aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-03-26 15:35:29 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-05-09 09:13:00 -0400
commit5afb707120ec269725c71a2282ee3473c5bc04c1 (patch)
tree63e8351141777ab982a8aa4944e849d5d6728c9f /drivers/media
parentd3911eaa0d7d0e6963f194e748cf21d7502584bf (diff)
V4L/DVB (5609): M920x: group like functions together
- Group the tuner configurations together. - Group the demod configurations together. - Group the device-specific initialization functions together. - Group demod_attach functions together. - Group tuner_attach functions together. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c201
1 files changed, 101 insertions, 100 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index 4d63d1f16295..3ebf0bcf47c9 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -22,45 +22,6 @@ static int dvb_usb_m920x_debug;
22module_param_named(debug,dvb_usb_m920x_debug, int, 0644); 22module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
23MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 23MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
24 24
25static struct dvb_usb_rc_key megasky_rc_keys [] = {
26 { 0x0, 0x12, KEY_POWER },
27 { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */
28 { 0x0, 0x02, KEY_CHANNELUP },
29 { 0x0, 0x05, KEY_CHANNELDOWN },
30 { 0x0, 0x03, KEY_VOLUMEUP },
31 { 0x0, 0x06, KEY_VOLUMEDOWN },
32 { 0x0, 0x04, KEY_MUTE },
33 { 0x0, 0x07, KEY_OK }, /* TS */
34 { 0x0, 0x08, KEY_STOP },
35 { 0x0, 0x09, KEY_MENU }, /* swap */
36 { 0x0, 0x0a, KEY_REWIND },
37 { 0x0, 0x1b, KEY_PAUSE },
38 { 0x0, 0x1f, KEY_FASTFORWARD },
39 { 0x0, 0x0c, KEY_RECORD },
40 { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */
41 { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */
42};
43
44static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
45 { 0x0, 0x01, KEY_ZOOM }, /* Full Screen */
46 { 0x0, 0x02, KEY_CAMERA }, /* snapshot */
47 { 0x0, 0x03, KEY_MUTE },
48 { 0x0, 0x04, KEY_REWIND },
49 { 0x0, 0x05, KEY_PLAYPAUSE }, /* Play/Pause */
50 { 0x0, 0x06, KEY_FASTFORWARD },
51 { 0x0, 0x07, KEY_RECORD },
52 { 0x0, 0x08, KEY_STOP },
53 { 0x0, 0x09, KEY_TIME }, /* Timeshift */
54 { 0x0, 0x0c, KEY_COFFEE }, /* Recall */
55 { 0x0, 0x0e, KEY_CHANNELUP },
56 { 0x0, 0x12, KEY_POWER },
57 { 0x0, 0x15, KEY_MENU }, /* source */
58 { 0x0, 0x18, KEY_CYCLEWINDOWS }, /* TWIN PIP */
59 { 0x0, 0x1a, KEY_CHANNELDOWN },
60 { 0x0, 0x1b, KEY_VOLUMEDOWN },
61 { 0x0, 0x1e, KEY_VOLUMEUP },
62};
63
64static inline int m9206_read(struct usb_device *udev, u8 request, u16 value, 25static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,
65 u16 index, void *data, int size) 26 u16 index, void *data, int size)
66{ 27{
@@ -259,7 +220,7 @@ static struct i2c_algorithm m9206_i2c_algo = {
259 .functionality = m9206_i2c_func, 220 .functionality = m9206_i2c_func,
260}; 221};
261 222
262 223/* pid filter */
263static int m9206_set_filter(struct dvb_usb_adapter *adap, 224static int m9206_set_filter(struct dvb_usb_adapter *adap,
264 int type, int idx, int pid) 225 int type, int idx, int pid)
265{ 226{
@@ -419,6 +380,7 @@ static int m920x_identify_state(struct usb_device *udev,
419 return 0; 380 return 0;
420} 381}
421 382
383/* demod configurations */
422static int megasky_mt352_demod_init(struct dvb_frontend *fe) 384static int megasky_mt352_demod_init(struct dvb_frontend *fe)
423{ 385{
424 u8 config[] = { CONFIG, 0x3d }; 386 u8 config[] = { CONFIG, 0x3d };
@@ -450,36 +412,6 @@ static struct mt352_config megasky_mt352_config = {
450 .demod_init = megasky_mt352_demod_init, 412 .demod_init = megasky_mt352_demod_init,
451}; 413};
452 414
453static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap)
454{
455 deb_rc("megasky_frontend_attach!\n");
456
457 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config,
458 &adap->dev->i2c_adap)) == NULL)
459 return -EIO;
460
461 return 0;
462}
463
464static struct qt1010_config megasky_qt1010_config = {
465 .i2c_address = 0x62
466};
467
468static int megasky_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
469{
470 if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap,
471 &megasky_qt1010_config) == NULL)
472 return -ENODEV;
473
474 return 0;
475}
476
477static struct m9206_inits megasky_rc_init [] = {
478 { M9206_RC_INIT2, 0xa8 },
479 { M9206_RC_INIT1, 0x51 },
480 { } /* terminating entry */
481};
482
483static struct tda1004x_config digivox_tda10046_config = { 415static struct tda1004x_config digivox_tda10046_config = {
484 .demod_address = 0x08, 416 .demod_address = 0x08,
485 .invert = 0, 417 .invert = 0,
@@ -492,32 +424,6 @@ static struct tda1004x_config digivox_tda10046_config = {
492 .request_firmware = NULL, 424 .request_firmware = NULL,
493}; 425};
494 426
495static int digivox_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
496{
497 deb_rc("digivox_tda10046_frontend_attach!\n");
498
499 if ((adap->fe = dvb_attach(tda10046_attach, &digivox_tda10046_config,
500 &adap->dev->i2c_adap)) == NULL)
501 return -EIO;
502
503 return 0;
504}
505
506static int digivox_tda8275_tuner_attach(struct dvb_usb_adapter *adap)
507{
508 if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap,
509 NULL) == NULL)
510 return -ENODEV;
511 return 0;
512}
513
514/* LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
515 * TDA10046 #0 is located at i2c address 0x08
516 * TDA10046 #1 is located at i2c address 0x0b
517 * TDA8275A #0 is located at i2c address 0x60
518 * TDA8275A #1 is located at i2c address 0x61
519 */
520
521static struct tda1004x_config tvwalkertwin_0_tda10046_config = { 427static struct tda1004x_config tvwalkertwin_0_tda10046_config = {
522 .demod_address = 0x08, 428 .demod_address = 0x08,
523 .invert = 0, 429 .invert = 0,
@@ -542,6 +448,41 @@ static struct tda1004x_config tvwalkertwin_1_tda10046_config = {
542 .request_firmware = NULL, /* uses firmware EEPROM */ 448 .request_firmware = NULL, /* uses firmware EEPROM */
543}; 449};
544 450
451/* tuner configurations */
452static struct qt1010_config megasky_qt1010_config = {
453 .i2c_address = 0x62
454};
455
456/* Callbacks for DVB USB */
457static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap)
458{
459 deb_rc("megasky_frontend_attach!\n");
460
461 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config,
462 &adap->dev->i2c_adap)) == NULL)
463 return -EIO;
464
465 return 0;
466}
467
468static int digivox_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
469{
470 deb_rc("digivox_tda10046_frontend_attach!\n");
471
472 if ((adap->fe = dvb_attach(tda10046_attach, &digivox_tda10046_config,
473 &adap->dev->i2c_adap)) == NULL)
474 return -EIO;
475
476 return 0;
477}
478
479/* LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
480 * TDA10046 #0 is located at i2c address 0x08
481 * TDA10046 #1 is located at i2c address 0x0b
482 * TDA8275A #0 is located at i2c address 0x60
483 * TDA8275A #1 is located at i2c address 0x61
484 */
485
545static int tvwalkertwin_0_tda10046_frontend_attach(struct dvb_usb_adapter *adap) 486static int tvwalkertwin_0_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
546{ 487{
547 deb_rc("tvwalkertwin_0_tda10046_frontend_attach!\n"); 488 deb_rc("tvwalkertwin_0_tda10046_frontend_attach!\n");
@@ -572,6 +513,23 @@ static int tvwalkertwin_1_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
572 return 0; 513 return 0;
573} 514}
574 515
516static int megasky_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
517{
518 if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap,
519 &megasky_qt1010_config) == NULL)
520 return -ENODEV;
521
522 return 0;
523}
524
525static int digivox_tda8275_tuner_attach(struct dvb_usb_adapter *adap)
526{
527 if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap,
528 NULL) == NULL)
529 return -ENODEV;
530 return 0;
531}
532
575static int tvwalkertwin_0_tda8275_tuner_attach(struct dvb_usb_adapter *adap) 533static int tvwalkertwin_0_tda8275_tuner_attach(struct dvb_usb_adapter *adap)
576{ 534{
577 int address = 0x60; 535 int address = 0x60;
@@ -602,6 +560,13 @@ static int tvwalkertwin_1_tda8275_tuner_attach(struct dvb_usb_adapter *adap)
602 return 0; 560 return 0;
603} 561}
604 562
563/* device-specific initialization */
564static struct m9206_inits megasky_rc_init [] = {
565 { M9206_RC_INIT2, 0xa8 },
566 { M9206_RC_INIT1, 0x51 },
567 { } /* terminating entry */
568};
569
605static struct m9206_inits tvwalkertwin_rc_init [] = { 570static struct m9206_inits tvwalkertwin_rc_init [] = {
606 { M9206_RC_INIT2, 0x00 }, 571 { M9206_RC_INIT2, 0x00 },
607 { M9206_RC_INIT1, 0xef }, 572 { M9206_RC_INIT1, 0xef },
@@ -611,15 +576,52 @@ static struct m9206_inits tvwalkertwin_rc_init [] = {
611 { } /* terminating entry */ 576 { } /* terminating entry */
612}; 577};
613 578
579/* ir keymaps */
580static struct dvb_usb_rc_key megasky_rc_keys [] = {
581 { 0x0, 0x12, KEY_POWER },
582 { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */
583 { 0x0, 0x02, KEY_CHANNELUP },
584 { 0x0, 0x05, KEY_CHANNELDOWN },
585 { 0x0, 0x03, KEY_VOLUMEUP },
586 { 0x0, 0x06, KEY_VOLUMEDOWN },
587 { 0x0, 0x04, KEY_MUTE },
588 { 0x0, 0x07, KEY_OK }, /* TS */
589 { 0x0, 0x08, KEY_STOP },
590 { 0x0, 0x09, KEY_MENU }, /* swap */
591 { 0x0, 0x0a, KEY_REWIND },
592 { 0x0, 0x1b, KEY_PAUSE },
593 { 0x0, 0x1f, KEY_FASTFORWARD },
594 { 0x0, 0x0c, KEY_RECORD },
595 { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */
596 { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */
597};
598
599static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
600 { 0x0, 0x01, KEY_ZOOM }, /* Full Screen */
601 { 0x0, 0x02, KEY_CAMERA }, /* snapshot */
602 { 0x0, 0x03, KEY_MUTE },
603 { 0x0, 0x04, KEY_REWIND },
604 { 0x0, 0x05, KEY_PLAYPAUSE }, /* Play/Pause */
605 { 0x0, 0x06, KEY_FASTFORWARD },
606 { 0x0, 0x07, KEY_RECORD },
607 { 0x0, 0x08, KEY_STOP },
608 { 0x0, 0x09, KEY_TIME }, /* Timeshift */
609 { 0x0, 0x0c, KEY_COFFEE }, /* Recall */
610 { 0x0, 0x0e, KEY_CHANNELUP },
611 { 0x0, 0x12, KEY_POWER },
612 { 0x0, 0x15, KEY_MENU }, /* source */
613 { 0x0, 0x18, KEY_CYCLEWINDOWS }, /* TWIN PIP */
614 { 0x0, 0x1a, KEY_CHANNELDOWN },
615 { 0x0, 0x1b, KEY_VOLUMEDOWN },
616 { 0x0, 0x1e, KEY_VOLUMEUP },
617};
618
614/* DVB USB Driver stuff */ 619/* DVB USB Driver stuff */
615static struct dvb_usb_device_properties megasky_properties; 620static struct dvb_usb_device_properties megasky_properties;
616static struct dvb_usb_device_properties digivox_mini_ii_properties; 621static struct dvb_usb_device_properties digivox_mini_ii_properties;
617static struct dvb_usb_device_properties tvwalkertwin_properties; 622static struct dvb_usb_device_properties tvwalkertwin_properties;
618static struct dvb_usb_device_properties dposh_properties; 623static struct dvb_usb_device_properties dposh_properties;
619 624
620static struct m9206_inits megasky_rc_init [];
621static struct m9206_inits tvwalkertwin_rc_init [];
622
623static int m920x_probe(struct usb_interface *intf, 625static int m920x_probe(struct usb_interface *intf,
624 const struct usb_device_id *id) 626 const struct usb_device_id *id)
625{ 627{
@@ -800,7 +802,6 @@ static struct dvb_usb_device_properties digivox_mini_ii_properties = {
800}; 802};
801 803
802/* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> */ 804/* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> */
803
804static struct dvb_usb_device_properties tvwalkertwin_properties = { 805static struct dvb_usb_device_properties tvwalkertwin_properties = {
805 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 806 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
806 807