Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Olivier Grenie and committed by
Mauro Carvalho Chehab
6fe1099c 173a64cb

+23 -1
+16 -1
drivers/media/dvb-frontends/dib7000p.c
··· 429 429 } 430 430 EXPORT_SYMBOL(dib7000p_get_agc_values); 431 431 432 + int dib7000p_set_agc1_min(struct dvb_frontend *fe, u16 v) 433 + { 434 + struct dib7000p_state *state = fe->demodulator_priv; 435 + return dib7000p_write_word(state, 108, v); 436 + } 437 + EXPORT_SYMBOL(dib7000p_set_agc1_min); 438 + 432 439 static void dib7000p_reset_pll(struct dib7000p_state *state) 433 440 { 434 441 struct dibx000_bandwidth_config *bw = &state->cfg.bw[0]; ··· 828 821 u8 agc_split; 829 822 u16 reg; 830 823 u32 upd_demod_gain_period = 0x1000; 824 + s32 frequency_offset = 0; 831 825 832 826 switch (state->agc_state) { 833 827 case 0: ··· 849 841 if (dib7000p_set_agc_config(state, BAND_OF_FREQUENCY(ch->frequency / 1000)) != 0) 850 842 return -1; 851 843 852 - dib7000p_set_dds(state, 0); 844 + if (demod->ops.tuner_ops.get_frequency) { 845 + u32 frequency_tuner; 846 + 847 + demod->ops.tuner_ops.get_frequency(demod, &frequency_tuner); 848 + frequency_offset = (s32)frequency_tuner / 1000 - ch->frequency / 1000; 849 + } 850 + 851 + dib7000p_set_dds(state, frequency_offset); 853 852 ret = 7; 854 853 (*agc_state)++; 855 854 break;
+7
drivers/media/dvb-frontends/dib7000p.h
··· 63 63 extern int dib7090_slave_reset(struct dvb_frontend *fe); 64 64 extern int dib7000p_get_agc_values(struct dvb_frontend *fe, 65 65 u16 *agc_global, u16 *agc1, u16 *agc2, u16 *wbd); 66 + extern int dib7000p_set_agc1_min(struct dvb_frontend *fe, u16 v); 66 67 #else 67 68 static inline struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg) 68 69 { ··· 151 150 152 151 static inline int dib7000p_get_agc_values(struct dvb_frontend *fe, 153 152 u16 *agc_global, u16 *agc1, u16 *agc2, u16 *wbd) 153 + { 154 + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 155 + return -ENODEV; 156 + } 157 + 158 + static inline int dib7000p_set_agc1_min(struct dvb_frontend *fe, u16 v) 154 159 { 155 160 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 156 161 return -ENODEV;