diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-05-13 15:49:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:21:11 -0400 |
commit | 4d7a2d6721a6380d4ffc26d81d2c8232fd0d2dfc (patch) | |
tree | 5ccac1dc6084363abdea5a63fe5d305421bd894c /drivers/media/video/saa7134/saa7134-input.c | |
parent | c668f32dca105d876e51862a003a302fa61e4ae4 (diff) |
V4L/DVB (11845): ir-kbd-i2c: Use initialization data
For specific boards, pass initialization data to ir-kbd-i2c instead
of modifying the settings after the device is initialized. This is
more efficient and easier to read.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 4144ca9cc7e0..a20f687f81a8 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -685,6 +685,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) | |||
685 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | 685 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev) |
686 | { | 686 | { |
687 | struct i2c_board_info info; | 687 | struct i2c_board_info info; |
688 | struct IR_i2c_init_data init_data; | ||
688 | const unsigned short addr_list[] = { | 689 | const unsigned short addr_list[] = { |
689 | 0x7a, 0x47, 0x71, 0x2d, | 690 | 0x7a, 0x47, 0x71, 0x2d, |
690 | I2C_CLIENT_END | 691 | I2C_CLIENT_END |
@@ -722,62 +723,35 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | |||
722 | } | 723 | } |
723 | 724 | ||
724 | memset(&info, 0, sizeof(struct i2c_board_info)); | 725 | memset(&info, 0, sizeof(struct i2c_board_info)); |
726 | memset(&init_data, 0, sizeof(struct IR_i2c_init_data)); | ||
725 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 727 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
726 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
727 | if (client) | ||
728 | return; | ||
729 | |||
730 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
731 | respond to probes unless we read something from | ||
732 | an existing device. Weird... */ | ||
733 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | ||
734 | dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", | ||
735 | msg_msi.addr, dev->i2c_adap.name, | ||
736 | (1 == rc) ? "yes" : "no"); | ||
737 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list_msi); | ||
738 | if (client) | ||
739 | return; | ||
740 | 728 | ||
741 | /* Special case for AVerMedia Cardbus remote */ | ||
742 | subaddr = 0x0d; | ||
743 | rc = i2c_transfer(&dev->i2c_adap, msg_avermedia, 2); | ||
744 | dprintk(KERN_DEBUG "probe 0x%02x/0x%02x @ %s: %s\n", | ||
745 | msg_avermedia[0].addr, subaddr, dev->i2c_adap.name, | ||
746 | (2 == rc) ? "yes" : "no"); | ||
747 | if (2 == rc) { | ||
748 | info.addr = msg_avermedia[0].addr; | ||
749 | i2c_new_device(&dev->i2c_adap, &info); | ||
750 | } | ||
751 | } | ||
752 | |||
753 | void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | ||
754 | { | ||
755 | switch (dev->board) { | 729 | switch (dev->board) { |
756 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | 730 | case SAA7134_BOARD_PINNACLE_PCTV_110i: |
757 | case SAA7134_BOARD_PINNACLE_PCTV_310i: | 731 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
758 | snprintf(ir->name, sizeof(ir->name), "Pinnacle PCTV"); | 732 | init_data.name = "Pinnacle PCTV"; |
759 | if (pinnacle_remote == 0) { | 733 | if (pinnacle_remote == 0) { |
760 | ir->get_key = get_key_pinnacle_color; | 734 | init_data.get_key = get_key_pinnacle_color; |
761 | ir->ir_codes = ir_codes_pinnacle_color; | 735 | init_data.ir_codes = ir_codes_pinnacle_color; |
762 | } else { | 736 | } else { |
763 | ir->get_key = get_key_pinnacle_grey; | 737 | init_data.get_key = get_key_pinnacle_grey; |
764 | ir->ir_codes = ir_codes_pinnacle_grey; | 738 | init_data.ir_codes = ir_codes_pinnacle_grey; |
765 | } | 739 | } |
766 | break; | 740 | break; |
767 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | 741 | case SAA7134_BOARD_UPMOST_PURPLE_TV: |
768 | snprintf(ir->name, sizeof(ir->name), "Purple TV"); | 742 | init_data.name = "Purple TV"; |
769 | ir->get_key = get_key_purpletv; | 743 | init_data.get_key = get_key_purpletv; |
770 | ir->ir_codes = ir_codes_purpletv; | 744 | init_data.ir_codes = ir_codes_purpletv; |
771 | break; | 745 | break; |
772 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: | 746 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: |
773 | snprintf(ir->name, sizeof(ir->name), "MSI TV@nywhere Plus"); | 747 | init_data.name = "MSI TV@nywhere Plus"; |
774 | ir->get_key = get_key_msi_tvanywhere_plus; | 748 | init_data.get_key = get_key_msi_tvanywhere_plus; |
775 | ir->ir_codes = ir_codes_msi_tvanywhere_plus; | 749 | init_data.ir_codes = ir_codes_msi_tvanywhere_plus; |
776 | break; | 750 | break; |
777 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 751 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
778 | snprintf(ir->name, sizeof(ir->name), "HVR 1110"); | 752 | init_data.name = "HVR 1110"; |
779 | ir->get_key = get_key_hvr1110; | 753 | init_data.get_key = get_key_hvr1110; |
780 | ir->ir_codes = ir_codes_hauppauge_new; | 754 | init_data.ir_codes = ir_codes_hauppauge_new; |
781 | break; | 755 | break; |
782 | case SAA7134_BOARD_BEHOLD_607FM_MK3: | 756 | case SAA7134_BOARD_BEHOLD_607FM_MK3: |
783 | case SAA7134_BOARD_BEHOLD_607FM_MK5: | 757 | case SAA7134_BOARD_BEHOLD_607FM_MK5: |
@@ -791,15 +765,39 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | |||
791 | case SAA7134_BOARD_BEHOLD_M63: | 765 | case SAA7134_BOARD_BEHOLD_M63: |
792 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: | 766 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: |
793 | case SAA7134_BOARD_BEHOLD_H6: | 767 | case SAA7134_BOARD_BEHOLD_H6: |
794 | snprintf(ir->name, sizeof(ir->name), "BeholdTV"); | 768 | init_data.name = "BeholdTV"; |
795 | ir->get_key = get_key_beholdm6xx; | 769 | init_data.get_key = get_key_beholdm6xx; |
796 | ir->ir_codes = ir_codes_behold; | 770 | init_data.ir_codes = ir_codes_behold; |
797 | break; | ||
798 | default: | ||
799 | dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); | ||
800 | break; | 771 | break; |
801 | } | 772 | } |
802 | 773 | ||
774 | if (init_data.name) | ||
775 | info.platform_data = &init_data; | ||
776 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
777 | if (client) | ||
778 | return; | ||
779 | |||
780 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
781 | respond to probes unless we read something from | ||
782 | an existing device. Weird... */ | ||
783 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | ||
784 | dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", | ||
785 | msg_msi.addr, dev->i2c_adap.name, | ||
786 | (1 == rc) ? "yes" : "no"); | ||
787 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list_msi); | ||
788 | if (client) | ||
789 | return; | ||
790 | |||
791 | /* Special case for AVerMedia Cardbus remote */ | ||
792 | subaddr = 0x0d; | ||
793 | rc = i2c_transfer(&dev->i2c_adap, msg_avermedia, 2); | ||
794 | dprintk(KERN_DEBUG "probe 0x%02x/0x%02x @ %s: %s\n", | ||
795 | msg_avermedia[0].addr, subaddr, dev->i2c_adap.name, | ||
796 | (2 == rc) ? "yes" : "no"); | ||
797 | if (2 == rc) { | ||
798 | info.addr = msg_avermedia[0].addr; | ||
799 | i2c_new_device(&dev->i2c_adap, &info); | ||
800 | } | ||
803 | } | 801 | } |
804 | 802 | ||
805 | static int saa7134_rc5_irq(struct saa7134_dev *dev) | 803 | static int saa7134_rc5_irq(struct saa7134_dev *dev) |