aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-02-27 22:14:06 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 17:58:46 -0400
commit44af747f4e0174d5dbc8c565a4d329dbcf599921 (patch)
tree29a264280a58ce21305bee8e98df28b28638b647 /drivers/media/tuners
parentd19812eb5f1efed3fa0ba5d752da5f24d8c89701 (diff)
[media] it913x: get rid of it913x config struct
We don't need it. Tuner ID and device address are enough. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/tuners')
-rw-r--r--drivers/media/tuners/it913x.c38
-rw-r--r--drivers/media/tuners/it913x.h22
2 files changed, 29 insertions, 31 deletions
diff --git a/drivers/media/tuners/it913x.c b/drivers/media/tuners/it913x.c
index de20da1548aa..66d4b72d97ab 100644
--- a/drivers/media/tuners/it913x.c
+++ b/drivers/media/tuners/it913x.c
@@ -25,7 +25,8 @@
25struct it913x_state { 25struct it913x_state {
26 struct dvb_frontend frontend; 26 struct dvb_frontend frontend;
27 struct i2c_adapter *i2c_adap; 27 struct i2c_adapter *i2c_adap;
28 struct ite_config *config; 28 u8 chip_ver;
29 u8 firmware_ver;
29 u8 i2c_addr; 30 u8 i2c_addr;
30 u32 frequency; 31 u32 frequency;
31 fe_modulation_t constellation; 32 fe_modulation_t constellation;
@@ -156,7 +157,7 @@ static int it913x_init(struct dvb_frontend *fe)
156 u8 b[2]; 157 u8 b[2];
157 158
158 /* v1 or v2 tuner script */ 159 /* v1 or v2 tuner script */
159 if (state->config->chip_ver > 1) 160 if (state->chip_ver > 1)
160 ret = it913x_script_loader(state, it9135_v2); 161 ret = it913x_script_loader(state, it9135_v2);
161 else 162 else
162 ret = it913x_script_loader(state, it9135_v1); 163 ret = it913x_script_loader(state, it9135_v1);
@@ -190,7 +191,7 @@ static int it913x_init(struct dvb_frontend *fe)
190 if (ret < 0) 191 if (ret < 0)
191 return ret; 192 return ret;
192 193
193 if (state->config->chip_ver == 2) { 194 if (state->chip_ver == 2) {
194 ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1); 195 ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
195 if (ret < 0) 196 if (ret < 0)
196 return -ENODEV; 197 return -ENODEV;
@@ -237,7 +238,7 @@ static int it913x_init(struct dvb_frontend *fe)
237 state->tun_fn_min /= (state->tun_fdiv * nv_val); 238 state->tun_fn_min /= (state->tun_fdiv * nv_val);
238 pr_debug("Tuner fn_min %d\n", state->tun_fn_min); 239 pr_debug("Tuner fn_min %d\n", state->tun_fn_min);
239 240
240 if (state->config->chip_ver > 1) 241 if (state->chip_ver > 1)
241 msleep(50); 242 msleep(50);
242 else { 243 else {
243 for (i = 0; i < 50; i++) { 244 for (i = 0; i < 50; i++) {
@@ -276,7 +277,7 @@ static int it9137_set_params(struct dvb_frontend *fe)
276 u8 lna_band; 277 u8 lna_band;
277 u8 bw; 278 u8 bw;
278 279
279 if (state->config->firmware_ver == 1) 280 if (state->firmware_ver == 1)
280 set_tuner = set_it9135_template; 281 set_tuner = set_it9135_template;
281 else 282 else
282 set_tuner = set_it9137_template; 283 set_tuner = set_it9137_template;
@@ -440,40 +441,47 @@ static const struct dvb_tuner_ops it913x_tuner_ops = {
440}; 441};
441 442
442struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, 443struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
443 struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config) 444 struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config)
444{ 445{
445 struct it913x_state *state = NULL; 446 struct it913x_state *state = NULL;
446 int ret;
447 447
448 /* allocate memory for the internal state */ 448 /* allocate memory for the internal state */
449 state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); 449 state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL);
450 if (state == NULL) 450 if (state == NULL)
451 return NULL; 451 return NULL;
452 if (config == NULL)
453 goto error;
454 452
455 state->i2c_adap = i2c_adap; 453 state->i2c_adap = i2c_adap;
456 state->i2c_addr = i2c_addr; 454 state->i2c_addr = i2c_addr;
457 state->config = config;
458 455
459 switch (state->config->tuner_id_0) { 456 switch (config) {
457 case IT9135_38:
460 case IT9135_51: 458 case IT9135_51:
461 case IT9135_52: 459 case IT9135_52:
460 state->chip_ver = 0x01;
461 break;
462 case IT9135_60: 462 case IT9135_60:
463 case IT9135_61: 463 case IT9135_61:
464 case IT9135_62: 464 case IT9135_62:
465 state->tuner_type = state->config->tuner_id_0; 465 state->chip_ver = 0x02;
466 break; 466 break;
467 default: 467 default:
468 case IT9135_38: 468 dev_dbg(&i2c_adap->dev,
469 state->tuner_type = IT9135_38; 469 "%s: invalid config=%02x\n", __func__, config);
470 goto error;
470 } 471 }
471 472
473 state->tuner_type = config;
474 state->firmware_ver = 1;
475
472 fe->tuner_priv = state; 476 fe->tuner_priv = state;
473 memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, 477 memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops,
474 sizeof(struct dvb_tuner_ops)); 478 sizeof(struct dvb_tuner_ops));
475 479
476 pr_info("%s: ITE Tech IT913X attached\n", KBUILD_MODNAME); 480 dev_info(&i2c_adap->dev,
481 "%s: ITE Tech IT913X successfully attached\n",
482 KBUILD_MODNAME);
483 dev_dbg(&i2c_adap->dev, "%s: config=%02x chip_ver=%02x\n",
484 __func__, config, state->chip_ver);
477 485
478 return fe; 486 return fe;
479error: 487error:
diff --git a/drivers/media/tuners/it913x.h b/drivers/media/tuners/it913x.h
index 3583e56625f1..12dd36bd9e79 100644
--- a/drivers/media/tuners/it913x.h
+++ b/drivers/media/tuners/it913x.h
@@ -25,27 +25,17 @@
25 25
26#include "dvb_frontend.h" 26#include "dvb_frontend.h"
27 27
28struct ite_config {
29 u8 chip_ver;
30 u16 chip_type;
31 u32 firmware;
32 u8 firmware_ver;
33 u8 adc_x2;
34 u8 tuner_id_0;
35 u8 tuner_id_1;
36 u8 dual_mode;
37 u8 adf;
38 /* option to read SIGNAL_LEVEL */
39 u8 read_slevel;
40};
41
42#if defined(CONFIG_MEDIA_TUNER_IT913X) || \ 28#if defined(CONFIG_MEDIA_TUNER_IT913X) || \
43 (defined(CONFIG_MEDIA_TUNER_IT913X_MODULE) && defined(MODULE)) 29 (defined(CONFIG_MEDIA_TUNER_IT913X_MODULE) && defined(MODULE))
44extern struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, 30extern struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
45 struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config); 31 struct i2c_adapter *i2c_adap,
32 u8 i2c_addr,
33 u8 config);
46#else 34#else
47static inline struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, 35static inline struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
48 struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config) 36 struct i2c_adapter *i2c_adap,
37 u8 i2c_addr,
38 u8 config)
49{ 39{
50 pr_warn("%s: driver disabled by Kconfig\n", __func__); 40 pr_warn("%s: driver disabled by Kconfig\n", __func__);
51 return NULL; 41 return NULL;