V4L/DVB (9260): cx24123: Checkpatch compliance
cx24123: Checkpatch compliance Signed-off-by: Steven Toth <stoth@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
b431c61642
Коммит
93504abfeb
|
@ -33,7 +33,13 @@
|
||||||
#define XTAL 10111000
|
#define XTAL 10111000
|
||||||
|
|
||||||
static int force_band;
|
static int force_band;
|
||||||
|
module_param(force_band, int, 0644);
|
||||||
|
MODULE_PARM_DESC(force_band, "Force a specific band select "\
|
||||||
|
"(1-9, default:off).");
|
||||||
|
|
||||||
static int debug;
|
static int debug;
|
||||||
|
module_param(debug, int, 0644);
|
||||||
|
MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
|
||||||
|
|
||||||
#define info(args...) do { printk(KERN_INFO "CX24123: " args); } while (0)
|
#define info(args...) do { printk(KERN_INFO "CX24123: " args); } while (0)
|
||||||
#define err(args...) do { printk(KERN_ERR "CX24123: " args); } while (0)
|
#define err(args...) do { printk(KERN_ERR "CX24123: " args); } while (0)
|
||||||
|
@ -46,8 +52,7 @@ static int debug;
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
struct cx24123_state
|
struct cx24123_state {
|
||||||
{
|
|
||||||
struct i2c_adapter *i2c;
|
struct i2c_adapter *i2c;
|
||||||
const struct cx24123_config *config;
|
const struct cx24123_config *config;
|
||||||
|
|
||||||
|
@ -70,8 +75,7 @@ struct cx24123_state
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Various tuner defaults need to be established for a given symbol rate Sps */
|
/* Various tuner defaults need to be established for a given symbol rate Sps */
|
||||||
static struct
|
static struct cx24123_AGC_val {
|
||||||
{
|
|
||||||
u32 symbolrate_low;
|
u32 symbolrate_low;
|
||||||
u32 symbolrate_high;
|
u32 symbolrate_high;
|
||||||
u32 VCAprogdata;
|
u32 VCAprogdata;
|
||||||
|
@ -109,8 +113,7 @@ static struct
|
||||||
* fixme: The bounds on the bands do not match the doc in real life.
|
* fixme: The bounds on the bands do not match the doc in real life.
|
||||||
* fixme: Some of them have been moved, other might need adjustment.
|
* fixme: Some of them have been moved, other might need adjustment.
|
||||||
*/
|
*/
|
||||||
static struct
|
static struct cx24123_bandselect_val {
|
||||||
{
|
|
||||||
u32 freq_low;
|
u32 freq_low;
|
||||||
u32 freq_high;
|
u32 freq_high;
|
||||||
u32 VCOdivider;
|
u32 VCOdivider;
|
||||||
|
@ -249,7 +252,8 @@ static int cx24123_i2c_writereg(struct cx24123_state *state,
|
||||||
|
|
||||||
/* printk(KERN_DEBUG "wr(%02x): %02x %02x\n", i2c_addr, reg, data); */
|
/* printk(KERN_DEBUG "wr(%02x): %02x %02x\n", i2c_addr, reg, data); */
|
||||||
|
|
||||||
if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
|
err = i2c_transfer(state->i2c, &msg, 1);
|
||||||
|
if (err != 1) {
|
||||||
printk("%s: writereg error(err == %i, reg == 0x%02x,"
|
printk("%s: writereg error(err == %i, reg == 0x%02x,"
|
||||||
" data == 0x%02x)\n", __func__, err, reg, data);
|
" data == 0x%02x)\n", __func__, err, reg, data);
|
||||||
return err;
|
return err;
|
||||||
|
@ -284,7 +288,8 @@ static int cx24123_i2c_readreg(struct cx24123_state *state, u8 i2c_addr, u8 reg)
|
||||||
#define cx24123_writereg(state, reg, val) \
|
#define cx24123_writereg(state, reg, val) \
|
||||||
cx24123_i2c_writereg(state, state->config->demod_address, reg, val)
|
cx24123_i2c_writereg(state, state->config->demod_address, reg, val)
|
||||||
|
|
||||||
static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion)
|
static int cx24123_set_inversion(struct cx24123_state *state,
|
||||||
|
fe_spectral_inversion_t inversion)
|
||||||
{
|
{
|
||||||
u8 nom_reg = cx24123_readreg(state, 0x0e);
|
u8 nom_reg = cx24123_readreg(state, 0x0e);
|
||||||
u8 auto_reg = cx24123_readreg(state, 0x10);
|
u8 auto_reg = cx24123_readreg(state, 0x10);
|
||||||
|
@ -311,7 +316,8 @@ static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_invers
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_inversion_t *inversion)
|
static int cx24123_get_inversion(struct cx24123_state *state,
|
||||||
|
fe_spectral_inversion_t *inversion)
|
||||||
{
|
{
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
|
@ -337,9 +343,11 @@ static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec)
|
||||||
|
|
||||||
/* Set the soft decision threshold */
|
/* Set the soft decision threshold */
|
||||||
if (fec == FEC_1_2)
|
if (fec == FEC_1_2)
|
||||||
cx24123_writereg(state, 0x43, cx24123_readreg(state, 0x43) | 0x01);
|
cx24123_writereg(state, 0x43,
|
||||||
|
cx24123_readreg(state, 0x43) | 0x01);
|
||||||
else
|
else
|
||||||
cx24123_writereg(state, 0x43, cx24123_readreg(state, 0x43) & ~0x01);
|
cx24123_writereg(state, 0x43,
|
||||||
|
cx24123_readreg(state, 0x43) & ~0x01);
|
||||||
|
|
||||||
switch (fec) {
|
switch (fec) {
|
||||||
case FEC_1_2:
|
case FEC_1_2:
|
||||||
|
@ -433,9 +441,9 @@ static u32 cx24123_int_log2(u32 a, u32 b)
|
||||||
{
|
{
|
||||||
u32 exp, nearest = 0;
|
u32 exp, nearest = 0;
|
||||||
u32 div = a / b;
|
u32 div = a / b;
|
||||||
if(a % b >= b / 2) ++div;
|
if (a % b >= b / 2)
|
||||||
if(div < (1 << 31))
|
++div;
|
||||||
{
|
if (div < (1 << 31)) {
|
||||||
for (exp = 1; div > exp; nearest++)
|
for (exp = 1; div > exp; nearest++)
|
||||||
exp += exp;
|
exp += exp;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +508,7 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate)
|
||||||
|
|
||||||
cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f);
|
cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f);
|
||||||
cx24123_writereg(state, 0x09, (ratio >> 8) & 0xff);
|
cx24123_writereg(state, 0x09, (ratio >> 8) & 0xff);
|
||||||
cx24123_writereg(state, 0x0a, (ratio ) & 0xff );
|
cx24123_writereg(state, 0x0a, ratio & 0xff);
|
||||||
|
|
||||||
/* also set the demodulator sample gain */
|
/* also set the demodulator sample gain */
|
||||||
sample_gain = cx24123_int_log2(sample_rate, srate);
|
sample_gain = cx24123_int_log2(sample_rate, srate);
|
||||||
|
@ -514,10 +522,12 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Based on the required frequency and symbolrate, the tuner AGC has to be configured
|
* Based on the required frequency and symbolrate, the tuner AGC has
|
||||||
* and the correct band selected. Calculate those values
|
* to be configured and the correct band selected.
|
||||||
|
* Calculate those values.
|
||||||
*/
|
*/
|
||||||
static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
|
static int cx24123_pll_calculate(struct dvb_frontend *fe,
|
||||||
|
struct dvb_frontend_parameters *p)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
u32 ndiv = 0, adiv = 0, vco_div = 0;
|
u32 ndiv = 0, adiv = 0, vco_div = 0;
|
||||||
|
@ -525,6 +535,8 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
|
||||||
int pump = 2;
|
int pump = 2;
|
||||||
int band = 0;
|
int band = 0;
|
||||||
int num_bands = ARRAY_SIZE(cx24123_bandselect_vals);
|
int num_bands = ARRAY_SIZE(cx24123_bandselect_vals);
|
||||||
|
struct cx24123_bandselect_val *bsv = NULL;
|
||||||
|
struct cx24123_AGC_val *agcv = NULL;
|
||||||
|
|
||||||
/* Defaults for low freq, low rate */
|
/* Defaults for low freq, low rate */
|
||||||
state->VCAarg = cx24123_AGC_vals[0].VCAprogdata;
|
state->VCAarg = cx24123_AGC_vals[0].VCAprogdata;
|
||||||
|
@ -532,58 +544,65 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
|
||||||
state->bandselectarg = cx24123_bandselect_vals[0].progdata;
|
state->bandselectarg = cx24123_bandselect_vals[0].progdata;
|
||||||
vco_div = cx24123_bandselect_vals[0].VCOdivider;
|
vco_div = cx24123_bandselect_vals[0].VCOdivider;
|
||||||
|
|
||||||
/* For the given symbol rate, determine the VCA, VGA and FILTUNE programming bits */
|
/* For the given symbol rate, determine the VCA, VGA and
|
||||||
for (i = 0; i < ARRAY_SIZE(cx24123_AGC_vals); i++)
|
* FILTUNE programming bits */
|
||||||
{
|
for (i = 0; i < ARRAY_SIZE(cx24123_AGC_vals); i++) {
|
||||||
if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) &&
|
agcv = &cx24123_AGC_vals[i];
|
||||||
(cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) {
|
if ((agcv->symbolrate_low <= p->u.qpsk.symbol_rate) &&
|
||||||
state->VCAarg = cx24123_AGC_vals[i].VCAprogdata;
|
(agcv->symbolrate_high >= p->u.qpsk.symbol_rate)) {
|
||||||
state->VGAarg = cx24123_AGC_vals[i].VGAprogdata;
|
state->VCAarg = agcv->VCAprogdata;
|
||||||
state->FILTune = cx24123_AGC_vals[i].FILTune;
|
state->VGAarg = agcv->VGAprogdata;
|
||||||
|
state->FILTune = agcv->FILTune;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* determine the band to use */
|
/* determine the band to use */
|
||||||
if(force_band < 1 || force_band > num_bands)
|
if (force_band < 1 || force_band > num_bands) {
|
||||||
{
|
for (i = 0; i < num_bands; i++) {
|
||||||
for (i = 0; i < num_bands; i++)
|
bsv = &cx24123_bandselect_vals[i];
|
||||||
{
|
if ((bsv->freq_low <= p->frequency) &&
|
||||||
if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) &&
|
(bsv->freq_high >= p->frequency))
|
||||||
(cx24123_bandselect_vals[i].freq_high >= p->frequency) )
|
|
||||||
band = i;
|
band = i;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
band = force_band - 1;
|
band = force_band - 1;
|
||||||
|
|
||||||
state->bandselectarg = cx24123_bandselect_vals[band].progdata;
|
state->bandselectarg = cx24123_bandselect_vals[band].progdata;
|
||||||
vco_div = cx24123_bandselect_vals[band].VCOdivider;
|
vco_div = cx24123_bandselect_vals[band].VCOdivider;
|
||||||
|
|
||||||
/* determine the charge pump current */
|
/* determine the charge pump current */
|
||||||
if ( p->frequency < (cx24123_bandselect_vals[band].freq_low + cx24123_bandselect_vals[band].freq_high)/2 )
|
if (p->frequency < (cx24123_bandselect_vals[band].freq_low +
|
||||||
|
cx24123_bandselect_vals[band].freq_high) / 2)
|
||||||
pump = 0x01;
|
pump = 0x01;
|
||||||
else
|
else
|
||||||
pump = 0x02;
|
pump = 0x02;
|
||||||
|
|
||||||
/* Determine the N/A dividers for the requested lband freq (in kHz). */
|
/* Determine the N/A dividers for the requested lband freq (in kHz). */
|
||||||
/* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */
|
/* Note: the reference divider R=10, frequency is in KHz,
|
||||||
ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff;
|
* XTAL is in Hz */
|
||||||
adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f;
|
ndiv = (((p->frequency * vco_div * 10) /
|
||||||
|
(2 * XTAL / 1000)) / 32) & 0x1ff;
|
||||||
|
adiv = (((p->frequency * vco_div * 10) /
|
||||||
|
(2 * XTAL / 1000)) % 32) & 0x1f;
|
||||||
|
|
||||||
if (adiv == 0 && ndiv > 0)
|
if (adiv == 0 && ndiv > 0)
|
||||||
ndiv--;
|
ndiv--;
|
||||||
|
|
||||||
/* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */
|
/* control bits 11, refdiv 11, charge pump polarity 1,
|
||||||
state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv;
|
* charge pump current, ndiv, adiv */
|
||||||
|
state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) |
|
||||||
|
(pump << 14) | (ndiv << 5) | adiv;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tuner data is 21 bits long, must be left-aligned in data.
|
* Tuner data is 21 bits long, must be left-aligned in data.
|
||||||
* Tuner cx24109 is written through a dedicated 3wire interface on the demod chip.
|
* Tuner cx24109 is written through a dedicated 3wire interface
|
||||||
|
* on the demod chip.
|
||||||
*/
|
*/
|
||||||
static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_parameters *p, u32 data)
|
static int cx24123_pll_writereg(struct dvb_frontend *fe,
|
||||||
|
struct dvb_frontend_parameters *p, u32 data)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
unsigned long timeout;
|
unsigned long timeout;
|
||||||
|
@ -620,7 +639,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par
|
||||||
msleep(10);
|
msleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send the lower 5 bits of this byte, padded with 3 LBB, wait for the send to be completed */
|
/* send the lower 5 bits of this byte, padded with 3 LBB,
|
||||||
|
* wait for the send to be completed */
|
||||||
timeout = jiffies + msecs_to_jiffies(40);
|
timeout = jiffies + msecs_to_jiffies(40);
|
||||||
cx24123_writereg(state, 0x22, (data) & 0xff);
|
cx24123_writereg(state, 0x22, (data) & 0xff);
|
||||||
while ((cx24123_readreg(state, 0x20) & 0x80)) {
|
while ((cx24123_readreg(state, 0x20) & 0x80)) {
|
||||||
|
@ -639,7 +659,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
|
static int cx24123_pll_tune(struct dvb_frontend *fe,
|
||||||
|
struct dvb_frontend_parameters *p)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
u8 val;
|
u8 val;
|
||||||
|
@ -699,11 +720,13 @@ static int cx24123_initfe(struct dvb_frontend* fe)
|
||||||
|
|
||||||
/* Configure the demod to a good set of defaults */
|
/* Configure the demod to a good set of defaults */
|
||||||
for (i = 0; i < ARRAY_SIZE(cx24123_regdata); i++)
|
for (i = 0; i < ARRAY_SIZE(cx24123_regdata); i++)
|
||||||
cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data);
|
cx24123_writereg(state, cx24123_regdata[i].reg,
|
||||||
|
cx24123_regdata[i].data);
|
||||||
|
|
||||||
/* Set the LNB polarity */
|
/* Set the LNB polarity */
|
||||||
if (state->config->lnb_polarity)
|
if (state->config->lnb_polarity)
|
||||||
cx24123_writereg(state, 0x32, cx24123_readreg(state, 0x32) | 0x02);
|
cx24123_writereg(state, 0x32,
|
||||||
|
cx24123_readreg(state, 0x32) | 0x02);
|
||||||
|
|
||||||
if (state->config->dont_use_pll)
|
if (state->config->dont_use_pll)
|
||||||
cx24123_repeater_mode(state, 1, 0);
|
cx24123_repeater_mode(state, 1, 0);
|
||||||
|
@ -711,7 +734,8 @@ static int cx24123_initfe(struct dvb_frontend* fe)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
|
static int cx24123_set_voltage(struct dvb_frontend *fe,
|
||||||
|
fe_sec_voltage_t voltage)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
u8 val;
|
u8 val;
|
||||||
|
@ -749,7 +773,8 @@ static void cx24123_wait_for_diseqc(struct cx24123_state *state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
|
static int cx24123_send_diseqc_msg(struct dvb_frontend *fe,
|
||||||
|
struct dvb_diseqc_master_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
int i, val, tone;
|
int i, val, tone;
|
||||||
|
@ -771,20 +796,21 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma
|
||||||
cx24123_writereg(state, 0x2C + i, cmd->msg[i]);
|
cx24123_writereg(state, 0x2C + i, cmd->msg[i]);
|
||||||
|
|
||||||
val = cx24123_readreg(state, 0x29);
|
val = cx24123_readreg(state, 0x29);
|
||||||
cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3));
|
cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) |
|
||||||
|
((cmd->msg_len-3) & 3));
|
||||||
|
|
||||||
/* wait for diseqc message to finish sending */
|
/* wait for diseqc message to finish sending */
|
||||||
cx24123_wait_for_diseqc(state);
|
cx24123_wait_for_diseqc(state);
|
||||||
|
|
||||||
/* restart continuous tone if enabled */
|
/* restart continuous tone if enabled */
|
||||||
if (tone & 0x10) {
|
if (tone & 0x10)
|
||||||
cx24123_writereg(state, 0x29, tone & ~0x40);
|
cx24123_writereg(state, 0x29, tone & ~0x40);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
|
static int cx24123_diseqc_send_burst(struct dvb_frontend *fe,
|
||||||
|
fe_sec_mini_cmd_t burst)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
int val, tone;
|
int val, tone;
|
||||||
|
@ -814,9 +840,9 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
|
||||||
cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xfb);
|
cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xfb);
|
||||||
|
|
||||||
/* restart continuous tone if enabled */
|
/* restart continuous tone if enabled */
|
||||||
if (tone & 0x10) {
|
if (tone & 0x10)
|
||||||
cx24123_writereg(state, 0x29, tone & ~0x40);
|
cx24123_writereg(state, 0x29, tone & ~0x40);
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,8 +879,9 @@ static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configured to return the measurement of errors in blocks, because no UCBLOCKS value
|
* Configured to return the measurement of errors in blocks,
|
||||||
* is available, so this value doubles up to satisfy both measurements
|
* because no UCBLOCKS value is available, so this value doubles up
|
||||||
|
* to satisfy both measurements.
|
||||||
*/
|
*/
|
||||||
static int cx24123_read_ber(struct dvb_frontend *fe, u32 *ber)
|
static int cx24123_read_ber(struct dvb_frontend *fe, u32 *ber)
|
||||||
{
|
{
|
||||||
|
@ -876,7 +903,8 @@ static int cx24123_read_signal_strength(struct dvb_frontend *fe,
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
|
|
||||||
*signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */
|
/* larger = better */
|
||||||
|
*signal_strength = cx24123_readreg(state, 0x3b) << 8;
|
||||||
|
|
||||||
dprintk("Signal strength = %d\n", *signal_strength);
|
dprintk("Signal strength = %d\n", *signal_strength);
|
||||||
|
|
||||||
|
@ -932,7 +960,8 @@ static int cx24123_set_frontend(struct dvb_frontend *fe,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
|
static int cx24123_get_frontend(struct dvb_frontend *fe,
|
||||||
|
struct dvb_frontend_parameters *p)
|
||||||
{
|
{
|
||||||
struct cx24123_state *state = fe->demodulator_priv;
|
struct cx24123_state *state = fe->demodulator_priv;
|
||||||
|
|
||||||
|
@ -997,7 +1026,7 @@ static int cx24123_tune(struct dvb_frontend* fe,
|
||||||
|
|
||||||
static int cx24123_get_algo(struct dvb_frontend *fe)
|
static int cx24123_get_algo(struct dvb_frontend *fe)
|
||||||
{
|
{
|
||||||
return 1; //FE_ALGO_HW
|
return 1; /* FE_ALGO_HW */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cx24123_release(struct dvb_frontend *fe)
|
static void cx24123_release(struct dvb_frontend *fe)
|
||||||
|
@ -1057,15 +1086,20 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config,
|
||||||
/* check if the demod is there */
|
/* check if the demod is there */
|
||||||
state->demod_rev = cx24123_readreg(state, 0x00);
|
state->demod_rev = cx24123_readreg(state, 0x00);
|
||||||
switch (state->demod_rev) {
|
switch (state->demod_rev) {
|
||||||
case 0xe1: info("detected CX24123C\n"); break;
|
case 0xe1:
|
||||||
case 0xd1: info("detected CX24123\n"); break;
|
info("detected CX24123C\n");
|
||||||
|
break;
|
||||||
|
case 0xd1:
|
||||||
|
info("detected CX24123\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
err("wrong demod revision: %x\n", state->demod_rev);
|
err("wrong demod revision: %x\n", state->demod_rev);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create dvb_frontend */
|
/* create dvb_frontend */
|
||||||
memcpy(&state->frontend.ops, &cx24123_ops, sizeof(struct dvb_frontend_ops));
|
memcpy(&state->frontend.ops, &cx24123_ops,
|
||||||
|
sizeof(struct dvb_frontend_ops));
|
||||||
state->frontend.demodulator_priv = state;
|
state->frontend.demodulator_priv = state;
|
||||||
|
|
||||||
/* create tuner i2c adapter */
|
/* create tuner i2c adapter */
|
||||||
|
@ -1090,6 +1124,7 @@ error:
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(cx24123_attach);
|
||||||
|
|
||||||
static struct dvb_frontend_ops cx24123_ops = {
|
static struct dvb_frontend_ops cx24123_ops = {
|
||||||
|
|
||||||
|
@ -1126,15 +1161,8 @@ static struct dvb_frontend_ops cx24123_ops = {
|
||||||
.get_frontend_algo = cx24123_get_algo,
|
.get_frontend_algo = cx24123_get_algo,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_param(debug, int, 0644);
|
|
||||||
MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
|
|
||||||
|
|
||||||
module_param(force_band, int, 0644);
|
|
||||||
MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off).");
|
|
||||||
|
|
||||||
MODULE_DESCRIPTION("DVB Frontend module for Conexant " \
|
MODULE_DESCRIPTION("DVB Frontend module for Conexant " \
|
||||||
"CX24123/CX24109/CX24113 hardware");
|
"CX24123/CX24109/CX24113 hardware");
|
||||||
MODULE_AUTHOR("Steven Toth");
|
MODULE_AUTHOR("Steven Toth");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
EXPORT_SYMBOL(cx24123_attach);
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
#include <linux/dvb/frontend.h>
|
#include <linux/dvb/frontend.h>
|
||||||
|
|
||||||
struct cx24123_config
|
struct cx24123_config {
|
||||||
{
|
|
||||||
/* the demodulator's i2c address */
|
/* the demodulator's i2c address */
|
||||||
u8 demod_address;
|
u8 demod_address;
|
||||||
|
|
||||||
|
@ -39,7 +38,8 @@ struct cx24123_config
|
||||||
void (*agc_callback) (struct dvb_frontend *);
|
void (*agc_callback) (struct dvb_frontend *);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_DVB_CX24123) || (defined(CONFIG_DVB_CX24123_MODULE) && defined(MODULE))
|
#if defined(CONFIG_DVB_CX24123) || (defined(CONFIG_DVB_CX24123_MODULE) \
|
||||||
|
&& defined(MODULE))
|
||||||
extern struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
|
extern struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
|
||||||
struct i2c_adapter *i2c);
|
struct i2c_adapter *i2c);
|
||||||
extern struct i2c_adapter *cx24123_get_tuner_i2c_adapter(struct dvb_frontend *);
|
extern struct i2c_adapter *cx24123_get_tuner_i2c_adapter(struct dvb_frontend *);
|
||||||
|
@ -56,6 +56,6 @@ static struct i2c_adapter *
|
||||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif // CONFIG_DVB_CX24123
|
#endif
|
||||||
|
|
||||||
#endif /* CX24123_H */
|
#endif /* CX24123_H */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче