aboutsummaryrefslogtreecommitdiffstats
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
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>
-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
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c7
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c8
-rw-r--r--drivers/media/video/au0828/au0828-cards.c2
-rw-r--r--drivers/media/video/au0828/au0828-dvb.c3
-rw-r--r--drivers/media/video/au0828/au0828.h3
-rw-r--r--drivers/media/video/cx18/cx18-gpio.c2
-rw-r--r--drivers/media/video/cx18/cx18-gpio.h2
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c12
-rw-r--r--drivers/media/video/cx23885/cx23885.h2
-rw-r--r--drivers/media/video/cx88/cx88-cards.c24
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c40
-rw-r--r--drivers/media/video/cx88/cx88.h2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c3
-rw-r--r--drivers/media/video/em28xx/em28xx.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-gpio.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-gpio.h2
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c7
-rw-r--r--drivers/media/video/saa7134/saa7134.h2
-rw-r--r--drivers/media/video/tuner-core.c10
-rw-r--r--include/media/tuner.h2
31 files changed, 90 insertions, 124 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 */
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 1a746127cbda..406d7fba369d 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -742,7 +742,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
742 return 0; 742 return 0;
743} 743}
744 744
745static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg) 745static int dvico_bluebird_xc2028_callback(void *ptr, int component,
746 int command, int arg)
746{ 747{
747 struct dvb_usb_adapter *adap = ptr; 748 struct dvb_usb_adapter *adap = ptr;
748 struct dvb_usb_device *d = adap->dev; 749 struct dvb_usb_device *d = adap->dev;
@@ -770,7 +771,6 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
770 struct xc2028_config cfg = { 771 struct xc2028_config cfg = {
771 .i2c_adap = &adap->dev->i2c_adap, 772 .i2c_adap = &adap->dev->i2c_adap,
772 .i2c_addr = 0x61, 773 .i2c_addr = 0x61,
773 .callback = dvico_bluebird_xc2028_callback,
774 }; 774 };
775 static struct xc2028_ctrl ctl = { 775 static struct xc2028_ctrl ctl = {
776 .fname = XC2028_DEFAULT_FIRMWARE, 776 .fname = XC2028_DEFAULT_FIRMWARE,
@@ -778,6 +778,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
778 .demod = XC3028_FE_ZARLINK456, 778 .demod = XC3028_FE_ZARLINK456,
779 }; 779 };
780 780
781 /* FIXME: generalize & move to common area */
782 adap->fe->callback = dvico_bluebird_xc2028_callback;
783
781 fe = dvb_attach(xc2028_attach, adap->fe, &cfg); 784 fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
782 if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) 785 if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
783 return -EIO; 786 return -EIO;
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 565563e68103..8b74e13a6460 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -368,7 +368,8 @@ static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
368 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, 368 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
369}; 369};
370 370
371static int stk7700ph_xc3028_callback(void *ptr, int command, int arg) 371static int stk7700ph_xc3028_callback(void *ptr, int component,
372 int command, int arg)
372{ 373{
373 struct dvb_usb_adapter *adap = ptr; 374 struct dvb_usb_adapter *adap = ptr;
374 375
@@ -396,7 +397,6 @@ static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
396 397
397static struct xc2028_config stk7700ph_xc3028_config = { 398static struct xc2028_config stk7700ph_xc3028_config = {
398 .i2c_addr = 0x61, 399 .i2c_addr = 0x61,
399 .callback = stk7700ph_xc3028_callback,
400 .ctrl = &stk7700ph_xc3028_ctrl, 400 .ctrl = &stk7700ph_xc3028_ctrl,
401}; 401};
402 402
@@ -437,7 +437,9 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
437 DIBX000_I2C_INTERFACE_TUNER, 1); 437 DIBX000_I2C_INTERFACE_TUNER, 1);
438 438
439 stk7700ph_xc3028_config.i2c_adap = tun_i2c; 439 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
440 stk7700ph_xc3028_config.video_dev = adap; 440
441 /* FIXME: generalize & move to common area */
442 adap->fe->callback = stk7700ph_xc3028_callback;
441 443
442 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config) 444 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
443 == NULL ? -ENODEV : 0; 445 == NULL ? -ENODEV : 0;
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index ed48908a9034..5f07a8a072b6 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -46,7 +46,7 @@ struct au0828_board au0828_boards[] = {
46/* Tuner callback function for au0828 boards. Currently only needed 46/* Tuner callback function for au0828 boards. Currently only needed
47 * for HVR1500Q, which has an xc5000 tuner. 47 * for HVR1500Q, which has an xc5000 tuner.
48 */ 48 */
49int au0828_tuner_callback(void *priv, int command, int arg) 49int au0828_tuner_callback(void *priv, int component, int command, int arg)
50{ 50{
51 struct au0828_dev *dev = priv; 51 struct au0828_dev *dev = priv;
52 52
diff --git a/drivers/media/video/au0828/au0828-dvb.c b/drivers/media/video/au0828/au0828-dvb.c
index 96246959dce1..a52abce16e1a 100644
--- a/drivers/media/video/au0828/au0828-dvb.c
+++ b/drivers/media/video/au0828/au0828-dvb.c
@@ -53,7 +53,6 @@ static struct au8522_config hauppauge_woodbury_config = {
53static struct xc5000_config hauppauge_hvr950q_tunerconfig = { 53static struct xc5000_config hauppauge_hvr950q_tunerconfig = {
54 .i2c_address = 0x61, 54 .i2c_address = 0x61,
55 .if_khz = 6000, 55 .if_khz = 6000,
56 .tuner_callback = au0828_tuner_callback
57}; 56};
58 57
59static struct mxl5007t_config mxl5007t_hvr950q_config = { 58static struct mxl5007t_config mxl5007t_hvr950q_config = {
@@ -389,6 +388,8 @@ int au0828_dvb_register(struct au0828_dev *dev)
389 __func__); 388 __func__);
390 return -1; 389 return -1;
391 } 390 }
391 /* define general-purpose callback pointer */
392 dvb->frontend->callback = au0828_tuner_callback;
392 393
393 /* register everything */ 394 /* register everything */
394 ret = dvb_register(dev); 395 ret = dvb_register(dev);
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
index 4f10ff300135..9d6a1161dc98 100644
--- a/drivers/media/video/au0828/au0828.h
+++ b/drivers/media/video/au0828/au0828.h
@@ -103,7 +103,8 @@ extern int au0828_debug;
103extern struct au0828_board au0828_boards[]; 103extern struct au0828_board au0828_boards[];
104extern struct usb_device_id au0828_usb_id_table[]; 104extern struct usb_device_id au0828_usb_id_table[];
105extern void au0828_gpio_setup(struct au0828_dev *dev); 105extern void au0828_gpio_setup(struct au0828_dev *dev);
106extern int au0828_tuner_callback(void *priv, int command, int arg); 106extern int au0828_tuner_callback(void *priv, int component,
107 int command, int arg);
107extern void au0828_card_setup(struct au0828_dev *dev); 108extern void au0828_card_setup(struct au0828_dev *dev);
108 109
109/* ----------------------------------------------------------- */ 110/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c
index 3bdffbf7a96d..0e560421989e 100644
--- a/drivers/media/video/cx18/cx18-gpio.c
+++ b/drivers/media/video/cx18/cx18-gpio.c
@@ -152,7 +152,7 @@ void cx18_gpio_init(struct cx18 *cx)
152} 152}
153 153
154/* Xceive tuner reset function */ 154/* Xceive tuner reset function */
155int cx18_reset_tuner_gpio(void *dev, int cmd, int value) 155int cx18_reset_tuner_gpio(void *dev, int component, int cmd, int value)
156{ 156{
157 struct i2c_algo_bit_data *algo = dev; 157 struct i2c_algo_bit_data *algo = dev;
158 struct cx18_i2c_algo_callback_data *cb_data = algo->data; 158 struct cx18_i2c_algo_callback_data *cb_data = algo->data;
diff --git a/drivers/media/video/cx18/cx18-gpio.h b/drivers/media/video/cx18/cx18-gpio.h
index 22cd7ddf8554..beb7424b9944 100644
--- a/drivers/media/video/cx18/cx18-gpio.h
+++ b/drivers/media/video/cx18/cx18-gpio.h
@@ -23,5 +23,5 @@
23void cx18_gpio_init(struct cx18 *cx); 23void cx18_gpio_init(struct cx18 *cx);
24void cx18_reset_i2c_slaves_gpio(struct cx18 *cx); 24void cx18_reset_i2c_slaves_gpio(struct cx18 *cx);
25void cx18_reset_ir_gpio(void *data); 25void cx18_reset_ir_gpio(void *data);
26int cx18_reset_tuner_gpio(void *dev, int cmd, int value); 26int cx18_reset_tuner_gpio(void *dev, int component, int cmd, int value);
27int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg); 27int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg);
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index ccea8de7c7dc..2cda15f829fd 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -337,7 +337,7 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
337 dev->name, tv.model); 337 dev->name, tv.model);
338} 338}
339 339
340int cx23885_tuner_callback(void *priv, int command, int arg) 340int cx23885_tuner_callback(void *priv, int component, int command, int arg)
341{ 341{
342 struct cx23885_tsport *port = priv; 342 struct cx23885_tsport *port = priv;
343 struct cx23885_dev *dev = port->dev; 343 struct cx23885_dev *dev = port->dev;
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 3b54f1391803..6c5475d7d321 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -189,13 +189,11 @@ static struct s5h1411_config dvico_s5h1411_config = {
189static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { 189static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
190 .i2c_address = 0x61, 190 .i2c_address = 0x61,
191 .if_khz = 5380, 191 .if_khz = 5380,
192 .tuner_callback = cx23885_tuner_callback,
193}; 192};
194 193
195static struct xc5000_config dvico_xc5000_tunerconfig = { 194static struct xc5000_config dvico_xc5000_tunerconfig = {
196 .i2c_address = 0x64, 195 .i2c_address = 0x64,
197 .if_khz = 5380, 196 .if_khz = 5380,
198 .tuner_callback = cx23885_tuner_callback,
199}; 197};
200 198
201static struct tda829x_config tda829x_no_probe = { 199static struct tda829x_config tda829x_no_probe = {
@@ -403,8 +401,6 @@ static int dvb_register(struct cx23885_tsport *port)
403 struct xc2028_config cfg = { 401 struct xc2028_config cfg = {
404 .i2c_adap = &i2c_bus->i2c_adap, 402 .i2c_adap = &i2c_bus->i2c_adap,
405 .i2c_addr = 0x61, 403 .i2c_addr = 0x61,
406 .video_dev = port,
407 .callback = cx23885_tuner_callback,
408 }; 404 };
409 static struct xc2028_ctrl ctl = { 405 static struct xc2028_ctrl ctl = {
410 .fname = XC2028_DEFAULT_FIRMWARE, 406 .fname = XC2028_DEFAULT_FIRMWARE,
@@ -443,8 +439,6 @@ static int dvb_register(struct cx23885_tsport *port)
443 struct xc2028_config cfg = { 439 struct xc2028_config cfg = {
444 .i2c_adap = &dev->i2c_bus[1].i2c_adap, 440 .i2c_adap = &dev->i2c_bus[1].i2c_adap,
445 .i2c_addr = 0x64, 441 .i2c_addr = 0x64,
446 .video_dev = port,
447 .callback = cx23885_tuner_callback,
448 }; 442 };
449 static struct xc2028_ctrl ctl = { 443 static struct xc2028_ctrl ctl = {
450 .fname = XC3028L_DEFAULT_FIRMWARE, 444 .fname = XC3028L_DEFAULT_FIRMWARE,
@@ -485,8 +479,6 @@ static int dvb_register(struct cx23885_tsport *port)
485 struct xc2028_config cfg = { 479 struct xc2028_config cfg = {
486 .i2c_adap = &i2c_bus->i2c_adap, 480 .i2c_adap = &i2c_bus->i2c_adap,
487 .i2c_addr = 0x61, 481 .i2c_addr = 0x61,
488 .video_dev = port,
489 .callback = cx23885_tuner_callback,
490 }; 482 };
491 static struct xc2028_ctrl ctl = { 483 static struct xc2028_ctrl ctl = {
492 .fname = XC2028_DEFAULT_FIRMWARE, 484 .fname = XC2028_DEFAULT_FIRMWARE,
@@ -512,8 +504,6 @@ static int dvb_register(struct cx23885_tsport *port)
512 struct xc2028_config cfg = { 504 struct xc2028_config cfg = {
513 .i2c_adap = &dev->i2c_bus[1].i2c_adap, 505 .i2c_adap = &dev->i2c_bus[1].i2c_adap,
514 .i2c_addr = 0x61, 506 .i2c_addr = 0x61,
515 .video_dev = port,
516 .callback = cx23885_tuner_callback,
517 }; 507 };
518 static struct xc2028_ctrl ctl = { 508 static struct xc2028_ctrl ctl = {
519 .fname = XC2028_DEFAULT_FIRMWARE, 509 .fname = XC2028_DEFAULT_FIRMWARE,
@@ -536,6 +526,8 @@ static int dvb_register(struct cx23885_tsport *port)
536 printk("%s: frontend initialization failed\n", dev->name); 526 printk("%s: frontend initialization failed\n", dev->name);
537 return -1; 527 return -1;
538 } 528 }
529 /* define general-purpose callback pointer */
530 port->dvb.frontend->callback = cx23885_tuner_callback;
539 531
540 /* Put the analog decoder in standby to keep it quiet */ 532 /* Put the analog decoder in standby to keep it quiet */
541 cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL); 533 cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL);
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index 4e0fcb3f7fcb..ba4e0aaed463 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -411,7 +411,7 @@ extern const unsigned int cx23885_bcount;
411extern struct cx23885_subid cx23885_subids[]; 411extern struct cx23885_subid cx23885_subids[];
412extern const unsigned int cx23885_idcount; 412extern const unsigned int cx23885_idcount;
413 413
414extern int cx23885_tuner_callback(void *priv, int command, int arg); 414extern int cx23885_tuner_callback(void *priv, int component, int command, int arg);
415extern void cx23885_card_list(struct cx23885_dev *dev); 415extern void cx23885_card_list(struct cx23885_dev *dev);
416extern int cx23885_ir_init(struct cx23885_dev *dev); 416extern int cx23885_ir_init(struct cx23885_dev *dev);
417extern void cx23885_gpio_setup(struct cx23885_dev *dev); 417extern void cx23885_gpio_setup(struct cx23885_dev *dev);
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 16bb9c35fc76..b5a25094c9e5 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -2308,9 +2308,21 @@ static int cx88_dvico_xc2028_callback(struct cx88_core *core,
2308{ 2308{
2309 switch (command) { 2309 switch (command) {
2310 case XC2028_TUNER_RESET: 2310 case XC2028_TUNER_RESET:
2311 cx_write(MO_GP0_IO, 0x101000); 2311 switch (core->boardnr) {
2312 mdelay(5); 2312 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2313 cx_set(MO_GP0_IO, 0x101010); 2313 /* GPIO-4 xc3028 tuner */
2314
2315 cx_set(MO_GP0_IO, 0x00001000);
2316 cx_clear(MO_GP0_IO, 0x00000010);
2317 msleep(100);
2318 cx_set(MO_GP0_IO, 0x00000010);
2319 msleep(100);
2320 break;
2321 default:
2322 cx_write(MO_GP0_IO, 0x101000);
2323 mdelay(5);
2324 cx_set(MO_GP0_IO, 0x101010);
2325 }
2314 break; 2326 break;
2315 default: 2327 default:
2316 return -EINVAL; 2328 return -EINVAL;
@@ -2419,6 +2431,7 @@ static int cx88_xc2028_tuner_callback(struct cx88_core *core,
2419 case CX88_BOARD_PROLINK_PV_8000GT: 2431 case CX88_BOARD_PROLINK_PV_8000GT:
2420 return cx88_pv_8000gt_callback(core, command, arg); 2432 return cx88_pv_8000gt_callback(core, command, arg);
2421 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: 2433 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2434 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2422 return cx88_dvico_xc2028_callback(core, command, arg); 2435 return cx88_dvico_xc2028_callback(core, command, arg);
2423 } 2436 }
2424 2437
@@ -2486,7 +2499,7 @@ static int cx88_xc5000_tuner_callback(struct cx88_core *core,
2486 return 0; /* Should never be here */ 2499 return 0; /* Should never be here */
2487} 2500}
2488 2501
2489int cx88_tuner_callback(void *priv, int command, int arg) 2502int cx88_tuner_callback(void *priv, int component, int command, int arg)
2490{ 2503{
2491 struct i2c_algo_bit_data *i2c_algo = priv; 2504 struct i2c_algo_bit_data *i2c_algo = priv;
2492 struct cx88_core *core; 2505 struct cx88_core *core;
@@ -2503,6 +2516,9 @@ int cx88_tuner_callback(void *priv, int command, int arg)
2503 return -EINVAL; 2516 return -EINVAL;
2504 } 2517 }
2505 2518
2519 if (component != DVB_FRONTEND_COMPONENT_TUNER)
2520 return -EINVAL;
2521
2506 switch (core->board.tuner_type) { 2522 switch (core->board.tuner_type) {
2507 case TUNER_XC2028: 2523 case TUNER_XC2028:
2508 info_printk(core, "Calling XC2028/3028 callback\n"); 2524 info_printk(core, "Calling XC2028/3028 callback\n");
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index cd368b512d1f..6751f36e061e 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -405,40 +405,6 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe,
405 return 0; 405 return 0;
406} 406}
407 407
408static int cx88_pci_nano_callback(void *ptr, int command, int arg)
409{
410 struct cx88_core *core = ptr;
411
412 switch (command) {
413 case XC2028_TUNER_RESET:
414 /* Send the tuner in then out of reset */
415 dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg);
416
417 switch (core->boardnr) {
418 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
419 /* GPIO-4 xc3028 tuner */
420
421 cx_set(MO_GP0_IO, 0x00001000);
422 cx_clear(MO_GP0_IO, 0x00000010);
423 msleep(100);
424 cx_set(MO_GP0_IO, 0x00000010);
425 msleep(100);
426 break;
427 }
428
429 break;
430 case XC2028_RESET_CLK:
431 dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg);
432 break;
433 default:
434 dprintk(1, "%s: unknown command %d, arg %d\n", __func__,
435 command, arg);
436 return -EINVAL;
437 }
438
439 return 0;
440}
441
442static struct cx24123_config geniatech_dvbs_config = { 408static struct cx24123_config geniatech_dvbs_config = {
443 .demod_address = 0x55, 409 .demod_address = 0x55,
444 .set_ts_params = cx24123_set_ts_param, 410 .set_ts_params = cx24123_set_ts_param,
@@ -486,7 +452,6 @@ static struct s5h1409_config kworld_atsc_120_config = {
486static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { 452static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
487 .i2c_address = 0x64, 453 .i2c_address = 0x64,
488 .if_khz = 5380, 454 .if_khz = 5380,
489 .tuner_callback = cx88_tuner_callback,
490}; 455};
491 456
492static struct zl10353_config cx88_geniatech_x8000_mt = { 457static struct zl10353_config cx88_geniatech_x8000_mt = {
@@ -507,7 +472,6 @@ static struct s5h1411_config dvico_fusionhdtv7_config = {
507static struct xc5000_config dvico_fusionhdtv7_tuner_config = { 472static struct xc5000_config dvico_fusionhdtv7_tuner_config = {
508 .i2c_address = 0xc2 >> 1, 473 .i2c_address = 0xc2 >> 1,
509 .if_khz = 5380, 474 .if_khz = 5380,
510 .tuner_callback = cx88_tuner_callback,
511}; 475};
512 476
513static int attach_xc3028(u8 addr, struct cx8802_dev *dev) 477static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
@@ -518,7 +482,6 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
518 .i2c_adap = &dev->core->i2c_adap, 482 .i2c_adap = &dev->core->i2c_adap,
519 .i2c_addr = addr, 483 .i2c_addr = addr,
520 .ctrl = &ctl, 484 .ctrl = &ctl,
521 .callback = cx88_tuner_callback,
522 }; 485 };
523 486
524 if (!dev->dvb.frontend) { 487 if (!dev->dvb.frontend) {
@@ -912,7 +875,6 @@ static int dvb_register(struct cx8802_dev *dev)
912 struct xc2028_config cfg = { 875 struct xc2028_config cfg = {
913 .i2c_adap = &core->i2c_adap, 876 .i2c_adap = &core->i2c_adap,
914 .i2c_addr = 0x61, 877 .i2c_addr = 0x61,
915 .callback = cx88_pci_nano_callback,
916 }; 878 };
917 static struct xc2028_ctrl ctl = { 879 static struct xc2028_ctrl ctl = {
918 .fname = XC2028_DEFAULT_FIRMWARE, 880 .fname = XC2028_DEFAULT_FIRMWARE,
@@ -1035,6 +997,8 @@ static int dvb_register(struct cx8802_dev *dev)
1035 core->name); 997 core->name);
1036 return -EINVAL; 998 return -EINVAL;
1037 } 999 }
1000 /* define general-purpose callback pointer */
1001 dev->dvb.frontend->callback = cx88_tuner_callback;
1038 1002
1039 /* Ensure all frontends negotiate bus access */ 1003 /* Ensure all frontends negotiate bus access */
1040 dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; 1004 dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index e17bd513b584..30b750ee8564 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -607,7 +607,7 @@ extern void cx88_call_i2c_clients(struct cx88_core *core,
607/* ----------------------------------------------------------- */ 607/* ----------------------------------------------------------- */
608/* cx88-cards.c */ 608/* cx88-cards.c */
609 609
610extern int cx88_tuner_callback(void *dev, int command, int arg); 610extern int cx88_tuner_callback(void *dev, int component, int command, int arg);
611extern int cx88_get_resources(const struct cx88_core *core, 611extern int cx88_get_resources(const struct cx88_core *core,
612 struct pci_dev *pci); 612 struct pci_dev *pci);
613extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr); 613extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 01804fac6aa6..d65d0572403b 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1271,7 +1271,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
1271 {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT}, 1271 {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT},
1272}; 1272};
1273 1273
1274int em28xx_tuner_callback(void *ptr, int command, int arg) 1274int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
1275{ 1275{
1276 int rc = 0; 1276 int rc = 0;
1277 struct em28xx *dev = ptr; 1277 struct em28xx *dev = ptr;
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index ea4f2a97bd2d..855ad3940b29 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -249,7 +249,6 @@ static int attach_xc3028(u8 addr, struct em28xx *dev)
249 memset(&cfg, 0, sizeof(cfg)); 249 memset(&cfg, 0, sizeof(cfg));
250 cfg.i2c_adap = &dev->i2c_adap; 250 cfg.i2c_adap = &dev->i2c_adap;
251 cfg.i2c_addr = addr; 251 cfg.i2c_addr = addr;
252 cfg.callback = em28xx_tuner_callback;
253 252
254 if (!dev->dvb->frontend) { 253 if (!dev->dvb->frontend) {
255 printk(KERN_ERR "%s/2: dvb frontend not attached. " 254 printk(KERN_ERR "%s/2: dvb frontend not attached. "
@@ -474,6 +473,8 @@ static int dvb_init(struct em28xx *dev)
474 result = -EINVAL; 473 result = -EINVAL;
475 goto out_free; 474 goto out_free;
476 } 475 }
476 /* define general-purpose callback pointer */
477 dvb->frontend->callback = em28xx_tuner_callback;
477 478
478 /* register everything */ 479 /* register everything */
479 result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev); 480 result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index d992280613b2..82781178e0a3 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -528,7 +528,7 @@ extern struct em28xx_board em28xx_boards[];
528extern struct usb_device_id em28xx_id_table[]; 528extern struct usb_device_id em28xx_id_table[];
529extern const unsigned int em28xx_bcount; 529extern const unsigned int em28xx_bcount;
530void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); 530void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
531int em28xx_tuner_callback(void *ptr, int command, int arg); 531int em28xx_tuner_callback(void *ptr, int component, int command, int arg);
532 532
533/* Provided by em28xx-input.c */ 533/* Provided by em28xx-input.c */
534/* TODO: Check if the standard get_key handlers on ir-common can be used */ 534/* TODO: Check if the standard get_key handlers on ir-common can be used */
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c
index bc22905ea20f..74a44844ccaf 100644
--- a/drivers/media/video/ivtv/ivtv-gpio.c
+++ b/drivers/media/video/ivtv/ivtv-gpio.c
@@ -124,7 +124,7 @@ void ivtv_reset_ir_gpio(struct ivtv *itv)
124} 124}
125 125
126/* Xceive tuner reset function */ 126/* Xceive tuner reset function */
127int ivtv_reset_tuner_gpio(void *dev, int cmd, int value) 127int ivtv_reset_tuner_gpio(void *dev, int component, int cmd, int value)
128{ 128{
129 struct i2c_algo_bit_data *algo = dev; 129 struct i2c_algo_bit_data *algo = dev;
130 struct ivtv *itv = algo->data; 130 struct ivtv *itv = algo->data;
diff --git a/drivers/media/video/ivtv/ivtv-gpio.h b/drivers/media/video/ivtv/ivtv-gpio.h
index 964a265d91a9..48b6291613a2 100644
--- a/drivers/media/video/ivtv/ivtv-gpio.h
+++ b/drivers/media/video/ivtv/ivtv-gpio.h
@@ -24,7 +24,7 @@
24/* GPIO stuff */ 24/* GPIO stuff */
25void ivtv_gpio_init(struct ivtv *itv); 25void ivtv_gpio_init(struct ivtv *itv);
26void ivtv_reset_ir_gpio(struct ivtv *itv); 26void ivtv_reset_ir_gpio(struct ivtv *itv);
27int ivtv_reset_tuner_gpio(void *dev, int cmd, int value); 27int ivtv_reset_tuner_gpio(void *dev, int component, int cmd, int value);
28int ivtv_gpio(struct ivtv *itv, unsigned int command, void *arg); 28int ivtv_gpio(struct ivtv *itv, unsigned int command, void *arg);
29 29
30#endif 30#endif
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 3c2f09fb0446..622d3ba5a1ec 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5576,7 +5576,7 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev,
5576 return 0; 5576 return 0;
5577} 5577}
5578 5578
5579int saa7134_tuner_callback(void *priv, int command, int arg) 5579int saa7134_tuner_callback(void *priv, int component, int command, int arg)
5580{ 5580{
5581 struct saa7134_dev *dev = priv; 5581 struct saa7134_dev *dev = priv;
5582 if (dev != NULL) { 5582 if (dev != NULL) {
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 7fa6ce76642b..0dd6b988820f 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -553,7 +553,6 @@ static int configure_tda827x_fe(struct saa7134_dev *dev,
553/* ------------------------------------------------------------------ */ 553/* ------------------------------------------------------------------ */
554 554
555static struct tda827x_config tda827x_cfg_0 = { 555static struct tda827x_config tda827x_cfg_0 = {
556 .tuner_callback = saa7134_tuner_callback,
557 .init = philips_tda827x_tuner_init, 556 .init = philips_tda827x_tuner_init,
558 .sleep = philips_tda827x_tuner_sleep, 557 .sleep = philips_tda827x_tuner_sleep,
559 .config = 0, 558 .config = 0,
@@ -561,7 +560,6 @@ static struct tda827x_config tda827x_cfg_0 = {
561}; 560};
562 561
563static struct tda827x_config tda827x_cfg_1 = { 562static struct tda827x_config tda827x_cfg_1 = {
564 .tuner_callback = saa7134_tuner_callback,
565 .init = philips_tda827x_tuner_init, 563 .init = philips_tda827x_tuner_init,
566 .sleep = philips_tda827x_tuner_sleep, 564 .sleep = philips_tda827x_tuner_sleep,
567 .config = 1, 565 .config = 1,
@@ -569,7 +567,6 @@ static struct tda827x_config tda827x_cfg_1 = {
569}; 567};
570 568
571static struct tda827x_config tda827x_cfg_2 = { 569static struct tda827x_config tda827x_cfg_2 = {
572 .tuner_callback = saa7134_tuner_callback,
573 .init = philips_tda827x_tuner_init, 570 .init = philips_tda827x_tuner_init,
574 .sleep = philips_tda827x_tuner_sleep, 571 .sleep = philips_tda827x_tuner_sleep,
575 .config = 2, 572 .config = 2,
@@ -577,7 +574,6 @@ static struct tda827x_config tda827x_cfg_2 = {
577}; 574};
578 575
579static struct tda827x_config tda827x_cfg_2_sw42 = { 576static struct tda827x_config tda827x_cfg_2_sw42 = {
580 .tuner_callback = saa7134_tuner_callback,
581 .init = philips_tda827x_tuner_init, 577 .init = philips_tda827x_tuner_init,
582 .sleep = philips_tda827x_tuner_sleep, 578 .sleep = philips_tda827x_tuner_sleep,
583 .config = 2, 579 .config = 2,
@@ -836,7 +832,6 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
836} 832}
837 833
838static struct tda827x_config ads_duo_cfg = { 834static struct tda827x_config ads_duo_cfg = {
839 .tuner_callback = saa7134_tuner_callback,
840 .init = ads_duo_tuner_init, 835 .init = ads_duo_tuner_init,
841 .sleep = ads_duo_tuner_sleep, 836 .sleep = ads_duo_tuner_sleep,
842 .config = 0 837 .config = 0
@@ -1366,6 +1361,8 @@ static int dvb_init(struct saa7134_dev *dev)
1366 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); 1361 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
1367 return -1; 1362 return -1;
1368 } 1363 }
1364 /* define general-purpose callback pointer */
1365 dev->dvb.frontend->callback = saa7134_tuner_callback;
1369 1366
1370 /* register everything else */ 1367 /* register everything else */
1371 ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev, 1368 ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev,
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index cbfdac27b69e..4005335c4f55 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -653,7 +653,7 @@ extern struct pci_device_id __devinitdata saa7134_pci_tbl[];
653 653
654extern int saa7134_board_init1(struct saa7134_dev *dev); 654extern int saa7134_board_init1(struct saa7134_dev *dev);
655extern int saa7134_board_init2(struct saa7134_dev *dev); 655extern int saa7134_board_init2(struct saa7134_dev *dev);
656int saa7134_tuner_callback(void *priv, int command, int arg); 656int saa7134_tuner_callback(void *priv, int component, int command, int arg);
657 657
658 658
659/* ----------------------------------------------------------- */ 659/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 39c7b9b835a3..4a7735c6c1a6 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -92,7 +92,6 @@ struct tuner {
92 92
93 unsigned int type; /* chip type id */ 93 unsigned int type; /* chip type id */
94 unsigned int config; 94 unsigned int config;
95 int (*tuner_callback) (void *dev, int command, int arg);
96 const char *name; 95 const char *name;
97}; 96};
98 97
@@ -346,7 +345,7 @@ static struct xc5000_config xc5000_cfg;
346 345
347static void set_type(struct i2c_client *c, unsigned int type, 346static void set_type(struct i2c_client *c, unsigned int type,
348 unsigned int new_mode_mask, unsigned int new_config, 347 unsigned int new_mode_mask, unsigned int new_config,
349 int (*tuner_callback) (void *dev, int command,int arg)) 348 int (*tuner_callback) (void *dev, int component, int cmd, int arg))
350{ 349{
351 struct tuner *t = i2c_get_clientdata(c); 350 struct tuner *t = i2c_get_clientdata(c);
352 struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops; 351 struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
@@ -362,7 +361,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
362 t->config = new_config; 361 t->config = new_config;
363 if (tuner_callback != NULL) { 362 if (tuner_callback != NULL) {
364 tuner_dbg("defining GPIO callback\n"); 363 tuner_dbg("defining GPIO callback\n");
365 t->tuner_callback = tuner_callback; 364 t->fe.callback = tuner_callback;
366 } 365 }
367 366
368 if (t->mode == T_UNINITIALIZED) { 367 if (t->mode == T_UNINITIALIZED) {
@@ -385,7 +384,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
385 { 384 {
386 struct tda829x_config cfg = { 385 struct tda829x_config cfg = {
387 .lna_cfg = t->config, 386 .lna_cfg = t->config,
388 .tuner_callback = t->tuner_callback,
389 }; 387 };
390 if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter, 388 if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter,
391 t->i2c->addr, &cfg)) 389 t->i2c->addr, &cfg))
@@ -433,7 +431,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
433 struct xc2028_config cfg = { 431 struct xc2028_config cfg = {
434 .i2c_adap = t->i2c->adapter, 432 .i2c_adap = t->i2c->adapter,
435 .i2c_addr = t->i2c->addr, 433 .i2c_addr = t->i2c->addr,
436 .callback = t->tuner_callback,
437 }; 434 };
438 if (!dvb_attach(xc2028_attach, &t->fe, &cfg)) 435 if (!dvb_attach(xc2028_attach, &t->fe, &cfg))
439 goto attach_failed; 436 goto attach_failed;
@@ -450,7 +447,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
450 447
451 xc5000_cfg.i2c_address = t->i2c->addr; 448 xc5000_cfg.i2c_address = t->i2c->addr;
452 xc5000_cfg.if_khz = 5380; 449 xc5000_cfg.if_khz = 5380;
453 xc5000_cfg.tuner_callback = t->tuner_callback;
454 if (!dvb_attach(xc5000_attach, 450 if (!dvb_attach(xc5000_attach,
455 &t->fe, t->i2c->adapter, &xc5000_cfg)) 451 &t->fe, t->i2c->adapter, &xc5000_cfg))
456 goto attach_failed; 452 goto attach_failed;
@@ -1224,7 +1220,7 @@ register_client:
1224 } else { 1220 } else {
1225 t->mode = V4L2_TUNER_DIGITAL_TV; 1221 t->mode = V4L2_TUNER_DIGITAL_TV;
1226 } 1222 }
1227 set_type(client, t->type, t->mode_mask, t->config, t->tuner_callback); 1223 set_type(client, t->type, t->mode_mask, t->config, t->fe.callback);
1228 list_add_tail(&t->list, &tuner_list); 1224 list_add_tail(&t->list, &tuner_list);
1229 return 0; 1225 return 0;
1230} 1226}
diff --git a/include/media/tuner.h b/include/media/tuner.h
index ba818985cc84..67c1f514d0e2 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -179,7 +179,7 @@ struct tuner_setup {
179 unsigned int type; /* Tuner type */ 179 unsigned int type; /* Tuner type */
180 unsigned int mode_mask; /* Allowed tuner modes */ 180 unsigned int mode_mask; /* Allowed tuner modes */
181 unsigned int config; /* configuraion for more complex tuners */ 181 unsigned int config; /* configuraion for more complex tuners */
182 int (*tuner_callback) (void *dev, int command,int arg); 182 int (*tuner_callback) (void *dev, int component, int cmd, int arg);
183}; 183};
184 184
185#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */