mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
media updates for v4.2-rc1
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVi+2qAAoJEAhfPr2O5OEVJdUP/2JzjQ17fswt4JCqXZRMjSZi ZZThdFY5Cirs4lKovigTsBwoFFf0nZ5ti+8MpbrglKUBRQTOwWXP/KrJt4hCCikD nkcEPkATqlhCYNqxI/6TgUgvVODmTO6PtLbWYpnW64zi9zq0FM4Ko1h+s8ynB91O UeDXbn00G2ifMo9BXuzyms+uW7f1LI0+Fqhwf3t9QrO8DTjjEU5Km9teUPMrJmgn rcfCrj4c3uDX4Wh4xe1DEs6T7Cf6qRKG5BLjwm6uNO3RMsZ5sA6tgCdE6FonhGrF Kvso2NCLQggZg6mgvMXoazYmaqxeeXsy06GBkmrQ9Xx6jo5z+nyJAWwVn7awdt7R 89CWWn9MRrjhG3QLiluacJaH/5Z+fULSe6Stg2AVqfQGy/EwE7N2BR1CqO0i4pbN PredVtT77wyuDfUg6cYgJNjhhCcSt2i71X5Wt42rCZMylTGg3vWq//RqLo7xReaz XC0uhrJRDnF02BMzwQftUa8+UTn8Ozb7OyV91DzmZq9njsVHLAyY5u5Q/Fye5buH 4Ejcjou3edVPMKu7aBtOt4Bmnwc03jBLTlMTdBMeHQugaj3aTP7G7EcX2UAGq4SK 2e5GaYyIaAvpiddhBJzSzzd8u+XtRynKtFvfWnR+wTnILC+w+nfM/PbthVlXNJZx 4sUv1XmWxbJT3T7wJ8xE =iJ/U -----END PGP SIGNATURE----- Merge tag 'media/v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - Lots of improvements at the DVB API DocBook documentation. Now, the frontend and the network APIs are fully in sync with the Kernel and looks more like the rest of the media documentation; - New frontend driver: cx24120 - New driver for a PCI device: cobalt. This driver is actually not sold in the market, but it is a good example of a multi-HDMI input device; - The dt3155 driver were promoted from staging; - The mantis driver got remote controller support; - New V4L2 driver for ST bdisp SoC chipsets; - Make sparse and smatch happier: several bugs were solved by fixing the issues reported by those static code analyzers. - Lots of new device additions, new features, improvements and cleanups at the existing drivers. * tag 'media/v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (553 commits) [media] lmedm04: fix the range for relative measurements [media] lmedm04: use u32 instead of u64 for relative stats [media] omap3isp: remove unused var [media] saa7134: fix page size on some archs [media] use CONFIG_PM_SLEEP for suspend/resume [media] tuner-i2c: be consistent with I2C declaration [media] si470x: cleanup define namespace [media] bdisp: prevent compiling on random arch [media] vb2: Don't WARN when v4l2_buffer.bytesused is 0 for multiplanar buffers [media] MAINTAINERS: Add entry for the Renesas VSP1 driver [media] videodev2.h: fix copy-and-paste error in V4L2_MAP_XFER_FUNC_DEFAULT [media] Revert "[media] vb2: Push mmap_sem down to memops" [media] mantis: cleanup a warning [media] bdisp-debug: don't try to divide by s64 [media] cx88: don't declare restart_video_queue if not used [media] au0828: move dev->boards atribuition to happen earlier [media] lmedm04: implement dvb v5 statistics [media] bdisp: remove unused var [media] bdisp: remove needless check ts2020: fix compilation on i386 ...
This commit is contained in:
commit
5b4ca44477
571 changed files with 27333 additions and 10259 deletions
|
|
@ -95,7 +95,7 @@ config MEDIA_CONTROLLER
|
|||
This API is mostly used by camera interfaces in embedded platforms.
|
||||
|
||||
config MEDIA_CONTROLLER_DVB
|
||||
bool "Enable Media controller for DVB"
|
||||
bool "Enable Media controller for DVB (EXPERIMENTAL)"
|
||||
depends on MEDIA_CONTROLLER
|
||||
depends on BROKEN
|
||||
---help---
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ config DVB_B2C2_FLEXCOP
|
|||
select DVB_S5H1420 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select DVB_TUNER_ITD1000 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select DVB_ISL6421 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select DVB_CX24120 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select DVB_CX24123 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT
|
||||
select DVB_TUNER_CX24113 if MEDIA_SUBDRV_AUTOSELECT
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ struct flexcop_device {
|
|||
int feedcount;
|
||||
int pid_filtering;
|
||||
int fullts_streaming_state;
|
||||
int skip_6_hw_pid_filter;
|
||||
|
||||
/* bus specific callbacks */
|
||||
flexcop_ibi_value(*read_ibi_reg) (struct flexcop_device *,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "cx24113.h"
|
||||
#include "cx24123.h"
|
||||
#include "isl6421.h"
|
||||
#include "cx24120.h"
|
||||
#include "mt352.h"
|
||||
#include "bcm3510.h"
|
||||
#include "nxt200x.h"
|
||||
|
|
@ -26,9 +27,20 @@
|
|||
#define FE_SUPPORTED(fe) (defined(CONFIG_DVB_##fe) || \
|
||||
(defined(CONFIG_DVB_##fe##_MODULE) && defined(MODULE)))
|
||||
|
||||
#if FE_SUPPORTED(BCM3510) || (FE_SUPPORTED(CX24120) && FE_SUPPORTED(ISL6421))
|
||||
static int flexcop_fe_request_firmware(struct dvb_frontend *fe,
|
||||
const struct firmware **fw, char *name)
|
||||
{
|
||||
struct flexcop_device *fc = fe->dvb->priv;
|
||||
|
||||
return request_firmware(fw, name, fc->dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* lnb control */
|
||||
#if FE_SUPPORTED(MT312) || FE_SUPPORTED(STV0299)
|
||||
static int flexcop_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
||||
static int flexcop_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct flexcop_device *fc = fe->dvb->priv;
|
||||
flexcop_ibi_value v;
|
||||
|
|
@ -67,7 +79,7 @@ static int flexcop_sleep(struct dvb_frontend* fe)
|
|||
|
||||
/* SkyStar2 DVB-S rev 2.3 */
|
||||
#if FE_SUPPORTED(MT312) && FE_SUPPORTED(PLL)
|
||||
static int flexcop_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
||||
static int flexcop_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
|
||||
{
|
||||
/* u16 wz_half_period_for_45_mhz[] = { 0x01ff, 0x0154, 0x00ff, 0x00cc }; */
|
||||
struct flexcop_device *fc = fe->dvb->priv;
|
||||
|
|
@ -146,7 +158,7 @@ static int flexcop_diseqc_send_master_cmd(struct dvb_frontend *fe,
|
|||
}
|
||||
|
||||
static int flexcop_diseqc_send_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t minicmd)
|
||||
enum fe_sec_mini_cmd minicmd)
|
||||
{
|
||||
return flexcop_send_diseqc_msg(fe, 0, NULL, minicmd);
|
||||
}
|
||||
|
|
@ -445,13 +457,6 @@ static int airstar_dvbt_attach(struct flexcop_device *fc,
|
|||
|
||||
/* AirStar ATSC 1st generation */
|
||||
#if FE_SUPPORTED(BCM3510)
|
||||
static int flexcop_fe_request_firmware(struct dvb_frontend *fe,
|
||||
const struct firmware **fw, char* name)
|
||||
{
|
||||
struct flexcop_device *fc = fe->dvb->priv;
|
||||
return request_firmware(fw, name, fc->dev);
|
||||
}
|
||||
|
||||
static struct bcm3510_config air2pc_atsc_first_gen_config = {
|
||||
.demod_address = 0x0f,
|
||||
.request_firmware = flexcop_fe_request_firmware,
|
||||
|
|
@ -619,6 +624,43 @@ fail:
|
|||
#define cablestar2_attach NULL
|
||||
#endif
|
||||
|
||||
/* SkyStar S2 PCI DVB-S/S2 card based on Conexant cx24120/cx24118 */
|
||||
#if FE_SUPPORTED(CX24120) && FE_SUPPORTED(ISL6421)
|
||||
static const struct cx24120_config skystar2_rev3_3_cx24120_config = {
|
||||
.i2c_addr = 0x55,
|
||||
.xtal_khz = 10111,
|
||||
.initial_mpeg_config = { 0xa1, 0x76, 0x07 },
|
||||
.request_firmware = flexcop_fe_request_firmware,
|
||||
.i2c_wr_max = 4,
|
||||
};
|
||||
|
||||
static int skystarS2_rev33_attach(struct flexcop_device *fc,
|
||||
struct i2c_adapter *i2c)
|
||||
{
|
||||
fc->fe = dvb_attach(cx24120_attach,
|
||||
&skystar2_rev3_3_cx24120_config, i2c);
|
||||
if (!fc->fe)
|
||||
return 0;
|
||||
|
||||
fc->dev_type = FC_SKYS2_REV33;
|
||||
fc->fc_i2c_adap[2].no_base_addr = 1;
|
||||
if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap,
|
||||
0x08, 0, 0, false)) {
|
||||
err("ISL6421 could NOT be attached!");
|
||||
fc->fc_i2c_adap[2].no_base_addr = 0;
|
||||
return 0;
|
||||
}
|
||||
info("ISL6421 successfully attached.");
|
||||
|
||||
if (fc->has_32_hw_pid_filter)
|
||||
fc->skip_6_hw_pid_filter = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
#define skystarS2_rev33_attach NULL
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
flexcop_device_type_t type;
|
||||
int (*attach)(struct flexcop_device *, struct i2c_adapter *);
|
||||
|
|
@ -632,6 +674,7 @@ static struct {
|
|||
{ FC_AIR_ATSC1, airstar_atsc1_attach },
|
||||
{ FC_CABLE, cablestar2_attach },
|
||||
{ FC_SKY_REV23, skystar2_rev23_attach },
|
||||
{ FC_SKYS2_REV33, skystarS2_rev33_attach },
|
||||
};
|
||||
|
||||
/* try to figure out the frontend */
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ static void flexcop_pid_control(struct flexcop_device *fc,
|
|||
deb_ts("setting pid: %5d %04x at index %d '%s'\n",
|
||||
pid, pid, index, onoff ? "on" : "off");
|
||||
|
||||
/* First 6 can be buggy - skip over them if option set */
|
||||
if (fc->skip_6_hw_pid_filter)
|
||||
index += 6;
|
||||
|
||||
/* We could use bit magic here to reduce source code size.
|
||||
* I decided against it, but to use the real register names */
|
||||
switch (index) {
|
||||
|
|
@ -170,7 +174,10 @@ static int flexcop_toggle_fullts_streaming(struct flexcop_device *fc, int onoff)
|
|||
int flexcop_pid_feed_control(struct flexcop_device *fc,
|
||||
struct dvb_demux_feed *dvbdmxfeed, int onoff)
|
||||
{
|
||||
int max_pid_filter = 6 + fc->has_32_hw_pid_filter*32;
|
||||
int max_pid_filter = 6;
|
||||
|
||||
max_pid_filter -= 6 * fc->skip_6_hw_pid_filter;
|
||||
max_pid_filter += 32 * fc->has_32_hw_pid_filter;
|
||||
|
||||
fc->feedcount += onoff ? 1 : -1; /* the number of PIDs/Feed currently requested */
|
||||
if (dvbdmxfeed->index >= max_pid_filter)
|
||||
|
|
@ -217,7 +224,12 @@ void flexcop_hw_filter_init(struct flexcop_device *fc)
|
|||
{
|
||||
int i;
|
||||
flexcop_ibi_value v;
|
||||
for (i = 0; i < 6 + 32*fc->has_32_hw_pid_filter; i++)
|
||||
int max_pid_filter = 6;
|
||||
|
||||
max_pid_filter -= 6 * fc->skip_6_hw_pid_filter;
|
||||
max_pid_filter += 32 * fc->has_32_hw_pid_filter;
|
||||
|
||||
for (i = 0; i < max_pid_filter; i++)
|
||||
flexcop_pid_control(fc, i, 0x1fff, 0);
|
||||
|
||||
flexcop_pid_group_filter(fc, 0, 0x1fe0);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ static const char *flexcop_device_names[] = {
|
|||
[FC_SKY_REV26] = "Sky2PC/SkyStar 2 DVB-S rev 2.6",
|
||||
[FC_SKY_REV27] = "Sky2PC/SkyStar 2 DVB-S rev 2.7a/u",
|
||||
[FC_SKY_REV28] = "Sky2PC/SkyStar 2 DVB-S rev 2.8",
|
||||
[FC_SKYS2_REV33] = "Sky2PC/SkyStar S2 DVB-S/S2 rev 3.3",
|
||||
};
|
||||
|
||||
static const char *flexcop_bus_names[] = {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ typedef enum {
|
|||
FC_SKY_REV26,
|
||||
FC_SKY_REV27,
|
||||
FC_SKY_REV28,
|
||||
FC_SKYS2_REV33,
|
||||
} flexcop_device_type_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -1010,6 +1010,7 @@ struct sms_rx_stats_ex {
|
|||
s32 mrc_in_band_pwr; /* In band power in dBM */
|
||||
};
|
||||
|
||||
#define SRVM_MAX_PID_FILTERS 8
|
||||
|
||||
/* statistics information returned as response for
|
||||
* SmsHostApiGetstatisticsEx_Req for DVB applications, SMS1100 and up */
|
||||
|
|
@ -1021,7 +1022,6 @@ struct sms_stats_dvb {
|
|||
struct sms_tx_stats transmission_data;
|
||||
|
||||
/* Burst parameters, valid only for DVB-H */
|
||||
#define SRVM_MAX_PID_FILTERS 8
|
||||
struct sms_pid_data pid_data[SRVM_MAX_PID_FILTERS];
|
||||
};
|
||||
|
||||
|
|
@ -1035,7 +1035,6 @@ struct sms_stats_dvb_ex {
|
|||
struct sms_tx_stats transmission_data;
|
||||
|
||||
/* Burst parameters, valid only for DVB-H */
|
||||
#define SRVM_MAX_PID_FILTERS 8
|
||||
struct sms_pid_data pid_data[SRVM_MAX_PID_FILTERS];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -753,7 +753,7 @@ static inline int led_feedback(struct smsdvb_client_t *client)
|
|||
SMS_LED_HI : SMS_LED_LO);
|
||||
}
|
||||
|
||||
static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat)
|
||||
static int smsdvb_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
{
|
||||
int rc;
|
||||
struct smsdvb_client_t *client;
|
||||
|
|
@ -900,7 +900,7 @@ static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe)
|
|||
/* Disable LNA, if any. An error is returned if no LNA is present */
|
||||
ret = sms_board_lna_control(client->coredev, 0);
|
||||
if (ret == 0) {
|
||||
fe_status_t status;
|
||||
enum fe_status status;
|
||||
|
||||
/* tune with LNA off at first */
|
||||
ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
||||
|
|
@ -971,7 +971,7 @@ static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
|
|||
/* Disable LNA, if any. An error is returned if no LNA is present */
|
||||
ret = sms_board_lna_control(client->coredev, 0);
|
||||
if (ret == 0) {
|
||||
fe_status_t status;
|
||||
enum fe_status status;
|
||||
|
||||
/* tune with LNA off at first */
|
||||
ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct smsdvb_client_t {
|
|||
struct dmxdev dmxdev;
|
||||
struct dvb_frontend frontend;
|
||||
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
|
||||
struct completion tune_done;
|
||||
struct completion stats_done;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
|
|||
dev->dev.parent = coredev->device;
|
||||
|
||||
#if 0
|
||||
/* TODO: properly initialize the parameters bellow */
|
||||
/* TODO: properly initialize the parameters below */
|
||||
dev->input_id.bustype = BUS_USB;
|
||||
dev->input_id.version = 1;
|
||||
dev->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include <linux/freezer.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#include "dvb_frontend.h"
|
||||
|
|
@ -110,7 +111,7 @@ struct dvb_frontend_private {
|
|||
struct task_struct *thread;
|
||||
unsigned long release_jiffies;
|
||||
unsigned int wakeup;
|
||||
fe_status_t status;
|
||||
enum fe_status status;
|
||||
unsigned long tune_mode_flags;
|
||||
unsigned int delay;
|
||||
unsigned int reinitialise;
|
||||
|
|
@ -198,7 +199,8 @@ static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system)
|
|||
}
|
||||
}
|
||||
|
||||
static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
|
||||
static void dvb_frontend_add_event(struct dvb_frontend *fe,
|
||||
enum fe_status status)
|
||||
{
|
||||
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||
struct dvb_fe_events *events = &fepriv->events;
|
||||
|
|
@ -429,7 +431,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra
|
|||
|
||||
static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
|
||||
{
|
||||
fe_status_t s = 0;
|
||||
enum fe_status s = 0;
|
||||
int retval = 0;
|
||||
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp;
|
||||
|
|
@ -690,7 +692,7 @@ static int dvb_frontend_thread(void *data)
|
|||
{
|
||||
struct dvb_frontend *fe = data;
|
||||
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||
fe_status_t s;
|
||||
enum fe_status s;
|
||||
enum dvbfe_algo algo;
|
||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||
int ret;
|
||||
|
|
@ -889,42 +891,21 @@ static void dvb_frontend_stop(struct dvb_frontend *fe)
|
|||
fepriv->thread);
|
||||
}
|
||||
|
||||
s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime)
|
||||
{
|
||||
return ((curtime.tv_usec < lasttime.tv_usec) ?
|
||||
1000000 - lasttime.tv_usec + curtime.tv_usec :
|
||||
curtime.tv_usec - lasttime.tv_usec);
|
||||
}
|
||||
EXPORT_SYMBOL(timeval_usec_diff);
|
||||
|
||||
static inline void timeval_usec_add(struct timeval *curtime, u32 add_usec)
|
||||
{
|
||||
curtime->tv_usec += add_usec;
|
||||
if (curtime->tv_usec >= 1000000) {
|
||||
curtime->tv_usec -= 1000000;
|
||||
curtime->tv_sec++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Sleep until gettimeofday() > waketime + add_usec
|
||||
* This needs to be as precise as possible, but as the delay is
|
||||
* usually between 2ms and 32ms, it is done using a scheduled msleep
|
||||
* followed by usleep (normally a busy-wait loop) for the remainder
|
||||
*/
|
||||
void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec)
|
||||
void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec)
|
||||
{
|
||||
struct timeval lasttime;
|
||||
s32 delta, newdelta;
|
||||
|
||||
timeval_usec_add(waketime, add_usec);
|
||||
|
||||
do_gettimeofday(&lasttime);
|
||||
delta = timeval_usec_diff(lasttime, *waketime);
|
||||
ktime_add_us(*waketime, add_usec);
|
||||
delta = ktime_us_delta(ktime_get_real(), *waketime);
|
||||
if (delta > 2500) {
|
||||
msleep((delta - 1500) / 1000);
|
||||
do_gettimeofday(&lasttime);
|
||||
newdelta = timeval_usec_diff(lasttime, *waketime);
|
||||
newdelta = ktime_us_delta(ktime_get_real(), *waketime);
|
||||
delta = (newdelta > delta) ? 0 : newdelta;
|
||||
}
|
||||
if (delta > 0)
|
||||
|
|
@ -2216,7 +2197,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
|
|||
break;
|
||||
}
|
||||
if (rolloff)
|
||||
c->bandwidth_hz = (c->symbol_rate * rolloff) / 100;
|
||||
c->bandwidth_hz = mult_frac(c->symbol_rate, rolloff, 100);
|
||||
|
||||
/* force auto frequency inversion if requested */
|
||||
if (dvb_force_auto_inversion)
|
||||
|
|
@ -2341,7 +2322,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
}
|
||||
|
||||
case FE_READ_STATUS: {
|
||||
fe_status_t* status = parg;
|
||||
enum fe_status *status = parg;
|
||||
|
||||
/* if retune was requested but hasn't occurred yet, prevent
|
||||
* that user get signal state from previous tuning */
|
||||
|
|
@ -2403,7 +2384,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
|
||||
case FE_DISEQC_SEND_MASTER_CMD:
|
||||
if (fe->ops.diseqc_send_master_cmd) {
|
||||
err = fe->ops.diseqc_send_master_cmd(fe, (struct dvb_diseqc_master_cmd*) parg);
|
||||
struct dvb_diseqc_master_cmd *cmd = parg;
|
||||
|
||||
if (cmd->msg_len > sizeof(cmd->msg)) {
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
err = fe->ops.diseqc_send_master_cmd(fe, cmd);
|
||||
fepriv->state = FESTATE_DISEQC;
|
||||
fepriv->status = 0;
|
||||
}
|
||||
|
|
@ -2411,7 +2398,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
|
||||
case FE_DISEQC_SEND_BURST:
|
||||
if (fe->ops.diseqc_send_burst) {
|
||||
err = fe->ops.diseqc_send_burst(fe, (fe_sec_mini_cmd_t) parg);
|
||||
err = fe->ops.diseqc_send_burst(fe,
|
||||
(enum fe_sec_mini_cmd)parg);
|
||||
fepriv->state = FESTATE_DISEQC;
|
||||
fepriv->status = 0;
|
||||
}
|
||||
|
|
@ -2419,8 +2407,9 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
|
||||
case FE_SET_TONE:
|
||||
if (fe->ops.set_tone) {
|
||||
err = fe->ops.set_tone(fe, (fe_sec_tone_mode_t) parg);
|
||||
fepriv->tone = (fe_sec_tone_mode_t) parg;
|
||||
err = fe->ops.set_tone(fe,
|
||||
(enum fe_sec_tone_mode)parg);
|
||||
fepriv->tone = (enum fe_sec_tone_mode)parg;
|
||||
fepriv->state = FESTATE_DISEQC;
|
||||
fepriv->status = 0;
|
||||
}
|
||||
|
|
@ -2428,8 +2417,9 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
|
||||
case FE_SET_VOLTAGE:
|
||||
if (fe->ops.set_voltage) {
|
||||
err = fe->ops.set_voltage(fe, (fe_sec_voltage_t) parg);
|
||||
fepriv->voltage = (fe_sec_voltage_t) parg;
|
||||
err = fe->ops.set_voltage(fe,
|
||||
(enum fe_sec_voltage)parg);
|
||||
fepriv->voltage = (enum fe_sec_voltage)parg;
|
||||
fepriv->state = FESTATE_DISEQC;
|
||||
fepriv->status = 0;
|
||||
}
|
||||
|
|
@ -2437,7 +2427,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
|
||||
case FE_DISHNETWORK_SEND_LEGACY_CMD:
|
||||
if (fe->ops.dishnetwork_send_legacy_command) {
|
||||
err = fe->ops.dishnetwork_send_legacy_command(fe, (unsigned long) parg);
|
||||
err = fe->ops.dishnetwork_send_legacy_command(fe,
|
||||
(unsigned long)parg);
|
||||
fepriv->state = FESTATE_DISEQC;
|
||||
fepriv->status = 0;
|
||||
} else if (fe->ops.set_voltage) {
|
||||
|
|
@ -2458,13 +2449,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
* include the initialization or start bit
|
||||
*/
|
||||
unsigned long swcmd = ((unsigned long) parg) << 1;
|
||||
struct timeval nexttime;
|
||||
struct timeval tv[10];
|
||||
ktime_t nexttime;
|
||||
ktime_t tv[10];
|
||||
int i;
|
||||
u8 last = 1;
|
||||
if (dvb_frontend_debug)
|
||||
printk("%s switch command: 0x%04lx\n", __func__, swcmd);
|
||||
do_gettimeofday(&nexttime);
|
||||
nexttime = ktime_get_real();
|
||||
if (dvb_frontend_debug)
|
||||
tv[0] = nexttime;
|
||||
/* before sending a command, initialize by sending
|
||||
|
|
@ -2475,7 +2466,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
|
||||
for (i = 0; i < 9; i++) {
|
||||
if (dvb_frontend_debug)
|
||||
do_gettimeofday(&tv[i + 1]);
|
||||
tv[i+1] = ktime_get_real();
|
||||
if ((swcmd & 0x01) != last) {
|
||||
/* set voltage to (last ? 13V : 18V) */
|
||||
fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18);
|
||||
|
|
@ -2489,7 +2480,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
|||
printk("%s(%d): switch delay (should be 32k followed by all 8k\n",
|
||||
__func__, fe->dvb->num);
|
||||
for (i = 1; i < 10; i++)
|
||||
printk("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i]));
|
||||
printk("%d: %d\n", i,
|
||||
(int) ktime_us_delta(tv[i], tv[i-1]));
|
||||
}
|
||||
err = 0;
|
||||
fepriv->state = FESTATE_DISEQC;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ struct dvb_frontend_ops {
|
|||
bool re_tune,
|
||||
unsigned int mode_flags,
|
||||
unsigned int *delay,
|
||||
fe_status_t *status);
|
||||
enum fe_status *status);
|
||||
/* get frontend tuning algorithm from the module */
|
||||
enum dvbfe_algo (*get_frontend_algo)(struct dvb_frontend *fe);
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ struct dvb_frontend_ops {
|
|||
|
||||
int (*get_frontend)(struct dvb_frontend *fe);
|
||||
|
||||
int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
|
||||
int (*read_status)(struct dvb_frontend *fe, enum fe_status *status);
|
||||
int (*read_ber)(struct dvb_frontend* fe, u32* ber);
|
||||
int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength);
|
||||
int (*read_snr)(struct dvb_frontend* fe, u16* snr);
|
||||
|
|
@ -298,9 +298,11 @@ struct dvb_frontend_ops {
|
|||
int (*diseqc_reset_overload)(struct dvb_frontend* fe);
|
||||
int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
|
||||
int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply);
|
||||
int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
|
||||
int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
|
||||
int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
|
||||
int (*diseqc_send_burst)(struct dvb_frontend *fe,
|
||||
enum fe_sec_mini_cmd minicmd);
|
||||
int (*set_tone)(struct dvb_frontend *fe, enum fe_sec_tone_mode tone);
|
||||
int (*set_voltage)(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage);
|
||||
int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
|
||||
int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
|
||||
int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
|
||||
|
|
@ -338,24 +340,24 @@ struct dtv_frontend_properties {
|
|||
u32 state;
|
||||
|
||||
u32 frequency;
|
||||
fe_modulation_t modulation;
|
||||
enum fe_modulation modulation;
|
||||
|
||||
fe_sec_voltage_t voltage;
|
||||
fe_sec_tone_mode_t sectone;
|
||||
fe_spectral_inversion_t inversion;
|
||||
fe_code_rate_t fec_inner;
|
||||
fe_transmit_mode_t transmission_mode;
|
||||
enum fe_sec_voltage voltage;
|
||||
enum fe_sec_tone_mode sectone;
|
||||
enum fe_spectral_inversion inversion;
|
||||
enum fe_code_rate fec_inner;
|
||||
enum fe_transmit_mode transmission_mode;
|
||||
u32 bandwidth_hz; /* 0 = AUTO */
|
||||
fe_guard_interval_t guard_interval;
|
||||
fe_hierarchy_t hierarchy;
|
||||
enum fe_guard_interval guard_interval;
|
||||
enum fe_hierarchy hierarchy;
|
||||
u32 symbol_rate;
|
||||
fe_code_rate_t code_rate_HP;
|
||||
fe_code_rate_t code_rate_LP;
|
||||
enum fe_code_rate code_rate_HP;
|
||||
enum fe_code_rate code_rate_LP;
|
||||
|
||||
fe_pilot_t pilot;
|
||||
fe_rolloff_t rolloff;
|
||||
enum fe_pilot pilot;
|
||||
enum fe_rolloff rolloff;
|
||||
|
||||
fe_delivery_system_t delivery_system;
|
||||
enum fe_delivery_system delivery_system;
|
||||
|
||||
enum fe_interleaving interleaving;
|
||||
|
||||
|
|
@ -368,8 +370,8 @@ struct dtv_frontend_properties {
|
|||
u8 isdbt_layer_enabled;
|
||||
struct {
|
||||
u8 segment_count;
|
||||
fe_code_rate_t fec;
|
||||
fe_modulation_t modulation;
|
||||
enum fe_code_rate fec;
|
||||
enum fe_modulation modulation;
|
||||
u8 interleaving;
|
||||
} layer[3];
|
||||
|
||||
|
|
@ -439,7 +441,6 @@ extern void dvb_frontend_reinitialise(struct dvb_frontend *fe);
|
|||
extern int dvb_frontend_suspend(struct dvb_frontend *fe);
|
||||
extern int dvb_frontend_resume(struct dvb_frontend *fe);
|
||||
|
||||
extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec);
|
||||
extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime);
|
||||
extern void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -36,8 +36,9 @@ config DVB_STV6110x
|
|||
A Silicon tuner that supports DVB-S and DVB-S2 modes
|
||||
|
||||
config DVB_M88DS3103
|
||||
tristate "Montage M88DS3103"
|
||||
tristate "Montage Technology M88DS3103"
|
||||
depends on DVB_CORE && I2C && I2C_MUX
|
||||
select REGMAP_I2C
|
||||
default m if !MEDIA_SUBDRV_AUTOSELECT
|
||||
help
|
||||
Say Y when you want to support this frontend.
|
||||
|
|
@ -223,6 +224,13 @@ config DVB_CX24117
|
|||
help
|
||||
A Dual DVB-S/S2 tuner module. Say Y when you want to support this frontend.
|
||||
|
||||
config DVB_CX24120
|
||||
tristate "Conexant CX24120 based"
|
||||
depends on DVB_CORE && I2C
|
||||
default m if !MEDIA_SUBDRV_AUTOSELECT
|
||||
help
|
||||
A DVB-S/S2 tuner module. Say Y when you want to support this frontend.
|
||||
|
||||
config DVB_SI21XX
|
||||
tristate "Silicon Labs SI21XX based"
|
||||
depends on DVB_CORE && I2C
|
||||
|
|
@ -232,7 +240,8 @@ config DVB_SI21XX
|
|||
|
||||
config DVB_TS2020
|
||||
tristate "Montage Tehnology TS2020 based tuners"
|
||||
depends on DVB_CORE && I2C
|
||||
depends on DVB_CORE
|
||||
select REGMAP_I2C
|
||||
default m if !MEDIA_SUBDRV_AUTOSELECT
|
||||
help
|
||||
A DVB-S/S2 silicon tuner. Say Y when you want to support this tuner.
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ obj-$(CONFIG_DVB_DUMMY_FE) += dvb_dummy_fe.o
|
|||
obj-$(CONFIG_DVB_AF9013) += af9013.o
|
||||
obj-$(CONFIG_DVB_CX24116) += cx24116.o
|
||||
obj-$(CONFIG_DVB_CX24117) += cx24117.o
|
||||
obj-$(CONFIG_DVB_CX24120) += cx24120.o
|
||||
obj-$(CONFIG_DVB_SI21XX) += si21xx.o
|
||||
obj-$(CONFIG_DVB_SI2168) += si2168.o
|
||||
obj-$(CONFIG_DVB_STV0288) += stv0288.o
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
#include "a8293.h"
|
||||
|
||||
struct a8293_priv {
|
||||
u8 i2c_addr;
|
||||
struct i2c_adapter *i2c;
|
||||
const struct a8293_config *cfg;
|
||||
struct i2c_client *client;
|
||||
u8 reg[2];
|
||||
};
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ static int a8293_i2c(struct a8293_priv *priv, u8 *val, int len, bool rd)
|
|||
int ret;
|
||||
struct i2c_msg msg[1] = {
|
||||
{
|
||||
.addr = priv->cfg->i2c_addr,
|
||||
.addr = priv->i2c_addr,
|
||||
.len = len,
|
||||
.buf = val,
|
||||
}
|
||||
|
|
@ -66,7 +67,7 @@ static int a8293_rd(struct a8293_priv *priv, u8 *val, int len)
|
|||
}
|
||||
|
||||
static int a8293_set_voltage(struct dvb_frontend *fe,
|
||||
fe_sec_voltage_t fe_sec_voltage)
|
||||
enum fe_sec_voltage fe_sec_voltage)
|
||||
{
|
||||
struct a8293_priv *priv = fe->sec_priv;
|
||||
int ret;
|
||||
|
|
@ -128,7 +129,7 @@ struct dvb_frontend *a8293_attach(struct dvb_frontend *fe,
|
|||
|
||||
/* setup the priv */
|
||||
priv->i2c = i2c;
|
||||
priv->cfg = cfg;
|
||||
priv->i2c_addr = cfg->i2c_addr;
|
||||
fe->sec_priv = priv;
|
||||
|
||||
/* check if the SEC is there */
|
||||
|
|
@ -164,6 +165,86 @@ err:
|
|||
}
|
||||
EXPORT_SYMBOL(a8293_attach);
|
||||
|
||||
static int a8293_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct a8293_priv *dev;
|
||||
struct a8293_platform_data *pdata = client->dev.platform_data;
|
||||
struct dvb_frontend *fe = pdata->dvb_frontend;
|
||||
int ret;
|
||||
u8 buf[2];
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
dev->client = client;
|
||||
dev->i2c = client->adapter;
|
||||
dev->i2c_addr = client->addr;
|
||||
|
||||
/* check if the SEC is there */
|
||||
ret = a8293_rd(dev, buf, 2);
|
||||
if (ret)
|
||||
goto err_kfree;
|
||||
|
||||
/* ENB=0 */
|
||||
dev->reg[0] = 0x10;
|
||||
ret = a8293_wr(dev, &dev->reg[0], 1);
|
||||
if (ret)
|
||||
goto err_kfree;
|
||||
|
||||
/* TMODE=0, TGATE=1 */
|
||||
dev->reg[1] = 0x82;
|
||||
ret = a8293_wr(dev, &dev->reg[1], 1);
|
||||
if (ret)
|
||||
goto err_kfree;
|
||||
|
||||
/* override frontend ops */
|
||||
fe->ops.set_voltage = a8293_set_voltage;
|
||||
|
||||
fe->sec_priv = dev;
|
||||
i2c_set_clientdata(client, dev);
|
||||
|
||||
dev_info(&client->dev, "Allegro A8293 SEC successfully attached\n");
|
||||
return 0;
|
||||
err_kfree:
|
||||
kfree(dev);
|
||||
err:
|
||||
dev_dbg(&client->dev, "failed=%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int a8293_remove(struct i2c_client *client)
|
||||
{
|
||||
struct a8293_dev *dev = i2c_get_clientdata(client);
|
||||
|
||||
dev_dbg(&client->dev, "\n");
|
||||
|
||||
kfree(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id a8293_id_table[] = {
|
||||
{"a8293", 0},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, a8293_id_table);
|
||||
|
||||
static struct i2c_driver a8293_driver = {
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "a8293",
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
.probe = a8293_probe,
|
||||
.remove = a8293_remove,
|
||||
.id_table = a8293_id_table,
|
||||
};
|
||||
|
||||
module_i2c_driver(a8293_driver);
|
||||
|
||||
MODULE_AUTHOR("Antti Palosaari <[email protected]>");
|
||||
MODULE_DESCRIPTION("Allegro A8293 SEC driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -21,8 +21,23 @@
|
|||
#ifndef A8293_H
|
||||
#define A8293_H
|
||||
|
||||
#include "dvb_frontend.h"
|
||||
#include <linux/kconfig.h>
|
||||
|
||||
/*
|
||||
* I2C address
|
||||
* 0x08, 0x09, 0x0a, 0x0b
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct a8293_platform_data - Platform data for the a8293 driver
|
||||
* @dvb_frontend: DVB frontend.
|
||||
*/
|
||||
struct a8293_platform_data {
|
||||
struct dvb_frontend *dvb_frontend;
|
||||
};
|
||||
|
||||
|
||||
struct a8293_config {
|
||||
u8 i2c_addr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct af9013_state {
|
|||
u32 ucblocks;
|
||||
u16 snr;
|
||||
u32 bandwidth_hz;
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
unsigned long set_frontend_jiffies;
|
||||
unsigned long read_status_jiffies;
|
||||
bool first_tune;
|
||||
|
|
@ -605,6 +605,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
|
|||
}
|
||||
}
|
||||
|
||||
/* Return an error if can't find bandwidth or the right clock */
|
||||
if (i == ARRAY_SIZE(coeff_lut))
|
||||
return -EINVAL;
|
||||
|
||||
ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val,
|
||||
sizeof(coeff_lut[i].val));
|
||||
}
|
||||
|
|
@ -979,7 +983,7 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int af9013_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct af9013_state *state = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct af9033_dev {
|
|||
bool ts_mode_parallel;
|
||||
bool ts_mode_serial;
|
||||
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
u64 post_bit_error_prev; /* for old read_ber we return (curr - prev) */
|
||||
u64 post_bit_error;
|
||||
u64 post_bit_count;
|
||||
|
|
@ -818,7 +818,7 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int af9033_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int af9033_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct af9033_dev *dev = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct as102_state {
|
|||
uint32_t ber;
|
||||
};
|
||||
|
||||
static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg)
|
||||
static uint8_t as102_fe_get_code_rate(enum fe_code_rate arg)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ static int as102_fe_get_tune_settings(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int as102_fe_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
int ret = 0;
|
||||
struct as102_state *state = fe->demodulator_priv;
|
||||
|
|
|
|||
|
|
@ -335,7 +335,8 @@ static int atbm8830_get_tune_settings(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int atbm8830_read_status(struct dvb_frontend *fe, fe_status_t *fe_status)
|
||||
static int atbm8830_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *fe_status)
|
||||
{
|
||||
struct atbm_state *priv = fe->demodulator_priv;
|
||||
u8 locked = 0;
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ static struct {
|
|||
};
|
||||
|
||||
static int au8522_enable_modulation(struct dvb_frontend *fe,
|
||||
fe_modulation_t m)
|
||||
enum fe_modulation m)
|
||||
{
|
||||
struct au8522_state *state = fe->demodulator_priv;
|
||||
int i;
|
||||
|
|
@ -644,7 +644,7 @@ static int au8522_set_frontend(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int au8522_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct au8522_state *state = fe->demodulator_priv;
|
||||
u8 reg;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct au8522_state {
|
|||
struct dvb_frontend frontend;
|
||||
|
||||
u32 current_frequency;
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
|
||||
u32 fe_status;
|
||||
unsigned int led_state;
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ static int bcm3510_refresh_state(struct bcm3510_state *st)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int bcm3510_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int bcm3510_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct bcm3510_state* st = fe->demodulator_priv;
|
||||
bcm3510_refresh_state(st);
|
||||
|
|
@ -685,7 +685,7 @@ static int bcm3510_reset(struct bcm3510_state *st)
|
|||
if ((ret = bcm3510_writeB(st,0xa0,v)) < 0)
|
||||
return ret;
|
||||
|
||||
t = jiffies + 3*HZ;
|
||||
t = jiffies + 3*HZ;
|
||||
while (time_before(jiffies, t)) {
|
||||
msleep(10);
|
||||
if ((ret = bcm3510_readB(st,0xa2,&v)) < 0)
|
||||
|
|
@ -708,7 +708,7 @@ static int bcm3510_clear_reset(struct bcm3510_state *st)
|
|||
if ((ret = bcm3510_writeB(st,0xa0,v)) < 0)
|
||||
return ret;
|
||||
|
||||
t = jiffies + 3*HZ;
|
||||
t = jiffies + 3*HZ;
|
||||
while (time_before(jiffies, t)) {
|
||||
msleep(10);
|
||||
if ((ret = bcm3510_readB(st,0xa2,&v)) < 0)
|
||||
|
|
|
|||
|
|
@ -191,9 +191,10 @@ static int cx22700_set_tps(struct cx22700_state *state,
|
|||
static int cx22700_get_tps(struct cx22700_state *state,
|
||||
struct dtv_frontend_properties *p)
|
||||
{
|
||||
static const fe_modulation_t qam_tab [3] = { QPSK, QAM_16, QAM_64 };
|
||||
static const fe_code_rate_t fec_tab [5] = { FEC_1_2, FEC_2_3, FEC_3_4,
|
||||
FEC_5_6, FEC_7_8 };
|
||||
static const enum fe_modulation qam_tab[3] = { QPSK, QAM_16, QAM_64 };
|
||||
static const enum fe_code_rate fec_tab[5] = {
|
||||
FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8
|
||||
};
|
||||
u8 val;
|
||||
|
||||
dprintk ("%s\n", __func__);
|
||||
|
|
@ -253,7 +254,7 @@ static int cx22700_init (struct dvb_frontend* fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx22700_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int cx22700_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cx22700_state* state = fe->demodulator_priv;
|
||||
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ static int cx22702_init(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx22702_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int cx22702_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cx22702_state *state = fe->demodulator_priv;
|
||||
u8 reg0A;
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@ static int cx24110_readreg (struct cx24110_state* state, u8 reg)
|
|||
return b1[0];
|
||||
}
|
||||
|
||||
static int cx24110_set_inversion (struct cx24110_state* state, fe_spectral_inversion_t inversion)
|
||||
static int cx24110_set_inversion(struct cx24110_state *state,
|
||||
enum fe_spectral_inversion inversion)
|
||||
{
|
||||
/* fixme (low): error handling */
|
||||
|
||||
|
|
@ -177,7 +178,7 @@ static int cx24110_set_inversion (struct cx24110_state* state, fe_spectral_inver
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24110_set_fec(struct cx24110_state* state, fe_code_rate_t fec)
|
||||
static int cx24110_set_fec(struct cx24110_state *state, enum fe_code_rate fec)
|
||||
{
|
||||
static const int rate[FEC_AUTO] = {-1, 1, 2, 3, 5, 7, -1};
|
||||
static const int g1[FEC_AUTO] = {-1, 0x01, 0x02, 0x05, 0x15, 0x45, -1};
|
||||
|
|
@ -220,7 +221,7 @@ static int cx24110_set_fec(struct cx24110_state* state, fe_code_rate_t fec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static fe_code_rate_t cx24110_get_fec (struct cx24110_state* state)
|
||||
static enum fe_code_rate cx24110_get_fec(struct cx24110_state *state)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -365,7 +366,8 @@ static int cx24110_initfe(struct dvb_frontend* fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage)
|
||||
static int cx24110_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct cx24110_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -379,7 +381,8 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
|
|||
}
|
||||
}
|
||||
|
||||
static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
|
||||
static int cx24110_diseqc_send_burst(struct dvb_frontend *fe,
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
int rv, bit;
|
||||
struct cx24110_state *state = fe->demodulator_priv;
|
||||
|
|
@ -434,7 +437,8 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24110_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int cx24110_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct cx24110_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -574,7 +578,8 @@ static int cx24110_get_frontend(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24110_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
|
||||
static int cx24110_set_tone(struct dvb_frontend *fe,
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct cx24110_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
|
|||
|
|
@ -160,13 +160,13 @@ enum cmds {
|
|||
struct cx24116_tuning {
|
||||
u32 frequency;
|
||||
u32 symbol_rate;
|
||||
fe_spectral_inversion_t inversion;
|
||||
fe_code_rate_t fec;
|
||||
enum fe_spectral_inversion inversion;
|
||||
enum fe_code_rate fec;
|
||||
|
||||
fe_delivery_system_t delsys;
|
||||
fe_modulation_t modulation;
|
||||
fe_pilot_t pilot;
|
||||
fe_rolloff_t rolloff;
|
||||
enum fe_delivery_system delsys;
|
||||
enum fe_modulation modulation;
|
||||
enum fe_pilot pilot;
|
||||
enum fe_rolloff rolloff;
|
||||
|
||||
/* Demod values */
|
||||
u8 fec_val;
|
||||
|
|
@ -285,7 +285,7 @@ static int cx24116_readreg(struct cx24116_state *state, u8 reg)
|
|||
}
|
||||
|
||||
static int cx24116_set_inversion(struct cx24116_state *state,
|
||||
fe_spectral_inversion_t inversion)
|
||||
enum fe_spectral_inversion inversion)
|
||||
{
|
||||
dprintk("%s(%d)\n", __func__, inversion);
|
||||
|
||||
|
|
@ -373,9 +373,9 @@ static int cx24116_set_inversion(struct cx24116_state *state,
|
|||
* a scheme are support. Especially, no auto detect when in S2 mode.
|
||||
*/
|
||||
static struct cx24116_modfec {
|
||||
fe_delivery_system_t delivery_system;
|
||||
fe_modulation_t modulation;
|
||||
fe_code_rate_t fec;
|
||||
enum fe_delivery_system delivery_system;
|
||||
enum fe_modulation modulation;
|
||||
enum fe_code_rate fec;
|
||||
u8 mask; /* In DVBS mode this is used to autodetect */
|
||||
u8 val; /* Passed to the firmware to indicate mode selection */
|
||||
} CX24116_MODFEC_MODES[] = {
|
||||
|
|
@ -415,7 +415,7 @@ static struct cx24116_modfec {
|
|||
};
|
||||
|
||||
static int cx24116_lookup_fecmod(struct cx24116_state *state,
|
||||
fe_delivery_system_t d, fe_modulation_t m, fe_code_rate_t f)
|
||||
enum fe_delivery_system d, enum fe_modulation m, enum fe_code_rate f)
|
||||
{
|
||||
int i, ret = -EOPNOTSUPP;
|
||||
|
||||
|
|
@ -434,7 +434,9 @@ static int cx24116_lookup_fecmod(struct cx24116_state *state,
|
|||
}
|
||||
|
||||
static int cx24116_set_fec(struct cx24116_state *state,
|
||||
fe_delivery_system_t delsys, fe_modulation_t mod, fe_code_rate_t fec)
|
||||
enum fe_delivery_system delsys,
|
||||
enum fe_modulation mod,
|
||||
enum fe_code_rate fec)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
|
@ -683,7 +685,7 @@ static int cx24116_load_firmware(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24116_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int cx24116_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cx24116_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -844,7 +846,7 @@ static int cx24116_wait_for_lnb(struct dvb_frontend *fe)
|
|||
}
|
||||
|
||||
static int cx24116_set_voltage(struct dvb_frontend *fe,
|
||||
fe_sec_voltage_t voltage)
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct cx24116_cmd cmd;
|
||||
int ret;
|
||||
|
|
@ -872,7 +874,7 @@ static int cx24116_set_voltage(struct dvb_frontend *fe,
|
|||
}
|
||||
|
||||
static int cx24116_set_tone(struct dvb_frontend *fe,
|
||||
fe_sec_tone_mode_t tone)
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct cx24116_cmd cmd;
|
||||
int ret;
|
||||
|
|
@ -963,6 +965,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
struct cx24116_state *state = fe->demodulator_priv;
|
||||
int i, ret;
|
||||
|
||||
/* Validate length */
|
||||
if (d->msg_len > sizeof(d->msg))
|
||||
return -EINVAL;
|
||||
|
||||
/* Dump DiSEqC message */
|
||||
if (debug) {
|
||||
printk(KERN_INFO "cx24116: %s(", __func__);
|
||||
|
|
@ -974,10 +980,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
printk(") toneburst=%d\n", toneburst);
|
||||
}
|
||||
|
||||
/* Validate length */
|
||||
if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS))
|
||||
return -EINVAL;
|
||||
|
||||
/* DiSEqC message */
|
||||
for (i = 0; i < d->msg_len; i++)
|
||||
state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];
|
||||
|
|
@ -1055,7 +1057,7 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
|
||||
/* Send DiSEqC burst */
|
||||
static int cx24116_diseqc_send_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t burst)
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct cx24116_state *state = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
@ -1220,7 +1222,7 @@ static int cx24116_set_frontend(struct dvb_frontend *fe)
|
|||
struct cx24116_state *state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
struct cx24116_cmd cmd;
|
||||
fe_status_t tunerstat;
|
||||
enum fe_status tunerstat;
|
||||
int i, status, ret, retune = 1;
|
||||
|
||||
dprintk("%s()\n", __func__);
|
||||
|
|
@ -1441,7 +1443,7 @@ tuned: /* Set/Reset B/W */
|
|||
}
|
||||
|
||||
static int cx24116_tune(struct dvb_frontend *fe, bool re_tune,
|
||||
unsigned int mode_flags, unsigned int *delay, fe_status_t *status)
|
||||
unsigned int mode_flags, unsigned int *delay, enum fe_status *status)
|
||||
{
|
||||
/*
|
||||
* It is safe to discard "params" here, as the DVB core will sync
|
||||
|
|
|
|||
|
|
@ -171,13 +171,13 @@ static DEFINE_MUTEX(cx24117_list_mutex);
|
|||
struct cx24117_tuning {
|
||||
u32 frequency;
|
||||
u32 symbol_rate;
|
||||
fe_spectral_inversion_t inversion;
|
||||
fe_code_rate_t fec;
|
||||
enum fe_spectral_inversion inversion;
|
||||
enum fe_code_rate fec;
|
||||
|
||||
fe_delivery_system_t delsys;
|
||||
fe_modulation_t modulation;
|
||||
fe_pilot_t pilot;
|
||||
fe_rolloff_t rolloff;
|
||||
enum fe_delivery_system delsys;
|
||||
enum fe_modulation modulation;
|
||||
enum fe_pilot pilot;
|
||||
enum fe_rolloff rolloff;
|
||||
|
||||
/* Demod values */
|
||||
u8 fec_val;
|
||||
|
|
@ -220,9 +220,9 @@ struct cx24117_state {
|
|||
/* modfec (modulation and FEC) lookup table */
|
||||
/* Check cx24116.c for a detailed description of each field */
|
||||
static struct cx24117_modfec {
|
||||
fe_delivery_system_t delivery_system;
|
||||
fe_modulation_t modulation;
|
||||
fe_code_rate_t fec;
|
||||
enum fe_delivery_system delivery_system;
|
||||
enum fe_modulation modulation;
|
||||
enum fe_code_rate fec;
|
||||
u8 mask; /* In DVBS mode this is used to autodetect */
|
||||
u8 val; /* Passed to the firmware to indicate mode selection */
|
||||
} cx24117_modfec_modes[] = {
|
||||
|
|
@ -362,7 +362,7 @@ static int cx24117_readregN(struct cx24117_state *state,
|
|||
}
|
||||
|
||||
static int cx24117_set_inversion(struct cx24117_state *state,
|
||||
fe_spectral_inversion_t inversion)
|
||||
enum fe_spectral_inversion inversion)
|
||||
{
|
||||
dev_dbg(&state->priv->i2c->dev, "%s(%d) demod%d\n",
|
||||
__func__, inversion, state->demod);
|
||||
|
|
@ -387,7 +387,7 @@ static int cx24117_set_inversion(struct cx24117_state *state,
|
|||
}
|
||||
|
||||
static int cx24117_lookup_fecmod(struct cx24117_state *state,
|
||||
fe_delivery_system_t d, fe_modulation_t m, fe_code_rate_t f)
|
||||
enum fe_delivery_system d, enum fe_modulation m, enum fe_code_rate f)
|
||||
{
|
||||
int i, ret = -EINVAL;
|
||||
|
||||
|
|
@ -408,7 +408,9 @@ static int cx24117_lookup_fecmod(struct cx24117_state *state,
|
|||
}
|
||||
|
||||
static int cx24117_set_fec(struct cx24117_state *state,
|
||||
fe_delivery_system_t delsys, fe_modulation_t mod, fe_code_rate_t fec)
|
||||
enum fe_delivery_system delsys,
|
||||
enum fe_modulation mod,
|
||||
enum fe_code_rate fec)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -737,7 +739,7 @@ error:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int cx24117_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int cx24117_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
int lock;
|
||||
|
|
@ -843,7 +845,7 @@ static int cx24117_read_snr(struct dvb_frontend *fe, u16 *snr)
|
|||
static int cx24117_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
||||
{
|
||||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
fe_delivery_system_t delsys = fe->dtv_property_cache.delivery_system;
|
||||
enum fe_delivery_system delsys = fe->dtv_property_cache.delivery_system;
|
||||
int ret;
|
||||
u8 buf[2];
|
||||
u8 reg = (state->demod == 0) ?
|
||||
|
|
@ -904,7 +906,7 @@ static int cx24117_wait_for_lnb(struct dvb_frontend *fe)
|
|||
}
|
||||
|
||||
static int cx24117_set_voltage(struct dvb_frontend *fe,
|
||||
fe_sec_voltage_t voltage)
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
struct cx24117_cmd cmd;
|
||||
|
|
@ -956,7 +958,7 @@ static int cx24117_set_voltage(struct dvb_frontend *fe,
|
|||
}
|
||||
|
||||
static int cx24117_set_tone(struct dvb_frontend *fe,
|
||||
fe_sec_tone_mode_t tone)
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
struct cx24117_cmd cmd;
|
||||
|
|
@ -1043,7 +1045,7 @@ static int cx24117_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
dev_dbg(&state->priv->i2c->dev, ")\n");
|
||||
|
||||
/* Validate length */
|
||||
if (d->msg_len > 15)
|
||||
if (d->msg_len > sizeof(d->msg))
|
||||
return -EINVAL;
|
||||
|
||||
/* DiSEqC message */
|
||||
|
|
@ -1112,7 +1114,7 @@ static int cx24117_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
|
||||
/* Send DiSEqC burst */
|
||||
static int cx24117_diseqc_send_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t burst)
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -1306,7 +1308,7 @@ static int cx24117_set_frontend(struct dvb_frontend *fe)
|
|||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
struct cx24117_cmd cmd;
|
||||
fe_status_t tunerstat;
|
||||
enum fe_status tunerstat;
|
||||
int i, status, ret, retune = 1;
|
||||
u8 reg_clkdiv, reg_ratediv;
|
||||
|
||||
|
|
@ -1537,7 +1539,7 @@ static int cx24117_set_frontend(struct dvb_frontend *fe)
|
|||
}
|
||||
|
||||
static int cx24117_tune(struct dvb_frontend *fe, bool re_tune,
|
||||
unsigned int mode_flags, unsigned int *delay, fe_status_t *status)
|
||||
unsigned int mode_flags, unsigned int *delay, enum fe_status *status)
|
||||
{
|
||||
struct cx24117_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
|
|||
1595
drivers/media/dvb-frontends/cx24120.c
Normal file
1595
drivers/media/dvb-frontends/cx24120.c
Normal file
File diff suppressed because it is too large
Load diff
58
drivers/media/dvb-frontends/cx24120.h
Normal file
58
drivers/media/dvb-frontends/cx24120.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Conexant CX24120/CX24118 - DVB-S/S2 demod/tuner driver
|
||||
*
|
||||
* Copyright (C) 2008 Patrick Boettcher <pb@linuxtv.org>
|
||||
* Copyright (C) 2009 Sergey Tyurin <forum.free-x.de>
|
||||
* Updated 2012 by Jannis Achstetter <jannis_achstetter@web.de>
|
||||
* Copyright (C) 2015 Jemma Denson <jdenson@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef CX24120_H
|
||||
#define CX24120_H
|
||||
|
||||
#include <linux/kconfig.h>
|
||||
#include <linux/dvb/frontend.h>
|
||||
#include <linux/firmware.h>
|
||||
|
||||
struct cx24120_initial_mpeg_config {
|
||||
u8 x1;
|
||||
u8 x2;
|
||||
u8 x3;
|
||||
};
|
||||
|
||||
struct cx24120_config {
|
||||
u8 i2c_addr;
|
||||
u32 xtal_khz;
|
||||
struct cx24120_initial_mpeg_config initial_mpeg_config;
|
||||
|
||||
int (*request_firmware)(struct dvb_frontend *fe,
|
||||
const struct firmware **fw, char *name);
|
||||
|
||||
/* max bytes I2C provider can write at once */
|
||||
u16 i2c_wr_max;
|
||||
};
|
||||
|
||||
#if IS_REACHABLE(CONFIG_DVB_CX24120)
|
||||
struct dvb_frontend *cx24120_attach(const struct cx24120_config *config,
|
||||
struct i2c_adapter *i2c);
|
||||
#else
|
||||
static inline
|
||||
struct dvb_frontend *cx24120_attach(const struct cx24120_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
{
|
||||
pr_warn("%s: driver disabled by Kconfig\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CX24120_H */
|
||||
|
|
@ -290,7 +290,7 @@ static int cx24123_i2c_readreg(struct cx24123_state *state, u8 i2c_addr, u8 reg)
|
|||
cx24123_i2c_writereg(state, state->config->demod_address, reg, val)
|
||||
|
||||
static int cx24123_set_inversion(struct cx24123_state *state,
|
||||
fe_spectral_inversion_t inversion)
|
||||
enum fe_spectral_inversion inversion)
|
||||
{
|
||||
u8 nom_reg = cx24123_readreg(state, 0x0e);
|
||||
u8 auto_reg = cx24123_readreg(state, 0x10);
|
||||
|
|
@ -318,7 +318,7 @@ static int cx24123_set_inversion(struct cx24123_state *state,
|
|||
}
|
||||
|
||||
static int cx24123_get_inversion(struct cx24123_state *state,
|
||||
fe_spectral_inversion_t *inversion)
|
||||
enum fe_spectral_inversion *inversion)
|
||||
{
|
||||
u8 val;
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ static int cx24123_get_inversion(struct cx24123_state *state,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24123_set_fec(struct cx24123_state *state, fe_code_rate_t fec)
|
||||
static int cx24123_set_fec(struct cx24123_state *state, enum fe_code_rate fec)
|
||||
{
|
||||
u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07;
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ static int cx24123_set_fec(struct cx24123_state *state, fe_code_rate_t fec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24123_get_fec(struct cx24123_state *state, fe_code_rate_t *fec)
|
||||
static int cx24123_get_fec(struct cx24123_state *state, enum fe_code_rate *fec)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -720,7 +720,7 @@ static int cx24123_initfe(struct dvb_frontend *fe)
|
|||
}
|
||||
|
||||
static int cx24123_set_voltage(struct dvb_frontend *fe,
|
||||
fe_sec_voltage_t voltage)
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct cx24123_state *state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
@ -795,7 +795,7 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
}
|
||||
|
||||
static int cx24123_diseqc_send_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t burst)
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct cx24123_state *state = fe->demodulator_priv;
|
||||
int val, tone;
|
||||
|
|
@ -831,7 +831,7 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24123_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int cx24123_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cx24123_state *state = fe->demodulator_priv;
|
||||
int sync = cx24123_readreg(state, 0x14);
|
||||
|
|
@ -966,7 +966,7 @@ static int cx24123_get_frontend(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx24123_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
||||
static int cx24123_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct cx24123_state *state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
@ -995,7 +995,7 @@ static int cx24123_tune(struct dvb_frontend *fe,
|
|||
bool re_tune,
|
||||
unsigned int mode_flags,
|
||||
unsigned int *delay,
|
||||
fe_status_t *status)
|
||||
enum fe_status *status)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static inline struct dvb_frontend *cx24123_attach(
|
|||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
static struct i2c_adapter *
|
||||
static inline struct i2c_adapter *
|
||||
cx24123_get_tuner_i2c_adapter(struct dvb_frontend *fe)
|
||||
{
|
||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status)
|
||||
int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cxd2820r_priv *priv = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -287,7 +287,8 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe)
|
|||
err:
|
||||
return ret;
|
||||
}
|
||||
static int cxd2820r_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
|
||||
static int cxd2820r_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cxd2820r_priv *priv = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
@ -501,7 +502,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe)
|
|||
struct cxd2820r_priv *priv = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
int ret, i;
|
||||
fe_status_t status = 0;
|
||||
enum fe_status status = 0;
|
||||
|
||||
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
|
||||
fe->dtv_property_cache.delivery_system);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ struct cxd2820r_priv {
|
|||
struct gpio_chip gpio_chip;
|
||||
#endif
|
||||
|
||||
fe_delivery_system_t delivery_system;
|
||||
enum fe_delivery_system delivery_system;
|
||||
bool last_tune_failed; /* for switch between T and T2 tune */
|
||||
};
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe);
|
|||
|
||||
int cxd2820r_set_frontend_c(struct dvb_frontend *fe);
|
||||
|
||||
int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status);
|
||||
int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status);
|
||||
|
||||
int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber);
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ int cxd2820r_get_frontend_t(struct dvb_frontend *fe);
|
|||
|
||||
int cxd2820r_set_frontend_t(struct dvb_frontend *fe);
|
||||
|
||||
int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status);
|
||||
int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status);
|
||||
|
||||
int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber);
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ int cxd2820r_get_frontend_t2(struct dvb_frontend *fe);
|
|||
|
||||
int cxd2820r_set_frontend_t2(struct dvb_frontend *fe);
|
||||
|
||||
int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status);
|
||||
int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status);
|
||||
|
||||
int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber);
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status)
|
||||
int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cxd2820r_priv *priv = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ error:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status)
|
||||
int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct cxd2820r_priv *priv = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ struct dib0070_state {
|
|||
u16 wbd_ff_offset;
|
||||
u8 revision;
|
||||
|
||||
enum frontend_tune_state tune_state;
|
||||
u32 current_rf;
|
||||
enum frontend_tune_state tune_state;
|
||||
u32 current_rf;
|
||||
|
||||
/* for the captrim binary search */
|
||||
/* for the captrim binary search */
|
||||
s8 step;
|
||||
u16 adc_diff;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ struct dib0070_state {
|
|||
const struct dib0070_tuning *current_tune_table_index;
|
||||
const struct dib0070_lna_match *lna_match;
|
||||
|
||||
u8 wbd_gain_current;
|
||||
u8 wbd_gain_current;
|
||||
u16 wbd_offset_3_3[2];
|
||||
|
||||
/* for the I2C transfer */
|
||||
|
|
@ -151,31 +151,31 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val)
|
|||
} while (0)
|
||||
|
||||
static int dib0070_set_bandwidth(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
u16 tmp = dib0070_read_reg(state, 0x02) & 0x3fff;
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
u16 tmp = dib0070_read_reg(state, 0x02) & 0x3fff;
|
||||
|
||||
if (state->fe->dtv_property_cache.bandwidth_hz/1000 > 7000)
|
||||
tmp |= (0 << 14);
|
||||
else if (state->fe->dtv_property_cache.bandwidth_hz/1000 > 6000)
|
||||
tmp |= (1 << 14);
|
||||
else if (state->fe->dtv_property_cache.bandwidth_hz/1000 > 5000)
|
||||
tmp |= (2 << 14);
|
||||
else
|
||||
tmp |= (3 << 14);
|
||||
if (state->fe->dtv_property_cache.bandwidth_hz/1000 > 7000)
|
||||
tmp |= (0 << 14);
|
||||
else if (state->fe->dtv_property_cache.bandwidth_hz/1000 > 6000)
|
||||
tmp |= (1 << 14);
|
||||
else if (state->fe->dtv_property_cache.bandwidth_hz/1000 > 5000)
|
||||
tmp |= (2 << 14);
|
||||
else
|
||||
tmp |= (3 << 14);
|
||||
|
||||
dib0070_write_reg(state, 0x02, tmp);
|
||||
dib0070_write_reg(state, 0x02, tmp);
|
||||
|
||||
/* sharpen the BB filter in ISDB-T to have higher immunity to adjacent channels */
|
||||
if (state->fe->dtv_property_cache.delivery_system == SYS_ISDBT) {
|
||||
u16 value = dib0070_read_reg(state, 0x17);
|
||||
/* sharpen the BB filter in ISDB-T to have higher immunity to adjacent channels */
|
||||
if (state->fe->dtv_property_cache.delivery_system == SYS_ISDBT) {
|
||||
u16 value = dib0070_read_reg(state, 0x17);
|
||||
|
||||
dib0070_write_reg(state, 0x17, value & 0xfffc);
|
||||
tmp = dib0070_read_reg(state, 0x01) & 0x01ff;
|
||||
dib0070_write_reg(state, 0x01, tmp | (60 << 9));
|
||||
dib0070_write_reg(state, 0x17, value & 0xfffc);
|
||||
tmp = dib0070_read_reg(state, 0x01) & 0x01ff;
|
||||
dib0070_write_reg(state, 0x01, tmp | (60 << 9));
|
||||
|
||||
dib0070_write_reg(state, 0x17, value);
|
||||
}
|
||||
dib0070_write_reg(state, 0x17, value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +186,6 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state
|
|||
int ret = 0;
|
||||
|
||||
if (*tune_state == CT_TUNER_STEP_0) {
|
||||
|
||||
dib0070_write_reg(state, 0x0f, 0xed10);
|
||||
dib0070_write_reg(state, 0x17, 0x0034);
|
||||
|
||||
|
|
@ -195,7 +194,7 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state
|
|||
state->adc_diff = 3000;
|
||||
ret = 20;
|
||||
|
||||
*tune_state = CT_TUNER_STEP_1;
|
||||
*tune_state = CT_TUNER_STEP_1;
|
||||
} else if (*tune_state == CT_TUNER_STEP_1) {
|
||||
state->step /= 2;
|
||||
dib0070_write_reg(state, 0x14, state->lo4 | state->captrim);
|
||||
|
|
@ -220,9 +219,6 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state
|
|||
dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)", state->captrim, adc, state->adc_diff);
|
||||
state->adc_diff = adc;
|
||||
state->fcaptrim = state->captrim;
|
||||
|
||||
|
||||
|
||||
}
|
||||
state->captrim += (step_sign * state->step);
|
||||
|
||||
|
|
@ -243,7 +239,8 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state
|
|||
static int dib0070_set_ctrl_lo5(struct dvb_frontend *fe, u8 vco_bias_trim, u8 hf_div_trim, u8 cp_current, u8 third_order_filt)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
u16 lo5 = (third_order_filt << 14) | (0 << 13) | (1 << 12) | (3 << 9) | (cp_current << 6) | (hf_div_trim << 3) | (vco_bias_trim << 0);
|
||||
u16 lo5 = (third_order_filt << 14) | (0 << 13) | (1 << 12) | (3 << 9) | (cp_current << 6) | (hf_div_trim << 3) | (vco_bias_trim << 0);
|
||||
|
||||
dprintk("CTRL_LO5: 0x%x", lo5);
|
||||
return dib0070_write_reg(state, 0x15, lo5);
|
||||
}
|
||||
|
|
@ -257,281 +254,282 @@ void dib0070_ctrl_agc_filter(struct dvb_frontend *fe, u8 open)
|
|||
dib0070_write_reg(state, 0x1a, 0x0000);
|
||||
} else {
|
||||
dib0070_write_reg(state, 0x1b, 0x4112);
|
||||
if (state->cfg->vga_filter != 0) {
|
||||
dib0070_write_reg(state, 0x1a, state->cfg->vga_filter);
|
||||
dprintk("vga filter register is set to %x", state->cfg->vga_filter);
|
||||
} else
|
||||
dib0070_write_reg(state, 0x1a, 0x0009);
|
||||
if (state->cfg->vga_filter != 0) {
|
||||
dib0070_write_reg(state, 0x1a, state->cfg->vga_filter);
|
||||
dprintk("vga filter register is set to %x", state->cfg->vga_filter);
|
||||
} else
|
||||
dib0070_write_reg(state, 0x1a, 0x0009);
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(dib0070_ctrl_agc_filter);
|
||||
struct dib0070_tuning {
|
||||
u32 max_freq; /* for every frequency less than or equal to that field: this information is correct */
|
||||
u8 switch_trim;
|
||||
u8 vco_band;
|
||||
u8 hfdiv;
|
||||
u8 vco_multi;
|
||||
u8 presc;
|
||||
u8 wbdmux;
|
||||
u16 tuner_enable;
|
||||
u32 max_freq; /* for every frequency less than or equal to that field: this information is correct */
|
||||
u8 switch_trim;
|
||||
u8 vco_band;
|
||||
u8 hfdiv;
|
||||
u8 vco_multi;
|
||||
u8 presc;
|
||||
u8 wbdmux;
|
||||
u16 tuner_enable;
|
||||
};
|
||||
|
||||
struct dib0070_lna_match {
|
||||
u32 max_freq; /* for every frequency less than or equal to that field: this information is correct */
|
||||
u8 lna_band;
|
||||
u32 max_freq; /* for every frequency less than or equal to that field: this information is correct */
|
||||
u8 lna_band;
|
||||
};
|
||||
|
||||
static const struct dib0070_tuning dib0070s_tuning_table[] = {
|
||||
{ 570000, 2, 1, 3, 6, 6, 2, 0x4000 | 0x0800 }, /* UHF */
|
||||
{ 700000, 2, 0, 2, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 863999, 2, 1, 2, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 1500000, 0, 1, 1, 2, 2, 4, 0x2000 | 0x0400 }, /* LBAND */
|
||||
{ 1600000, 0, 1, 1, 2, 2, 4, 0x2000 | 0x0400 },
|
||||
{ 2000000, 0, 1, 1, 2, 2, 4, 0x2000 | 0x0400 },
|
||||
{ 0xffffffff, 0, 0, 8, 1, 2, 1, 0x8000 | 0x1000 }, /* SBAND */
|
||||
{ 570000, 2, 1, 3, 6, 6, 2, 0x4000 | 0x0800 }, /* UHF */
|
||||
{ 700000, 2, 0, 2, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 863999, 2, 1, 2, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 1500000, 0, 1, 1, 2, 2, 4, 0x2000 | 0x0400 }, /* LBAND */
|
||||
{ 1600000, 0, 1, 1, 2, 2, 4, 0x2000 | 0x0400 },
|
||||
{ 2000000, 0, 1, 1, 2, 2, 4, 0x2000 | 0x0400 },
|
||||
{ 0xffffffff, 0, 0, 8, 1, 2, 1, 0x8000 | 0x1000 }, /* SBAND */
|
||||
};
|
||||
|
||||
static const struct dib0070_tuning dib0070_tuning_table[] = {
|
||||
{ 115000, 1, 0, 7, 24, 2, 1, 0x8000 | 0x1000 }, /* FM below 92MHz cannot be tuned */
|
||||
{ 179500, 1, 0, 3, 16, 2, 1, 0x8000 | 0x1000 }, /* VHF */
|
||||
{ 189999, 1, 1, 3, 16, 2, 1, 0x8000 | 0x1000 },
|
||||
{ 250000, 1, 0, 6, 12, 2, 1, 0x8000 | 0x1000 },
|
||||
{ 569999, 2, 1, 5, 6, 2, 2, 0x4000 | 0x0800 }, /* UHF */
|
||||
{ 699999, 2, 0, 1, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 863999, 2, 1, 1, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 0xffffffff, 0, 1, 0, 2, 2, 4, 0x2000 | 0x0400 }, /* LBAND or everything higher than UHF */
|
||||
{ 115000, 1, 0, 7, 24, 2, 1, 0x8000 | 0x1000 }, /* FM below 92MHz cannot be tuned */
|
||||
{ 179500, 1, 0, 3, 16, 2, 1, 0x8000 | 0x1000 }, /* VHF */
|
||||
{ 189999, 1, 1, 3, 16, 2, 1, 0x8000 | 0x1000 },
|
||||
{ 250000, 1, 0, 6, 12, 2, 1, 0x8000 | 0x1000 },
|
||||
{ 569999, 2, 1, 5, 6, 2, 2, 0x4000 | 0x0800 }, /* UHF */
|
||||
{ 699999, 2, 0, 1, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 863999, 2, 1, 1, 4, 2, 2, 0x4000 | 0x0800 },
|
||||
{ 0xffffffff, 0, 1, 0, 2, 2, 4, 0x2000 | 0x0400 }, /* LBAND or everything higher than UHF */
|
||||
};
|
||||
|
||||
static const struct dib0070_lna_match dib0070_lna_flip_chip[] = {
|
||||
{ 180000, 0 }, /* VHF */
|
||||
{ 188000, 1 },
|
||||
{ 196400, 2 },
|
||||
{ 250000, 3 },
|
||||
{ 550000, 0 }, /* UHF */
|
||||
{ 590000, 1 },
|
||||
{ 666000, 3 },
|
||||
{ 864000, 5 },
|
||||
{ 1500000, 0 }, /* LBAND or everything higher than UHF */
|
||||
{ 1600000, 1 },
|
||||
{ 2000000, 3 },
|
||||
{ 0xffffffff, 7 },
|
||||
{ 180000, 0 }, /* VHF */
|
||||
{ 188000, 1 },
|
||||
{ 196400, 2 },
|
||||
{ 250000, 3 },
|
||||
{ 550000, 0 }, /* UHF */
|
||||
{ 590000, 1 },
|
||||
{ 666000, 3 },
|
||||
{ 864000, 5 },
|
||||
{ 1500000, 0 }, /* LBAND or everything higher than UHF */
|
||||
{ 1600000, 1 },
|
||||
{ 2000000, 3 },
|
||||
{ 0xffffffff, 7 },
|
||||
};
|
||||
|
||||
static const struct dib0070_lna_match dib0070_lna[] = {
|
||||
{ 180000, 0 }, /* VHF */
|
||||
{ 188000, 1 },
|
||||
{ 196400, 2 },
|
||||
{ 250000, 3 },
|
||||
{ 550000, 2 }, /* UHF */
|
||||
{ 650000, 3 },
|
||||
{ 750000, 5 },
|
||||
{ 850000, 6 },
|
||||
{ 864000, 7 },
|
||||
{ 1500000, 0 }, /* LBAND or everything higher than UHF */
|
||||
{ 1600000, 1 },
|
||||
{ 2000000, 3 },
|
||||
{ 0xffffffff, 7 },
|
||||
{ 180000, 0 }, /* VHF */
|
||||
{ 188000, 1 },
|
||||
{ 196400, 2 },
|
||||
{ 250000, 3 },
|
||||
{ 550000, 2 }, /* UHF */
|
||||
{ 650000, 3 },
|
||||
{ 750000, 5 },
|
||||
{ 850000, 6 },
|
||||
{ 864000, 7 },
|
||||
{ 1500000, 0 }, /* LBAND or everything higher than UHF */
|
||||
{ 1600000, 1 },
|
||||
{ 2000000, 3 },
|
||||
{ 0xffffffff, 7 },
|
||||
};
|
||||
|
||||
#define LPF 100
|
||||
static int dib0070_tune_digital(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
|
||||
const struct dib0070_tuning *tune;
|
||||
const struct dib0070_lna_match *lna_match;
|
||||
const struct dib0070_tuning *tune;
|
||||
const struct dib0070_lna_match *lna_match;
|
||||
|
||||
enum frontend_tune_state *tune_state = &state->tune_state;
|
||||
int ret = 10; /* 1ms is the default delay most of the time */
|
||||
enum frontend_tune_state *tune_state = &state->tune_state;
|
||||
int ret = 10; /* 1ms is the default delay most of the time */
|
||||
|
||||
u8 band = (u8)BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency/1000);
|
||||
u32 freq = fe->dtv_property_cache.frequency/1000 + (band == BAND_VHF ? state->cfg->freq_offset_khz_vhf : state->cfg->freq_offset_khz_uhf);
|
||||
u8 band = (u8)BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency/1000);
|
||||
u32 freq = fe->dtv_property_cache.frequency/1000 + (band == BAND_VHF ? state->cfg->freq_offset_khz_vhf : state->cfg->freq_offset_khz_uhf);
|
||||
|
||||
#ifdef CONFIG_SYS_ISDBT
|
||||
if (state->fe->dtv_property_cache.delivery_system == SYS_ISDBT && state->fe->dtv_property_cache.isdbt_sb_mode == 1)
|
||||
if (((state->fe->dtv_property_cache.isdbt_sb_segment_count % 2)
|
||||
&& (state->fe->dtv_property_cache.isdbt_sb_segment_idx == ((state->fe->dtv_property_cache.isdbt_sb_segment_count / 2) + 1)))
|
||||
|| (((state->fe->dtv_property_cache.isdbt_sb_segment_count % 2) == 0)
|
||||
&& (state->fe->dtv_property_cache.isdbt_sb_segment_idx == (state->fe->dtv_property_cache.isdbt_sb_segment_count / 2)))
|
||||
|| (((state->fe->dtv_property_cache.isdbt_sb_segment_count % 2) == 0)
|
||||
&& (state->fe->dtv_property_cache.isdbt_sb_segment_idx == ((state->fe->dtv_property_cache.isdbt_sb_segment_count / 2) + 1))))
|
||||
freq += 850;
|
||||
if (state->fe->dtv_property_cache.delivery_system == SYS_ISDBT && state->fe->dtv_property_cache.isdbt_sb_mode == 1)
|
||||
if (((state->fe->dtv_property_cache.isdbt_sb_segment_count % 2)
|
||||
&& (state->fe->dtv_property_cache.isdbt_sb_segment_idx == ((state->fe->dtv_property_cache.isdbt_sb_segment_count / 2) + 1)))
|
||||
|| (((state->fe->dtv_property_cache.isdbt_sb_segment_count % 2) == 0)
|
||||
&& (state->fe->dtv_property_cache.isdbt_sb_segment_idx == (state->fe->dtv_property_cache.isdbt_sb_segment_count / 2)))
|
||||
|| (((state->fe->dtv_property_cache.isdbt_sb_segment_count % 2) == 0)
|
||||
&& (state->fe->dtv_property_cache.isdbt_sb_segment_idx == ((state->fe->dtv_property_cache.isdbt_sb_segment_count / 2) + 1))))
|
||||
freq += 850;
|
||||
#endif
|
||||
if (state->current_rf != freq) {
|
||||
|
||||
switch (state->revision) {
|
||||
case DIB0070S_P1A:
|
||||
tune = dib0070s_tuning_table;
|
||||
lna_match = dib0070_lna;
|
||||
break;
|
||||
default:
|
||||
tune = dib0070_tuning_table;
|
||||
if (state->cfg->flip_chip)
|
||||
lna_match = dib0070_lna_flip_chip;
|
||||
else
|
||||
lna_match = dib0070_lna;
|
||||
break;
|
||||
}
|
||||
while (freq > tune->max_freq) /* find the right one */
|
||||
tune++;
|
||||
while (freq > lna_match->max_freq) /* find the right one */
|
||||
lna_match++;
|
||||
|
||||
state->current_tune_table_index = tune;
|
||||
state->lna_match = lna_match;
|
||||
}
|
||||
|
||||
if (*tune_state == CT_TUNER_START) {
|
||||
dprintk("Tuning for Band: %hd (%d kHz)", band, freq);
|
||||
if (state->current_rf != freq) {
|
||||
u8 REFDIV;
|
||||
u32 FBDiv, Rest, FREF, VCOF_kHz;
|
||||
u8 Den;
|
||||
|
||||
state->current_rf = freq;
|
||||
state->lo4 = (state->current_tune_table_index->vco_band << 11) | (state->current_tune_table_index->hfdiv << 7);
|
||||
|
||||
|
||||
dib0070_write_reg(state, 0x17, 0x30);
|
||||
|
||||
|
||||
VCOF_kHz = state->current_tune_table_index->vco_multi * freq * 2;
|
||||
|
||||
switch (band) {
|
||||
case BAND_VHF:
|
||||
REFDIV = (u8) ((state->cfg->clock_khz + 9999) / 10000);
|
||||
break;
|
||||
case BAND_FM:
|
||||
REFDIV = (u8) ((state->cfg->clock_khz) / 1000);
|
||||
break;
|
||||
default:
|
||||
REFDIV = (u8) (state->cfg->clock_khz / 10000);
|
||||
break;
|
||||
}
|
||||
FREF = state->cfg->clock_khz / REFDIV;
|
||||
|
||||
|
||||
|
||||
switch (state->revision) {
|
||||
case DIB0070S_P1A:
|
||||
FBDiv = (VCOF_kHz / state->current_tune_table_index->presc / FREF);
|
||||
Rest = (VCOF_kHz / state->current_tune_table_index->presc) - FBDiv * FREF;
|
||||
break;
|
||||
|
||||
case DIB0070_P1G:
|
||||
case DIB0070_P1F:
|
||||
tune = dib0070s_tuning_table;
|
||||
lna_match = dib0070_lna;
|
||||
break;
|
||||
default:
|
||||
FBDiv = (freq / (FREF / 2));
|
||||
Rest = 2 * freq - FBDiv * FREF;
|
||||
break;
|
||||
tune = dib0070_tuning_table;
|
||||
if (state->cfg->flip_chip)
|
||||
lna_match = dib0070_lna_flip_chip;
|
||||
else
|
||||
lna_match = dib0070_lna;
|
||||
break;
|
||||
}
|
||||
while (freq > tune->max_freq) /* find the right one */
|
||||
tune++;
|
||||
while (freq > lna_match->max_freq) /* find the right one */
|
||||
lna_match++;
|
||||
|
||||
if (Rest < LPF)
|
||||
Rest = 0;
|
||||
else if (Rest < 2 * LPF)
|
||||
Rest = 2 * LPF;
|
||||
else if (Rest > (FREF - LPF)) {
|
||||
Rest = 0;
|
||||
FBDiv += 1;
|
||||
} else if (Rest > (FREF - 2 * LPF))
|
||||
Rest = FREF - 2 * LPF;
|
||||
Rest = (Rest * 6528) / (FREF / 10);
|
||||
|
||||
Den = 1;
|
||||
if (Rest > 0) {
|
||||
state->lo4 |= (1 << 14) | (1 << 12);
|
||||
Den = 255;
|
||||
}
|
||||
|
||||
|
||||
dib0070_write_reg(state, 0x11, (u16)FBDiv);
|
||||
dib0070_write_reg(state, 0x12, (Den << 8) | REFDIV);
|
||||
dib0070_write_reg(state, 0x13, (u16) Rest);
|
||||
|
||||
if (state->revision == DIB0070S_P1A) {
|
||||
|
||||
if (band == BAND_SBAND) {
|
||||
dib0070_set_ctrl_lo5(fe, 2, 4, 3, 0);
|
||||
dib0070_write_reg(state, 0x1d, 0xFFFF);
|
||||
} else
|
||||
dib0070_set_ctrl_lo5(fe, 5, 4, 3, 1);
|
||||
}
|
||||
|
||||
dib0070_write_reg(state, 0x20,
|
||||
0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001 | state->current_tune_table_index->tuner_enable);
|
||||
|
||||
dprintk("REFDIV: %hd, FREF: %d", REFDIV, FREF);
|
||||
dprintk("FBDIV: %d, Rest: %d", FBDiv, Rest);
|
||||
dprintk("Num: %hd, Den: %hd, SD: %hd", (u16) Rest, Den, (state->lo4 >> 12) & 0x1);
|
||||
dprintk("HFDIV code: %hd", state->current_tune_table_index->hfdiv);
|
||||
dprintk("VCO = %hd", state->current_tune_table_index->vco_band);
|
||||
dprintk("VCOF: ((%hd*%d) << 1))", state->current_tune_table_index->vco_multi, freq);
|
||||
|
||||
*tune_state = CT_TUNER_STEP_0;
|
||||
} else { /* we are already tuned to this frequency - the configuration is correct */
|
||||
ret = 50; /* wakeup time */
|
||||
*tune_state = CT_TUNER_STEP_5;
|
||||
state->current_tune_table_index = tune;
|
||||
state->lna_match = lna_match;
|
||||
}
|
||||
} else if ((*tune_state > CT_TUNER_START) && (*tune_state < CT_TUNER_STEP_4)) {
|
||||
|
||||
ret = dib0070_captrim(state, tune_state);
|
||||
if (*tune_state == CT_TUNER_START) {
|
||||
dprintk("Tuning for Band: %hd (%d kHz)", band, freq);
|
||||
if (state->current_rf != freq) {
|
||||
u8 REFDIV;
|
||||
u32 FBDiv, Rest, FREF, VCOF_kHz;
|
||||
u8 Den;
|
||||
|
||||
} else if (*tune_state == CT_TUNER_STEP_4) {
|
||||
const struct dib0070_wbd_gain_cfg *tmp = state->cfg->wbd_gain;
|
||||
if (tmp != NULL) {
|
||||
while (freq/1000 > tmp->freq) /* find the right one */
|
||||
tmp++;
|
||||
dib0070_write_reg(state, 0x0f,
|
||||
(0 << 15) | (1 << 14) | (3 << 12)
|
||||
| (tmp->wbd_gain_val << 9) | (0 << 8) | (1 << 7)
|
||||
| (state->current_tune_table_index->wbdmux << 0));
|
||||
state->wbd_gain_current = tmp->wbd_gain_val;
|
||||
} else {
|
||||
state->current_rf = freq;
|
||||
state->lo4 = (state->current_tune_table_index->vco_band << 11) | (state->current_tune_table_index->hfdiv << 7);
|
||||
|
||||
|
||||
dib0070_write_reg(state, 0x17, 0x30);
|
||||
|
||||
|
||||
VCOF_kHz = state->current_tune_table_index->vco_multi * freq * 2;
|
||||
|
||||
switch (band) {
|
||||
case BAND_VHF:
|
||||
REFDIV = (u8) ((state->cfg->clock_khz + 9999) / 10000);
|
||||
break;
|
||||
case BAND_FM:
|
||||
REFDIV = (u8) ((state->cfg->clock_khz) / 1000);
|
||||
break;
|
||||
default:
|
||||
REFDIV = (u8) (state->cfg->clock_khz / 10000);
|
||||
break;
|
||||
}
|
||||
FREF = state->cfg->clock_khz / REFDIV;
|
||||
|
||||
|
||||
|
||||
switch (state->revision) {
|
||||
case DIB0070S_P1A:
|
||||
FBDiv = (VCOF_kHz / state->current_tune_table_index->presc / FREF);
|
||||
Rest = (VCOF_kHz / state->current_tune_table_index->presc) - FBDiv * FREF;
|
||||
break;
|
||||
|
||||
case DIB0070_P1G:
|
||||
case DIB0070_P1F:
|
||||
default:
|
||||
FBDiv = (freq / (FREF / 2));
|
||||
Rest = 2 * freq - FBDiv * FREF;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Rest < LPF)
|
||||
Rest = 0;
|
||||
else if (Rest < 2 * LPF)
|
||||
Rest = 2 * LPF;
|
||||
else if (Rest > (FREF - LPF)) {
|
||||
Rest = 0;
|
||||
FBDiv += 1;
|
||||
} else if (Rest > (FREF - 2 * LPF))
|
||||
Rest = FREF - 2 * LPF;
|
||||
Rest = (Rest * 6528) / (FREF / 10);
|
||||
|
||||
Den = 1;
|
||||
if (Rest > 0) {
|
||||
state->lo4 |= (1 << 14) | (1 << 12);
|
||||
Den = 255;
|
||||
}
|
||||
|
||||
|
||||
dib0070_write_reg(state, 0x11, (u16)FBDiv);
|
||||
dib0070_write_reg(state, 0x12, (Den << 8) | REFDIV);
|
||||
dib0070_write_reg(state, 0x13, (u16) Rest);
|
||||
|
||||
if (state->revision == DIB0070S_P1A) {
|
||||
|
||||
if (band == BAND_SBAND) {
|
||||
dib0070_set_ctrl_lo5(fe, 2, 4, 3, 0);
|
||||
dib0070_write_reg(state, 0x1d, 0xFFFF);
|
||||
} else
|
||||
dib0070_set_ctrl_lo5(fe, 5, 4, 3, 1);
|
||||
}
|
||||
|
||||
dib0070_write_reg(state, 0x20,
|
||||
0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001 | state->current_tune_table_index->tuner_enable);
|
||||
|
||||
dprintk("REFDIV: %hd, FREF: %d", REFDIV, FREF);
|
||||
dprintk("FBDIV: %d, Rest: %d", FBDiv, Rest);
|
||||
dprintk("Num: %hd, Den: %hd, SD: %hd", (u16) Rest, Den, (state->lo4 >> 12) & 0x1);
|
||||
dprintk("HFDIV code: %hd", state->current_tune_table_index->hfdiv);
|
||||
dprintk("VCO = %hd", state->current_tune_table_index->vco_band);
|
||||
dprintk("VCOF: ((%hd*%d) << 1))", state->current_tune_table_index->vco_multi, freq);
|
||||
|
||||
*tune_state = CT_TUNER_STEP_0;
|
||||
} else { /* we are already tuned to this frequency - the configuration is correct */
|
||||
ret = 50; /* wakeup time */
|
||||
*tune_state = CT_TUNER_STEP_5;
|
||||
}
|
||||
} else if ((*tune_state > CT_TUNER_START) && (*tune_state < CT_TUNER_STEP_4)) {
|
||||
|
||||
ret = dib0070_captrim(state, tune_state);
|
||||
|
||||
} else if (*tune_state == CT_TUNER_STEP_4) {
|
||||
const struct dib0070_wbd_gain_cfg *tmp = state->cfg->wbd_gain;
|
||||
if (tmp != NULL) {
|
||||
while (freq/1000 > tmp->freq) /* find the right one */
|
||||
tmp++;
|
||||
dib0070_write_reg(state, 0x0f,
|
||||
(0 << 15) | (1 << 14) | (3 << 12) | (6 << 9) | (0 << 8) | (1 << 7) | (state->current_tune_table_index->
|
||||
wbdmux << 0));
|
||||
state->wbd_gain_current = 6;
|
||||
}
|
||||
(0 << 15) | (1 << 14) | (3 << 12)
|
||||
| (tmp->wbd_gain_val << 9) | (0 << 8) | (1 << 7)
|
||||
| (state->current_tune_table_index->wbdmux << 0));
|
||||
state->wbd_gain_current = tmp->wbd_gain_val;
|
||||
} else {
|
||||
dib0070_write_reg(state, 0x0f,
|
||||
(0 << 15) | (1 << 14) | (3 << 12)
|
||||
| (6 << 9) | (0 << 8) | (1 << 7)
|
||||
| (state->current_tune_table_index->wbdmux << 0));
|
||||
state->wbd_gain_current = 6;
|
||||
}
|
||||
|
||||
dib0070_write_reg(state, 0x06, 0x3fff);
|
||||
dib0070_write_reg(state, 0x06, 0x3fff);
|
||||
dib0070_write_reg(state, 0x07,
|
||||
(state->current_tune_table_index->switch_trim << 11) | (7 << 8) | (state->lna_match->lna_band << 3) | (3 << 0));
|
||||
dib0070_write_reg(state, 0x08, (state->lna_match->lna_band << 10) | (3 << 7) | (127));
|
||||
dib0070_write_reg(state, 0x0d, 0x0d80);
|
||||
dib0070_write_reg(state, 0x08, (state->lna_match->lna_band << 10) | (3 << 7) | (127));
|
||||
dib0070_write_reg(state, 0x0d, 0x0d80);
|
||||
|
||||
|
||||
dib0070_write_reg(state, 0x18, 0x07ff);
|
||||
dib0070_write_reg(state, 0x17, 0x0033);
|
||||
dib0070_write_reg(state, 0x18, 0x07ff);
|
||||
dib0070_write_reg(state, 0x17, 0x0033);
|
||||
|
||||
|
||||
*tune_state = CT_TUNER_STEP_5;
|
||||
} else if (*tune_state == CT_TUNER_STEP_5) {
|
||||
dib0070_set_bandwidth(fe);
|
||||
*tune_state = CT_TUNER_STOP;
|
||||
} else {
|
||||
ret = FE_CALLBACK_TIME_NEVER; /* tuner finished, time to call again infinite */
|
||||
}
|
||||
return ret;
|
||||
*tune_state = CT_TUNER_STEP_5;
|
||||
} else if (*tune_state == CT_TUNER_STEP_5) {
|
||||
dib0070_set_bandwidth(fe);
|
||||
*tune_state = CT_TUNER_STOP;
|
||||
} else {
|
||||
ret = FE_CALLBACK_TIME_NEVER; /* tuner finished, time to call again infinite */
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int dib0070_tune(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
uint32_t ret;
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
uint32_t ret;
|
||||
|
||||
state->tune_state = CT_TUNER_START;
|
||||
state->tune_state = CT_TUNER_START;
|
||||
|
||||
do {
|
||||
ret = dib0070_tune_digital(fe);
|
||||
if (ret != FE_CALLBACK_TIME_NEVER)
|
||||
msleep(ret/10);
|
||||
else
|
||||
break;
|
||||
} while (state->tune_state != CT_TUNER_STOP);
|
||||
do {
|
||||
ret = dib0070_tune_digital(fe);
|
||||
if (ret != FE_CALLBACK_TIME_NEVER)
|
||||
msleep(ret/10);
|
||||
else
|
||||
break;
|
||||
} while (state->tune_state != CT_TUNER_STOP);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dib0070_wakeup(struct dvb_frontend *fe)
|
||||
|
|
@ -610,48 +608,48 @@ static const u16 dib0070_p1f_defaults[] =
|
|||
|
||||
static u16 dib0070_read_wbd_offset(struct dib0070_state *state, u8 gain)
|
||||
{
|
||||
u16 tuner_en = dib0070_read_reg(state, 0x20);
|
||||
u16 offset;
|
||||
u16 tuner_en = dib0070_read_reg(state, 0x20);
|
||||
u16 offset;
|
||||
|
||||
dib0070_write_reg(state, 0x18, 0x07ff);
|
||||
dib0070_write_reg(state, 0x20, 0x0800 | 0x4000 | 0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001);
|
||||
dib0070_write_reg(state, 0x0f, (1 << 14) | (2 << 12) | (gain << 9) | (1 << 8) | (1 << 7) | (0 << 0));
|
||||
msleep(9);
|
||||
offset = dib0070_read_reg(state, 0x19);
|
||||
dib0070_write_reg(state, 0x20, tuner_en);
|
||||
return offset;
|
||||
dib0070_write_reg(state, 0x18, 0x07ff);
|
||||
dib0070_write_reg(state, 0x20, 0x0800 | 0x4000 | 0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001);
|
||||
dib0070_write_reg(state, 0x0f, (1 << 14) | (2 << 12) | (gain << 9) | (1 << 8) | (1 << 7) | (0 << 0));
|
||||
msleep(9);
|
||||
offset = dib0070_read_reg(state, 0x19);
|
||||
dib0070_write_reg(state, 0x20, tuner_en);
|
||||
return offset;
|
||||
}
|
||||
|
||||
static void dib0070_wbd_offset_calibration(struct dib0070_state *state)
|
||||
{
|
||||
u8 gain;
|
||||
for (gain = 6; gain < 8; gain++) {
|
||||
state->wbd_offset_3_3[gain - 6] = ((dib0070_read_wbd_offset(state, gain) * 8 * 18 / 33 + 1) / 2);
|
||||
dprintk("Gain: %d, WBDOffset (3.3V) = %hd", gain, state->wbd_offset_3_3[gain-6]);
|
||||
}
|
||||
u8 gain;
|
||||
for (gain = 6; gain < 8; gain++) {
|
||||
state->wbd_offset_3_3[gain - 6] = ((dib0070_read_wbd_offset(state, gain) * 8 * 18 / 33 + 1) / 2);
|
||||
dprintk("Gain: %d, WBDOffset (3.3V) = %hd", gain, state->wbd_offset_3_3[gain-6]);
|
||||
}
|
||||
}
|
||||
|
||||
u16 dib0070_wbd_offset(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
const struct dib0070_wbd_gain_cfg *tmp = state->cfg->wbd_gain;
|
||||
u32 freq = fe->dtv_property_cache.frequency/1000;
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
const struct dib0070_wbd_gain_cfg *tmp = state->cfg->wbd_gain;
|
||||
u32 freq = fe->dtv_property_cache.frequency/1000;
|
||||
|
||||
if (tmp != NULL) {
|
||||
while (freq/1000 > tmp->freq) /* find the right one */
|
||||
tmp++;
|
||||
state->wbd_gain_current = tmp->wbd_gain_val;
|
||||
if (tmp != NULL) {
|
||||
while (freq/1000 > tmp->freq) /* find the right one */
|
||||
tmp++;
|
||||
state->wbd_gain_current = tmp->wbd_gain_val;
|
||||
} else
|
||||
state->wbd_gain_current = 6;
|
||||
state->wbd_gain_current = 6;
|
||||
|
||||
return state->wbd_offset_3_3[state->wbd_gain_current - 6];
|
||||
return state->wbd_offset_3_3[state->wbd_gain_current - 6];
|
||||
}
|
||||
EXPORT_SYMBOL(dib0070_wbd_offset);
|
||||
|
||||
#define pgm_read_word(w) (*w)
|
||||
static int dib0070_reset(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
u16 l, r, *n;
|
||||
|
||||
HARD_RESET(state);
|
||||
|
|
@ -664,7 +662,7 @@ static int dib0070_reset(struct dvb_frontend *fe)
|
|||
#else
|
||||
#warning forcing SBAND
|
||||
#endif
|
||||
state->revision = DIB0070S_P1A;
|
||||
state->revision = DIB0070S_P1A;
|
||||
|
||||
/* P1F or not */
|
||||
dprintk("Revision: %x", state->revision);
|
||||
|
|
@ -703,24 +701,25 @@ static int dib0070_reset(struct dvb_frontend *fe)
|
|||
dib0070_write_reg(state, 0x02, r | (1 << 5));
|
||||
}
|
||||
|
||||
if (state->revision == DIB0070S_P1A)
|
||||
dib0070_set_ctrl_lo5(fe, 2, 4, 3, 0);
|
||||
else
|
||||
dib0070_set_ctrl_lo5(fe, 5, 4, state->cfg->charge_pump, state->cfg->enable_third_order_filter);
|
||||
if (state->revision == DIB0070S_P1A)
|
||||
dib0070_set_ctrl_lo5(fe, 2, 4, 3, 0);
|
||||
else
|
||||
dib0070_set_ctrl_lo5(fe, 5, 4, state->cfg->charge_pump,
|
||||
state->cfg->enable_third_order_filter);
|
||||
|
||||
dib0070_write_reg(state, 0x01, (54 << 9) | 0xc8);
|
||||
|
||||
dib0070_wbd_offset_calibration(state);
|
||||
dib0070_wbd_offset_calibration(state);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dib0070_get_frequency(struct dvb_frontend *fe, u32 *frequency)
|
||||
{
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
|
||||
*frequency = 1000 * state->current_rf;
|
||||
return 0;
|
||||
*frequency = 1000 * state->current_rf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dib0070_release(struct dvb_frontend *fe)
|
||||
|
|
|
|||
|
|
@ -1696,12 +1696,10 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front
|
|||
|
||||
if (state->identity.p1g)
|
||||
state->dc = dc_p1g_table;
|
||||
*tune_state = CT_TUNER_STEP_0;
|
||||
|
||||
/* fall through */
|
||||
|
||||
case CT_TUNER_STEP_0:
|
||||
dprintk("Sart/continue DC calibration for %s path", (state->dc->i == 1) ? "I" : "Q");
|
||||
dprintk("Start/continue DC calibration for %s path", (state->dc->i == 1) ? "I" : "Q");
|
||||
dib0090_write_reg(state, 0x01, state->dc->bb1);
|
||||
dib0090_write_reg(state, 0x07, state->bb7 | (state->dc->i << 7));
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)
|
|||
{
|
||||
struct dib3000_state* state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
fe_code_rate_t fe_cr = FEC_NONE;
|
||||
enum fe_code_rate fe_cr = FEC_NONE;
|
||||
int search_state, seq;
|
||||
|
||||
if (tuner && fe->ops.tuner_ops.set_params) {
|
||||
|
|
@ -454,7 +454,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe)
|
|||
{
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
struct dib3000_state* state = fe->demodulator_priv;
|
||||
fe_code_rate_t *cr;
|
||||
enum fe_code_rate *cr;
|
||||
u16 tps_val;
|
||||
int inv_test1,inv_test2;
|
||||
u32 dds_val, threshold = 0x800000;
|
||||
|
|
@ -611,7 +611,8 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dib3000mb_read_status(struct dvb_frontend* fe, fe_status_t *stat)
|
||||
static int dib3000mb_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *stat)
|
||||
{
|
||||
struct dib3000_state* state = fe->demodulator_priv;
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static int dib3000mc_set_timing(struct dib3000mc_state *state, s16 nfft, u32 bw,
|
|||
static int dib3000mc_setup_pwm_state(struct dib3000mc_state *state)
|
||||
{
|
||||
u16 reg_51, reg_52 = state->cfg->agc->setup & 0xfefb;
|
||||
if (state->cfg->pwm3_inversion) {
|
||||
if (state->cfg->pwm3_inversion) {
|
||||
reg_51 = (2 << 14) | (0 << 10) | (7 << 6) | (2 << 2) | (2 << 0);
|
||||
reg_52 |= (1 << 2);
|
||||
} else {
|
||||
|
|
@ -141,12 +141,12 @@ static int dib3000mc_setup_pwm_state(struct dib3000mc_state *state)
|
|||
dib3000mc_write_word(state, 51, reg_51);
|
||||
dib3000mc_write_word(state, 52, reg_52);
|
||||
|
||||
if (state->cfg->use_pwm3)
|
||||
if (state->cfg->use_pwm3)
|
||||
dib3000mc_write_word(state, 245, (1 << 3) | (1 << 0));
|
||||
else
|
||||
dib3000mc_write_word(state, 245, 0);
|
||||
|
||||
dib3000mc_write_word(state, 1040, 0x3);
|
||||
dib3000mc_write_word(state, 1040, 0x3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ static int dib3000mc_sleep(struct dvb_frontend *demod)
|
|||
dib3000mc_write_word(state, 1032, 0xFFFF);
|
||||
dib3000mc_write_word(state, 1033, 0xFFF0);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dib3000mc_set_adp_cfg(struct dib3000mc_state *state, s16 qam)
|
||||
|
|
@ -447,10 +447,14 @@ static void dib3000mc_set_channel_cfg(struct dib3000mc_state *state,
|
|||
dib3000mc_set_bandwidth(state, bw);
|
||||
dib3000mc_set_timing(state, ch->transmission_mode, bw, 0);
|
||||
|
||||
// if (boost)
|
||||
// dib3000mc_write_word(state, 100, (11 << 6) + 6);
|
||||
// else
|
||||
#if 1
|
||||
dib3000mc_write_word(state, 100, (16 << 6) + 9);
|
||||
#else
|
||||
if (boost)
|
||||
dib3000mc_write_word(state, 100, (11 << 6) + 6);
|
||||
else
|
||||
dib3000mc_write_word(state, 100, (16 << 6) + 9);
|
||||
#endif
|
||||
|
||||
dib3000mc_write_word(state, 1027, 0x0800);
|
||||
dib3000mc_write_word(state, 1027, 0x0000);
|
||||
|
|
@ -732,7 +736,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend *fe)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dib3000mc_read_status(struct dvb_frontend *fe, fe_status_t *stat)
|
||||
static int dib3000mc_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
{
|
||||
struct dib3000mc_state *state = fe->demodulator_priv;
|
||||
u16 lock = dib3000mc_read_word(state, 509);
|
||||
|
|
|
|||
|
|
@ -1256,7 +1256,7 @@ static int dib7000m_set_frontend(struct dvb_frontend *fe)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dib7000m_read_status(struct dvb_frontend *fe, fe_status_t *stat)
|
||||
static int dib7000m_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
{
|
||||
struct dib7000m_state *state = fe->demodulator_priv;
|
||||
u16 lock = dib7000m_read_word(state, 535);
|
||||
|
|
|
|||
|
|
@ -1558,9 +1558,9 @@ static int dib7000p_set_frontend(struct dvb_frontend *fe)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dib7000p_get_stats(struct dvb_frontend *fe, fe_status_t stat);
|
||||
static int dib7000p_get_stats(struct dvb_frontend *fe, enum fe_status stat);
|
||||
|
||||
static int dib7000p_read_status(struct dvb_frontend *fe, fe_status_t * stat)
|
||||
static int dib7000p_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
{
|
||||
struct dib7000p_state *state = fe->demodulator_priv;
|
||||
u16 lock = dib7000p_read_word(state, 509);
|
||||
|
|
@ -1877,7 +1877,7 @@ static u32 dib7000p_get_time_us(struct dvb_frontend *demod)
|
|||
return time_us;
|
||||
}
|
||||
|
||||
static int dib7000p_get_stats(struct dvb_frontend *demod, fe_status_t stat)
|
||||
static int dib7000p_get_stats(struct dvb_frontend *demod, enum fe_status stat)
|
||||
{
|
||||
struct dib7000p_state *state = demod->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &demod->dtv_property_cache;
|
||||
|
|
|
|||
|
|
@ -3380,13 +3380,13 @@ static int dib8000_sleep(struct dvb_frontend *fe)
|
|||
return dib8000_set_adc_state(state, DIBX000_SLOW_ADC_OFF) | dib8000_set_adc_state(state, DIBX000_ADC_OFF);
|
||||
}
|
||||
|
||||
static int dib8000_read_status(struct dvb_frontend *fe, fe_status_t * stat);
|
||||
static int dib8000_read_status(struct dvb_frontend *fe, enum fe_status *stat);
|
||||
|
||||
static int dib8000_get_frontend(struct dvb_frontend *fe)
|
||||
{
|
||||
struct dib8000_state *state = fe->demodulator_priv;
|
||||
u16 i, val = 0;
|
||||
fe_status_t stat = 0;
|
||||
enum fe_status stat = 0;
|
||||
u8 index_frontend, sub_index_frontend;
|
||||
|
||||
fe->dtv_property_cache.bandwidth_hz = 6000000;
|
||||
|
|
@ -3733,9 +3733,9 @@ static int dib8000_set_frontend(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dib8000_get_stats(struct dvb_frontend *fe, fe_status_t stat);
|
||||
static int dib8000_get_stats(struct dvb_frontend *fe, enum fe_status stat);
|
||||
|
||||
static int dib8000_read_status(struct dvb_frontend *fe, fe_status_t * stat)
|
||||
static int dib8000_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
{
|
||||
struct dib8000_state *state = fe->demodulator_priv;
|
||||
u16 lock_slave = 0, lock;
|
||||
|
|
@ -4089,7 +4089,7 @@ static u32 dib8000_get_time_us(struct dvb_frontend *fe, int layer)
|
|||
return time_us;
|
||||
}
|
||||
|
||||
static int dib8000_get_stats(struct dvb_frontend *fe, fe_status_t stat)
|
||||
static int dib8000_get_stats(struct dvb_frontend *fe, enum fe_status stat)
|
||||
{
|
||||
struct dib8000_state *state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &state->fe[0]->dtv_property_cache;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ struct dib8000_ops {
|
|||
#if IS_REACHABLE(CONFIG_DVB_DIB8000)
|
||||
void *dib8000_attach(struct dib8000_ops *ops);
|
||||
#else
|
||||
static inline int dib8000_attach(struct dib8000_ops *ops)
|
||||
static inline void *dib8000_attach(struct dib8000_ops *ops)
|
||||
{
|
||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -1893,7 +1893,7 @@ static int dib9000_get_frontend(struct dvb_frontend *fe)
|
|||
{
|
||||
struct dib9000_state *state = fe->demodulator_priv;
|
||||
u8 index_frontend, sub_index_frontend;
|
||||
fe_status_t stat;
|
||||
enum fe_status stat;
|
||||
int ret = 0;
|
||||
|
||||
if (state->get_frontend_internal == 0) {
|
||||
|
|
@ -2161,7 +2161,7 @@ static u16 dib9000_read_lock(struct dvb_frontend *fe)
|
|||
return dib9000_read_word(state, 535);
|
||||
}
|
||||
|
||||
static int dib9000_read_status(struct dvb_frontend *fe, fe_status_t * stat)
|
||||
static int dib9000_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
{
|
||||
struct dib9000_state *state = fe->demodulator_priv;
|
||||
u8 index_frontend;
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ DEFINES
|
|||
|
||||
/**
|
||||
* \def DRXJ_DEF_I2C_ADDR
|
||||
* \brief Default I2C addres of a demodulator instance.
|
||||
* \brief Default I2C address of a demodulator instance.
|
||||
*/
|
||||
#define DRXJ_DEF_I2C_ADDR (0x52)
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ DEFINES
|
|||
* MICROCODE RELATED DEFINES
|
||||
*/
|
||||
|
||||
/* Magic word for checking correct Endianess of microcode data */
|
||||
/* Magic word for checking correct Endianness of microcode data */
|
||||
#define DRX_UCODE_MAGIC_WORD ((((u16)'H')<<8)+((u16)'L'))
|
||||
|
||||
/* CRC flag in ucode header, flags field. */
|
||||
|
|
@ -847,9 +847,9 @@ static struct drx_common_attr drxj_default_comm_attr_g = {
|
|||
static clockrate is selected */
|
||||
DRX_MPEG_STR_WIDTH_1 /* MPEG Start width in clock cycles */
|
||||
},
|
||||
/* Initilisations below can be ommited, they require no user input and
|
||||
/* Initilisations below can be omitted, they require no user input and
|
||||
are initialy 0, NULL or false. The compiler will initialize them to these
|
||||
values when ommited. */
|
||||
values when omitted. */
|
||||
false, /* is_opened */
|
||||
|
||||
/* SCAN */
|
||||
|
|
@ -1175,7 +1175,7 @@ static u32 log1_times100(u32 x)
|
|||
Now x has binary point between bit[scale] and bit[scale-1]
|
||||
and 1.0 <= x < 2.0 */
|
||||
|
||||
/* correction for divison: log(x) = log(x/y)+log(y) */
|
||||
/* correction for division: log(x) = log(x/y)+log(y) */
|
||||
y = k * ((((u32) 1) << scale) * 200);
|
||||
|
||||
/* remove integer part */
|
||||
|
|
@ -1653,7 +1653,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
|
|||
sequense will be visible: (1) write address {i2c addr,
|
||||
4 bytes chip address} (2) write data {i2c addr, 4 bytes data }
|
||||
(3) write address (4) write data etc...
|
||||
Addres must be rewriten because HI is reset after data transport and
|
||||
Address must be rewriten because HI is reset after data transport and
|
||||
expects an address.
|
||||
*/
|
||||
todo = (block_size < datasize ? block_size : datasize);
|
||||
|
|
@ -2971,7 +2971,7 @@ ctrl_set_cfg_mpeg_output(struct drx_demod_instance *demod, struct drx_cfg_mpeg_o
|
|||
} /* ext_attr->standard */
|
||||
}
|
||||
|
||||
if (cfg_data->enable_parallel == true) { /* MPEG data output is paralel -> clear ipr_mode[0] */
|
||||
if (cfg_data->enable_parallel == true) { /* MPEG data output is parallel -> clear ipr_mode[0] */
|
||||
fec_oc_reg_ipr_mode &= (~(FEC_OC_IPR_MODE_SERIAL__M));
|
||||
} else { /* MPEG data output is serial -> set ipr_mode[0] */
|
||||
fec_oc_reg_ipr_mode |= FEC_OC_IPR_MODE_SERIAL__M;
|
||||
|
|
@ -3157,7 +3157,7 @@ ctrl_set_cfg_mpeg_output(struct drx_demod_instance *demod, struct drx_cfg_mpeg_o
|
|||
pr_err("error %d\n", rc);
|
||||
goto rw_error;
|
||||
}
|
||||
if (cfg_data->enable_parallel == true) { /* MPEG data output is paralel -> set MD1 to MD7 to output mode */
|
||||
if (cfg_data->enable_parallel == true) { /* MPEG data output is parallel -> set MD1 to MD7 to output mode */
|
||||
sio_pdr_md_cfg =
|
||||
MPEG_PARALLEL_OUTPUT_PIN_DRIVE_STRENGTH <<
|
||||
SIO_PDR_MD0_CFG_DRIVE__B | 0x03 <<
|
||||
|
|
@ -4320,7 +4320,7 @@ static int adc_synchronization(struct drx_demod_instance *demod)
|
|||
}
|
||||
|
||||
if (count == 1) {
|
||||
/* Try sampling on a diffrent edge */
|
||||
/* Try sampling on a different edge */
|
||||
u16 clk_neg = 0;
|
||||
|
||||
rc = drxj_dap_read_reg16(dev_addr, IQM_AF_CLKNEG__A, &clk_neg, 0);
|
||||
|
|
@ -6461,7 +6461,7 @@ set_qam_measurement(struct drx_demod_instance *demod,
|
|||
enum drx_modulation constellation, u32 symbol_rate)
|
||||
{
|
||||
struct i2c_device_addr *dev_addr = NULL; /* device address for I2C writes */
|
||||
struct drxj_data *ext_attr = NULL; /* Global data container for DRXJ specif data */
|
||||
struct drxj_data *ext_attr = NULL; /* Global data container for DRXJ specific data */
|
||||
int rc;
|
||||
u32 fec_bits_desired = 0; /* BER accounting period */
|
||||
u16 fec_rs_plen = 0; /* defines RS BER measurement period */
|
||||
|
|
@ -8864,7 +8864,7 @@ qam64auto(struct drx_demod_instance *demod,
|
|||
u32 timeout_ofs = 0;
|
||||
u16 data = 0;
|
||||
|
||||
/* external attributes for storing aquired channel constellation */
|
||||
/* external attributes for storing acquired channel constellation */
|
||||
*lock_status = DRX_NOT_LOCKED;
|
||||
start_time = jiffies_to_msecs(jiffies);
|
||||
lck_state = NO_LOCK;
|
||||
|
|
@ -9011,7 +9011,7 @@ qam256auto(struct drx_demod_instance *demod,
|
|||
u32 d_locked_time = 0;
|
||||
u32 timeout_ofs = DRXJ_QAM_DEMOD_LOCK_EXT_WAITTIME;
|
||||
|
||||
/* external attributes for storing aquired channel constellation */
|
||||
/* external attributes for storing acquired channel constellation */
|
||||
*lock_status = DRX_NOT_LOCKED;
|
||||
start_time = jiffies_to_msecs(jiffies);
|
||||
lck_state = NO_LOCK;
|
||||
|
|
@ -9087,7 +9087,7 @@ set_qam_channel(struct drx_demod_instance *demod,
|
|||
enum drx_lock_status lock_status = DRX_NOT_LOCKED;
|
||||
bool auto_flag = false;
|
||||
|
||||
/* external attributes for storing aquired channel constellation */
|
||||
/* external attributes for storing acquired channel constellation */
|
||||
ext_attr = (struct drxj_data *) demod->my_ext_attr;
|
||||
|
||||
/* set QAM channel constellation */
|
||||
|
|
@ -9431,7 +9431,7 @@ rw_error:
|
|||
|
||||
/**
|
||||
* \fn int ctrl_get_qam_sig_quality()
|
||||
* \brief Retreive QAM signal quality from device.
|
||||
* \brief Retrieve QAM signal quality from device.
|
||||
* \param devmod Pointer to demodulator instance.
|
||||
* \param sig_quality Pointer to signal quality data.
|
||||
* \return int.
|
||||
|
|
@ -9541,7 +9541,7 @@ ctrl_get_qam_sig_quality(struct drx_demod_instance *demod)
|
|||
/* ----------------------------------------- */
|
||||
/* Pre Viterbi Symbol Error Rate Calculation */
|
||||
/* ----------------------------------------- */
|
||||
/* pre viterbi SER is good if it is bellow 0.025 */
|
||||
/* pre viterbi SER is good if it is below 0.025 */
|
||||
|
||||
/* get the register value */
|
||||
/* no of quadrature symbol errors */
|
||||
|
|
@ -10647,7 +10647,7 @@ rw_error:
|
|||
|
||||
/**
|
||||
* \fn int ctrl_sig_quality()
|
||||
* \brief Retreive signal quality form device.
|
||||
* \brief Retrieve signal quality form device.
|
||||
* \param devmod Pointer to demodulator instance.
|
||||
* \param sig_quality Pointer to signal quality data.
|
||||
* \return int.
|
||||
|
|
@ -10763,7 +10763,7 @@ rw_error:
|
|||
|
||||
/**
|
||||
* \fn int ctrl_lock_status()
|
||||
* \brief Retreive lock status .
|
||||
* \brief Retrieve lock status .
|
||||
* \param dev_addr Pointer to demodulator device address.
|
||||
* \param lock_stat Pointer to lock status structure.
|
||||
* \return int.
|
||||
|
|
@ -10815,7 +10815,7 @@ ctrl_lock_status(struct drx_demod_instance *demod, enum drx_lock_status *lock_st
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
/* define the SCU command paramters and execute the command */
|
||||
/* define the SCU command parameters and execute the command */
|
||||
cmd_scu.parameter_len = 0;
|
||||
cmd_scu.result_len = 2;
|
||||
cmd_scu.parameter = NULL;
|
||||
|
|
@ -11489,7 +11489,7 @@ static int drxj_open(struct drx_demod_instance *demod)
|
|||
}
|
||||
|
||||
/* Stamp driver version number in SCU data RAM in BCD code
|
||||
Done to enable field application engineers to retreive drxdriver version
|
||||
Done to enable field application engineers to retrieve drxdriver version
|
||||
via I2C from SCU RAM
|
||||
*/
|
||||
driver_version = (VERSION_MAJOR / 100) % 10;
|
||||
|
|
@ -11892,7 +11892,7 @@ release:
|
|||
return rc;
|
||||
}
|
||||
|
||||
/* caller is expeced to check if lna is supported before enabling */
|
||||
/* caller is expected to check if lna is supported before enabling */
|
||||
static int drxj_set_lna_state(struct drx_demod_instance *demod, bool state)
|
||||
{
|
||||
struct drxuio_cfg uio_cfg;
|
||||
|
|
@ -11946,7 +11946,7 @@ static int drx39xxj_set_powerstate(struct dvb_frontend *fe, int enable)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int drx39xxj_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int drx39xxj_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct drx39xxj_state *state = fe->demodulator_priv;
|
||||
struct drx_demod_instance *demod = state->demod;
|
||||
|
|
|
|||
|
|
@ -2805,7 +2805,7 @@ static int drxd_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int drxd_read_status(struct dvb_frontend *fe, fe_status_t * status)
|
||||
static int drxd_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct drxd_state *state = fe->demodulator_priv;
|
||||
u32 lock;
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ error:
|
|||
static int init_state(struct drxk_state *state)
|
||||
{
|
||||
/*
|
||||
* FIXME: most (all?) of the values bellow should be moved into
|
||||
* FIXME: most (all?) of the values below should be moved into
|
||||
* struct drxk_config, as they are probably board-specific
|
||||
*/
|
||||
u32 ul_vsb_if_agc_mode = DRXK_AGC_CTRL_AUTO;
|
||||
|
|
@ -3262,6 +3262,7 @@ static int dvbt_sc_command(struct drxk_state *state,
|
|||
}
|
||||
|
||||
/* Write needed parameters and the command */
|
||||
status = 0;
|
||||
switch (cmd) {
|
||||
/* All commands using 5 parameters */
|
||||
/* All commands using 4 parameters */
|
||||
|
|
@ -3270,16 +3271,16 @@ static int dvbt_sc_command(struct drxk_state *state,
|
|||
case OFDM_SC_RA_RAM_CMD_PROC_START:
|
||||
case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM:
|
||||
case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM:
|
||||
status = write16(state, OFDM_SC_RA_RAM_PARAM1__A, param1);
|
||||
status |= write16(state, OFDM_SC_RA_RAM_PARAM1__A, param1);
|
||||
/* All commands using 1 parameters */
|
||||
case OFDM_SC_RA_RAM_CMD_SET_ECHO_TIMING:
|
||||
case OFDM_SC_RA_RAM_CMD_USER_IO:
|
||||
status = write16(state, OFDM_SC_RA_RAM_PARAM0__A, param0);
|
||||
status |= write16(state, OFDM_SC_RA_RAM_PARAM0__A, param0);
|
||||
/* All commands using 0 parameters */
|
||||
case OFDM_SC_RA_RAM_CMD_GET_OP_PARAM:
|
||||
case OFDM_SC_RA_RAM_CMD_NULL:
|
||||
/* Write command */
|
||||
status = write16(state, OFDM_SC_RA_RAM_CMD__A, cmd);
|
||||
status |= write16(state, OFDM_SC_RA_RAM_CMD__A, cmd);
|
||||
break;
|
||||
default:
|
||||
/* Unknown command */
|
||||
|
|
@ -6639,7 +6640,7 @@ error:
|
|||
}
|
||||
|
||||
|
||||
static int drxk_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int drxk_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct drxk_state *state = fe->demodulator_priv;
|
||||
int rc;
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ struct drxk_state {
|
|||
bool antenna_dvbt;
|
||||
u16 antenna_gpio;
|
||||
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
|
||||
/* Firmware */
|
||||
const char *microcode_name;
|
||||
|
|
|
|||
|
|
@ -404,7 +404,8 @@ static int ds3000_load_firmware(struct dvb_frontend *fe,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ds3000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
||||
static int ds3000_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct ds3000_state *state = fe->demodulator_priv;
|
||||
u8 data;
|
||||
|
|
@ -431,7 +432,7 @@ static int ds3000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ds3000_read_status(struct dvb_frontend *fe, fe_status_t* status)
|
||||
static int ds3000_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct ds3000_state *state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
|
|
@ -666,7 +667,7 @@ static int ds3000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ds3000_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
||||
static int ds3000_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct ds3000_state *state = fe->demodulator_priv;
|
||||
u8 data;
|
||||
|
|
@ -766,7 +767,7 @@ static int ds3000_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
|
||||
/* Send DiSEqC burst */
|
||||
static int ds3000_diseqc_send_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t burst)
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct ds3000_state *state = fe->demodulator_priv;
|
||||
int i;
|
||||
|
|
@ -905,7 +906,7 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
|
|||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
|
||||
int i;
|
||||
fe_status_t status;
|
||||
enum fe_status status;
|
||||
s32 offset_khz;
|
||||
u32 frequency;
|
||||
u16 value;
|
||||
|
|
@ -1045,7 +1046,7 @@ static int ds3000_tune(struct dvb_frontend *fe,
|
|||
bool re_tune,
|
||||
unsigned int mode_flags,
|
||||
unsigned int *delay,
|
||||
fe_status_t *status)
|
||||
enum fe_status *status)
|
||||
{
|
||||
if (re_tune) {
|
||||
int ret = ds3000_set_frontend(fe);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ struct dvb_dummy_fe_state {
|
|||
};
|
||||
|
||||
|
||||
static int dvb_dummy_fe_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int dvb_dummy_fe_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
*status = FE_HAS_SIGNAL
|
||||
| FE_HAS_CARRIER
|
||||
|
|
@ -97,12 +98,14 @@ static int dvb_dummy_fe_init(struct dvb_frontend* fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dvb_dummy_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
|
||||
static int dvb_dummy_fe_set_tone(struct dvb_frontend *fe,
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvb_dummy_fe_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
|
||||
static int dvb_dummy_fe_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ static int ec100_get_tune_settings(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ec100_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int ec100_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct ec100_state *state = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hd29l2_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int hd29l2_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
int ret;
|
||||
struct hd29l2_priv *priv = fe->demodulator_priv;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct hd29l2_priv {
|
|||
struct hd29l2_config cfg;
|
||||
u8 tuner_i2c_addr_programmed:1;
|
||||
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
};
|
||||
|
||||
static const struct reg_mod_vals reg_mod_vals_tab[] = {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ struct isl6405 {
|
|||
u8 i2c_addr;
|
||||
};
|
||||
|
||||
static int isl6405_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
||||
static int isl6405_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ struct isl6421 {
|
|||
u8 i2c_addr;
|
||||
};
|
||||
|
||||
static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
||||
static int isl6421_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct isl6421 *isl6421 = (struct isl6421 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0,
|
||||
|
|
@ -89,7 +90,8 @@ static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
|
|||
return (i2c_transfer(isl6421->i2c, &msg, 1) == 1) ? 0 : -EIO;
|
||||
}
|
||||
|
||||
static int isl6421_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
|
||||
static int isl6421_set_tone(struct dvb_frontend *fe,
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct isl6421 *isl6421 = (struct isl6421 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0,
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ static int get_frontend(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l64781_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int l64781_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct l64781_state* state = fe->demodulator_priv;
|
||||
int sync = l64781_readreg (state, 0x32);
|
||||
|
|
|
|||
|
|
@ -1203,7 +1203,7 @@ static int lg216x_read_lock_status(struct lg216x_state *state,
|
|||
#endif
|
||||
}
|
||||
|
||||
static int lg216x_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int lg216x_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct lg216x_state *state = fe->demodulator_priv;
|
||||
int ret, acq_lock, sync_lock;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ struct lgdt3305_state {
|
|||
|
||||
struct dvb_frontend frontend;
|
||||
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
u32 current_frequency;
|
||||
u32 snr;
|
||||
};
|
||||
|
|
@ -912,7 +912,7 @@ fail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int lgdt3305_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int lgdt3305_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct lgdt3305_state *state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ struct lgdt3306a_state {
|
|||
|
||||
struct dvb_frontend frontend;
|
||||
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
u32 current_frequency;
|
||||
u32 snr;
|
||||
};
|
||||
|
|
@ -1558,7 +1558,8 @@ lgdt3306a_qam_lock_poll(struct lgdt3306a_state *state)
|
|||
return LG3306_UNLOCK;
|
||||
}
|
||||
|
||||
static int lgdt3306a_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int lgdt3306a_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct lgdt3306a_state *state = fe->demodulator_priv;
|
||||
u16 strength = 0;
|
||||
|
|
@ -1705,7 +1706,7 @@ static int lgdt3306a_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
|||
|
||||
static int lgdt3306a_tune(struct dvb_frontend *fe, bool re_tune,
|
||||
unsigned int mode_flags, unsigned int *delay,
|
||||
fe_status_t *status)
|
||||
enum fe_status *status)
|
||||
{
|
||||
int ret = 0;
|
||||
struct lgdt3306a_state *state = fe->demodulator_priv;
|
||||
|
|
@ -1735,7 +1736,7 @@ static int lgdt3306a_get_tune_settings(struct dvb_frontend *fe,
|
|||
|
||||
static int lgdt3306a_search(struct dvb_frontend *fe)
|
||||
{
|
||||
fe_status_t status = 0;
|
||||
enum fe_status status = 0;
|
||||
int i, ret;
|
||||
|
||||
/* set frontend */
|
||||
|
|
@ -2101,7 +2102,7 @@ static void lgdt3306a_DumpRegs(struct lgdt3306a_state *state)
|
|||
lgdt3306a_read_reg(state, regtab[i], ®val1[i]);
|
||||
if (regval1[i] != regval2[i]) {
|
||||
lg_debug(" %04X = %02X\n", regtab[i], regval1[i]);
|
||||
regval2[i] = regval1[i];
|
||||
regval2[i] = regval1[i];
|
||||
}
|
||||
}
|
||||
debug = sav_debug;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct lgdt330x_state
|
|||
struct dvb_frontend frontend;
|
||||
|
||||
/* Demodulator private data */
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
u32 snr; /* Result of last SNR calculation */
|
||||
|
||||
/* Tuner private data */
|
||||
|
|
@ -447,7 +447,8 @@ static int lgdt330x_get_frontend(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int lgdt3302_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct lgdt330x_state* state = fe->demodulator_priv;
|
||||
u8 buf[3];
|
||||
|
|
@ -505,7 +506,8 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int lgdt3303_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct lgdt330x_state* state = fe->demodulator_priv;
|
||||
int err;
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ lgs8gl5_init(struct dvb_frontend *fe)
|
|||
|
||||
|
||||
static int
|
||||
lgs8gl5_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
lgs8gl5_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct lgs8gl5_state *state = fe->demodulator_priv;
|
||||
u8 level = lgs8gl5_read_reg(state, REG_STRENGTH);
|
||||
|
|
|
|||
|
|
@ -732,7 +732,8 @@ int lgs8gxx_get_tune_settings(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lgs8gxx_read_status(struct dvb_frontend *fe, fe_status_t *fe_status)
|
||||
static int lgs8gxx_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *fe_status)
|
||||
{
|
||||
struct lgs8gxx_state *priv = fe->demodulator_priv;
|
||||
s8 ret;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ struct lnbp21 {
|
|||
};
|
||||
|
||||
static int lnbp21_set_voltage(struct dvb_frontend *fe,
|
||||
fe_sec_voltage_t voltage)
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = lnbp21->i2c_addr, .flags = 0,
|
||||
|
|
@ -92,7 +92,7 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
|
|||
}
|
||||
|
||||
static int lnbp21_set_tone(struct dvb_frontend *fe,
|
||||
fe_sec_tone_mode_t tone)
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = lnbp21->i2c_addr, .flags = 0,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ struct lnbp22 {
|
|||
struct i2c_adapter *i2c;
|
||||
};
|
||||
|
||||
static int lnbp22_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
||||
static int lnbp22_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct lnbp22 *lnbp22 = (struct lnbp22 *)fe->sec_priv;
|
||||
struct i2c_msg msg = {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Montage M88DS3103 demodulator driver
|
||||
* Montage Technology M88DS3103/M88RS6000 demodulator driver
|
||||
*
|
||||
* Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
|
||||
*
|
||||
|
|
@ -19,6 +19,63 @@
|
|||
|
||||
#include <linux/dvb/frontend.h>
|
||||
|
||||
/*
|
||||
* I2C address
|
||||
* 0x68,
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct m88ds3103_platform_data - Platform data for the m88ds3103 driver
|
||||
* @clk: Clock frequency.
|
||||
* @i2c_wr_max: Max bytes I2C adapter can write at once.
|
||||
* @ts_mode: TS mode.
|
||||
* @ts_clk: TS clock (KHz).
|
||||
* @ts_clk_pol: TS clk polarity. 1-active at falling edge; 0-active at rising
|
||||
* edge.
|
||||
* @spec_inv: Input spectrum inversion.
|
||||
* @agc: AGC configuration.
|
||||
* @agc_inv: AGC polarity.
|
||||
* @clk_out: Clock output.
|
||||
* @envelope_mode: DiSEqC envelope mode.
|
||||
* @lnb_hv_pol: LNB H/V pin polarity. 0: pin high set to VOLTAGE_18, pin low to
|
||||
* set VOLTAGE_13. 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18.
|
||||
* @lnb_en_pol: LNB enable pin polarity. 0: pin high to disable, pin low to
|
||||
* enable. 1: pin high to enable, pin low to disable.
|
||||
* @get_dvb_frontend: Get DVB frontend.
|
||||
* @get_i2c_adapter: Get I2C adapter.
|
||||
*/
|
||||
|
||||
struct m88ds3103_platform_data {
|
||||
u32 clk;
|
||||
u16 i2c_wr_max;
|
||||
#define M88DS3103_TS_SERIAL 0 /* TS output pin D0, normal */
|
||||
#define M88DS3103_TS_SERIAL_D7 1 /* TS output pin D7 */
|
||||
#define M88DS3103_TS_PARALLEL 2 /* TS Parallel mode */
|
||||
#define M88DS3103_TS_CI 3 /* TS CI Mode */
|
||||
u8 ts_mode:2;
|
||||
u32 ts_clk;
|
||||
u8 ts_clk_pol:1;
|
||||
u8 spec_inv:1;
|
||||
u8 agc;
|
||||
u8 agc_inv:1;
|
||||
#define M88DS3103_CLOCK_OUT_DISABLED 0
|
||||
#define M88DS3103_CLOCK_OUT_ENABLED 1
|
||||
#define M88DS3103_CLOCK_OUT_ENABLED_DIV2 2
|
||||
u8 clk_out:2;
|
||||
u8 envelope_mode:1;
|
||||
u8 lnb_hv_pol:1;
|
||||
u8 lnb_en_pol:1;
|
||||
|
||||
struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
|
||||
struct i2c_adapter* (*get_i2c_adapter)(struct i2c_client *);
|
||||
|
||||
/* private: For legacy media attach wrapper. Do not set value. */
|
||||
u8 attach_in_use:1;
|
||||
};
|
||||
|
||||
/*
|
||||
* Do not add new m88ds3103_attach() users! Use I2C bindings instead.
|
||||
*/
|
||||
struct m88ds3103_config {
|
||||
/*
|
||||
* I2C address
|
||||
|
|
@ -113,18 +170,13 @@ struct m88ds3103_config {
|
|||
u8 lnb_en_pol:1;
|
||||
};
|
||||
|
||||
/*
|
||||
* Driver implements own I2C-adapter for tuner I2C access. That's since chip
|
||||
* has I2C-gate control which closes gate automatically after I2C transfer.
|
||||
* Using own I2C adapter we can workaround that.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DVB_M88DS3103) || \
|
||||
(defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
|
||||
extern struct dvb_frontend *m88ds3103_attach(
|
||||
const struct m88ds3103_config *config,
|
||||
struct i2c_adapter *i2c,
|
||||
struct i2c_adapter **tuner_i2c);
|
||||
extern int m88ds3103_get_agc_pwm(struct dvb_frontend *fe, u8 *_agc_pwm);
|
||||
#else
|
||||
static inline struct dvb_frontend *m88ds3103_attach(
|
||||
const struct m88ds3103_config *config,
|
||||
|
|
@ -134,6 +186,7 @@ static inline struct dvb_frontend *m88ds3103_attach(
|
|||
pr_warn("%s: driver disabled by Kconfig\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
#define m88ds3103_get_agc_pwm NULL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Montage M88DS3103 demodulator driver
|
||||
* Montage Technology M88DS3103/M88RS6000 demodulator driver
|
||||
*
|
||||
* Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
|
||||
*
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
#include "dvb_math.h"
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/math64.h>
|
||||
|
||||
#define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
|
||||
|
|
@ -30,21 +31,24 @@
|
|||
#define M88RS6000_CHIP_ID 0x74
|
||||
#define M88DS3103_CHIP_ID 0x70
|
||||
|
||||
struct m88ds3103_priv {
|
||||
struct i2c_adapter *i2c;
|
||||
/* mutex needed due to own tuner I2C adapter */
|
||||
struct mutex i2c_mutex;
|
||||
struct m88ds3103_dev {
|
||||
struct i2c_client *client;
|
||||
struct regmap_config regmap_config;
|
||||
struct regmap *regmap;
|
||||
struct m88ds3103_config config;
|
||||
const struct m88ds3103_config *cfg;
|
||||
struct dvb_frontend fe;
|
||||
fe_delivery_system_t delivery_system;
|
||||
fe_status_t fe_status;
|
||||
u32 ber;
|
||||
enum fe_delivery_system delivery_system;
|
||||
enum fe_status fe_status;
|
||||
u32 dvbv3_ber; /* for old DVBv3 API read_ber */
|
||||
bool warm; /* FW running */
|
||||
struct i2c_adapter *i2c_adapter;
|
||||
/* auto detect chip id to do different config */
|
||||
u8 chip_id;
|
||||
/* main mclk is calculated for M88RS6000 dynamically */
|
||||
u32 mclk_khz;
|
||||
u64 post_bit_error;
|
||||
u64 post_bit_count;
|
||||
};
|
||||
|
||||
struct m88ds3103_reg_val {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ struct m88rs2000_state {
|
|||
u8 no_lock_count;
|
||||
u32 tuner_frequency;
|
||||
u32 symbol_rate;
|
||||
fe_code_rate_t fec_inner;
|
||||
enum fe_code_rate fec_inner;
|
||||
u8 tuner_level;
|
||||
int errmode;
|
||||
};
|
||||
|
|
@ -247,7 +247,7 @@ static int m88rs2000_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
}
|
||||
|
||||
static int m88rs2000_send_diseqc_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t burst)
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct m88rs2000_state *state = fe->demodulator_priv;
|
||||
u8 reg0, reg1;
|
||||
|
|
@ -264,7 +264,8 @@ static int m88rs2000_send_diseqc_burst(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int m88rs2000_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
||||
static int m88rs2000_set_tone(struct dvb_frontend *fe,
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct m88rs2000_state *state = fe->demodulator_priv;
|
||||
u8 reg0, reg1;
|
||||
|
|
@ -412,7 +413,8 @@ static int m88rs2000_tab_set(struct m88rs2000_state *state,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int m88rs2000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t volt)
|
||||
static int m88rs2000_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage volt)
|
||||
{
|
||||
struct m88rs2000_state *state = fe->demodulator_priv;
|
||||
u8 data;
|
||||
|
|
@ -462,7 +464,8 @@ static int m88rs2000_sleep(struct dvb_frontend *fe)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int m88rs2000_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int m88rs2000_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct m88rs2000_state *state = fe->demodulator_priv;
|
||||
u8 reg = m88rs2000_readreg(state, 0x8c);
|
||||
|
|
@ -539,7 +542,7 @@ static int m88rs2000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
|||
}
|
||||
|
||||
static int m88rs2000_set_fec(struct m88rs2000_state *state,
|
||||
fe_code_rate_t fec)
|
||||
enum fe_code_rate fec)
|
||||
{
|
||||
u8 fec_set, reg;
|
||||
int ret;
|
||||
|
|
@ -574,7 +577,7 @@ static int m88rs2000_set_fec(struct m88rs2000_state *state,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static fe_code_rate_t m88rs2000_get_fec(struct m88rs2000_state *state)
|
||||
static enum fe_code_rate m88rs2000_get_fec(struct m88rs2000_state *state)
|
||||
{
|
||||
u8 reg;
|
||||
m88rs2000_writereg(state, 0x9a, 0x30);
|
||||
|
|
@ -606,7 +609,7 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe)
|
|||
{
|
||||
struct m88rs2000_state *state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
fe_status_t status;
|
||||
enum fe_status status;
|
||||
int i, ret = 0;
|
||||
u32 tuner_freq;
|
||||
s16 offset = 0;
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ err:
|
|||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
static int mb86a16_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int mb86a16_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
u8 stat, stat2;
|
||||
struct mb86a16_state *state = fe->demodulator_priv;
|
||||
|
|
@ -1562,7 +1562,8 @@ err:
|
|||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
static int mb86a16_send_diseqc_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t burst)
|
||||
static int mb86a16_send_diseqc_burst(struct dvb_frontend *fe,
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct mb86a16_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -1590,7 +1591,7 @@ err:
|
|||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
static int mb86a16_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
||||
static int mb86a16_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct mb86a16_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
struct mb86a16_config {
|
||||
u8 demod_address;
|
||||
|
||||
int (*set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
|
||||
int (*set_voltage)(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ static int mb86a20s_i2c_readreg(struct mb86a20s_state *state,
|
|||
* The functions below assume that gateway lock has already obtained
|
||||
*/
|
||||
|
||||
static int mb86a20s_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct mb86a20s_state *state = fe->demodulator_priv;
|
||||
int val;
|
||||
|
|
@ -1951,7 +1951,7 @@ static int mb86a20s_set_frontend(struct dvb_frontend *fe)
|
|||
}
|
||||
|
||||
static int mb86a20s_read_status_and_stats(struct dvb_frontend *fe,
|
||||
fe_status_t *status)
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct mb86a20s_state *state = fe->demodulator_priv;
|
||||
int rc, status_nr;
|
||||
|
|
@ -2042,7 +2042,7 @@ static int mb86a20s_tune(struct dvb_frontend *fe,
|
|||
bool re_tune,
|
||||
unsigned int mode_flags,
|
||||
unsigned int *delay,
|
||||
fe_status_t *status)
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct mb86a20s_state *state = fe->demodulator_priv;
|
||||
int rc = 0;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static inline struct dvb_frontend *mb86a20s_attach(
|
|||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
static struct i2c_adapter *
|
||||
static inline struct i2c_adapter *
|
||||
mb86a20s_get_tuner_i2c_adapter(struct dvb_frontend *fe)
|
||||
{
|
||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ static int mt312_reset(struct mt312_state *state, const u8 full)
|
|||
}
|
||||
|
||||
static int mt312_get_inversion(struct mt312_state *state,
|
||||
fe_spectral_inversion_t *i)
|
||||
enum fe_spectral_inversion *i)
|
||||
{
|
||||
int ret;
|
||||
u8 vit_mode;
|
||||
|
|
@ -225,9 +225,9 @@ static int mt312_get_symbol_rate(struct mt312_state *state, u32 *sr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt312_get_code_rate(struct mt312_state *state, fe_code_rate_t *cr)
|
||||
static int mt312_get_code_rate(struct mt312_state *state, enum fe_code_rate *cr)
|
||||
{
|
||||
const fe_code_rate_t fec_tab[8] =
|
||||
const enum fe_code_rate fec_tab[8] =
|
||||
{ FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_6_7, FEC_7_8,
|
||||
FEC_AUTO, FEC_AUTO };
|
||||
|
||||
|
|
@ -380,7 +380,8 @@ static int mt312_send_master_cmd(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt312_send_burst(struct dvb_frontend *fe, const fe_sec_mini_cmd_t c)
|
||||
static int mt312_send_burst(struct dvb_frontend *fe,
|
||||
const enum fe_sec_mini_cmd c)
|
||||
{
|
||||
struct mt312_state *state = fe->demodulator_priv;
|
||||
const u8 mini_tab[2] = { 0x02, 0x03 };
|
||||
|
|
@ -403,7 +404,8 @@ static int mt312_send_burst(struct dvb_frontend *fe, const fe_sec_mini_cmd_t c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt312_set_tone(struct dvb_frontend *fe, const fe_sec_tone_mode_t t)
|
||||
static int mt312_set_tone(struct dvb_frontend *fe,
|
||||
const enum fe_sec_tone_mode t)
|
||||
{
|
||||
struct mt312_state *state = fe->demodulator_priv;
|
||||
const u8 tone_tab[2] = { 0x01, 0x00 };
|
||||
|
|
@ -426,7 +428,8 @@ static int mt312_set_tone(struct dvb_frontend *fe, const fe_sec_tone_mode_t t)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v)
|
||||
static int mt312_set_voltage(struct dvb_frontend *fe,
|
||||
const enum fe_sec_voltage v)
|
||||
{
|
||||
struct mt312_state *state = fe->demodulator_priv;
|
||||
const u8 volt_tab[3] = { 0x00, 0x40, 0x00 };
|
||||
|
|
@ -442,7 +445,7 @@ static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v)
|
|||
return mt312_writereg(state, DISEQC_MODE, val);
|
||||
}
|
||||
|
||||
static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s)
|
||||
static int mt312_read_status(struct dvb_frontend *fe, enum fe_status *s)
|
||||
{
|
||||
struct mt312_state *state = fe->demodulator_priv;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ static int mt352_get_parameters(struct dvb_frontend* fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt352_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int mt352_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct mt352_state* state = fe->demodulator_priv;
|
||||
int s0, s1, s3;
|
||||
|
|
|
|||
|
|
@ -781,7 +781,7 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nxt200x_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int nxt200x_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct nxt200x_state* state = fe->demodulator_priv;
|
||||
u8 lock;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ static int nxt6000_set_bandwidth(struct nxt6000_state *state, u32 bandwidth)
|
|||
return nxt6000_writereg(state, OFDM_TRL_NOMINALRATE_2, (nominal_rate >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
static int nxt6000_set_guard_interval(struct nxt6000_state* state, fe_guard_interval_t guard_interval)
|
||||
static int nxt6000_set_guard_interval(struct nxt6000_state *state,
|
||||
enum fe_guard_interval guard_interval)
|
||||
{
|
||||
switch (guard_interval) {
|
||||
|
||||
|
|
@ -131,7 +132,8 @@ static int nxt6000_set_guard_interval(struct nxt6000_state* state, fe_guard_inte
|
|||
}
|
||||
}
|
||||
|
||||
static int nxt6000_set_inversion(struct nxt6000_state* state, fe_spectral_inversion_t inversion)
|
||||
static int nxt6000_set_inversion(struct nxt6000_state *state,
|
||||
enum fe_spectral_inversion inversion)
|
||||
{
|
||||
switch (inversion) {
|
||||
|
||||
|
|
@ -147,7 +149,9 @@ static int nxt6000_set_inversion(struct nxt6000_state* state, fe_spectral_invers
|
|||
}
|
||||
}
|
||||
|
||||
static int nxt6000_set_transmission_mode(struct nxt6000_state* state, fe_transmit_mode_t transmission_mode)
|
||||
static int
|
||||
nxt6000_set_transmission_mode(struct nxt6000_state *state,
|
||||
enum fe_transmit_mode transmission_mode)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -416,7 +420,7 @@ static void nxt6000_dump_status(struct nxt6000_state *state)
|
|||
printk("\n");
|
||||
}
|
||||
|
||||
static int nxt6000_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int nxt6000_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
u8 core_status;
|
||||
struct nxt6000_state* state = fe->demodulator_priv;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ struct or51132_state
|
|||
struct dvb_frontend frontend;
|
||||
|
||||
/* Demodulator private data */
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
u32 snr; /* Result of last SNR calculation */
|
||||
|
||||
/* Tuner private data */
|
||||
|
|
@ -292,7 +292,7 @@ static int or51132_setmode(struct dvb_frontend* fe)
|
|||
#define MOD_FWCLASS_UNKNOWN 0
|
||||
#define MOD_FWCLASS_VSB 1
|
||||
#define MOD_FWCLASS_QAM 2
|
||||
static int modulation_fw_class(fe_modulation_t modulation)
|
||||
static int modulation_fw_class(enum fe_modulation modulation)
|
||||
{
|
||||
switch(modulation) {
|
||||
case VSB_8:
|
||||
|
|
@ -415,7 +415,7 @@ start:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int or51132_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int or51132_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct or51132_state* state = fe->demodulator_priv;
|
||||
int reg;
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ static int or51211_set_parameters(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int or51211_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int or51211_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct or51211_state* state = fe->demodulator_priv;
|
||||
unsigned char rec_buf[2];
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int rtl2830_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int rtl2830_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct i2c_client *client = fe->demodulator_priv;
|
||||
struct rtl2830_dev *dev = i2c_get_clientdata(client);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct rtl2830_dev {
|
|||
bool sleeping;
|
||||
unsigned long filters;
|
||||
struct delayed_work stat_work;
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
u64 post_bit_error_prev; /* for old DVBv3 read_ber() calculation */
|
||||
u64 post_bit_error;
|
||||
u64 post_bit_count;
|
||||
|
|
|
|||
|
|
@ -358,6 +358,10 @@ static int rtl2832_init(struct dvb_frontend *fe)
|
|||
dev_dbg(&client->dev, "load settings for tuner=%02x\n",
|
||||
dev->pdata->tuner);
|
||||
switch (dev->pdata->tuner) {
|
||||
case RTL2832_TUNER_FC2580:
|
||||
len = ARRAY_SIZE(rtl2832_tuner_init_fc2580);
|
||||
init = rtl2832_tuner_init_fc2580;
|
||||
break;
|
||||
case RTL2832_TUNER_FC0012:
|
||||
case RTL2832_TUNER_FC0013:
|
||||
len = ARRAY_SIZE(rtl2832_tuner_init_fc0012);
|
||||
|
|
@ -376,6 +380,10 @@ static int rtl2832_init(struct dvb_frontend *fe)
|
|||
len = ARRAY_SIZE(rtl2832_tuner_init_r820t);
|
||||
init = rtl2832_tuner_init_r820t;
|
||||
break;
|
||||
case RTL2832_TUNER_SI2157:
|
||||
len = ARRAY_SIZE(rtl2832_tuner_init_si2157);
|
||||
init = rtl2832_tuner_init_si2157;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
|
|
@ -680,7 +688,7 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int rtl2832_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int rtl2832_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct rtl2832_dev *dev = fe->demodulator_priv;
|
||||
struct i2c_client *client = dev->client;
|
||||
|
|
|
|||
|
|
@ -41,12 +41,14 @@ struct rtl2832_platform_data {
|
|||
/*
|
||||
* XXX: This list must be kept sync with dvb_usb_rtl28xxu USB IF driver.
|
||||
*/
|
||||
#define RTL2832_TUNER_FC2580 0x21
|
||||
#define RTL2832_TUNER_TUA9001 0x24
|
||||
#define RTL2832_TUNER_FC0012 0x26
|
||||
#define RTL2832_TUNER_E4000 0x27
|
||||
#define RTL2832_TUNER_FC0013 0x29
|
||||
#define RTL2832_TUNER_R820T 0x2a
|
||||
#define RTL2832_TUNER_R828D 0x2b
|
||||
#define RTL2832_TUNER_SI2157 0x2c
|
||||
u8 tuner;
|
||||
|
||||
struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct rtl2832_dev {
|
|||
struct i2c_adapter *i2c_adapter_tuner;
|
||||
struct dvb_frontend fe;
|
||||
struct delayed_work stat_work;
|
||||
fe_status_t fe_status;
|
||||
enum fe_status fe_status;
|
||||
u64 post_bit_error_prev; /* for old DVBv3 read_ber() calculation */
|
||||
u64 post_bit_error;
|
||||
u64 post_bit_count;
|
||||
|
|
@ -252,6 +252,30 @@ enum DVBT_REG_BIT_NAME {
|
|||
DVBT_REG_BIT_NAME_ITEM_TERMINATOR,
|
||||
};
|
||||
|
||||
static const struct rtl2832_reg_value rtl2832_tuner_init_fc2580[] = {
|
||||
{DVBT_DAGC_TRG_VAL, 0x39},
|
||||
{DVBT_AGC_TARG_VAL_0, 0x0},
|
||||
{DVBT_AGC_TARG_VAL_8_1, 0x5a},
|
||||
{DVBT_AAGC_LOOP_GAIN, 0x16},
|
||||
{DVBT_LOOP_GAIN2_3_0, 0x6},
|
||||
{DVBT_LOOP_GAIN2_4, 0x1},
|
||||
{DVBT_LOOP_GAIN3, 0x16},
|
||||
{DVBT_VTOP1, 0x35},
|
||||
{DVBT_VTOP2, 0x21},
|
||||
{DVBT_VTOP3, 0x21},
|
||||
{DVBT_KRF1, 0x0},
|
||||
{DVBT_KRF2, 0x40},
|
||||
{DVBT_KRF3, 0x10},
|
||||
{DVBT_KRF4, 0x10},
|
||||
{DVBT_IF_AGC_MIN, 0x80},
|
||||
{DVBT_IF_AGC_MAX, 0x7f},
|
||||
{DVBT_RF_AGC_MIN, 0x9c},
|
||||
{DVBT_RF_AGC_MAX, 0x7f},
|
||||
{DVBT_POLAR_RF_AGC, 0x0},
|
||||
{DVBT_POLAR_IF_AGC, 0x0},
|
||||
{DVBT_AD7_SETTING, 0xe9f4},
|
||||
};
|
||||
|
||||
static const struct rtl2832_reg_value rtl2832_tuner_init_tua9001[] = {
|
||||
{DVBT_DAGC_TRG_VAL, 0x39},
|
||||
{DVBT_AGC_TARG_VAL_0, 0x0},
|
||||
|
|
@ -377,4 +401,29 @@ static const struct rtl2832_reg_value rtl2832_tuner_init_r820t[] = {
|
|||
{DVBT_SPEC_INV, 0x1},
|
||||
};
|
||||
|
||||
static const struct rtl2832_reg_value rtl2832_tuner_init_si2157[] = {
|
||||
{DVBT_DAGC_TRG_VAL, 0x39},
|
||||
{DVBT_AGC_TARG_VAL_0, 0x0},
|
||||
{DVBT_AGC_TARG_VAL_8_1, 0x40},
|
||||
{DVBT_AAGC_LOOP_GAIN, 0x16},
|
||||
{DVBT_LOOP_GAIN2_3_0, 0x8},
|
||||
{DVBT_LOOP_GAIN2_4, 0x1},
|
||||
{DVBT_LOOP_GAIN3, 0x18},
|
||||
{DVBT_VTOP1, 0x35},
|
||||
{DVBT_VTOP2, 0x21},
|
||||
{DVBT_VTOP3, 0x21},
|
||||
{DVBT_KRF1, 0x0},
|
||||
{DVBT_KRF2, 0x40},
|
||||
{DVBT_KRF3, 0x10},
|
||||
{DVBT_KRF4, 0x10},
|
||||
{DVBT_IF_AGC_MIN, 0x80},
|
||||
{DVBT_IF_AGC_MAX, 0x7f},
|
||||
{DVBT_RF_AGC_MIN, 0x80},
|
||||
{DVBT_RF_AGC_MAX, 0x7f},
|
||||
{DVBT_POLAR_RF_AGC, 0x0},
|
||||
{DVBT_POLAR_IF_AGC, 0x0},
|
||||
{DVBT_AD7_SETTING, 0xe9f4},
|
||||
{DVBT_SPEC_INV, 0x0},
|
||||
};
|
||||
|
||||
#endif /* RTL2832_PRIV_H */
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ static bool rtl2832_sdr_emulated_fmt;
|
|||
module_param_named(emulated_formats, rtl2832_sdr_emulated_fmt, bool, 0644);
|
||||
MODULE_PARM_DESC(emulated_formats, "enable emulated formats (disappears in future)");
|
||||
|
||||
/* Original macro does not contain enough null pointer checks for our need */
|
||||
#define V4L2_SUBDEV_HAS_OP(sd, o, f) \
|
||||
((sd) && (sd)->ops && (sd)->ops->o && (sd)->ops->o->f)
|
||||
|
||||
#define MAX_BULK_BUFS (10)
|
||||
#define BULK_BUFFER_SIZE (128 * 512)
|
||||
|
||||
|
|
@ -108,14 +112,15 @@ struct rtl2832_sdr_frame_buf {
|
|||
};
|
||||
|
||||
struct rtl2832_sdr_dev {
|
||||
#define POWER_ON (1 << 1)
|
||||
#define URB_BUF (1 << 2)
|
||||
#define POWER_ON 0 /* BIT(0) */
|
||||
#define URB_BUF 1 /* BIT(1) */
|
||||
unsigned long flags;
|
||||
|
||||
struct platform_device *pdev;
|
||||
|
||||
struct video_device vdev;
|
||||
struct v4l2_device v4l2_dev;
|
||||
struct v4l2_subdev *v4l2_subdev;
|
||||
|
||||
/* videobuf2 queue and queued buffers list */
|
||||
struct vb2_queue vb_queue;
|
||||
|
|
@ -351,7 +356,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_dev *dev)
|
|||
{
|
||||
struct platform_device *pdev = dev->pdev;
|
||||
|
||||
if (dev->flags & USB_STATE_URB_BUF) {
|
||||
if (test_bit(URB_BUF, &dev->flags)) {
|
||||
while (dev->buf_num) {
|
||||
dev->buf_num--;
|
||||
dev_dbg(&pdev->dev, "free buf=%d\n", dev->buf_num);
|
||||
|
|
@ -360,7 +365,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_dev *dev)
|
|||
dev->dma_addr[dev->buf_num]);
|
||||
}
|
||||
}
|
||||
dev->flags &= ~USB_STATE_URB_BUF;
|
||||
clear_bit(URB_BUF, &dev->flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -389,7 +394,7 @@ static int rtl2832_sdr_alloc_stream_bufs(struct rtl2832_sdr_dev *dev)
|
|||
dev_dbg(&pdev->dev, "alloc buf=%d %p (dma %llu)\n",
|
||||
dev->buf_num, dev->buf_list[dev->buf_num],
|
||||
(long long)dev->dma_addr[dev->buf_num]);
|
||||
dev->flags |= USB_STATE_URB_BUF;
|
||||
set_bit(URB_BUF, &dev->flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -742,6 +747,29 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_dev *dev)
|
|||
ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x011, "\xf4", 1);
|
||||
break;
|
||||
case RTL2832_SDR_TUNER_FC2580:
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x112, "\x39", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x102, "\x40", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x103, "\x5a", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1c7, "\x2c", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x104, "\xcc", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x105, "\xbe", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1c8, "\x16", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x106, "\x35", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1c9, "\x21", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1ca, "\x21", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1cb, "\x00", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x107, "\x40", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1cd, "\x10", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x1ce, "\x10", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x108, "\x80", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x109, "\x7f", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x10a, "\x9c", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x10b, "\x7f", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1);
|
||||
ret = rtl2832_sdr_wr_regs(dev, 0x011, "\xe9\xf4", 2);
|
||||
break;
|
||||
default:
|
||||
dev_notice(&pdev->dev, "Unsupported tuner\n");
|
||||
}
|
||||
|
|
@ -832,8 +860,10 @@ static int rtl2832_sdr_set_tuner_freq(struct rtl2832_sdr_dev *dev)
|
|||
if (!test_bit(POWER_ON, &dev->flags))
|
||||
return 0;
|
||||
|
||||
if (fe->ops.tuner_ops.set_params)
|
||||
fe->ops.tuner_ops.set_params(fe);
|
||||
if (!V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, s_frequency)) {
|
||||
if (fe->ops.tuner_ops.set_params)
|
||||
fe->ops.tuner_ops.set_params(fe);
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
|
@ -891,7 +921,11 @@ static int rtl2832_sdr_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
|
||||
set_bit(POWER_ON, &dev->flags);
|
||||
|
||||
ret = rtl2832_sdr_set_tuner(dev);
|
||||
/* wake-up tuner */
|
||||
if (V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, core, s_power))
|
||||
ret = v4l2_subdev_call(dev->v4l2_subdev, core, s_power, 1);
|
||||
else
|
||||
ret = rtl2832_sdr_set_tuner(dev);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
|
@ -939,7 +973,12 @@ static void rtl2832_sdr_stop_streaming(struct vb2_queue *vq)
|
|||
rtl2832_sdr_free_stream_bufs(dev);
|
||||
rtl2832_sdr_cleanup_queued_bufs(dev);
|
||||
rtl2832_sdr_unset_adc(dev);
|
||||
rtl2832_sdr_unset_tuner(dev);
|
||||
|
||||
/* sleep tuner */
|
||||
if (V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, core, s_power))
|
||||
v4l2_subdev_call(dev->v4l2_subdev, core, s_power, 0);
|
||||
else
|
||||
rtl2832_sdr_unset_tuner(dev);
|
||||
|
||||
clear_bit(POWER_ON, &dev->flags);
|
||||
|
||||
|
|
@ -968,6 +1007,7 @@ static int rtl2832_sdr_g_tuner(struct file *file, void *priv,
|
|||
{
|
||||
struct rtl2832_sdr_dev *dev = video_drvdata(file);
|
||||
struct platform_device *pdev = dev->pdev;
|
||||
int ret;
|
||||
|
||||
dev_dbg(&pdev->dev, "index=%d type=%d\n", v->index, v->type);
|
||||
|
||||
|
|
@ -977,17 +1017,21 @@ static int rtl2832_sdr_g_tuner(struct file *file, void *priv,
|
|||
v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS;
|
||||
v->rangelow = 300000;
|
||||
v->rangehigh = 3200000;
|
||||
ret = 0;
|
||||
} else if (v->index == 1 &&
|
||||
V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, g_tuner)) {
|
||||
ret = v4l2_subdev_call(dev->v4l2_subdev, tuner, g_tuner, v);
|
||||
} else if (v->index == 1) {
|
||||
strlcpy(v->name, "RF: <unknown>", sizeof(v->name));
|
||||
v->type = V4L2_TUNER_RF;
|
||||
v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS;
|
||||
v->rangelow = 50000000;
|
||||
v->rangehigh = 2000000000;
|
||||
ret = 0;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rtl2832_sdr_s_tuner(struct file *file, void *priv,
|
||||
|
|
@ -995,12 +1039,21 @@ static int rtl2832_sdr_s_tuner(struct file *file, void *priv,
|
|||
{
|
||||
struct rtl2832_sdr_dev *dev = video_drvdata(file);
|
||||
struct platform_device *pdev = dev->pdev;
|
||||
int ret;
|
||||
|
||||
dev_dbg(&pdev->dev, "\n");
|
||||
|
||||
if (v->index > 1)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
if (v->index == 0) {
|
||||
ret = 0;
|
||||
} else if (v->index == 1 &&
|
||||
V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, s_tuner)) {
|
||||
ret = v4l2_subdev_call(dev->v4l2_subdev, tuner, s_tuner, v);
|
||||
} else if (v->index == 1) {
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rtl2832_sdr_enum_freq_bands(struct file *file, void *priv,
|
||||
|
|
@ -1008,6 +1061,7 @@ static int rtl2832_sdr_enum_freq_bands(struct file *file, void *priv,
|
|||
{
|
||||
struct rtl2832_sdr_dev *dev = video_drvdata(file);
|
||||
struct platform_device *pdev = dev->pdev;
|
||||
int ret;
|
||||
|
||||
dev_dbg(&pdev->dev, "tuner=%d type=%d index=%d\n",
|
||||
band->tuner, band->type, band->index);
|
||||
|
|
@ -1017,16 +1071,20 @@ static int rtl2832_sdr_enum_freq_bands(struct file *file, void *priv,
|
|||
return -EINVAL;
|
||||
|
||||
*band = bands_adc[band->index];
|
||||
ret = 0;
|
||||
} else if (band->tuner == 1 &&
|
||||
V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, enum_freq_bands)) {
|
||||
ret = v4l2_subdev_call(dev->v4l2_subdev, tuner, enum_freq_bands, band);
|
||||
} else if (band->tuner == 1) {
|
||||
if (band->index >= ARRAY_SIZE(bands_fm))
|
||||
return -EINVAL;
|
||||
|
||||
*band = bands_fm[band->index];
|
||||
ret = 0;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rtl2832_sdr_g_frequency(struct file *file, void *priv,
|
||||
|
|
@ -1034,20 +1092,25 @@ static int rtl2832_sdr_g_frequency(struct file *file, void *priv,
|
|||
{
|
||||
struct rtl2832_sdr_dev *dev = video_drvdata(file);
|
||||
struct platform_device *pdev = dev->pdev;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
dev_dbg(&pdev->dev, "tuner=%d type=%d\n", f->tuner, f->type);
|
||||
|
||||
if (f->tuner == 0) {
|
||||
f->frequency = dev->f_adc;
|
||||
f->type = V4L2_TUNER_ADC;
|
||||
ret = 0;
|
||||
} else if (f->tuner == 1 &&
|
||||
V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, g_frequency)) {
|
||||
f->type = V4L2_TUNER_RF;
|
||||
ret = v4l2_subdev_call(dev->v4l2_subdev, tuner, g_frequency, f);
|
||||
} else if (f->tuner == 1) {
|
||||
f->frequency = dev->f_tuner;
|
||||
f->type = V4L2_TUNER_RF;
|
||||
ret = 0;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1074,11 +1137,14 @@ static int rtl2832_sdr_s_frequency(struct file *file, void *priv,
|
|||
band = 2;
|
||||
|
||||
dev->f_adc = clamp_t(unsigned int, f->frequency,
|
||||
bands_adc[band].rangelow,
|
||||
bands_adc[band].rangehigh);
|
||||
bands_adc[band].rangelow,
|
||||
bands_adc[band].rangehigh);
|
||||
|
||||
dev_dbg(&pdev->dev, "ADC frequency=%u Hz\n", dev->f_adc);
|
||||
ret = rtl2832_sdr_set_adc(dev);
|
||||
} else if (f->tuner == 1 &&
|
||||
V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, s_frequency)) {
|
||||
ret = v4l2_subdev_call(dev->v4l2_subdev, tuner, s_frequency, f);
|
||||
} else if (f->tuner == 1) {
|
||||
dev->f_tuner = clamp_t(unsigned int, f->frequency,
|
||||
bands_fm[0].rangelow,
|
||||
|
|
@ -1089,7 +1155,6 @@ static int rtl2832_sdr_s_frequency(struct file *file, void *priv,
|
|||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1329,6 +1394,7 @@ static int rtl2832_sdr_probe(struct platform_device *pdev)
|
|||
|
||||
/* setup the state */
|
||||
subdev = pdata->v4l2_subdev;
|
||||
dev->v4l2_subdev = pdata->v4l2_subdev;
|
||||
dev->pdev = pdev;
|
||||
dev->udev = pdata->dvb_usb_device->udev;
|
||||
dev->f_adc = bands_adc[0].rangelow;
|
||||
|
|
@ -1388,6 +1454,12 @@ static int rtl2832_sdr_probe(struct platform_device *pdev)
|
|||
6000000);
|
||||
v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false);
|
||||
break;
|
||||
case RTL2832_SDR_TUNER_FC2580:
|
||||
v4l2_ctrl_handler_init(&dev->hdl, 2);
|
||||
if (subdev)
|
||||
v4l2_ctrl_add_handler(&dev->hdl, subdev->ctrl_handler,
|
||||
NULL);
|
||||
break;
|
||||
default:
|
||||
v4l2_ctrl_handler_init(&dev->hdl, 0);
|
||||
dev_err(&pdev->dev, "Unsupported tuner\n");
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ struct rtl2832_sdr_platform_data {
|
|||
/*
|
||||
* XXX: This list must be kept sync with dvb_usb_rtl28xxu USB IF driver.
|
||||
*/
|
||||
#define RTL2832_SDR_TUNER_FC2580 0x21
|
||||
#define RTL2832_SDR_TUNER_TUA9001 0x24
|
||||
#define RTL2832_SDR_TUNER_FC0012 0x26
|
||||
#define RTL2832_SDR_TUNER_E4000 0x27
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct s5h1409_state {
|
|||
struct dvb_frontend frontend;
|
||||
|
||||
/* previous uncorrected block counter */
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
|
||||
u32 current_frequency;
|
||||
int if_freq;
|
||||
|
|
@ -400,7 +400,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend *fe, int inverted)
|
|||
}
|
||||
|
||||
static int s5h1409_enable_modulation(struct dvb_frontend *fe,
|
||||
fe_modulation_t m)
|
||||
enum fe_modulation m)
|
||||
{
|
||||
struct s5h1409_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -755,7 +755,7 @@ static int s5h1409_init(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s5h1409_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int s5h1409_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct s5h1409_state *state = fe->demodulator_priv;
|
||||
u16 reg;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct s5h1411_state {
|
|||
|
||||
struct dvb_frontend frontend;
|
||||
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
unsigned int first_tune:1;
|
||||
|
||||
u32 current_frequency;
|
||||
|
|
@ -484,7 +484,7 @@ static int s5h1411_set_serialmode(struct dvb_frontend *fe, int serial)
|
|||
}
|
||||
|
||||
static int s5h1411_enable_modulation(struct dvb_frontend *fe,
|
||||
fe_modulation_t m)
|
||||
enum fe_modulation m)
|
||||
{
|
||||
struct s5h1411_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -659,7 +659,7 @@ static int s5h1411_init(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s5h1411_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int s5h1411_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct s5h1411_state *state = fe->demodulator_priv;
|
||||
u16 reg;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct s5h1420_state {
|
|||
u8 postlocked:1;
|
||||
u32 fclk;
|
||||
u32 tunedfreq;
|
||||
fe_code_rate_t fec_inner;
|
||||
enum fe_code_rate fec_inner;
|
||||
u32 symbol_rate;
|
||||
|
||||
/* FIXME: ugly workaround for flexcop's incapable i2c-controller
|
||||
|
|
@ -124,7 +124,8 @@ static int s5h1420_writereg (struct s5h1420_state* state, u8 reg, u8 data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage)
|
||||
static int s5h1420_set_voltage(struct dvb_frontend *fe,
|
||||
enum fe_sec_voltage voltage)
|
||||
{
|
||||
struct s5h1420_state* state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -149,7 +150,8 @@ static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s5h1420_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
|
||||
static int s5h1420_set_tone(struct dvb_frontend *fe,
|
||||
enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct s5h1420_state* state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -180,7 +182,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe,
|
|||
int result = 0;
|
||||
|
||||
dprintk("enter %s\n", __func__);
|
||||
if (cmd->msg_len > 8)
|
||||
if (cmd->msg_len > sizeof(cmd->msg))
|
||||
return -EINVAL;
|
||||
|
||||
/* setup for DISEQC */
|
||||
|
|
@ -270,7 +272,8 @@ exit:
|
|||
return result;
|
||||
}
|
||||
|
||||
static int s5h1420_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd)
|
||||
static int s5h1420_send_burst(struct dvb_frontend *fe,
|
||||
enum fe_sec_mini_cmd minicmd)
|
||||
{
|
||||
struct s5h1420_state* state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
@ -307,10 +310,10 @@ static int s5h1420_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minicm
|
|||
return result;
|
||||
}
|
||||
|
||||
static fe_status_t s5h1420_get_status_bits(struct s5h1420_state* state)
|
||||
static enum fe_status s5h1420_get_status_bits(struct s5h1420_state *state)
|
||||
{
|
||||
u8 val;
|
||||
fe_status_t status = 0;
|
||||
enum fe_status status = 0;
|
||||
|
||||
val = s5h1420_readreg(state, 0x14);
|
||||
if (val & 0x02)
|
||||
|
|
@ -328,7 +331,8 @@ static fe_status_t s5h1420_get_status_bits(struct s5h1420_state* state)
|
|||
return status;
|
||||
}
|
||||
|
||||
static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||
static int s5h1420_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *status)
|
||||
{
|
||||
struct s5h1420_state* state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
@ -561,27 +565,33 @@ static void s5h1420_setfec_inversion(struct s5h1420_state* state,
|
|||
} else {
|
||||
switch (p->fec_inner) {
|
||||
case FEC_1_2:
|
||||
vit08 = 0x01; vit09 = 0x10;
|
||||
vit08 = 0x01;
|
||||
vit09 = 0x10;
|
||||
break;
|
||||
|
||||
case FEC_2_3:
|
||||
vit08 = 0x02; vit09 = 0x11;
|
||||
vit08 = 0x02;
|
||||
vit09 = 0x11;
|
||||
break;
|
||||
|
||||
case FEC_3_4:
|
||||
vit08 = 0x04; vit09 = 0x12;
|
||||
vit08 = 0x04;
|
||||
vit09 = 0x12;
|
||||
break;
|
||||
|
||||
case FEC_5_6:
|
||||
vit08 = 0x08; vit09 = 0x13;
|
||||
vit08 = 0x08;
|
||||
vit09 = 0x13;
|
||||
break;
|
||||
|
||||
case FEC_6_7:
|
||||
vit08 = 0x10; vit09 = 0x14;
|
||||
vit08 = 0x10;
|
||||
vit09 = 0x14;
|
||||
break;
|
||||
|
||||
case FEC_7_8:
|
||||
vit08 = 0x20; vit09 = 0x15;
|
||||
vit08 = 0x20;
|
||||
vit09 = 0x15;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -595,7 +605,7 @@ static void s5h1420_setfec_inversion(struct s5h1420_state* state,
|
|||
dprintk("leave %s\n", __func__);
|
||||
}
|
||||
|
||||
static fe_code_rate_t s5h1420_getfec(struct s5h1420_state* state)
|
||||
static enum fe_code_rate s5h1420_getfec(struct s5h1420_state *state)
|
||||
{
|
||||
switch(s5h1420_readreg(state, 0x32) & 0x07) {
|
||||
case 0:
|
||||
|
|
@ -620,7 +630,8 @@ static fe_code_rate_t s5h1420_getfec(struct s5h1420_state* state)
|
|||
return FEC_NONE;
|
||||
}
|
||||
|
||||
static fe_spectral_inversion_t s5h1420_getinversion(struct s5h1420_state* state)
|
||||
static enum fe_spectral_inversion
|
||||
s5h1420_getinversion(struct s5h1420_state *state)
|
||||
{
|
||||
if (s5h1420_readreg(state, 0x32) & 0x08)
|
||||
return INVERSION_ON;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct s5h1432_state {
|
|||
|
||||
struct dvb_frontend frontend;
|
||||
|
||||
fe_modulation_t current_modulation;
|
||||
enum fe_modulation current_modulation;
|
||||
unsigned int first_tune:1;
|
||||
|
||||
u32 current_frequency;
|
||||
|
|
@ -302,7 +302,7 @@ static int s5h1432_init(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s5h1432_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int s5h1432_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ static int s921_initfe(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s921_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int s921_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct s921_state *state = fe->demodulator_priv;
|
||||
int regstatus, rc;
|
||||
|
|
@ -389,7 +389,7 @@ static int s921_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
|||
|
||||
static int s921_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
|
||||
{
|
||||
fe_status_t status;
|
||||
enum fe_status status;
|
||||
struct s921_state *state = fe->demodulator_priv;
|
||||
int rc;
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ static int s921_tune(struct dvb_frontend *fe,
|
|||
bool re_tune,
|
||||
unsigned int mode_flags,
|
||||
unsigned int *delay,
|
||||
fe_status_t *status)
|
||||
enum fe_status *status)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static inline struct dvb_frontend *s921_attach(
|
|||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
static struct i2c_adapter *
|
||||
static inline struct i2c_adapter *
|
||||
s921_get_tuner_i2c_adapter(struct dvb_frontend *fe)
|
||||
{
|
||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ static int si2165_sleep(struct dvb_frontend *fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int si2165_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int si2165_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
int ret;
|
||||
u8 fec_lock = 0;
|
||||
|
|
|
|||
|
|
@ -18,23 +18,53 @@
|
|||
|
||||
static const struct dvb_frontend_ops si2168_ops;
|
||||
|
||||
/* execute firmware command */
|
||||
static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
|
||||
/* Own I2C adapter locking is needed because of I2C gate logic. */
|
||||
static int si2168_i2c_master_send_unlocked(const struct i2c_client *client,
|
||||
const char *buf, int count)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_msg msg = {
|
||||
.addr = client->addr,
|
||||
.flags = 0,
|
||||
.len = count,
|
||||
.buf = (char *)buf,
|
||||
};
|
||||
|
||||
ret = __i2c_transfer(client->adapter, &msg, 1);
|
||||
return (ret == 1) ? count : ret;
|
||||
}
|
||||
|
||||
static int si2168_i2c_master_recv_unlocked(const struct i2c_client *client,
|
||||
char *buf, int count)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_msg msg = {
|
||||
.addr = client->addr,
|
||||
.flags = I2C_M_RD,
|
||||
.len = count,
|
||||
.buf = buf,
|
||||
};
|
||||
|
||||
ret = __i2c_transfer(client->adapter, &msg, 1);
|
||||
return (ret == 1) ? count : ret;
|
||||
}
|
||||
|
||||
/* execute firmware command */
|
||||
static int si2168_cmd_execute_unlocked(struct i2c_client *client,
|
||||
struct si2168_cmd *cmd)
|
||||
{
|
||||
struct si2168_dev *dev = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
unsigned long timeout;
|
||||
|
||||
mutex_lock(&dev->i2c_mutex);
|
||||
|
||||
if (cmd->wlen) {
|
||||
/* write cmd and args for firmware */
|
||||
ret = i2c_master_send(client, cmd->args, cmd->wlen);
|
||||
ret = si2168_i2c_master_send_unlocked(client, cmd->args,
|
||||
cmd->wlen);
|
||||
if (ret < 0) {
|
||||
goto err_mutex_unlock;
|
||||
goto err;
|
||||
} else if (ret != cmd->wlen) {
|
||||
ret = -EREMOTEIO;
|
||||
goto err_mutex_unlock;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -43,12 +73,13 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
|
|||
#define TIMEOUT 70
|
||||
timeout = jiffies + msecs_to_jiffies(TIMEOUT);
|
||||
while (!time_after(jiffies, timeout)) {
|
||||
ret = i2c_master_recv(client, cmd->args, cmd->rlen);
|
||||
ret = si2168_i2c_master_recv_unlocked(client, cmd->args,
|
||||
cmd->rlen);
|
||||
if (ret < 0) {
|
||||
goto err_mutex_unlock;
|
||||
goto err;
|
||||
} else if (ret != cmd->rlen) {
|
||||
ret = -EREMOTEIO;
|
||||
goto err_mutex_unlock;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* firmware ready? */
|
||||
|
|
@ -60,22 +91,36 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
|
|||
jiffies_to_msecs(jiffies) -
|
||||
(jiffies_to_msecs(timeout) - TIMEOUT));
|
||||
|
||||
/* error bit set? */
|
||||
if ((cmd->args[0] >> 6) & 0x01) {
|
||||
ret = -EREMOTEIO;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!((cmd->args[0] >> 7) & 0x01)) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto err_mutex_unlock;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->i2c_mutex);
|
||||
return 0;
|
||||
|
||||
err_mutex_unlock:
|
||||
mutex_unlock(&dev->i2c_mutex);
|
||||
err:
|
||||
dev_dbg(&client->dev, "failed=%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int si2168_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
i2c_lock_adapter(client->adapter);
|
||||
ret = si2168_cmd_execute_unlocked(client, cmd);
|
||||
i2c_unlock_adapter(client->adapter);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct i2c_client *client = fe->demodulator_priv;
|
||||
struct si2168_dev *dev = i2c_get_clientdata(client);
|
||||
|
|
@ -508,6 +553,8 @@ static int si2168_init(struct dvb_frontend *fe)
|
|||
/* set ts mode */
|
||||
memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
|
||||
cmd.args[4] |= dev->ts_mode;
|
||||
if (dev->ts_clock_gapped)
|
||||
cmd.args[4] |= 0x40;
|
||||
cmd.wlen = 6;
|
||||
cmd.rlen = 4;
|
||||
ret = si2168_cmd_execute(client, &cmd);
|
||||
|
|
@ -561,60 +608,46 @@ static int si2168_get_tune_settings(struct dvb_frontend *fe,
|
|||
|
||||
/*
|
||||
* I2C gate logic
|
||||
* We must use unlocked i2c_transfer() here because I2C lock is already taken
|
||||
* by tuner driver.
|
||||
* We must use unlocked I2C I/O because I2C adapter lock is already taken
|
||||
* by the caller (usually tuner driver).
|
||||
*/
|
||||
static int si2168_select(struct i2c_adapter *adap, void *mux_priv, u32 chan)
|
||||
{
|
||||
struct i2c_client *client = mux_priv;
|
||||
struct si2168_dev *dev = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
struct i2c_msg gate_open_msg = {
|
||||
.addr = client->addr,
|
||||
.flags = 0,
|
||||
.len = 3,
|
||||
.buf = "\xc0\x0d\x01",
|
||||
};
|
||||
struct si2168_cmd cmd;
|
||||
|
||||
mutex_lock(&dev->i2c_mutex);
|
||||
|
||||
/* open tuner I2C gate */
|
||||
ret = __i2c_transfer(client->adapter, &gate_open_msg, 1);
|
||||
if (ret != 1) {
|
||||
dev_warn(&client->dev, "i2c write failed=%d\n", ret);
|
||||
if (ret >= 0)
|
||||
ret = -EREMOTEIO;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
/* open I2C gate */
|
||||
memcpy(cmd.args, "\xc0\x0d\x01", 3);
|
||||
cmd.wlen = 3;
|
||||
cmd.rlen = 0;
|
||||
ret = si2168_cmd_execute_unlocked(client, &cmd);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
dev_dbg(&client->dev, "failed=%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int si2168_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan)
|
||||
{
|
||||
struct i2c_client *client = mux_priv;
|
||||
struct si2168_dev *dev = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
struct i2c_msg gate_close_msg = {
|
||||
.addr = client->addr,
|
||||
.flags = 0,
|
||||
.len = 3,
|
||||
.buf = "\xc0\x0d\x00",
|
||||
};
|
||||
struct si2168_cmd cmd;
|
||||
|
||||
/* close tuner I2C gate */
|
||||
ret = __i2c_transfer(client->adapter, &gate_close_msg, 1);
|
||||
if (ret != 1) {
|
||||
dev_warn(&client->dev, "i2c write failed=%d\n", ret);
|
||||
if (ret >= 0)
|
||||
ret = -EREMOTEIO;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->i2c_mutex);
|
||||
/* close I2C gate */
|
||||
memcpy(cmd.args, "\xc0\x0d\x00", 3);
|
||||
cmd.wlen = 3;
|
||||
cmd.rlen = 0;
|
||||
ret = si2168_cmd_execute_unlocked(client, &cmd);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
dev_dbg(&client->dev, "failed=%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -671,8 +704,6 @@ static int si2168_probe(struct i2c_client *client,
|
|||
goto err;
|
||||
}
|
||||
|
||||
mutex_init(&dev->i2c_mutex);
|
||||
|
||||
/* create mux i2c adapter for tuner */
|
||||
dev->adapter = i2c_add_mux_adapter(client->adapter, &client->dev,
|
||||
client, 0, 0, 0, si2168_select, si2168_deselect);
|
||||
|
|
@ -688,6 +719,7 @@ static int si2168_probe(struct i2c_client *client,
|
|||
*config->fe = &dev->fe;
|
||||
dev->ts_mode = config->ts_mode;
|
||||
dev->ts_clock_inv = config->ts_clock_inv;
|
||||
dev->ts_clock_gapped = config->ts_clock_gapped;
|
||||
dev->fw_loaded = false;
|
||||
|
||||
i2c_set_clientdata(client, dev);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ struct si2168_config {
|
|||
|
||||
/* TS clock inverted */
|
||||
bool ts_clock_inv;
|
||||
|
||||
/* TS clock gapped */
|
||||
bool ts_clock_gapped;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@
|
|||
/* state struct */
|
||||
struct si2168_dev {
|
||||
struct i2c_adapter *adapter;
|
||||
struct mutex i2c_mutex;
|
||||
struct dvb_frontend fe;
|
||||
fe_delivery_system_t delivery_system;
|
||||
fe_status_t fe_status;
|
||||
enum fe_delivery_system delivery_system;
|
||||
enum fe_status fe_status;
|
||||
bool active;
|
||||
bool fw_loaded;
|
||||
u8 ts_mode;
|
||||
bool ts_clock_inv;
|
||||
bool ts_clock_gapped;
|
||||
};
|
||||
|
||||
/* firmware command struct */
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ static int si21xx_send_diseqc_msg(struct dvb_frontend *fe,
|
|||
}
|
||||
|
||||
static int si21xx_send_diseqc_burst(struct dvb_frontend *fe,
|
||||
fe_sec_mini_cmd_t burst)
|
||||
enum fe_sec_mini_cmd burst)
|
||||
{
|
||||
struct si21xx_state *state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
@ -434,7 +434,7 @@ static int si21xx_send_diseqc_burst(struct dvb_frontend *fe,
|
|||
return 0;
|
||||
}
|
||||
/* 30.06.2008 */
|
||||
static int si21xx_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
||||
static int si21xx_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
|
||||
{
|
||||
struct si21xx_state *state = fe->demodulator_priv;
|
||||
u8 val;
|
||||
|
|
@ -454,7 +454,7 @@ static int si21xx_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
|
|||
}
|
||||
}
|
||||
|
||||
static int si21xx_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t volt)
|
||||
static int si21xx_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage volt)
|
||||
{
|
||||
struct si21xx_state *state = fe->demodulator_priv;
|
||||
|
||||
|
|
@ -536,7 +536,7 @@ static int si21xx_init(struct dvb_frontend *fe)
|
|||
|
||||
}
|
||||
|
||||
static int si21_read_status(struct dvb_frontend *fe, fe_status_t *status)
|
||||
static int si21_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
{
|
||||
struct si21xx_state *state = fe->demodulator_priv;
|
||||
u8 regs_read[2];
|
||||
|
|
@ -641,7 +641,7 @@ static int si21_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
|||
/* initiates a channel acquisition sequence
|
||||
using the specified symbol rate and code rate */
|
||||
static int si21xx_setacquire(struct dvb_frontend *fe, int symbrate,
|
||||
fe_code_rate_t crate)
|
||||
enum fe_code_rate crate)
|
||||
{
|
||||
|
||||
struct si21xx_state *state = fe->demodulator_priv;
|
||||
|
|
|
|||
|
|
@ -350,7 +350,8 @@ static int sp8870_init (struct dvb_frontend* fe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sp8870_read_status (struct dvb_frontend* fe, fe_status_t * fe_status)
|
||||
static int sp8870_read_status(struct dvb_frontend *fe,
|
||||
enum fe_status *fe_status)
|
||||
{
|
||||
struct sp8870_state* state = fe->demodulator_priv;
|
||||
int status;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue