aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/af9033.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-01-07 07:48:03 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 17:46:47 -0400
commit4902bb39b643437a4c0a339dbf8f3ceb14540be5 (patch)
tree267a1630dfbec22f222a2015f076c548d3e49372 /drivers/media/dvb-frontends/af9033.c
parent88b38befc0d8b7590f0b083dc4c8e4cee0b84788 (diff)
[media] af9033: support for it913x tuners
Add support for tuners integrated to the IT9135 and IT9137. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends/af9033.c')
-rw-r--r--drivers/media/dvb-frontends/af9033.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index c9cad989b8b9..dece775836ac 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -223,6 +223,7 @@ static int af9033_init(struct dvb_frontend *fe)
223 { 0x80f986, state->ts_mode_parallel, 0x01 }, 223 { 0x80f986, state->ts_mode_parallel, 0x01 },
224 { 0x00d827, 0x00, 0xff }, 224 { 0x00d827, 0x00, 0xff },
225 { 0x00d829, 0x00, 0xff }, 225 { 0x00d829, 0x00, 0xff },
226 { 0x800045, state->cfg.adc_multiplier, 0xff },
226 }; 227 };
227 228
228 /* program clock control */ 229 /* program clock control */
@@ -322,6 +323,14 @@ static int af9033_init(struct dvb_frontend *fe)
322 len = ARRAY_SIZE(tuner_init_fc0012); 323 len = ARRAY_SIZE(tuner_init_fc0012);
323 init = tuner_init_fc0012; 324 init = tuner_init_fc0012;
324 break; 325 break;
326 case AF9033_TUNER_IT9135_38:
327 case AF9033_TUNER_IT9135_51:
328 case AF9033_TUNER_IT9135_52:
329 case AF9033_TUNER_IT9135_60:
330 case AF9033_TUNER_IT9135_61:
331 case AF9033_TUNER_IT9135_62:
332 len = 0;
333 break;
325 default: 334 default:
326 dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n", 335 dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
327 __func__, state->cfg.tuner); 336 __func__, state->cfg.tuner);
@@ -498,12 +507,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
498 if (spec_inv == -1) 507 if (spec_inv == -1)
499 freq_cw = 0x800000 - freq_cw; 508 freq_cw = 0x800000 - freq_cw;
500 509
501 /* get adc multiplies */ 510 if (state->cfg.adc_multiplier == AF9033_ADC_MULTIPLIER_2X)
502 ret = af9033_rd_reg(state, 0x800045, &tmp);
503 if (ret < 0)
504 goto err;
505
506 if (tmp == 1)
507 freq_cw /= 2; 511 freq_cw /= 2;
508 512
509 buf[0] = (freq_cw >> 0) & 0xff; 513 buf[0] = (freq_cw >> 0) & 0xff;
@@ -933,14 +937,18 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
933 "OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1], 937 "OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
934 buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); 938 buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
935 939
936 /* sleep */
937 ret = af9033_wr_reg(state, 0x80004c, 1);
938 if (ret < 0)
939 goto err;
940 940
941 ret = af9033_wr_reg(state, 0x800000, 0); 941 /* FIXME: Do not abuse adc_multiplier for detecting IT9135 */
942 if (ret < 0) 942 if (state->cfg.adc_multiplier != AF9033_ADC_MULTIPLIER_2X) {
943 goto err; 943 /* sleep */
944 ret = af9033_wr_reg(state, 0x80004c, 1);
945 if (ret < 0)
946 goto err;
947
948 ret = af9033_wr_reg(state, 0x800000, 0);
949 if (ret < 0)
950 goto err;
951 }
944 952
945 /* configure internal TS mode */ 953 /* configure internal TS mode */
946 switch (state->cfg.ts_mode) { 954 switch (state->cfg.ts_mode) {