aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-08-29 13:15:55 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:19:47 -0400
commit715a223323c8c8bcbe7739e20f6c619f7343b595 (patch)
tree0c7eddcdd3c778428fc936009af085940c0394bb /drivers/media/video/saa7134
parent47f7f6fb7949b6546baf4b6f26bf0ca075d12759 (diff)
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and the value is the keycode. While this works, it has some drawbacks: 1) It requires that the scancode to be at the range 00-7f; 2) keycodes should be masked on 7 bits in order for it to work; 3) due to the 7 bits approach, sometimes it is not possible to replace the default keyboard to another one with a different encoding rule; 4) it is different than what is done with dvb-usb approach; 5) it requires a typedef for it to work. This is not a recommended Linux CodingStyle. This patch is part of a larger series of IR changes. It basically replaces the IR_KEYTAB_TYPE tables by a structured table: struct ir_scancode { u16 scancode; u32 keycode; }; This is very close to what dvb does. So, a further integration with DVB code will be easy. While we've changed the tables, for now, the IR keycode handling is still based on the old approach. The only notable effect is the redution of about 35% of the ir-common module size: text data bss dec hex filename 6721 29208 4 35933 8c5d old/ir-common.ko 5756 18040 4 23800 5cf8 new/ir-common.ko In thesis, we could be using above u8 for scancode, reducing even more the size of the module, but defining it as u16 is more convenient, since, on dvb, each scancode has up to 16 bits, and we currently have a few troubles with rc5, as their scancodes are defined with more than 8 bits. This patch itself shouldn't be doing any functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 65fb7b17b678..9070e5fabb4e 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -394,7 +394,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
394{ 394{
395 struct card_ir *ir; 395 struct card_ir *ir;
396 struct input_dev *input_dev; 396 struct input_dev *input_dev;
397 IR_KEYTAB_TYPE *ir_codes = NULL; 397 struct ir_scancode_table *ir_codes = NULL;
398 u32 mask_keycode = 0; 398 u32 mask_keycode = 0;
399 u32 mask_keydown = 0; 399 u32 mask_keydown = 0;
400 u32 mask_keyup = 0; 400 u32 mask_keyup = 0;
@@ -416,27 +416,27 @@ int saa7134_input_init1(struct saa7134_dev *dev)
416 case SAA7134_BOARD_FLYTVPLATINUM_FM: 416 case SAA7134_BOARD_FLYTVPLATINUM_FM:
417 case SAA7134_BOARD_FLYTVPLATINUM_MINI2: 417 case SAA7134_BOARD_FLYTVPLATINUM_MINI2:
418 case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM: 418 case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM:
419 ir_codes = ir_codes_flyvideo; 419 ir_codes = &ir_codes_flyvideo_table;
420 mask_keycode = 0xEC00000; 420 mask_keycode = 0xEC00000;
421 mask_keydown = 0x0040000; 421 mask_keydown = 0x0040000;
422 break; 422 break;
423 case SAA7134_BOARD_CINERGY400: 423 case SAA7134_BOARD_CINERGY400:
424 case SAA7134_BOARD_CINERGY600: 424 case SAA7134_BOARD_CINERGY600:
425 case SAA7134_BOARD_CINERGY600_MK3: 425 case SAA7134_BOARD_CINERGY600_MK3:
426 ir_codes = ir_codes_cinergy; 426 ir_codes = &ir_codes_cinergy_table;
427 mask_keycode = 0x00003f; 427 mask_keycode = 0x00003f;
428 mask_keyup = 0x040000; 428 mask_keyup = 0x040000;
429 break; 429 break;
430 case SAA7134_BOARD_ECS_TVP3XP: 430 case SAA7134_BOARD_ECS_TVP3XP:
431 case SAA7134_BOARD_ECS_TVP3XP_4CB5: 431 case SAA7134_BOARD_ECS_TVP3XP_4CB5:
432 ir_codes = ir_codes_eztv; 432 ir_codes = &ir_codes_eztv_table;
433 mask_keycode = 0x00017c; 433 mask_keycode = 0x00017c;
434 mask_keyup = 0x000002; 434 mask_keyup = 0x000002;
435 polling = 50; // ms 435 polling = 50; // ms
436 break; 436 break;
437 case SAA7134_BOARD_KWORLD_XPERT: 437 case SAA7134_BOARD_KWORLD_XPERT:
438 case SAA7134_BOARD_AVACSSMARTTV: 438 case SAA7134_BOARD_AVACSSMARTTV:
439 ir_codes = ir_codes_pixelview; 439 ir_codes = &ir_codes_pixelview_table;
440 mask_keycode = 0x00001F; 440 mask_keycode = 0x00001F;
441 mask_keyup = 0x000020; 441 mask_keyup = 0x000020;
442 polling = 50; // ms 442 polling = 50; // ms
@@ -453,7 +453,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
453 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 453 case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
454 case SAA7134_BOARD_AVERMEDIA_M102: 454 case SAA7134_BOARD_AVERMEDIA_M102:
455 case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: 455 case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS:
456 ir_codes = ir_codes_avermedia; 456 ir_codes = &ir_codes_avermedia_table;
457 mask_keycode = 0x0007C8; 457 mask_keycode = 0x0007C8;
458 mask_keydown = 0x000010; 458 mask_keydown = 0x000010;
459 polling = 50; // ms 459 polling = 50; // ms
@@ -462,14 +462,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
462 saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); 462 saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4);
463 break; 463 break;
464 case SAA7134_BOARD_AVERMEDIA_M135A: 464 case SAA7134_BOARD_AVERMEDIA_M135A:
465 ir_codes = ir_codes_avermedia_m135a; 465 ir_codes = &ir_codes_avermedia_m135a_table;
466 mask_keydown = 0x0040000; 466 mask_keydown = 0x0040000;
467 mask_keycode = 0x00013f; 467 mask_keycode = 0x00013f;
468 nec_gpio = 1; 468 nec_gpio = 1;
469 break; 469 break;
470 case SAA7134_BOARD_AVERMEDIA_777: 470 case SAA7134_BOARD_AVERMEDIA_777:
471 case SAA7134_BOARD_AVERMEDIA_A16AR: 471 case SAA7134_BOARD_AVERMEDIA_A16AR:
472 ir_codes = ir_codes_avermedia; 472 ir_codes = &ir_codes_avermedia_table;
473 mask_keycode = 0x02F200; 473 mask_keycode = 0x02F200;
474 mask_keydown = 0x000400; 474 mask_keydown = 0x000400;
475 polling = 50; // ms 475 polling = 50; // ms
@@ -478,7 +478,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
478 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); 478 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
479 break; 479 break;
480 case SAA7134_BOARD_AVERMEDIA_A16D: 480 case SAA7134_BOARD_AVERMEDIA_A16D:
481 ir_codes = ir_codes_avermedia_a16d; 481 ir_codes = &ir_codes_avermedia_a16d_table;
482 mask_keycode = 0x02F200; 482 mask_keycode = 0x02F200;
483 mask_keydown = 0x000400; 483 mask_keydown = 0x000400;
484 polling = 50; /* ms */ 484 polling = 50; /* ms */
@@ -487,14 +487,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
487 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); 487 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
488 break; 488 break;
489 case SAA7134_BOARD_KWORLD_TERMINATOR: 489 case SAA7134_BOARD_KWORLD_TERMINATOR:
490 ir_codes = ir_codes_pixelview; 490 ir_codes = &ir_codes_pixelview_table;
491 mask_keycode = 0x00001f; 491 mask_keycode = 0x00001f;
492 mask_keyup = 0x000060; 492 mask_keyup = 0x000060;
493 polling = 50; // ms 493 polling = 50; // ms
494 break; 494 break;
495 case SAA7134_BOARD_MANLI_MTV001: 495 case SAA7134_BOARD_MANLI_MTV001:
496 case SAA7134_BOARD_MANLI_MTV002: 496 case SAA7134_BOARD_MANLI_MTV002:
497 ir_codes = ir_codes_manli; 497 ir_codes = &ir_codes_manli_table;
498 mask_keycode = 0x001f00; 498 mask_keycode = 0x001f00;
499 mask_keyup = 0x004000; 499 mask_keyup = 0x004000;
500 polling = 50; /* ms */ 500 polling = 50; /* ms */
@@ -513,25 +513,25 @@ int saa7134_input_init1(struct saa7134_dev *dev)
513 case SAA7134_BOARD_BEHOLD_507_9FM: 513 case SAA7134_BOARD_BEHOLD_507_9FM:
514 case SAA7134_BOARD_BEHOLD_507RDS_MK3: 514 case SAA7134_BOARD_BEHOLD_507RDS_MK3:
515 case SAA7134_BOARD_BEHOLD_507RDS_MK5: 515 case SAA7134_BOARD_BEHOLD_507RDS_MK5:
516 ir_codes = ir_codes_manli; 516 ir_codes = &ir_codes_manli_table;
517 mask_keycode = 0x003f00; 517 mask_keycode = 0x003f00;
518 mask_keyup = 0x004000; 518 mask_keyup = 0x004000;
519 polling = 50; /* ms */ 519 polling = 50; /* ms */
520 break; 520 break;
521 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: 521 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
522 ir_codes = ir_codes_behold_columbus; 522 ir_codes = &ir_codes_behold_columbus_table;
523 mask_keycode = 0x003f00; 523 mask_keycode = 0x003f00;
524 mask_keyup = 0x004000; 524 mask_keyup = 0x004000;
525 polling = 50; // ms 525 polling = 50; // ms
526 break; 526 break;
527 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: 527 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS:
528 ir_codes = ir_codes_pctv_sedna; 528 ir_codes = &ir_codes_pctv_sedna_table;
529 mask_keycode = 0x001f00; 529 mask_keycode = 0x001f00;
530 mask_keyup = 0x004000; 530 mask_keyup = 0x004000;
531 polling = 50; // ms 531 polling = 50; // ms
532 break; 532 break;
533 case SAA7134_BOARD_GOTVIEW_7135: 533 case SAA7134_BOARD_GOTVIEW_7135:
534 ir_codes = ir_codes_gotview7135; 534 ir_codes = &ir_codes_gotview7135_table;
535 mask_keycode = 0x0003CC; 535 mask_keycode = 0x0003CC;
536 mask_keydown = 0x000010; 536 mask_keydown = 0x000010;
537 polling = 5; /* ms */ 537 polling = 5; /* ms */
@@ -540,75 +540,75 @@ int saa7134_input_init1(struct saa7134_dev *dev)
540 case SAA7134_BOARD_VIDEOMATE_TV_PVR: 540 case SAA7134_BOARD_VIDEOMATE_TV_PVR:
541 case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: 541 case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS:
542 case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: 542 case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
543 ir_codes = ir_codes_videomate_tv_pvr; 543 ir_codes = &ir_codes_videomate_tv_pvr_table;
544 mask_keycode = 0x00003F; 544 mask_keycode = 0x00003F;
545 mask_keyup = 0x400000; 545 mask_keyup = 0x400000;
546 polling = 50; // ms 546 polling = 50; // ms
547 break; 547 break;
548 case SAA7134_BOARD_PROTEUS_2309: 548 case SAA7134_BOARD_PROTEUS_2309:
549 ir_codes = ir_codes_proteus_2309; 549 ir_codes = &ir_codes_proteus_2309_table;
550 mask_keycode = 0x00007F; 550 mask_keycode = 0x00007F;
551 mask_keyup = 0x000080; 551 mask_keyup = 0x000080;
552 polling = 50; // ms 552 polling = 50; // ms
553 break; 553 break;
554 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 554 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
555 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 555 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
556 ir_codes = ir_codes_videomate_tv_pvr; 556 ir_codes = &ir_codes_videomate_tv_pvr_table;
557 mask_keycode = 0x003F00; 557 mask_keycode = 0x003F00;
558 mask_keyup = 0x040000; 558 mask_keyup = 0x040000;
559 break; 559 break;
560 case SAA7134_BOARD_FLYDVBS_LR300: 560 case SAA7134_BOARD_FLYDVBS_LR300:
561 case SAA7134_BOARD_FLYDVBT_LR301: 561 case SAA7134_BOARD_FLYDVBT_LR301:
562 case SAA7134_BOARD_FLYDVBTDUO: 562 case SAA7134_BOARD_FLYDVBTDUO:
563 ir_codes = ir_codes_flydvb; 563 ir_codes = &ir_codes_flydvb_table;
564 mask_keycode = 0x0001F00; 564 mask_keycode = 0x0001F00;
565 mask_keydown = 0x0040000; 565 mask_keydown = 0x0040000;
566 break; 566 break;
567 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 567 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
568 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: 568 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
569 case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: 569 case SAA7134_BOARD_ASUSTeK_P7131_ANALOG:
570 ir_codes = ir_codes_asus_pc39; 570 ir_codes = &ir_codes_asus_pc39_table;
571 mask_keydown = 0x0040000; 571 mask_keydown = 0x0040000;
572 rc5_gpio = 1; 572 rc5_gpio = 1;
573 break; 573 break;
574 case SAA7134_BOARD_ENCORE_ENLTV: 574 case SAA7134_BOARD_ENCORE_ENLTV:
575 case SAA7134_BOARD_ENCORE_ENLTV_FM: 575 case SAA7134_BOARD_ENCORE_ENLTV_FM:
576 ir_codes = ir_codes_encore_enltv; 576 ir_codes = &ir_codes_encore_enltv_table;
577 mask_keycode = 0x00007f; 577 mask_keycode = 0x00007f;
578 mask_keyup = 0x040000; 578 mask_keyup = 0x040000;
579 polling = 50; // ms 579 polling = 50; // ms
580 break; 580 break;
581 case SAA7134_BOARD_ENCORE_ENLTV_FM53: 581 case SAA7134_BOARD_ENCORE_ENLTV_FM53:
582 ir_codes = ir_codes_encore_enltv_fm53; 582 ir_codes = &ir_codes_encore_enltv_fm53_table;
583 mask_keydown = 0x0040000; 583 mask_keydown = 0x0040000;
584 mask_keycode = 0x00007f; 584 mask_keycode = 0x00007f;
585 nec_gpio = 1; 585 nec_gpio = 1;
586 break; 586 break;
587 case SAA7134_BOARD_10MOONSTVMASTER3: 587 case SAA7134_BOARD_10MOONSTVMASTER3:
588 ir_codes = ir_codes_encore_enltv; 588 ir_codes = &ir_codes_encore_enltv_table;
589 mask_keycode = 0x5f80000; 589 mask_keycode = 0x5f80000;
590 mask_keyup = 0x8000000; 590 mask_keyup = 0x8000000;
591 polling = 50; //ms 591 polling = 50; //ms
592 break; 592 break;
593 case SAA7134_BOARD_GENIUS_TVGO_A11MCE: 593 case SAA7134_BOARD_GENIUS_TVGO_A11MCE:
594 ir_codes = ir_codes_genius_tvgo_a11mce; 594 ir_codes = &ir_codes_genius_tvgo_a11mce_table;
595 mask_keycode = 0xff; 595 mask_keycode = 0xff;
596 mask_keydown = 0xf00000; 596 mask_keydown = 0xf00000;
597 polling = 50; /* ms */ 597 polling = 50; /* ms */
598 break; 598 break;
599 case SAA7134_BOARD_REAL_ANGEL_220: 599 case SAA7134_BOARD_REAL_ANGEL_220:
600 ir_codes = ir_codes_real_audio_220_32_keys; 600 ir_codes = &ir_codes_real_audio_220_32_keys_table;
601 mask_keycode = 0x3f00; 601 mask_keycode = 0x3f00;
602 mask_keyup = 0x4000; 602 mask_keyup = 0x4000;
603 polling = 50; /* ms */ 603 polling = 50; /* ms */
604 break; 604 break;
605 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: 605 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG:
606 ir_codes = ir_codes_kworld_plus_tv_analog; 606 ir_codes = &ir_codes_kworld_plus_tv_analog_table;
607 mask_keycode = 0x7f; 607 mask_keycode = 0x7f;
608 polling = 40; /* ms */ 608 polling = 40; /* ms */
609 break; 609 break;
610 case SAA7134_BOARD_VIDEOMATE_S350: 610 case SAA7134_BOARD_VIDEOMATE_S350:
611 ir_codes = ir_codes_videomate_s350; 611 ir_codes = &ir_codes_videomate_s350_table;
612 mask_keycode = 0x003f00; 612 mask_keycode = 0x003f00;
613 mask_keydown = 0x040000; 613 mask_keydown = 0x040000;
614 break; 614 break;
@@ -722,23 +722,23 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
722 init_data.name = "Pinnacle PCTV"; 722 init_data.name = "Pinnacle PCTV";
723 if (pinnacle_remote == 0) { 723 if (pinnacle_remote == 0) {
724 init_data.get_key = get_key_pinnacle_color; 724 init_data.get_key = get_key_pinnacle_color;
725 init_data.ir_codes = ir_codes_pinnacle_color; 725 init_data.ir_codes = &ir_codes_pinnacle_color_table;
726 info.addr = 0x47; 726 info.addr = 0x47;
727 } else { 727 } else {
728 init_data.get_key = get_key_pinnacle_grey; 728 init_data.get_key = get_key_pinnacle_grey;
729 init_data.ir_codes = ir_codes_pinnacle_grey; 729 init_data.ir_codes = &ir_codes_pinnacle_grey_table;
730 info.addr = 0x47; 730 info.addr = 0x47;
731 } 731 }
732 break; 732 break;
733 case SAA7134_BOARD_UPMOST_PURPLE_TV: 733 case SAA7134_BOARD_UPMOST_PURPLE_TV:
734 init_data.name = "Purple TV"; 734 init_data.name = "Purple TV";
735 init_data.get_key = get_key_purpletv; 735 init_data.get_key = get_key_purpletv;
736 init_data.ir_codes = ir_codes_purpletv; 736 init_data.ir_codes = &ir_codes_purpletv_table;
737 break; 737 break;
738 case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: 738 case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS:
739 init_data.name = "MSI TV@nywhere Plus"; 739 init_data.name = "MSI TV@nywhere Plus";
740 init_data.get_key = get_key_msi_tvanywhere_plus; 740 init_data.get_key = get_key_msi_tvanywhere_plus;
741 init_data.ir_codes = ir_codes_msi_tvanywhere_plus; 741 init_data.ir_codes = &ir_codes_msi_tvanywhere_plus_table;
742 info.addr = 0x30; 742 info.addr = 0x30;
743 /* MSI TV@nywhere Plus controller doesn't seem to 743 /* MSI TV@nywhere Plus controller doesn't seem to
744 respond to probes unless we read something from 744 respond to probes unless we read something from
@@ -752,7 +752,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
752 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 752 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
753 init_data.name = "HVR 1110"; 753 init_data.name = "HVR 1110";
754 init_data.get_key = get_key_hvr1110; 754 init_data.get_key = get_key_hvr1110;
755 init_data.ir_codes = ir_codes_hauppauge_new; 755 init_data.ir_codes = &ir_codes_hauppauge_new_table;
756 break; 756 break;
757 case SAA7134_BOARD_BEHOLD_607FM_MK3: 757 case SAA7134_BOARD_BEHOLD_607FM_MK3:
758 case SAA7134_BOARD_BEHOLD_607FM_MK5: 758 case SAA7134_BOARD_BEHOLD_607FM_MK5:
@@ -769,7 +769,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
769 case SAA7134_BOARD_BEHOLD_X7: 769 case SAA7134_BOARD_BEHOLD_X7:
770 init_data.name = "BeholdTV"; 770 init_data.name = "BeholdTV";
771 init_data.get_key = get_key_beholdm6xx; 771 init_data.get_key = get_key_beholdm6xx;
772 init_data.ir_codes = ir_codes_behold; 772 init_data.ir_codes = &ir_codes_behold_table;
773 break; 773 break;
774 case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: 774 case SAA7134_BOARD_AVERMEDIA_CARDBUS_501:
775 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 775 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: