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

V4L/DVB (11581): stv090x and stv6110x: fix repeater level setup and ref clock

* Reference clock was unused
* Fix missing repeater level setup

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Manu Abraham and committed by
Mauro Carvalho Chehab
017eb038 dd4c2b3f

+24 -6
+7 -2
drivers/media/dvb/frontends/stv090x.c
··· 640 640 static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) 641 641 { 642 642 struct stv090x_state *state = fe->demodulator_priv; 643 + const struct stv090x_config *config = state->config; 643 644 u32 reg; 644 645 645 646 reg = STV090x_READ_DEMOD(state, I2CRPT); 646 - 647 + // STV090x_SETFIELD_Px(reg, ENARPT_LEVEL_FIELD, config->repeater_level); 647 648 if (enable) { 649 + dprintk(FE_DEBUG, 1, "Enable Gate"); 648 650 STV090x_SETFIELD_Px(reg, I2CT_ON_FIELD, 1); 649 651 if (STV090x_WRITE_DEMOD(state, I2CRPT, reg) < 0) 650 652 goto err; 651 653 652 654 } else { 655 + dprintk(FE_DEBUG, 1, "Disable Gate"); 653 656 STV090x_SETFIELD_Px(reg, I2CT_ON_FIELD, 0); 654 657 if ((STV090x_WRITE_DEMOD(state, I2CRPT, reg)) < 0) 655 658 goto err; ··· 3776 3773 const struct stv090x_reg *stv090x_initval = NULL; 3777 3774 const struct stv090x_reg *stv090x_cut20_val = NULL; 3778 3775 unsigned long t1_size = 0, t2_size = 0; 3776 + u32 reg = 0; 3779 3777 3780 3778 int i; 3781 3779 ··· 3803 3799 if (STV090x_WRITE_DEMOD(state, TNRCFG, 0x6c) < 0) /* check register ! (No Tuner Mode) */ 3804 3800 goto err; 3805 3801 3806 - if (STV090x_WRITE_DEMOD(state, I2CRPT, 0x00) < 0) /* repeater OFF */ 3802 + STV090x_SETFIELD_Px(reg, ENARPT_LEVEL_FIELD, config->repeater_level); 3803 + if (STV090x_WRITE_DEMOD(state, I2CRPT, reg) < 0) /* repeater OFF */ 3807 3804 goto err; 3808 3805 3809 3806 if (stv090x_write_reg(state, STV090x_NCOARSE, 0x13) < 0) /* set PLL divider */
+13
drivers/media/dvb/frontends/stv090x.h
··· 49 49 STV090x_CLK_EXT = 2 /* Clk i/p = XTALI */ 50 50 }; 51 51 52 + enum stv090x_i2crpt { 53 + STV090x_RPTLEVEL_256 = 0, 54 + STV090x_RPTLEVEL_128 = 1, 55 + STV090x_RPTLEVEL_64 = 2, 56 + STV090x_RPTLEVEL_32 = 3, 57 + STV090x_RPTLEVEL_16 = 4, 58 + STV090x_RPTLEVEL_8 = 5, 59 + STV090x_RPTLEVEL_4 = 6, 60 + STV090x_RPTLEVEL_2 = 7, 61 + }; 62 + 52 63 struct stv090x_config { 53 64 enum stv090x_device device; 54 65 enum stv090x_mode demod_mode; ··· 72 61 73 62 u8 ts1_mode; 74 63 u8 ts2_mode; 64 + 65 + enum stv090x_i2crpt repeater_level; 75 66 76 67 int (*tuner_init) (struct dvb_frontend *fe); 77 68 int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode);
+2 -4
drivers/media/dvb/frontends/stv6110x_priv.h
··· 62 62 63 63 #define TRIALS 10 64 64 #define R_DIV(__div) (1 << (__div + 1)) 65 - #define REFCLOCK_kHz (stv6110x->reference / 1000) 66 - #define REFCLOCK_MHz (stv6110x->reference / 1000000) 65 + #define REFCLOCK_kHz (stv6110x->config->refclk / 1000) 66 + #define REFCLOCK_MHz (stv6110x->config->refclk / 1000000) 67 67 68 68 struct stv6110x_state { 69 69 struct i2c_adapter *i2c; 70 70 const struct stv6110x_config *config; 71 71 72 72 struct stv6110x_devctl *devctl; 73 - 74 - u32 reference; 75 73 }; 76 74 77 75 #endif /* __STV6110x_PRIV_H */
+2
drivers/media/dvb/ttpci/budget-ci.c
··· 1361 1361 .ts1_mode = STV090x_TSMODE_DVBCI, 1362 1362 .ts2_mode = STV090x_TSMODE_DVBCI, 1363 1363 1364 + .repeater_level = STV090x_RPTLEVEL_16, 1365 + 1364 1366 .tuner_init = NULL, 1365 1367 .tuner_set_mode = NULL, 1366 1368 .tuner_set_frequency = NULL,