diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-09-12 12:31:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:09 -0400 |
commit | d7cba043d7ec840d67bd5143779d1febe7d83407 (patch) | |
tree | 4fb46684538e0ad7d3229f592182ed6121049d69 /drivers/media/video/cx88 | |
parent | ebb8d68a5c8c236acd8e8cf8f0d6046e027a8e21 (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/video/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-cards.c | 24 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 40 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88.h | 2 |
3 files changed, 23 insertions, 43 deletions
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 | ||
2489 | int cx88_tuner_callback(void *priv, int command, int arg) | 2502 | int 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 | ||
408 | static 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 | |||
442 | static struct cx24123_config geniatech_dvbs_config = { | 408 | static 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 = { | |||
486 | static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { | 452 | static 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 | ||
492 | static struct zl10353_config cx88_geniatech_x8000_mt = { | 457 | static struct zl10353_config cx88_geniatech_x8000_mt = { |
@@ -507,7 +472,6 @@ static struct s5h1411_config dvico_fusionhdtv7_config = { | |||
507 | static struct xc5000_config dvico_fusionhdtv7_tuner_config = { | 472 | static 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 | ||
513 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | 477 | static 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 | ||
610 | extern int cx88_tuner_callback(void *dev, int command, int arg); | 610 | extern int cx88_tuner_callback(void *dev, int component, int command, int arg); |
611 | extern int cx88_get_resources(const struct cx88_core *core, | 611 | extern int cx88_get_resources(const struct cx88_core *core, |
612 | struct pci_dev *pci); | 612 | struct pci_dev *pci); |
613 | extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr); | 613 | extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr); |