From d8b5a8e449a08a1a87170144a42d0a0b167bcad6 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Sun, 10 Jan 2010 15:40:28 -0300 Subject: V4L/DVB (13988): [STV090x] Configuration parameters adc1_range, adc2_range, tuner_bbgain Add parameters adc1_range, adc2_range and tuner_bbgain to the config struct. Defaults: adc1_range = adc2_range = 2Vpp, tuner_bbgain = 10db Signed-off-by: Oliver Endriss Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 19 ++++++++++++++++++- drivers/media/dvb/frontends/stv090x.h | 9 +++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index a5bae404701c..e1d4647b1a99 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -3237,7 +3237,10 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) goto err; if (state->config->tuner_set_bbgain) { - if (state->config->tuner_set_bbgain(fe, 10) < 0) /* 10dB */ + reg = state->config->tuner_bbgain; + if (reg == 0) + reg = 10; /* default: 10dB */ + if (state->config->tuner_set_bbgain(fe, reg) < 0) goto err_gateoff; } @@ -4446,6 +4449,20 @@ static int stv090x_setup(struct dvb_frontend *fe) state->internal->dev_ver); } + /* ADC1 range */ + reg = stv090x_read_reg(state, STV090x_TSTTNR1); + STV090x_SETFIELD(reg, ADC1_INMODE_FIELD, + (config->adc1_range == STV090x_ADC_1Vpp) ? 0 : 1); + if (stv090x_write_reg(state, STV090x_TSTTNR1, reg) < 0) + goto err; + + /* ADC2 range */ + reg = stv090x_read_reg(state, STV090x_TSTTNR3); + STV090x_SETFIELD(reg, ADC2_INMODE_FIELD, + (config->adc2_range == STV090x_ADC_1Vpp) ? 0 : 1); + if (stv090x_write_reg(state, STV090x_TSTTNR3, reg) < 0) + goto err; + if (stv090x_write_reg(state, STV090x_TSTRES0, 0x80) < 0) goto err; if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0) diff --git a/drivers/media/dvb/frontends/stv090x.h b/drivers/media/dvb/frontends/stv090x.h index 96e3dc758e08..30f01a6902ac 100644 --- a/drivers/media/dvb/frontends/stv090x.h +++ b/drivers/media/dvb/frontends/stv090x.h @@ -60,6 +60,11 @@ enum stv090x_i2crpt { STV090x_RPTLEVEL_2 = 7, }; +enum stv090x_adc_range { + STV090x_ADC_2Vpp = 0, + STV090x_ADC_1Vpp = 1 +}; + struct stv090x_config { enum stv090x_device device; enum stv090x_mode demod_mode; @@ -75,6 +80,10 @@ struct stv090x_config { enum stv090x_i2crpt repeater_level; + u8 tuner_bbgain; /* default: 10db */ + enum stv090x_adc_range adc1_range; /* default: 2Vpp */ + enum stv090x_adc_range adc2_range; /* default: 2Vpp */ + bool diseqc_envelope_mode; int (*tuner_init) (struct dvb_frontend *fe); -- cgit v1.2.2