summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/dib7000p.c
diff options
context:
space:
mode:
authorOlivier Grenie <olivier.grenie@parrot.com>2012-12-31 09:23:26 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-22 17:13:43 -0300
commit6fe1099c7aecc54ebf2fcf8e3af2225cd7bfa550 (patch)
tree7d7f88a275200cafffb96027b94b750afc761951 /drivers/media/dvb-frontends/dib7000p.c
parent173a64cb3fcff1993b2aa8113e53fd379f6a968f (diff)
downloadlinux-6fe1099c7aecc54ebf2fcf8e3af2225cd7bfa550.tar.gz
linux-6fe1099c7aecc54ebf2fcf8e3af2225cd7bfa550.tar.bz2
linux-6fe1099c7aecc54ebf2fcf8e3af2225cd7bfa550.zip
[media] dib7000p: enhancement
The intend of this patch is to improve the support of the dib7000p. It is now possible to set the minimum value for the AGC1. Also, the driver takes into account the frequency offset introduced in the tuned frequency. Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends/dib7000p.c')
-rw-r--r--drivers/media/dvb-frontends/dib7000p.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
index 3e1eefada0e8..effb87f773b0 100644
--- a/drivers/media/dvb-frontends/dib7000p.c
+++ b/drivers/media/dvb-frontends/dib7000p.c
@@ -429,6 +429,13 @@ int dib7000p_get_agc_values(struct dvb_frontend *fe,
}
EXPORT_SYMBOL(dib7000p_get_agc_values);
+int dib7000p_set_agc1_min(struct dvb_frontend *fe, u16 v)
+{
+ struct dib7000p_state *state = fe->demodulator_priv;
+ return dib7000p_write_word(state, 108, v);
+}
+EXPORT_SYMBOL(dib7000p_set_agc1_min);
+
static void dib7000p_reset_pll(struct dib7000p_state *state)
{
struct dibx000_bandwidth_config *bw = &state->cfg.bw[0];
@@ -821,6 +828,7 @@ static int dib7000p_agc_startup(struct dvb_frontend *demod)
u8 agc_split;
u16 reg;
u32 upd_demod_gain_period = 0x1000;
+ s32 frequency_offset = 0;
switch (state->agc_state) {
case 0:
@@ -841,7 +849,14 @@ static int dib7000p_agc_startup(struct dvb_frontend *demod)
if (dib7000p_set_agc_config(state, BAND_OF_FREQUENCY(ch->frequency / 1000)) != 0)
return -1;
- dib7000p_set_dds(state, 0);
+ if (demod->ops.tuner_ops.get_frequency) {
+ u32 frequency_tuner;
+
+ demod->ops.tuner_ops.get_frequency(demod, &frequency_tuner);
+ frequency_offset = (s32)frequency_tuner / 1000 - ch->frequency / 1000;
+ }
+
+ dib7000p_set_dds(state, frequency_offset);
ret = 7;
(*agc_state)++;
break;