aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-09-12 12:31:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:37:09 -0400
commitd7cba043d7ec840d67bd5143779d1febe7d83407 (patch)
tree4fb46684538e0ad7d3229f592182ed6121049d69 /drivers/media/common
parentebb8d68a5c8c236acd8e8cf8f0d6046e027a8e21 (diff)
V4L/DVB (9049): convert tuner drivers to use dvb_frontend->callback
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/tuners/tda827x.c12
-rw-r--r--drivers/media/common/tuners/tda827x.h1
-rw-r--r--drivers/media/common/tuners/tda8290.c4
-rw-r--r--drivers/media/common/tuners/tda8290.h1
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c41
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.h2
-rw-r--r--drivers/media/common/tuners/xc5000.c8
-rw-r--r--drivers/media/common/tuners/xc5000.h2
8 files changed, 32 insertions, 39 deletions
diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c
index 8555d9cf9051..4a74f65e759a 100644
--- a/drivers/media/common/tuners/tda827x.c
+++ b/drivers/media/common/tuners/tda827x.c
@@ -447,17 +447,19 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
447 else 447 else
448 arg = 0; 448 arg = 0;
449 } 449 }
450 if (priv->cfg->tuner_callback) 450 if (fe->callback)
451 priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 451 fe->callback(priv->i2c_adap->algo_data,
452 gp_func, arg); 452 DVB_FRONTEND_COMPONENT_TUNER,
453 gp_func, arg);
453 buf[1] = high ? 0 : 1; 454 buf[1] = high ? 0 : 1;
454 if (priv->cfg->config == 2) 455 if (priv->cfg->config == 2)
455 buf[1] = high ? 1 : 0; 456 buf[1] = high ? 1 : 0;
456 i2c_transfer(priv->i2c_adap, &msg, 1); 457 i2c_transfer(priv->i2c_adap, &msg, 1);
457 break; 458 break;
458 case 3: /* switch with GPIO of saa713x */ 459 case 3: /* switch with GPIO of saa713x */
459 if (priv->cfg->tuner_callback) 460 if (fe->callback)
460 priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high); 461 fe->callback(priv->i2c_adap->algo_data,
462 DVB_FRONTEND_COMPONENT_TUNER, 0, high);
461 break; 463 break;
462 } 464 }
463} 465}
diff --git a/drivers/media/common/tuners/tda827x.h b/drivers/media/common/tuners/tda827x.h
index 7850a9a1dc8f..7d72ce0a0c2d 100644
--- a/drivers/media/common/tuners/tda827x.h
+++ b/drivers/media/common/tuners/tda827x.h
@@ -36,7 +36,6 @@ struct tda827x_config
36 /* interface to tda829x driver */ 36 /* interface to tda829x driver */
37 unsigned int config; 37 unsigned int config;
38 int switch_addr; 38 int switch_addr;
39 int (*tuner_callback) (void *dev, int command, int arg);
40 39
41 void (*agcf)(struct dvb_frontend *fe); 40 void (*agcf)(struct dvb_frontend *fe);
42}; 41};
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c
index 91204d3f282d..c112bdd4e0f0 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -672,10 +672,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
672 priv->i2c_props.addr = i2c_addr; 672 priv->i2c_props.addr = i2c_addr;
673 priv->i2c_props.adap = i2c_adap; 673 priv->i2c_props.adap = i2c_adap;
674 priv->i2c_props.name = "tda829x"; 674 priv->i2c_props.name = "tda829x";
675 if (cfg) { 675 if (cfg)
676 priv->cfg.config = cfg->lna_cfg; 676 priv->cfg.config = cfg->lna_cfg;
677 priv->cfg.tuner_callback = cfg->tuner_callback;
678 }
679 677
680 if (tda8290_probe(&priv->i2c_props) == 0) { 678 if (tda8290_probe(&priv->i2c_props) == 0) {
681 priv->ver = TDA8290; 679 priv->ver = TDA8290;
diff --git a/drivers/media/common/tuners/tda8290.h b/drivers/media/common/tuners/tda8290.h
index aa074f3f0c07..7e288b26fcc3 100644
--- a/drivers/media/common/tuners/tda8290.h
+++ b/drivers/media/common/tuners/tda8290.h
@@ -22,7 +22,6 @@
22 22
23struct tda829x_config { 23struct tda829x_config {
24 unsigned int lna_cfg; 24 unsigned int lna_cfg;
25 int (*tuner_callback) (void *dev, int command, int arg);
26 25
27 unsigned int probe_tuner:1; 26 unsigned int probe_tuner:1;
28#define TDA829X_PROBE_TUNER 0 27#define TDA829X_PROBE_TUNER 0
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index 4dd1d2421cc5..fc82d154c8c2 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -71,9 +71,6 @@ struct firmware_properties {
71struct xc2028_data { 71struct xc2028_data {
72 struct list_head hybrid_tuner_instance_list; 72 struct list_head hybrid_tuner_instance_list;
73 struct tuner_i2c_props i2c_props; 73 struct tuner_i2c_props i2c_props;
74 int (*tuner_callback) (void *dev,
75 int command, int arg);
76 void *video_dev;
77 __u32 frequency; 74 __u32 frequency;
78 75
79 struct firmware_description *firm; 76 struct firmware_description *firm;
@@ -492,6 +489,23 @@ ret:
492 return i; 489 return i;
493} 490}
494 491
492static inline int do_tuner_callback(struct dvb_frontend *fe, int cmd, int arg)
493{
494 struct xc2028_data *priv = fe->tuner_priv;
495
496 /* analog side (tuner-core) uses i2c_adap->algo_data.
497 * digital side is not guaranteed to have algo_data defined.
498 *
499 * digital side will always have fe->dvb defined.
500 * analog side (tuner-core) doesn't (yet) define fe->dvb.
501 */
502
503 return (!fe->callback) ? -EINVAL :
504 fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
505 fe->dvb->priv : priv->i2c_props.adap->algo_data,
506 DVB_FRONTEND_COMPONENT_TUNER, cmd, arg);
507}
508
495static int load_firmware(struct dvb_frontend *fe, unsigned int type, 509static int load_firmware(struct dvb_frontend *fe, unsigned int type,
496 v4l2_std_id *id) 510 v4l2_std_id *id)
497{ 511{
@@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
530 544
531 if (!size) { 545 if (!size) {
532 /* Special callback command received */ 546 /* Special callback command received */
533 rc = priv->tuner_callback(priv->video_dev, 547 rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
534 XC2028_TUNER_RESET, 0);
535 if (rc < 0) { 548 if (rc < 0) {
536 tuner_err("Error at RESET code %d\n", 549 tuner_err("Error at RESET code %d\n",
537 (*p) & 0x7f); 550 (*p) & 0x7f);
@@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
542 if (size >= 0xff00) { 555 if (size >= 0xff00) {
543 switch (size) { 556 switch (size) {
544 case 0xff00: 557 case 0xff00:
545 rc = priv->tuner_callback(priv->video_dev, 558 rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0);
546 XC2028_RESET_CLK, 0);
547 if (rc < 0) { 559 if (rc < 0) {
548 tuner_err("Error at RESET code %d\n", 560 tuner_err("Error at RESET code %d\n",
549 (*p) & 0x7f); 561 (*p) & 0x7f);
@@ -715,8 +727,7 @@ retry:
715 memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); 727 memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
716 728
717 /* Reset is needed before loading firmware */ 729 /* Reset is needed before loading firmware */
718 rc = priv->tuner_callback(priv->video_dev, 730 rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
719 XC2028_TUNER_RESET, 0);
720 if (rc < 0) 731 if (rc < 0)
721 goto fail; 732 goto fail;
722 733
@@ -933,7 +944,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
933 The reset CLK is needed only with tm6000. 944 The reset CLK is needed only with tm6000.
934 Driver should work fine even if this fails. 945 Driver should work fine even if this fails.
935 */ 946 */
936 priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1); 947 do_tuner_callback(fe, XC2028_RESET_CLK, 1);
937 948
938 msleep(10); 949 msleep(10);
939 950
@@ -1177,20 +1188,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1177 break; 1188 break;
1178 case 1: 1189 case 1:
1179 /* new tuner instance */ 1190 /* new tuner instance */
1180 priv->tuner_callback = cfg->callback;
1181 priv->ctrl.max_len = 13; 1191 priv->ctrl.max_len = 13;
1182 1192
1183 mutex_init(&priv->lock); 1193 mutex_init(&priv->lock);
1184 1194
1185 /* analog side (tuner-core) uses i2c_adap->algo_data.
1186 * digital side is not guaranteed to have algo_data defined.
1187 *
1188 * digital side will always have fe->dvb defined.
1189 * analog side (tuner-core) doesn't (yet) define fe->dvb.
1190 */
1191 priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ?
1192 fe->dvb->priv : cfg->i2c_adap->algo_data;
1193
1194 fe->tuner_priv = priv; 1195 fe->tuner_priv = priv;
1195 break; 1196 break;
1196 case 2: 1197 case 2:
diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h
index 2c5b6282b569..1af69f49f8e1 100644
--- a/drivers/media/common/tuners/tuner-xc2028.h
+++ b/drivers/media/common/tuners/tuner-xc2028.h
@@ -39,9 +39,7 @@ struct xc2028_ctrl {
39struct xc2028_config { 39struct xc2028_config {
40 struct i2c_adapter *i2c_adap; 40 struct i2c_adapter *i2c_adap;
41 u8 i2c_addr; 41 u8 i2c_addr;
42 void *video_dev;
43 struct xc2028_ctrl *ctrl; 42 struct xc2028_ctrl *ctrl;
44 int (*callback) (void *dev, int command, int arg);
45}; 43};
46 44
47/* xc2028 commands for callback */ 45/* xc2028 commands for callback */
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index ccc4dae4126a..f9c2bb917f54 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -58,8 +58,6 @@ struct xc5000_priv {
58 u32 bandwidth; 58 u32 bandwidth;
59 u8 video_standard; 59 u8 video_standard;
60 u8 rf_mode; 60 u8 rf_mode;
61
62 int (*tuner_callback) (void *priv, int command, int arg);
63}; 61};
64 62
65/* Misc Defines */ 63/* Misc Defines */
@@ -232,10 +230,11 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)
232 230
233 dprintk(1, "%s()\n", __func__); 231 dprintk(1, "%s()\n", __func__);
234 232
235 if (priv->tuner_callback) { 233 if (fe->callback) {
236 ret = priv->tuner_callback(((fe->dvb) && (fe->dvb->priv)) ? 234 ret = fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
237 fe->dvb->priv : 235 fe->dvb->priv :
238 priv->i2c_props.adap->algo_data, 236 priv->i2c_props.adap->algo_data,
237 DVB_FRONTEND_COMPONENT_TUNER,
239 XC5000_TUNER_RESET, 0); 238 XC5000_TUNER_RESET, 0);
240 if (ret) 239 if (ret)
241 printk(KERN_ERR "xc5000: reset failed\n"); 240 printk(KERN_ERR "xc5000: reset failed\n");
@@ -975,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
975 /* new tuner instance */ 974 /* new tuner instance */
976 priv->bandwidth = BANDWIDTH_6_MHZ; 975 priv->bandwidth = BANDWIDTH_6_MHZ;
977 priv->if_khz = cfg->if_khz; 976 priv->if_khz = cfg->if_khz;
978 priv->tuner_callback = cfg->tuner_callback;
979 977
980 fe->tuner_priv = priv; 978 fe->tuner_priv = priv;
981 break; 979 break;
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index fa0321cfd179..cf1a558e0e7f 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -30,8 +30,6 @@ struct i2c_adapter;
30struct xc5000_config { 30struct xc5000_config {
31 u8 i2c_address; 31 u8 i2c_address;
32 u32 if_khz; 32 u32 if_khz;
33
34 int (*tuner_callback) (void *priv, int command, int arg);
35}; 33};
36 34
37/* xc5000 callback command */ 35/* xc5000 callback command */