aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2010-01-22 10:10:53 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:52 -0500
commit634d2d757a435037576bac465a84a02a72c747b6 (patch)
tree975c4ff3dd2877d98150915285808159525b36c1 /drivers/media/dvb
parent6c614044ff00bf3e7403ac6c4ed4e53db8c349f3 (diff)
V4L/DVB: media: dvb/af9015, factor out remote setting
This is just a code shuffle without functional changes. For easier review of later changes, i.e. preparation. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.c305
1 files changed, 157 insertions, 148 deletions
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c
index 9f8370f4cc81..9a799d2e8792 100644
--- a/drivers/media/dvb/dvb-usb/af9015.c
+++ b/drivers/media/dvb/dvb-usb/af9015.c
@@ -732,12 +732,166 @@ error:
732 return ret; 732 return ret;
733} 733}
734 734
735static void af9015_set_remote_config(struct usb_device *udev,
736 struct dvb_usb_device_properties *props)
737{
738 if (dvb_usb_af9015_remote) {
739 /* load remote defined as module param */
740 switch (dvb_usb_af9015_remote) {
741 case AF9015_REMOTE_A_LINK_DTU_M:
742 props->rc_key_map =
743 af9015_rc_keys_a_link;
744 props->rc_key_map_size =
745 ARRAY_SIZE(af9015_rc_keys_a_link);
746 af9015_config.ir_table = af9015_ir_table_a_link;
747 af9015_config.ir_table_size =
748 ARRAY_SIZE(af9015_ir_table_a_link);
749 break;
750 case AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3:
751 props->rc_key_map =
752 af9015_rc_keys_msi;
753 props->rc_key_map_size =
754 ARRAY_SIZE(af9015_rc_keys_msi);
755 af9015_config.ir_table = af9015_ir_table_msi;
756 af9015_config.ir_table_size =
757 ARRAY_SIZE(af9015_ir_table_msi);
758 break;
759 case AF9015_REMOTE_MYGICTV_U718:
760 props->rc_key_map =
761 af9015_rc_keys_mygictv;
762 props->rc_key_map_size =
763 ARRAY_SIZE(af9015_rc_keys_mygictv);
764 af9015_config.ir_table =
765 af9015_ir_table_mygictv;
766 af9015_config.ir_table_size =
767 ARRAY_SIZE(af9015_ir_table_mygictv);
768 break;
769 case AF9015_REMOTE_DIGITTRADE_DVB_T:
770 props->rc_key_map =
771 af9015_rc_keys_digittrade;
772 props->rc_key_map_size =
773 ARRAY_SIZE(af9015_rc_keys_digittrade);
774 af9015_config.ir_table =
775 af9015_ir_table_digittrade;
776 af9015_config.ir_table_size =
777 ARRAY_SIZE(af9015_ir_table_digittrade);
778 break;
779 case AF9015_REMOTE_AVERMEDIA_KS:
780 props->rc_key_map =
781 af9015_rc_keys_avermedia;
782 props->rc_key_map_size =
783 ARRAY_SIZE(af9015_rc_keys_avermedia);
784 af9015_config.ir_table =
785 af9015_ir_table_avermedia_ks;
786 af9015_config.ir_table_size =
787 ARRAY_SIZE(af9015_ir_table_avermedia_ks);
788 break;
789 }
790 } else {
791 switch (le16_to_cpu(udev->descriptor.idVendor)) {
792 case USB_VID_LEADTEK:
793 props->rc_key_map =
794 af9015_rc_keys_leadtek;
795 props->rc_key_map_size =
796 ARRAY_SIZE(af9015_rc_keys_leadtek);
797 af9015_config.ir_table =
798 af9015_ir_table_leadtek;
799 af9015_config.ir_table_size =
800 ARRAY_SIZE(af9015_ir_table_leadtek);
801 break;
802 case USB_VID_VISIONPLUS:
803 props->rc_key_map =
804 af9015_rc_keys_twinhan;
805 props->rc_key_map_size =
806 ARRAY_SIZE(af9015_rc_keys_twinhan);
807 af9015_config.ir_table =
808 af9015_ir_table_twinhan;
809 af9015_config.ir_table_size =
810 ARRAY_SIZE(af9015_ir_table_twinhan);
811 break;
812 case USB_VID_KWORLD_2:
813 /* TODO: use correct rc keys */
814 props->rc_key_map =
815 af9015_rc_keys_twinhan;
816 props->rc_key_map_size =
817 ARRAY_SIZE(af9015_rc_keys_twinhan);
818 af9015_config.ir_table = af9015_ir_table_kworld;
819 af9015_config.ir_table_size =
820 ARRAY_SIZE(af9015_ir_table_kworld);
821 break;
822 /* Check USB manufacturer and product strings and try
823 to determine correct remote in case of chip vendor
824 reference IDs are used. */
825 case USB_VID_AFATECH:
826 {
827 char manufacturer[10];
828 memset(manufacturer, 0, sizeof(manufacturer));
829 usb_string(udev, udev->descriptor.iManufacturer,
830 manufacturer, sizeof(manufacturer));
831 if (!strcmp("Geniatech", manufacturer)) {
832 /* iManufacturer 1 Geniatech
833 iProduct 2 AF9015 */
834 props->rc_key_map =
835 af9015_rc_keys_mygictv;
836 props->rc_key_map_size =
837 ARRAY_SIZE(af9015_rc_keys_mygictv);
838 af9015_config.ir_table =
839 af9015_ir_table_mygictv;
840 af9015_config.ir_table_size =
841 ARRAY_SIZE(af9015_ir_table_mygictv);
842 } else if (!strcmp("MSI", manufacturer)) {
843 /* iManufacturer 1 MSI
844 iProduct 2 MSI K-VOX */
845 props->rc_key_map =
846 af9015_rc_keys_msi;
847 props->rc_key_map_size =
848 ARRAY_SIZE(af9015_rc_keys_msi);
849 af9015_config.ir_table =
850 af9015_ir_table_msi;
851 af9015_config.ir_table_size =
852 ARRAY_SIZE(af9015_ir_table_msi);
853 } else if (udev->descriptor.idProduct ==
854 cpu_to_le16(USB_PID_TREKSTOR_DVBT)) {
855 props->rc_key_map =
856 af9015_rc_keys_trekstor;
857 props->rc_key_map_size =
858 ARRAY_SIZE(af9015_rc_keys_trekstor);
859 af9015_config.ir_table =
860 af9015_ir_table_trekstor;
861 af9015_config.ir_table_size =
862 ARRAY_SIZE(af9015_ir_table_trekstor);
863 }
864 break;
865 }
866 case USB_VID_AVERMEDIA:
867 props->rc_key_map =
868 af9015_rc_keys_avermedia;
869 props->rc_key_map_size =
870 ARRAY_SIZE(af9015_rc_keys_avermedia);
871 af9015_config.ir_table =
872 af9015_ir_table_avermedia;
873 af9015_config.ir_table_size =
874 ARRAY_SIZE(af9015_ir_table_avermedia);
875 break;
876 case USB_VID_MSI_2:
877 props->rc_key_map =
878 af9015_rc_keys_msi_digivox_iii;
879 props->rc_key_map_size =
880 ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii);
881 af9015_config.ir_table =
882 af9015_ir_table_msi_digivox_iii;
883 af9015_config.ir_table_size =
884 ARRAY_SIZE(af9015_ir_table_msi_digivox_iii);
885 break;
886 }
887 }
888}
889
735static int af9015_read_config(struct usb_device *udev) 890static int af9015_read_config(struct usb_device *udev)
736{ 891{
737 int ret; 892 int ret;
738 u8 val, i, offset = 0; 893 u8 val, i, offset = 0;
739 struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val}; 894 struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val};
740 char manufacturer[10];
741 895
742 /* IR remote controller */ 896 /* IR remote controller */
743 req.addr = AF9015_EEPROM_IR_MODE; 897 req.addr = AF9015_EEPROM_IR_MODE;
@@ -759,153 +913,8 @@ static int af9015_read_config(struct usb_device *udev)
759 if (val == AF9015_IR_MODE_DISABLED) { 913 if (val == AF9015_IR_MODE_DISABLED) {
760 af9015_properties[i].rc_key_map = NULL; 914 af9015_properties[i].rc_key_map = NULL;
761 af9015_properties[i].rc_key_map_size = 0; 915 af9015_properties[i].rc_key_map_size = 0;
762 } else if (dvb_usb_af9015_remote) { 916 } else
763 /* load remote defined as module param */ 917 af9015_set_remote_config(udev, &af9015_properties[i]);
764 switch (dvb_usb_af9015_remote) {
765 case AF9015_REMOTE_A_LINK_DTU_M:
766 af9015_properties[i].rc_key_map =
767 af9015_rc_keys_a_link;
768 af9015_properties[i].rc_key_map_size =
769 ARRAY_SIZE(af9015_rc_keys_a_link);
770 af9015_config.ir_table = af9015_ir_table_a_link;
771 af9015_config.ir_table_size =
772 ARRAY_SIZE(af9015_ir_table_a_link);
773 break;
774 case AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3:
775 af9015_properties[i].rc_key_map =
776 af9015_rc_keys_msi;
777 af9015_properties[i].rc_key_map_size =
778 ARRAY_SIZE(af9015_rc_keys_msi);
779 af9015_config.ir_table = af9015_ir_table_msi;
780 af9015_config.ir_table_size =
781 ARRAY_SIZE(af9015_ir_table_msi);
782 break;
783 case AF9015_REMOTE_MYGICTV_U718:
784 af9015_properties[i].rc_key_map =
785 af9015_rc_keys_mygictv;
786 af9015_properties[i].rc_key_map_size =
787 ARRAY_SIZE(af9015_rc_keys_mygictv);
788 af9015_config.ir_table =
789 af9015_ir_table_mygictv;
790 af9015_config.ir_table_size =
791 ARRAY_SIZE(af9015_ir_table_mygictv);
792 break;
793 case AF9015_REMOTE_DIGITTRADE_DVB_T:
794 af9015_properties[i].rc_key_map =
795 af9015_rc_keys_digittrade;
796 af9015_properties[i].rc_key_map_size =
797 ARRAY_SIZE(af9015_rc_keys_digittrade);
798 af9015_config.ir_table =
799 af9015_ir_table_digittrade;
800 af9015_config.ir_table_size =
801 ARRAY_SIZE(af9015_ir_table_digittrade);
802 break;
803 case AF9015_REMOTE_AVERMEDIA_KS:
804 af9015_properties[i].rc_key_map =
805 af9015_rc_keys_avermedia;
806 af9015_properties[i].rc_key_map_size =
807 ARRAY_SIZE(af9015_rc_keys_avermedia);
808 af9015_config.ir_table =
809 af9015_ir_table_avermedia_ks;
810 af9015_config.ir_table_size =
811 ARRAY_SIZE(af9015_ir_table_avermedia_ks);
812 break;
813 }
814 } else {
815 switch (le16_to_cpu(udev->descriptor.idVendor)) {
816 case USB_VID_LEADTEK:
817 af9015_properties[i].rc_key_map =
818 af9015_rc_keys_leadtek;
819 af9015_properties[i].rc_key_map_size =
820 ARRAY_SIZE(af9015_rc_keys_leadtek);
821 af9015_config.ir_table =
822 af9015_ir_table_leadtek;
823 af9015_config.ir_table_size =
824 ARRAY_SIZE(af9015_ir_table_leadtek);
825 break;
826 case USB_VID_VISIONPLUS:
827 af9015_properties[i].rc_key_map =
828 af9015_rc_keys_twinhan;
829 af9015_properties[i].rc_key_map_size =
830 ARRAY_SIZE(af9015_rc_keys_twinhan);
831 af9015_config.ir_table =
832 af9015_ir_table_twinhan;
833 af9015_config.ir_table_size =
834 ARRAY_SIZE(af9015_ir_table_twinhan);
835 break;
836 case USB_VID_KWORLD_2:
837 /* TODO: use correct rc keys */
838 af9015_properties[i].rc_key_map =
839 af9015_rc_keys_twinhan;
840 af9015_properties[i].rc_key_map_size =
841 ARRAY_SIZE(af9015_rc_keys_twinhan);
842 af9015_config.ir_table = af9015_ir_table_kworld;
843 af9015_config.ir_table_size =
844 ARRAY_SIZE(af9015_ir_table_kworld);
845 break;
846 /* Check USB manufacturer and product strings and try
847 to determine correct remote in case of chip vendor
848 reference IDs are used. */
849 case USB_VID_AFATECH:
850 memset(manufacturer, 0, sizeof(manufacturer));
851 usb_string(udev, udev->descriptor.iManufacturer,
852 manufacturer, sizeof(manufacturer));
853 if (!strcmp("Geniatech", manufacturer)) {
854 /* iManufacturer 1 Geniatech
855 iProduct 2 AF9015 */
856 af9015_properties[i].rc_key_map =
857 af9015_rc_keys_mygictv;
858 af9015_properties[i].rc_key_map_size =
859 ARRAY_SIZE(af9015_rc_keys_mygictv);
860 af9015_config.ir_table =
861 af9015_ir_table_mygictv;
862 af9015_config.ir_table_size =
863 ARRAY_SIZE(af9015_ir_table_mygictv);
864 } else if (!strcmp("MSI", manufacturer)) {
865 /* iManufacturer 1 MSI
866 iProduct 2 MSI K-VOX */
867 af9015_properties[i].rc_key_map =
868 af9015_rc_keys_msi;
869 af9015_properties[i].rc_key_map_size =
870 ARRAY_SIZE(af9015_rc_keys_msi);
871 af9015_config.ir_table =
872 af9015_ir_table_msi;
873 af9015_config.ir_table_size =
874 ARRAY_SIZE(af9015_ir_table_msi);
875 } else if (udev->descriptor.idProduct ==
876 cpu_to_le16(USB_PID_TREKSTOR_DVBT)) {
877 af9015_properties[i].rc_key_map =
878 af9015_rc_keys_trekstor;
879 af9015_properties[i].rc_key_map_size =
880 ARRAY_SIZE(af9015_rc_keys_trekstor);
881 af9015_config.ir_table =
882 af9015_ir_table_trekstor;
883 af9015_config.ir_table_size =
884 ARRAY_SIZE(af9015_ir_table_trekstor);
885 }
886 break;
887 case USB_VID_AVERMEDIA:
888 af9015_properties[i].rc_key_map =
889 af9015_rc_keys_avermedia;
890 af9015_properties[i].rc_key_map_size =
891 ARRAY_SIZE(af9015_rc_keys_avermedia);
892 af9015_config.ir_table =
893 af9015_ir_table_avermedia;
894 af9015_config.ir_table_size =
895 ARRAY_SIZE(af9015_ir_table_avermedia);
896 break;
897 case USB_VID_MSI_2:
898 af9015_properties[i].rc_key_map =
899 af9015_rc_keys_msi_digivox_iii;
900 af9015_properties[i].rc_key_map_size =
901 ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii);
902 af9015_config.ir_table =
903 af9015_ir_table_msi_digivox_iii;
904 af9015_config.ir_table_size =
905 ARRAY_SIZE(af9015_ir_table_msi_digivox_iii);
906 break;
907 }
908 }
909 } 918 }
910 919
911 /* TS mode - one or two receivers */ 920 /* TS mode - one or two receivers */