diff options
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/Kconfig | 12 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/Makefile | 3 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/af9015.c | 351 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/af9015.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/az6027.c | 1151 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/az6027.h | 14 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 3 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700_core.c | 197 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700_devices.c | 160 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 9 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-init.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dw2102.c | 95 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/friio-fe.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.c | 141 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/opera1.c | 2 |
18 files changed, 1808 insertions, 339 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 1b249897c9fb..e5f91f16ffa4 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -112,11 +112,13 @@ config DVB_USB_CXUSB | |||
112 | select DVB_MT352 if !DVB_FE_CUSTOMISE | 112 | select DVB_MT352 if !DVB_FE_CUSTOMISE |
113 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | 113 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
114 | select DVB_DIB7000P if !DVB_FE_CUSTOMISE | 114 | select DVB_DIB7000P if !DVB_FE_CUSTOMISE |
115 | select DVB_LGS8GL5 if !DVB_FE_CUSTOMISE | ||
116 | select DVB_TUNER_DIB0070 if !DVB_FE_CUSTOMISE | 115 | select DVB_TUNER_DIB0070 if !DVB_FE_CUSTOMISE |
116 | select DVB_ATBM8830 if !DVB_FE_CUSTOMISE | ||
117 | select DVB_LGS8GXX if !DVB_FE_CUSTOMISE | ||
117 | select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE | 118 | select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE |
118 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE | 119 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE |
119 | select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE | 120 | select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE |
121 | select MEDIA_TUNER_MAX2165 if !MEDIA_TUNER_CUSTOMISE | ||
120 | help | 122 | help |
121 | Say Y here to support the Conexant USB2.0 hybrid reference design. | 123 | Say Y here to support the Conexant USB2.0 hybrid reference design. |
122 | Currently, only DVB and ATSC modes are supported, analog mode | 124 | Currently, only DVB and ATSC modes are supported, analog mode |
@@ -334,3 +336,11 @@ config DVB_USB_EC168 | |||
334 | select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE | 336 | select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE |
335 | help | 337 | help |
336 | Say Y here to support the E3C EC168 DVB-T USB2.0 receiver. | 338 | Say Y here to support the E3C EC168 DVB-T USB2.0 receiver. |
339 | |||
340 | config DVB_USB_AZ6027 | ||
341 | tristate "Azurewave DVB-S/S2 USB2.0 AZ6027 support" | ||
342 | depends on DVB_USB | ||
343 | select DVB_STB0899 if !DVB_FE_CUSTOMISE | ||
344 | select DVB_STB6100 if !DVB_FE_CUSTOMISE | ||
345 | help | ||
346 | Say Y here to support the AZ6027 device | ||
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 72c92cb69a22..1a192453b0e7 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -85,6 +85,9 @@ obj-$(CONFIG_DVB_USB_FRIIO) += dvb-usb-friio.o | |||
85 | dvb-usb-ec168-objs = ec168.o | 85 | dvb-usb-ec168-objs = ec168.o |
86 | obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o | 86 | obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o |
87 | 87 | ||
88 | dvb-usb-az6027-objs = az6027.o | ||
89 | obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o | ||
90 | |||
88 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 91 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
89 | # due to tuner-xc3028 | 92 | # due to tuner-xc3028 |
90 | EXTRA_CFLAGS += -Idrivers/media/common/tuners | 93 | EXTRA_CFLAGS += -Idrivers/media/common/tuners |
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 8b60a601fb82..d7975383d31b 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c | |||
@@ -21,6 +21,8 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/hash.h> | ||
25 | |||
24 | #include "af9015.h" | 26 | #include "af9015.h" |
25 | #include "af9013.h" | 27 | #include "af9013.h" |
26 | #include "mt2060.h" | 28 | #include "mt2060.h" |
@@ -553,26 +555,45 @@ exit: | |||
553 | return ret; | 555 | return ret; |
554 | } | 556 | } |
555 | 557 | ||
556 | /* dump eeprom */ | 558 | /* hash (and dump) eeprom */ |
557 | static int af9015_eeprom_dump(struct dvb_usb_device *d) | 559 | static int af9015_eeprom_hash(struct usb_device *udev) |
558 | { | 560 | { |
559 | u8 reg, val; | 561 | static const unsigned int eeprom_size = 256; |
562 | unsigned int reg; | ||
563 | int ret; | ||
564 | u8 val, *eeprom; | ||
565 | struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val}; | ||
560 | 566 | ||
561 | for (reg = 0; ; reg++) { | 567 | eeprom = kmalloc(eeprom_size, GFP_KERNEL); |
562 | if (reg % 16 == 0) { | 568 | if (eeprom == NULL) |
563 | if (reg) | 569 | return -ENOMEM; |
564 | deb_info(KERN_CONT "\n"); | 570 | |
565 | deb_info(KERN_DEBUG "%02x:", reg); | 571 | for (reg = 0; reg < eeprom_size; reg++) { |
566 | } | 572 | req.addr = reg; |
567 | if (af9015_read_reg_i2c(d, AF9015_I2C_EEPROM, reg, &val) == 0) | 573 | ret = af9015_rw_udev(udev, &req); |
568 | deb_info(KERN_CONT " %02x", val); | 574 | if (ret) |
569 | else | 575 | goto free; |
570 | deb_info(KERN_CONT " --"); | 576 | eeprom[reg] = val; |
571 | if (reg == 0xff) | ||
572 | break; | ||
573 | } | 577 | } |
574 | deb_info(KERN_CONT "\n"); | 578 | |
575 | return 0; | 579 | if (dvb_usb_af9015_debug & 0x01) |
580 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, eeprom, | ||
581 | eeprom_size); | ||
582 | |||
583 | BUG_ON(eeprom_size % 4); | ||
584 | |||
585 | af9015_config.eeprom_sum = 0; | ||
586 | for (reg = 0; reg < eeprom_size / sizeof(u32); reg++) { | ||
587 | af9015_config.eeprom_sum *= GOLDEN_RATIO_PRIME_32; | ||
588 | af9015_config.eeprom_sum += le32_to_cpu(((u32 *)eeprom)[reg]); | ||
589 | } | ||
590 | |||
591 | deb_info("%s: eeprom sum=%.8x\n", __func__, af9015_config.eeprom_sum); | ||
592 | |||
593 | ret = 0; | ||
594 | free: | ||
595 | kfree(eeprom); | ||
596 | return ret; | ||
576 | } | 597 | } |
577 | 598 | ||
578 | static int af9015_download_ir_table(struct dvb_usb_device *d) | 599 | static int af9015_download_ir_table(struct dvb_usb_device *d) |
@@ -711,12 +732,132 @@ error: | |||
711 | return ret; | 732 | return ret; |
712 | } | 733 | } |
713 | 734 | ||
735 | struct af9015_setup { | ||
736 | unsigned int id; | ||
737 | struct dvb_usb_rc_key *rc_key_map; | ||
738 | unsigned int rc_key_map_size; | ||
739 | u8 *ir_table; | ||
740 | unsigned int ir_table_size; | ||
741 | }; | ||
742 | |||
743 | static const struct af9015_setup *af9015_setup_match(unsigned int id, | ||
744 | const struct af9015_setup *table) | ||
745 | { | ||
746 | for (; table->rc_key_map; table++) | ||
747 | if (table->id == id) | ||
748 | return table; | ||
749 | return NULL; | ||
750 | } | ||
751 | |||
752 | static const struct af9015_setup af9015_setup_modparam[] = { | ||
753 | { AF9015_REMOTE_A_LINK_DTU_M, | ||
754 | af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link), | ||
755 | af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, | ||
756 | { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, | ||
757 | af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi), | ||
758 | af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, | ||
759 | { AF9015_REMOTE_MYGICTV_U718, | ||
760 | af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv), | ||
761 | af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, | ||
762 | { AF9015_REMOTE_DIGITTRADE_DVB_T, | ||
763 | af9015_rc_keys_digittrade, ARRAY_SIZE(af9015_rc_keys_digittrade), | ||
764 | af9015_ir_table_digittrade, ARRAY_SIZE(af9015_ir_table_digittrade) }, | ||
765 | { AF9015_REMOTE_AVERMEDIA_KS, | ||
766 | af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia), | ||
767 | af9015_ir_table_avermedia_ks, ARRAY_SIZE(af9015_ir_table_avermedia_ks) }, | ||
768 | { } | ||
769 | }; | ||
770 | |||
771 | /* don't add new entries here anymore, use hashes instead */ | ||
772 | static const struct af9015_setup af9015_setup_usbids[] = { | ||
773 | { USB_VID_LEADTEK, | ||
774 | af9015_rc_keys_leadtek, ARRAY_SIZE(af9015_rc_keys_leadtek), | ||
775 | af9015_ir_table_leadtek, ARRAY_SIZE(af9015_ir_table_leadtek) }, | ||
776 | { USB_VID_VISIONPLUS, | ||
777 | af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan), | ||
778 | af9015_ir_table_twinhan, ARRAY_SIZE(af9015_ir_table_twinhan) }, | ||
779 | { USB_VID_KWORLD_2, /* TODO: use correct rc keys */ | ||
780 | af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan), | ||
781 | af9015_ir_table_kworld, ARRAY_SIZE(af9015_ir_table_kworld) }, | ||
782 | { USB_VID_AVERMEDIA, | ||
783 | af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia), | ||
784 | af9015_ir_table_avermedia, ARRAY_SIZE(af9015_ir_table_avermedia) }, | ||
785 | { USB_VID_MSI_2, | ||
786 | af9015_rc_keys_msi_digivox_iii, ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii), | ||
787 | af9015_ir_table_msi_digivox_iii, ARRAY_SIZE(af9015_ir_table_msi_digivox_iii) }, | ||
788 | { } | ||
789 | }; | ||
790 | |||
791 | static const struct af9015_setup af9015_setup_hashes[] = { | ||
792 | { 0xb8feb708, | ||
793 | af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi), | ||
794 | af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, | ||
795 | { 0xa3703d00, | ||
796 | af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link), | ||
797 | af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, | ||
798 | { 0x9b7dc64e, | ||
799 | af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv), | ||
800 | af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, | ||
801 | { } | ||
802 | }; | ||
803 | |||
804 | static void af9015_set_remote_config(struct usb_device *udev, | ||
805 | struct dvb_usb_device_properties *props) | ||
806 | { | ||
807 | const struct af9015_setup *table = NULL; | ||
808 | |||
809 | if (dvb_usb_af9015_remote) { | ||
810 | /* load remote defined as module param */ | ||
811 | table = af9015_setup_match(dvb_usb_af9015_remote, | ||
812 | af9015_setup_modparam); | ||
813 | } else { | ||
814 | u16 vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
815 | |||
816 | table = af9015_setup_match(af9015_config.eeprom_sum, | ||
817 | af9015_setup_hashes); | ||
818 | |||
819 | if (!table && vendor == USB_VID_AFATECH) { | ||
820 | /* Check USB manufacturer and product strings and try | ||
821 | to determine correct remote in case of chip vendor | ||
822 | reference IDs are used. | ||
823 | DO NOT ADD ANYTHING NEW HERE. Use hashes instead. | ||
824 | */ | ||
825 | char manufacturer[10]; | ||
826 | memset(manufacturer, 0, sizeof(manufacturer)); | ||
827 | usb_string(udev, udev->descriptor.iManufacturer, | ||
828 | manufacturer, sizeof(manufacturer)); | ||
829 | if (!strcmp("MSI", manufacturer)) { | ||
830 | /* iManufacturer 1 MSI | ||
831 | iProduct 2 MSI K-VOX */ | ||
832 | table = af9015_setup_match( | ||
833 | AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, | ||
834 | af9015_setup_modparam); | ||
835 | } else if (udev->descriptor.idProduct == | ||
836 | cpu_to_le16(USB_PID_TREKSTOR_DVBT)) { | ||
837 | table = &(const struct af9015_setup){ 0, | ||
838 | af9015_rc_keys_trekstor, | ||
839 | ARRAY_SIZE(af9015_rc_keys_trekstor), | ||
840 | af9015_ir_table_trekstor, | ||
841 | ARRAY_SIZE(af9015_ir_table_trekstor) | ||
842 | }; | ||
843 | } | ||
844 | } else if (!table) | ||
845 | table = af9015_setup_match(vendor, af9015_setup_usbids); | ||
846 | } | ||
847 | |||
848 | if (table) { | ||
849 | props->rc_key_map = table->rc_key_map; | ||
850 | props->rc_key_map_size = table->rc_key_map_size; | ||
851 | af9015_config.ir_table = table->ir_table; | ||
852 | af9015_config.ir_table_size = table->ir_table_size; | ||
853 | } | ||
854 | } | ||
855 | |||
714 | static int af9015_read_config(struct usb_device *udev) | 856 | static int af9015_read_config(struct usb_device *udev) |
715 | { | 857 | { |
716 | int ret; | 858 | int ret; |
717 | u8 val, i, offset = 0; | 859 | u8 val, i, offset = 0; |
718 | struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val}; | 860 | struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val}; |
719 | char manufacturer[10]; | ||
720 | 861 | ||
721 | /* IR remote controller */ | 862 | /* IR remote controller */ |
722 | req.addr = AF9015_EEPROM_IR_MODE; | 863 | req.addr = AF9015_EEPROM_IR_MODE; |
@@ -728,158 +869,18 @@ static int af9015_read_config(struct usb_device *udev) | |||
728 | } | 869 | } |
729 | if (ret) | 870 | if (ret) |
730 | goto error; | 871 | goto error; |
872 | |||
873 | ret = af9015_eeprom_hash(udev); | ||
874 | if (ret) | ||
875 | goto error; | ||
876 | |||
731 | deb_info("%s: IR mode:%d\n", __func__, val); | 877 | deb_info("%s: IR mode:%d\n", __func__, val); |
732 | for (i = 0; i < af9015_properties_count; i++) { | 878 | for (i = 0; i < af9015_properties_count; i++) { |
733 | if (val == AF9015_IR_MODE_DISABLED) { | 879 | if (val == AF9015_IR_MODE_DISABLED) { |
734 | af9015_properties[i].rc_key_map = NULL; | 880 | af9015_properties[i].rc_key_map = NULL; |
735 | af9015_properties[i].rc_key_map_size = 0; | 881 | af9015_properties[i].rc_key_map_size = 0; |
736 | } else if (dvb_usb_af9015_remote) { | 882 | } else |
737 | /* load remote defined as module param */ | 883 | af9015_set_remote_config(udev, &af9015_properties[i]); |
738 | switch (dvb_usb_af9015_remote) { | ||
739 | case AF9015_REMOTE_A_LINK_DTU_M: | ||
740 | af9015_properties[i].rc_key_map = | ||
741 | af9015_rc_keys_a_link; | ||
742 | af9015_properties[i].rc_key_map_size = | ||
743 | ARRAY_SIZE(af9015_rc_keys_a_link); | ||
744 | af9015_config.ir_table = af9015_ir_table_a_link; | ||
745 | af9015_config.ir_table_size = | ||
746 | ARRAY_SIZE(af9015_ir_table_a_link); | ||
747 | break; | ||
748 | case AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3: | ||
749 | af9015_properties[i].rc_key_map = | ||
750 | af9015_rc_keys_msi; | ||
751 | af9015_properties[i].rc_key_map_size = | ||
752 | ARRAY_SIZE(af9015_rc_keys_msi); | ||
753 | af9015_config.ir_table = af9015_ir_table_msi; | ||
754 | af9015_config.ir_table_size = | ||
755 | ARRAY_SIZE(af9015_ir_table_msi); | ||
756 | break; | ||
757 | case AF9015_REMOTE_MYGICTV_U718: | ||
758 | af9015_properties[i].rc_key_map = | ||
759 | af9015_rc_keys_mygictv; | ||
760 | af9015_properties[i].rc_key_map_size = | ||
761 | ARRAY_SIZE(af9015_rc_keys_mygictv); | ||
762 | af9015_config.ir_table = | ||
763 | af9015_ir_table_mygictv; | ||
764 | af9015_config.ir_table_size = | ||
765 | ARRAY_SIZE(af9015_ir_table_mygictv); | ||
766 | break; | ||
767 | case AF9015_REMOTE_DIGITTRADE_DVB_T: | ||
768 | af9015_properties[i].rc_key_map = | ||
769 | af9015_rc_keys_digittrade; | ||
770 | af9015_properties[i].rc_key_map_size = | ||
771 | ARRAY_SIZE(af9015_rc_keys_digittrade); | ||
772 | af9015_config.ir_table = | ||
773 | af9015_ir_table_digittrade; | ||
774 | af9015_config.ir_table_size = | ||
775 | ARRAY_SIZE(af9015_ir_table_digittrade); | ||
776 | break; | ||
777 | case AF9015_REMOTE_AVERMEDIA_KS: | ||
778 | af9015_properties[i].rc_key_map = | ||
779 | af9015_rc_keys_avermedia; | ||
780 | af9015_properties[i].rc_key_map_size = | ||
781 | ARRAY_SIZE(af9015_rc_keys_avermedia); | ||
782 | af9015_config.ir_table = | ||
783 | af9015_ir_table_avermedia_ks; | ||
784 | af9015_config.ir_table_size = | ||
785 | ARRAY_SIZE(af9015_ir_table_avermedia_ks); | ||
786 | break; | ||
787 | } | ||
788 | } else { | ||
789 | switch (le16_to_cpu(udev->descriptor.idVendor)) { | ||
790 | case USB_VID_LEADTEK: | ||
791 | af9015_properties[i].rc_key_map = | ||
792 | af9015_rc_keys_leadtek; | ||
793 | af9015_properties[i].rc_key_map_size = | ||
794 | ARRAY_SIZE(af9015_rc_keys_leadtek); | ||
795 | af9015_config.ir_table = | ||
796 | af9015_ir_table_leadtek; | ||
797 | af9015_config.ir_table_size = | ||
798 | ARRAY_SIZE(af9015_ir_table_leadtek); | ||
799 | break; | ||
800 | case USB_VID_VISIONPLUS: | ||
801 | af9015_properties[i].rc_key_map = | ||
802 | af9015_rc_keys_twinhan; | ||
803 | af9015_properties[i].rc_key_map_size = | ||
804 | ARRAY_SIZE(af9015_rc_keys_twinhan); | ||
805 | af9015_config.ir_table = | ||
806 | af9015_ir_table_twinhan; | ||
807 | af9015_config.ir_table_size = | ||
808 | ARRAY_SIZE(af9015_ir_table_twinhan); | ||
809 | break; | ||
810 | case USB_VID_KWORLD_2: | ||
811 | /* TODO: use correct rc keys */ | ||
812 | af9015_properties[i].rc_key_map = | ||
813 | af9015_rc_keys_twinhan; | ||
814 | af9015_properties[i].rc_key_map_size = | ||
815 | ARRAY_SIZE(af9015_rc_keys_twinhan); | ||
816 | af9015_config.ir_table = af9015_ir_table_kworld; | ||
817 | af9015_config.ir_table_size = | ||
818 | ARRAY_SIZE(af9015_ir_table_kworld); | ||
819 | break; | ||
820 | /* Check USB manufacturer and product strings and try | ||
821 | to determine correct remote in case of chip vendor | ||
822 | reference IDs are used. */ | ||
823 | case USB_VID_AFATECH: | ||
824 | memset(manufacturer, 0, sizeof(manufacturer)); | ||
825 | usb_string(udev, udev->descriptor.iManufacturer, | ||
826 | manufacturer, sizeof(manufacturer)); | ||
827 | if (!strcmp("Geniatech", manufacturer)) { | ||
828 | /* iManufacturer 1 Geniatech | ||
829 | iProduct 2 AF9015 */ | ||
830 | af9015_properties[i].rc_key_map = | ||
831 | af9015_rc_keys_mygictv; | ||
832 | af9015_properties[i].rc_key_map_size = | ||
833 | ARRAY_SIZE(af9015_rc_keys_mygictv); | ||
834 | af9015_config.ir_table = | ||
835 | af9015_ir_table_mygictv; | ||
836 | af9015_config.ir_table_size = | ||
837 | ARRAY_SIZE(af9015_ir_table_mygictv); | ||
838 | } else if (!strcmp("MSI", manufacturer)) { | ||
839 | /* iManufacturer 1 MSI | ||
840 | iProduct 2 MSI K-VOX */ | ||
841 | af9015_properties[i].rc_key_map = | ||
842 | af9015_rc_keys_msi; | ||
843 | af9015_properties[i].rc_key_map_size = | ||
844 | ARRAY_SIZE(af9015_rc_keys_msi); | ||
845 | af9015_config.ir_table = | ||
846 | af9015_ir_table_msi; | ||
847 | af9015_config.ir_table_size = | ||
848 | ARRAY_SIZE(af9015_ir_table_msi); | ||
849 | } else if (udev->descriptor.idProduct == | ||
850 | cpu_to_le16(USB_PID_TREKSTOR_DVBT)) { | ||
851 | af9015_properties[i].rc_key_map = | ||
852 | af9015_rc_keys_trekstor; | ||
853 | af9015_properties[i].rc_key_map_size = | ||
854 | ARRAY_SIZE(af9015_rc_keys_trekstor); | ||
855 | af9015_config.ir_table = | ||
856 | af9015_ir_table_trekstor; | ||
857 | af9015_config.ir_table_size = | ||
858 | ARRAY_SIZE(af9015_ir_table_trekstor); | ||
859 | } | ||
860 | break; | ||
861 | case USB_VID_AVERMEDIA: | ||
862 | af9015_properties[i].rc_key_map = | ||
863 | af9015_rc_keys_avermedia; | ||
864 | af9015_properties[i].rc_key_map_size = | ||
865 | ARRAY_SIZE(af9015_rc_keys_avermedia); | ||
866 | af9015_config.ir_table = | ||
867 | af9015_ir_table_avermedia; | ||
868 | af9015_config.ir_table_size = | ||
869 | ARRAY_SIZE(af9015_ir_table_avermedia); | ||
870 | break; | ||
871 | case USB_VID_MSI_2: | ||
872 | af9015_properties[i].rc_key_map = | ||
873 | af9015_rc_keys_msi_digivox_iii; | ||
874 | af9015_properties[i].rc_key_map_size = | ||
875 | ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii); | ||
876 | af9015_config.ir_table = | ||
877 | af9015_ir_table_msi_digivox_iii; | ||
878 | af9015_config.ir_table_size = | ||
879 | ARRAY_SIZE(af9015_ir_table_msi_digivox_iii); | ||
880 | break; | ||
881 | } | ||
882 | } | ||
883 | } | 884 | } |
884 | 885 | ||
885 | /* TS mode - one or two receivers */ | 886 | /* TS mode - one or two receivers */ |
@@ -1001,6 +1002,9 @@ static int af9015_read_config(struct usb_device *udev) | |||
1001 | af9015_af9013_config[i].gpio[1] = AF9013_GPIO_LO; | 1002 | af9015_af9013_config[i].gpio[1] = AF9013_GPIO_LO; |
1002 | af9015_af9013_config[i].rf_spec_inv = 1; | 1003 | af9015_af9013_config[i].rf_spec_inv = 1; |
1003 | break; | 1004 | break; |
1005 | case AF9013_TUNER_TDA18218: | ||
1006 | warn("tuner NXP TDA18218 not supported yet"); | ||
1007 | return -ENODEV; | ||
1004 | default: | 1008 | default: |
1005 | warn("tuner id:%d not supported, please report!", val); | 1009 | warn("tuner id:%d not supported, please report!", val); |
1006 | return -ENODEV; | 1010 | return -ENODEV; |
@@ -1125,11 +1129,6 @@ static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap) | |||
1125 | 1129 | ||
1126 | deb_info("%s: init I2C\n", __func__); | 1130 | deb_info("%s: init I2C\n", __func__); |
1127 | ret = af9015_i2c_init(adap->dev); | 1131 | ret = af9015_i2c_init(adap->dev); |
1128 | |||
1129 | /* dump eeprom (debug) */ | ||
1130 | ret = af9015_eeprom_dump(adap->dev); | ||
1131 | if (ret) | ||
1132 | return ret; | ||
1133 | } else { | 1132 | } else { |
1134 | /* select I2C adapter */ | 1133 | /* select I2C adapter */ |
1135 | i2c_adap = &state->i2c_adap; | 1134 | i2c_adap = &state->i2c_adap; |
@@ -1295,6 +1294,8 @@ static struct usb_device_id af9015_usb_table[] = { | |||
1295 | /* 25 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U_2)}, | 1294 | /* 25 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U_2)}, |
1296 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_PC160_T)}, | 1295 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_PC160_T)}, |
1297 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20)}, | 1296 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20)}, |
1297 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_TINYTWIN_2)}, | ||
1298 | {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, | ||
1298 | {0}, | 1299 | {0}, |
1299 | }; | 1300 | }; |
1300 | MODULE_DEVICE_TABLE(usb, af9015_usb_table); | 1301 | MODULE_DEVICE_TABLE(usb, af9015_usb_table); |
@@ -1381,7 +1382,8 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1381 | }, | 1382 | }, |
1382 | { | 1383 | { |
1383 | .name = "DigitalNow TinyTwin DVB-T Receiver", | 1384 | .name = "DigitalNow TinyTwin DVB-T Receiver", |
1384 | .cold_ids = {&af9015_usb_table[5], NULL}, | 1385 | .cold_ids = {&af9015_usb_table[5], |
1386 | &af9015_usb_table[28], NULL}, | ||
1385 | .warm_ids = {NULL}, | 1387 | .warm_ids = {NULL}, |
1386 | }, | 1388 | }, |
1387 | { | 1389 | { |
@@ -1566,7 +1568,7 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1566 | 1568 | ||
1567 | .i2c_algo = &af9015_i2c_algo, | 1569 | .i2c_algo = &af9015_i2c_algo, |
1568 | 1570 | ||
1569 | .num_device_descs = 6, /* max 9 */ | 1571 | .num_device_descs = 7, /* max 9 */ |
1570 | .devices = { | 1572 | .devices = { |
1571 | { | 1573 | { |
1572 | .name = "AverMedia AVerTV Volar GPS 805 (A805)", | 1574 | .name = "AverMedia AVerTV Volar GPS 805 (A805)", |
@@ -1600,6 +1602,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1600 | .cold_ids = {&af9015_usb_table[27], NULL}, | 1602 | .cold_ids = {&af9015_usb_table[27], NULL}, |
1601 | .warm_ids = {NULL}, | 1603 | .warm_ids = {NULL}, |
1602 | }, | 1604 | }, |
1605 | { | ||
1606 | .name = "Leadtek WinFast DTV2000DS", | ||
1607 | .cold_ids = {&af9015_usb_table[29], NULL}, | ||
1608 | .warm_ids = {NULL}, | ||
1609 | }, | ||
1603 | } | 1610 | } |
1604 | }, | 1611 | }, |
1605 | }; | 1612 | }; |
diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h index 931c8515830d..ef36b1831490 100644 --- a/drivers/media/dvb/dvb-usb/af9015.h +++ b/drivers/media/dvb/dvb-usb/af9015.h | |||
@@ -107,6 +107,7 @@ struct af9015_config { | |||
107 | u16 mt2060_if1[2]; | 107 | u16 mt2060_if1[2]; |
108 | u16 firmware_size; | 108 | u16 firmware_size; |
109 | u16 firmware_checksum; | 109 | u16 firmware_checksum; |
110 | u32 eeprom_sum; | ||
110 | u8 *ir_table; | 111 | u8 *ir_table; |
111 | u16 ir_table_size; | 112 | u16 ir_table_size; |
112 | }; | 113 | }; |
diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c new file mode 100644 index 000000000000..d7290b2c0913 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/az6027.c | |||
@@ -0,0 +1,1151 @@ | |||
1 | /* DVB USB compliant Linux driver for the AZUREWAVE DVB-S/S2 USB2.0 (AZ6027) | ||
2 | * receiver. | ||
3 | * | ||
4 | * Copyright (C) 2009 Adams.Xu <adams.xu@azwave.com.cn> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #include "az6027.h" | ||
13 | |||
14 | #include "stb0899_drv.h" | ||
15 | #include "stb0899_reg.h" | ||
16 | #include "stb0899_cfg.h" | ||
17 | |||
18 | #include "stb6100.h" | ||
19 | #include "stb6100_cfg.h" | ||
20 | #include "dvb_ca_en50221.h" | ||
21 | |||
22 | int dvb_usb_az6027_debug; | ||
23 | module_param_named(debug, dvb_usb_az6027_debug, int, 0644); | ||
24 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | ||
25 | |||
26 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
27 | |||
28 | struct az6027_device_state { | ||
29 | struct dvb_ca_en50221 ca; | ||
30 | struct mutex ca_mutex; | ||
31 | u8 power_state; | ||
32 | }; | ||
33 | |||
34 | static const struct stb0899_s1_reg az6027_stb0899_s1_init_1[] = { | ||
35 | |||
36 | /* 0x0000000b, SYSREG */ | ||
37 | { STB0899_DEV_ID , 0x30 }, | ||
38 | { STB0899_DISCNTRL1 , 0x32 }, | ||
39 | { STB0899_DISCNTRL2 , 0x80 }, | ||
40 | { STB0899_DISRX_ST0 , 0x04 }, | ||
41 | { STB0899_DISRX_ST1 , 0x00 }, | ||
42 | { STB0899_DISPARITY , 0x00 }, | ||
43 | { STB0899_DISFIFO , 0x00 }, | ||
44 | { STB0899_DISSTATUS , 0x20 }, | ||
45 | { STB0899_DISF22 , 0x99 }, | ||
46 | { STB0899_DISF22RX , 0xa8 }, | ||
47 | /* SYSREG ? */ | ||
48 | { STB0899_ACRPRESC , 0x11 }, | ||
49 | { STB0899_ACRDIV1 , 0x0a }, | ||
50 | { STB0899_ACRDIV2 , 0x05 }, | ||
51 | { STB0899_DACR1 , 0x00 }, | ||
52 | { STB0899_DACR2 , 0x00 }, | ||
53 | { STB0899_OUTCFG , 0x00 }, | ||
54 | { STB0899_MODECFG , 0x00 }, | ||
55 | { STB0899_IRQSTATUS_3 , 0xfe }, | ||
56 | { STB0899_IRQSTATUS_2 , 0x03 }, | ||
57 | { STB0899_IRQSTATUS_1 , 0x7c }, | ||
58 | { STB0899_IRQSTATUS_0 , 0xf4 }, | ||
59 | { STB0899_IRQMSK_3 , 0xf3 }, | ||
60 | { STB0899_IRQMSK_2 , 0xfc }, | ||
61 | { STB0899_IRQMSK_1 , 0xff }, | ||
62 | { STB0899_IRQMSK_0 , 0xff }, | ||
63 | { STB0899_IRQCFG , 0x00 }, | ||
64 | { STB0899_I2CCFG , 0x88 }, | ||
65 | { STB0899_I2CRPT , 0x58 }, | ||
66 | { STB0899_IOPVALUE5 , 0x00 }, | ||
67 | { STB0899_IOPVALUE4 , 0x33 }, | ||
68 | { STB0899_IOPVALUE3 , 0x6d }, | ||
69 | { STB0899_IOPVALUE2 , 0x90 }, | ||
70 | { STB0899_IOPVALUE1 , 0x60 }, | ||
71 | { STB0899_IOPVALUE0 , 0x00 }, | ||
72 | { STB0899_GPIO00CFG , 0x82 }, | ||
73 | { STB0899_GPIO01CFG , 0x82 }, | ||
74 | { STB0899_GPIO02CFG , 0x82 }, | ||
75 | { STB0899_GPIO03CFG , 0x82 }, | ||
76 | { STB0899_GPIO04CFG , 0x82 }, | ||
77 | { STB0899_GPIO05CFG , 0x82 }, | ||
78 | { STB0899_GPIO06CFG , 0x82 }, | ||
79 | { STB0899_GPIO07CFG , 0x82 }, | ||
80 | { STB0899_GPIO08CFG , 0x82 }, | ||
81 | { STB0899_GPIO09CFG , 0x82 }, | ||
82 | { STB0899_GPIO10CFG , 0x82 }, | ||
83 | { STB0899_GPIO11CFG , 0x82 }, | ||
84 | { STB0899_GPIO12CFG , 0x82 }, | ||
85 | { STB0899_GPIO13CFG , 0x82 }, | ||
86 | { STB0899_GPIO14CFG , 0x82 }, | ||
87 | { STB0899_GPIO15CFG , 0x82 }, | ||
88 | { STB0899_GPIO16CFG , 0x82 }, | ||
89 | { STB0899_GPIO17CFG , 0x82 }, | ||
90 | { STB0899_GPIO18CFG , 0x82 }, | ||
91 | { STB0899_GPIO19CFG , 0x82 }, | ||
92 | { STB0899_GPIO20CFG , 0x82 }, | ||
93 | { STB0899_SDATCFG , 0xb8 }, | ||
94 | { STB0899_SCLTCFG , 0xba }, | ||
95 | { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */ | ||
96 | { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */ | ||
97 | { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */ | ||
98 | { STB0899_DIRCLKCFG , 0x82 }, | ||
99 | { STB0899_CLKOUT27CFG , 0x7e }, | ||
100 | { STB0899_STDBYCFG , 0x82 }, | ||
101 | { STB0899_CS0CFG , 0x82 }, | ||
102 | { STB0899_CS1CFG , 0x82 }, | ||
103 | { STB0899_DISEQCOCFG , 0x20 }, | ||
104 | { STB0899_GPIO32CFG , 0x82 }, | ||
105 | { STB0899_GPIO33CFG , 0x82 }, | ||
106 | { STB0899_GPIO34CFG , 0x82 }, | ||
107 | { STB0899_GPIO35CFG , 0x82 }, | ||
108 | { STB0899_GPIO36CFG , 0x82 }, | ||
109 | { STB0899_GPIO37CFG , 0x82 }, | ||
110 | { STB0899_GPIO38CFG , 0x82 }, | ||
111 | { STB0899_GPIO39CFG , 0x82 }, | ||
112 | { STB0899_NCOARSE , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */ | ||
113 | { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */ | ||
114 | { STB0899_FILTCTRL , 0x00 }, | ||
115 | { STB0899_SYSCTRL , 0x01 }, | ||
116 | { STB0899_STOPCLK1 , 0x20 }, | ||
117 | { STB0899_STOPCLK2 , 0x00 }, | ||
118 | { STB0899_INTBUFSTATUS , 0x00 }, | ||
119 | { STB0899_INTBUFCTRL , 0x0a }, | ||
120 | { 0xffff , 0xff }, | ||
121 | }; | ||
122 | |||
123 | static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { | ||
124 | { STB0899_DEMOD , 0x00 }, | ||
125 | { STB0899_RCOMPC , 0xc9 }, | ||
126 | { STB0899_AGC1CN , 0x01 }, | ||
127 | { STB0899_AGC1REF , 0x10 }, | ||
128 | { STB0899_RTC , 0x23 }, | ||
129 | { STB0899_TMGCFG , 0x4e }, | ||
130 | { STB0899_AGC2REF , 0x34 }, | ||
131 | { STB0899_TLSR , 0x84 }, | ||
132 | { STB0899_CFD , 0xf7 }, | ||
133 | { STB0899_ACLC , 0x87 }, | ||
134 | { STB0899_BCLC , 0x94 }, | ||
135 | { STB0899_EQON , 0x41 }, | ||
136 | { STB0899_LDT , 0xf1 }, | ||
137 | { STB0899_LDT2 , 0xe3 }, | ||
138 | { STB0899_EQUALREF , 0xb4 }, | ||
139 | { STB0899_TMGRAMP , 0x10 }, | ||
140 | { STB0899_TMGTHD , 0x30 }, | ||
141 | { STB0899_IDCCOMP , 0xfd }, | ||
142 | { STB0899_QDCCOMP , 0xff }, | ||
143 | { STB0899_POWERI , 0x0c }, | ||
144 | { STB0899_POWERQ , 0x0f }, | ||
145 | { STB0899_RCOMP , 0x6c }, | ||
146 | { STB0899_AGCIQIN , 0x80 }, | ||
147 | { STB0899_AGC2I1 , 0x06 }, | ||
148 | { STB0899_AGC2I2 , 0x00 }, | ||
149 | { STB0899_TLIR , 0x30 }, | ||
150 | { STB0899_RTF , 0x7f }, | ||
151 | { STB0899_DSTATUS , 0x00 }, | ||
152 | { STB0899_LDI , 0xbc }, | ||
153 | { STB0899_CFRM , 0xea }, | ||
154 | { STB0899_CFRL , 0x31 }, | ||
155 | { STB0899_NIRM , 0x2b }, | ||
156 | { STB0899_NIRL , 0x80 }, | ||
157 | { STB0899_ISYMB , 0x1d }, | ||
158 | { STB0899_QSYMB , 0xa6 }, | ||
159 | { STB0899_SFRH , 0x2f }, | ||
160 | { STB0899_SFRM , 0x68 }, | ||
161 | { STB0899_SFRL , 0x40 }, | ||
162 | { STB0899_SFRUPH , 0x2f }, | ||
163 | { STB0899_SFRUPM , 0x68 }, | ||
164 | { STB0899_SFRUPL , 0x40 }, | ||
165 | { STB0899_EQUAI1 , 0x02 }, | ||
166 | { STB0899_EQUAQ1 , 0xff }, | ||
167 | { STB0899_EQUAI2 , 0x04 }, | ||
168 | { STB0899_EQUAQ2 , 0x05 }, | ||
169 | { STB0899_EQUAI3 , 0x02 }, | ||
170 | { STB0899_EQUAQ3 , 0xfd }, | ||
171 | { STB0899_EQUAI4 , 0x03 }, | ||
172 | { STB0899_EQUAQ4 , 0x07 }, | ||
173 | { STB0899_EQUAI5 , 0x08 }, | ||
174 | { STB0899_EQUAQ5 , 0xf5 }, | ||
175 | { STB0899_DSTATUS2 , 0x00 }, | ||
176 | { STB0899_VSTATUS , 0x00 }, | ||
177 | { STB0899_VERROR , 0x86 }, | ||
178 | { STB0899_IQSWAP , 0x2a }, | ||
179 | { STB0899_ECNT1M , 0x00 }, | ||
180 | { STB0899_ECNT1L , 0x00 }, | ||
181 | { STB0899_ECNT2M , 0x00 }, | ||
182 | { STB0899_ECNT2L , 0x00 }, | ||
183 | { STB0899_ECNT3M , 0x0a }, | ||
184 | { STB0899_ECNT3L , 0xad }, | ||
185 | { STB0899_FECAUTO1 , 0x06 }, | ||
186 | { STB0899_FECM , 0x01 }, | ||
187 | { STB0899_VTH12 , 0xb0 }, | ||
188 | { STB0899_VTH23 , 0x7a }, | ||
189 | { STB0899_VTH34 , 0x58 }, | ||
190 | { STB0899_VTH56 , 0x38 }, | ||
191 | { STB0899_VTH67 , 0x34 }, | ||
192 | { STB0899_VTH78 , 0x24 }, | ||
193 | { STB0899_PRVIT , 0xff }, | ||
194 | { STB0899_VITSYNC , 0x19 }, | ||
195 | { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ | ||
196 | { STB0899_TSULC , 0x42 }, | ||
197 | { STB0899_RSLLC , 0x41 }, | ||
198 | { STB0899_TSLPL , 0x12 }, | ||
199 | { STB0899_TSCFGH , 0x0c }, | ||
200 | { STB0899_TSCFGM , 0x00 }, | ||
201 | { STB0899_TSCFGL , 0x00 }, | ||
202 | { STB0899_TSOUT , 0x69 }, /* 0x0d for CAM */ | ||
203 | { STB0899_RSSYNCDEL , 0x00 }, | ||
204 | { STB0899_TSINHDELH , 0x02 }, | ||
205 | { STB0899_TSINHDELM , 0x00 }, | ||
206 | { STB0899_TSINHDELL , 0x00 }, | ||
207 | { STB0899_TSLLSTKM , 0x1b }, | ||
208 | { STB0899_TSLLSTKL , 0xb3 }, | ||
209 | { STB0899_TSULSTKM , 0x00 }, | ||
210 | { STB0899_TSULSTKL , 0x00 }, | ||
211 | { STB0899_PCKLENUL , 0xbc }, | ||
212 | { STB0899_PCKLENLL , 0xcc }, | ||
213 | { STB0899_RSPCKLEN , 0xbd }, | ||
214 | { STB0899_TSSTATUS , 0x90 }, | ||
215 | { STB0899_ERRCTRL1 , 0xb6 }, | ||
216 | { STB0899_ERRCTRL2 , 0x95 }, | ||
217 | { STB0899_ERRCTRL3 , 0x8d }, | ||
218 | { STB0899_DMONMSK1 , 0x27 }, | ||
219 | { STB0899_DMONMSK0 , 0x03 }, | ||
220 | { STB0899_DEMAPVIT , 0x5c }, | ||
221 | { STB0899_PLPARM , 0x19 }, | ||
222 | { STB0899_PDELCTRL , 0x48 }, | ||
223 | { STB0899_PDELCTRL2 , 0x00 }, | ||
224 | { STB0899_BBHCTRL1 , 0x00 }, | ||
225 | { STB0899_BBHCTRL2 , 0x00 }, | ||
226 | { STB0899_HYSTTHRESH , 0x77 }, | ||
227 | { STB0899_MATCSTM , 0x00 }, | ||
228 | { STB0899_MATCSTL , 0x00 }, | ||
229 | { STB0899_UPLCSTM , 0x00 }, | ||
230 | { STB0899_UPLCSTL , 0x00 }, | ||
231 | { STB0899_DFLCSTM , 0x00 }, | ||
232 | { STB0899_DFLCSTL , 0x00 }, | ||
233 | { STB0899_SYNCCST , 0x00 }, | ||
234 | { STB0899_SYNCDCSTM , 0x00 }, | ||
235 | { STB0899_SYNCDCSTL , 0x00 }, | ||
236 | { STB0899_ISI_ENTRY , 0x00 }, | ||
237 | { STB0899_ISI_BIT_EN , 0x00 }, | ||
238 | { STB0899_MATSTRM , 0xf0 }, | ||
239 | { STB0899_MATSTRL , 0x02 }, | ||
240 | { STB0899_UPLSTRM , 0x45 }, | ||
241 | { STB0899_UPLSTRL , 0x60 }, | ||
242 | { STB0899_DFLSTRM , 0xe3 }, | ||
243 | { STB0899_DFLSTRL , 0x00 }, | ||
244 | { STB0899_SYNCSTR , 0x47 }, | ||
245 | { STB0899_SYNCDSTRM , 0x05 }, | ||
246 | { STB0899_SYNCDSTRL , 0x18 }, | ||
247 | { STB0899_CFGPDELSTATUS1 , 0x19 }, | ||
248 | { STB0899_CFGPDELSTATUS2 , 0x2b }, | ||
249 | { STB0899_BBFERRORM , 0x00 }, | ||
250 | { STB0899_BBFERRORL , 0x01 }, | ||
251 | { STB0899_UPKTERRORM , 0x00 }, | ||
252 | { STB0899_UPKTERRORL , 0x00 }, | ||
253 | { 0xffff , 0xff }, | ||
254 | }; | ||
255 | |||
256 | |||
257 | |||
258 | struct stb0899_config az6027_stb0899_config = { | ||
259 | .init_dev = az6027_stb0899_s1_init_1, | ||
260 | .init_s2_demod = stb0899_s2_init_2, | ||
261 | .init_s1_demod = az6027_stb0899_s1_init_3, | ||
262 | .init_s2_fec = stb0899_s2_init_4, | ||
263 | .init_tst = stb0899_s1_init_5, | ||
264 | |||
265 | .demod_address = 0xd0, /* 0x68, 0xd0 >> 1 */ | ||
266 | |||
267 | .xtal_freq = 27000000, | ||
268 | .inversion = IQ_SWAP_ON, /* 1 */ | ||
269 | |||
270 | .lo_clk = 76500000, | ||
271 | .hi_clk = 99000000, | ||
272 | |||
273 | .esno_ave = STB0899_DVBS2_ESNO_AVE, | ||
274 | .esno_quant = STB0899_DVBS2_ESNO_QUANT, | ||
275 | .avframes_coarse = STB0899_DVBS2_AVFRAMES_COARSE, | ||
276 | .avframes_fine = STB0899_DVBS2_AVFRAMES_FINE, | ||
277 | .miss_threshold = STB0899_DVBS2_MISS_THRESHOLD, | ||
278 | .uwp_threshold_acq = STB0899_DVBS2_UWP_THRESHOLD_ACQ, | ||
279 | .uwp_threshold_track = STB0899_DVBS2_UWP_THRESHOLD_TRACK, | ||
280 | .uwp_threshold_sof = STB0899_DVBS2_UWP_THRESHOLD_SOF, | ||
281 | .sof_search_timeout = STB0899_DVBS2_SOF_SEARCH_TIMEOUT, | ||
282 | |||
283 | .btr_nco_bits = STB0899_DVBS2_BTR_NCO_BITS, | ||
284 | .btr_gain_shift_offset = STB0899_DVBS2_BTR_GAIN_SHIFT_OFFSET, | ||
285 | .crl_nco_bits = STB0899_DVBS2_CRL_NCO_BITS, | ||
286 | .ldpc_max_iter = STB0899_DVBS2_LDPC_MAX_ITER, | ||
287 | |||
288 | .tuner_get_frequency = stb6100_get_frequency, | ||
289 | .tuner_set_frequency = stb6100_set_frequency, | ||
290 | .tuner_set_bandwidth = stb6100_set_bandwidth, | ||
291 | .tuner_get_bandwidth = stb6100_get_bandwidth, | ||
292 | .tuner_set_rfsiggain = NULL, | ||
293 | }; | ||
294 | |||
295 | struct stb6100_config az6027_stb6100_config = { | ||
296 | .tuner_address = 0xc0, | ||
297 | .refclock = 27000000, | ||
298 | }; | ||
299 | |||
300 | |||
301 | /* check for mutex FIXME */ | ||
302 | int az6027_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | ||
303 | { | ||
304 | int ret = -1; | ||
305 | if (mutex_lock_interruptible(&d->usb_mutex)) | ||
306 | return -EAGAIN; | ||
307 | |||
308 | ret = usb_control_msg(d->udev, | ||
309 | usb_rcvctrlpipe(d->udev, 0), | ||
310 | req, | ||
311 | USB_TYPE_VENDOR | USB_DIR_IN, | ||
312 | value, | ||
313 | index, | ||
314 | b, | ||
315 | blen, | ||
316 | 2000); | ||
317 | |||
318 | if (ret < 0) { | ||
319 | warn("usb in operation failed. (%d)", ret); | ||
320 | ret = -EIO; | ||
321 | } else | ||
322 | ret = 0; | ||
323 | |||
324 | deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ", req, value, index); | ||
325 | debug_dump(b, blen, deb_xfer); | ||
326 | |||
327 | mutex_unlock(&d->usb_mutex); | ||
328 | return ret; | ||
329 | } | ||
330 | |||
331 | static int az6027_usb_out_op(struct dvb_usb_device *d, | ||
332 | u8 req, | ||
333 | u16 value, | ||
334 | u16 index, | ||
335 | u8 *b, | ||
336 | int blen) | ||
337 | { | ||
338 | int ret; | ||
339 | |||
340 | deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ", req, value, index); | ||
341 | debug_dump(b, blen, deb_xfer); | ||
342 | |||
343 | if (mutex_lock_interruptible(&d->usb_mutex)) | ||
344 | return -EAGAIN; | ||
345 | |||
346 | ret = usb_control_msg(d->udev, | ||
347 | usb_sndctrlpipe(d->udev, 0), | ||
348 | req, | ||
349 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
350 | value, | ||
351 | index, | ||
352 | b, | ||
353 | blen, | ||
354 | 2000); | ||
355 | |||
356 | if (ret != blen) { | ||
357 | warn("usb out operation failed. (%d)", ret); | ||
358 | mutex_unlock(&d->usb_mutex); | ||
359 | return -EIO; | ||
360 | } else{ | ||
361 | mutex_unlock(&d->usb_mutex); | ||
362 | return 0; | ||
363 | } | ||
364 | } | ||
365 | |||
366 | static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | ||
367 | { | ||
368 | int ret; | ||
369 | u8 req; | ||
370 | u16 value; | ||
371 | u16 index; | ||
372 | int blen; | ||
373 | |||
374 | deb_info("%s %d", __func__, onoff); | ||
375 | |||
376 | req = 0xBC; | ||
377 | value = onoff; | ||
378 | index = 0; | ||
379 | blen = 0; | ||
380 | |||
381 | ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); | ||
382 | if (ret != 0) | ||
383 | warn("usb out operation failed. (%d)", ret); | ||
384 | |||
385 | return ret; | ||
386 | } | ||
387 | |||
388 | /* keys for the enclosed remote control */ | ||
389 | static struct dvb_usb_rc_key az6027_rc_keys[] = { | ||
390 | { 0x01, KEY_1 }, | ||
391 | { 0x02, KEY_2 }, | ||
392 | }; | ||
393 | |||
394 | /* remote control stuff (does not work with my box) */ | ||
395 | static int az6027_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
396 | { | ||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | /* | ||
401 | int az6027_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
402 | { | ||
403 | u8 v = onoff; | ||
404 | return az6027_usb_out_op(d,0xBC,v,3,NULL,1); | ||
405 | } | ||
406 | */ | ||
407 | |||
408 | static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca, | ||
409 | int slot, | ||
410 | int address) | ||
411 | { | ||
412 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
413 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
414 | |||
415 | int ret; | ||
416 | u8 req; | ||
417 | u16 value; | ||
418 | u16 index; | ||
419 | int blen; | ||
420 | u8 b[12]; | ||
421 | |||
422 | if (slot != 0) | ||
423 | return -EINVAL; | ||
424 | |||
425 | mutex_lock(&state->ca_mutex); | ||
426 | |||
427 | req = 0xC1; | ||
428 | value = address; | ||
429 | index = 0; | ||
430 | blen = 1; | ||
431 | |||
432 | ret = az6027_usb_in_op(d, req, value, index, b, blen); | ||
433 | if (ret < 0) { | ||
434 | warn("usb in operation failed. (%d)", ret); | ||
435 | ret = -EINVAL; | ||
436 | } else { | ||
437 | ret = b[0]; | ||
438 | } | ||
439 | |||
440 | mutex_unlock(&state->ca_mutex); | ||
441 | return ret; | ||
442 | } | ||
443 | |||
444 | static int az6027_ci_write_attribute_mem(struct dvb_ca_en50221 *ca, | ||
445 | int slot, | ||
446 | int address, | ||
447 | u8 value) | ||
448 | { | ||
449 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
450 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
451 | |||
452 | int ret; | ||
453 | u8 req; | ||
454 | u16 value1; | ||
455 | u16 index; | ||
456 | int blen; | ||
457 | |||
458 | deb_info("%s %d", __func__, slot); | ||
459 | if (slot != 0) | ||
460 | return -EINVAL; | ||
461 | |||
462 | mutex_lock(&state->ca_mutex); | ||
463 | req = 0xC2; | ||
464 | value1 = address; | ||
465 | index = value; | ||
466 | blen = 0; | ||
467 | |||
468 | ret = az6027_usb_out_op(d, req, value1, index, NULL, blen); | ||
469 | if (ret != 0) | ||
470 | warn("usb out operation failed. (%d)", ret); | ||
471 | |||
472 | mutex_unlock(&state->ca_mutex); | ||
473 | return ret; | ||
474 | } | ||
475 | |||
476 | static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca, | ||
477 | int slot, | ||
478 | u8 address) | ||
479 | { | ||
480 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
481 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
482 | |||
483 | int ret; | ||
484 | u8 req; | ||
485 | u16 value; | ||
486 | u16 index; | ||
487 | int blen; | ||
488 | u8 b[12]; | ||
489 | |||
490 | if (slot != 0) | ||
491 | return -EINVAL; | ||
492 | |||
493 | mutex_lock(&state->ca_mutex); | ||
494 | |||
495 | req = 0xC3; | ||
496 | value = address; | ||
497 | index = 0; | ||
498 | blen = 2; | ||
499 | |||
500 | ret = az6027_usb_in_op(d, req, value, index, b, blen); | ||
501 | if (ret < 0) { | ||
502 | warn("usb in operation failed. (%d)", ret); | ||
503 | ret = -EINVAL; | ||
504 | } else { | ||
505 | if (b[0] == 0) | ||
506 | warn("Read CI IO error"); | ||
507 | |||
508 | ret = b[1]; | ||
509 | deb_info("read cam data = %x from 0x%x", b[1], value); | ||
510 | } | ||
511 | |||
512 | mutex_unlock(&state->ca_mutex); | ||
513 | return ret; | ||
514 | } | ||
515 | |||
516 | static int az6027_ci_write_cam_control(struct dvb_ca_en50221 *ca, | ||
517 | int slot, | ||
518 | u8 address, | ||
519 | u8 value) | ||
520 | { | ||
521 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
522 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
523 | |||
524 | int ret; | ||
525 | u8 req; | ||
526 | u16 value1; | ||
527 | u16 index; | ||
528 | int blen; | ||
529 | |||
530 | if (slot != 0) | ||
531 | return -EINVAL; | ||
532 | |||
533 | mutex_lock(&state->ca_mutex); | ||
534 | req = 0xC4; | ||
535 | value1 = address; | ||
536 | index = value; | ||
537 | blen = 0; | ||
538 | |||
539 | ret = az6027_usb_out_op(d, req, value1, index, NULL, blen); | ||
540 | if (ret != 0) { | ||
541 | warn("usb out operation failed. (%d)", ret); | ||
542 | goto failed; | ||
543 | } | ||
544 | |||
545 | failed: | ||
546 | mutex_unlock(&state->ca_mutex); | ||
547 | return ret; | ||
548 | } | ||
549 | |||
550 | static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot) | ||
551 | { | ||
552 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
553 | |||
554 | int ret; | ||
555 | u8 req; | ||
556 | u16 value; | ||
557 | u16 index; | ||
558 | int blen; | ||
559 | u8 b[12]; | ||
560 | |||
561 | req = 0xC8; | ||
562 | value = 0; | ||
563 | index = 0; | ||
564 | blen = 1; | ||
565 | |||
566 | ret = az6027_usb_in_op(d, req, value, index, b, blen); | ||
567 | if (ret < 0) { | ||
568 | warn("usb in operation failed. (%d)", ret); | ||
569 | ret = -EIO; | ||
570 | } else{ | ||
571 | ret = b[0]; | ||
572 | } | ||
573 | return ret; | ||
574 | } | ||
575 | |||
576 | static int az6027_ci_slot_reset(struct dvb_ca_en50221 *ca, int slot) | ||
577 | { | ||
578 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
579 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
580 | |||
581 | int ret, i; | ||
582 | u8 req; | ||
583 | u16 value; | ||
584 | u16 index; | ||
585 | int blen; | ||
586 | |||
587 | mutex_lock(&state->ca_mutex); | ||
588 | |||
589 | req = 0xC6; | ||
590 | value = 1; | ||
591 | index = 0; | ||
592 | blen = 0; | ||
593 | |||
594 | ret = az6027_usb_out_op(d, req, value, index, NULL, blen); | ||
595 | if (ret != 0) { | ||
596 | warn("usb out operation failed. (%d)", ret); | ||
597 | goto failed; | ||
598 | } | ||
599 | |||
600 | msleep(500); | ||
601 | req = 0xC6; | ||
602 | value = 0; | ||
603 | index = 0; | ||
604 | blen = 0; | ||
605 | |||
606 | ret = az6027_usb_out_op(d, req, value, index, NULL, blen); | ||
607 | if (ret != 0) { | ||
608 | warn("usb out operation failed. (%d)", ret); | ||
609 | goto failed; | ||
610 | } | ||
611 | |||
612 | for (i = 0; i < 15; i++) { | ||
613 | msleep(100); | ||
614 | |||
615 | if (CI_CamReady(ca, slot)) { | ||
616 | deb_info("CAM Ready"); | ||
617 | break; | ||
618 | } | ||
619 | } | ||
620 | msleep(5000); | ||
621 | |||
622 | failed: | ||
623 | mutex_unlock(&state->ca_mutex); | ||
624 | return ret; | ||
625 | } | ||
626 | |||
627 | static int az6027_ci_slot_shutdown(struct dvb_ca_en50221 *ca, int slot) | ||
628 | { | ||
629 | return 0; | ||
630 | } | ||
631 | |||
632 | static int az6027_ci_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot) | ||
633 | { | ||
634 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
635 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
636 | |||
637 | int ret; | ||
638 | u8 req; | ||
639 | u16 value; | ||
640 | u16 index; | ||
641 | int blen; | ||
642 | |||
643 | deb_info("%s", __func__); | ||
644 | mutex_lock(&state->ca_mutex); | ||
645 | req = 0xC7; | ||
646 | value = 1; | ||
647 | index = 0; | ||
648 | blen = 0; | ||
649 | |||
650 | ret = az6027_usb_out_op(d, req, value, index, NULL, blen); | ||
651 | if (ret != 0) { | ||
652 | warn("usb out operation failed. (%d)", ret); | ||
653 | goto failed; | ||
654 | } | ||
655 | |||
656 | failed: | ||
657 | mutex_unlock(&state->ca_mutex); | ||
658 | return ret; | ||
659 | } | ||
660 | |||
661 | static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open) | ||
662 | { | ||
663 | struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data; | ||
664 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
665 | int ret; | ||
666 | u8 req; | ||
667 | u16 value; | ||
668 | u16 index; | ||
669 | int blen; | ||
670 | u8 b[12]; | ||
671 | |||
672 | mutex_lock(&state->ca_mutex); | ||
673 | |||
674 | req = 0xC5; | ||
675 | value = 0; | ||
676 | index = 0; | ||
677 | blen = 1; | ||
678 | |||
679 | ret = az6027_usb_in_op(d, req, value, index, b, blen); | ||
680 | if (ret < 0) { | ||
681 | warn("usb in operation failed. (%d)", ret); | ||
682 | ret = -EIO; | ||
683 | } else | ||
684 | ret = 0; | ||
685 | |||
686 | if (b[0] == 0) { | ||
687 | ret = 0; | ||
688 | |||
689 | } else if (b[0] == 1) { | ||
690 | ret = DVB_CA_EN50221_POLL_CAM_PRESENT | | ||
691 | DVB_CA_EN50221_POLL_CAM_READY; | ||
692 | } | ||
693 | |||
694 | mutex_unlock(&state->ca_mutex); | ||
695 | return ret; | ||
696 | } | ||
697 | |||
698 | |||
699 | static void az6027_ci_uninit(struct dvb_usb_device *d) | ||
700 | { | ||
701 | struct az6027_device_state *state; | ||
702 | |||
703 | deb_info("%s", __func__); | ||
704 | |||
705 | if (NULL == d) | ||
706 | return; | ||
707 | |||
708 | state = (struct az6027_device_state *)d->priv; | ||
709 | if (NULL == state) | ||
710 | return; | ||
711 | |||
712 | if (NULL == state->ca.data) | ||
713 | return; | ||
714 | |||
715 | dvb_ca_en50221_release(&state->ca); | ||
716 | |||
717 | memset(&state->ca, 0, sizeof(state->ca)); | ||
718 | } | ||
719 | |||
720 | |||
721 | static int az6027_ci_init(struct dvb_usb_adapter *a) | ||
722 | { | ||
723 | struct dvb_usb_device *d = a->dev; | ||
724 | struct az6027_device_state *state = (struct az6027_device_state *)d->priv; | ||
725 | int ret; | ||
726 | |||
727 | deb_info("%s", __func__); | ||
728 | |||
729 | mutex_init(&state->ca_mutex); | ||
730 | |||
731 | state->ca.owner = THIS_MODULE; | ||
732 | state->ca.read_attribute_mem = az6027_ci_read_attribute_mem; | ||
733 | state->ca.write_attribute_mem = az6027_ci_write_attribute_mem; | ||
734 | state->ca.read_cam_control = az6027_ci_read_cam_control; | ||
735 | state->ca.write_cam_control = az6027_ci_write_cam_control; | ||
736 | state->ca.slot_reset = az6027_ci_slot_reset; | ||
737 | state->ca.slot_shutdown = az6027_ci_slot_shutdown; | ||
738 | state->ca.slot_ts_enable = az6027_ci_slot_ts_enable; | ||
739 | state->ca.poll_slot_status = az6027_ci_poll_slot_status; | ||
740 | state->ca.data = d; | ||
741 | |||
742 | ret = dvb_ca_en50221_init(&a->dvb_adap, | ||
743 | &state->ca, | ||
744 | 0, /* flags */ | ||
745 | 1);/* n_slots */ | ||
746 | if (ret != 0) { | ||
747 | err("Cannot initialize CI: Error %d.", ret); | ||
748 | memset(&state->ca, 0, sizeof(state->ca)); | ||
749 | return ret; | ||
750 | } | ||
751 | |||
752 | deb_info("CI initialized."); | ||
753 | |||
754 | return 0; | ||
755 | } | ||
756 | |||
757 | /* | ||
758 | static int az6027_read_mac_addr(struct dvb_usb_device *d, u8 mac[6]) | ||
759 | { | ||
760 | az6027_usb_in_op(d, 0xb7, 6, 0, &mac[0], 6); | ||
761 | return 0; | ||
762 | } | ||
763 | */ | ||
764 | |||
765 | static int az6027_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | ||
766 | { | ||
767 | |||
768 | u8 buf; | ||
769 | int ret; | ||
770 | struct dvb_usb_adapter *adap = fe->dvb->priv; | ||
771 | |||
772 | struct i2c_msg i2c_msg = { | ||
773 | .addr = 0x99, | ||
774 | .flags = 0, | ||
775 | .buf = &buf, | ||
776 | .len = 1 | ||
777 | }; | ||
778 | |||
779 | /* | ||
780 | * 2 --18v | ||
781 | * 1 --13v | ||
782 | * 0 --off | ||
783 | */ | ||
784 | switch (voltage) { | ||
785 | case SEC_VOLTAGE_13: | ||
786 | buf = 1; | ||
787 | ret = i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1); | ||
788 | break; | ||
789 | |||
790 | case SEC_VOLTAGE_18: | ||
791 | buf = 2; | ||
792 | ret = i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1); | ||
793 | break; | ||
794 | |||
795 | case SEC_VOLTAGE_OFF: | ||
796 | buf = 0; | ||
797 | ret = i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1); | ||
798 | break; | ||
799 | |||
800 | default: | ||
801 | return -EINVAL; | ||
802 | } | ||
803 | return 0; | ||
804 | } | ||
805 | |||
806 | |||
807 | static int az6027_frontend_poweron(struct dvb_usb_adapter *adap) | ||
808 | { | ||
809 | int ret; | ||
810 | u8 req; | ||
811 | u16 value; | ||
812 | u16 index; | ||
813 | int blen; | ||
814 | |||
815 | req = 0xBC; | ||
816 | value = 1; /* power on */ | ||
817 | index = 3; | ||
818 | blen = 0; | ||
819 | |||
820 | ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); | ||
821 | if (ret != 0) | ||
822 | return -EIO; | ||
823 | |||
824 | return 0; | ||
825 | } | ||
826 | static int az6027_frontend_reset(struct dvb_usb_adapter *adap) | ||
827 | { | ||
828 | int ret; | ||
829 | u8 req; | ||
830 | u16 value; | ||
831 | u16 index; | ||
832 | int blen; | ||
833 | |||
834 | /* reset demodulator */ | ||
835 | req = 0xC0; | ||
836 | value = 1; /* high */ | ||
837 | index = 3; | ||
838 | blen = 0; | ||
839 | |||
840 | ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); | ||
841 | if (ret != 0) | ||
842 | return -EIO; | ||
843 | |||
844 | req = 0xC0; | ||
845 | value = 0; /* low */ | ||
846 | index = 3; | ||
847 | blen = 0; | ||
848 | msleep_interruptible(200); | ||
849 | |||
850 | ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); | ||
851 | if (ret != 0) | ||
852 | return -EIO; | ||
853 | |||
854 | msleep_interruptible(200); | ||
855 | |||
856 | req = 0xC0; | ||
857 | value = 1; /*high */ | ||
858 | index = 3; | ||
859 | blen = 0; | ||
860 | |||
861 | ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); | ||
862 | if (ret != 0) | ||
863 | return -EIO; | ||
864 | |||
865 | msleep_interruptible(200); | ||
866 | return 0; | ||
867 | } | ||
868 | |||
869 | static int az6027_frontend_tsbypass(struct dvb_usb_adapter *adap, int onoff) | ||
870 | { | ||
871 | int ret; | ||
872 | u8 req; | ||
873 | u16 value; | ||
874 | u16 index; | ||
875 | int blen; | ||
876 | |||
877 | /* TS passthrough */ | ||
878 | req = 0xC7; | ||
879 | value = onoff; | ||
880 | index = 0; | ||
881 | blen = 0; | ||
882 | |||
883 | ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); | ||
884 | if (ret != 0) | ||
885 | return -EIO; | ||
886 | |||
887 | return 0; | ||
888 | } | ||
889 | |||
890 | static int az6027_frontend_attach(struct dvb_usb_adapter *adap) | ||
891 | { | ||
892 | |||
893 | az6027_frontend_poweron(adap); | ||
894 | az6027_frontend_reset(adap); | ||
895 | |||
896 | deb_info("adap = %p, dev = %p\n", adap, adap->dev); | ||
897 | adap->fe = stb0899_attach(&az6027_stb0899_config, &adap->dev->i2c_adap); | ||
898 | |||
899 | if (adap->fe) { | ||
900 | deb_info("found STB0899 DVB-S/DVB-S2 frontend @0x%02x", az6027_stb0899_config.demod_address); | ||
901 | if (stb6100_attach(adap->fe, &az6027_stb6100_config, &adap->dev->i2c_adap)) { | ||
902 | deb_info("found STB6100 DVB-S/DVB-S2 frontend @0x%02x", az6027_stb6100_config.tuner_address); | ||
903 | adap->fe->ops.set_voltage = az6027_set_voltage; | ||
904 | az6027_ci_init(adap); | ||
905 | } else { | ||
906 | adap->fe = NULL; | ||
907 | } | ||
908 | } else | ||
909 | warn("no front-end attached\n"); | ||
910 | |||
911 | az6027_frontend_tsbypass(adap, 0); | ||
912 | |||
913 | return 0; | ||
914 | } | ||
915 | |||
916 | static struct dvb_usb_device_properties az6027_properties; | ||
917 | |||
918 | static void az6027_usb_disconnect(struct usb_interface *intf) | ||
919 | { | ||
920 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
921 | az6027_ci_uninit(d); | ||
922 | dvb_usb_device_exit(intf); | ||
923 | } | ||
924 | |||
925 | |||
926 | static int az6027_usb_probe(struct usb_interface *intf, | ||
927 | const struct usb_device_id *id) | ||
928 | { | ||
929 | return dvb_usb_device_init(intf, | ||
930 | &az6027_properties, | ||
931 | THIS_MODULE, | ||
932 | NULL, | ||
933 | adapter_nr); | ||
934 | } | ||
935 | |||
936 | /* I2C */ | ||
937 | static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) | ||
938 | { | ||
939 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
940 | int i = 0, j = 0, len = 0; | ||
941 | int ret; | ||
942 | u16 index; | ||
943 | u16 value; | ||
944 | int length; | ||
945 | u8 req; | ||
946 | u8 data[256]; | ||
947 | |||
948 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
949 | return -EAGAIN; | ||
950 | |||
951 | if (num > 2) | ||
952 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
953 | |||
954 | for (i = 0; i < num; i++) { | ||
955 | |||
956 | if (msg[i].addr == 0x99) { | ||
957 | req = 0xBE; | ||
958 | index = 0; | ||
959 | value = msg[i].buf[0] & 0x00ff; | ||
960 | length = 1; | ||
961 | az6027_usb_out_op(d, req, value, index, data, length); | ||
962 | } | ||
963 | |||
964 | if (msg[i].addr == 0xd0) { | ||
965 | /* write/read request */ | ||
966 | if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD)) { | ||
967 | req = 0xB9; | ||
968 | index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); | ||
969 | value = msg[i].addr + (msg[i].len << 8); | ||
970 | length = msg[i + 1].len + 6; | ||
971 | ret = az6027_usb_in_op(d, req, value, index, data, length); | ||
972 | len = msg[i + 1].len; | ||
973 | for (j = 0; j < len; j++) | ||
974 | msg[i + 1].buf[j] = data[j + 5]; | ||
975 | |||
976 | i++; | ||
977 | } else { | ||
978 | |||
979 | if (msg[i].addr == 0xd0) { | ||
980 | /* demod 16bit addr */ | ||
981 | req = 0xBD; | ||
982 | index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); | ||
983 | value = msg[i].addr + (2 << 8); | ||
984 | length = msg[i].len - 2; | ||
985 | len = msg[i].len - 2; | ||
986 | for (j = 0; j < len; j++) | ||
987 | data[j] = msg[i].buf[j + 2]; | ||
988 | |||
989 | } | ||
990 | az6027_usb_out_op(d, req, value, index, data, length); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | if (msg[i].addr == 0xc0) { | ||
995 | if (msg[i].flags & I2C_M_RD) { | ||
996 | |||
997 | req = 0xB9; | ||
998 | index = 0x0; | ||
999 | value = msg[i].addr; | ||
1000 | length = msg[i].len + 6; | ||
1001 | ret = az6027_usb_in_op(d, req, value, index, data, length); | ||
1002 | len = msg[i].len; | ||
1003 | for (j = 0; j < len; j++) | ||
1004 | msg[i].buf[j] = data[j + 5]; | ||
1005 | |||
1006 | } else { | ||
1007 | |||
1008 | req = 0xBD; | ||
1009 | index = msg[i].buf[0] & 0x00FF; | ||
1010 | value = msg[i].addr + (1 << 8); | ||
1011 | length = msg[i].len - 1; | ||
1012 | len = msg[i].len - 1; | ||
1013 | |||
1014 | for (j = 0; j < len; j++) | ||
1015 | data[j] = msg[i].buf[j + 1]; | ||
1016 | |||
1017 | az6027_usb_out_op(d, req, value, index, data, length); | ||
1018 | } | ||
1019 | } | ||
1020 | } | ||
1021 | mutex_unlock(&d->i2c_mutex); | ||
1022 | |||
1023 | return i; | ||
1024 | } | ||
1025 | |||
1026 | |||
1027 | static u32 az6027_i2c_func(struct i2c_adapter *adapter) | ||
1028 | { | ||
1029 | return I2C_FUNC_I2C; | ||
1030 | } | ||
1031 | |||
1032 | static struct i2c_algorithm az6027_i2c_algo = { | ||
1033 | .master_xfer = az6027_i2c_xfer, | ||
1034 | .functionality = az6027_i2c_func, | ||
1035 | }; | ||
1036 | |||
1037 | int az6027_identify_state(struct usb_device *udev, | ||
1038 | struct dvb_usb_device_properties *props, | ||
1039 | struct dvb_usb_device_description **desc, | ||
1040 | int *cold) | ||
1041 | { | ||
1042 | u8 b[16]; | ||
1043 | s16 ret = usb_control_msg(udev, | ||
1044 | usb_rcvctrlpipe(udev, 0), | ||
1045 | 0xb7, | ||
1046 | USB_TYPE_VENDOR | USB_DIR_IN, | ||
1047 | 6, | ||
1048 | 0, | ||
1049 | b, | ||
1050 | 6, | ||
1051 | USB_CTRL_GET_TIMEOUT); | ||
1052 | |||
1053 | *cold = ret <= 0; | ||
1054 | |||
1055 | deb_info("cold: %d\n", *cold); | ||
1056 | return 0; | ||
1057 | } | ||
1058 | |||
1059 | |||
1060 | static struct usb_device_id az6027_usb_table[] = { | ||
1061 | { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) }, | ||
1062 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI) }, | ||
1063 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI) }, | ||
1064 | { }, | ||
1065 | }; | ||
1066 | |||
1067 | MODULE_DEVICE_TABLE(usb, az6027_usb_table); | ||
1068 | |||
1069 | static struct dvb_usb_device_properties az6027_properties = { | ||
1070 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1071 | .usb_ctrl = CYPRESS_FX2, | ||
1072 | .firmware = "dvb-usb-az6027-03.fw", | ||
1073 | .no_reconnect = 1, | ||
1074 | |||
1075 | .size_of_priv = sizeof(struct az6027_device_state), | ||
1076 | .identify_state = az6027_identify_state, | ||
1077 | .num_adapters = 1, | ||
1078 | .adapter = { | ||
1079 | { | ||
1080 | .streaming_ctrl = az6027_streaming_ctrl, | ||
1081 | .frontend_attach = az6027_frontend_attach, | ||
1082 | |||
1083 | /* parameter for the MPEG2-data transfer */ | ||
1084 | .stream = { | ||
1085 | .type = USB_BULK, | ||
1086 | .count = 10, | ||
1087 | .endpoint = 0x02, | ||
1088 | .u = { | ||
1089 | .bulk = { | ||
1090 | .buffersize = 4096, | ||
1091 | } | ||
1092 | } | ||
1093 | }, | ||
1094 | } | ||
1095 | }, | ||
1096 | /* | ||
1097 | .power_ctrl = az6027_power_ctrl, | ||
1098 | .read_mac_address = az6027_read_mac_addr, | ||
1099 | */ | ||
1100 | .rc_key_map = az6027_rc_keys, | ||
1101 | .rc_key_map_size = ARRAY_SIZE(az6027_rc_keys), | ||
1102 | .rc_interval = 400, | ||
1103 | .rc_query = az6027_rc_query, | ||
1104 | .i2c_algo = &az6027_i2c_algo, | ||
1105 | |||
1106 | .num_device_descs = 1, | ||
1107 | .devices = { | ||
1108 | { | ||
1109 | .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)", | ||
1110 | .cold_ids = { &az6027_usb_table[0], NULL }, | ||
1111 | .warm_ids = { NULL }, | ||
1112 | }, | ||
1113 | { NULL }, | ||
1114 | } | ||
1115 | }; | ||
1116 | |||
1117 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
1118 | static struct usb_driver az6027_usb_driver = { | ||
1119 | .name = "dvb_usb_az6027", | ||
1120 | .probe = az6027_usb_probe, | ||
1121 | .disconnect = az6027_usb_disconnect, | ||
1122 | .id_table = az6027_usb_table, | ||
1123 | }; | ||
1124 | |||
1125 | /* module stuff */ | ||
1126 | static int __init az6027_usb_module_init(void) | ||
1127 | { | ||
1128 | int result; | ||
1129 | |||
1130 | result = usb_register(&az6027_usb_driver); | ||
1131 | if (result) { | ||
1132 | err("usb_register failed. (%d)", result); | ||
1133 | return result; | ||
1134 | } | ||
1135 | |||
1136 | return 0; | ||
1137 | } | ||
1138 | |||
1139 | static void __exit az6027_usb_module_exit(void) | ||
1140 | { | ||
1141 | /* deregister this driver from the USB subsystem */ | ||
1142 | usb_deregister(&az6027_usb_driver); | ||
1143 | } | ||
1144 | |||
1145 | module_init(az6027_usb_module_init); | ||
1146 | module_exit(az6027_usb_module_exit); | ||
1147 | |||
1148 | MODULE_AUTHOR("Adams Xu <Adams.xu@azwave.com.cn>"); | ||
1149 | MODULE_DESCRIPTION("Driver for AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)"); | ||
1150 | MODULE_VERSION("1.0"); | ||
1151 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/az6027.h b/drivers/media/dvb/dvb-usb/az6027.h new file mode 100644 index 000000000000..f3afe17f3f3d --- /dev/null +++ b/drivers/media/dvb/dvb-usb/az6027.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _DVB_USB_VP6027_H_ | ||
2 | #define _DVB_USB_VP6027_H_ | ||
3 | |||
4 | #define DVB_USB_LOG_PREFIX "az6027" | ||
5 | #include "dvb-usb.h" | ||
6 | |||
7 | |||
8 | extern int dvb_usb_az6027_debug; | ||
9 | #define deb_info(args...) dprintk(dvb_usb_az6027_debug, 0x01, args) | ||
10 | #define deb_xfer(args...) dprintk(dvb_usb_az6027_debug, 0x02, args) | ||
11 | #define deb_rc(args...) dprintk(dvb_usb_az6027_debug, 0x04, args) | ||
12 | #define deb_fe(args...) dprintk(dvb_usb_az6027_debug, 0x08, args) | ||
13 | |||
14 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 05fb28e9c69e..a7b8405c291e 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -1184,6 +1184,9 @@ static struct atbm8830_config mygica_d689_atbm8830_cfg = { | |||
1184 | .osc_clk_freq = 30400, /* in kHz */ | 1184 | .osc_clk_freq = 30400, /* in kHz */ |
1185 | .if_freq = 0, /* zero IF */ | 1185 | .if_freq = 0, /* zero IF */ |
1186 | .zif_swap_iq = 1, | 1186 | .zif_swap_iq = 1, |
1187 | .agc_min = 0x2E, | ||
1188 | .agc_max = 0x90, | ||
1189 | .agc_hold_loop = 0, | ||
1187 | }; | 1190 | }; |
1188 | 1191 | ||
1189 | static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) | 1192 | static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) |
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index 495a90577c5f..83fc24a6c31a 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h | |||
@@ -42,7 +42,6 @@ struct dib0700_state { | |||
42 | u16 mt2060_if1[2]; | 42 | u16 mt2060_if1[2]; |
43 | u8 rc_toggle; | 43 | u8 rc_toggle; |
44 | u8 rc_counter; | 44 | u8 rc_counter; |
45 | u8 rc_func_version; | ||
46 | u8 is_dib7000pc; | 45 | u8 is_dib7000pc; |
47 | u8 fw_use_new_i2c_api; | 46 | u8 fw_use_new_i2c_api; |
48 | u8 disable_streaming_master_mode; | 47 | u8 disable_streaming_master_mode; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 0d3c9a9a33be..4f961d2d1817 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
@@ -471,14 +471,209 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
471 | return dib0700_ctrl_wr(adap->dev, b, 4); | 471 | return dib0700_ctrl_wr(adap->dev, b, 4); |
472 | } | 472 | } |
473 | 473 | ||
474 | /* Number of keypresses to ignore before start repeating */ | ||
475 | #define RC_REPEAT_DELAY_V1_20 10 | ||
476 | |||
477 | /* This is the structure of the RC response packet starting in firmware 1.20 */ | ||
478 | struct dib0700_rc_response { | ||
479 | u8 report_id; | ||
480 | u8 data_state; | ||
481 | u16 system; | ||
482 | u8 data; | ||
483 | u8 not_data; | ||
484 | }; | ||
485 | #define RC_MSG_SIZE_V1_20 6 | ||
486 | |||
487 | static void dib0700_rc_urb_completion(struct urb *purb) | ||
488 | { | ||
489 | struct dvb_usb_device *d = purb->context; | ||
490 | struct dvb_usb_rc_key *keymap; | ||
491 | struct dib0700_state *st; | ||
492 | struct dib0700_rc_response poll_reply; | ||
493 | u8 *buf; | ||
494 | int found = 0; | ||
495 | u32 event; | ||
496 | int state; | ||
497 | int i; | ||
498 | |||
499 | deb_info("%s()\n", __func__); | ||
500 | if (d == NULL) | ||
501 | return; | ||
502 | |||
503 | if (d->rc_input_dev == NULL) { | ||
504 | /* This will occur if disable_rc_polling=1 */ | ||
505 | usb_free_urb(purb); | ||
506 | return; | ||
507 | } | ||
508 | |||
509 | keymap = d->props.rc_key_map; | ||
510 | st = d->priv; | ||
511 | buf = (u8 *)purb->transfer_buffer; | ||
512 | |||
513 | if (purb->status < 0) { | ||
514 | deb_info("discontinuing polling\n"); | ||
515 | usb_free_urb(purb); | ||
516 | return; | ||
517 | } | ||
518 | |||
519 | if (purb->actual_length != RC_MSG_SIZE_V1_20) { | ||
520 | deb_info("malformed rc msg size=%d\n", purb->actual_length); | ||
521 | goto resubmit; | ||
522 | } | ||
523 | |||
524 | /* Set initial results in case we exit the function early */ | ||
525 | event = 0; | ||
526 | state = REMOTE_NO_KEY_PRESSED; | ||
527 | |||
528 | deb_data("IR raw %02X %02X %02X %02X %02X %02X (len %d)\n", buf[0], | ||
529 | buf[1], buf[2], buf[3], buf[4], buf[5], purb->actual_length); | ||
530 | |||
531 | switch (dvb_usb_dib0700_ir_proto) { | ||
532 | case 0: | ||
533 | /* NEC Protocol */ | ||
534 | poll_reply.report_id = 0; | ||
535 | poll_reply.data_state = 1; | ||
536 | poll_reply.system = buf[2]; | ||
537 | poll_reply.data = buf[4]; | ||
538 | poll_reply.not_data = buf[5]; | ||
539 | |||
540 | /* NEC protocol sends repeat code as 0 0 0 FF */ | ||
541 | if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00) | ||
542 | && (poll_reply.not_data == 0xff)) { | ||
543 | poll_reply.data_state = 2; | ||
544 | break; | ||
545 | } | ||
546 | break; | ||
547 | default: | ||
548 | /* RC5 Protocol */ | ||
549 | poll_reply.report_id = buf[0]; | ||
550 | poll_reply.data_state = buf[1]; | ||
551 | poll_reply.system = (buf[2] << 8) | buf[3]; | ||
552 | poll_reply.data = buf[4]; | ||
553 | poll_reply.not_data = buf[5]; | ||
554 | break; | ||
555 | } | ||
556 | |||
557 | if ((poll_reply.data + poll_reply.not_data) != 0xff) { | ||
558 | /* Key failed integrity check */ | ||
559 | err("key failed integrity check: %04x %02x %02x", | ||
560 | poll_reply.system, | ||
561 | poll_reply.data, poll_reply.not_data); | ||
562 | goto resubmit; | ||
563 | } | ||
564 | |||
565 | deb_data("rid=%02x ds=%02x sm=%04x d=%02x nd=%02x\n", | ||
566 | poll_reply.report_id, poll_reply.data_state, | ||
567 | poll_reply.system, poll_reply.data, poll_reply.not_data); | ||
568 | |||
569 | /* Find the key in the map */ | ||
570 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
571 | if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) && | ||
572 | rc5_data(&keymap[i]) == poll_reply.data) { | ||
573 | event = keymap[i].event; | ||
574 | found = 1; | ||
575 | break; | ||
576 | } | ||
577 | } | ||
578 | |||
579 | if (found == 0) { | ||
580 | err("Unknown remote controller key: %04x %02x %02x", | ||
581 | poll_reply.system, poll_reply.data, poll_reply.not_data); | ||
582 | d->last_event = 0; | ||
583 | goto resubmit; | ||
584 | } | ||
585 | |||
586 | if (poll_reply.data_state == 1) { | ||
587 | /* New key hit */ | ||
588 | st->rc_counter = 0; | ||
589 | event = keymap[i].event; | ||
590 | state = REMOTE_KEY_PRESSED; | ||
591 | d->last_event = keymap[i].event; | ||
592 | } else if (poll_reply.data_state == 2) { | ||
593 | /* Key repeated */ | ||
594 | st->rc_counter++; | ||
595 | |||
596 | /* prevents unwanted double hits */ | ||
597 | if (st->rc_counter > RC_REPEAT_DELAY_V1_20) { | ||
598 | event = d->last_event; | ||
599 | state = REMOTE_KEY_PRESSED; | ||
600 | st->rc_counter = RC_REPEAT_DELAY_V1_20; | ||
601 | } | ||
602 | } else { | ||
603 | err("Unknown data state [%d]", poll_reply.data_state); | ||
604 | } | ||
605 | |||
606 | switch (state) { | ||
607 | case REMOTE_NO_KEY_PRESSED: | ||
608 | break; | ||
609 | case REMOTE_KEY_PRESSED: | ||
610 | deb_info("key pressed\n"); | ||
611 | d->last_event = event; | ||
612 | case REMOTE_KEY_REPEAT: | ||
613 | deb_info("key repeated\n"); | ||
614 | input_event(d->rc_input_dev, EV_KEY, event, 1); | ||
615 | input_sync(d->rc_input_dev); | ||
616 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); | ||
617 | input_sync(d->rc_input_dev); | ||
618 | break; | ||
619 | default: | ||
620 | break; | ||
621 | } | ||
622 | |||
623 | resubmit: | ||
624 | /* Clean the buffer before we requeue */ | ||
625 | memset(purb->transfer_buffer, 0, RC_MSG_SIZE_V1_20); | ||
626 | |||
627 | /* Requeue URB */ | ||
628 | usb_submit_urb(purb, GFP_ATOMIC); | ||
629 | } | ||
630 | |||
474 | int dib0700_rc_setup(struct dvb_usb_device *d) | 631 | int dib0700_rc_setup(struct dvb_usb_device *d) |
475 | { | 632 | { |
633 | struct dib0700_state *st = d->priv; | ||
476 | u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0}; | 634 | u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0}; |
477 | int i = dib0700_ctrl_wr(d, rc_setup, 3); | 635 | struct urb *purb; |
636 | int ret; | ||
637 | int i; | ||
638 | |||
639 | if (d->props.rc_key_map == NULL) | ||
640 | return 0; | ||
641 | |||
642 | /* Set the IR mode */ | ||
643 | i = dib0700_ctrl_wr(d, rc_setup, 3); | ||
478 | if (i<0) { | 644 | if (i<0) { |
479 | err("ir protocol setup failed"); | 645 | err("ir protocol setup failed"); |
480 | return -1; | 646 | return -1; |
481 | } | 647 | } |
648 | |||
649 | if (st->fw_version < 0x10200) | ||
650 | return 0; | ||
651 | |||
652 | /* Starting in firmware 1.20, the RC info is provided on a bulk pipe */ | ||
653 | purb = usb_alloc_urb(0, GFP_KERNEL); | ||
654 | if (purb == NULL) { | ||
655 | err("rc usb alloc urb failed\n"); | ||
656 | return -1; | ||
657 | } | ||
658 | |||
659 | purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL); | ||
660 | if (purb->transfer_buffer == NULL) { | ||
661 | err("rc kzalloc failed\n"); | ||
662 | usb_free_urb(purb); | ||
663 | return -1; | ||
664 | } | ||
665 | |||
666 | purb->status = -EINPROGRESS; | ||
667 | usb_fill_bulk_urb(purb, d->udev, usb_rcvbulkpipe(d->udev, 1), | ||
668 | purb->transfer_buffer, RC_MSG_SIZE_V1_20, | ||
669 | dib0700_rc_urb_completion, d); | ||
670 | |||
671 | ret = usb_submit_urb(purb, GFP_ATOMIC); | ||
672 | if (ret != 0) { | ||
673 | err("rc submit urb failed\n"); | ||
674 | return -1; | ||
675 | } | ||
676 | |||
482 | return 0; | 677 | return 0; |
483 | } | 678 | } |
484 | 679 | ||
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 44972d01bbd0..34eab05afc6c 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -472,20 +472,25 @@ static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; | |||
472 | 472 | ||
473 | /* Number of keypresses to ignore before start repeating */ | 473 | /* Number of keypresses to ignore before start repeating */ |
474 | #define RC_REPEAT_DELAY 6 | 474 | #define RC_REPEAT_DELAY 6 |
475 | #define RC_REPEAT_DELAY_V1_20 10 | ||
476 | 475 | ||
477 | 476 | static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |
478 | |||
479 | /* Used by firmware versions < 1.20 (deprecated) */ | ||
480 | static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event, | ||
481 | int *state) | ||
482 | { | 477 | { |
483 | u8 key[4]; | 478 | u8 key[4]; |
484 | int i; | 479 | int i; |
485 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 480 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; |
486 | struct dib0700_state *st = d->priv; | 481 | struct dib0700_state *st = d->priv; |
482 | |||
487 | *event = 0; | 483 | *event = 0; |
488 | *state = REMOTE_NO_KEY_PRESSED; | 484 | *state = REMOTE_NO_KEY_PRESSED; |
485 | |||
486 | if (st->fw_version >= 0x10200) { | ||
487 | /* For 1.20 firmware , We need to keep the RC polling | ||
488 | callback so we can reuse the input device setup in | ||
489 | dvb-usb-remote.c. However, the actual work is being done | ||
490 | in the bulk URB completion handler. */ | ||
491 | return 0; | ||
492 | } | ||
493 | |||
489 | i=dib0700_ctrl_rd(d,rc_request,2,key,4); | 494 | i=dib0700_ctrl_rd(d,rc_request,2,key,4); |
490 | if (i<=0) { | 495 | if (i<=0) { |
491 | err("RC Query Failed"); | 496 | err("RC Query Failed"); |
@@ -557,149 +562,6 @@ static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event, | |||
557 | return 0; | 562 | return 0; |
558 | } | 563 | } |
559 | 564 | ||
560 | /* This is the structure of the RC response packet starting in firmware 1.20 */ | ||
561 | struct dib0700_rc_response { | ||
562 | u8 report_id; | ||
563 | u8 data_state; | ||
564 | u16 system; | ||
565 | u8 data; | ||
566 | u8 not_data; | ||
567 | }; | ||
568 | |||
569 | /* This supports the new IR response format for firmware v1.20 */ | ||
570 | static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event, | ||
571 | int *state) | ||
572 | { | ||
573 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | ||
574 | struct dib0700_state *st = d->priv; | ||
575 | struct dib0700_rc_response poll_reply; | ||
576 | u8 buf[6]; | ||
577 | int i; | ||
578 | int status; | ||
579 | int actlen; | ||
580 | int found = 0; | ||
581 | |||
582 | /* Set initial results in case we exit the function early */ | ||
583 | *event = 0; | ||
584 | *state = REMOTE_NO_KEY_PRESSED; | ||
585 | |||
586 | /* Firmware v1.20 provides RC data via bulk endpoint 1 */ | ||
587 | status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf, | ||
588 | sizeof(buf), &actlen, 50); | ||
589 | if (status < 0) { | ||
590 | /* No data available (meaning no key press) */ | ||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | |||
595 | switch (dvb_usb_dib0700_ir_proto) { | ||
596 | case 0: | ||
597 | poll_reply.report_id = 0; | ||
598 | poll_reply.data_state = 1; | ||
599 | poll_reply.system = buf[2]; | ||
600 | poll_reply.data = buf[4]; | ||
601 | poll_reply.not_data = buf[5]; | ||
602 | |||
603 | /* NEC protocol sends repeat code as 0 0 0 FF */ | ||
604 | if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00) | ||
605 | && (poll_reply.not_data == 0xff)) { | ||
606 | poll_reply.data_state = 2; | ||
607 | break; | ||
608 | } | ||
609 | break; | ||
610 | default: | ||
611 | if (actlen != sizeof(buf)) { | ||
612 | /* We didn't get back the 6 byte message we expected */ | ||
613 | err("Unexpected RC response size [%d]", actlen); | ||
614 | return -1; | ||
615 | } | ||
616 | |||
617 | poll_reply.report_id = buf[0]; | ||
618 | poll_reply.data_state = buf[1]; | ||
619 | poll_reply.system = (buf[2] << 8) | buf[3]; | ||
620 | poll_reply.data = buf[4]; | ||
621 | poll_reply.not_data = buf[5]; | ||
622 | |||
623 | break; | ||
624 | } | ||
625 | |||
626 | if ((poll_reply.data + poll_reply.not_data) != 0xff) { | ||
627 | /* Key failed integrity check */ | ||
628 | err("key failed integrity check: %04x %02x %02x", | ||
629 | poll_reply.system, | ||
630 | poll_reply.data, poll_reply.not_data); | ||
631 | return -1; | ||
632 | } | ||
633 | |||
634 | |||
635 | /* Find the key in the map */ | ||
636 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
637 | if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) && | ||
638 | rc5_data(&keymap[i]) == poll_reply.data) { | ||
639 | *event = keymap[i].event; | ||
640 | found = 1; | ||
641 | break; | ||
642 | } | ||
643 | } | ||
644 | |||
645 | if (found == 0) { | ||
646 | err("Unknown remote controller key: %04x %02x %02x", | ||
647 | poll_reply.system, | ||
648 | poll_reply.data, poll_reply.not_data); | ||
649 | d->last_event = 0; | ||
650 | return 0; | ||
651 | } | ||
652 | |||
653 | if (poll_reply.data_state == 1) { | ||
654 | /* New key hit */ | ||
655 | st->rc_counter = 0; | ||
656 | *event = keymap[i].event; | ||
657 | *state = REMOTE_KEY_PRESSED; | ||
658 | d->last_event = keymap[i].event; | ||
659 | } else if (poll_reply.data_state == 2) { | ||
660 | /* Key repeated */ | ||
661 | st->rc_counter++; | ||
662 | |||
663 | /* prevents unwanted double hits */ | ||
664 | if (st->rc_counter > RC_REPEAT_DELAY_V1_20) { | ||
665 | *event = d->last_event; | ||
666 | *state = REMOTE_KEY_PRESSED; | ||
667 | st->rc_counter = RC_REPEAT_DELAY_V1_20; | ||
668 | } | ||
669 | } else { | ||
670 | err("Unknown data state [%d]", poll_reply.data_state); | ||
671 | } | ||
672 | |||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
677 | { | ||
678 | struct dib0700_state *st = d->priv; | ||
679 | |||
680 | /* Because some people may have improperly named firmware files, | ||
681 | let's figure out whether to use the new firmware call or the legacy | ||
682 | call based on the firmware version embedded in the file */ | ||
683 | if (st->rc_func_version == 0) { | ||
684 | u32 hwver, romver, ramver, fwtype; | ||
685 | int ret = dib0700_get_version(d, &hwver, &romver, &ramver, | ||
686 | &fwtype); | ||
687 | if (ret < 0) { | ||
688 | err("Could not determine version info"); | ||
689 | return -1; | ||
690 | } | ||
691 | if (ramver < 0x10200) | ||
692 | st->rc_func_version = 1; | ||
693 | else | ||
694 | st->rc_func_version = 2; | ||
695 | } | ||
696 | |||
697 | if (st->rc_func_version == 2) | ||
698 | return dib0700_rc_query_v1_20(d, event, state); | ||
699 | else | ||
700 | return dib0700_rc_query_legacy(d, event, state); | ||
701 | } | ||
702 | |||
703 | static struct dvb_usb_rc_key dib0700_rc_keys[] = { | 565 | static struct dvb_usb_rc_key dib0700_rc_keys[] = { |
704 | /* Key codes for the tiny Pinnacle remote*/ | 566 | /* Key codes for the tiny Pinnacle remote*/ |
705 | { 0x0700, KEY_MUTE }, | 567 | { 0x0700, KEY_MUTE }, |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index bc3581d58ced..ae8b57acfe05 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -64,6 +64,8 @@ | |||
64 | #define USB_VID_HUMAX_COEX 0x10b9 | 64 | #define USB_VID_HUMAX_COEX 0x10b9 |
65 | #define USB_VID_774 0x7a69 | 65 | #define USB_VID_774 0x7a69 |
66 | #define USB_VID_EVOLUTEPC 0x1e59 | 66 | #define USB_VID_EVOLUTEPC 0x1e59 |
67 | #define USB_VID_AZUREWAVE 0x13d3 | ||
68 | #define USB_VID_TECHNISAT 0x14f7 | ||
67 | 69 | ||
68 | /* Product IDs */ | 70 | /* Product IDs */ |
69 | #define USB_PID_ADSTECH_USB2_COLD 0xa333 | 71 | #define USB_PID_ADSTECH_USB2_COLD 0xa333 |
@@ -138,6 +140,7 @@ | |||
138 | #define USB_PID_TWINHAN_VP7021_COLD 0x3207 | 140 | #define USB_PID_TWINHAN_VP7021_COLD 0x3207 |
139 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 | 141 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 |
140 | #define USB_PID_TINYTWIN 0x3226 | 142 | #define USB_PID_TINYTWIN 0x3226 |
143 | #define USB_PID_TINYTWIN_2 0xe402 | ||
141 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 | 144 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 |
142 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 | 145 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 |
143 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | 146 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 |
@@ -209,6 +212,7 @@ | |||
209 | #define USB_PID_PINNACLE_PCTV71E 0x022b | 212 | #define USB_PID_PINNACLE_PCTV71E 0x022b |
210 | #define USB_PID_PINNACLE_PCTV72E 0x0236 | 213 | #define USB_PID_PINNACLE_PCTV72E 0x0236 |
211 | #define USB_PID_PINNACLE_PCTV73E 0x0237 | 214 | #define USB_PID_PINNACLE_PCTV73E 0x0237 |
215 | #define USB_PID_PINNACLE_PCTV310E 0x3211 | ||
212 | #define USB_PID_PINNACLE_PCTV801E 0x023a | 216 | #define USB_PID_PINNACLE_PCTV801E 0x023a |
213 | #define USB_PID_PINNACLE_PCTV801E_SE 0x023b | 217 | #define USB_PID_PINNACLE_PCTV801E_SE 0x023b |
214 | #define USB_PID_PINNACLE_PCTV73A 0x0243 | 218 | #define USB_PID_PINNACLE_PCTV73A 0x0243 |
@@ -248,6 +252,7 @@ | |||
248 | #define USB_PID_DIGIVOX_MINI_SL_WARM 0xe361 | 252 | #define USB_PID_DIGIVOX_MINI_SL_WARM 0xe361 |
249 | #define USB_PID_GRANDTEC_DVBT_USB2_COLD 0x0bc6 | 253 | #define USB_PID_GRANDTEC_DVBT_USB2_COLD 0x0bc6 |
250 | #define USB_PID_GRANDTEC_DVBT_USB2_WARM 0x0bc7 | 254 | #define USB_PID_GRANDTEC_DVBT_USB2_WARM 0x0bc7 |
255 | #define USB_PID_WINFAST_DTV2000DS 0x6a04 | ||
251 | #define USB_PID_WINFAST_DTV_DONGLE_COLD 0x6025 | 256 | #define USB_PID_WINFAST_DTV_DONGLE_COLD 0x6025 |
252 | #define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026 | 257 | #define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026 |
253 | #define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00 | 258 | #define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00 |
@@ -290,5 +295,7 @@ | |||
290 | #define USB_PID_FRIIO_WHITE 0x0001 | 295 | #define USB_PID_FRIIO_WHITE 0x0001 |
291 | #define USB_PID_TVWAY_PLUS 0x0002 | 296 | #define USB_PID_TVWAY_PLUS 0x0002 |
292 | #define USB_PID_SVEON_STV20 0xe39d | 297 | #define USB_PID_SVEON_STV20 0xe39d |
293 | 298 | #define USB_PID_AZUREWAVE_AZ6027 0x3275 | |
299 | #define USB_PID_TERRATEC_DVBS2CI 0x3275 | ||
300 | #define USB_PID_TECHNISAT_USB2_HDCI 0x0002 | ||
294 | #endif | 301 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index e331db8c77b2..5d91f70d2d2d 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -243,7 +243,7 @@ int dvb_usb_device_init(struct usb_interface *intf, | |||
243 | d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | 243 | d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); |
244 | if (d == NULL) { | 244 | if (d == NULL) { |
245 | err("no memory for 'struct dvb_usb_device'"); | 245 | err("no memory for 'struct dvb_usb_device'"); |
246 | return ret; | 246 | return -ENOMEM; |
247 | } | 247 | } |
248 | 248 | ||
249 | d->udev = udev; | 249 | d->udev = udev; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index 6b5ded9e7d5d..a03ef7efec9a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
@@ -107,6 +107,7 @@ static void dvb_usb_read_remote_control(struct work_struct *work) | |||
107 | case REMOTE_KEY_REPEAT: | 107 | case REMOTE_KEY_REPEAT: |
108 | deb_rc("key repeated\n"); | 108 | deb_rc("key repeated\n"); |
109 | input_event(d->rc_input_dev, EV_KEY, event, 1); | 109 | input_event(d->rc_input_dev, EV_KEY, event, 1); |
110 | input_sync(d->rc_input_dev); | ||
110 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); | 111 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); |
111 | input_sync(d->rc_input_dev); | 112 | input_sync(d->rc_input_dev); |
112 | break; | 113 | break; |
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index 64132c0cf80d..accc65509b07 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the | 1 | /* DVB USB framework compliant Linux driver for the |
2 | * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101, | 2 | * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101, |
3 | * TeVii S600, S630, S650 Cards | 3 | * TeVii S600, S630, S650, |
4 | * Prof 1100, 7500 Cards | ||
4 | * Copyright (C) 2008,2009 Igor M. Liplianin (liplianin@me.by) | 5 | * Copyright (C) 2008,2009 Igor M. Liplianin (liplianin@me.by) |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -469,11 +470,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
469 | int num) | 470 | int num) |
470 | { | 471 | { |
471 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 472 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
473 | struct usb_device *udev; | ||
472 | int ret = 0; | 474 | int ret = 0; |
473 | int len, i, j; | 475 | int len, i, j; |
474 | 476 | ||
475 | if (!d) | 477 | if (!d) |
476 | return -ENODEV; | 478 | return -ENODEV; |
479 | udev = d->udev; | ||
477 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 480 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
478 | return -EAGAIN; | 481 | return -EAGAIN; |
479 | 482 | ||
@@ -488,8 +491,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
488 | } | 491 | } |
489 | case (DW2102_VOLTAGE_CTRL): { | 492 | case (DW2102_VOLTAGE_CTRL): { |
490 | u8 obuf[2]; | 493 | u8 obuf[2]; |
494 | |||
495 | obuf[0] = 1; | ||
496 | obuf[1] = msg[j].buf[1];/* off-on */ | ||
497 | ret = dw210x_op_rw(d->udev, 0x8a, 0, 0, | ||
498 | obuf, 2, DW210X_WRITE_MSG); | ||
491 | obuf[0] = 3; | 499 | obuf[0] = 3; |
492 | obuf[1] = msg[j].buf[0]; | 500 | obuf[1] = msg[j].buf[0];/* 13v-18v */ |
493 | ret = dw210x_op_rw(d->udev, 0x8a, 0, 0, | 501 | ret = dw210x_op_rw(d->udev, 0x8a, 0, 0, |
494 | obuf, 2, DW210X_WRITE_MSG); | 502 | obuf, 2, DW210X_WRITE_MSG); |
495 | break; | 503 | break; |
@@ -527,6 +535,17 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
527 | i += 16; | 535 | i += 16; |
528 | len -= 16; | 536 | len -= 16; |
529 | } while (len > 0); | 537 | } while (len > 0); |
538 | } else if ((udev->descriptor.idProduct == 0x7500) | ||
539 | && (j < (num - 1))) { | ||
540 | /* write register addr before read */ | ||
541 | u8 obuf[msg[j].len + 2]; | ||
542 | obuf[0] = msg[j + 1].len; | ||
543 | obuf[1] = (msg[j].addr << 1); | ||
544 | memcpy(obuf + 2, msg[j].buf, msg[j].len); | ||
545 | ret = dw210x_op_rw(d->udev, 0x92, 0, 0, | ||
546 | obuf, msg[j].len + 2, | ||
547 | DW210X_WRITE_MSG); | ||
548 | break; | ||
530 | } else { | 549 | } else { |
531 | /* write registers */ | 550 | /* write registers */ |
532 | u8 obuf[msg[j].len + 2]; | 551 | u8 obuf[msg[j].len + 2]; |
@@ -651,18 +670,25 @@ static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) | |||
651 | 670 | ||
652 | static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 671 | static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
653 | { | 672 | { |
654 | static u8 command_13v[1] = {0x00}; | 673 | static u8 command_13v[] = {0x00, 0x01}; |
655 | static u8 command_18v[1] = {0x01}; | 674 | static u8 command_18v[] = {0x01, 0x01}; |
656 | struct i2c_msg msg[] = { | 675 | static u8 command_off[] = {0x00, 0x00}; |
657 | {.addr = DW2102_VOLTAGE_CTRL, .flags = 0, | 676 | struct i2c_msg msg = { |
658 | .buf = command_13v, .len = 1}, | 677 | .addr = DW2102_VOLTAGE_CTRL, |
678 | .flags = 0, | ||
679 | .buf = command_off, | ||
680 | .len = 2, | ||
659 | }; | 681 | }; |
660 | 682 | ||
661 | struct dvb_usb_adapter *udev_adap = | 683 | struct dvb_usb_adapter *udev_adap = |
662 | (struct dvb_usb_adapter *)(fe->dvb->priv); | 684 | (struct dvb_usb_adapter *)(fe->dvb->priv); |
663 | if (voltage == SEC_VOLTAGE_18) | 685 | if (voltage == SEC_VOLTAGE_18) |
664 | msg[0].buf = command_18v; | 686 | msg.buf = command_18v; |
665 | i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1); | 687 | else if (voltage == SEC_VOLTAGE_13) |
688 | msg.buf = command_13v; | ||
689 | |||
690 | i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1); | ||
691 | |||
666 | return 0; | 692 | return 0; |
667 | } | 693 | } |
668 | 694 | ||
@@ -735,6 +761,18 @@ static struct stv6110_config dw2104_stv6110_config = { | |||
735 | .clk_div = 1, | 761 | .clk_div = 1, |
736 | }; | 762 | }; |
737 | 763 | ||
764 | static struct stv0900_config prof_7500_stv0900_config = { | ||
765 | .demod_address = 0x6a, | ||
766 | .demod_mode = 0, | ||
767 | .xtal = 27000000, | ||
768 | .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */ | ||
769 | .diseqc_mode = 2,/* 2/3 PWM */ | ||
770 | .tun1_maddress = 0,/* 0x60 */ | ||
771 | .tun1_adc = 0,/* 2 Vpp */ | ||
772 | .path1_mode = 3, | ||
773 | .tun1_type = 3, | ||
774 | }; | ||
775 | |||
738 | static int dw2104_frontend_attach(struct dvb_usb_adapter *d) | 776 | static int dw2104_frontend_attach(struct dvb_usb_adapter *d) |
739 | { | 777 | { |
740 | struct dvb_tuner_ops *tuner_ops = NULL; | 778 | struct dvb_tuner_ops *tuner_ops = NULL; |
@@ -882,6 +920,19 @@ static int s6x0_frontend_attach(struct dvb_usb_adapter *d) | |||
882 | return -EIO; | 920 | return -EIO; |
883 | } | 921 | } |
884 | 922 | ||
923 | static int prof_7500_frontend_attach(struct dvb_usb_adapter *d) | ||
924 | { | ||
925 | d->fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config, | ||
926 | &d->dev->i2c_adap, 0); | ||
927 | if (d->fe == NULL) | ||
928 | return -EIO; | ||
929 | d->fe->ops.set_voltage = dw210x_set_voltage; | ||
930 | |||
931 | info("Attached STV0900+STB6100A!\n"); | ||
932 | |||
933 | return 0; | ||
934 | } | ||
935 | |||
885 | static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) | 936 | static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) |
886 | { | 937 | { |
887 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, | 938 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, |
@@ -1073,6 +1124,7 @@ static struct usb_device_id dw2102_table[] = { | |||
1073 | {USB_DEVICE(0x9022, USB_PID_TEVII_S630)}, | 1124 | {USB_DEVICE(0x9022, USB_PID_TEVII_S630)}, |
1074 | {USB_DEVICE(0x3011, USB_PID_PROF_1100)}, | 1125 | {USB_DEVICE(0x3011, USB_PID_PROF_1100)}, |
1075 | {USB_DEVICE(0x9022, USB_PID_TEVII_S660)}, | 1126 | {USB_DEVICE(0x9022, USB_PID_TEVII_S660)}, |
1127 | {USB_DEVICE(0x3034, 0x7500)}, | ||
1076 | { } | 1128 | { } |
1077 | }; | 1129 | }; |
1078 | 1130 | ||
@@ -1387,9 +1439,30 @@ static struct dvb_usb_device_properties s6x0_properties = { | |||
1387 | } | 1439 | } |
1388 | }; | 1440 | }; |
1389 | 1441 | ||
1442 | struct dvb_usb_device_properties *p7500; | ||
1443 | static struct dvb_usb_device_description d7500 = { | ||
1444 | "Prof 7500 USB DVB-S2", | ||
1445 | {&dw2102_table[9], NULL}, | ||
1446 | {NULL}, | ||
1447 | }; | ||
1448 | |||
1390 | static int dw2102_probe(struct usb_interface *intf, | 1449 | static int dw2102_probe(struct usb_interface *intf, |
1391 | const struct usb_device_id *id) | 1450 | const struct usb_device_id *id) |
1392 | { | 1451 | { |
1452 | |||
1453 | p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
1454 | if (!p7500) | ||
1455 | return -ENOMEM; | ||
1456 | /* copy default structure */ | ||
1457 | memcpy(p7500, &s6x0_properties, | ||
1458 | sizeof(struct dvb_usb_device_properties)); | ||
1459 | /* fill only different fields */ | ||
1460 | p7500->firmware = "dvb-usb-p7500.fw"; | ||
1461 | p7500->devices[0] = d7500; | ||
1462 | p7500->rc_key_map = tbs_rc_keys; | ||
1463 | p7500->rc_key_map_size = ARRAY_SIZE(tbs_rc_keys); | ||
1464 | p7500->adapter->frontend_attach = prof_7500_frontend_attach; | ||
1465 | |||
1393 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, | 1466 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
1394 | THIS_MODULE, NULL, adapter_nr) || | 1467 | THIS_MODULE, NULL, adapter_nr) || |
1395 | 0 == dvb_usb_device_init(intf, &dw2104_properties, | 1468 | 0 == dvb_usb_device_init(intf, &dw2104_properties, |
@@ -1397,6 +1470,8 @@ static int dw2102_probe(struct usb_interface *intf, | |||
1397 | 0 == dvb_usb_device_init(intf, &dw3101_properties, | 1470 | 0 == dvb_usb_device_init(intf, &dw3101_properties, |
1398 | THIS_MODULE, NULL, adapter_nr) || | 1471 | THIS_MODULE, NULL, adapter_nr) || |
1399 | 0 == dvb_usb_device_init(intf, &s6x0_properties, | 1472 | 0 == dvb_usb_device_init(intf, &s6x0_properties, |
1473 | THIS_MODULE, NULL, adapter_nr) || | ||
1474 | 0 == dvb_usb_device_init(intf, p7500, | ||
1400 | THIS_MODULE, NULL, adapter_nr)) | 1475 | THIS_MODULE, NULL, adapter_nr)) |
1401 | return 0; | 1476 | return 0; |
1402 | 1477 | ||
@@ -1431,6 +1506,6 @@ MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); | |||
1431 | MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," | 1506 | MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," |
1432 | " DVB-C 3101 USB2.0," | 1507 | " DVB-C 3101 USB2.0," |
1433 | " TeVii S600, S630, S650, S660 USB2.0," | 1508 | " TeVii S600, S630, S650, S660 USB2.0," |
1434 | " Prof 1100 USB2.0 devices"); | 1509 | " Prof 1100, 7500 USB2.0 devices"); |
1435 | MODULE_VERSION("0.1"); | 1510 | MODULE_VERSION("0.1"); |
1436 | MODULE_LICENSE("GPL"); | 1511 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/dvb-usb/friio-fe.c b/drivers/media/dvb/dvb-usb/friio-fe.c index ebb7b9fd115b..d14bd227b502 100644 --- a/drivers/media/dvb/dvb-usb/friio-fe.c +++ b/drivers/media/dvb/dvb-usb/friio-fe.c | |||
@@ -366,7 +366,7 @@ static u8 init_code[][2] = { | |||
366 | {0x76, 0x0C}, | 366 | {0x76, 0x0C}, |
367 | }; | 367 | }; |
368 | 368 | ||
369 | const static int init_code_len = sizeof(init_code) / sizeof(u8[2]); | 369 | static const int init_code_len = sizeof(init_code) / sizeof(u8[2]); |
370 | 370 | ||
371 | static int jdvbt90502_init(struct dvb_frontend *fe) | 371 | static int jdvbt90502_init(struct dvb_frontend *fe) |
372 | { | 372 | { |
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index ef9b7bed13ff..737ffa36ac9c 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
@@ -16,6 +16,9 @@ | |||
16 | #include "qt1010.h" | 16 | #include "qt1010.h" |
17 | #include "tda1004x.h" | 17 | #include "tda1004x.h" |
18 | #include "tda827x.h" | 18 | #include "tda827x.h" |
19 | |||
20 | #include <media/tuner.h> | ||
21 | #include "tuner-simple.h" | ||
19 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
20 | 23 | ||
21 | /* debug */ | 24 | /* debug */ |
@@ -158,11 +161,14 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
158 | 161 | ||
159 | case 0x93: | 162 | case 0x93: |
160 | case 0x92: | 163 | case 0x92: |
164 | case 0x83: /* pinnacle PCTV310e */ | ||
165 | case 0x82: | ||
161 | m->rep_count = 0; | 166 | m->rep_count = 0; |
162 | *state = REMOTE_KEY_PRESSED; | 167 | *state = REMOTE_KEY_PRESSED; |
163 | goto unlock; | 168 | goto unlock; |
164 | 169 | ||
165 | case 0x91: | 170 | case 0x91: |
171 | case 0x81: /* pinnacle PCTV310e */ | ||
166 | /* prevent immediate auto-repeat */ | 172 | /* prevent immediate auto-repeat */ |
167 | if (++m->rep_count > 2) | 173 | if (++m->rep_count > 2) |
168 | *state = REMOTE_KEY_REPEAT; | 174 | *state = REMOTE_KEY_REPEAT; |
@@ -546,6 +552,14 @@ static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) | |||
546 | return 0; | 552 | return 0; |
547 | } | 553 | } |
548 | 554 | ||
555 | static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) | ||
556 | { | ||
557 | dvb_attach(simple_tuner_attach, adap->fe, | ||
558 | &adap->dev->i2c_adap, 0x61, | ||
559 | TUNER_PHILIPS_FMD1216ME_MK3); | ||
560 | return 0; | ||
561 | } | ||
562 | |||
549 | /* device-specific initialization */ | 563 | /* device-specific initialization */ |
550 | static struct m920x_inits megasky_rc_init [] = { | 564 | static struct m920x_inits megasky_rc_init [] = { |
551 | { M9206_RC_INIT2, 0xa8 }, | 565 | { M9206_RC_INIT2, 0xa8 }, |
@@ -562,6 +576,18 @@ static struct m920x_inits tvwalkertwin_rc_init [] = { | |||
562 | { } /* terminating entry */ | 576 | { } /* terminating entry */ |
563 | }; | 577 | }; |
564 | 578 | ||
579 | static struct m920x_inits pinnacle310e_init[] = { | ||
580 | /* without these the tuner don't work */ | ||
581 | { 0xff20, 0x9b }, | ||
582 | { 0xff22, 0x70 }, | ||
583 | |||
584 | /* rc settings */ | ||
585 | { 0xff50, 0x80 }, | ||
586 | { M9206_RC_INIT1, 0x00 }, | ||
587 | { M9206_RC_INIT2, 0xff }, | ||
588 | { } /* terminating entry */ | ||
589 | }; | ||
590 | |||
565 | /* ir keymaps */ | 591 | /* ir keymaps */ |
566 | static struct dvb_usb_rc_key megasky_rc_keys [] = { | 592 | static struct dvb_usb_rc_key megasky_rc_keys [] = { |
567 | { 0x0012, KEY_POWER }, | 593 | { 0x0012, KEY_POWER }, |
@@ -602,11 +628,68 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { | |||
602 | { 0x001e, KEY_VOLUMEUP }, | 628 | { 0x001e, KEY_VOLUMEUP }, |
603 | }; | 629 | }; |
604 | 630 | ||
631 | static struct dvb_usb_rc_key pinnacle310e_rc_keys[] = { | ||
632 | { 0x16, KEY_POWER }, | ||
633 | { 0x17, KEY_FAVORITES }, | ||
634 | { 0x0f, KEY_TEXT }, | ||
635 | { 0x48, KEY_MEDIA }, /* preview */ | ||
636 | { 0x1c, KEY_EPG }, | ||
637 | { 0x04, KEY_LIST }, /* record list */ | ||
638 | { 0x03, KEY_1 }, | ||
639 | { 0x01, KEY_2 }, | ||
640 | { 0x06, KEY_3 }, | ||
641 | { 0x09, KEY_4 }, | ||
642 | { 0x1d, KEY_5 }, | ||
643 | { 0x1f, KEY_6 }, | ||
644 | { 0x0d, KEY_7 }, | ||
645 | { 0x19, KEY_8 }, | ||
646 | { 0x1b, KEY_9 }, | ||
647 | { 0x15, KEY_0 }, | ||
648 | { 0x0c, KEY_CANCEL }, | ||
649 | { 0x4a, KEY_CLEAR }, | ||
650 | { 0x13, KEY_BACK }, | ||
651 | { 0x00, KEY_TAB }, | ||
652 | { 0x4b, KEY_UP }, | ||
653 | { 0x4e, KEY_LEFT }, | ||
654 | { 0x52, KEY_RIGHT }, | ||
655 | { 0x51, KEY_DOWN }, | ||
656 | { 0x4f, KEY_ENTER }, /* could also be KEY_OK */ | ||
657 | { 0x1e, KEY_VOLUMEUP }, | ||
658 | { 0x0a, KEY_VOLUMEDOWN }, | ||
659 | { 0x05, KEY_CHANNELUP }, | ||
660 | { 0x02, KEY_CHANNELDOWN }, | ||
661 | { 0x11, KEY_RECORD }, | ||
662 | { 0x14, KEY_PLAY }, | ||
663 | { 0x4c, KEY_PAUSE }, | ||
664 | { 0x1a, KEY_STOP }, | ||
665 | { 0x40, KEY_REWIND }, | ||
666 | { 0x12, KEY_FASTFORWARD }, | ||
667 | { 0x41, KEY_PREVIOUSSONG }, /* Replay */ | ||
668 | { 0x42, KEY_NEXTSONG }, /* Skip */ | ||
669 | { 0x54, KEY_CAMERA }, /* Capture */ | ||
670 | /* { 0x50, KEY_SAP }, */ /* Sap */ | ||
671 | { 0x47, KEY_CYCLEWINDOWS }, /* Pip */ | ||
672 | { 0x4d, KEY_SCREEN }, /* FullScreen */ | ||
673 | { 0x08, KEY_SUBTITLE }, | ||
674 | { 0x0e, KEY_MUTE }, | ||
675 | /* { 0x49, KEY_LR }, */ /* L/R */ | ||
676 | { 0x07, KEY_SLEEP }, /* Hibernate */ | ||
677 | { 0x08, KEY_MEDIA }, /* A/V */ | ||
678 | { 0x0e, KEY_MENU }, /* Recall */ | ||
679 | { 0x45, KEY_ZOOMIN }, | ||
680 | { 0x46, KEY_ZOOMOUT }, | ||
681 | { 0x18, KEY_TV }, /* Red */ | ||
682 | { 0x53, KEY_VCR }, /* Green */ | ||
683 | { 0x5e, KEY_SAT }, /* Yellow */ | ||
684 | { 0x5f, KEY_PLAYER }, /* Blue */ | ||
685 | }; | ||
686 | |||
605 | /* DVB USB Driver stuff */ | 687 | /* DVB USB Driver stuff */ |
606 | static struct dvb_usb_device_properties megasky_properties; | 688 | static struct dvb_usb_device_properties megasky_properties; |
607 | static struct dvb_usb_device_properties digivox_mini_ii_properties; | 689 | static struct dvb_usb_device_properties digivox_mini_ii_properties; |
608 | static struct dvb_usb_device_properties tvwalkertwin_properties; | 690 | static struct dvb_usb_device_properties tvwalkertwin_properties; |
609 | static struct dvb_usb_device_properties dposh_properties; | 691 | static struct dvb_usb_device_properties dposh_properties; |
692 | static struct dvb_usb_device_properties pinnacle_pctv310e_properties; | ||
610 | 693 | ||
611 | static int m920x_probe(struct usb_interface *intf, | 694 | static int m920x_probe(struct usb_interface *intf, |
612 | const struct usb_device_id *id) | 695 | const struct usb_device_id *id) |
@@ -652,6 +735,13 @@ static int m920x_probe(struct usb_interface *intf, | |||
652 | goto found; | 735 | goto found; |
653 | } | 736 | } |
654 | 737 | ||
738 | ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties, | ||
739 | THIS_MODULE, &d, adapter_nr); | ||
740 | if (ret == 0) { | ||
741 | rc_init_seq = pinnacle310e_init; | ||
742 | goto found; | ||
743 | } | ||
744 | |||
655 | return ret; | 745 | return ret; |
656 | } else { | 746 | } else { |
657 | /* Another interface on a multi-tuner device */ | 747 | /* Another interface on a multi-tuner device */ |
@@ -682,6 +772,7 @@ static struct usb_device_id m920x_table [] = { | |||
682 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, | 772 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, |
683 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, | 773 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, |
684 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, | 774 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, |
775 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) }, | ||
685 | { } /* Terminating entry */ | 776 | { } /* Terminating entry */ |
686 | }; | 777 | }; |
687 | MODULE_DEVICE_TABLE (usb, m920x_table); | 778 | MODULE_DEVICE_TABLE (usb, m920x_table); |
@@ -895,6 +986,56 @@ static struct dvb_usb_device_properties dposh_properties = { | |||
895 | } | 986 | } |
896 | }; | 987 | }; |
897 | 988 | ||
989 | static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { | ||
990 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
991 | |||
992 | .usb_ctrl = DEVICE_SPECIFIC, | ||
993 | .download_firmware = NULL, | ||
994 | |||
995 | .rc_interval = 100, | ||
996 | .rc_key_map = pinnacle310e_rc_keys, | ||
997 | .rc_key_map_size = ARRAY_SIZE(pinnacle310e_rc_keys), | ||
998 | .rc_query = m920x_rc_query, | ||
999 | |||
1000 | .size_of_priv = sizeof(struct m920x_state), | ||
1001 | |||
1002 | .identify_state = m920x_identify_state, | ||
1003 | .num_adapters = 1, | ||
1004 | .adapter = {{ | ||
1005 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
1006 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
1007 | |||
1008 | .pid_filter_count = 8, | ||
1009 | .pid_filter = m920x_pid_filter, | ||
1010 | .pid_filter_ctrl = m920x_pid_filter_ctrl, | ||
1011 | |||
1012 | .frontend_attach = m920x_mt352_frontend_attach, | ||
1013 | .tuner_attach = m920x_fmd1216me_tuner_attach, | ||
1014 | |||
1015 | .stream = { | ||
1016 | .type = USB_ISOC, | ||
1017 | .count = 5, | ||
1018 | .endpoint = 0x84, | ||
1019 | .u = { | ||
1020 | .isoc = { | ||
1021 | .framesperurb = 128, | ||
1022 | .framesize = 564, | ||
1023 | .interval = 1, | ||
1024 | } | ||
1025 | } | ||
1026 | }, | ||
1027 | } }, | ||
1028 | .i2c_algo = &m920x_i2c_algo, | ||
1029 | |||
1030 | .num_device_descs = 1, | ||
1031 | .devices = { | ||
1032 | { "Pinnacle PCTV 310e", | ||
1033 | { &m920x_table[6], NULL }, | ||
1034 | { NULL }, | ||
1035 | } | ||
1036 | } | ||
1037 | }; | ||
1038 | |||
898 | static struct usb_driver m920x_driver = { | 1039 | static struct usb_driver m920x_driver = { |
899 | .name = "dvb_usb_m920x", | 1040 | .name = "dvb_usb_m920x", |
900 | .probe = m920x_probe, | 1041 | .probe = m920x_probe, |
diff --git a/drivers/media/dvb/dvb-usb/m920x.h b/drivers/media/dvb/dvb-usb/m920x.h index 37532890accd..3c061518ffc1 100644 --- a/drivers/media/dvb/dvb-usb/m920x.h +++ b/drivers/media/dvb/dvb-usb/m920x.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #define M9206_FW 0x30 | 18 | #define M9206_FW 0x30 |
19 | 19 | ||
20 | #define M9206_MAX_FILTERS 8 | 20 | #define M9206_MAX_FILTERS 8 |
21 | #define M9206_MAX_ADAPTERS 2 | 21 | #define M9206_MAX_ADAPTERS 4 |
22 | 22 | ||
23 | /* | 23 | /* |
24 | sequences found in logs: | 24 | sequences found in logs: |
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index d4e230941679..830557696ae6 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -138,7 +138,7 @@ static int opera1_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
138 | (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), | 138 | (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), |
139 | msg[i].buf, | 139 | msg[i].buf, |
140 | msg[i].len | 140 | msg[i].len |
141 | )!= msg[i].len)) { | 141 | )) != msg[i].len) { |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | if (dvb_usb_opera1_debug & 0x10) | 144 | if (dvb_usb_opera1_debug & 0x10) |