diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/stb0899_algo.c | 13 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stb0899_drv.c | 22 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stb0899_priv.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stb6100.c | 17 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda8261.c | 8 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 2 |
7 files changed, 37 insertions, 29 deletions
diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index b7752473f7a7..3cf9719204f2 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c | |||
@@ -583,6 +583,9 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state) | |||
583 | internal->derot_freq = 0; | 583 | internal->derot_freq = 0; |
584 | internal->status = NOAGC1; | 584 | internal->status = NOAGC1; |
585 | 585 | ||
586 | /* enable tuner I/O */ | ||
587 | stb0899_i2c_gate_ctrl(&state->frontend, 1); | ||
588 | |||
586 | /* Move tuner to frequency */ | 589 | /* Move tuner to frequency */ |
587 | dprintk(state->verbose, FE_DEBUG, 1, "Tuner set frequency"); | 590 | dprintk(state->verbose, FE_DEBUG, 1, "Tuner set frequency"); |
588 | if (state->config->tuner_set_frequency) | 591 | if (state->config->tuner_set_frequency) |
@@ -598,6 +601,10 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state) | |||
598 | /* There is signal in the band */ | 601 | /* There is signal in the band */ |
599 | if (config->tuner_get_bandwidth) | 602 | if (config->tuner_get_bandwidth) |
600 | config->tuner_get_bandwidth(&state->frontend, &bandwidth); | 603 | config->tuner_get_bandwidth(&state->frontend, &bandwidth); |
604 | |||
605 | /* disable tuner I/O */ | ||
606 | stb0899_i2c_gate_ctrl(&state->frontend, 0); | ||
607 | |||
601 | if (params->srate <= bandwidth / 2) | 608 | if (params->srate <= bandwidth / 2) |
602 | stb0899_search_tmg(state); /* For low rates (SCPC) */ | 609 | stb0899_search_tmg(state); /* For low rates (SCPC) */ |
603 | else | 610 | else |
@@ -1325,12 +1332,18 @@ enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state) | |||
1325 | STB0899_SETFIELD_VAL(FRESRS, reg, 1); | 1332 | STB0899_SETFIELD_VAL(FRESRS, reg, 1); |
1326 | stb0899_write_reg(state, STB0899_TSTRES, reg); | 1333 | stb0899_write_reg(state, STB0899_TSTRES, reg); |
1327 | 1334 | ||
1335 | /* enable tuner I/O */ | ||
1336 | stb0899_i2c_gate_ctrl(&state->frontend, 1); | ||
1337 | |||
1328 | /* Move tuner to frequency */ | 1338 | /* Move tuner to frequency */ |
1329 | if (state->config->tuner_set_frequency) | 1339 | if (state->config->tuner_set_frequency) |
1330 | state->config->tuner_set_frequency(&state->frontend, internal->freq); | 1340 | state->config->tuner_set_frequency(&state->frontend, internal->freq); |
1331 | if (state->config->tuner_get_frequency) | 1341 | if (state->config->tuner_get_frequency) |
1332 | state->config->tuner_get_frequency(&state->frontend, &internal->freq); | 1342 | state->config->tuner_get_frequency(&state->frontend, &internal->freq); |
1333 | 1343 | ||
1344 | /* disable tuner I/O */ | ||
1345 | stb0899_i2c_gate_ctrl(&state->frontend, 0); | ||
1346 | |||
1334 | /* Set IF AGC to acquisition */ | 1347 | /* Set IF AGC to acquisition */ |
1335 | reg = STB0899_READ_S2REG(STB0899_S2DEMOD, IF_AGC_CNTRL); | 1348 | reg = STB0899_READ_S2REG(STB0899_S2DEMOD, IF_AGC_CNTRL); |
1336 | STB0899_SETFIELD_VAL(IF_LOOP_GAIN, reg, 4); | 1349 | STB0899_SETFIELD_VAL(IF_LOOP_GAIN, reg, 4); |
diff --git a/drivers/media/dvb/frontends/stb0899_drv.c b/drivers/media/dvb/frontends/stb0899_drv.c index 196a837f11ce..333b983b04ab 100644 --- a/drivers/media/dvb/frontends/stb0899_drv.c +++ b/drivers/media/dvb/frontends/stb0899_drv.c | |||
@@ -1241,7 +1241,7 @@ static int stb0899_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) | |||
1241 | return 0; | 1241 | return 0; |
1242 | } | 1242 | } |
1243 | 1243 | ||
1244 | static int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | 1244 | int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) |
1245 | { | 1245 | { |
1246 | int i2c_stat; | 1246 | int i2c_stat; |
1247 | struct stb0899_state *state = fe->demodulator_priv; | 1247 | struct stb0899_state *state = fe->demodulator_priv; |
@@ -1255,10 +1255,15 @@ static int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
1255 | i2c_stat |= STB0899_I2CTON; | 1255 | i2c_stat |= STB0899_I2CTON; |
1256 | if (stb0899_write_reg(state, STB0899_I2CRPT, i2c_stat) < 0) | 1256 | if (stb0899_write_reg(state, STB0899_I2CRPT, i2c_stat) < 0) |
1257 | goto err; | 1257 | goto err; |
1258 | } else { | ||
1259 | dprintk(state->verbose, FE_DEBUG, 1, "Disabling I2C Repeater ..."); | ||
1260 | i2c_stat &= ~STB0899_I2CTON; | ||
1261 | if (stb0899_write_reg(state, STB0899_I2CRPT, i2c_stat) < 0) | ||
1262 | goto err; | ||
1258 | } | 1263 | } |
1259 | return 0; | 1264 | return 0; |
1260 | err: | 1265 | err: |
1261 | dprintk(state->verbose, FE_ERROR, 1, "I2C Repeater enable failed"); | 1266 | dprintk(state->verbose, FE_ERROR, 1, "I2C Repeater control failed"); |
1262 | return -EREMOTEIO; | 1267 | return -EREMOTEIO; |
1263 | } | 1268 | } |
1264 | 1269 | ||
@@ -1592,10 +1597,17 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_pa | |||
1592 | internal->derot_percent = 30; | 1597 | internal->derot_percent = 30; |
1593 | 1598 | ||
1594 | /* What to do for tuners having no bandwidth setup ? */ | 1599 | /* What to do for tuners having no bandwidth setup ? */ |
1600 | /* enable tuner I/O */ | ||
1601 | stb0899_i2c_gate_ctrl(&state->frontend, 1); | ||
1602 | |||
1595 | if (state->config->tuner_set_bandwidth) | 1603 | if (state->config->tuner_set_bandwidth) |
1596 | state->config->tuner_set_bandwidth(fe, (13 * (stb0899_carr_width(state) + SearchRange)) / 10); | 1604 | state->config->tuner_set_bandwidth(fe, (13 * (stb0899_carr_width(state) + SearchRange)) / 10); |
1597 | if (state->config->tuner_get_bandwidth) | 1605 | if (state->config->tuner_get_bandwidth) |
1598 | state->config->tuner_get_bandwidth(fe, &internal->tuner_bw); | 1606 | state->config->tuner_get_bandwidth(fe, &internal->tuner_bw); |
1607 | |||
1608 | /* disable tuner I/O */ | ||
1609 | stb0899_i2c_gate_ctrl(&state->frontend, 0); | ||
1610 | |||
1599 | /* Set DVB-S1 AGC */ | 1611 | /* Set DVB-S1 AGC */ |
1600 | stb0899_write_reg(state, STB0899_AGCRFCFG, 0x11); | 1612 | stb0899_write_reg(state, STB0899_AGCRFCFG, 0x11); |
1601 | 1613 | ||
@@ -1624,11 +1636,17 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_pa | |||
1624 | internal->srate = i_params->srate; | 1636 | internal->srate = i_params->srate; |
1625 | internal->srch_range = SearchRange; | 1637 | internal->srch_range = SearchRange; |
1626 | 1638 | ||
1639 | /* enable tuner I/O */ | ||
1640 | stb0899_i2c_gate_ctrl(&state->frontend, 1); | ||
1641 | |||
1627 | if (state->config->tuner_set_bandwidth) | 1642 | if (state->config->tuner_set_bandwidth) |
1628 | state->config->tuner_set_bandwidth(fe, (stb0899_carr_width(state) + SearchRange)); | 1643 | state->config->tuner_set_bandwidth(fe, (stb0899_carr_width(state) + SearchRange)); |
1629 | if (state->config->tuner_get_bandwidth) | 1644 | if (state->config->tuner_get_bandwidth) |
1630 | state->config->tuner_get_bandwidth(fe, &internal->tuner_bw); | 1645 | state->config->tuner_get_bandwidth(fe, &internal->tuner_bw); |
1631 | 1646 | ||
1647 | /* disable tuner I/O */ | ||
1648 | stb0899_i2c_gate_ctrl(&state->frontend, 0); | ||
1649 | |||
1632 | // pParams->SpectralInv = pSearch->IQ_Inversion; | 1650 | // pParams->SpectralInv = pSearch->IQ_Inversion; |
1633 | 1651 | ||
1634 | /* Set DVB-S2 AGC */ | 1652 | /* Set DVB-S2 AGC */ |
diff --git a/drivers/media/dvb/frontends/stb0899_priv.h b/drivers/media/dvb/frontends/stb0899_priv.h index 8a7c4ee087d8..755269979d1e 100644 --- a/drivers/media/dvb/frontends/stb0899_priv.h +++ b/drivers/media/dvb/frontends/stb0899_priv.h | |||
@@ -253,6 +253,8 @@ extern int stb0899_write_s2reg(struct stb0899_state *state, | |||
253 | u16 stb0899_reg_offset, | 253 | u16 stb0899_reg_offset, |
254 | u32 stb0899_data); | 254 | u32 stb0899_data); |
255 | 255 | ||
256 | extern int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable); | ||
257 | |||
256 | 258 | ||
257 | #define STB0899_READ_S2REG(DEVICE, REG) (_stb0899_read_s2reg(state, DEVICE, STB0899_BASE_##REG, STB0899_OFF0_##REG)) | 259 | #define STB0899_READ_S2REG(DEVICE, REG) (_stb0899_read_s2reg(state, DEVICE, STB0899_BASE_##REG, STB0899_OFF0_##REG)) |
258 | //#define STB0899_WRITE_S2REG(DEVICE, REG, DATA) (_stb0899_write_s2reg(state, DEVICE, STB0899_BASE_##REG, STB0899_OFF0_##REG, DATA)) | 260 | //#define STB0899_WRITE_S2REG(DEVICE, REG, DATA) (_stb0899_write_s2reg(state, DEVICE, STB0899_BASE_##REG, STB0899_OFF0_##REG, DATA)) |
diff --git a/drivers/media/dvb/frontends/stb6100.c b/drivers/media/dvb/frontends/stb6100.c index c8fdc1e99df1..f404a4d0fb17 100644 --- a/drivers/media/dvb/frontends/stb6100.c +++ b/drivers/media/dvb/frontends/stb6100.c | |||
@@ -134,16 +134,7 @@ static int stb6100_read_regs(struct stb6100_state *state, u8 regs[]) | |||
134 | .len = STB6100_NUMREGS | 134 | .len = STB6100_NUMREGS |
135 | }; | 135 | }; |
136 | 136 | ||
137 | if (state->frontend->ops.i2c_gate_ctrl) | ||
138 | if ((rc = state->frontend->ops.i2c_gate_ctrl(state->frontend, 1)) < 0) | ||
139 | return rc; | ||
140 | |||
141 | rc = i2c_transfer(state->i2c, &msg, 1); | 137 | rc = i2c_transfer(state->i2c, &msg, 1); |
142 | if (state->frontend->ops.i2c_gate_ctrl) { | ||
143 | int rc2; | ||
144 | if ((rc2 = state->frontend->ops.i2c_gate_ctrl(state->frontend, 0)) < 0) | ||
145 | return rc2; | ||
146 | } | ||
147 | if (unlikely(rc != 1)) { | 138 | if (unlikely(rc != 1)) { |
148 | dprintk(verbose, FE_ERROR, 1, "Read (0x%x) err, rc=[%d]", | 139 | dprintk(verbose, FE_ERROR, 1, "Read (0x%x) err, rc=[%d]", |
149 | state->config->tuner_address, rc); | 140 | state->config->tuner_address, rc); |
@@ -200,15 +191,7 @@ static int stb6100_write_reg_range(struct stb6100_state *state, u8 buf[], int st | |||
200 | for (i = 0; i < len; i++) | 191 | for (i = 0; i < len; i++) |
201 | dprintk(verbose, FE_DEBUG, 1, " %s: 0x%02x", stb6100_regnames[start + i], buf[i]); | 192 | dprintk(verbose, FE_DEBUG, 1, " %s: 0x%02x", stb6100_regnames[start + i], buf[i]); |
202 | } | 193 | } |
203 | if (state->frontend->ops.i2c_gate_ctrl) | ||
204 | if ((rc = state->frontend->ops.i2c_gate_ctrl(state->frontend, 1)) < 0) | ||
205 | return rc; | ||
206 | rc = i2c_transfer(state->i2c, &msg, 1); | 194 | rc = i2c_transfer(state->i2c, &msg, 1); |
207 | if (state->frontend->ops.i2c_gate_ctrl) { | ||
208 | int rc2; | ||
209 | if ((rc2 = state->frontend->ops.i2c_gate_ctrl(state->frontend, 0)) < 0) | ||
210 | return rc2; | ||
211 | } | ||
212 | if (unlikely(rc != 1)) { | 195 | if (unlikely(rc != 1)) { |
213 | dprintk(verbose, FE_ERROR, 1, "(0x%x) write err [%d:%d], rc=[%d]", | 196 | dprintk(verbose, FE_ERROR, 1, "(0x%x) write err [%d:%d], rc=[%d]", |
214 | (unsigned int)state->config->tuner_address, start, len, rc); | 197 | (unsigned int)state->config->tuner_address, start, len, rc); |
diff --git a/drivers/media/dvb/frontends/tda8261.c b/drivers/media/dvb/frontends/tda8261.c index 16e833fdc77e..b6d177799104 100644 --- a/drivers/media/dvb/frontends/tda8261.c +++ b/drivers/media/dvb/frontends/tda8261.c | |||
@@ -37,14 +37,10 @@ struct tda8261_state { | |||
37 | 37 | ||
38 | static int tda8261_read(struct tda8261_state *state, u8 *buf) | 38 | static int tda8261_read(struct tda8261_state *state, u8 *buf) |
39 | { | 39 | { |
40 | struct dvb_frontend *fe = state->fe; | ||
41 | const struct tda8261_config *config = state->config; | 40 | const struct tda8261_config *config = state->config; |
42 | int err = 0; | 41 | int err = 0; |
43 | struct i2c_msg msg = { .addr = config->addr, .flags = I2C_M_RD,.buf = buf, .len = 2 }; | 42 | struct i2c_msg msg = { .addr = config->addr, .flags = I2C_M_RD,.buf = buf, .len = 2 }; |
44 | 43 | ||
45 | if (fe->ops.i2c_gate_ctrl) | ||
46 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
47 | |||
48 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) | 44 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) |
49 | printk("%s: read error, err=%d\n", __func__, err); | 45 | printk("%s: read error, err=%d\n", __func__, err); |
50 | 46 | ||
@@ -53,14 +49,10 @@ static int tda8261_read(struct tda8261_state *state, u8 *buf) | |||
53 | 49 | ||
54 | static int tda8261_write(struct tda8261_state *state, u8 *buf) | 50 | static int tda8261_write(struct tda8261_state *state, u8 *buf) |
55 | { | 51 | { |
56 | struct dvb_frontend *fe = state->fe; | ||
57 | const struct tda8261_config *config = state->config; | 52 | const struct tda8261_config *config = state->config; |
58 | int err = 0; | 53 | int err = 0; |
59 | struct i2c_msg msg = { .addr = config->addr, .flags = 0, .buf = buf, .len = 4 }; | 54 | struct i2c_msg msg = { .addr = config->addr, .flags = 0, .buf = buf, .len = 4 }; |
60 | 55 | ||
61 | if (fe->ops.i2c_gate_ctrl) | ||
62 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
63 | |||
64 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) | 56 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) |
65 | printk("%s: write error, err=%d\n", __func__, err); | 57 | printk("%s: write error, err=%d\n", __func__, err); |
66 | 58 | ||
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index d2b5cad8e06e..67a14c580a74 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -919,7 +919,7 @@ static const struct stb0899_s1_reg knc1_stb0899_s1_init_1[] = { | |||
919 | { STB0899_IRQMSK_0 , 0xff }, | 919 | { STB0899_IRQMSK_0 , 0xff }, |
920 | { STB0899_IRQCFG , 0x00 }, | 920 | { STB0899_IRQCFG , 0x00 }, |
921 | { STB0899_I2CCFG , 0x88 }, | 921 | { STB0899_I2CCFG , 0x88 }, |
922 | { STB0899_I2CRPT , 0x5c }, | 922 | { STB0899_I2CRPT , 0x58 }, /* Repeater=8, Stop=disabled */ |
923 | { STB0899_IOPVALUE5 , 0x00 }, | 923 | { STB0899_IOPVALUE5 , 0x00 }, |
924 | { STB0899_IOPVALUE4 , 0x20 }, | 924 | { STB0899_IOPVALUE4 , 0x20 }, |
925 | { STB0899_IOPVALUE3 , 0xc9 }, | 925 | { STB0899_IOPVALUE3 , 0xc9 }, |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 5b6dbcc764cf..9cb8ff59e61f 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -1108,7 +1108,7 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_1[] = { | |||
1108 | { STB0899_IRQMSK_0 , 0xff }, | 1108 | { STB0899_IRQMSK_0 , 0xff }, |
1109 | { STB0899_IRQCFG , 0x00 }, | 1109 | { STB0899_IRQCFG , 0x00 }, |
1110 | { STB0899_I2CCFG , 0x88 }, | 1110 | { STB0899_I2CCFG , 0x88 }, |
1111 | { STB0899_I2CRPT , 0x48 }, /* 12k Pullup */ | 1111 | { STB0899_I2CRPT , 0x48 }, /* 12k Pullup, Repeater=16, Stop=disabled */ |
1112 | { STB0899_IOPVALUE5 , 0x00 }, | 1112 | { STB0899_IOPVALUE5 , 0x00 }, |
1113 | { STB0899_IOPVALUE4 , 0x20 }, | 1113 | { STB0899_IOPVALUE4 , 0x20 }, |
1114 | { STB0899_IOPVALUE3 , 0xc9 }, | 1114 | { STB0899_IOPVALUE3 , 0xc9 }, |