diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-18 16:47:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:58:44 -0400 |
commit | 74349bef1a5b5a287721a42bec08c226b095e8b0 (patch) | |
tree | 410f251b3fce7a8e94120576ddd5f9fc25ddc839 | |
parent | e9f9c0d87b1d532b82618bc154246e2dba20934b (diff) |
V4L/DVB (3858): Convert tda1004x to refactored tuner code
Convert to tuner_ops calls.
Remove pll function pointers from structure.
Remove unneeded tuner calls.
Add i2c gate control function.
Remove europa specific hack (moved into appropriate card driver)
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/frontends/tda1004x.c | 47 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda1004x.h | 5 |
2 files changed, 15 insertions, 37 deletions
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index b83dafa4e12c..d9abce753e52 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -600,13 +600,6 @@ static int tda10045_init(struct dvb_frontend* fe) | |||
600 | 600 | ||
601 | tda1004x_write_mask(state, TDA1004X_CONFADC1, 0x10, 0); // wake up the ADC | 601 | tda1004x_write_mask(state, TDA1004X_CONFADC1, 0x10, 0); // wake up the ADC |
602 | 602 | ||
603 | // Init the PLL | ||
604 | if (state->config->pll_init) { | ||
605 | tda1004x_enable_tuner_i2c(state); | ||
606 | state->config->pll_init(fe); | ||
607 | tda1004x_disable_tuner_i2c(state); | ||
608 | } | ||
609 | |||
610 | // tda setup | 603 | // tda setup |
611 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer | 604 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer |
612 | tda1004x_write_mask(state, TDA1004X_AUTO, 8, 0); // select HP stream | 605 | tda1004x_write_mask(state, TDA1004X_AUTO, 8, 0); // select HP stream |
@@ -635,16 +628,6 @@ static int tda10046_init(struct dvb_frontend* fe) | |||
635 | return -EIO; | 628 | return -EIO; |
636 | } | 629 | } |
637 | 630 | ||
638 | // Init the tuner PLL | ||
639 | if (state->config->pll_init) { | ||
640 | tda1004x_enable_tuner_i2c(state); | ||
641 | if (state->config->pll_init(fe)) { | ||
642 | printk(KERN_ERR "tda1004x: pll init failed\n"); | ||
643 | return -EIO; | ||
644 | } | ||
645 | tda1004x_disable_tuner_i2c(state); | ||
646 | } | ||
647 | |||
648 | // tda setup | 631 | // tda setup |
649 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer | 632 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer |
650 | tda1004x_write_byteI(state, TDA1004X_AUTO, 0x87); // 100 ppm crystal, select HP stream | 633 | tda1004x_write_byteI(state, TDA1004X_AUTO, 0x87); // 100 ppm crystal, select HP stream |
@@ -712,12 +695,10 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
712 | } | 695 | } |
713 | 696 | ||
714 | // set frequency | 697 | // set frequency |
715 | tda1004x_enable_tuner_i2c(state); | 698 | if (fe->ops->tuner_ops.set_params) { |
716 | if (state->config->pll_set(fe, fe_params)) { | 699 | fe->ops->tuner_ops.set_params(fe, fe_params); |
717 | printk(KERN_ERR "tda1004x: pll set failed\n"); | 700 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); |
718 | return -EIO; | ||
719 | } | 701 | } |
720 | tda1004x_disable_tuner_i2c(state); | ||
721 | 702 | ||
722 | // Hardcoded to use auto as much as possible on the TDA10045 as it | 703 | // Hardcoded to use auto as much as possible on the TDA10045 as it |
723 | // is very unreliable if AUTO mode is _not_ used. | 704 | // is very unreliable if AUTO mode is _not_ used. |
@@ -1183,16 +1164,6 @@ static int tda1004x_sleep(struct dvb_frontend* fe) | |||
1183 | break; | 1164 | break; |
1184 | 1165 | ||
1185 | case TDA1004X_DEMOD_TDA10046: | 1166 | case TDA1004X_DEMOD_TDA10046: |
1186 | if (state->config->pll_sleep != NULL) { | ||
1187 | tda1004x_enable_tuner_i2c(state); | ||
1188 | state->config->pll_sleep(fe); | ||
1189 | if (state->config->if_freq != TDA10046_FREQ_052) { | ||
1190 | /* special hack for Philips EUROPA Based boards: | ||
1191 | * keep the I2c bridge open for tuner access in analog mode | ||
1192 | */ | ||
1193 | tda1004x_disable_tuner_i2c(state); | ||
1194 | } | ||
1195 | } | ||
1196 | /* set outputs to tristate */ | 1167 | /* set outputs to tristate */ |
1197 | tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0xff); | 1168 | tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0xff); |
1198 | tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1); | 1169 | tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1); |
@@ -1202,6 +1173,17 @@ static int tda1004x_sleep(struct dvb_frontend* fe) | |||
1202 | return 0; | 1173 | return 0; |
1203 | } | 1174 | } |
1204 | 1175 | ||
1176 | static int tda1004x_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
1177 | { | ||
1178 | struct tda1004x_state* state = fe->demodulator_priv; | ||
1179 | |||
1180 | if (enable) { | ||
1181 | return tda1004x_enable_tuner_i2c(state); | ||
1182 | } else { | ||
1183 | return tda1004x_disable_tuner_i2c(state); | ||
1184 | } | ||
1185 | } | ||
1186 | |||
1205 | static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 1187 | static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) |
1206 | { | 1188 | { |
1207 | fesettings->min_delay_ms = 800; | 1189 | fesettings->min_delay_ms = 800; |
@@ -1235,6 +1217,7 @@ static struct dvb_frontend_ops tda10045_ops = { | |||
1235 | 1217 | ||
1236 | .init = tda10045_init, | 1218 | .init = tda10045_init, |
1237 | .sleep = tda1004x_sleep, | 1219 | .sleep = tda1004x_sleep, |
1220 | .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl, | ||
1238 | 1221 | ||
1239 | .set_frontend = tda1004x_set_fe, | 1222 | .set_frontend = tda1004x_set_fe, |
1240 | .get_frontend = tda1004x_get_fe, | 1223 | .get_frontend = tda1004x_get_fe, |
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h index cc0c4af64067..b877b23ed734 100644 --- a/drivers/media/dvb/frontends/tda1004x.h +++ b/drivers/media/dvb/frontends/tda1004x.h | |||
@@ -66,11 +66,6 @@ struct tda1004x_config | |||
66 | /* AGC configuration */ | 66 | /* AGC configuration */ |
67 | enum tda10046_agc agc_config; | 67 | enum tda10046_agc agc_config; |
68 | 68 | ||
69 | /* PLL maintenance */ | ||
70 | int (*pll_init)(struct dvb_frontend* fe); | ||
71 | void (*pll_sleep)(struct dvb_frontend* fe); | ||
72 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | ||
73 | |||
74 | /* request firmware for device */ | 69 | /* request firmware for device */ |
75 | /* set this to NULL if the card has a firmware EEPROM */ | 70 | /* set this to NULL if the card has a firmware EEPROM */ |
76 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | 71 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); |