diff options
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
49 files changed, 6009 insertions, 1923 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index fdc19bba2128..e85304c59a2b 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DVB_USB | 1 | config DVB_USB |
2 | tristate "Support for various USB DVB devices" | 2 | tristate "Support for various USB DVB devices" |
3 | depends on DVB_CORE && USB && I2C && IR_CORE | 3 | depends on DVB_CORE && USB && I2C && RC_CORE |
4 | help | 4 | help |
5 | By enabling this you will be able to choose the various supported | 5 | By enabling this you will be able to choose the various supported |
6 | USB1.1 and USB2.0 DVB devices. | 6 | USB1.1 and USB2.0 DVB devices. |
@@ -292,6 +292,11 @@ config DVB_USB_ANYSEE | |||
292 | select DVB_MT352 if !DVB_FE_CUSTOMISE | 292 | select DVB_MT352 if !DVB_FE_CUSTOMISE |
293 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | 293 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
294 | select DVB_TDA10023 if !DVB_FE_CUSTOMISE | 294 | select DVB_TDA10023 if !DVB_FE_CUSTOMISE |
295 | select MEDIA_TUNER_TDA18212 if !MEDIA_TUNER_CUSTOMISE | ||
296 | select DVB_CX24116 if !DVB_FE_CUSTOMISE | ||
297 | select DVB_STV0900 if !DVB_FE_CUSTOMISE | ||
298 | select DVB_STV6110 if !DVB_FE_CUSTOMISE | ||
299 | select DVB_ISL6423 if !DVB_FE_CUSTOMISE | ||
295 | help | 300 | help |
296 | Say Y here to support the Anysee E30, Anysee E30 Plus or | 301 | Say Y here to support the Anysee E30, Anysee E30 Plus or |
297 | Anysee E30 C Plus DVB USB2.0 receiver. | 302 | Anysee E30 C Plus DVB USB2.0 receiver. |
@@ -314,6 +319,8 @@ config DVB_USB_AF9015 | |||
314 | select MEDIA_TUNER_TDA18271 if !MEDIA_TUNER_CUSTOMISE | 319 | select MEDIA_TUNER_TDA18271 if !MEDIA_TUNER_CUSTOMISE |
315 | select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE | 320 | select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE |
316 | select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE | 321 | select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE |
322 | select MEDIA_TUNER_TDA18218 if !MEDIA_TUNER_CUSTOMISE | ||
323 | select MEDIA_TUNER_MXL5007T if !MEDIA_TUNER_CUSTOMISE | ||
317 | help | 324 | help |
318 | Say Y here to support the Afatech AF9015 based DVB-T USB2.0 receiver | 325 | Say Y here to support the Afatech AF9015 based DVB-T USB2.0 receiver |
319 | 326 | ||
@@ -346,3 +353,23 @@ config DVB_USB_AZ6027 | |||
346 | select DVB_STB6100 if !DVB_FE_CUSTOMISE | 353 | select DVB_STB6100 if !DVB_FE_CUSTOMISE |
347 | help | 354 | help |
348 | Say Y here to support the AZ6027 device | 355 | Say Y here to support the AZ6027 device |
356 | |||
357 | config DVB_USB_LME2510 | ||
358 | tristate "LME DM04/QQBOX DVB-S USB2.0 support" | ||
359 | depends on DVB_USB | ||
360 | select DVB_TDA10086 if !DVB_FE_CUSTOMISE | ||
361 | select DVB_TDA826X if !DVB_FE_CUSTOMISE | ||
362 | select DVB_STV0288 if !DVB_FE_CUSTOMISE | ||
363 | select DVB_IX2505V if !DVB_FE_CUSTOMISE | ||
364 | select DVB_STV0299 if !DVB_FE_CUSTOMISE | ||
365 | select DVB_PLL if !DVB_FE_CUSTOMISE | ||
366 | help | ||
367 | Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 . | ||
368 | |||
369 | config DVB_USB_TECHNISAT_USB2 | ||
370 | tristate "Technisat DVB-S/S2 USB2.0 support" | ||
371 | depends on DVB_USB | ||
372 | select DVB_STV090x if !DVB_FE_CUSTOMISE | ||
373 | select DVB_STV6110x if !DVB_FE_CUSTOMISE | ||
374 | help | ||
375 | Say Y here to support the Technisat USB2 DVB-S/S2 device | ||
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 1a192453b0e7..4bac13da0c39 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -88,6 +88,12 @@ obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o | |||
88 | dvb-usb-az6027-objs = az6027.o | 88 | dvb-usb-az6027-objs = az6027.o |
89 | obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o | 89 | obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o |
90 | 90 | ||
91 | dvb-usb-lmedm04-objs = lmedm04.o | ||
92 | obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o | ||
93 | |||
94 | dvb-usb-technisat-usb2-objs = technisat-usb2.o | ||
95 | obj-$(CONFIG_DVB_USB_TECHNISAT_USB2) += dvb-usb-technisat-usb2.o | ||
96 | |||
91 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 97 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
92 | # due to tuner-xc3028 | 98 | # due to tuner-xc3028 |
93 | EXTRA_CFLAGS += -Idrivers/media/common/tuners | 99 | EXTRA_CFLAGS += -Idrivers/media/common/tuners |
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index a5c363727133..b95a95e17840 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c | |||
@@ -37,9 +37,9 @@ static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_pr | |||
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | static struct ir_scancode ir_codes_a800_table[] = { | 40 | static struct rc_map_table rc_map_a800_table[] = { |
41 | { 0x0201, KEY_PROG1 }, /* SOURCE */ | 41 | { 0x0201, KEY_MODE }, /* SOURCE */ |
42 | { 0x0200, KEY_POWER }, /* POWER */ | 42 | { 0x0200, KEY_POWER2 }, /* POWER */ |
43 | { 0x0205, KEY_1 }, /* 1 */ | 43 | { 0x0205, KEY_1 }, /* 1 */ |
44 | { 0x0206, KEY_2 }, /* 2 */ | 44 | { 0x0206, KEY_2 }, /* 2 */ |
45 | { 0x0207, KEY_3 }, /* 3 */ | 45 | { 0x0207, KEY_3 }, /* 3 */ |
@@ -52,8 +52,8 @@ static struct ir_scancode ir_codes_a800_table[] = { | |||
52 | { 0x0212, KEY_LEFT }, /* L / DISPLAY */ | 52 | { 0x0212, KEY_LEFT }, /* L / DISPLAY */ |
53 | { 0x0211, KEY_0 }, /* 0 */ | 53 | { 0x0211, KEY_0 }, /* 0 */ |
54 | { 0x0213, KEY_RIGHT }, /* R / CH RTN */ | 54 | { 0x0213, KEY_RIGHT }, /* R / CH RTN */ |
55 | { 0x0217, KEY_PROG2 }, /* SNAP SHOT */ | 55 | { 0x0217, KEY_CAMERA }, /* SNAP SHOT */ |
56 | { 0x0210, KEY_PROG3 }, /* 16-CH PREV */ | 56 | { 0x0210, KEY_LAST }, /* 16-CH PREV */ |
57 | { 0x021e, KEY_VOLUMEDOWN }, /* VOL DOWN */ | 57 | { 0x021e, KEY_VOLUMEDOWN }, /* VOL DOWN */ |
58 | { 0x020c, KEY_ZOOM }, /* FULL SCREEN */ | 58 | { 0x020c, KEY_ZOOM }, /* FULL SCREEN */ |
59 | { 0x021f, KEY_VOLUMEUP }, /* VOL UP */ | 59 | { 0x021f, KEY_VOLUMEUP }, /* VOL UP */ |
@@ -78,17 +78,26 @@ static struct ir_scancode ir_codes_a800_table[] = { | |||
78 | 78 | ||
79 | static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 79 | static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
80 | { | 80 | { |
81 | u8 key[5]; | 81 | int ret; |
82 | u8 *key = kmalloc(5, GFP_KERNEL); | ||
83 | if (!key) | ||
84 | return -ENOMEM; | ||
85 | |||
82 | if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), | 86 | if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), |
83 | 0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5, | 87 | 0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5, |
84 | 2000) != 5) | 88 | 2000) != 5) { |
85 | return -ENODEV; | 89 | ret = -ENODEV; |
90 | goto out; | ||
91 | } | ||
86 | 92 | ||
87 | /* call the universal NEC remote processor, to find out the key's state and event */ | 93 | /* call the universal NEC remote processor, to find out the key's state and event */ |
88 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | 94 | dvb_usb_nec_rc_key_to_event(d,key,event,state); |
89 | if (key[0] != 0) | 95 | if (key[0] != 0) |
90 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | 96 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); |
91 | return 0; | 97 | ret = 0; |
98 | out: | ||
99 | kfree(key); | ||
100 | return ret; | ||
92 | } | 101 | } |
93 | 102 | ||
94 | /* USB Driver stuff */ | 103 | /* USB Driver stuff */ |
@@ -148,8 +157,8 @@ static struct dvb_usb_device_properties a800_properties = { | |||
148 | 157 | ||
149 | .rc.legacy = { | 158 | .rc.legacy = { |
150 | .rc_interval = DEFAULT_RC_INTERVAL, | 159 | .rc_interval = DEFAULT_RC_INTERVAL, |
151 | .rc_key_map = ir_codes_a800_table, | 160 | .rc_map_table = rc_map_a800_table, |
152 | .rc_key_map_size = ARRAY_SIZE(ir_codes_a800_table), | 161 | .rc_map_size = ARRAY_SIZE(rc_map_a800_table), |
153 | .rc_query = a800_rc_query, | 162 | .rc_query = a800_rc_query, |
154 | }, | 163 | }, |
155 | 164 | ||
diff --git a/drivers/media/dvb/dvb-usb/af9005-fe.c b/drivers/media/dvb/dvb-usb/af9005-fe.c index 199ece0d4883..6ad94745bbdd 100644 --- a/drivers/media/dvb/dvb-usb/af9005-fe.c +++ b/drivers/media/dvb/dvb-usb/af9005-fe.c | |||
@@ -580,7 +580,7 @@ static int af9005_fe_program_cfoe(struct dvb_usb_device *d, fe_bandwidth_t bw) | |||
580 | NS_coeff2_8k = 0x724925; | 580 | NS_coeff2_8k = 0x724925; |
581 | break; | 581 | break; |
582 | default: | 582 | default: |
583 | err("Invalid bandwith %d.", bw); | 583 | err("Invalid bandwidth %d.", bw); |
584 | return -EINVAL; | 584 | return -EINVAL; |
585 | } | 585 | } |
586 | 586 | ||
@@ -789,7 +789,7 @@ static int af9005_fe_select_bw(struct dvb_usb_device *d, fe_bandwidth_t bw) | |||
789 | temp = 2; | 789 | temp = 2; |
790 | break; | 790 | break; |
791 | default: | 791 | default: |
792 | err("Invalid bandwith %d.", bw); | 792 | err("Invalid bandwidth %d.", bw); |
793 | return -EINVAL; | 793 | return -EINVAL; |
794 | } | 794 | } |
795 | return af9005_write_register_bits(d, xd_g_reg_bw, reg_bw_pos, | 795 | return af9005_write_register_bits(d, xd_g_reg_bw, reg_bw_pos, |
@@ -930,7 +930,7 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
930 | if (ret) | 930 | if (ret) |
931 | return ret; | 931 | return ret; |
932 | 932 | ||
933 | /* init other parameters: program cfoe and select bandwith */ | 933 | /* init other parameters: program cfoe and select bandwidth */ |
934 | deb_info("program cfoe\n"); | 934 | deb_info("program cfoe\n"); |
935 | if ((ret = af9005_fe_program_cfoe(state->d, BANDWIDTH_6_MHZ))) | 935 | if ((ret = af9005_fe_program_cfoe(state->d, BANDWIDTH_6_MHZ))) |
936 | return ret; | 936 | return ret; |
@@ -1167,7 +1167,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1167 | if (ret) | 1167 | if (ret) |
1168 | return ret; | 1168 | return ret; |
1169 | 1169 | ||
1170 | /* select bandwith */ | 1170 | /* select bandwidth */ |
1171 | deb_info("select bandwidth"); | 1171 | deb_info("select bandwidth"); |
1172 | ret = af9005_fe_select_bw(state->d, fep->u.ofdm.bandwidth); | 1172 | ret = af9005_fe_select_bw(state->d, fep->u.ofdm.bandwidth); |
1173 | if (ret) | 1173 | if (ret) |
diff --git a/drivers/media/dvb/dvb-usb/af9005-remote.c b/drivers/media/dvb/dvb-usb/af9005-remote.c index 696207fe37ec..c3bc64ed405c 100644 --- a/drivers/media/dvb/dvb-usb/af9005-remote.c +++ b/drivers/media/dvb/dvb-usb/af9005-remote.c | |||
@@ -33,7 +33,7 @@ MODULE_PARM_DESC(debug, | |||
33 | 33 | ||
34 | #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) | 34 | #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) |
35 | 35 | ||
36 | struct ir_scancode ir_codes_af9005_table[] = { | 36 | struct rc_map_table rc_map_af9005_table[] = { |
37 | 37 | ||
38 | {0x01b7, KEY_POWER}, | 38 | {0x01b7, KEY_POWER}, |
39 | {0x01a7, KEY_VOLUMEUP}, | 39 | {0x01a7, KEY_VOLUMEUP}, |
@@ -74,7 +74,7 @@ struct ir_scancode ir_codes_af9005_table[] = { | |||
74 | {0x00d5, KEY_GOTO}, /* marked jump on the remote */ | 74 | {0x00d5, KEY_GOTO}, /* marked jump on the remote */ |
75 | }; | 75 | }; |
76 | 76 | ||
77 | int ir_codes_af9005_table_size = ARRAY_SIZE(ir_codes_af9005_table); | 77 | int rc_map_af9005_table_size = ARRAY_SIZE(rc_map_af9005_table); |
78 | 78 | ||
79 | static int repeatable_keys[] = { | 79 | static int repeatable_keys[] = { |
80 | KEY_VOLUMEUP, | 80 | KEY_VOLUMEUP, |
@@ -130,10 +130,10 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, | |||
130 | deb_decode("code != inverted code\n"); | 130 | deb_decode("code != inverted code\n"); |
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
133 | for (i = 0; i < ir_codes_af9005_table_size; i++) { | 133 | for (i = 0; i < rc_map_af9005_table_size; i++) { |
134 | if (rc5_custom(&ir_codes_af9005_table[i]) == cust | 134 | if (rc5_custom(&rc_map_af9005_table[i]) == cust |
135 | && rc5_data(&ir_codes_af9005_table[i]) == dat) { | 135 | && rc5_data(&rc_map_af9005_table[i]) == dat) { |
136 | *event = ir_codes_af9005_table[i].keycode; | 136 | *event = rc_map_af9005_table[i].keycode; |
137 | *state = REMOTE_KEY_PRESSED; | 137 | *state = REMOTE_KEY_PRESSED; |
138 | deb_decode | 138 | deb_decode |
139 | ("key pressed, event %x\n", *event); | 139 | ("key pressed, event %x\n", *event); |
@@ -146,8 +146,8 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, | |||
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
148 | 148 | ||
149 | EXPORT_SYMBOL(ir_codes_af9005_table); | 149 | EXPORT_SYMBOL(rc_map_af9005_table); |
150 | EXPORT_SYMBOL(ir_codes_af9005_table_size); | 150 | EXPORT_SYMBOL(rc_map_af9005_table_size); |
151 | EXPORT_SYMBOL(af9005_rc_decode); | 151 | EXPORT_SYMBOL(af9005_rc_decode); |
152 | 152 | ||
153 | MODULE_AUTHOR("Luca Olivetti <luca@ventoso.org>"); | 153 | MODULE_AUTHOR("Luca Olivetti <luca@ventoso.org>"); |
diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c index 8ecba8848bcf..51f6439dcfd5 100644 --- a/drivers/media/dvb/dvb-usb/af9005.c +++ b/drivers/media/dvb/dvb-usb/af9005.c | |||
@@ -1027,8 +1027,8 @@ static struct dvb_usb_device_properties af9005_properties = { | |||
1027 | 1027 | ||
1028 | .rc.legacy = { | 1028 | .rc.legacy = { |
1029 | .rc_interval = 200, | 1029 | .rc_interval = 200, |
1030 | .rc_key_map = NULL, | 1030 | .rc_map_table = NULL, |
1031 | .rc_key_map_size = 0, | 1031 | .rc_map_size = 0, |
1032 | .rc_query = af9005_rc_query, | 1032 | .rc_query = af9005_rc_query, |
1033 | }, | 1033 | }, |
1034 | 1034 | ||
@@ -1070,14 +1070,14 @@ static int __init af9005_usb_module_init(void) | |||
1070 | return result; | 1070 | return result; |
1071 | } | 1071 | } |
1072 | rc_decode = symbol_request(af9005_rc_decode); | 1072 | rc_decode = symbol_request(af9005_rc_decode); |
1073 | rc_keys = symbol_request(ir_codes_af9005_table); | 1073 | rc_keys = symbol_request(rc_map_af9005_table); |
1074 | rc_keys_size = symbol_request(ir_codes_af9005_table_size); | 1074 | rc_keys_size = symbol_request(rc_map_af9005_table_size); |
1075 | if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { | 1075 | if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { |
1076 | err("af9005_rc_decode function not found, disabling remote"); | 1076 | err("af9005_rc_decode function not found, disabling remote"); |
1077 | af9005_properties.rc.legacy.rc_query = NULL; | 1077 | af9005_properties.rc.legacy.rc_query = NULL; |
1078 | } else { | 1078 | } else { |
1079 | af9005_properties.rc.legacy.rc_key_map = rc_keys; | 1079 | af9005_properties.rc.legacy.rc_map_table = rc_keys; |
1080 | af9005_properties.rc.legacy.rc_key_map_size = *rc_keys_size; | 1080 | af9005_properties.rc.legacy.rc_map_size = *rc_keys_size; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | return 0; | 1083 | return 0; |
@@ -1089,9 +1089,9 @@ static void __exit af9005_usb_module_exit(void) | |||
1089 | if (rc_decode != NULL) | 1089 | if (rc_decode != NULL) |
1090 | symbol_put(af9005_rc_decode); | 1090 | symbol_put(af9005_rc_decode); |
1091 | if (rc_keys != NULL) | 1091 | if (rc_keys != NULL) |
1092 | symbol_put(ir_codes_af9005_table); | 1092 | symbol_put(rc_map_af9005_table); |
1093 | if (rc_keys_size != NULL) | 1093 | if (rc_keys_size != NULL) |
1094 | symbol_put(ir_codes_af9005_table_size); | 1094 | symbol_put(rc_map_af9005_table_size); |
1095 | /* deregister this driver from the USB subsystem */ | 1095 | /* deregister this driver from the USB subsystem */ |
1096 | usb_deregister(&af9005_usb_driver); | 1096 | usb_deregister(&af9005_usb_driver); |
1097 | } | 1097 | } |
diff --git a/drivers/media/dvb/dvb-usb/af9005.h b/drivers/media/dvb/dvb-usb/af9005.h index 3c1fbd1c5d60..c71c77bd7f4b 100644 --- a/drivers/media/dvb/dvb-usb/af9005.h +++ b/drivers/media/dvb/dvb-usb/af9005.h | |||
@@ -3490,7 +3490,7 @@ extern u8 regmask[8]; | |||
3490 | /* remote control decoder */ | 3490 | /* remote control decoder */ |
3491 | extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, | 3491 | extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, |
3492 | u32 * event, int *state); | 3492 | u32 * event, int *state); |
3493 | extern struct ir_scancode ir_codes_af9005_table[]; | 3493 | extern struct rc_map_table rc_map_af9005_table[]; |
3494 | extern int ir_codes_af9005_table_size; | 3494 | extern int rc_map_af9005_table_size; |
3495 | 3495 | ||
3496 | #endif | 3496 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index ea1ed3b4592a..100ebc37e99e 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "tda18271.h" | 31 | #include "tda18271.h" |
32 | #include "mxl5005s.h" | 32 | #include "mxl5005s.h" |
33 | #include "mc44s803.h" | 33 | #include "mc44s803.h" |
34 | #include "tda18218.h" | ||
35 | #include "mxl5007t.h" | ||
34 | 36 | ||
35 | static int dvb_usb_af9015_debug; | 37 | static int dvb_usb_af9015_debug; |
36 | module_param_named(debug, dvb_usb_af9015_debug, int, 0644); | 38 | module_param_named(debug, dvb_usb_af9015_debug, int, 0644); |
@@ -205,12 +207,18 @@ static int af9015_write_reg(struct dvb_usb_device *d, u16 addr, u8 val) | |||
205 | return af9015_write_regs(d, addr, &val, 1); | 207 | return af9015_write_regs(d, addr, &val, 1); |
206 | } | 208 | } |
207 | 209 | ||
208 | static int af9015_read_reg(struct dvb_usb_device *d, u16 addr, u8 *val) | 210 | static int af9015_read_regs(struct dvb_usb_device *d, u16 addr, u8 *val, u8 len) |
209 | { | 211 | { |
210 | struct req_t req = {READ_MEMORY, AF9015_I2C_DEMOD, addr, 0, 0, 1, val}; | 212 | struct req_t req = {READ_MEMORY, AF9015_I2C_DEMOD, addr, 0, 0, len, |
213 | val}; | ||
211 | return af9015_ctrl_msg(d, &req); | 214 | return af9015_ctrl_msg(d, &req); |
212 | } | 215 | } |
213 | 216 | ||
217 | static int af9015_read_reg(struct dvb_usb_device *d, u16 addr, u8 *val) | ||
218 | { | ||
219 | return af9015_read_regs(d, addr, val, 1); | ||
220 | } | ||
221 | |||
214 | static int af9015_write_reg_i2c(struct dvb_usb_device *d, u8 addr, u16 reg, | 222 | static int af9015_write_reg_i2c(struct dvb_usb_device *d, u8 addr, u16 reg, |
215 | u8 val) | 223 | u8 val) |
216 | { | 224 | { |
@@ -241,7 +249,7 @@ static int af9015_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
241 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 249 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
242 | int ret = 0, i = 0; | 250 | int ret = 0, i = 0; |
243 | u16 addr; | 251 | u16 addr; |
244 | u8 mbox, addr_len; | 252 | u8 uninitialized_var(mbox), addr_len; |
245 | struct req_t req; | 253 | struct req_t req; |
246 | 254 | ||
247 | /* TODO: implement bus lock | 255 | /* TODO: implement bus lock |
@@ -280,7 +288,7 @@ Due to that the only way to select correct tuner is use demodulator I2C-gate. | |||
280 | } else { | 288 | } else { |
281 | addr = msg[i].buf[0]; | 289 | addr = msg[i].buf[0]; |
282 | addr_len = 1; | 290 | addr_len = 1; |
283 | mbox = 0; | 291 | /* mbox is don't care in that case */ |
284 | } | 292 | } |
285 | 293 | ||
286 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { | 294 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { |
@@ -471,6 +479,7 @@ static int af9015_init_endpoint(struct dvb_usb_device *d) | |||
471 | ret = af9015_set_reg_bit(d, 0xd50b, 0); | 479 | ret = af9015_set_reg_bit(d, 0xd50b, 0); |
472 | else | 480 | else |
473 | ret = af9015_clear_reg_bit(d, 0xd50b, 0); | 481 | ret = af9015_clear_reg_bit(d, 0xd50b, 0); |
482 | |||
474 | error: | 483 | error: |
475 | if (ret) | 484 | if (ret) |
476 | err("endpoint init failed:%d", ret); | 485 | err("endpoint init failed:%d", ret); |
@@ -494,7 +503,8 @@ static int af9015_copy_firmware(struct dvb_usb_device *d) | |||
494 | /* wait 2nd demodulator ready */ | 503 | /* wait 2nd demodulator ready */ |
495 | msleep(100); | 504 | msleep(100); |
496 | 505 | ||
497 | ret = af9015_read_reg_i2c(d, 0x3a, 0x98be, &val); | 506 | ret = af9015_read_reg_i2c(d, |
507 | af9015_af9013_config[1].demod_address, 0x98be, &val); | ||
498 | if (ret) | 508 | if (ret) |
499 | goto error; | 509 | goto error; |
500 | else | 510 | else |
@@ -597,47 +607,17 @@ free: | |||
597 | return ret; | 607 | return ret; |
598 | } | 608 | } |
599 | 609 | ||
600 | static int af9015_download_ir_table(struct dvb_usb_device *d) | ||
601 | { | ||
602 | int i, packets = 0, ret; | ||
603 | u16 addr = 0x9a56; /* ir-table start address */ | ||
604 | struct req_t req = {WRITE_MEMORY, 0, 0, 0, 0, 1, NULL}; | ||
605 | u8 *data = NULL; | ||
606 | deb_info("%s:\n", __func__); | ||
607 | |||
608 | data = af9015_config.ir_table; | ||
609 | packets = af9015_config.ir_table_size; | ||
610 | |||
611 | /* no remote */ | ||
612 | if (!packets) | ||
613 | goto exit; | ||
614 | |||
615 | /* load remote ir-table */ | ||
616 | for (i = 0; i < packets; i++) { | ||
617 | req.addr = addr + i; | ||
618 | req.data = &data[i]; | ||
619 | ret = af9015_ctrl_msg(d, &req); | ||
620 | if (ret) { | ||
621 | err("ir-table download failed at packet %d with " \ | ||
622 | "code %d", i, ret); | ||
623 | return ret; | ||
624 | } | ||
625 | } | ||
626 | |||
627 | exit: | ||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | static int af9015_init(struct dvb_usb_device *d) | 610 | static int af9015_init(struct dvb_usb_device *d) |
632 | { | 611 | { |
633 | int ret; | 612 | int ret; |
634 | deb_info("%s:\n", __func__); | 613 | deb_info("%s:\n", __func__); |
635 | 614 | ||
636 | ret = af9015_init_endpoint(d); | 615 | /* init RC canary */ |
616 | ret = af9015_write_reg(d, 0x98e9, 0xff); | ||
637 | if (ret) | 617 | if (ret) |
638 | goto error; | 618 | goto error; |
639 | 619 | ||
640 | ret = af9015_download_ir_table(d); | 620 | ret = af9015_init_endpoint(d); |
641 | if (ret) | 621 | if (ret) |
642 | goto error; | 622 | goto error; |
643 | 623 | ||
@@ -685,9 +665,8 @@ error: | |||
685 | static int af9015_download_firmware(struct usb_device *udev, | 665 | static int af9015_download_firmware(struct usb_device *udev, |
686 | const struct firmware *fw) | 666 | const struct firmware *fw) |
687 | { | 667 | { |
688 | int i, len, packets, remainder, ret; | 668 | int i, len, remaining, ret; |
689 | struct req_t req = {DOWNLOAD_FIRMWARE, 0, 0, 0, 0, 0, NULL}; | 669 | struct req_t req = {DOWNLOAD_FIRMWARE, 0, 0, 0, 0, 0, NULL}; |
690 | u16 addr = 0x5100; /* firmware start address */ | ||
691 | u16 checksum = 0; | 670 | u16 checksum = 0; |
692 | 671 | ||
693 | deb_info("%s:\n", __func__); | 672 | deb_info("%s:\n", __func__); |
@@ -699,24 +678,20 @@ static int af9015_download_firmware(struct usb_device *udev, | |||
699 | af9015_config.firmware_size = fw->size; | 678 | af9015_config.firmware_size = fw->size; |
700 | af9015_config.firmware_checksum = checksum; | 679 | af9015_config.firmware_checksum = checksum; |
701 | 680 | ||
702 | #define FW_PACKET_MAX_DATA 55 | 681 | #define FW_ADDR 0x5100 /* firmware start address */ |
703 | 682 | #define LEN_MAX 55 /* max packet size */ | |
704 | packets = fw->size / FW_PACKET_MAX_DATA; | 683 | for (remaining = fw->size; remaining > 0; remaining -= LEN_MAX) { |
705 | remainder = fw->size % FW_PACKET_MAX_DATA; | 684 | len = remaining; |
706 | len = FW_PACKET_MAX_DATA; | 685 | if (len > LEN_MAX) |
707 | for (i = 0; i <= packets; i++) { | 686 | len = LEN_MAX; |
708 | if (i == packets) /* set size of the last packet */ | ||
709 | len = remainder; | ||
710 | 687 | ||
711 | req.data_len = len; | 688 | req.data_len = len; |
712 | req.data = (u8 *)(fw->data + i * FW_PACKET_MAX_DATA); | 689 | req.data = (u8 *) &fw->data[fw->size - remaining]; |
713 | req.addr = addr; | 690 | req.addr = FW_ADDR + fw->size - remaining; |
714 | addr += FW_PACKET_MAX_DATA; | ||
715 | 691 | ||
716 | ret = af9015_rw_udev(udev, &req); | 692 | ret = af9015_rw_udev(udev, &req); |
717 | if (ret) { | 693 | if (ret) { |
718 | err("firmware download failed at packet %d with " \ | 694 | err("firmware download failed:%d", ret); |
719 | "code %d", i, ret); | ||
720 | goto error; | 695 | goto error; |
721 | } | 696 | } |
722 | } | 697 | } |
@@ -733,125 +708,104 @@ error: | |||
733 | return ret; | 708 | return ret; |
734 | } | 709 | } |
735 | 710 | ||
736 | struct af9015_setup { | 711 | struct af9015_rc_setup { |
737 | unsigned int id; | 712 | unsigned int id; |
738 | struct ir_scancode *rc_key_map; | 713 | char *rc_codes; |
739 | unsigned int rc_key_map_size; | ||
740 | u8 *ir_table; | ||
741 | unsigned int ir_table_size; | ||
742 | }; | 714 | }; |
743 | 715 | ||
744 | static const struct af9015_setup *af9015_setup_match(unsigned int id, | 716 | static char *af9015_rc_setup_match(unsigned int id, |
745 | const struct af9015_setup *table) | 717 | const struct af9015_rc_setup *table) |
746 | { | 718 | { |
747 | for (; table->rc_key_map; table++) | 719 | for (; table->rc_codes; table++) |
748 | if (table->id == id) | 720 | if (table->id == id) |
749 | return table; | 721 | return table->rc_codes; |
750 | return NULL; | 722 | return NULL; |
751 | } | 723 | } |
752 | 724 | ||
753 | static const struct af9015_setup af9015_setup_modparam[] = { | 725 | static const struct af9015_rc_setup af9015_rc_setup_modparam[] = { |
754 | { AF9015_REMOTE_A_LINK_DTU_M, | 726 | { AF9015_REMOTE_A_LINK_DTU_M, RC_MAP_ALINK_DTU_M }, |
755 | ir_codes_af9015_table_a_link, ARRAY_SIZE(ir_codes_af9015_table_a_link), | 727 | { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, RC_MAP_MSI_DIGIVOX_II }, |
756 | af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, | 728 | { AF9015_REMOTE_MYGICTV_U718, RC_MAP_TOTAL_MEDIA_IN_HAND }, |
757 | { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, | 729 | { AF9015_REMOTE_DIGITTRADE_DVB_T, RC_MAP_DIGITTRADE }, |
758 | ir_codes_af9015_table_msi, ARRAY_SIZE(ir_codes_af9015_table_msi), | 730 | { AF9015_REMOTE_AVERMEDIA_KS, RC_MAP_AVERMEDIA_RM_KS }, |
759 | af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, | ||
760 | { AF9015_REMOTE_MYGICTV_U718, | ||
761 | ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv), | ||
762 | af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, | ||
763 | { AF9015_REMOTE_DIGITTRADE_DVB_T, | ||
764 | ir_codes_af9015_table_digittrade, ARRAY_SIZE(ir_codes_af9015_table_digittrade), | ||
765 | af9015_ir_table_digittrade, ARRAY_SIZE(af9015_ir_table_digittrade) }, | ||
766 | { AF9015_REMOTE_AVERMEDIA_KS, | ||
767 | ir_codes_af9015_table_avermedia, ARRAY_SIZE(ir_codes_af9015_table_avermedia), | ||
768 | af9015_ir_table_avermedia_ks, ARRAY_SIZE(af9015_ir_table_avermedia_ks) }, | ||
769 | { } | 731 | { } |
770 | }; | 732 | }; |
771 | 733 | ||
772 | /* don't add new entries here anymore, use hashes instead */ | 734 | static const struct af9015_rc_setup af9015_rc_setup_hashes[] = { |
773 | static const struct af9015_setup af9015_setup_usbids[] = { | 735 | { 0xb8feb708, RC_MAP_MSI_DIGIVOX_II }, |
774 | { USB_VID_LEADTEK, | 736 | { 0xa3703d00, RC_MAP_ALINK_DTU_M }, |
775 | ir_codes_af9015_table_leadtek, ARRAY_SIZE(ir_codes_af9015_table_leadtek), | 737 | { 0x9b7dc64e, RC_MAP_TOTAL_MEDIA_IN_HAND }, /* MYGICTV U718 */ |
776 | af9015_ir_table_leadtek, ARRAY_SIZE(af9015_ir_table_leadtek) }, | ||
777 | { USB_VID_VISIONPLUS, | ||
778 | ir_codes_af9015_table_twinhan, ARRAY_SIZE(ir_codes_af9015_table_twinhan), | ||
779 | af9015_ir_table_twinhan, ARRAY_SIZE(af9015_ir_table_twinhan) }, | ||
780 | { USB_VID_KWORLD_2, /* TODO: use correct rc keys */ | ||
781 | ir_codes_af9015_table_twinhan, ARRAY_SIZE(ir_codes_af9015_table_twinhan), | ||
782 | af9015_ir_table_kworld, ARRAY_SIZE(af9015_ir_table_kworld) }, | ||
783 | { USB_VID_AVERMEDIA, | ||
784 | ir_codes_af9015_table_avermedia, ARRAY_SIZE(ir_codes_af9015_table_avermedia), | ||
785 | af9015_ir_table_avermedia, ARRAY_SIZE(af9015_ir_table_avermedia) }, | ||
786 | { USB_VID_MSI_2, | ||
787 | ir_codes_af9015_table_msi_digivox_iii, ARRAY_SIZE(ir_codes_af9015_table_msi_digivox_iii), | ||
788 | af9015_ir_table_msi_digivox_iii, ARRAY_SIZE(af9015_ir_table_msi_digivox_iii) }, | ||
789 | { } | 738 | { } |
790 | }; | 739 | }; |
791 | 740 | ||
792 | static const struct af9015_setup af9015_setup_hashes[] = { | 741 | static const struct af9015_rc_setup af9015_rc_setup_usbids[] = { |
793 | { 0xb8feb708, | 742 | { (USB_VID_TERRATEC << 16) + USB_PID_TERRATEC_CINERGY_T_STICK_RC, |
794 | ir_codes_af9015_table_msi, ARRAY_SIZE(ir_codes_af9015_table_msi), | 743 | RC_MAP_TERRATEC_SLIM_2 }, |
795 | af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, | 744 | { (USB_VID_TERRATEC << 16) + USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC, |
796 | { 0xa3703d00, | 745 | RC_MAP_TERRATEC_SLIM }, |
797 | ir_codes_af9015_table_a_link, ARRAY_SIZE(ir_codes_af9015_table_a_link), | 746 | { (USB_VID_VISIONPLUS << 16) + USB_PID_AZUREWAVE_AD_TU700, |
798 | af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, | 747 | RC_MAP_AZUREWAVE_AD_TU700 }, |
799 | { 0x9b7dc64e, | 748 | { (USB_VID_VISIONPLUS << 16) + USB_PID_TINYTWIN, |
800 | ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv), | 749 | RC_MAP_AZUREWAVE_AD_TU700 }, |
801 | af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, | 750 | { (USB_VID_MSI_2 << 16) + USB_PID_MSI_DIGI_VOX_MINI_III, |
751 | RC_MAP_MSI_DIGIVOX_III }, | ||
752 | { (USB_VID_LEADTEK << 16) + USB_PID_WINFAST_DTV_DONGLE_GOLD, | ||
753 | RC_MAP_LEADTEK_Y04G0051 }, | ||
754 | { (USB_VID_AVERMEDIA << 16) + USB_PID_AVERMEDIA_VOLAR_X, | ||
755 | RC_MAP_AVERMEDIA_M135A }, | ||
756 | { (USB_VID_AFATECH << 16) + USB_PID_TREKSTOR_DVBT, | ||
757 | RC_MAP_TREKSTOR }, | ||
758 | { (USB_VID_KWORLD_2 << 16) + USB_PID_TINYTWIN_2, | ||
759 | RC_MAP_DIGITALNOW_TINYTWIN }, | ||
760 | { (USB_VID_GTEK << 16) + USB_PID_TINYTWIN_3, | ||
761 | RC_MAP_DIGITALNOW_TINYTWIN }, | ||
802 | { } | 762 | { } |
803 | }; | 763 | }; |
804 | 764 | ||
805 | static void af9015_set_remote_config(struct usb_device *udev, | 765 | static void af9015_set_remote_config(struct usb_device *udev, |
806 | struct dvb_usb_device_properties *props) | 766 | struct dvb_usb_device_properties *props) |
807 | { | 767 | { |
808 | const struct af9015_setup *table = NULL; | 768 | u16 vid = le16_to_cpu(udev->descriptor.idVendor); |
809 | 769 | u16 pid = le16_to_cpu(udev->descriptor.idProduct); | |
810 | if (dvb_usb_af9015_remote) { | 770 | |
811 | /* load remote defined as module param */ | 771 | /* try to load remote based module param */ |
812 | table = af9015_setup_match(dvb_usb_af9015_remote, | 772 | props->rc.core.rc_codes = af9015_rc_setup_match( |
813 | af9015_setup_modparam); | 773 | dvb_usb_af9015_remote, af9015_rc_setup_modparam); |
814 | } else { | 774 | |
815 | u16 vendor = le16_to_cpu(udev->descriptor.idVendor); | 775 | /* try to load remote based eeprom hash */ |
816 | 776 | if (!props->rc.core.rc_codes) | |
817 | table = af9015_setup_match(af9015_config.eeprom_sum, | 777 | props->rc.core.rc_codes = af9015_rc_setup_match( |
818 | af9015_setup_hashes); | 778 | af9015_config.eeprom_sum, af9015_rc_setup_hashes); |
819 | 779 | ||
820 | if (!table && vendor == USB_VID_AFATECH) { | 780 | /* try to load remote based USB ID */ |
821 | /* Check USB manufacturer and product strings and try | 781 | if (!props->rc.core.rc_codes) |
822 | to determine correct remote in case of chip vendor | 782 | props->rc.core.rc_codes = af9015_rc_setup_match( |
823 | reference IDs are used. | 783 | (vid << 16) + pid, af9015_rc_setup_usbids); |
824 | DO NOT ADD ANYTHING NEW HERE. Use hashes instead. | 784 | |
825 | */ | 785 | /* try to load remote based USB iManufacturer string */ |
826 | char manufacturer[10]; | 786 | if (!props->rc.core.rc_codes && vid == USB_VID_AFATECH) { |
827 | memset(manufacturer, 0, sizeof(manufacturer)); | 787 | /* Check USB manufacturer and product strings and try |
828 | usb_string(udev, udev->descriptor.iManufacturer, | 788 | to determine correct remote in case of chip vendor |
829 | manufacturer, sizeof(manufacturer)); | 789 | reference IDs are used. |
830 | if (!strcmp("MSI", manufacturer)) { | 790 | DO NOT ADD ANYTHING NEW HERE. Use hashes instead. */ |
831 | /* iManufacturer 1 MSI | 791 | char manufacturer[10]; |
832 | iProduct 2 MSI K-VOX */ | 792 | memset(manufacturer, 0, sizeof(manufacturer)); |
833 | table = af9015_setup_match( | 793 | usb_string(udev, udev->descriptor.iManufacturer, |
834 | AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, | 794 | manufacturer, sizeof(manufacturer)); |
835 | af9015_setup_modparam); | 795 | if (!strcmp("MSI", manufacturer)) { |
836 | } else if (udev->descriptor.idProduct == | 796 | /* iManufacturer 1 MSI |
837 | cpu_to_le16(USB_PID_TREKSTOR_DVBT)) { | 797 | iProduct 2 MSI K-VOX */ |
838 | table = &(const struct af9015_setup){ 0, | 798 | props->rc.core.rc_codes = af9015_rc_setup_match( |
839 | ir_codes_af9015_table_trekstor, | 799 | AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, |
840 | ARRAY_SIZE(ir_codes_af9015_table_trekstor), | 800 | af9015_rc_setup_modparam); |
841 | af9015_ir_table_trekstor, | 801 | } |
842 | ARRAY_SIZE(af9015_ir_table_trekstor) | ||
843 | }; | ||
844 | } | ||
845 | } else if (!table) | ||
846 | table = af9015_setup_match(vendor, af9015_setup_usbids); | ||
847 | } | 802 | } |
848 | 803 | ||
849 | if (table) { | 804 | /* finally load "empty" just for leaving IR receiver enabled */ |
850 | props->rc.legacy.rc_key_map = table->rc_key_map; | 805 | if (!props->rc.core.rc_codes) |
851 | props->rc.legacy.rc_key_map_size = table->rc_key_map_size; | 806 | props->rc.core.rc_codes = RC_MAP_EMPTY; |
852 | af9015_config.ir_table = table->ir_table; | 807 | |
853 | af9015_config.ir_table_size = table->ir_table_size; | 808 | return; |
854 | } | ||
855 | } | 809 | } |
856 | 810 | ||
857 | static int af9015_read_config(struct usb_device *udev) | 811 | static int af9015_read_config(struct usb_device *udev) |
@@ -877,10 +831,9 @@ static int af9015_read_config(struct usb_device *udev) | |||
877 | 831 | ||
878 | deb_info("%s: IR mode:%d\n", __func__, val); | 832 | deb_info("%s: IR mode:%d\n", __func__, val); |
879 | for (i = 0; i < af9015_properties_count; i++) { | 833 | for (i = 0; i < af9015_properties_count; i++) { |
880 | if (val == AF9015_IR_MODE_DISABLED) { | 834 | if (val == AF9015_IR_MODE_DISABLED) |
881 | af9015_properties[i].rc.legacy.rc_key_map = NULL; | 835 | af9015_properties[i].rc.core.rc_codes = NULL; |
882 | af9015_properties[i].rc.legacy.rc_key_map_size = 0; | 836 | else |
883 | } else | ||
884 | af9015_set_remote_config(udev, &af9015_properties[i]); | 837 | af9015_set_remote_config(udev, &af9015_properties[i]); |
885 | } | 838 | } |
886 | 839 | ||
@@ -992,20 +945,19 @@ static int af9015_read_config(struct usb_device *udev) | |||
992 | case AF9013_TUNER_MT2060_2: | 945 | case AF9013_TUNER_MT2060_2: |
993 | case AF9013_TUNER_TDA18271: | 946 | case AF9013_TUNER_TDA18271: |
994 | case AF9013_TUNER_QT1010A: | 947 | case AF9013_TUNER_QT1010A: |
948 | case AF9013_TUNER_TDA18218: | ||
995 | af9015_af9013_config[i].rf_spec_inv = 1; | 949 | af9015_af9013_config[i].rf_spec_inv = 1; |
996 | break; | 950 | break; |
997 | case AF9013_TUNER_MXL5003D: | 951 | case AF9013_TUNER_MXL5003D: |
998 | case AF9013_TUNER_MXL5005D: | 952 | case AF9013_TUNER_MXL5005D: |
999 | case AF9013_TUNER_MXL5005R: | 953 | case AF9013_TUNER_MXL5005R: |
954 | case AF9013_TUNER_MXL5007T: | ||
1000 | af9015_af9013_config[i].rf_spec_inv = 0; | 955 | af9015_af9013_config[i].rf_spec_inv = 0; |
1001 | break; | 956 | break; |
1002 | case AF9013_TUNER_MC44S803: | 957 | case AF9013_TUNER_MC44S803: |
1003 | af9015_af9013_config[i].gpio[1] = AF9013_GPIO_LO; | 958 | af9015_af9013_config[i].gpio[1] = AF9013_GPIO_LO; |
1004 | af9015_af9013_config[i].rf_spec_inv = 1; | 959 | af9015_af9013_config[i].rf_spec_inv = 1; |
1005 | break; | 960 | break; |
1006 | case AF9013_TUNER_TDA18218: | ||
1007 | warn("tuner NXP TDA18218 not supported yet"); | ||
1008 | return -ENODEV; | ||
1009 | default: | 961 | default: |
1010 | warn("tuner id:%d not supported, please report!", val); | 962 | warn("tuner id:%d not supported, please report!", val); |
1011 | return -ENODEV; | 963 | return -ENODEV; |
@@ -1020,9 +972,13 @@ error: | |||
1020 | err("eeprom read failed:%d", ret); | 972 | err("eeprom read failed:%d", ret); |
1021 | 973 | ||
1022 | /* AverMedia AVerTV Volar Black HD (A850) device have bad EEPROM | 974 | /* AverMedia AVerTV Volar Black HD (A850) device have bad EEPROM |
1023 | content :-( Override some wrong values here. */ | 975 | content :-( Override some wrong values here. Ditto for the |
976 | AVerTV Red HD+ (A850T) device. */ | ||
1024 | if (le16_to_cpu(udev->descriptor.idVendor) == USB_VID_AVERMEDIA && | 977 | if (le16_to_cpu(udev->descriptor.idVendor) == USB_VID_AVERMEDIA && |
1025 | le16_to_cpu(udev->descriptor.idProduct) == USB_PID_AVERMEDIA_A850) { | 978 | ((le16_to_cpu(udev->descriptor.idProduct) == |
979 | USB_PID_AVERMEDIA_A850) || | ||
980 | (le16_to_cpu(udev->descriptor.idProduct) == | ||
981 | USB_PID_AVERMEDIA_A850T))) { | ||
1026 | deb_info("%s: AverMedia A850: overriding config\n", __func__); | 982 | deb_info("%s: AverMedia A850: overriding config\n", __func__); |
1027 | /* disable dual mode */ | 983 | /* disable dual mode */ |
1028 | af9015_config.dual_mode = 0; | 984 | af9015_config.dual_mode = 0; |
@@ -1059,36 +1015,71 @@ static int af9015_identify_state(struct usb_device *udev, | |||
1059 | return ret; | 1015 | return ret; |
1060 | } | 1016 | } |
1061 | 1017 | ||
1062 | static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 1018 | static int af9015_rc_query(struct dvb_usb_device *d) |
1063 | { | 1019 | { |
1064 | u8 buf[8]; | 1020 | struct af9015_state *priv = d->priv; |
1065 | struct req_t req = {GET_IR_CODE, 0, 0, 0, 0, sizeof(buf), buf}; | 1021 | int ret; |
1066 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 1022 | u8 buf[17]; |
1067 | int i, ret; | ||
1068 | |||
1069 | memset(buf, 0, sizeof(buf)); | ||
1070 | 1023 | ||
1071 | ret = af9015_ctrl_msg(d, &req); | 1024 | /* read registers needed to detect remote controller code */ |
1025 | ret = af9015_read_regs(d, 0x98d9, buf, sizeof(buf)); | ||
1072 | if (ret) | 1026 | if (ret) |
1027 | goto error; | ||
1028 | |||
1029 | /* If any of these are non-zero, assume invalid data */ | ||
1030 | if (buf[1] || buf[2] || buf[3]) | ||
1073 | return ret; | 1031 | return ret; |
1074 | 1032 | ||
1075 | *event = 0; | 1033 | /* Check for repeat of previous code */ |
1076 | *state = REMOTE_NO_KEY_PRESSED; | 1034 | if ((priv->rc_repeat != buf[6] || buf[0]) && |
1035 | !memcmp(&buf[12], priv->rc_last, 4)) { | ||
1036 | deb_rc("%s: key repeated\n", __func__); | ||
1037 | rc_keydown(d->rc_dev, priv->rc_keycode, 0); | ||
1038 | priv->rc_repeat = buf[6]; | ||
1039 | return ret; | ||
1040 | } | ||
1077 | 1041 | ||
1078 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | 1042 | /* Only process key if canary killed */ |
1079 | if (!buf[1] && rc5_custom(&keymap[i]) == buf[0] && | 1043 | if (buf[16] != 0xff && buf[0] != 0x01) { |
1080 | rc5_data(&keymap[i]) == buf[2]) { | 1044 | deb_rc("%s: key pressed %02x %02x %02x %02x\n", __func__, |
1081 | *event = keymap[i].keycode; | 1045 | buf[12], buf[13], buf[14], buf[15]); |
1082 | *state = REMOTE_KEY_PRESSED; | 1046 | |
1083 | break; | 1047 | /* Reset the canary */ |
1048 | ret = af9015_write_reg(d, 0x98e9, 0xff); | ||
1049 | if (ret) | ||
1050 | goto error; | ||
1051 | |||
1052 | /* Remember this key */ | ||
1053 | memcpy(priv->rc_last, &buf[12], 4); | ||
1054 | if (buf[14] == (u8) ~buf[15]) { | ||
1055 | if (buf[12] == (u8) ~buf[13]) { | ||
1056 | /* NEC */ | ||
1057 | priv->rc_keycode = buf[12] << 8 | buf[14]; | ||
1058 | } else { | ||
1059 | /* NEC extended*/ | ||
1060 | priv->rc_keycode = buf[12] << 16 | | ||
1061 | buf[13] << 8 | buf[14]; | ||
1062 | } | ||
1063 | } else { | ||
1064 | /* 32 bit NEC */ | ||
1065 | priv->rc_keycode = buf[12] << 24 | buf[13] << 16 | | ||
1066 | buf[14] << 8 | buf[15]; | ||
1084 | } | 1067 | } |
1068 | rc_keydown(d->rc_dev, priv->rc_keycode, 0); | ||
1069 | } else { | ||
1070 | deb_rc("%s: no key press\n", __func__); | ||
1071 | /* Invalidate last keypress */ | ||
1072 | /* Not really needed, but helps with debug */ | ||
1073 | priv->rc_last[2] = priv->rc_last[3]; | ||
1085 | } | 1074 | } |
1086 | if (!buf[1]) | ||
1087 | deb_rc("%s: %02x %02x %02x %02x %02x %02x %02x %02x\n", | ||
1088 | __func__, buf[0], buf[1], buf[2], buf[3], buf[4], | ||
1089 | buf[5], buf[6], buf[7]); | ||
1090 | 1075 | ||
1091 | return 0; | 1076 | priv->rc_repeat = buf[6]; |
1077 | |||
1078 | error: | ||
1079 | if (ret) | ||
1080 | err("%s: failed:%d", __func__, ret); | ||
1081 | |||
1082 | return ret; | ||
1092 | } | 1083 | } |
1093 | 1084 | ||
1094 | /* init 2nd I2C adapter */ | 1085 | /* init 2nd I2C adapter */ |
@@ -1100,11 +1091,6 @@ static int af9015_i2c_init(struct dvb_usb_device *d) | |||
1100 | 1091 | ||
1101 | strncpy(state->i2c_adap.name, d->desc->name, | 1092 | strncpy(state->i2c_adap.name, d->desc->name, |
1102 | sizeof(state->i2c_adap.name)); | 1093 | sizeof(state->i2c_adap.name)); |
1103 | #ifdef I2C_ADAP_CLASS_TV_DIGITAL | ||
1104 | state->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, | ||
1105 | #else | ||
1106 | state->i2c_adap.class = I2C_CLASS_TV_DIGITAL, | ||
1107 | #endif | ||
1108 | state->i2c_adap.algo = d->props.i2c_algo; | 1094 | state->i2c_adap.algo = d->props.i2c_algo; |
1109 | state->i2c_adap.algo_data = NULL; | 1095 | state->i2c_adap.algo_data = NULL; |
1110 | state->i2c_adap.dev.parent = &d->udev->dev; | 1096 | state->i2c_adap.dev.parent = &d->udev->dev; |
@@ -1166,7 +1152,7 @@ static struct qt1010_config af9015_qt1010_config = { | |||
1166 | 1152 | ||
1167 | static struct tda18271_config af9015_tda18271_config = { | 1153 | static struct tda18271_config af9015_tda18271_config = { |
1168 | .gate = TDA18271_GATE_DIGITAL, | 1154 | .gate = TDA18271_GATE_DIGITAL, |
1169 | .small_i2c = 1, | 1155 | .small_i2c = TDA18271_16_BYTE_CHUNK_INIT, |
1170 | }; | 1156 | }; |
1171 | 1157 | ||
1172 | static struct mxl5005s_config af9015_mxl5003_config = { | 1158 | static struct mxl5005s_config af9015_mxl5003_config = { |
@@ -1208,12 +1194,22 @@ static struct mc44s803_config af9015_mc44s803_config = { | |||
1208 | .dig_out = 1, | 1194 | .dig_out = 1, |
1209 | }; | 1195 | }; |
1210 | 1196 | ||
1197 | static struct tda18218_config af9015_tda18218_config = { | ||
1198 | .i2c_address = 0xc0, | ||
1199 | .i2c_wr_max = 21, /* max wr bytes AF9015 I2C adap can handle at once */ | ||
1200 | }; | ||
1201 | |||
1202 | static struct mxl5007t_config af9015_mxl5007t_config = { | ||
1203 | .xtal_freq_hz = MxL_XTAL_24_MHZ, | ||
1204 | .if_freq_hz = MxL_IF_4_57_MHZ, | ||
1205 | }; | ||
1206 | |||
1211 | static int af9015_tuner_attach(struct dvb_usb_adapter *adap) | 1207 | static int af9015_tuner_attach(struct dvb_usb_adapter *adap) |
1212 | { | 1208 | { |
1213 | struct af9015_state *state = adap->dev->priv; | 1209 | struct af9015_state *state = adap->dev->priv; |
1214 | struct i2c_adapter *i2c_adap; | 1210 | struct i2c_adapter *i2c_adap; |
1215 | int ret; | 1211 | int ret; |
1216 | deb_info("%s: \n", __func__); | 1212 | deb_info("%s:\n", __func__); |
1217 | 1213 | ||
1218 | /* select I2C adapter */ | 1214 | /* select I2C adapter */ |
1219 | if (adap->id == 0) | 1215 | if (adap->id == 0) |
@@ -1238,6 +1234,10 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap) | |||
1238 | ret = dvb_attach(tda18271_attach, adap->fe, 0xc0, i2c_adap, | 1234 | ret = dvb_attach(tda18271_attach, adap->fe, 0xc0, i2c_adap, |
1239 | &af9015_tda18271_config) == NULL ? -ENODEV : 0; | 1235 | &af9015_tda18271_config) == NULL ? -ENODEV : 0; |
1240 | break; | 1236 | break; |
1237 | case AF9013_TUNER_TDA18218: | ||
1238 | ret = dvb_attach(tda18218_attach, adap->fe, i2c_adap, | ||
1239 | &af9015_tda18218_config) == NULL ? -ENODEV : 0; | ||
1240 | break; | ||
1241 | case AF9013_TUNER_MXL5003D: | 1241 | case AF9013_TUNER_MXL5003D: |
1242 | ret = dvb_attach(mxl5005s_attach, adap->fe, i2c_adap, | 1242 | ret = dvb_attach(mxl5005s_attach, adap->fe, i2c_adap, |
1243 | &af9015_mxl5003_config) == NULL ? -ENODEV : 0; | 1243 | &af9015_mxl5003_config) == NULL ? -ENODEV : 0; |
@@ -1255,6 +1255,10 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap) | |||
1255 | ret = dvb_attach(mc44s803_attach, adap->fe, i2c_adap, | 1255 | ret = dvb_attach(mc44s803_attach, adap->fe, i2c_adap, |
1256 | &af9015_mc44s803_config) == NULL ? -ENODEV : 0; | 1256 | &af9015_mc44s803_config) == NULL ? -ENODEV : 0; |
1257 | break; | 1257 | break; |
1258 | case AF9013_TUNER_MXL5007T: | ||
1259 | ret = dvb_attach(mxl5007t_attach, adap->fe, i2c_adap, | ||
1260 | 0xc0, &af9015_mxl5007t_config) == NULL ? -ENODEV : 0; | ||
1261 | break; | ||
1258 | case AF9013_TUNER_UNKNOWN: | 1262 | case AF9013_TUNER_UNKNOWN: |
1259 | default: | 1263 | default: |
1260 | ret = -ENODEV; | 1264 | ret = -ENODEV; |
@@ -1300,10 +1304,16 @@ static struct usb_device_id af9015_usb_table[] = { | |||
1300 | /* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, | 1304 | /* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, |
1301 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)}, | 1305 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)}, |
1302 | {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A815M)}, | 1306 | {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A815M)}, |
1307 | {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_RC)}, | ||
1308 | {USB_DEVICE(USB_VID_TERRATEC, | ||
1309 | USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC)}, | ||
1310 | /* 35 */{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A850T)}, | ||
1311 | {USB_DEVICE(USB_VID_GTEK, USB_PID_TINYTWIN_3)}, | ||
1303 | {0}, | 1312 | {0}, |
1304 | }; | 1313 | }; |
1305 | MODULE_DEVICE_TABLE(usb, af9015_usb_table); | 1314 | MODULE_DEVICE_TABLE(usb, af9015_usb_table); |
1306 | 1315 | ||
1316 | #define AF9015_RC_INTERVAL 500 | ||
1307 | static struct dvb_usb_device_properties af9015_properties[] = { | 1317 | static struct dvb_usb_device_properties af9015_properties[] = { |
1308 | { | 1318 | { |
1309 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | 1319 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
@@ -1354,14 +1364,17 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1354 | 1364 | ||
1355 | .identify_state = af9015_identify_state, | 1365 | .identify_state = af9015_identify_state, |
1356 | 1366 | ||
1357 | .rc.legacy = { | 1367 | .rc.core = { |
1368 | .protocol = RC_TYPE_NEC, | ||
1369 | .module_name = "af9015", | ||
1358 | .rc_query = af9015_rc_query, | 1370 | .rc_query = af9015_rc_query, |
1359 | .rc_interval = 150, | 1371 | .rc_interval = AF9015_RC_INTERVAL, |
1372 | .allowed_protos = RC_TYPE_NEC, | ||
1360 | }, | 1373 | }, |
1361 | 1374 | ||
1362 | .i2c_algo = &af9015_i2c_algo, | 1375 | .i2c_algo = &af9015_i2c_algo, |
1363 | 1376 | ||
1364 | .num_device_descs = 9, /* max 9 */ | 1377 | .num_device_descs = 12, /* check max from dvb-usb.h */ |
1365 | .devices = { | 1378 | .devices = { |
1366 | { | 1379 | { |
1367 | .name = "Afatech AF9015 DVB-T USB2.0 stick", | 1380 | .name = "Afatech AF9015 DVB-T USB2.0 stick", |
@@ -1389,7 +1402,8 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1389 | { | 1402 | { |
1390 | .name = "DigitalNow TinyTwin DVB-T Receiver", | 1403 | .name = "DigitalNow TinyTwin DVB-T Receiver", |
1391 | .cold_ids = {&af9015_usb_table[5], | 1404 | .cold_ids = {&af9015_usb_table[5], |
1392 | &af9015_usb_table[28], NULL}, | 1405 | &af9015_usb_table[28], |
1406 | &af9015_usb_table[36], NULL}, | ||
1393 | .warm_ids = {NULL}, | 1407 | .warm_ids = {NULL}, |
1394 | }, | 1408 | }, |
1395 | { | 1409 | { |
@@ -1413,6 +1427,21 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1413 | .cold_ids = {&af9015_usb_table[9], NULL}, | 1427 | .cold_ids = {&af9015_usb_table[9], NULL}, |
1414 | .warm_ids = {NULL}, | 1428 | .warm_ids = {NULL}, |
1415 | }, | 1429 | }, |
1430 | { | ||
1431 | .name = "TerraTec Cinergy T Stick RC", | ||
1432 | .cold_ids = {&af9015_usb_table[33], NULL}, | ||
1433 | .warm_ids = {NULL}, | ||
1434 | }, | ||
1435 | { | ||
1436 | .name = "TerraTec Cinergy T Stick Dual RC", | ||
1437 | .cold_ids = {&af9015_usb_table[34], NULL}, | ||
1438 | .warm_ids = {NULL}, | ||
1439 | }, | ||
1440 | { | ||
1441 | .name = "AverMedia AVerTV Red HD+ (A850T)", | ||
1442 | .cold_ids = {&af9015_usb_table[35], NULL}, | ||
1443 | .warm_ids = {NULL}, | ||
1444 | }, | ||
1416 | } | 1445 | } |
1417 | }, { | 1446 | }, { |
1418 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | 1447 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
@@ -1463,14 +1492,17 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1463 | 1492 | ||
1464 | .identify_state = af9015_identify_state, | 1493 | .identify_state = af9015_identify_state, |
1465 | 1494 | ||
1466 | .rc.legacy = { | 1495 | .rc.core = { |
1496 | .protocol = RC_TYPE_NEC, | ||
1497 | .module_name = "af9015", | ||
1467 | .rc_query = af9015_rc_query, | 1498 | .rc_query = af9015_rc_query, |
1468 | .rc_interval = 150, | 1499 | .rc_interval = AF9015_RC_INTERVAL, |
1500 | .allowed_protos = RC_TYPE_NEC, | ||
1469 | }, | 1501 | }, |
1470 | 1502 | ||
1471 | .i2c_algo = &af9015_i2c_algo, | 1503 | .i2c_algo = &af9015_i2c_algo, |
1472 | 1504 | ||
1473 | .num_device_descs = 9, /* max 9 */ | 1505 | .num_device_descs = 9, /* check max from dvb-usb.h */ |
1474 | .devices = { | 1506 | .devices = { |
1475 | { | 1507 | { |
1476 | .name = "Xtensions XD-380", | 1508 | .name = "Xtensions XD-380", |
@@ -1572,14 +1604,17 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
1572 | 1604 | ||
1573 | .identify_state = af9015_identify_state, | 1605 | .identify_state = af9015_identify_state, |
1574 | 1606 | ||
1575 | .rc.legacy = { | 1607 | .rc.core = { |
1608 | .protocol = RC_TYPE_NEC, | ||
1609 | .module_name = "af9015", | ||
1576 | .rc_query = af9015_rc_query, | 1610 | .rc_query = af9015_rc_query, |
1577 | .rc_interval = 150, | 1611 | .rc_interval = AF9015_RC_INTERVAL, |
1612 | .allowed_protos = RC_TYPE_NEC, | ||
1578 | }, | 1613 | }, |
1579 | 1614 | ||
1580 | .i2c_algo = &af9015_i2c_algo, | 1615 | .i2c_algo = &af9015_i2c_algo, |
1581 | 1616 | ||
1582 | .num_device_descs = 9, /* max 9 */ | 1617 | .num_device_descs = 9, /* check max from dvb-usb.h */ |
1583 | .devices = { | 1618 | .devices = { |
1584 | { | 1619 | { |
1585 | .name = "AverMedia AVerTV Volar GPS 805 (A805)", | 1620 | .name = "AverMedia AVerTV Volar GPS 805 (A805)", |
@@ -1672,7 +1707,7 @@ static int af9015_usb_probe(struct usb_interface *intf, | |||
1672 | static void af9015_i2c_exit(struct dvb_usb_device *d) | 1707 | static void af9015_i2c_exit(struct dvb_usb_device *d) |
1673 | { | 1708 | { |
1674 | struct af9015_state *state = d->priv; | 1709 | struct af9015_state *state = d->priv; |
1675 | deb_info("%s: \n", __func__); | 1710 | deb_info("%s:\n", __func__); |
1676 | 1711 | ||
1677 | /* remove 2nd I2C adapter */ | 1712 | /* remove 2nd I2C adapter */ |
1678 | if (d->state & DVB_USB_STATE_I2C) | 1713 | if (d->state & DVB_USB_STATE_I2C) |
@@ -1682,7 +1717,7 @@ static void af9015_i2c_exit(struct dvb_usb_device *d) | |||
1682 | static void af9015_usb_device_exit(struct usb_interface *intf) | 1717 | static void af9015_usb_device_exit(struct usb_interface *intf) |
1683 | { | 1718 | { |
1684 | struct dvb_usb_device *d = usb_get_intfdata(intf); | 1719 | struct dvb_usb_device *d = usb_get_intfdata(intf); |
1685 | deb_info("%s: \n", __func__); | 1720 | deb_info("%s:\n", __func__); |
1686 | 1721 | ||
1687 | /* remove 2nd I2C adapter */ | 1722 | /* remove 2nd I2C adapter */ |
1688 | if (d != NULL && d->desc != NULL) | 1723 | if (d != NULL && d->desc != NULL) |
diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h index c8e9349742ee..beb3004f00ba 100644 --- a/drivers/media/dvb/dvb-usb/af9015.h +++ b/drivers/media/dvb/dvb-usb/af9015.h | |||
@@ -100,6 +100,9 @@ enum af9015_ir_mode { | |||
100 | 100 | ||
101 | struct af9015_state { | 101 | struct af9015_state { |
102 | struct i2c_adapter i2c_adap; /* I2C adapter for 2nd FE */ | 102 | struct i2c_adapter i2c_adap; /* I2C adapter for 2nd FE */ |
103 | u8 rc_repeat; | ||
104 | u32 rc_keycode; | ||
105 | u8 rc_last[4]; | ||
103 | }; | 106 | }; |
104 | 107 | ||
105 | struct af9015_config { | 108 | struct af9015_config { |
@@ -108,8 +111,6 @@ struct af9015_config { | |||
108 | u16 firmware_size; | 111 | u16 firmware_size; |
109 | u16 firmware_checksum; | 112 | u16 firmware_checksum; |
110 | u32 eeprom_sum; | 113 | u32 eeprom_sum; |
111 | u8 *ir_table; | ||
112 | u16 ir_table_size; | ||
113 | }; | 114 | }; |
114 | 115 | ||
115 | enum af9015_remote { | 116 | enum af9015_remote { |
@@ -121,735 +122,4 @@ enum af9015_remote { | |||
121 | /* 5 */ AF9015_REMOTE_AVERMEDIA_KS, | 122 | /* 5 */ AF9015_REMOTE_AVERMEDIA_KS, |
122 | }; | 123 | }; |
123 | 124 | ||
124 | /* LeadTek - Y04G0051 */ | ||
125 | /* Leadtek WinFast DTV Dongle Gold */ | ||
126 | static struct ir_scancode ir_codes_af9015_table_leadtek[] = { | ||
127 | { 0x001e, KEY_1 }, | ||
128 | { 0x001f, KEY_2 }, | ||
129 | { 0x0020, KEY_3 }, | ||
130 | { 0x0021, KEY_4 }, | ||
131 | { 0x0022, KEY_5 }, | ||
132 | { 0x0023, KEY_6 }, | ||
133 | { 0x0024, KEY_7 }, | ||
134 | { 0x0025, KEY_8 }, | ||
135 | { 0x0026, KEY_9 }, | ||
136 | { 0x0027, KEY_0 }, | ||
137 | { 0x0028, KEY_OK }, | ||
138 | { 0x004f, KEY_RIGHT }, | ||
139 | { 0x0050, KEY_LEFT }, | ||
140 | { 0x0051, KEY_DOWN }, | ||
141 | { 0x0052, KEY_UP }, | ||
142 | { 0x011a, KEY_POWER2 }, | ||
143 | { 0x04b4, KEY_TV }, | ||
144 | { 0x04b3, KEY_RED }, | ||
145 | { 0x04b2, KEY_GREEN }, | ||
146 | { 0x04b1, KEY_YELLOW }, | ||
147 | { 0x04b0, KEY_BLUE }, | ||
148 | { 0x003d, KEY_TEXT }, | ||
149 | { 0x0113, KEY_SLEEP }, | ||
150 | { 0x0010, KEY_MUTE }, | ||
151 | { 0x0105, KEY_ESC }, | ||
152 | { 0x0009, KEY_SCREEN }, | ||
153 | { 0x010f, KEY_MENU }, | ||
154 | { 0x003f, KEY_CHANNEL }, | ||
155 | { 0x0013, KEY_REWIND }, | ||
156 | { 0x0012, KEY_PLAY }, | ||
157 | { 0x0011, KEY_FASTFORWARD }, | ||
158 | { 0x0005, KEY_PREVIOUS }, | ||
159 | { 0x0029, KEY_STOP }, | ||
160 | { 0x002b, KEY_NEXT }, | ||
161 | { 0x0041, KEY_EPG }, | ||
162 | { 0x0019, KEY_VIDEO }, | ||
163 | { 0x0016, KEY_AUDIO }, | ||
164 | { 0x0037, KEY_DOT }, | ||
165 | { 0x002a, KEY_AGAIN }, | ||
166 | { 0x002c, KEY_CAMERA }, | ||
167 | { 0x003c, KEY_NEW }, | ||
168 | { 0x0115, KEY_RECORD }, | ||
169 | { 0x010b, KEY_TIME }, | ||
170 | { 0x0043, KEY_VOLUMEUP }, | ||
171 | { 0x0042, KEY_VOLUMEDOWN }, | ||
172 | { 0x004b, KEY_CHANNELUP }, | ||
173 | { 0x004e, KEY_CHANNELDOWN }, | ||
174 | }; | ||
175 | |||
176 | static u8 af9015_ir_table_leadtek[] = { | ||
177 | 0x03, 0xfc, 0x00, 0xff, 0x1a, 0x01, 0x00, /* KEY_POWER2 */ | ||
178 | 0x03, 0xfc, 0x56, 0xa9, 0xb4, 0x04, 0x00, /* KEY_TV */ | ||
179 | 0x03, 0xfc, 0x4b, 0xb4, 0xb3, 0x04, 0x00, /* KEY_RED */ | ||
180 | 0x03, 0xfc, 0x4c, 0xb3, 0xb2, 0x04, 0x00, /* KEY_GREEN */ | ||
181 | 0x03, 0xfc, 0x4d, 0xb2, 0xb1, 0x04, 0x00, /* KEY_YELLOW */ | ||
182 | 0x03, 0xfc, 0x4e, 0xb1, 0xb0, 0x04, 0x00, /* KEY_BLUE */ | ||
183 | 0x03, 0xfc, 0x1f, 0xe0, 0x3d, 0x00, 0x00, /* KEY_TEXT */ | ||
184 | 0x03, 0xfc, 0x40, 0xbf, 0x13, 0x01, 0x00, /* KEY_SLEEP */ | ||
185 | 0x03, 0xfc, 0x14, 0xeb, 0x10, 0x00, 0x00, /* KEY_MUTE */ | ||
186 | 0x03, 0xfc, 0x49, 0xb6, 0x05, 0x01, 0x00, /* KEY_ESC */ | ||
187 | 0x03, 0xfc, 0x50, 0xaf, 0x29, 0x00, 0x00, /* KEY_STOP (1)*/ | ||
188 | 0x03, 0xfc, 0x0c, 0xf3, 0x52, 0x00, 0x00, /* KEY_UP */ | ||
189 | 0x03, 0xfc, 0x03, 0xfc, 0x09, 0x00, 0x00, /* KEY_SCREEN */ | ||
190 | 0x03, 0xfc, 0x08, 0xf7, 0x50, 0x00, 0x00, /* KEY_LEFT */ | ||
191 | 0x03, 0xfc, 0x13, 0xec, 0x28, 0x00, 0x00, /* KEY_OK (1) */ | ||
192 | 0x03, 0xfc, 0x04, 0xfb, 0x4f, 0x00, 0x00, /* KEY_RIGHT */ | ||
193 | 0x03, 0xfc, 0x4f, 0xb0, 0x0f, 0x01, 0x00, /* KEY_MENU */ | ||
194 | 0x03, 0xfc, 0x10, 0xef, 0x51, 0x00, 0x00, /* KEY_DOWN */ | ||
195 | 0x03, 0xfc, 0x51, 0xae, 0x3f, 0x00, 0x00, /* KEY_CHANNEL */ | ||
196 | 0x03, 0xfc, 0x42, 0xbd, 0x13, 0x00, 0x00, /* KEY_REWIND */ | ||
197 | 0x03, 0xfc, 0x43, 0xbc, 0x12, 0x00, 0x00, /* KEY_PLAY */ | ||
198 | 0x03, 0xfc, 0x44, 0xbb, 0x11, 0x00, 0x00, /* KEY_FASTFORWARD */ | ||
199 | 0x03, 0xfc, 0x52, 0xad, 0x19, 0x00, 0x00, /* KEY_VIDEO (1) */ | ||
200 | 0x03, 0xfc, 0x54, 0xab, 0x05, 0x00, 0x00, /* KEY_PREVIOUS */ | ||
201 | 0x03, 0xfc, 0x46, 0xb9, 0x29, 0x00, 0x00, /* KEY_STOP (2) */ | ||
202 | 0x03, 0xfc, 0x55, 0xaa, 0x2b, 0x00, 0x00, /* KEY_NEXT */ | ||
203 | 0x03, 0xfc, 0x53, 0xac, 0x41, 0x00, 0x00, /* KEY_EPG */ | ||
204 | 0x03, 0xfc, 0x05, 0xfa, 0x1e, 0x00, 0x00, /* KEY_1 */ | ||
205 | 0x03, 0xfc, 0x06, 0xf9, 0x1f, 0x00, 0x00, /* KEY_2 */ | ||
206 | 0x03, 0xfc, 0x07, 0xf8, 0x20, 0x00, 0x00, /* KEY_3 */ | ||
207 | 0x03, 0xfc, 0x1e, 0xe1, 0x19, 0x00, 0x00, /* KEY_VIDEO (2) */ | ||
208 | 0x03, 0xfc, 0x09, 0xf6, 0x21, 0x00, 0x00, /* KEY_4 */ | ||
209 | 0x03, 0xfc, 0x0a, 0xf5, 0x22, 0x00, 0x00, /* KEY_5 */ | ||
210 | 0x03, 0xfc, 0x0b, 0xf4, 0x23, 0x00, 0x00, /* KEY_6 */ | ||
211 | 0x03, 0xfc, 0x1b, 0xe4, 0x16, 0x00, 0x00, /* KEY_AUDIO */ | ||
212 | 0x03, 0xfc, 0x0d, 0xf2, 0x24, 0x00, 0x00, /* KEY_7 */ | ||
213 | 0x03, 0xfc, 0x0e, 0xf1, 0x25, 0x00, 0x00, /* KEY_8 */ | ||
214 | 0x03, 0xfc, 0x0f, 0xf0, 0x26, 0x00, 0x00, /* KEY_9 */ | ||
215 | 0x03, 0xfc, 0x16, 0xe9, 0x28, 0x00, 0x00, /* KEY_OK (2) */ | ||
216 | 0x03, 0xfc, 0x41, 0xbe, 0x37, 0x00, 0x00, /* KEY_DOT */ | ||
217 | 0x03, 0xfc, 0x12, 0xed, 0x27, 0x00, 0x00, /* KEY_0 */ | ||
218 | 0x03, 0xfc, 0x11, 0xee, 0x2a, 0x00, 0x00, /* KEY_AGAIN */ | ||
219 | 0x03, 0xfc, 0x48, 0xb7, 0x2c, 0x00, 0x00, /* KEY_CAMERA */ | ||
220 | 0x03, 0xfc, 0x4a, 0xb5, 0x3c, 0x00, 0x00, /* KEY_NEW */ | ||
221 | 0x03, 0xfc, 0x47, 0xb8, 0x15, 0x01, 0x00, /* KEY_RECORD */ | ||
222 | 0x03, 0xfc, 0x45, 0xba, 0x0b, 0x01, 0x00, /* KEY_TIME */ | ||
223 | 0x03, 0xfc, 0x5e, 0xa1, 0x43, 0x00, 0x00, /* KEY_VOLUMEUP */ | ||
224 | 0x03, 0xfc, 0x5a, 0xa5, 0x42, 0x00, 0x00, /* KEY_VOLUMEDOWN */ | ||
225 | 0x03, 0xfc, 0x5b, 0xa4, 0x4b, 0x00, 0x00, /* KEY_CHANNELUP */ | ||
226 | 0x03, 0xfc, 0x5f, 0xa0, 0x4e, 0x00, 0x00, /* KEY_CHANNELDOWN */ | ||
227 | }; | ||
228 | |||
229 | /* TwinHan AzureWave AD-TU700(704J) */ | ||
230 | static struct ir_scancode ir_codes_af9015_table_twinhan[] = { | ||
231 | { 0x053f, KEY_POWER }, | ||
232 | { 0x0019, KEY_FAVORITES }, /* Favorite List */ | ||
233 | { 0x0004, KEY_TEXT }, /* Teletext */ | ||
234 | { 0x000e, KEY_POWER }, | ||
235 | { 0x000e, KEY_INFO }, /* Preview */ | ||
236 | { 0x0008, KEY_EPG }, /* Info/EPG */ | ||
237 | { 0x000f, KEY_LIST }, /* Record List */ | ||
238 | { 0x001e, KEY_1 }, | ||
239 | { 0x001f, KEY_2 }, | ||
240 | { 0x0020, KEY_3 }, | ||
241 | { 0x0021, KEY_4 }, | ||
242 | { 0x0022, KEY_5 }, | ||
243 | { 0x0023, KEY_6 }, | ||
244 | { 0x0024, KEY_7 }, | ||
245 | { 0x0025, KEY_8 }, | ||
246 | { 0x0026, KEY_9 }, | ||
247 | { 0x0027, KEY_0 }, | ||
248 | { 0x0029, KEY_CANCEL }, /* Cancel */ | ||
249 | { 0x004c, KEY_CLEAR }, /* Clear */ | ||
250 | { 0x002a, KEY_BACK }, /* Back */ | ||
251 | { 0x002b, KEY_TAB }, /* Tab */ | ||
252 | { 0x0052, KEY_UP }, /* up arrow */ | ||
253 | { 0x0051, KEY_DOWN }, /* down arrow */ | ||
254 | { 0x004f, KEY_RIGHT }, /* right arrow */ | ||
255 | { 0x0050, KEY_LEFT }, /* left arrow */ | ||
256 | { 0x0028, KEY_ENTER }, /* Enter / ok */ | ||
257 | { 0x0252, KEY_VOLUMEUP }, | ||
258 | { 0x0251, KEY_VOLUMEDOWN }, | ||
259 | { 0x004e, KEY_CHANNELDOWN }, | ||
260 | { 0x004b, KEY_CHANNELUP }, | ||
261 | { 0x004a, KEY_RECORD }, | ||
262 | { 0x0111, KEY_PLAY }, | ||
263 | { 0x0017, KEY_PAUSE }, | ||
264 | { 0x000c, KEY_REWIND }, /* FR << */ | ||
265 | { 0x0011, KEY_FASTFORWARD }, /* FF >> */ | ||
266 | { 0x0115, KEY_PREVIOUS }, /* Replay */ | ||
267 | { 0x010e, KEY_NEXT }, /* Skip */ | ||
268 | { 0x0013, KEY_CAMERA }, /* Capture */ | ||
269 | { 0x010f, KEY_LANGUAGE }, /* SAP */ | ||
270 | { 0x0113, KEY_TV2 }, /* PIP */ | ||
271 | { 0x001d, KEY_ZOOM }, /* Full Screen */ | ||
272 | { 0x0117, KEY_SUBTITLE }, /* Subtitle / CC */ | ||
273 | { 0x0010, KEY_MUTE }, | ||
274 | { 0x0119, KEY_AUDIO }, /* L/R */ /* TODO better event */ | ||
275 | { 0x0116, KEY_SLEEP }, /* Hibernate */ | ||
276 | { 0x0116, KEY_SWITCHVIDEOMODE }, | ||
277 | /* A/V */ /* TODO does not work */ | ||
278 | { 0x0006, KEY_AGAIN }, /* Recall */ | ||
279 | { 0x0116, KEY_KPPLUS }, /* Zoom+ */ /* TODO does not work */ | ||
280 | { 0x0116, KEY_KPMINUS }, /* Zoom- */ /* TODO does not work */ | ||
281 | { 0x0215, KEY_RED }, | ||
282 | { 0x020a, KEY_GREEN }, | ||
283 | { 0x021c, KEY_YELLOW }, | ||
284 | { 0x0205, KEY_BLUE }, | ||
285 | }; | ||
286 | |||
287 | static u8 af9015_ir_table_twinhan[] = { | ||
288 | 0x00, 0xff, 0x16, 0xe9, 0x3f, 0x05, 0x00, | ||
289 | 0x00, 0xff, 0x07, 0xf8, 0x16, 0x01, 0x00, | ||
290 | 0x00, 0xff, 0x14, 0xeb, 0x11, 0x01, 0x00, | ||
291 | 0x00, 0xff, 0x1a, 0xe5, 0x4d, 0x00, 0x00, | ||
292 | 0x00, 0xff, 0x4c, 0xb3, 0x17, 0x00, 0x00, | ||
293 | 0x00, 0xff, 0x12, 0xed, 0x11, 0x00, 0x00, | ||
294 | 0x00, 0xff, 0x40, 0xbf, 0x0c, 0x00, 0x00, | ||
295 | 0x00, 0xff, 0x11, 0xee, 0x4a, 0x00, 0x00, | ||
296 | 0x00, 0xff, 0x54, 0xab, 0x13, 0x00, 0x00, | ||
297 | 0x00, 0xff, 0x41, 0xbe, 0x15, 0x01, 0x00, | ||
298 | 0x00, 0xff, 0x42, 0xbd, 0x0e, 0x01, 0x00, | ||
299 | 0x00, 0xff, 0x43, 0xbc, 0x17, 0x01, 0x00, | ||
300 | 0x00, 0xff, 0x50, 0xaf, 0x0f, 0x01, 0x00, | ||
301 | 0x00, 0xff, 0x4d, 0xb2, 0x1d, 0x00, 0x00, | ||
302 | 0x00, 0xff, 0x47, 0xb8, 0x13, 0x01, 0x00, | ||
303 | 0x00, 0xff, 0x05, 0xfa, 0x4b, 0x00, 0x00, | ||
304 | 0x00, 0xff, 0x02, 0xfd, 0x4e, 0x00, 0x00, | ||
305 | 0x00, 0xff, 0x0e, 0xf1, 0x06, 0x00, 0x00, | ||
306 | 0x00, 0xff, 0x1e, 0xe1, 0x52, 0x02, 0x00, | ||
307 | 0x00, 0xff, 0x0a, 0xf5, 0x51, 0x02, 0x00, | ||
308 | 0x00, 0xff, 0x10, 0xef, 0x10, 0x00, 0x00, | ||
309 | 0x00, 0xff, 0x49, 0xb6, 0x19, 0x01, 0x00, | ||
310 | 0x00, 0xff, 0x15, 0xea, 0x27, 0x00, 0x00, | ||
311 | 0x00, 0xff, 0x03, 0xfc, 0x1e, 0x00, 0x00, | ||
312 | 0x00, 0xff, 0x01, 0xfe, 0x1f, 0x00, 0x00, | ||
313 | 0x00, 0xff, 0x06, 0xf9, 0x20, 0x00, 0x00, | ||
314 | 0x00, 0xff, 0x09, 0xf6, 0x21, 0x00, 0x00, | ||
315 | 0x00, 0xff, 0x1d, 0xe2, 0x22, 0x00, 0x00, | ||
316 | 0x00, 0xff, 0x1f, 0xe0, 0x23, 0x00, 0x00, | ||
317 | 0x00, 0xff, 0x0d, 0xf2, 0x24, 0x00, 0x00, | ||
318 | 0x00, 0xff, 0x19, 0xe6, 0x25, 0x00, 0x00, | ||
319 | 0x00, 0xff, 0x1b, 0xe4, 0x26, 0x00, 0x00, | ||
320 | 0x00, 0xff, 0x00, 0xff, 0x2b, 0x00, 0x00, | ||
321 | 0x00, 0xff, 0x4a, 0xb5, 0x4c, 0x00, 0x00, | ||
322 | 0x00, 0xff, 0x4b, 0xb4, 0x52, 0x00, 0x00, | ||
323 | 0x00, 0xff, 0x51, 0xae, 0x51, 0x00, 0x00, | ||
324 | 0x00, 0xff, 0x52, 0xad, 0x4f, 0x00, 0x00, | ||
325 | 0x00, 0xff, 0x4e, 0xb1, 0x50, 0x00, 0x00, | ||
326 | 0x00, 0xff, 0x0c, 0xf3, 0x29, 0x00, 0x00, | ||
327 | 0x00, 0xff, 0x4f, 0xb0, 0x28, 0x00, 0x00, | ||
328 | 0x00, 0xff, 0x13, 0xec, 0x2a, 0x00, 0x00, | ||
329 | 0x00, 0xff, 0x17, 0xe8, 0x19, 0x00, 0x00, | ||
330 | 0x00, 0xff, 0x04, 0xfb, 0x0f, 0x00, 0x00, | ||
331 | 0x00, 0xff, 0x48, 0xb7, 0x0e, 0x00, 0x00, | ||
332 | 0x00, 0xff, 0x0f, 0xf0, 0x04, 0x00, 0x00, | ||
333 | 0x00, 0xff, 0x1c, 0xe3, 0x08, 0x00, 0x00, | ||
334 | 0x00, 0xff, 0x18, 0xe7, 0x15, 0x02, 0x00, | ||
335 | 0x00, 0xff, 0x53, 0xac, 0x0a, 0x02, 0x00, | ||
336 | 0x00, 0xff, 0x5e, 0xa1, 0x1c, 0x02, 0x00, | ||
337 | 0x00, 0xff, 0x5f, 0xa0, 0x05, 0x02, 0x00, | ||
338 | }; | ||
339 | |||
340 | /* A-Link DTU(m) */ | ||
341 | static struct ir_scancode ir_codes_af9015_table_a_link[] = { | ||
342 | { 0x001e, KEY_1 }, | ||
343 | { 0x001f, KEY_2 }, | ||
344 | { 0x0020, KEY_3 }, | ||
345 | { 0x0021, KEY_4 }, | ||
346 | { 0x0022, KEY_5 }, | ||
347 | { 0x0023, KEY_6 }, | ||
348 | { 0x0024, KEY_7 }, | ||
349 | { 0x0025, KEY_8 }, | ||
350 | { 0x0026, KEY_9 }, | ||
351 | { 0x0027, KEY_0 }, | ||
352 | { 0x002e, KEY_CHANNELUP }, | ||
353 | { 0x002d, KEY_CHANNELDOWN }, | ||
354 | { 0x0428, KEY_ZOOM }, | ||
355 | { 0x0041, KEY_MUTE }, | ||
356 | { 0x0042, KEY_VOLUMEDOWN }, | ||
357 | { 0x0043, KEY_VOLUMEUP }, | ||
358 | { 0x0044, KEY_GOTO }, /* jump */ | ||
359 | { 0x0545, KEY_POWER }, | ||
360 | }; | ||
361 | |||
362 | static u8 af9015_ir_table_a_link[] = { | ||
363 | 0x08, 0xf7, 0x12, 0xed, 0x45, 0x05, 0x00, /* power */ | ||
364 | 0x08, 0xf7, 0x1a, 0xe5, 0x41, 0x00, 0x00, /* mute */ | ||
365 | 0x08, 0xf7, 0x01, 0xfe, 0x1e, 0x00, 0x00, /* 1 */ | ||
366 | 0x08, 0xf7, 0x1c, 0xe3, 0x21, 0x00, 0x00, /* 4 */ | ||
367 | 0x08, 0xf7, 0x03, 0xfc, 0x24, 0x00, 0x00, /* 7 */ | ||
368 | 0x08, 0xf7, 0x05, 0xfa, 0x28, 0x04, 0x00, /* zoom */ | ||
369 | 0x08, 0xf7, 0x00, 0xff, 0x43, 0x00, 0x00, /* volume up */ | ||
370 | 0x08, 0xf7, 0x16, 0xe9, 0x42, 0x00, 0x00, /* volume down */ | ||
371 | 0x08, 0xf7, 0x0f, 0xf0, 0x1f, 0x00, 0x00, /* 2 */ | ||
372 | 0x08, 0xf7, 0x0d, 0xf2, 0x22, 0x00, 0x00, /* 5 */ | ||
373 | 0x08, 0xf7, 0x1b, 0xe4, 0x25, 0x00, 0x00, /* 8 */ | ||
374 | 0x08, 0xf7, 0x06, 0xf9, 0x27, 0x00, 0x00, /* 0 */ | ||
375 | 0x08, 0xf7, 0x14, 0xeb, 0x2e, 0x00, 0x00, /* channel up */ | ||
376 | 0x08, 0xf7, 0x1d, 0xe2, 0x2d, 0x00, 0x00, /* channel down */ | ||
377 | 0x08, 0xf7, 0x02, 0xfd, 0x20, 0x00, 0x00, /* 3 */ | ||
378 | 0x08, 0xf7, 0x18, 0xe7, 0x23, 0x00, 0x00, /* 6 */ | ||
379 | 0x08, 0xf7, 0x04, 0xfb, 0x26, 0x00, 0x00, /* 9 */ | ||
380 | 0x08, 0xf7, 0x07, 0xf8, 0x44, 0x00, 0x00, /* jump */ | ||
381 | }; | ||
382 | |||
383 | /* MSI DIGIVOX mini II V3.0 */ | ||
384 | static struct ir_scancode ir_codes_af9015_table_msi[] = { | ||
385 | { 0x001e, KEY_1 }, | ||
386 | { 0x001f, KEY_2 }, | ||
387 | { 0x0020, KEY_3 }, | ||
388 | { 0x0021, KEY_4 }, | ||
389 | { 0x0022, KEY_5 }, | ||
390 | { 0x0023, KEY_6 }, | ||
391 | { 0x0024, KEY_7 }, | ||
392 | { 0x0025, KEY_8 }, | ||
393 | { 0x0026, KEY_9 }, | ||
394 | { 0x0027, KEY_0 }, | ||
395 | { 0x030f, KEY_CHANNELUP }, | ||
396 | { 0x030e, KEY_CHANNELDOWN }, | ||
397 | { 0x0042, KEY_VOLUMEDOWN }, | ||
398 | { 0x0043, KEY_VOLUMEUP }, | ||
399 | { 0x0545, KEY_POWER }, | ||
400 | { 0x0052, KEY_UP }, /* up */ | ||
401 | { 0x0051, KEY_DOWN }, /* down */ | ||
402 | { 0x0028, KEY_ENTER }, | ||
403 | }; | ||
404 | |||
405 | static u8 af9015_ir_table_msi[] = { | ||
406 | 0x03, 0xfc, 0x17, 0xe8, 0x45, 0x05, 0x00, /* power */ | ||
407 | 0x03, 0xfc, 0x0d, 0xf2, 0x51, 0x00, 0x00, /* down */ | ||
408 | 0x03, 0xfc, 0x03, 0xfc, 0x52, 0x00, 0x00, /* up */ | ||
409 | 0x03, 0xfc, 0x1a, 0xe5, 0x1e, 0x00, 0x00, /* 1 */ | ||
410 | 0x03, 0xfc, 0x02, 0xfd, 0x1f, 0x00, 0x00, /* 2 */ | ||
411 | 0x03, 0xfc, 0x04, 0xfb, 0x20, 0x00, 0x00, /* 3 */ | ||
412 | 0x03, 0xfc, 0x1c, 0xe3, 0x21, 0x00, 0x00, /* 4 */ | ||
413 | 0x03, 0xfc, 0x08, 0xf7, 0x22, 0x00, 0x00, /* 5 */ | ||
414 | 0x03, 0xfc, 0x1d, 0xe2, 0x23, 0x00, 0x00, /* 6 */ | ||
415 | 0x03, 0xfc, 0x11, 0xee, 0x24, 0x00, 0x00, /* 7 */ | ||
416 | 0x03, 0xfc, 0x0b, 0xf4, 0x25, 0x00, 0x00, /* 8 */ | ||
417 | 0x03, 0xfc, 0x10, 0xef, 0x26, 0x00, 0x00, /* 9 */ | ||
418 | 0x03, 0xfc, 0x09, 0xf6, 0x27, 0x00, 0x00, /* 0 */ | ||
419 | 0x03, 0xfc, 0x14, 0xeb, 0x43, 0x00, 0x00, /* volume up */ | ||
420 | 0x03, 0xfc, 0x1f, 0xe0, 0x42, 0x00, 0x00, /* volume down */ | ||
421 | 0x03, 0xfc, 0x15, 0xea, 0x0f, 0x03, 0x00, /* channel up */ | ||
422 | 0x03, 0xfc, 0x05, 0xfa, 0x0e, 0x03, 0x00, /* channel down */ | ||
423 | 0x03, 0xfc, 0x16, 0xe9, 0x28, 0x00, 0x00, /* enter */ | ||
424 | }; | ||
425 | |||
426 | /* MYGICTV U718 */ | ||
427 | static struct ir_scancode ir_codes_af9015_table_mygictv[] = { | ||
428 | { 0x003d, KEY_SWITCHVIDEOMODE }, | ||
429 | /* TV / AV */ | ||
430 | { 0x0545, KEY_POWER }, | ||
431 | { 0x001e, KEY_1 }, | ||
432 | { 0x001f, KEY_2 }, | ||
433 | { 0x0020, KEY_3 }, | ||
434 | { 0x0021, KEY_4 }, | ||
435 | { 0x0022, KEY_5 }, | ||
436 | { 0x0023, KEY_6 }, | ||
437 | { 0x0024, KEY_7 }, | ||
438 | { 0x0025, KEY_8 }, | ||
439 | { 0x0026, KEY_9 }, | ||
440 | { 0x0027, KEY_0 }, | ||
441 | { 0x0041, KEY_MUTE }, | ||
442 | { 0x002a, KEY_ESC }, /* Esc */ | ||
443 | { 0x002e, KEY_CHANNELUP }, | ||
444 | { 0x002d, KEY_CHANNELDOWN }, | ||
445 | { 0x0042, KEY_VOLUMEDOWN }, | ||
446 | { 0x0043, KEY_VOLUMEUP }, | ||
447 | { 0x0052, KEY_UP }, /* up arrow */ | ||
448 | { 0x0051, KEY_DOWN }, /* down arrow */ | ||
449 | { 0x004f, KEY_RIGHT }, /* right arrow */ | ||
450 | { 0x0050, KEY_LEFT }, /* left arrow */ | ||
451 | { 0x0028, KEY_ENTER }, /* ok */ | ||
452 | { 0x0115, KEY_RECORD }, | ||
453 | { 0x0313, KEY_PLAY }, | ||
454 | { 0x0113, KEY_PAUSE }, | ||
455 | { 0x0116, KEY_STOP }, | ||
456 | { 0x0307, KEY_REWIND }, /* FR << */ | ||
457 | { 0x0309, KEY_FASTFORWARD }, /* FF >> */ | ||
458 | { 0x003b, KEY_TIME }, /* TimeShift */ | ||
459 | { 0x003e, KEY_CAMERA }, /* Snapshot */ | ||
460 | { 0x0316, KEY_CYCLEWINDOWS }, /* yellow, min / max */ | ||
461 | { 0x0000, KEY_ZOOM }, /* 'select' (?) */ | ||
462 | { 0x0316, KEY_SHUFFLE }, /* Shuffle */ | ||
463 | { 0x0345, KEY_POWER }, | ||
464 | }; | ||
465 | |||
466 | static u8 af9015_ir_table_mygictv[] = { | ||
467 | 0x02, 0xbd, 0x0c, 0xf3, 0x3d, 0x00, 0x00, /* TV / AV */ | ||
468 | 0x02, 0xbd, 0x14, 0xeb, 0x45, 0x05, 0x00, /* power */ | ||
469 | 0x02, 0xbd, 0x00, 0xff, 0x1e, 0x00, 0x00, /* 1 */ | ||
470 | 0x02, 0xbd, 0x01, 0xfe, 0x1f, 0x00, 0x00, /* 2 */ | ||
471 | 0x02, 0xbd, 0x02, 0xfd, 0x20, 0x00, 0x00, /* 3 */ | ||
472 | 0x02, 0xbd, 0x03, 0xfc, 0x21, 0x00, 0x00, /* 4 */ | ||
473 | 0x02, 0xbd, 0x04, 0xfb, 0x22, 0x00, 0x00, /* 5 */ | ||
474 | 0x02, 0xbd, 0x05, 0xfa, 0x23, 0x00, 0x00, /* 6 */ | ||
475 | 0x02, 0xbd, 0x06, 0xf9, 0x24, 0x00, 0x00, /* 7 */ | ||
476 | 0x02, 0xbd, 0x07, 0xf8, 0x25, 0x00, 0x00, /* 8 */ | ||
477 | 0x02, 0xbd, 0x08, 0xf7, 0x26, 0x00, 0x00, /* 9 */ | ||
478 | 0x02, 0xbd, 0x09, 0xf6, 0x27, 0x00, 0x00, /* 0 */ | ||
479 | 0x02, 0xbd, 0x0a, 0xf5, 0x41, 0x00, 0x00, /* mute */ | ||
480 | 0x02, 0xbd, 0x1c, 0xe3, 0x2a, 0x00, 0x00, /* esc */ | ||
481 | 0x02, 0xbd, 0x1f, 0xe0, 0x43, 0x00, 0x00, /* volume up */ | ||
482 | 0x02, 0xbd, 0x12, 0xed, 0x52, 0x00, 0x00, /* up arrow */ | ||
483 | 0x02, 0xbd, 0x11, 0xee, 0x50, 0x00, 0x00, /* left arrow */ | ||
484 | 0x02, 0xbd, 0x15, 0xea, 0x28, 0x00, 0x00, /* ok */ | ||
485 | 0x02, 0xbd, 0x10, 0xef, 0x4f, 0x00, 0x00, /* right arrow */ | ||
486 | 0x02, 0xbd, 0x13, 0xec, 0x51, 0x00, 0x00, /* down arrow */ | ||
487 | 0x02, 0xbd, 0x0e, 0xf1, 0x42, 0x00, 0x00, /* volume down */ | ||
488 | 0x02, 0xbd, 0x19, 0xe6, 0x15, 0x01, 0x00, /* record */ | ||
489 | 0x02, 0xbd, 0x1e, 0xe1, 0x13, 0x03, 0x00, /* play */ | ||
490 | 0x02, 0xbd, 0x16, 0xe9, 0x16, 0x01, 0x00, /* stop */ | ||
491 | 0x02, 0xbd, 0x0b, 0xf4, 0x28, 0x04, 0x00, /* yellow, min / max */ | ||
492 | 0x02, 0xbd, 0x0f, 0xf0, 0x3b, 0x00, 0x00, /* time shift */ | ||
493 | 0x02, 0xbd, 0x18, 0xe7, 0x2e, 0x00, 0x00, /* channel up */ | ||
494 | 0x02, 0xbd, 0x1a, 0xe5, 0x2d, 0x00, 0x00, /* channel down */ | ||
495 | 0x02, 0xbd, 0x17, 0xe8, 0x3e, 0x00, 0x00, /* snapshot */ | ||
496 | 0x02, 0xbd, 0x40, 0xbf, 0x13, 0x01, 0x00, /* pause */ | ||
497 | 0x02, 0xbd, 0x41, 0xbe, 0x09, 0x03, 0x00, /* FF >> */ | ||
498 | 0x02, 0xbd, 0x42, 0xbd, 0x07, 0x03, 0x00, /* FR << */ | ||
499 | 0x02, 0xbd, 0x43, 0xbc, 0x00, 0x00, 0x00, /* 'select' (?) */ | ||
500 | 0x02, 0xbd, 0x44, 0xbb, 0x16, 0x03, 0x00, /* shuffle */ | ||
501 | 0x02, 0xbd, 0x45, 0xba, 0x45, 0x03, 0x00, /* power */ | ||
502 | }; | ||
503 | |||
504 | /* KWorld PlusTV Dual DVB-T Stick (DVB-T 399U) */ | ||
505 | static u8 af9015_ir_table_kworld[] = { | ||
506 | 0x86, 0x6b, 0x0c, 0xf3, 0x2e, 0x07, 0x00, | ||
507 | 0x86, 0x6b, 0x16, 0xe9, 0x2d, 0x07, 0x00, | ||
508 | 0x86, 0x6b, 0x1d, 0xe2, 0x37, 0x07, 0x00, | ||
509 | 0x86, 0x6b, 0x00, 0xff, 0x1e, 0x07, 0x00, | ||
510 | 0x86, 0x6b, 0x01, 0xfe, 0x1f, 0x07, 0x00, | ||
511 | 0x86, 0x6b, 0x02, 0xfd, 0x20, 0x07, 0x00, | ||
512 | 0x86, 0x6b, 0x03, 0xfc, 0x21, 0x07, 0x00, | ||
513 | 0x86, 0x6b, 0x04, 0xfb, 0x22, 0x07, 0x00, | ||
514 | 0x86, 0x6b, 0x05, 0xfa, 0x23, 0x07, 0x00, | ||
515 | 0x86, 0x6b, 0x06, 0xf9, 0x24, 0x07, 0x00, | ||
516 | 0x86, 0x6b, 0x07, 0xf8, 0x25, 0x07, 0x00, | ||
517 | 0x86, 0x6b, 0x08, 0xf7, 0x26, 0x07, 0x00, | ||
518 | 0x86, 0x6b, 0x09, 0xf6, 0x4d, 0x07, 0x00, | ||
519 | 0x86, 0x6b, 0x0a, 0xf5, 0x4e, 0x07, 0x00, | ||
520 | 0x86, 0x6b, 0x14, 0xeb, 0x4f, 0x07, 0x00, | ||
521 | 0x86, 0x6b, 0x1e, 0xe1, 0x50, 0x07, 0x00, | ||
522 | 0x86, 0x6b, 0x17, 0xe8, 0x52, 0x07, 0x00, | ||
523 | 0x86, 0x6b, 0x1f, 0xe0, 0x51, 0x07, 0x00, | ||
524 | 0x86, 0x6b, 0x0e, 0xf1, 0x0b, 0x07, 0x00, | ||
525 | 0x86, 0x6b, 0x20, 0xdf, 0x0c, 0x07, 0x00, | ||
526 | 0x86, 0x6b, 0x42, 0xbd, 0x0d, 0x07, 0x00, | ||
527 | 0x86, 0x6b, 0x0b, 0xf4, 0x0e, 0x07, 0x00, | ||
528 | 0x86, 0x6b, 0x43, 0xbc, 0x0f, 0x07, 0x00, | ||
529 | 0x86, 0x6b, 0x10, 0xef, 0x10, 0x07, 0x00, | ||
530 | 0x86, 0x6b, 0x21, 0xde, 0x11, 0x07, 0x00, | ||
531 | 0x86, 0x6b, 0x13, 0xec, 0x12, 0x07, 0x00, | ||
532 | 0x86, 0x6b, 0x11, 0xee, 0x13, 0x07, 0x00, | ||
533 | 0x86, 0x6b, 0x12, 0xed, 0x14, 0x07, 0x00, | ||
534 | 0x86, 0x6b, 0x19, 0xe6, 0x15, 0x07, 0x00, | ||
535 | 0x86, 0x6b, 0x1a, 0xe5, 0x16, 0x07, 0x00, | ||
536 | 0x86, 0x6b, 0x1b, 0xe4, 0x17, 0x07, 0x00, | ||
537 | 0x86, 0x6b, 0x4b, 0xb4, 0x18, 0x07, 0x00, | ||
538 | 0x86, 0x6b, 0x40, 0xbf, 0x19, 0x07, 0x00, | ||
539 | 0x86, 0x6b, 0x44, 0xbb, 0x1a, 0x07, 0x00, | ||
540 | 0x86, 0x6b, 0x41, 0xbe, 0x1b, 0x07, 0x00, | ||
541 | 0x86, 0x6b, 0x22, 0xdd, 0x1c, 0x07, 0x00, | ||
542 | 0x86, 0x6b, 0x15, 0xea, 0x1d, 0x07, 0x00, | ||
543 | 0x86, 0x6b, 0x0f, 0xf0, 0x3f, 0x07, 0x00, | ||
544 | 0x86, 0x6b, 0x1c, 0xe3, 0x40, 0x07, 0x00, | ||
545 | 0x86, 0x6b, 0x4a, 0xb5, 0x41, 0x07, 0x00, | ||
546 | 0x86, 0x6b, 0x48, 0xb7, 0x42, 0x07, 0x00, | ||
547 | 0x86, 0x6b, 0x49, 0xb6, 0x43, 0x07, 0x00, | ||
548 | 0x86, 0x6b, 0x18, 0xe7, 0x44, 0x07, 0x00, | ||
549 | 0x86, 0x6b, 0x23, 0xdc, 0x45, 0x07, 0x00, | ||
550 | }; | ||
551 | |||
552 | /* AverMedia Volar X */ | ||
553 | static struct ir_scancode ir_codes_af9015_table_avermedia[] = { | ||
554 | { 0x053d, KEY_PROG1 }, /* SOURCE */ | ||
555 | { 0x0512, KEY_POWER }, /* POWER */ | ||
556 | { 0x051e, KEY_1 }, /* 1 */ | ||
557 | { 0x051f, KEY_2 }, /* 2 */ | ||
558 | { 0x0520, KEY_3 }, /* 3 */ | ||
559 | { 0x0521, KEY_4 }, /* 4 */ | ||
560 | { 0x0522, KEY_5 }, /* 5 */ | ||
561 | { 0x0523, KEY_6 }, /* 6 */ | ||
562 | { 0x0524, KEY_7 }, /* 7 */ | ||
563 | { 0x0525, KEY_8 }, /* 8 */ | ||
564 | { 0x0526, KEY_9 }, /* 9 */ | ||
565 | { 0x053f, KEY_LEFT }, /* L / DISPLAY */ | ||
566 | { 0x0527, KEY_0 }, /* 0 */ | ||
567 | { 0x050f, KEY_RIGHT }, /* R / CH RTN */ | ||
568 | { 0x0518, KEY_PROG2 }, /* SNAP SHOT */ | ||
569 | { 0x051c, KEY_PROG3 }, /* 16-CH PREV */ | ||
570 | { 0x052d, KEY_VOLUMEDOWN }, /* VOL DOWN */ | ||
571 | { 0x053e, KEY_ZOOM }, /* FULL SCREEN */ | ||
572 | { 0x052e, KEY_VOLUMEUP }, /* VOL UP */ | ||
573 | { 0x0510, KEY_MUTE }, /* MUTE */ | ||
574 | { 0x0504, KEY_AUDIO }, /* AUDIO */ | ||
575 | { 0x0515, KEY_RECORD }, /* RECORD */ | ||
576 | { 0x0511, KEY_PLAY }, /* PLAY */ | ||
577 | { 0x0516, KEY_STOP }, /* STOP */ | ||
578 | { 0x050c, KEY_PLAYPAUSE }, /* TIMESHIFT / PAUSE */ | ||
579 | { 0x0505, KEY_BACK }, /* << / RED */ | ||
580 | { 0x0509, KEY_FORWARD }, /* >> / YELLOW */ | ||
581 | { 0x0517, KEY_TEXT }, /* TELETEXT */ | ||
582 | { 0x050a, KEY_EPG }, /* EPG */ | ||
583 | { 0x0513, KEY_MENU }, /* MENU */ | ||
584 | |||
585 | { 0x050e, KEY_CHANNELUP }, /* CH UP */ | ||
586 | { 0x050d, KEY_CHANNELDOWN }, /* CH DOWN */ | ||
587 | { 0x0519, KEY_FIRST }, /* |<< / GREEN */ | ||
588 | { 0x0508, KEY_LAST }, /* >>| / BLUE */ | ||
589 | }; | ||
590 | |||
591 | static u8 af9015_ir_table_avermedia[] = { | ||
592 | 0x02, 0xfd, 0x00, 0xff, 0x12, 0x05, 0x00, | ||
593 | 0x02, 0xfd, 0x01, 0xfe, 0x3d, 0x05, 0x00, | ||
594 | 0x02, 0xfd, 0x03, 0xfc, 0x17, 0x05, 0x00, | ||
595 | 0x02, 0xfd, 0x04, 0xfb, 0x0a, 0x05, 0x00, | ||
596 | 0x02, 0xfd, 0x05, 0xfa, 0x1e, 0x05, 0x00, | ||
597 | 0x02, 0xfd, 0x06, 0xf9, 0x1f, 0x05, 0x00, | ||
598 | 0x02, 0xfd, 0x07, 0xf8, 0x20, 0x05, 0x00, | ||
599 | 0x02, 0xfd, 0x09, 0xf6, 0x21, 0x05, 0x00, | ||
600 | 0x02, 0xfd, 0x0a, 0xf5, 0x22, 0x05, 0x00, | ||
601 | 0x02, 0xfd, 0x0b, 0xf4, 0x23, 0x05, 0x00, | ||
602 | 0x02, 0xfd, 0x0d, 0xf2, 0x24, 0x05, 0x00, | ||
603 | 0x02, 0xfd, 0x0e, 0xf1, 0x25, 0x05, 0x00, | ||
604 | 0x02, 0xfd, 0x0f, 0xf0, 0x26, 0x05, 0x00, | ||
605 | 0x02, 0xfd, 0x11, 0xee, 0x27, 0x05, 0x00, | ||
606 | 0x02, 0xfd, 0x08, 0xf7, 0x04, 0x05, 0x00, | ||
607 | 0x02, 0xfd, 0x0c, 0xf3, 0x3e, 0x05, 0x00, | ||
608 | 0x02, 0xfd, 0x10, 0xef, 0x1c, 0x05, 0x00, | ||
609 | 0x02, 0xfd, 0x12, 0xed, 0x3f, 0x05, 0x00, | ||
610 | 0x02, 0xfd, 0x13, 0xec, 0x0f, 0x05, 0x00, | ||
611 | 0x02, 0xfd, 0x14, 0xeb, 0x10, 0x05, 0x00, | ||
612 | 0x02, 0xfd, 0x15, 0xea, 0x13, 0x05, 0x00, | ||
613 | 0x02, 0xfd, 0x17, 0xe8, 0x18, 0x05, 0x00, | ||
614 | 0x02, 0xfd, 0x18, 0xe7, 0x11, 0x05, 0x00, | ||
615 | 0x02, 0xfd, 0x19, 0xe6, 0x15, 0x05, 0x00, | ||
616 | 0x02, 0xfd, 0x1a, 0xe5, 0x0c, 0x05, 0x00, | ||
617 | 0x02, 0xfd, 0x1b, 0xe4, 0x16, 0x05, 0x00, | ||
618 | 0x02, 0xfd, 0x1c, 0xe3, 0x09, 0x05, 0x00, | ||
619 | 0x02, 0xfd, 0x1d, 0xe2, 0x05, 0x05, 0x00, | ||
620 | 0x02, 0xfd, 0x1e, 0xe1, 0x2d, 0x05, 0x00, | ||
621 | 0x02, 0xfd, 0x1f, 0xe0, 0x2e, 0x05, 0x00, | ||
622 | 0x03, 0xfc, 0x00, 0xff, 0x08, 0x05, 0x00, | ||
623 | 0x03, 0xfc, 0x01, 0xfe, 0x19, 0x05, 0x00, | ||
624 | 0x03, 0xfc, 0x02, 0xfd, 0x0d, 0x05, 0x00, | ||
625 | 0x03, 0xfc, 0x03, 0xfc, 0x0e, 0x05, 0x00, | ||
626 | }; | ||
627 | |||
628 | static u8 af9015_ir_table_avermedia_ks[] = { | ||
629 | 0x05, 0xfa, 0x01, 0xfe, 0x12, 0x05, 0x00, | ||
630 | 0x05, 0xfa, 0x02, 0xfd, 0x0e, 0x05, 0x00, | ||
631 | 0x05, 0xfa, 0x03, 0xfc, 0x0d, 0x05, 0x00, | ||
632 | 0x05, 0xfa, 0x04, 0xfb, 0x2e, 0x05, 0x00, | ||
633 | 0x05, 0xfa, 0x05, 0xfa, 0x2d, 0x05, 0x00, | ||
634 | 0x05, 0xfa, 0x06, 0xf9, 0x10, 0x05, 0x00, | ||
635 | 0x05, 0xfa, 0x07, 0xf8, 0x0f, 0x05, 0x00, | ||
636 | 0x05, 0xfa, 0x08, 0xf7, 0x3d, 0x05, 0x00, | ||
637 | 0x05, 0xfa, 0x09, 0xf6, 0x1e, 0x05, 0x00, | ||
638 | 0x05, 0xfa, 0x0a, 0xf5, 0x1f, 0x05, 0x00, | ||
639 | 0x05, 0xfa, 0x0b, 0xf4, 0x20, 0x05, 0x00, | ||
640 | 0x05, 0xfa, 0x0c, 0xf3, 0x21, 0x05, 0x00, | ||
641 | 0x05, 0xfa, 0x0d, 0xf2, 0x22, 0x05, 0x00, | ||
642 | 0x05, 0xfa, 0x0e, 0xf1, 0x23, 0x05, 0x00, | ||
643 | 0x05, 0xfa, 0x0f, 0xf0, 0x24, 0x05, 0x00, | ||
644 | 0x05, 0xfa, 0x10, 0xef, 0x25, 0x05, 0x00, | ||
645 | 0x05, 0xfa, 0x11, 0xee, 0x26, 0x05, 0x00, | ||
646 | 0x05, 0xfa, 0x12, 0xed, 0x27, 0x05, 0x00, | ||
647 | 0x05, 0xfa, 0x13, 0xec, 0x04, 0x05, 0x00, | ||
648 | 0x05, 0xfa, 0x15, 0xea, 0x0a, 0x05, 0x00, | ||
649 | 0x05, 0xfa, 0x16, 0xe9, 0x11, 0x05, 0x00, | ||
650 | 0x05, 0xfa, 0x17, 0xe8, 0x15, 0x05, 0x00, | ||
651 | 0x05, 0xfa, 0x18, 0xe7, 0x16, 0x05, 0x00, | ||
652 | 0x05, 0xfa, 0x1c, 0xe3, 0x05, 0x05, 0x00, | ||
653 | 0x05, 0xfa, 0x1d, 0xe2, 0x09, 0x05, 0x00, | ||
654 | 0x05, 0xfa, 0x4d, 0xb2, 0x3f, 0x05, 0x00, | ||
655 | 0x05, 0xfa, 0x56, 0xa9, 0x3e, 0x05, 0x00 | ||
656 | }; | ||
657 | |||
658 | /* Digittrade DVB-T USB Stick */ | ||
659 | static struct ir_scancode ir_codes_af9015_table_digittrade[] = { | ||
660 | { 0x010f, KEY_LAST }, /* RETURN */ | ||
661 | { 0x0517, KEY_TEXT }, /* TELETEXT */ | ||
662 | { 0x0108, KEY_EPG }, /* EPG */ | ||
663 | { 0x0513, KEY_POWER }, /* POWER */ | ||
664 | { 0x0109, KEY_ZOOM }, /* FULLSCREEN */ | ||
665 | { 0x0040, KEY_AUDIO }, /* DUAL SOUND */ | ||
666 | { 0x002c, KEY_PRINT }, /* SNAPSHOT */ | ||
667 | { 0x0516, KEY_SUBTITLE }, /* SUBTITLE */ | ||
668 | { 0x0052, KEY_CHANNELUP }, /* CH Up */ | ||
669 | { 0x0051, KEY_CHANNELDOWN },/* Ch Dn */ | ||
670 | { 0x0057, KEY_VOLUMEUP }, /* Vol Up */ | ||
671 | { 0x0056, KEY_VOLUMEDOWN }, /* Vol Dn */ | ||
672 | { 0x0110, KEY_MUTE }, /* MUTE */ | ||
673 | { 0x0027, KEY_0 }, | ||
674 | { 0x001e, KEY_1 }, | ||
675 | { 0x001f, KEY_2 }, | ||
676 | { 0x0020, KEY_3 }, | ||
677 | { 0x0021, KEY_4 }, | ||
678 | { 0x0022, KEY_5 }, | ||
679 | { 0x0023, KEY_6 }, | ||
680 | { 0x0024, KEY_7 }, | ||
681 | { 0x0025, KEY_8 }, | ||
682 | { 0x0026, KEY_9 }, | ||
683 | { 0x0117, KEY_PLAYPAUSE }, /* TIMESHIFT */ | ||
684 | { 0x0115, KEY_RECORD }, /* RECORD */ | ||
685 | { 0x0313, KEY_PLAY }, /* PLAY */ | ||
686 | { 0x0116, KEY_STOP }, /* STOP */ | ||
687 | { 0x0113, KEY_PAUSE }, /* PAUSE */ | ||
688 | }; | ||
689 | |||
690 | static u8 af9015_ir_table_digittrade[] = { | ||
691 | 0x00, 0xff, 0x06, 0xf9, 0x13, 0x05, 0x00, | ||
692 | 0x00, 0xff, 0x4d, 0xb2, 0x17, 0x01, 0x00, | ||
693 | 0x00, 0xff, 0x1f, 0xe0, 0x2c, 0x00, 0x00, | ||
694 | 0x00, 0xff, 0x0a, 0xf5, 0x15, 0x01, 0x00, | ||
695 | 0x00, 0xff, 0x0e, 0xf1, 0x16, 0x01, 0x00, | ||
696 | 0x00, 0xff, 0x09, 0xf6, 0x09, 0x01, 0x00, | ||
697 | 0x00, 0xff, 0x01, 0xfe, 0x08, 0x01, 0x00, | ||
698 | 0x00, 0xff, 0x05, 0xfa, 0x10, 0x01, 0x00, | ||
699 | 0x00, 0xff, 0x02, 0xfd, 0x56, 0x00, 0x00, | ||
700 | 0x00, 0xff, 0x40, 0xbf, 0x57, 0x00, 0x00, | ||
701 | 0x00, 0xff, 0x19, 0xe6, 0x52, 0x00, 0x00, | ||
702 | 0x00, 0xff, 0x17, 0xe8, 0x51, 0x00, 0x00, | ||
703 | 0x00, 0xff, 0x10, 0xef, 0x0f, 0x01, 0x00, | ||
704 | 0x00, 0xff, 0x54, 0xab, 0x27, 0x00, 0x00, | ||
705 | 0x00, 0xff, 0x1b, 0xe4, 0x1e, 0x00, 0x00, | ||
706 | 0x00, 0xff, 0x11, 0xee, 0x1f, 0x00, 0x00, | ||
707 | 0x00, 0xff, 0x15, 0xea, 0x20, 0x00, 0x00, | ||
708 | 0x00, 0xff, 0x12, 0xed, 0x21, 0x00, 0x00, | ||
709 | 0x00, 0xff, 0x16, 0xe9, 0x22, 0x00, 0x00, | ||
710 | 0x00, 0xff, 0x4c, 0xb3, 0x23, 0x00, 0x00, | ||
711 | 0x00, 0xff, 0x48, 0xb7, 0x24, 0x00, 0x00, | ||
712 | 0x00, 0xff, 0x04, 0xfb, 0x25, 0x00, 0x00, | ||
713 | 0x00, 0xff, 0x00, 0xff, 0x26, 0x00, 0x00, | ||
714 | 0x00, 0xff, 0x1e, 0xe1, 0x13, 0x03, 0x00, | ||
715 | 0x00, 0xff, 0x1a, 0xe5, 0x13, 0x01, 0x00, | ||
716 | 0x00, 0xff, 0x03, 0xfc, 0x17, 0x05, 0x00, | ||
717 | 0x00, 0xff, 0x0d, 0xf2, 0x16, 0x05, 0x00, | ||
718 | 0x00, 0xff, 0x1d, 0xe2, 0x40, 0x00, 0x00, | ||
719 | }; | ||
720 | |||
721 | /* TREKSTOR DVB-T USB Stick */ | ||
722 | static struct ir_scancode ir_codes_af9015_table_trekstor[] = { | ||
723 | { 0x0704, KEY_AGAIN }, /* Home */ | ||
724 | { 0x0705, KEY_MUTE }, /* Mute */ | ||
725 | { 0x0706, KEY_UP }, /* Up */ | ||
726 | { 0x0707, KEY_DOWN }, /* Down */ | ||
727 | { 0x0709, KEY_RIGHT }, /* Right */ | ||
728 | { 0x070a, KEY_ENTER }, /* OK */ | ||
729 | { 0x070b, KEY_FASTFORWARD }, /* Fast forward */ | ||
730 | { 0x070c, KEY_REWIND }, /* Rewind */ | ||
731 | { 0x070d, KEY_PLAY }, /* Play/Pause */ | ||
732 | { 0x070e, KEY_VOLUMEUP }, /* Volume + */ | ||
733 | { 0x070f, KEY_VOLUMEDOWN }, /* Volume - */ | ||
734 | { 0x0710, KEY_RECORD }, /* Record */ | ||
735 | { 0x0711, KEY_STOP }, /* Stop */ | ||
736 | { 0x0712, KEY_ZOOM }, /* TV */ | ||
737 | { 0x0713, KEY_EPG }, /* Info/EPG */ | ||
738 | { 0x0714, KEY_CHANNELDOWN }, /* Channel - */ | ||
739 | { 0x0715, KEY_CHANNELUP }, /* Channel + */ | ||
740 | { 0x071e, KEY_1 }, | ||
741 | { 0x071f, KEY_2 }, | ||
742 | { 0x0720, KEY_3 }, | ||
743 | { 0x0721, KEY_4 }, | ||
744 | { 0x0722, KEY_5 }, | ||
745 | { 0x0723, KEY_6 }, | ||
746 | { 0x0724, KEY_7 }, | ||
747 | { 0x0725, KEY_8 }, | ||
748 | { 0x0726, KEY_9 }, | ||
749 | { 0x0708, KEY_LEFT }, /* LEFT */ | ||
750 | { 0x0727, KEY_0 }, | ||
751 | }; | ||
752 | |||
753 | static u8 af9015_ir_table_trekstor[] = { | ||
754 | 0x00, 0xff, 0x86, 0x79, 0x04, 0x07, 0x00, | ||
755 | 0x00, 0xff, 0x85, 0x7a, 0x05, 0x07, 0x00, | ||
756 | 0x00, 0xff, 0x87, 0x78, 0x06, 0x07, 0x00, | ||
757 | 0x00, 0xff, 0x8c, 0x73, 0x07, 0x07, 0x00, | ||
758 | 0x00, 0xff, 0x89, 0x76, 0x09, 0x07, 0x00, | ||
759 | 0x00, 0xff, 0x88, 0x77, 0x0a, 0x07, 0x00, | ||
760 | 0x00, 0xff, 0x8a, 0x75, 0x0b, 0x07, 0x00, | ||
761 | 0x00, 0xff, 0x9e, 0x61, 0x0c, 0x07, 0x00, | ||
762 | 0x00, 0xff, 0x8d, 0x72, 0x0d, 0x07, 0x00, | ||
763 | 0x00, 0xff, 0x8b, 0x74, 0x0e, 0x07, 0x00, | ||
764 | 0x00, 0xff, 0x9b, 0x64, 0x0f, 0x07, 0x00, | ||
765 | 0x00, 0xff, 0x9d, 0x62, 0x10, 0x07, 0x00, | ||
766 | 0x00, 0xff, 0x8e, 0x71, 0x11, 0x07, 0x00, | ||
767 | 0x00, 0xff, 0x9c, 0x63, 0x12, 0x07, 0x00, | ||
768 | 0x00, 0xff, 0x8f, 0x70, 0x13, 0x07, 0x00, | ||
769 | 0x00, 0xff, 0x93, 0x6c, 0x14, 0x07, 0x00, | ||
770 | 0x00, 0xff, 0x97, 0x68, 0x15, 0x07, 0x00, | ||
771 | 0x00, 0xff, 0x92, 0x6d, 0x1e, 0x07, 0x00, | ||
772 | 0x00, 0xff, 0x96, 0x69, 0x1f, 0x07, 0x00, | ||
773 | 0x00, 0xff, 0x9a, 0x65, 0x20, 0x07, 0x00, | ||
774 | 0x00, 0xff, 0x91, 0x6e, 0x21, 0x07, 0x00, | ||
775 | 0x00, 0xff, 0x95, 0x6a, 0x22, 0x07, 0x00, | ||
776 | 0x00, 0xff, 0x99, 0x66, 0x23, 0x07, 0x00, | ||
777 | 0x00, 0xff, 0x90, 0x6f, 0x24, 0x07, 0x00, | ||
778 | 0x00, 0xff, 0x94, 0x6b, 0x25, 0x07, 0x00, | ||
779 | 0x00, 0xff, 0x98, 0x67, 0x26, 0x07, 0x00, | ||
780 | 0x00, 0xff, 0x9f, 0x60, 0x08, 0x07, 0x00, | ||
781 | 0x00, 0xff, 0x84, 0x7b, 0x27, 0x07, 0x00, | ||
782 | }; | ||
783 | |||
784 | /* MSI DIGIVOX mini III */ | ||
785 | static struct ir_scancode ir_codes_af9015_table_msi_digivox_iii[] = { | ||
786 | { 0x0713, KEY_POWER }, /* [red power button] */ | ||
787 | { 0x073b, KEY_VIDEO }, /* Source */ | ||
788 | { 0x073e, KEY_ZOOM }, /* Zoom */ | ||
789 | { 0x070b, KEY_POWER2 }, /* ShutDown */ | ||
790 | { 0x071e, KEY_1 }, | ||
791 | { 0x071f, KEY_2 }, | ||
792 | { 0x0720, KEY_3 }, | ||
793 | { 0x0721, KEY_4 }, | ||
794 | { 0x0722, KEY_5 }, | ||
795 | { 0x0723, KEY_6 }, | ||
796 | { 0x0724, KEY_7 }, | ||
797 | { 0x0725, KEY_8 }, | ||
798 | { 0x0726, KEY_9 }, | ||
799 | { 0x0727, KEY_0 }, | ||
800 | { 0x0752, KEY_CHANNELUP }, /* CH+ */ | ||
801 | { 0x0751, KEY_CHANNELDOWN }, /* CH- */ | ||
802 | { 0x0750, KEY_VOLUMEUP }, /* Vol+ */ | ||
803 | { 0x074f, KEY_VOLUMEDOWN }, /* Vol- */ | ||
804 | { 0x0705, KEY_ESC }, /* [back up arrow] */ | ||
805 | { 0x0708, KEY_OK }, /* [enter arrow] */ | ||
806 | { 0x073f, KEY_RECORD }, /* Rec */ | ||
807 | { 0x0716, KEY_STOP }, /* Stop */ | ||
808 | { 0x072a, KEY_PLAY }, /* Play */ | ||
809 | { 0x073c, KEY_MUTE }, /* Mute */ | ||
810 | { 0x0718, KEY_UP }, | ||
811 | { 0x0707, KEY_DOWN }, | ||
812 | { 0x070f, KEY_LEFT }, | ||
813 | { 0x0715, KEY_RIGHT }, | ||
814 | { 0x0736, KEY_RED }, | ||
815 | { 0x0737, KEY_GREEN }, | ||
816 | { 0x072d, KEY_YELLOW }, | ||
817 | { 0x072e, KEY_BLUE }, | ||
818 | }; | ||
819 | |||
820 | static u8 af9015_ir_table_msi_digivox_iii[] = { | ||
821 | 0x61, 0xd6, 0x43, 0xbc, 0x13, 0x07, 0x00, /* KEY_POWER */ | ||
822 | 0x61, 0xd6, 0x01, 0xfe, 0x3b, 0x07, 0x00, /* KEY_VIDEO */ | ||
823 | 0x61, 0xd6, 0x0b, 0xf4, 0x3e, 0x07, 0x00, /* KEY_ZOOM */ | ||
824 | 0x61, 0xd6, 0x03, 0xfc, 0x0b, 0x07, 0x00, /* KEY_POWER2 */ | ||
825 | 0x61, 0xd6, 0x04, 0xfb, 0x1e, 0x07, 0x00, /* KEY_1 */ | ||
826 | 0x61, 0xd6, 0x08, 0xf7, 0x1f, 0x07, 0x00, /* KEY_2 */ | ||
827 | 0x61, 0xd6, 0x02, 0xfd, 0x20, 0x07, 0x00, /* KEY_3 */ | ||
828 | 0x61, 0xd6, 0x0f, 0xf0, 0x21, 0x07, 0x00, /* KEY_4 */ | ||
829 | 0x61, 0xd6, 0x05, 0xfa, 0x22, 0x07, 0x00, /* KEY_5 */ | ||
830 | 0x61, 0xd6, 0x06, 0xf9, 0x23, 0x07, 0x00, /* KEY_6 */ | ||
831 | 0x61, 0xd6, 0x0c, 0xf3, 0x24, 0x07, 0x00, /* KEY_7 */ | ||
832 | 0x61, 0xd6, 0x0d, 0xf2, 0x25, 0x07, 0x00, /* KEY_8 */ | ||
833 | 0x61, 0xd6, 0x0a, 0xf5, 0x26, 0x07, 0x00, /* KEY_9 */ | ||
834 | 0x61, 0xd6, 0x11, 0xee, 0x27, 0x07, 0x00, /* KEY_0 */ | ||
835 | 0x61, 0xd6, 0x09, 0xf6, 0x52, 0x07, 0x00, /* KEY_CHANNELUP */ | ||
836 | 0x61, 0xd6, 0x07, 0xf8, 0x51, 0x07, 0x00, /* KEY_CHANNELDOWN */ | ||
837 | 0x61, 0xd6, 0x0e, 0xf1, 0x50, 0x07, 0x00, /* KEY_VOLUMEUP */ | ||
838 | 0x61, 0xd6, 0x13, 0xec, 0x4f, 0x07, 0x00, /* KEY_VOLUMEDOWN */ | ||
839 | 0x61, 0xd6, 0x10, 0xef, 0x05, 0x07, 0x00, /* KEY_ESC */ | ||
840 | 0x61, 0xd6, 0x12, 0xed, 0x08, 0x07, 0x00, /* KEY_OK */ | ||
841 | 0x61, 0xd6, 0x14, 0xeb, 0x3f, 0x07, 0x00, /* KEY_RECORD */ | ||
842 | 0x61, 0xd6, 0x15, 0xea, 0x16, 0x07, 0x00, /* KEY_STOP */ | ||
843 | 0x61, 0xd6, 0x16, 0xe9, 0x2a, 0x07, 0x00, /* KEY_PLAY */ | ||
844 | 0x61, 0xd6, 0x17, 0xe8, 0x3c, 0x07, 0x00, /* KEY_MUTE */ | ||
845 | 0x61, 0xd6, 0x18, 0xe7, 0x18, 0x07, 0x00, /* KEY_UP */ | ||
846 | 0x61, 0xd6, 0x19, 0xe6, 0x07, 0x07, 0x00, /* KEY_DOWN */ | ||
847 | 0x61, 0xd6, 0x1a, 0xe5, 0x0f, 0x07, 0x00, /* KEY_LEFT */ | ||
848 | 0x61, 0xd6, 0x1b, 0xe4, 0x15, 0x07, 0x00, /* KEY_RIGHT */ | ||
849 | 0x61, 0xd6, 0x1c, 0xe3, 0x36, 0x07, 0x00, /* KEY_RED */ | ||
850 | 0x61, 0xd6, 0x1d, 0xe2, 0x37, 0x07, 0x00, /* KEY_GREEN */ | ||
851 | 0x61, 0xd6, 0x1e, 0xe1, 0x2d, 0x07, 0x00, /* KEY_YELLOW */ | ||
852 | 0x61, 0xd6, 0x1f, 0xe0, 0x2e, 0x07, 0x00, /* KEY_BLUE */ | ||
853 | }; | ||
854 | |||
855 | #endif | 125 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 4685259e1614..7c327b54308e 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c | |||
@@ -36,6 +36,11 @@ | |||
36 | #include "mt352.h" | 36 | #include "mt352.h" |
37 | #include "mt352_priv.h" | 37 | #include "mt352_priv.h" |
38 | #include "zl10353.h" | 38 | #include "zl10353.h" |
39 | #include "tda18212.h" | ||
40 | #include "cx24116.h" | ||
41 | #include "stv0900.h" | ||
42 | #include "stv6110.h" | ||
43 | #include "isl6423.h" | ||
39 | 44 | ||
40 | /* debug */ | 45 | /* debug */ |
41 | static int dvb_usb_anysee_debug; | 46 | static int dvb_usb_anysee_debug; |
@@ -55,8 +60,6 @@ static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | |||
55 | int act_len, ret; | 60 | int act_len, ret; |
56 | u8 buf[64]; | 61 | u8 buf[64]; |
57 | 62 | ||
58 | if (slen > sizeof(buf)) | ||
59 | slen = sizeof(buf); | ||
60 | memcpy(&buf[0], sbuf, slen); | 63 | memcpy(&buf[0], sbuf, slen); |
61 | buf[60] = state->seq++; | 64 | buf[60] = state->seq++; |
62 | 65 | ||
@@ -105,6 +108,27 @@ static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val) | |||
105 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); | 108 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); |
106 | } | 109 | } |
107 | 110 | ||
111 | /* write single register with mask */ | ||
112 | static int anysee_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val, | ||
113 | u8 mask) | ||
114 | { | ||
115 | int ret; | ||
116 | u8 tmp; | ||
117 | |||
118 | /* no need for read if whole reg is written */ | ||
119 | if (mask != 0xff) { | ||
120 | ret = anysee_read_reg(d, reg, &tmp); | ||
121 | if (ret) | ||
122 | return ret; | ||
123 | |||
124 | val &= mask; | ||
125 | tmp &= ~mask; | ||
126 | val |= tmp; | ||
127 | } | ||
128 | |||
129 | return anysee_write_reg(d, reg, val); | ||
130 | } | ||
131 | |||
108 | static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id) | 132 | static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id) |
109 | { | 133 | { |
110 | u8 buf[] = {CMD_GET_HW_INFO}; | 134 | u8 buf[] = {CMD_GET_HW_INFO}; |
@@ -154,30 +178,37 @@ static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
154 | { | 178 | { |
155 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 179 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
156 | int ret = 0, inc, i = 0; | 180 | int ret = 0, inc, i = 0; |
181 | u8 buf[52]; /* 4 + 48 (I2C WR USB command header + I2C WR max) */ | ||
157 | 182 | ||
158 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 183 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
159 | return -EAGAIN; | 184 | return -EAGAIN; |
160 | 185 | ||
161 | while (i < num) { | 186 | while (i < num) { |
162 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { | 187 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { |
163 | u8 buf[6]; | 188 | if (msg[i].len > 2 || msg[i+1].len > 60) { |
189 | ret = -EOPNOTSUPP; | ||
190 | break; | ||
191 | } | ||
164 | buf[0] = CMD_I2C_READ; | 192 | buf[0] = CMD_I2C_READ; |
165 | buf[1] = msg[i].addr + 1; | 193 | buf[1] = (msg[i].addr << 1) | 0x01; |
166 | buf[2] = msg[i].buf[0]; | 194 | buf[2] = msg[i].buf[0]; |
167 | buf[3] = 0x00; | 195 | buf[3] = msg[i].buf[1]; |
168 | buf[4] = 0x00; | 196 | buf[4] = msg[i].len-1; |
169 | buf[5] = 0x01; | 197 | buf[5] = msg[i+1].len; |
170 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), msg[i+1].buf, | 198 | ret = anysee_ctrl_msg(d, buf, 6, msg[i+1].buf, |
171 | msg[i+1].len); | 199 | msg[i+1].len); |
172 | inc = 2; | 200 | inc = 2; |
173 | } else { | 201 | } else { |
174 | u8 buf[4+msg[i].len]; | 202 | if (msg[i].len > 48) { |
203 | ret = -EOPNOTSUPP; | ||
204 | break; | ||
205 | } | ||
175 | buf[0] = CMD_I2C_WRITE; | 206 | buf[0] = CMD_I2C_WRITE; |
176 | buf[1] = msg[i].addr; | 207 | buf[1] = (msg[i].addr << 1); |
177 | buf[2] = msg[i].len; | 208 | buf[2] = msg[i].len; |
178 | buf[3] = 0x01; | 209 | buf[3] = 0x01; |
179 | memcpy(&buf[4], msg[i].buf, msg[i].len); | 210 | memcpy(&buf[4], msg[i].buf, msg[i].len); |
180 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); | 211 | ret = anysee_ctrl_msg(d, buf, 4 + msg[i].len, NULL, 0); |
181 | inc = 1; | 212 | inc = 1; |
182 | } | 213 | } |
183 | if (ret) | 214 | if (ret) |
@@ -224,7 +255,7 @@ static int anysee_mt352_demod_init(struct dvb_frontend *fe) | |||
224 | 255 | ||
225 | /* Callbacks for DVB USB */ | 256 | /* Callbacks for DVB USB */ |
226 | static struct tda10023_config anysee_tda10023_config = { | 257 | static struct tda10023_config anysee_tda10023_config = { |
227 | .demod_address = 0x1a, | 258 | .demod_address = (0x1a >> 1), |
228 | .invert = 0, | 259 | .invert = 0, |
229 | .xtal = 16000000, | 260 | .xtal = 16000000, |
230 | .pll_m = 11, | 261 | .pll_m = 11, |
@@ -235,217 +266,567 @@ static struct tda10023_config anysee_tda10023_config = { | |||
235 | }; | 266 | }; |
236 | 267 | ||
237 | static struct mt352_config anysee_mt352_config = { | 268 | static struct mt352_config anysee_mt352_config = { |
238 | .demod_address = 0x1e, | 269 | .demod_address = (0x1e >> 1), |
239 | .demod_init = anysee_mt352_demod_init, | 270 | .demod_init = anysee_mt352_demod_init, |
240 | }; | 271 | }; |
241 | 272 | ||
242 | static struct zl10353_config anysee_zl10353_config = { | 273 | static struct zl10353_config anysee_zl10353_config = { |
243 | .demod_address = 0x1e, | 274 | .demod_address = (0x1e >> 1), |
244 | .parallel_ts = 1, | 275 | .parallel_ts = 1, |
245 | }; | 276 | }; |
246 | 277 | ||
278 | static struct zl10353_config anysee_zl10353_tda18212_config2 = { | ||
279 | .demod_address = (0x1e >> 1), | ||
280 | .parallel_ts = 1, | ||
281 | .disable_i2c_gate_ctrl = 1, | ||
282 | .no_tuner = 1, | ||
283 | .if2 = 41500, | ||
284 | }; | ||
285 | |||
286 | static struct zl10353_config anysee_zl10353_tda18212_config = { | ||
287 | .demod_address = (0x18 >> 1), | ||
288 | .parallel_ts = 1, | ||
289 | .disable_i2c_gate_ctrl = 1, | ||
290 | .no_tuner = 1, | ||
291 | .if2 = 41500, | ||
292 | }; | ||
293 | |||
294 | static struct tda10023_config anysee_tda10023_tda18212_config = { | ||
295 | .demod_address = (0x1a >> 1), | ||
296 | .xtal = 16000000, | ||
297 | .pll_m = 12, | ||
298 | .pll_p = 3, | ||
299 | .pll_n = 1, | ||
300 | .output_mode = TDA10023_OUTPUT_MODE_PARALLEL_C, | ||
301 | .deltaf = 0xba02, | ||
302 | }; | ||
303 | |||
304 | static struct tda18212_config anysee_tda18212_config = { | ||
305 | .i2c_address = (0xc0 >> 1), | ||
306 | .if_dvbt_6 = 4150, | ||
307 | .if_dvbt_7 = 4150, | ||
308 | .if_dvbt_8 = 4150, | ||
309 | .if_dvbc = 5000, | ||
310 | }; | ||
311 | |||
312 | static struct cx24116_config anysee_cx24116_config = { | ||
313 | .demod_address = (0xaa >> 1), | ||
314 | .mpg_clk_pos_pol = 0x00, | ||
315 | .i2c_wr_max = 48, | ||
316 | }; | ||
317 | |||
318 | static struct stv0900_config anysee_stv0900_config = { | ||
319 | .demod_address = (0xd0 >> 1), | ||
320 | .demod_mode = 0, | ||
321 | .xtal = 8000000, | ||
322 | .clkmode = 3, | ||
323 | .diseqc_mode = 2, | ||
324 | .tun1_maddress = 0, | ||
325 | .tun1_adc = 1, /* 1 Vpp */ | ||
326 | .path1_mode = 3, | ||
327 | }; | ||
328 | |||
329 | static struct stv6110_config anysee_stv6110_config = { | ||
330 | .i2c_address = (0xc0 >> 1), | ||
331 | .mclk = 16000000, | ||
332 | .clk_div = 1, | ||
333 | }; | ||
334 | |||
335 | static struct isl6423_config anysee_isl6423_config = { | ||
336 | .current_max = SEC_CURRENT_800m, | ||
337 | .curlim = SEC_CURRENT_LIM_OFF, | ||
338 | .mod_extern = 1, | ||
339 | .addr = (0x10 >> 1), | ||
340 | }; | ||
341 | |||
342 | /* | ||
343 | * New USB device strings: Mfr=1, Product=2, SerialNumber=0 | ||
344 | * Manufacturer: AMT.CO.KR | ||
345 | * | ||
346 | * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=???????? | ||
347 | * PCB: ? | ||
348 | * parts: DNOS404ZH102A(MT352, DTT7579(?)) | ||
349 | * | ||
350 | * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=???????? | ||
351 | * PCB: ? | ||
352 | * parts: DNOS404ZH103A(ZL10353, DTT7579(?)) | ||
353 | * | ||
354 | * E30 Plus VID=04b4 PID=861f HW=6 FW=1.0 "anysee" | ||
355 | * PCB: 507CD (rev1.1) | ||
356 | * parts: DNOS404ZH103A(ZL10353, DTT7579(?)), CST56I01 | ||
357 | * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe | ||
358 | * IOA=4f IOB=ff IOC=00 IOD=06 IOF=01 | ||
359 | * IOD[0] ZL10353 1=enabled | ||
360 | * IOA[7] TS 0=enabled | ||
361 | * tuner is not behind ZL10353 I2C-gate (no care if gate disabled or not) | ||
362 | * | ||
363 | * E30 C Plus VID=04b4 PID=861f HW=10 FW=1.0 "anysee-DC(LP)" | ||
364 | * PCB: 507DC (rev0.2) | ||
365 | * parts: TDA10023, DTOS403IH102B TM, CST56I01 | ||
366 | * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe | ||
367 | * IOA=4f IOB=ff IOC=00 IOD=26 IOF=01 | ||
368 | * IOD[0] TDA10023 1=enabled | ||
369 | * | ||
370 | * E30 S2 Plus VID=04b4 PID=861f HW=11 FW=0.1 "anysee-S2(LP)" | ||
371 | * PCB: 507SI (rev2.1) | ||
372 | * parts: BS2N10WCC01(CX24116, CX24118), ISL6423, TDA8024 | ||
373 | * OEA=80 OEB=00 OEC=ff OED=ff OEF=fe | ||
374 | * IOA=4d IOB=ff IOC=00 IOD=26 IOF=01 | ||
375 | * IOD[0] CX24116 1=enabled | ||
376 | * | ||
377 | * E30 C Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)" | ||
378 | * PCB: 507FA (rev0.4) | ||
379 | * parts: TDA10023, DTOS403IH102B TM, TDA8024 | ||
380 | * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff | ||
381 | * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0 | ||
382 | * IOD[5] TDA10023 1=enabled | ||
383 | * IOE[0] tuner 1=enabled | ||
384 | * | ||
385 | * E30 Combo Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)" | ||
386 | * PCB: 507FA (rev1.1) | ||
387 | * parts: ZL10353, TDA10023, DTOS403IH102B TM, TDA8024 | ||
388 | * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff | ||
389 | * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0 | ||
390 | * DVB-C: | ||
391 | * IOD[5] TDA10023 1=enabled | ||
392 | * IOE[0] tuner 1=enabled | ||
393 | * DVB-T: | ||
394 | * IOD[0] ZL10353 1=enabled | ||
395 | * IOE[0] tuner 0=enabled | ||
396 | * tuner is behind ZL10353 I2C-gate | ||
397 | * | ||
398 | * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)" | ||
399 | * PCB: 508TC (rev0.6) | ||
400 | * parts: ZL10353, TDA10023, DNOD44CDH086A(TDA18212) | ||
401 | * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff | ||
402 | * IOA=4d IOB=00 IOC=cc IOD=48 IOF=e4 | ||
403 | * IOA[7] TS 1=enabled | ||
404 | * IOE[4] TDA18212 1=enabled | ||
405 | * DVB-C: | ||
406 | * IOD[6] ZL10353 0=disabled | ||
407 | * IOD[5] TDA10023 1=enabled | ||
408 | * IOE[0] IF 1=enabled | ||
409 | * DVB-T: | ||
410 | * IOD[5] TDA10023 0=disabled | ||
411 | * IOD[6] ZL10353 1=enabled | ||
412 | * IOE[0] IF 0=enabled | ||
413 | * | ||
414 | * E7 S2 VID=1c73 PID=861f HW=19 FW=0.4 AMTCI=0.5 "anysee-E7S2(LP)" | ||
415 | * PCB: 508S2 (rev0.7) | ||
416 | * parts: DNBU10512IST(STV0903, STV6110), ISL6423 | ||
417 | * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff | ||
418 | * IOA=4d IOB=00 IOC=c4 IOD=08 IOF=e4 | ||
419 | * IOA[7] TS 1=enabled | ||
420 | * IOE[5] STV0903 1=enabled | ||
421 | * | ||
422 | */ | ||
423 | |||
247 | static int anysee_frontend_attach(struct dvb_usb_adapter *adap) | 424 | static int anysee_frontend_attach(struct dvb_usb_adapter *adap) |
248 | { | 425 | { |
249 | int ret; | 426 | int ret; |
250 | struct anysee_state *state = adap->dev->priv; | 427 | struct anysee_state *state = adap->dev->priv; |
251 | u8 hw_info[3]; | 428 | u8 hw_info[3]; |
252 | u8 io_d; /* IO port D */ | 429 | u8 tmp; |
430 | struct i2c_msg msg[2] = { | ||
431 | { | ||
432 | .addr = anysee_tda18212_config.i2c_address, | ||
433 | .flags = 0, | ||
434 | .len = 1, | ||
435 | .buf = "\x00", | ||
436 | }, { | ||
437 | .addr = anysee_tda18212_config.i2c_address, | ||
438 | .flags = I2C_M_RD, | ||
439 | .len = 1, | ||
440 | .buf = &tmp, | ||
441 | } | ||
442 | }; | ||
253 | 443 | ||
254 | /* check which hardware we have | 444 | /* Check which hardware we have. |
255 | We must do this call two times to get reliable values (hw bug). */ | 445 | * We must do this call two times to get reliable values (hw bug). |
446 | */ | ||
256 | ret = anysee_get_hw_info(adap->dev, hw_info); | 447 | ret = anysee_get_hw_info(adap->dev, hw_info); |
257 | if (ret) | 448 | if (ret) |
258 | return ret; | 449 | goto error; |
450 | |||
259 | ret = anysee_get_hw_info(adap->dev, hw_info); | 451 | ret = anysee_get_hw_info(adap->dev, hw_info); |
260 | if (ret) | 452 | if (ret) |
261 | return ret; | 453 | goto error; |
262 | 454 | ||
263 | /* Meaning of these info bytes are guessed. */ | 455 | /* Meaning of these info bytes are guessed. */ |
264 | info("firmware version:%d.%d.%d hardware id:%d", | 456 | info("firmware version:%d.%d hardware id:%d", |
265 | 0, hw_info[1], hw_info[2], hw_info[0]); | 457 | hw_info[1], hw_info[2], hw_info[0]); |
266 | 458 | ||
267 | ret = anysee_read_reg(adap->dev, 0xb0, &io_d); /* IO port D */ | 459 | state->hw = hw_info[0]; |
268 | if (ret) | ||
269 | return ret; | ||
270 | deb_info("%s: IO port D:%02x\n", __func__, io_d); | ||
271 | |||
272 | /* Select demod using trial and error method. */ | ||
273 | |||
274 | /* Try to attach demodulator in following order: | ||
275 | model demod hw firmware | ||
276 | 1. E30 MT352 02 0.2.1 | ||
277 | 2. E30 ZL10353 02 0.2.1 | ||
278 | 3. E30 Combo ZL10353 0f 0.1.2 DVB-T/C combo | ||
279 | 4. E30 Plus ZL10353 06 0.1.0 | ||
280 | 5. E30C Plus TDA10023 0a 0.1.0 rev 0.2 | ||
281 | E30C Plus TDA10023 0f 0.1.2 rev 0.4 | ||
282 | E30 Combo TDA10023 0f 0.1.2 DVB-T/C combo | ||
283 | */ | ||
284 | |||
285 | /* Zarlink MT352 DVB-T demod inside of Samsung DNOS404ZH102A NIM */ | ||
286 | adap->fe = dvb_attach(mt352_attach, &anysee_mt352_config, | ||
287 | &adap->dev->i2c_adap); | ||
288 | if (adap->fe != NULL) { | ||
289 | state->tuner = DVB_PLL_THOMSON_DTT7579; | ||
290 | return 0; | ||
291 | } | ||
292 | 460 | ||
293 | /* Zarlink ZL10353 DVB-T demod inside of Samsung DNOS404ZH103A NIM */ | 461 | switch (state->hw) { |
294 | adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, | 462 | case ANYSEE_HW_02: /* 2 */ |
295 | &adap->dev->i2c_adap); | 463 | /* E30 */ |
296 | if (adap->fe != NULL) { | ||
297 | state->tuner = DVB_PLL_THOMSON_DTT7579; | ||
298 | return 0; | ||
299 | } | ||
300 | 464 | ||
301 | /* for E30 Combo Plus DVB-T demodulator */ | 465 | /* attach demod */ |
302 | if (dvb_usb_anysee_delsys) { | 466 | adap->fe = dvb_attach(mt352_attach, &anysee_mt352_config, |
303 | ret = anysee_write_reg(adap->dev, 0xb0, 0x01); | 467 | &adap->dev->i2c_adap); |
468 | if (adap->fe) | ||
469 | break; | ||
470 | |||
471 | /* attach demod */ | ||
472 | adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, | ||
473 | &adap->dev->i2c_adap); | ||
474 | |||
475 | break; | ||
476 | case ANYSEE_HW_507CD: /* 6 */ | ||
477 | /* E30 Plus */ | ||
478 | |||
479 | /* enable DVB-T demod on IOD[0] */ | ||
480 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01); | ||
304 | if (ret) | 481 | if (ret) |
305 | return ret; | 482 | goto error; |
483 | |||
484 | /* enable transport stream on IOA[7] */ | ||
485 | ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (0 << 7), 0x80); | ||
486 | if (ret) | ||
487 | goto error; | ||
306 | 488 | ||
307 | /* Zarlink ZL10353 DVB-T demod */ | 489 | /* attach demod */ |
308 | adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, | 490 | adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, |
309 | &adap->dev->i2c_adap); | 491 | &adap->dev->i2c_adap); |
310 | if (adap->fe != NULL) { | 492 | |
311 | state->tuner = DVB_PLL_SAMSUNG_DTOS403IH102A; | 493 | break; |
312 | return 0; | 494 | case ANYSEE_HW_507DC: /* 10 */ |
495 | /* E30 C Plus */ | ||
496 | |||
497 | /* enable DVB-C demod on IOD[0] */ | ||
498 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01); | ||
499 | if (ret) | ||
500 | goto error; | ||
501 | |||
502 | /* attach demod */ | ||
503 | adap->fe = dvb_attach(tda10023_attach, &anysee_tda10023_config, | ||
504 | &adap->dev->i2c_adap, 0x48); | ||
505 | |||
506 | break; | ||
507 | case ANYSEE_HW_507SI: /* 11 */ | ||
508 | /* E30 S2 Plus */ | ||
509 | |||
510 | /* enable DVB-S/S2 demod on IOD[0] */ | ||
511 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01); | ||
512 | if (ret) | ||
513 | goto error; | ||
514 | |||
515 | /* attach demod */ | ||
516 | adap->fe = dvb_attach(cx24116_attach, &anysee_cx24116_config, | ||
517 | &adap->dev->i2c_adap); | ||
518 | |||
519 | break; | ||
520 | case ANYSEE_HW_507FA: /* 15 */ | ||
521 | /* E30 Combo Plus */ | ||
522 | /* E30 C Plus */ | ||
523 | |||
524 | /* enable tuner on IOE[4] */ | ||
525 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10); | ||
526 | if (ret) | ||
527 | goto error; | ||
528 | |||
529 | /* probe TDA18212 */ | ||
530 | tmp = 0; | ||
531 | ret = i2c_transfer(&adap->dev->i2c_adap, msg, 2); | ||
532 | if (ret == 2 && tmp == 0xc7) | ||
533 | deb_info("%s: TDA18212 found\n", __func__); | ||
534 | else | ||
535 | tmp = 0; | ||
536 | |||
537 | /* disable tuner on IOE[4] */ | ||
538 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10); | ||
539 | if (ret) | ||
540 | goto error; | ||
541 | |||
542 | if (dvb_usb_anysee_delsys) { | ||
543 | /* disable DVB-C demod on IOD[5] */ | ||
544 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 5), | ||
545 | 0x20); | ||
546 | if (ret) | ||
547 | goto error; | ||
548 | |||
549 | /* enable DVB-T demod on IOD[0] */ | ||
550 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), | ||
551 | 0x01); | ||
552 | if (ret) | ||
553 | goto error; | ||
554 | |||
555 | /* attach demod */ | ||
556 | if (tmp == 0xc7) { | ||
557 | /* TDA18212 config */ | ||
558 | adap->fe = dvb_attach(zl10353_attach, | ||
559 | &anysee_zl10353_tda18212_config2, | ||
560 | &adap->dev->i2c_adap); | ||
561 | } else { | ||
562 | /* PLL config */ | ||
563 | adap->fe = dvb_attach(zl10353_attach, | ||
564 | &anysee_zl10353_config, | ||
565 | &adap->dev->i2c_adap); | ||
566 | } | ||
567 | } else { | ||
568 | /* disable DVB-T demod on IOD[0] */ | ||
569 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 0), | ||
570 | 0x01); | ||
571 | if (ret) | ||
572 | goto error; | ||
573 | |||
574 | /* enable DVB-C demod on IOD[5] */ | ||
575 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 5), | ||
576 | 0x20); | ||
577 | if (ret) | ||
578 | goto error; | ||
579 | |||
580 | /* attach demod */ | ||
581 | if (tmp == 0xc7) { | ||
582 | /* TDA18212 config */ | ||
583 | adap->fe = dvb_attach(tda10023_attach, | ||
584 | &anysee_tda10023_tda18212_config, | ||
585 | &adap->dev->i2c_adap, 0x48); | ||
586 | } else { | ||
587 | /* PLL config */ | ||
588 | adap->fe = dvb_attach(tda10023_attach, | ||
589 | &anysee_tda10023_config, | ||
590 | &adap->dev->i2c_adap, 0x48); | ||
591 | } | ||
313 | } | 592 | } |
314 | } | ||
315 | 593 | ||
316 | /* connect demod on IO port D for TDA10023 & ZL10353 */ | 594 | break; |
317 | ret = anysee_write_reg(adap->dev, 0xb0, 0x25); | 595 | case ANYSEE_HW_508TC: /* 18 */ |
318 | if (ret) | 596 | /* E7 TC */ |
319 | return ret; | ||
320 | 597 | ||
321 | /* Zarlink ZL10353 DVB-T demod inside of Samsung DNOS404ZH103A NIM */ | 598 | /* enable transport stream on IOA[7] */ |
322 | adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, | 599 | ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80); |
323 | &adap->dev->i2c_adap); | 600 | if (ret) |
324 | if (adap->fe != NULL) { | 601 | goto error; |
325 | state->tuner = DVB_PLL_THOMSON_DTT7579; | 602 | |
326 | return 0; | 603 | if (dvb_usb_anysee_delsys) { |
327 | } | 604 | /* disable DVB-C demod on IOD[5] */ |
605 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 5), | ||
606 | 0x20); | ||
607 | if (ret) | ||
608 | goto error; | ||
609 | |||
610 | /* enable DVB-T demod on IOD[6] */ | ||
611 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 6), | ||
612 | 0x40); | ||
613 | if (ret) | ||
614 | goto error; | ||
615 | |||
616 | /* enable IF route on IOE[0] */ | ||
617 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 0), | ||
618 | 0x01); | ||
619 | if (ret) | ||
620 | goto error; | ||
621 | |||
622 | /* attach demod */ | ||
623 | adap->fe = dvb_attach(zl10353_attach, | ||
624 | &anysee_zl10353_tda18212_config, | ||
625 | &adap->dev->i2c_adap); | ||
626 | } else { | ||
627 | /* disable DVB-T demod on IOD[6] */ | ||
628 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 6), | ||
629 | 0x40); | ||
630 | if (ret) | ||
631 | goto error; | ||
632 | |||
633 | /* enable DVB-C demod on IOD[5] */ | ||
634 | ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 5), | ||
635 | 0x20); | ||
636 | if (ret) | ||
637 | goto error; | ||
638 | |||
639 | /* enable IF route on IOE[0] */ | ||
640 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 0), | ||
641 | 0x01); | ||
642 | if (ret) | ||
643 | goto error; | ||
644 | |||
645 | /* attach demod */ | ||
646 | adap->fe = dvb_attach(tda10023_attach, | ||
647 | &anysee_tda10023_tda18212_config, | ||
648 | &adap->dev->i2c_adap, 0x48); | ||
649 | } | ||
328 | 650 | ||
329 | /* IO port E - E30C rev 0.4 board requires this */ | 651 | break; |
330 | ret = anysee_write_reg(adap->dev, 0xb1, 0xa7); | 652 | case ANYSEE_HW_508S2: /* 19 */ |
331 | if (ret) | 653 | /* E7 S2 */ |
332 | return ret; | ||
333 | 654 | ||
334 | /* Philips TDA10023 DVB-C demod */ | 655 | /* enable transport stream on IOA[7] */ |
335 | adap->fe = dvb_attach(tda10023_attach, &anysee_tda10023_config, | 656 | ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80); |
336 | &adap->dev->i2c_adap, 0x48); | 657 | if (ret) |
337 | if (adap->fe != NULL) { | 658 | goto error; |
338 | state->tuner = DVB_PLL_SAMSUNG_DTOS403IH102A; | ||
339 | return 0; | ||
340 | } | ||
341 | 659 | ||
342 | /* return IO port D to init value for safe */ | 660 | /* enable DVB-S/S2 demod on IOE[5] */ |
343 | ret = anysee_write_reg(adap->dev, 0xb0, io_d); | 661 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 5), 0x20); |
344 | if (ret) | 662 | if (ret) |
345 | return ret; | 663 | goto error; |
346 | 664 | ||
347 | err("Unknown Anysee version: %02x %02x %02x. "\ | 665 | /* attach demod */ |
348 | "Please report the <linux-dvb@linuxtv.org>.", | 666 | adap->fe = dvb_attach(stv0900_attach, &anysee_stv0900_config, |
349 | hw_info[0], hw_info[1], hw_info[2]); | 667 | &adap->dev->i2c_adap, 0); |
350 | 668 | ||
351 | return -ENODEV; | 669 | break; |
670 | } | ||
671 | |||
672 | if (!adap->fe) { | ||
673 | /* we have no frontend :-( */ | ||
674 | ret = -ENODEV; | ||
675 | err("Unsupported Anysee version. " \ | ||
676 | "Please report the <linux-media@vger.kernel.org>."); | ||
677 | } | ||
678 | error: | ||
679 | return ret; | ||
352 | } | 680 | } |
353 | 681 | ||
354 | static int anysee_tuner_attach(struct dvb_usb_adapter *adap) | 682 | static int anysee_tuner_attach(struct dvb_usb_adapter *adap) |
355 | { | 683 | { |
356 | struct anysee_state *state = adap->dev->priv; | 684 | struct anysee_state *state = adap->dev->priv; |
357 | deb_info("%s: \n", __func__); | 685 | struct dvb_frontend *fe; |
358 | 686 | int ret; | |
359 | switch (state->tuner) { | 687 | deb_info("%s:\n", __func__); |
360 | case DVB_PLL_THOMSON_DTT7579: | 688 | |
361 | /* Thomson dtt7579 (not sure) PLL inside of: | 689 | switch (state->hw) { |
362 | Samsung DNOS404ZH102A NIM | 690 | case ANYSEE_HW_02: /* 2 */ |
363 | Samsung DNOS404ZH103A NIM */ | 691 | /* E30 */ |
364 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, | 692 | |
365 | NULL, DVB_PLL_THOMSON_DTT7579); | 693 | /* attach tuner */ |
694 | fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc2 >> 1), | ||
695 | NULL, DVB_PLL_THOMSON_DTT7579); | ||
696 | |||
697 | break; | ||
698 | case ANYSEE_HW_507CD: /* 6 */ | ||
699 | /* E30 Plus */ | ||
700 | |||
701 | /* attach tuner */ | ||
702 | fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc2 >> 1), | ||
703 | &adap->dev->i2c_adap, DVB_PLL_THOMSON_DTT7579); | ||
704 | |||
705 | break; | ||
706 | case ANYSEE_HW_507DC: /* 10 */ | ||
707 | /* E30 C Plus */ | ||
708 | |||
709 | /* attach tuner */ | ||
710 | fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc0 >> 1), | ||
711 | &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); | ||
712 | |||
713 | break; | ||
714 | case ANYSEE_HW_507SI: /* 11 */ | ||
715 | /* E30 S2 Plus */ | ||
716 | |||
717 | /* attach LNB controller */ | ||
718 | fe = dvb_attach(isl6423_attach, adap->fe, &adap->dev->i2c_adap, | ||
719 | &anysee_isl6423_config); | ||
720 | |||
721 | break; | ||
722 | case ANYSEE_HW_507FA: /* 15 */ | ||
723 | /* E30 Combo Plus */ | ||
724 | /* E30 C Plus */ | ||
725 | |||
726 | if (dvb_usb_anysee_delsys) { | ||
727 | /* enable DVB-T tuner on IOE[0] */ | ||
728 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 0), | ||
729 | 0x01); | ||
730 | if (ret) | ||
731 | goto error; | ||
732 | } else { | ||
733 | /* enable DVB-C tuner on IOE[0] */ | ||
734 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 0), | ||
735 | 0x01); | ||
736 | if (ret) | ||
737 | goto error; | ||
738 | } | ||
739 | |||
740 | /* Try first attach TDA18212 silicon tuner on IOE[4], if that | ||
741 | * fails attach old simple PLL. */ | ||
742 | |||
743 | /* enable tuner on IOE[4] */ | ||
744 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10); | ||
745 | if (ret) | ||
746 | goto error; | ||
747 | |||
748 | /* attach tuner */ | ||
749 | fe = dvb_attach(tda18212_attach, adap->fe, &adap->dev->i2c_adap, | ||
750 | &anysee_tda18212_config); | ||
751 | if (fe) | ||
752 | break; | ||
753 | |||
754 | /* disable tuner on IOE[4] */ | ||
755 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10); | ||
756 | if (ret) | ||
757 | goto error; | ||
758 | |||
759 | /* attach tuner */ | ||
760 | fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc0 >> 1), | ||
761 | &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); | ||
762 | |||
763 | break; | ||
764 | case ANYSEE_HW_508TC: /* 18 */ | ||
765 | /* E7 TC */ | ||
766 | |||
767 | /* enable tuner on IOE[4] */ | ||
768 | ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10); | ||
769 | if (ret) | ||
770 | goto error; | ||
771 | |||
772 | /* attach tuner */ | ||
773 | fe = dvb_attach(tda18212_attach, adap->fe, &adap->dev->i2c_adap, | ||
774 | &anysee_tda18212_config); | ||
775 | |||
366 | break; | 776 | break; |
367 | case DVB_PLL_SAMSUNG_DTOS403IH102A: | 777 | case ANYSEE_HW_508S2: /* 19 */ |
368 | /* Unknown PLL inside of Samsung DTOS403IH102A tuner module */ | 778 | /* E7 S2 */ |
369 | dvb_attach(dvb_pll_attach, adap->fe, 0xc0, | 779 | |
370 | &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); | 780 | /* attach tuner */ |
781 | fe = dvb_attach(stv6110_attach, adap->fe, | ||
782 | &anysee_stv6110_config, &adap->dev->i2c_adap); | ||
783 | |||
784 | if (fe) { | ||
785 | /* attach LNB controller */ | ||
786 | fe = dvb_attach(isl6423_attach, adap->fe, | ||
787 | &adap->dev->i2c_adap, &anysee_isl6423_config); | ||
788 | } | ||
789 | |||
371 | break; | 790 | break; |
791 | default: | ||
792 | fe = NULL; | ||
372 | } | 793 | } |
373 | 794 | ||
374 | return 0; | 795 | if (fe) |
796 | ret = 0; | ||
797 | else | ||
798 | ret = -ENODEV; | ||
799 | |||
800 | error: | ||
801 | return ret; | ||
375 | } | 802 | } |
376 | 803 | ||
377 | static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 804 | static int anysee_rc_query(struct dvb_usb_device *d) |
378 | { | 805 | { |
379 | u8 buf[] = {CMD_GET_IR_CODE}; | 806 | u8 buf[] = {CMD_GET_IR_CODE}; |
380 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | ||
381 | u8 ircode[2]; | 807 | u8 ircode[2]; |
382 | int i, ret; | 808 | int ret; |
383 | 809 | ||
384 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), &ircode[0], 2); | 810 | /* Remote controller is basic NEC using address byte 0x08. |
811 | Anysee device RC query returns only two bytes, status and code, | ||
812 | address byte is dropped. Also it does not return any value for | ||
813 | NEC RCs having address byte other than 0x08. Due to that, we | ||
814 | cannot use that device as standard NEC receiver. | ||
815 | It could be possible make hack which reads whole code directly | ||
816 | from device memory... */ | ||
817 | |||
818 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), ircode, sizeof(ircode)); | ||
385 | if (ret) | 819 | if (ret) |
386 | return ret; | 820 | return ret; |
387 | 821 | ||
388 | *event = 0; | 822 | if (ircode[0]) { |
389 | *state = REMOTE_NO_KEY_PRESSED; | 823 | deb_rc("%s: key pressed %02x\n", __func__, ircode[1]); |
390 | 824 | rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0); | |
391 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | ||
392 | if (rc5_custom(&keymap[i]) == ircode[0] && | ||
393 | rc5_data(&keymap[i]) == ircode[1]) { | ||
394 | *event = keymap[i].keycode; | ||
395 | *state = REMOTE_KEY_PRESSED; | ||
396 | return 0; | ||
397 | } | ||
398 | } | 825 | } |
826 | |||
399 | return 0; | 827 | return 0; |
400 | } | 828 | } |
401 | 829 | ||
402 | static struct ir_scancode ir_codes_anysee_table[] = { | ||
403 | { 0x0100, KEY_0 }, | ||
404 | { 0x0101, KEY_1 }, | ||
405 | { 0x0102, KEY_2 }, | ||
406 | { 0x0103, KEY_3 }, | ||
407 | { 0x0104, KEY_4 }, | ||
408 | { 0x0105, KEY_5 }, | ||
409 | { 0x0106, KEY_6 }, | ||
410 | { 0x0107, KEY_7 }, | ||
411 | { 0x0108, KEY_8 }, | ||
412 | { 0x0109, KEY_9 }, | ||
413 | { 0x010a, KEY_POWER }, | ||
414 | { 0x010b, KEY_DOCUMENTS }, /* * */ | ||
415 | { 0x0119, KEY_FAVORITES }, | ||
416 | { 0x0120, KEY_SLEEP }, | ||
417 | { 0x0121, KEY_MODE }, /* 4:3 / 16:9 select */ | ||
418 | { 0x0122, KEY_ZOOM }, | ||
419 | { 0x0147, KEY_TEXT }, | ||
420 | { 0x0116, KEY_TV }, /* TV / radio select */ | ||
421 | { 0x011e, KEY_LANGUAGE }, /* Second Audio Program */ | ||
422 | { 0x011a, KEY_SUBTITLE }, | ||
423 | { 0x011b, KEY_CAMERA }, /* screenshot */ | ||
424 | { 0x0142, KEY_MUTE }, | ||
425 | { 0x010e, KEY_MENU }, | ||
426 | { 0x010f, KEY_EPG }, | ||
427 | { 0x0117, KEY_INFO }, | ||
428 | { 0x0110, KEY_EXIT }, | ||
429 | { 0x0113, KEY_VOLUMEUP }, | ||
430 | { 0x0112, KEY_VOLUMEDOWN }, | ||
431 | { 0x0111, KEY_CHANNELUP }, | ||
432 | { 0x0114, KEY_CHANNELDOWN }, | ||
433 | { 0x0115, KEY_OK }, | ||
434 | { 0x011d, KEY_RED }, | ||
435 | { 0x011f, KEY_GREEN }, | ||
436 | { 0x011c, KEY_YELLOW }, | ||
437 | { 0x0144, KEY_BLUE }, | ||
438 | { 0x010c, KEY_SHUFFLE }, /* snapshot */ | ||
439 | { 0x0148, KEY_STOP }, | ||
440 | { 0x0150, KEY_PLAY }, | ||
441 | { 0x0151, KEY_PAUSE }, | ||
442 | { 0x0149, KEY_RECORD }, | ||
443 | { 0x0118, KEY_PREVIOUS }, /* |<< */ | ||
444 | { 0x010d, KEY_NEXT }, /* >>| */ | ||
445 | { 0x0124, KEY_PROG1 }, /* F1 */ | ||
446 | { 0x0125, KEY_PROG2 }, /* F2 */ | ||
447 | }; | ||
448 | |||
449 | /* DVB USB Driver stuff */ | 830 | /* DVB USB Driver stuff */ |
450 | static struct dvb_usb_device_properties anysee_properties; | 831 | static struct dvb_usb_device_properties anysee_properties; |
451 | 832 | ||
@@ -520,11 +901,12 @@ static struct dvb_usb_device_properties anysee_properties = { | |||
520 | } | 901 | } |
521 | }, | 902 | }, |
522 | 903 | ||
523 | .rc.legacy = { | 904 | .rc.core = { |
524 | .rc_key_map = ir_codes_anysee_table, | 905 | .rc_codes = RC_MAP_ANYSEE, |
525 | .rc_key_map_size = ARRAY_SIZE(ir_codes_anysee_table), | 906 | .protocol = RC_TYPE_OTHER, |
907 | .module_name = "anysee", | ||
526 | .rc_query = anysee_rc_query, | 908 | .rc_query = anysee_rc_query, |
527 | .rc_interval = 200, /* windows driver uses 500ms */ | 909 | .rc_interval = 250, /* windows driver uses 500ms */ |
528 | }, | 910 | }, |
529 | 911 | ||
530 | .i2c_algo = &anysee_i2c_algo, | 912 | .i2c_algo = &anysee_i2c_algo, |
diff --git a/drivers/media/dvb/dvb-usb/anysee.h b/drivers/media/dvb/dvb-usb/anysee.h index 7ca01ff6e13c..a7673aa1e007 100644 --- a/drivers/media/dvb/dvb-usb/anysee.h +++ b/drivers/media/dvb/dvb-usb/anysee.h | |||
@@ -57,10 +57,29 @@ enum cmd { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct anysee_state { | 59 | struct anysee_state { |
60 | u8 tuner; | 60 | u8 hw; /* PCB ID */ |
61 | u8 seq; | 61 | u8 seq; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #define ANYSEE_HW_02 2 /* E30 */ | ||
65 | #define ANYSEE_HW_507CD 6 /* E30 Plus */ | ||
66 | #define ANYSEE_HW_507DC 10 /* E30 C Plus */ | ||
67 | #define ANYSEE_HW_507SI 11 /* E30 S2 Plus */ | ||
68 | #define ANYSEE_HW_507FA 15 /* E30 Combo Plus / E30 C Plus */ | ||
69 | #define ANYSEE_HW_508TC 18 /* E7 TC */ | ||
70 | #define ANYSEE_HW_508S2 19 /* E7 S2 */ | ||
71 | |||
72 | #define REG_IOA 0x80 /* Port A (bit addressable) */ | ||
73 | #define REG_IOB 0x90 /* Port B (bit addressable) */ | ||
74 | #define REG_IOC 0xa0 /* Port C (bit addressable) */ | ||
75 | #define REG_IOD 0xb0 /* Port D (bit addressable) */ | ||
76 | #define REG_IOE 0xb1 /* Port E (NOT bit addressable) */ | ||
77 | #define REG_OEA 0xb2 /* Port A Output Enable */ | ||
78 | #define REG_OEB 0xb3 /* Port B Output Enable */ | ||
79 | #define REG_OEC 0xb4 /* Port C Output Enable */ | ||
80 | #define REG_OED 0xb5 /* Port D Output Enable */ | ||
81 | #define REG_OEE 0xb6 /* Port E Output Enable */ | ||
82 | |||
64 | #endif | 83 | #endif |
65 | 84 | ||
66 | /*************************************************************************** | 85 | /*************************************************************************** |
@@ -136,7 +155,7 @@ General reply packet(s) are always used if not own reply defined. | |||
136 | ---------------------------------------------------------------------------- | 155 | ---------------------------------------------------------------------------- |
137 | | 04 | 0x00 | 156 | | 04 | 0x00 |
138 | ---------------------------------------------------------------------------- | 157 | ---------------------------------------------------------------------------- |
139 | | 05 | 0x01 | 158 | | 05 | data length |
140 | ---------------------------------------------------------------------------- | 159 | ---------------------------------------------------------------------------- |
141 | | 06-59 | don't care | 160 | | 06-59 | don't care |
142 | ---------------------------------------------------------------------------- | 161 | ---------------------------------------------------------------------------- |
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c index eb34cc3894e0..2351077ff2b3 100644 --- a/drivers/media/dvb/dvb-usb/au6610.c +++ b/drivers/media/dvb/dvb-usb/au6610.c | |||
@@ -33,8 +33,16 @@ static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, | |||
33 | { | 33 | { |
34 | int ret; | 34 | int ret; |
35 | u16 index; | 35 | u16 index; |
36 | u8 usb_buf[6]; /* enough for all known requests, | 36 | u8 *usb_buf; |
37 | read returns 5 and write 6 bytes */ | 37 | |
38 | /* | ||
39 | * allocate enough for all known requests, | ||
40 | * read returns 5 and write 6 bytes | ||
41 | */ | ||
42 | usb_buf = kmalloc(6, GFP_KERNEL); | ||
43 | if (!usb_buf) | ||
44 | return -ENOMEM; | ||
45 | |||
38 | switch (wlen) { | 46 | switch (wlen) { |
39 | case 1: | 47 | case 1: |
40 | index = wbuf[0] << 8; | 48 | index = wbuf[0] << 8; |
@@ -45,14 +53,15 @@ static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, | |||
45 | break; | 53 | break; |
46 | default: | 54 | default: |
47 | warn("wlen = %x, aborting.", wlen); | 55 | warn("wlen = %x, aborting.", wlen); |
48 | return -EINVAL; | 56 | ret = -EINVAL; |
57 | goto error; | ||
49 | } | 58 | } |
50 | 59 | ||
51 | ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), operation, | 60 | ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), operation, |
52 | USB_TYPE_VENDOR|USB_DIR_IN, addr << 1, index, | 61 | USB_TYPE_VENDOR|USB_DIR_IN, addr << 1, index, |
53 | usb_buf, sizeof(usb_buf), AU6610_USB_TIMEOUT); | 62 | usb_buf, 6, AU6610_USB_TIMEOUT); |
54 | if (ret < 0) | 63 | if (ret < 0) |
55 | return ret; | 64 | goto error; |
56 | 65 | ||
57 | switch (operation) { | 66 | switch (operation) { |
58 | case AU6610_REQ_I2C_READ: | 67 | case AU6610_REQ_I2C_READ: |
@@ -60,7 +69,8 @@ static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, | |||
60 | /* requested value is always 5th byte in buffer */ | 69 | /* requested value is always 5th byte in buffer */ |
61 | rbuf[0] = usb_buf[4]; | 70 | rbuf[0] = usb_buf[4]; |
62 | } | 71 | } |
63 | 72 | error: | |
73 | kfree(usb_buf); | ||
64 | return ret; | 74 | return ret; |
65 | } | 75 | } |
66 | 76 | ||
diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 62c58288469f..57e2444d51ab 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c | |||
@@ -386,7 +386,7 @@ static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
386 | } | 386 | } |
387 | 387 | ||
388 | /* keys for the enclosed remote control */ | 388 | /* keys for the enclosed remote control */ |
389 | static struct ir_scancode ir_codes_az6027_table[] = { | 389 | static struct rc_map_table rc_map_az6027_table[] = { |
390 | { 0x01, KEY_1 }, | 390 | { 0x01, KEY_1 }, |
391 | { 0x02, KEY_2 }, | 391 | { 0x02, KEY_2 }, |
392 | }; | 392 | }; |
@@ -1089,6 +1089,7 @@ static struct usb_device_id az6027_usb_table[] = { | |||
1089 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V2) }, | 1089 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V2) }, |
1090 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, | 1090 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, |
1091 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, | 1091 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, |
1092 | { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) }, | ||
1092 | { }, | 1093 | { }, |
1093 | }; | 1094 | }; |
1094 | 1095 | ||
@@ -1126,15 +1127,15 @@ static struct dvb_usb_device_properties az6027_properties = { | |||
1126 | .read_mac_address = az6027_read_mac_addr, | 1127 | .read_mac_address = az6027_read_mac_addr, |
1127 | */ | 1128 | */ |
1128 | .rc.legacy = { | 1129 | .rc.legacy = { |
1129 | .rc_key_map = ir_codes_az6027_table, | 1130 | .rc_map_table = rc_map_az6027_table, |
1130 | .rc_key_map_size = ARRAY_SIZE(ir_codes_az6027_table), | 1131 | .rc_map_size = ARRAY_SIZE(rc_map_az6027_table), |
1131 | .rc_interval = 400, | 1132 | .rc_interval = 400, |
1132 | .rc_query = az6027_rc_query, | 1133 | .rc_query = az6027_rc_query, |
1133 | }, | 1134 | }, |
1134 | 1135 | ||
1135 | .i2c_algo = &az6027_i2c_algo, | 1136 | .i2c_algo = &az6027_i2c_algo, |
1136 | 1137 | ||
1137 | .num_device_descs = 5, | 1138 | .num_device_descs = 6, |
1138 | .devices = { | 1139 | .devices = { |
1139 | { | 1140 | { |
1140 | .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)", | 1141 | .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)", |
@@ -1156,6 +1157,10 @@ static struct dvb_usb_device_properties az6027_properties = { | |||
1156 | .name = "Technisat SkyStar USB 2 HD CI", | 1157 | .name = "Technisat SkyStar USB 2 HD CI", |
1157 | .cold_ids = { &az6027_usb_table[4], NULL }, | 1158 | .cold_ids = { &az6027_usb_table[4], NULL }, |
1158 | .warm_ids = { NULL }, | 1159 | .warm_ids = { NULL }, |
1160 | }, { | ||
1161 | .name = "Elgato EyeTV Sat", | ||
1162 | .cold_ids = { &az6027_usb_table[5], NULL }, | ||
1163 | .warm_ids = { NULL }, | ||
1159 | }, | 1164 | }, |
1160 | { NULL }, | 1165 | { NULL }, |
1161 | } | 1166 | } |
diff --git a/drivers/media/dvb/dvb-usb/ce6230.c b/drivers/media/dvb/dvb-usb/ce6230.c index 3df2045b7d2d..6d1a3041540d 100644 --- a/drivers/media/dvb/dvb-usb/ce6230.c +++ b/drivers/media/dvb/dvb-usb/ce6230.c | |||
@@ -39,7 +39,7 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req) | |||
39 | u8 requesttype; | 39 | u8 requesttype; |
40 | u16 value; | 40 | u16 value; |
41 | u16 index; | 41 | u16 index; |
42 | u8 buf[req->data_len]; | 42 | u8 *buf; |
43 | 43 | ||
44 | request = req->cmd; | 44 | request = req->cmd; |
45 | value = req->value; | 45 | value = req->value; |
@@ -62,6 +62,12 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req) | |||
62 | goto error; | 62 | goto error; |
63 | } | 63 | } |
64 | 64 | ||
65 | buf = kmalloc(req->data_len, GFP_KERNEL); | ||
66 | if (!buf) { | ||
67 | ret = -ENOMEM; | ||
68 | goto error; | ||
69 | } | ||
70 | |||
65 | if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) { | 71 | if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) { |
66 | /* write */ | 72 | /* write */ |
67 | memcpy(buf, req->data, req->data_len); | 73 | memcpy(buf, req->data, req->data_len); |
@@ -74,7 +80,7 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req) | |||
74 | msleep(1); /* avoid I2C errors */ | 80 | msleep(1); /* avoid I2C errors */ |
75 | 81 | ||
76 | ret = usb_control_msg(udev, pipe, request, requesttype, value, index, | 82 | ret = usb_control_msg(udev, pipe, request, requesttype, value, index, |
77 | buf, sizeof(buf), CE6230_USB_TIMEOUT); | 83 | buf, req->data_len, CE6230_USB_TIMEOUT); |
78 | 84 | ||
79 | ce6230_debug_dump(request, requesttype, value, index, buf, | 85 | ce6230_debug_dump(request, requesttype, value, index, buf, |
80 | req->data_len, deb_xfer); | 86 | req->data_len, deb_xfer); |
@@ -88,6 +94,7 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req) | |||
88 | if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN)) | 94 | if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN)) |
89 | memcpy(req->data, buf, req->data_len); | 95 | memcpy(req->data, buf, req->data_len); |
90 | 96 | ||
97 | kfree(buf); | ||
91 | error: | 98 | error: |
92 | return ret; | 99 | return ret; |
93 | } | 100 | } |
diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c index 4f5aa83fc1fc..16f2ce2bc15a 100644 --- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c | |||
@@ -84,7 +84,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) | |||
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | 86 | ||
87 | static struct ir_scancode ir_codes_cinergyt2_table[] = { | 87 | static struct rc_map_table rc_map_cinergyt2_table[] = { |
88 | { 0x0401, KEY_POWER }, | 88 | { 0x0401, KEY_POWER }, |
89 | { 0x0402, KEY_1 }, | 89 | { 0x0402, KEY_1 }, |
90 | { 0x0403, KEY_2 }, | 90 | { 0x0403, KEY_2 }, |
@@ -219,8 +219,8 @@ static struct dvb_usb_device_properties cinergyt2_properties = { | |||
219 | 219 | ||
220 | .rc.legacy = { | 220 | .rc.legacy = { |
221 | .rc_interval = 50, | 221 | .rc_interval = 50, |
222 | .rc_key_map = ir_codes_cinergyt2_table, | 222 | .rc_map_table = rc_map_cinergyt2_table, |
223 | .rc_key_map_size = ARRAY_SIZE(ir_codes_cinergyt2_table), | 223 | .rc_map_size = ARRAY_SIZE(rc_map_cinergyt2_table), |
224 | .rc_query = cinergyt2_rc_query, | 224 | .rc_query = cinergyt2_rc_query, |
225 | }, | 225 | }, |
226 | 226 | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index cd9f362c37b2..acb5fb2d2e73 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -385,7 +385,7 @@ static int cxusb_d680_dmb_streaming_ctrl( | |||
385 | 385 | ||
386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
387 | { | 387 | { |
388 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 388 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
389 | u8 ircode[4]; | 389 | u8 ircode[4]; |
390 | int i; | 390 | int i; |
391 | 391 | ||
@@ -394,7 +394,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
394 | *event = 0; | 394 | *event = 0; |
395 | *state = REMOTE_NO_KEY_PRESSED; | 395 | *state = REMOTE_NO_KEY_PRESSED; |
396 | 396 | ||
397 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | 397 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
398 | if (rc5_custom(&keymap[i]) == ircode[2] && | 398 | if (rc5_custom(&keymap[i]) == ircode[2] && |
399 | rc5_data(&keymap[i]) == ircode[3]) { | 399 | rc5_data(&keymap[i]) == ircode[3]) { |
400 | *event = keymap[i].keycode; | 400 | *event = keymap[i].keycode; |
@@ -410,7 +410,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | 410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, |
411 | int *state) | 411 | int *state) |
412 | { | 412 | { |
413 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 413 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
414 | u8 ircode[4]; | 414 | u8 ircode[4]; |
415 | int i; | 415 | int i; |
416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, | 416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
@@ -422,7 +422,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) | 422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) |
423 | return 0; | 423 | return 0; |
424 | 424 | ||
425 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | 425 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
426 | if (rc5_custom(&keymap[i]) == ircode[1] && | 426 | if (rc5_custom(&keymap[i]) == ircode[1] && |
427 | rc5_data(&keymap[i]) == ircode[2]) { | 427 | rc5_data(&keymap[i]) == ircode[2]) { |
428 | *event = keymap[i].keycode; | 428 | *event = keymap[i].keycode; |
@@ -438,7 +438,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | 438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, |
439 | int *state) | 439 | int *state) |
440 | { | 440 | { |
441 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 441 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
442 | u8 ircode[2]; | 442 | u8 ircode[2]; |
443 | int i; | 443 | int i; |
444 | 444 | ||
@@ -448,7 +448,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | |||
448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) | 448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) |
449 | return 0; | 449 | return 0; |
450 | 450 | ||
451 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | 451 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
452 | if (rc5_custom(&keymap[i]) == ircode[0] && | 452 | if (rc5_custom(&keymap[i]) == ircode[0] && |
453 | rc5_data(&keymap[i]) == ircode[1]) { | 453 | rc5_data(&keymap[i]) == ircode[1]) { |
454 | *event = keymap[i].keycode; | 454 | *event = keymap[i].keycode; |
@@ -461,7 +461,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | |||
461 | return 0; | 461 | return 0; |
462 | } | 462 | } |
463 | 463 | ||
464 | static struct ir_scancode ir_codes_dvico_mce_table[] = { | 464 | static struct rc_map_table rc_map_dvico_mce_table[] = { |
465 | { 0xfe02, KEY_TV }, | 465 | { 0xfe02, KEY_TV }, |
466 | { 0xfe0e, KEY_MP3 }, | 466 | { 0xfe0e, KEY_MP3 }, |
467 | { 0xfe1a, KEY_DVD }, | 467 | { 0xfe1a, KEY_DVD }, |
@@ -509,7 +509,7 @@ static struct ir_scancode ir_codes_dvico_mce_table[] = { | |||
509 | { 0xfe4e, KEY_POWER }, | 509 | { 0xfe4e, KEY_POWER }, |
510 | }; | 510 | }; |
511 | 511 | ||
512 | static struct ir_scancode ir_codes_dvico_portable_table[] = { | 512 | static struct rc_map_table rc_map_dvico_portable_table[] = { |
513 | { 0xfc02, KEY_SETUP }, /* Profile */ | 513 | { 0xfc02, KEY_SETUP }, /* Profile */ |
514 | { 0xfc43, KEY_POWER2 }, | 514 | { 0xfc43, KEY_POWER2 }, |
515 | { 0xfc06, KEY_EPG }, | 515 | { 0xfc06, KEY_EPG }, |
@@ -548,7 +548,7 @@ static struct ir_scancode ir_codes_dvico_portable_table[] = { | |||
548 | { 0xfc00, KEY_UNKNOWN }, /* HD */ | 548 | { 0xfc00, KEY_UNKNOWN }, /* HD */ |
549 | }; | 549 | }; |
550 | 550 | ||
551 | static struct ir_scancode ir_codes_d680_dmb_table[] = { | 551 | static struct rc_map_table rc_map_d680_dmb_table[] = { |
552 | { 0x0038, KEY_UNKNOWN }, /* TV/AV */ | 552 | { 0x0038, KEY_UNKNOWN }, /* TV/AV */ |
553 | { 0x080c, KEY_ZOOM }, | 553 | { 0x080c, KEY_ZOOM }, |
554 | { 0x0800, KEY_0 }, | 554 | { 0x0800, KEY_0 }, |
@@ -923,7 +923,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
923 | return -EIO; | 923 | return -EIO; |
924 | 924 | ||
925 | /* try to determine if there is no IR decoder on the I2C bus */ | 925 | /* try to determine if there is no IR decoder on the I2C bus */ |
926 | for (i = 0; adap->dev->props.rc.legacy.rc_key_map != NULL && i < 5; i++) { | 926 | for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) { |
927 | msleep(20); | 927 | msleep(20); |
928 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) | 928 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) |
929 | goto no_IR; | 929 | goto no_IR; |
@@ -931,7 +931,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
931 | continue; | 931 | continue; |
932 | if (ircode[2] + ircode[3] != 0xff) { | 932 | if (ircode[2] + ircode[3] != 0xff) { |
933 | no_IR: | 933 | no_IR: |
934 | adap->dev->props.rc.legacy.rc_key_map = NULL; | 934 | adap->dev->props.rc.legacy.rc_map_table = NULL; |
935 | info("No IR receiver detected on this device."); | 935 | info("No IR receiver detected on this device."); |
936 | break; | 936 | break; |
937 | } | 937 | } |
@@ -1453,8 +1453,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { | |||
1453 | 1453 | ||
1454 | .rc.legacy = { | 1454 | .rc.legacy = { |
1455 | .rc_interval = 100, | 1455 | .rc_interval = 100, |
1456 | .rc_key_map = ir_codes_dvico_portable_table, | 1456 | .rc_map_table = rc_map_dvico_portable_table, |
1457 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1457 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
1458 | .rc_query = cxusb_rc_query, | 1458 | .rc_query = cxusb_rc_query, |
1459 | }, | 1459 | }, |
1460 | 1460 | ||
@@ -1506,8 +1506,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { | |||
1506 | 1506 | ||
1507 | .rc.legacy = { | 1507 | .rc.legacy = { |
1508 | .rc_interval = 150, | 1508 | .rc_interval = 150, |
1509 | .rc_key_map = ir_codes_dvico_mce_table, | 1509 | .rc_map_table = rc_map_dvico_mce_table, |
1510 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1510 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), |
1511 | .rc_query = cxusb_rc_query, | 1511 | .rc_query = cxusb_rc_query, |
1512 | }, | 1512 | }, |
1513 | 1513 | ||
@@ -1567,8 +1567,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { | |||
1567 | 1567 | ||
1568 | .rc.legacy = { | 1568 | .rc.legacy = { |
1569 | .rc_interval = 100, | 1569 | .rc_interval = 100, |
1570 | .rc_key_map = ir_codes_dvico_portable_table, | 1570 | .rc_map_table = rc_map_dvico_portable_table, |
1571 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1571 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
1572 | .rc_query = cxusb_rc_query, | 1572 | .rc_query = cxusb_rc_query, |
1573 | }, | 1573 | }, |
1574 | 1574 | ||
@@ -1619,8 +1619,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { | |||
1619 | 1619 | ||
1620 | .rc.legacy = { | 1620 | .rc.legacy = { |
1621 | .rc_interval = 100, | 1621 | .rc_interval = 100, |
1622 | .rc_key_map = ir_codes_dvico_portable_table, | 1622 | .rc_map_table = rc_map_dvico_portable_table, |
1623 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1623 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
1624 | .rc_query = cxusb_rc_query, | 1624 | .rc_query = cxusb_rc_query, |
1625 | }, | 1625 | }, |
1626 | 1626 | ||
@@ -1670,8 +1670,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { | |||
1670 | 1670 | ||
1671 | .rc.legacy = { | 1671 | .rc.legacy = { |
1672 | .rc_interval = 100, | 1672 | .rc_interval = 100, |
1673 | .rc_key_map = ir_codes_dvico_mce_table, | 1673 | .rc_map_table = rc_map_dvico_mce_table, |
1674 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1674 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), |
1675 | .rc_query = cxusb_bluebird2_rc_query, | 1675 | .rc_query = cxusb_bluebird2_rc_query, |
1676 | }, | 1676 | }, |
1677 | 1677 | ||
@@ -1720,8 +1720,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { | |||
1720 | 1720 | ||
1721 | .rc.legacy = { | 1721 | .rc.legacy = { |
1722 | .rc_interval = 100, | 1722 | .rc_interval = 100, |
1723 | .rc_key_map = ir_codes_dvico_portable_table, | 1723 | .rc_map_table = rc_map_dvico_portable_table, |
1724 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1724 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
1725 | .rc_query = cxusb_bluebird2_rc_query, | 1725 | .rc_query = cxusb_bluebird2_rc_query, |
1726 | }, | 1726 | }, |
1727 | 1727 | ||
@@ -1772,8 +1772,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope | |||
1772 | 1772 | ||
1773 | .rc.legacy = { | 1773 | .rc.legacy = { |
1774 | .rc_interval = 100, | 1774 | .rc_interval = 100, |
1775 | .rc_key_map = ir_codes_dvico_portable_table, | 1775 | .rc_map_table = rc_map_dvico_portable_table, |
1776 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1776 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
1777 | .rc_query = cxusb_rc_query, | 1777 | .rc_query = cxusb_rc_query, |
1778 | }, | 1778 | }, |
1779 | 1779 | ||
@@ -1865,8 +1865,8 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { | |||
1865 | 1865 | ||
1866 | .rc.legacy = { | 1866 | .rc.legacy = { |
1867 | .rc_interval = 100, | 1867 | .rc_interval = 100, |
1868 | .rc_key_map = ir_codes_dvico_mce_table, | 1868 | .rc_map_table = rc_map_dvico_mce_table, |
1869 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1869 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), |
1870 | .rc_query = cxusb_rc_query, | 1870 | .rc_query = cxusb_rc_query, |
1871 | }, | 1871 | }, |
1872 | 1872 | ||
@@ -1915,8 +1915,8 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { | |||
1915 | 1915 | ||
1916 | .rc.legacy = { | 1916 | .rc.legacy = { |
1917 | .rc_interval = 100, | 1917 | .rc_interval = 100, |
1918 | .rc_key_map = ir_codes_d680_dmb_table, | 1918 | .rc_map_table = rc_map_d680_dmb_table, |
1919 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), | 1919 | .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table), |
1920 | .rc_query = cxusb_d680_dmb_rc_query, | 1920 | .rc_query = cxusb_d680_dmb_rc_query, |
1921 | }, | 1921 | }, |
1922 | 1922 | ||
@@ -1966,8 +1966,8 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { | |||
1966 | 1966 | ||
1967 | .rc.legacy = { | 1967 | .rc.legacy = { |
1968 | .rc_interval = 100, | 1968 | .rc_interval = 100, |
1969 | .rc_key_map = ir_codes_d680_dmb_table, | 1969 | .rc_map_table = rc_map_d680_dmb_table, |
1970 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), | 1970 | .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table), |
1971 | .rc_query = cxusb_d680_dmb_rc_query, | 1971 | .rc_query = cxusb_d680_dmb_rc_query, |
1972 | }, | 1972 | }, |
1973 | 1973 | ||
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index c2c9d236ec7e..9bd6d51b3b93 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h | |||
@@ -32,6 +32,7 @@ extern int dvb_usb_dib0700_debug; | |||
32 | // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog) | 32 | // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog) |
33 | // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1) | 33 | // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1) |
34 | // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " ) | 34 | // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " ) |
35 | #define REQUEST_SET_I2C_PARAM 0x10 | ||
35 | #define REQUEST_SET_RC 0x11 | 36 | #define REQUEST_SET_RC 0x11 |
36 | #define REQUEST_NEW_I2C_READ 0x12 | 37 | #define REQUEST_NEW_I2C_READ 0x12 |
37 | #define REQUEST_NEW_I2C_WRITE 0x13 | 38 | #define REQUEST_NEW_I2C_WRITE 0x13 |
@@ -45,8 +46,9 @@ struct dib0700_state { | |||
45 | u8 is_dib7000pc; | 46 | u8 is_dib7000pc; |
46 | u8 fw_use_new_i2c_api; | 47 | u8 fw_use_new_i2c_api; |
47 | u8 disable_streaming_master_mode; | 48 | u8 disable_streaming_master_mode; |
48 | u32 fw_version; | 49 | u32 fw_version; |
49 | u32 nb_packet_buffer_size; | 50 | u32 nb_packet_buffer_size; |
51 | u8 buf[255]; | ||
50 | }; | 52 | }; |
51 | 53 | ||
52 | extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, | 54 | extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, |
@@ -60,7 +62,8 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); | |||
60 | extern struct i2c_algorithm dib0700_i2c_algo; | 62 | extern struct i2c_algorithm dib0700_i2c_algo; |
61 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, | 63 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, |
62 | struct dvb_usb_device_description **desc, int *cold); | 64 | struct dvb_usb_device_description **desc, int *cold); |
63 | extern int dib0700_change_protocol(void *priv, u64 ir_type); | 65 | extern int dib0700_change_protocol(struct rc_dev *dev, u64 rc_type); |
66 | extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); | ||
64 | 67 | ||
65 | extern int dib0700_device_count; | 68 | extern int dib0700_device_count; |
66 | extern int dvb_usb_dib0700_ir_proto; | 69 | extern int dvb_usb_dib0700_ir_proto; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 48397f103d32..5eb91b4f8fd0 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
@@ -27,19 +27,25 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
27 | int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, | 27 | int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, |
28 | u32 *romversion, u32 *ramversion, u32 *fwtype) | 28 | u32 *romversion, u32 *ramversion, u32 *fwtype) |
29 | { | 29 | { |
30 | u8 b[16]; | 30 | struct dib0700_state *st = d->priv; |
31 | int ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), | 31 | int ret; |
32 | |||
33 | ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), | ||
32 | REQUEST_GET_VERSION, | 34 | REQUEST_GET_VERSION, |
33 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | 35 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
34 | b, sizeof(b), USB_CTRL_GET_TIMEOUT); | 36 | st->buf, 16, USB_CTRL_GET_TIMEOUT); |
35 | if (hwversion != NULL) | 37 | if (hwversion != NULL) |
36 | *hwversion = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; | 38 | *hwversion = (st->buf[0] << 24) | (st->buf[1] << 16) | |
39 | (st->buf[2] << 8) | st->buf[3]; | ||
37 | if (romversion != NULL) | 40 | if (romversion != NULL) |
38 | *romversion = (b[4] << 24) | (b[5] << 16) | (b[6] << 8) | b[7]; | 41 | *romversion = (st->buf[4] << 24) | (st->buf[5] << 16) | |
42 | (st->buf[6] << 8) | st->buf[7]; | ||
39 | if (ramversion != NULL) | 43 | if (ramversion != NULL) |
40 | *ramversion = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11]; | 44 | *ramversion = (st->buf[8] << 24) | (st->buf[9] << 16) | |
45 | (st->buf[10] << 8) | st->buf[11]; | ||
41 | if (fwtype != NULL) | 46 | if (fwtype != NULL) |
42 | *fwtype = (b[12] << 24) | (b[13] << 16) | (b[14] << 8) | b[15]; | 47 | *fwtype = (st->buf[12] << 24) | (st->buf[13] << 16) | |
48 | (st->buf[14] << 8) | st->buf[15]; | ||
43 | return ret; | 49 | return ret; |
44 | } | 50 | } |
45 | 51 | ||
@@ -101,24 +107,31 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen | |||
101 | 107 | ||
102 | int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val) | 108 | int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val) |
103 | { | 109 | { |
104 | u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) }; | 110 | struct dib0700_state *st = d->priv; |
105 | return dib0700_ctrl_wr(d, buf, sizeof(buf)); | 111 | s16 ret; |
112 | |||
113 | st->buf[0] = REQUEST_SET_GPIO; | ||
114 | st->buf[1] = gpio; | ||
115 | st->buf[2] = ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6); | ||
116 | |||
117 | ret = dib0700_ctrl_wr(d, st->buf, 3); | ||
118 | |||
119 | return ret; | ||
106 | } | 120 | } |
107 | 121 | ||
108 | static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) | 122 | static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) |
109 | { | 123 | { |
110 | struct dib0700_state *st = d->priv; | 124 | struct dib0700_state *st = d->priv; |
111 | u8 b[3]; | ||
112 | int ret; | 125 | int ret; |
113 | 126 | ||
114 | if (st->fw_version >= 0x10201) { | 127 | if (st->fw_version >= 0x10201) { |
115 | b[0] = REQUEST_SET_USB_XFER_LEN; | 128 | st->buf[0] = REQUEST_SET_USB_XFER_LEN; |
116 | b[1] = (nb_ts_packets >> 8) & 0xff; | 129 | st->buf[1] = (nb_ts_packets >> 8) & 0xff; |
117 | b[2] = nb_ts_packets & 0xff; | 130 | st->buf[2] = nb_ts_packets & 0xff; |
118 | 131 | ||
119 | deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets); | 132 | deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets); |
120 | 133 | ||
121 | ret = dib0700_ctrl_wr(d, b, sizeof(b)); | 134 | ret = dib0700_ctrl_wr(d, st->buf, 3); |
122 | } else { | 135 | } else { |
123 | deb_info("this firmware does not allow to change the USB xfer len\n"); | 136 | deb_info("this firmware does not allow to change the USB xfer len\n"); |
124 | ret = -EIO; | 137 | ret = -EIO; |
@@ -137,11 +150,11 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
137 | properly support i2c read calls not preceded by a write */ | 150 | properly support i2c read calls not preceded by a write */ |
138 | 151 | ||
139 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 152 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
153 | struct dib0700_state *st = d->priv; | ||
140 | uint8_t bus_mode = 1; /* 0=eeprom bus, 1=frontend bus */ | 154 | uint8_t bus_mode = 1; /* 0=eeprom bus, 1=frontend bus */ |
141 | uint8_t gen_mode = 0; /* 0=master i2c, 1=gpio i2c */ | 155 | uint8_t gen_mode = 0; /* 0=master i2c, 1=gpio i2c */ |
142 | uint8_t en_start = 0; | 156 | uint8_t en_start = 0; |
143 | uint8_t en_stop = 0; | 157 | uint8_t en_stop = 0; |
144 | uint8_t buf[255]; /* TBV: malloc ? */ | ||
145 | int result, i; | 158 | int result, i; |
146 | 159 | ||
147 | /* Ensure nobody else hits the i2c bus while we're sending our | 160 | /* Ensure nobody else hits the i2c bus while we're sending our |
@@ -186,7 +199,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
186 | msg[i].len, | 199 | msg[i].len, |
187 | USB_CTRL_GET_TIMEOUT); | 200 | USB_CTRL_GET_TIMEOUT); |
188 | if (result < 0) { | 201 | if (result < 0) { |
189 | err("i2c read error (status = %d)\n", result); | 202 | deb_info("i2c read error (status = %d)\n", result); |
190 | break; | 203 | break; |
191 | } | 204 | } |
192 | 205 | ||
@@ -195,27 +208,27 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
195 | 208 | ||
196 | } else { | 209 | } else { |
197 | /* Write request */ | 210 | /* Write request */ |
198 | buf[0] = REQUEST_NEW_I2C_WRITE; | 211 | st->buf[0] = REQUEST_NEW_I2C_WRITE; |
199 | buf[1] = msg[i].addr << 1; | 212 | st->buf[1] = msg[i].addr << 1; |
200 | buf[2] = (en_start << 7) | (en_stop << 6) | | 213 | st->buf[2] = (en_start << 7) | (en_stop << 6) | |
201 | (msg[i].len & 0x3F); | 214 | (msg[i].len & 0x3F); |
202 | /* I2C ctrl + FE bus; */ | 215 | /* I2C ctrl + FE bus; */ |
203 | buf[3] = ((gen_mode << 6) & 0xC0) | | 216 | st->buf[3] = ((gen_mode << 6) & 0xC0) | |
204 | ((bus_mode << 4) & 0x30); | 217 | ((bus_mode << 4) & 0x30); |
205 | /* The Actual i2c payload */ | 218 | /* The Actual i2c payload */ |
206 | memcpy(&buf[4], msg[i].buf, msg[i].len); | 219 | memcpy(&st->buf[4], msg[i].buf, msg[i].len); |
207 | 220 | ||
208 | deb_data(">>> "); | 221 | deb_data(">>> "); |
209 | debug_dump(buf, msg[i].len + 4, deb_data); | 222 | debug_dump(st->buf, msg[i].len + 4, deb_data); |
210 | 223 | ||
211 | result = usb_control_msg(d->udev, | 224 | result = usb_control_msg(d->udev, |
212 | usb_sndctrlpipe(d->udev, 0), | 225 | usb_sndctrlpipe(d->udev, 0), |
213 | REQUEST_NEW_I2C_WRITE, | 226 | REQUEST_NEW_I2C_WRITE, |
214 | USB_TYPE_VENDOR | USB_DIR_OUT, | 227 | USB_TYPE_VENDOR | USB_DIR_OUT, |
215 | 0, 0, buf, msg[i].len + 4, | 228 | 0, 0, st->buf, msg[i].len + 4, |
216 | USB_CTRL_GET_TIMEOUT); | 229 | USB_CTRL_GET_TIMEOUT); |
217 | if (result < 0) { | 230 | if (result < 0) { |
218 | err("i2c write error (status = %d)\n", result); | 231 | deb_info("i2c write error (status = %d)\n", result); |
219 | break; | 232 | break; |
220 | } | 233 | } |
221 | } | 234 | } |
@@ -231,27 +244,29 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, | |||
231 | struct i2c_msg *msg, int num) | 244 | struct i2c_msg *msg, int num) |
232 | { | 245 | { |
233 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 246 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
247 | struct dib0700_state *st = d->priv; | ||
234 | int i,len; | 248 | int i,len; |
235 | u8 buf[255]; | ||
236 | 249 | ||
237 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 250 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
238 | return -EAGAIN; | 251 | return -EAGAIN; |
239 | 252 | ||
240 | for (i = 0; i < num; i++) { | 253 | for (i = 0; i < num; i++) { |
241 | /* fill in the address */ | 254 | /* fill in the address */ |
242 | buf[1] = msg[i].addr << 1; | 255 | st->buf[1] = msg[i].addr << 1; |
243 | /* fill the buffer */ | 256 | /* fill the buffer */ |
244 | memcpy(&buf[2], msg[i].buf, msg[i].len); | 257 | memcpy(&st->buf[2], msg[i].buf, msg[i].len); |
245 | 258 | ||
246 | /* write/read request */ | 259 | /* write/read request */ |
247 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 260 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { |
248 | buf[0] = REQUEST_I2C_READ; | 261 | st->buf[0] = REQUEST_I2C_READ; |
249 | buf[1] |= 1; | 262 | st->buf[1] |= 1; |
250 | 263 | ||
251 | /* special thing in the current firmware: when length is zero the read-failed */ | 264 | /* special thing in the current firmware: when length is zero the read-failed */ |
252 | if ((len = dib0700_ctrl_rd(d, buf, msg[i].len + 2, msg[i+1].buf, msg[i+1].len)) <= 0) { | 265 | len = dib0700_ctrl_rd(d, st->buf, msg[i].len + 2, |
266 | msg[i+1].buf, msg[i+1].len); | ||
267 | if (len <= 0) { | ||
253 | deb_info("I2C read failed on address 0x%02x\n", | 268 | deb_info("I2C read failed on address 0x%02x\n", |
254 | msg[i].addr); | 269 | msg[i].addr); |
255 | break; | 270 | break; |
256 | } | 271 | } |
257 | 272 | ||
@@ -259,13 +274,13 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, | |||
259 | 274 | ||
260 | i++; | 275 | i++; |
261 | } else { | 276 | } else { |
262 | buf[0] = REQUEST_I2C_WRITE; | 277 | st->buf[0] = REQUEST_I2C_WRITE; |
263 | if (dib0700_ctrl_wr(d, buf, msg[i].len + 2) < 0) | 278 | if (dib0700_ctrl_wr(d, st->buf, msg[i].len + 2) < 0) |
264 | break; | 279 | break; |
265 | } | 280 | } |
266 | } | 281 | } |
267 | |||
268 | mutex_unlock(&d->i2c_mutex); | 282 | mutex_unlock(&d->i2c_mutex); |
283 | |||
269 | return i; | 284 | return i; |
270 | } | 285 | } |
271 | 286 | ||
@@ -297,15 +312,23 @@ struct i2c_algorithm dib0700_i2c_algo = { | |||
297 | int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, | 312 | int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, |
298 | struct dvb_usb_device_description **desc, int *cold) | 313 | struct dvb_usb_device_description **desc, int *cold) |
299 | { | 314 | { |
300 | u8 b[16]; | 315 | s16 ret; |
301 | s16 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev,0), | 316 | u8 *b; |
317 | |||
318 | b = kmalloc(16, GFP_KERNEL); | ||
319 | if (!b) | ||
320 | return -ENOMEM; | ||
321 | |||
322 | |||
323 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
302 | REQUEST_GET_VERSION, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, b, 16, USB_CTRL_GET_TIMEOUT); | 324 | REQUEST_GET_VERSION, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, b, 16, USB_CTRL_GET_TIMEOUT); |
303 | 325 | ||
304 | deb_info("FW GET_VERSION length: %d\n",ret); | 326 | deb_info("FW GET_VERSION length: %d\n",ret); |
305 | 327 | ||
306 | *cold = ret <= 0; | 328 | *cold = ret <= 0; |
307 | |||
308 | deb_info("cold: %d\n", *cold); | 329 | deb_info("cold: %d\n", *cold); |
330 | |||
331 | kfree(b); | ||
309 | return 0; | 332 | return 0; |
310 | } | 333 | } |
311 | 334 | ||
@@ -313,21 +336,53 @@ static int dib0700_set_clock(struct dvb_usb_device *d, u8 en_pll, | |||
313 | u8 pll_src, u8 pll_range, u8 clock_gpio3, u16 pll_prediv, | 336 | u8 pll_src, u8 pll_range, u8 clock_gpio3, u16 pll_prediv, |
314 | u16 pll_loopdiv, u16 free_div, u16 dsuScaler) | 337 | u16 pll_loopdiv, u16 free_div, u16 dsuScaler) |
315 | { | 338 | { |
316 | u8 b[10]; | 339 | struct dib0700_state *st = d->priv; |
317 | b[0] = REQUEST_SET_CLOCK; | 340 | s16 ret; |
318 | b[1] = (en_pll << 7) | (pll_src << 6) | (pll_range << 5) | (clock_gpio3 << 4); | 341 | |
319 | b[2] = (pll_prediv >> 8) & 0xff; // MSB | 342 | st->buf[0] = REQUEST_SET_CLOCK; |
320 | b[3] = pll_prediv & 0xff; // LSB | 343 | st->buf[1] = (en_pll << 7) | (pll_src << 6) | |
321 | b[4] = (pll_loopdiv >> 8) & 0xff; // MSB | 344 | (pll_range << 5) | (clock_gpio3 << 4); |
322 | b[5] = pll_loopdiv & 0xff; // LSB | 345 | st->buf[2] = (pll_prediv >> 8) & 0xff; /* MSB */ |
323 | b[6] = (free_div >> 8) & 0xff; // MSB | 346 | st->buf[3] = pll_prediv & 0xff; /* LSB */ |
324 | b[7] = free_div & 0xff; // LSB | 347 | st->buf[4] = (pll_loopdiv >> 8) & 0xff; /* MSB */ |
325 | b[8] = (dsuScaler >> 8) & 0xff; // MSB | 348 | st->buf[5] = pll_loopdiv & 0xff; /* LSB */ |
326 | b[9] = dsuScaler & 0xff; // LSB | 349 | st->buf[6] = (free_div >> 8) & 0xff; /* MSB */ |
327 | 350 | st->buf[7] = free_div & 0xff; /* LSB */ | |
328 | return dib0700_ctrl_wr(d, b, 10); | 351 | st->buf[8] = (dsuScaler >> 8) & 0xff; /* MSB */ |
352 | st->buf[9] = dsuScaler & 0xff; /* LSB */ | ||
353 | |||
354 | ret = dib0700_ctrl_wr(d, st->buf, 10); | ||
355 | |||
356 | return ret; | ||
329 | } | 357 | } |
330 | 358 | ||
359 | int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz) | ||
360 | { | ||
361 | struct dib0700_state *st = d->priv; | ||
362 | u16 divider; | ||
363 | |||
364 | if (scl_kHz == 0) | ||
365 | return -EINVAL; | ||
366 | |||
367 | st->buf[0] = REQUEST_SET_I2C_PARAM; | ||
368 | divider = (u16) (30000 / scl_kHz); | ||
369 | st->buf[1] = 0; | ||
370 | st->buf[2] = (u8) (divider >> 8); | ||
371 | st->buf[3] = (u8) (divider & 0xff); | ||
372 | divider = (u16) (72000 / scl_kHz); | ||
373 | st->buf[4] = (u8) (divider >> 8); | ||
374 | st->buf[5] = (u8) (divider & 0xff); | ||
375 | divider = (u16) (72000 / scl_kHz); /* clock: 72MHz */ | ||
376 | st->buf[6] = (u8) (divider >> 8); | ||
377 | st->buf[7] = (u8) (divider & 0xff); | ||
378 | |||
379 | deb_info("setting I2C speed: %04x %04x %04x (%d kHz).", | ||
380 | (st->buf[2] << 8) | (st->buf[3]), (st->buf[4] << 8) | | ||
381 | st->buf[5], (st->buf[6] << 8) | st->buf[7], scl_kHz); | ||
382 | return dib0700_ctrl_wr(d, st->buf, 8); | ||
383 | } | ||
384 | |||
385 | |||
331 | int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3) | 386 | int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3) |
332 | { | 387 | { |
333 | switch (clk_MHz) { | 388 | switch (clk_MHz) { |
@@ -339,32 +394,45 @@ int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3) | |||
339 | 394 | ||
340 | static int dib0700_jumpram(struct usb_device *udev, u32 address) | 395 | static int dib0700_jumpram(struct usb_device *udev, u32 address) |
341 | { | 396 | { |
342 | int ret, actlen; | 397 | int ret = 0, actlen; |
343 | u8 buf[8] = { REQUEST_JUMPRAM, 0, 0, 0, | 398 | u8 *buf; |
344 | (address >> 24) & 0xff, | 399 | |
345 | (address >> 16) & 0xff, | 400 | buf = kmalloc(8, GFP_KERNEL); |
346 | (address >> 8) & 0xff, | 401 | if (!buf) |
347 | address & 0xff }; | 402 | return -ENOMEM; |
403 | buf[0] = REQUEST_JUMPRAM; | ||
404 | buf[1] = 0; | ||
405 | buf[2] = 0; | ||
406 | buf[3] = 0; | ||
407 | buf[4] = (address >> 24) & 0xff; | ||
408 | buf[5] = (address >> 16) & 0xff; | ||
409 | buf[6] = (address >> 8) & 0xff; | ||
410 | buf[7] = address & 0xff; | ||
348 | 411 | ||
349 | if ((ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 0x01),buf,8,&actlen,1000)) < 0) { | 412 | if ((ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 0x01),buf,8,&actlen,1000)) < 0) { |
350 | deb_fw("jumpram to 0x%x failed\n",address); | 413 | deb_fw("jumpram to 0x%x failed\n",address); |
351 | return ret; | 414 | goto out; |
352 | } | 415 | } |
353 | if (actlen != 8) { | 416 | if (actlen != 8) { |
354 | deb_fw("jumpram to 0x%x failed\n",address); | 417 | deb_fw("jumpram to 0x%x failed\n",address); |
355 | return -EIO; | 418 | ret = -EIO; |
419 | goto out; | ||
356 | } | 420 | } |
357 | return 0; | 421 | out: |
422 | kfree(buf); | ||
423 | return ret; | ||
358 | } | 424 | } |
359 | 425 | ||
360 | int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw) | 426 | int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw) |
361 | { | 427 | { |
362 | struct hexline hx; | 428 | struct hexline hx; |
363 | int pos = 0, ret, act_len, i, adap_num; | 429 | int pos = 0, ret, act_len, i, adap_num; |
364 | u8 b[16]; | 430 | u8 *buf; |
365 | u32 fw_version; | 431 | u32 fw_version; |
366 | 432 | ||
367 | u8 buf[260]; | 433 | buf = kmalloc(260, GFP_KERNEL); |
434 | if (!buf) | ||
435 | return -ENOMEM; | ||
368 | 436 | ||
369 | while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) { | 437 | while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) { |
370 | deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n", | 438 | deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n", |
@@ -386,7 +454,7 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw | |||
386 | 454 | ||
387 | if (ret < 0) { | 455 | if (ret < 0) { |
388 | err("firmware download failed at %d with %d",pos,ret); | 456 | err("firmware download failed at %d with %d",pos,ret); |
389 | return ret; | 457 | goto out; |
390 | } | 458 | } |
391 | } | 459 | } |
392 | 460 | ||
@@ -407,8 +475,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw | |||
407 | usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 475 | usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
408 | REQUEST_GET_VERSION, | 476 | REQUEST_GET_VERSION, |
409 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | 477 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
410 | b, sizeof(b), USB_CTRL_GET_TIMEOUT); | 478 | buf, 16, USB_CTRL_GET_TIMEOUT); |
411 | fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11]; | 479 | fw_version = (buf[8] << 24) | (buf[9] << 16) | (buf[10] << 8) | buf[11]; |
412 | 480 | ||
413 | /* set the buffer size - DVB-USB is allocating URB buffers | 481 | /* set the buffer size - DVB-USB is allocating URB buffers |
414 | * only after the firwmare download was successful */ | 482 | * only after the firwmare download was successful */ |
@@ -426,14 +494,14 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw | |||
426 | } | 494 | } |
427 | } | 495 | } |
428 | } | 496 | } |
429 | 497 | out: | |
498 | kfree(buf); | ||
430 | return ret; | 499 | return ret; |
431 | } | 500 | } |
432 | 501 | ||
433 | int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 502 | int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
434 | { | 503 | { |
435 | struct dib0700_state *st = adap->dev->priv; | 504 | struct dib0700_state *st = adap->dev->priv; |
436 | u8 b[4]; | ||
437 | int ret; | 505 | int ret; |
438 | 506 | ||
439 | if ((onoff != 0) && (st->fw_version >= 0x10201)) { | 507 | if ((onoff != 0) && (st->fw_version >= 0x10201)) { |
@@ -447,43 +515,58 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
447 | } | 515 | } |
448 | } | 516 | } |
449 | 517 | ||
450 | b[0] = REQUEST_ENABLE_VIDEO; | 518 | st->buf[0] = REQUEST_ENABLE_VIDEO; |
451 | b[1] = (onoff << 4) | 0x00; /* this bit gives a kind of command, rather than enabling something or not */ | 519 | /* this bit gives a kind of command, |
520 | * rather than enabling something or not */ | ||
521 | st->buf[1] = (onoff << 4) | 0x00; | ||
452 | 522 | ||
453 | if (st->disable_streaming_master_mode == 1) | 523 | if (st->disable_streaming_master_mode == 1) |
454 | b[2] = 0x00; | 524 | st->buf[2] = 0x00; |
455 | else | 525 | else |
456 | b[2] = 0x01 << 4; /* Master mode */ | 526 | st->buf[2] = 0x01 << 4; /* Master mode */ |
457 | 527 | ||
458 | b[3] = 0x00; | 528 | st->buf[3] = 0x00; |
459 | 529 | ||
460 | deb_info("modifying (%d) streaming state for %d\n", onoff, adap->id); | 530 | deb_info("modifying (%d) streaming state for %d\n", onoff, adap->id); |
461 | 531 | ||
462 | if (onoff) | 532 | st->channel_state &= ~0x3; |
463 | st->channel_state |= 1 << adap->id; | 533 | if ((adap->stream.props.endpoint != 2) |
464 | else | 534 | && (adap->stream.props.endpoint != 3)) { |
465 | st->channel_state &= ~(1 << adap->id); | 535 | deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->stream.props.endpoint); |
536 | if (onoff) | ||
537 | st->channel_state |= 1 << (adap->id); | ||
538 | else | ||
539 | st->channel_state |= 1 << ~(adap->id); | ||
540 | } else { | ||
541 | if (onoff) | ||
542 | st->channel_state |= 1 << (adap->stream.props.endpoint-2); | ||
543 | else | ||
544 | st->channel_state |= 1 << (3-adap->stream.props.endpoint); | ||
545 | } | ||
466 | 546 | ||
467 | b[2] |= st->channel_state; | 547 | st->buf[2] |= st->channel_state; |
468 | 548 | ||
469 | deb_info("data for streaming: %x %x\n", b[1], b[2]); | 549 | deb_info("data for streaming: %x %x\n", st->buf[1], st->buf[2]); |
470 | 550 | ||
471 | return dib0700_ctrl_wr(adap->dev, b, 4); | 551 | return dib0700_ctrl_wr(adap->dev, st->buf, 4); |
472 | } | 552 | } |
473 | 553 | ||
474 | int dib0700_change_protocol(void *priv, u64 ir_type) | 554 | int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) |
475 | { | 555 | { |
476 | struct dvb_usb_device *d = priv; | 556 | struct dvb_usb_device *d = rc->priv; |
477 | struct dib0700_state *st = d->priv; | 557 | struct dib0700_state *st = d->priv; |
478 | u8 rc_setup[3] = { REQUEST_SET_RC, 0, 0 }; | ||
479 | int new_proto, ret; | 558 | int new_proto, ret; |
480 | 559 | ||
560 | st->buf[0] = REQUEST_SET_RC; | ||
561 | st->buf[1] = 0; | ||
562 | st->buf[2] = 0; | ||
563 | |||
481 | /* Set the IR mode */ | 564 | /* Set the IR mode */ |
482 | if (ir_type == IR_TYPE_RC5) | 565 | if (rc_type == RC_TYPE_RC5) |
483 | new_proto = 1; | 566 | new_proto = 1; |
484 | else if (ir_type == IR_TYPE_NEC) | 567 | else if (rc_type == RC_TYPE_NEC) |
485 | new_proto = 0; | 568 | new_proto = 0; |
486 | else if (ir_type == IR_TYPE_RC6) { | 569 | else if (rc_type == RC_TYPE_RC6) { |
487 | if (st->fw_version < 0x10200) | 570 | if (st->fw_version < 0x10200) |
488 | return -EINVAL; | 571 | return -EINVAL; |
489 | 572 | ||
@@ -491,15 +574,15 @@ int dib0700_change_protocol(void *priv, u64 ir_type) | |||
491 | } else | 574 | } else |
492 | return -EINVAL; | 575 | return -EINVAL; |
493 | 576 | ||
494 | rc_setup[1] = new_proto; | 577 | st->buf[1] = new_proto; |
495 | 578 | ||
496 | ret = dib0700_ctrl_wr(d, rc_setup, sizeof(rc_setup)); | 579 | ret = dib0700_ctrl_wr(d, st->buf, 3); |
497 | if (ret < 0) { | 580 | if (ret < 0) { |
498 | err("ir protocol setup failed"); | 581 | err("ir protocol setup failed"); |
499 | return ret; | 582 | return ret; |
500 | } | 583 | } |
501 | 584 | ||
502 | d->props.rc.core.protocol = ir_type; | 585 | d->props.rc.core.protocol = rc_type; |
503 | 586 | ||
504 | return ret; | 587 | return ret; |
505 | } | 588 | } |
@@ -514,8 +597,8 @@ struct dib0700_rc_response { | |||
514 | union { | 597 | union { |
515 | u16 system16; | 598 | u16 system16; |
516 | struct { | 599 | struct { |
517 | u8 system; | ||
518 | u8 not_system; | 600 | u8 not_system; |
601 | u8 system; | ||
519 | }; | 602 | }; |
520 | }; | 603 | }; |
521 | u8 data; | 604 | u8 data; |
@@ -526,7 +609,6 @@ struct dib0700_rc_response { | |||
526 | static void dib0700_rc_urb_completion(struct urb *purb) | 609 | static void dib0700_rc_urb_completion(struct urb *purb) |
527 | { | 610 | { |
528 | struct dvb_usb_device *d = purb->context; | 611 | struct dvb_usb_device *d = purb->context; |
529 | struct dib0700_state *st; | ||
530 | struct dib0700_rc_response *poll_reply; | 612 | struct dib0700_rc_response *poll_reply; |
531 | u32 uninitialized_var(keycode); | 613 | u32 uninitialized_var(keycode); |
532 | u8 toggle; | 614 | u8 toggle; |
@@ -535,13 +617,12 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
535 | if (d == NULL) | 617 | if (d == NULL) |
536 | return; | 618 | return; |
537 | 619 | ||
538 | if (d->rc_input_dev == NULL) { | 620 | if (d->rc_dev == NULL) { |
539 | /* This will occur if disable_rc_polling=1 */ | 621 | /* This will occur if disable_rc_polling=1 */ |
540 | usb_free_urb(purb); | 622 | usb_free_urb(purb); |
541 | return; | 623 | return; |
542 | } | 624 | } |
543 | 625 | ||
544 | st = d->priv; | ||
545 | poll_reply = purb->transfer_buffer; | 626 | poll_reply = purb->transfer_buffer; |
546 | 627 | ||
547 | if (purb->status < 0) { | 628 | if (purb->status < 0) { |
@@ -562,7 +643,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
562 | purb->actual_length); | 643 | purb->actual_length); |
563 | 644 | ||
564 | switch (d->props.rc.core.protocol) { | 645 | switch (d->props.rc.core.protocol) { |
565 | case IR_TYPE_NEC: | 646 | case RC_TYPE_NEC: |
566 | toggle = 0; | 647 | toggle = 0; |
567 | 648 | ||
568 | /* NEC protocol sends repeat code as 0 0 0 FF */ | 649 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
@@ -575,7 +656,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
575 | if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { | 656 | if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { |
576 | deb_data("NEC extended protocol\n"); | 657 | deb_data("NEC extended protocol\n"); |
577 | /* NEC extended code - 24 bits */ | 658 | /* NEC extended code - 24 bits */ |
578 | keycode = poll_reply->system16 << 8 | poll_reply->data; | 659 | keycode = be16_to_cpu(poll_reply->system16) << 8 | poll_reply->data; |
579 | } else { | 660 | } else { |
580 | deb_data("NEC normal protocol\n"); | 661 | deb_data("NEC normal protocol\n"); |
581 | /* normal NEC code - 16 bits */ | 662 | /* normal NEC code - 16 bits */ |
@@ -587,7 +668,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
587 | deb_data("RC5 protocol\n"); | 668 | deb_data("RC5 protocol\n"); |
588 | /* RC5 Protocol */ | 669 | /* RC5 Protocol */ |
589 | toggle = poll_reply->report_id; | 670 | toggle = poll_reply->report_id; |
590 | keycode = poll_reply->system16 << 8 | poll_reply->data; | 671 | keycode = poll_reply->system << 8 | poll_reply->data; |
591 | 672 | ||
592 | break; | 673 | break; |
593 | } | 674 | } |
@@ -600,7 +681,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
600 | goto resubmit; | 681 | goto resubmit; |
601 | } | 682 | } |
602 | 683 | ||
603 | ir_keydown(d->rc_input_dev, keycode, toggle); | 684 | rc_keydown(d->rc_dev, keycode, toggle); |
604 | 685 | ||
605 | resubmit: | 686 | resubmit: |
606 | /* Clean the buffer before we requeue */ | 687 | /* Clean the buffer before we requeue */ |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index e06acd1fecb6..c519ad5eb731 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "dib7000m.h" | 12 | #include "dib7000m.h" |
13 | #include "dib7000p.h" | 13 | #include "dib7000p.h" |
14 | #include "dib8000.h" | 14 | #include "dib8000.h" |
15 | #include "dib9000.h" | ||
15 | #include "mt2060.h" | 16 | #include "mt2060.h" |
16 | #include "mt2266.h" | 17 | #include "mt2266.h" |
17 | #include "tuner-xc2028.h" | 18 | #include "tuner-xc2028.h" |
@@ -29,6 +30,7 @@ MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplif | |||
29 | 30 | ||
30 | struct dib0700_adapter_state { | 31 | struct dib0700_adapter_state { |
31 | int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *); | 32 | int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *); |
33 | const struct firmware *frontend_firmware; | ||
32 | }; | 34 | }; |
33 | 35 | ||
34 | /* Hauppauge Nova-T 500 (aka Bristol) | 36 | /* Hauppauge Nova-T 500 (aka Bristol) |
@@ -510,7 +512,7 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) | |||
510 | 512 | ||
511 | d->last_event = 0; | 513 | d->last_event = 0; |
512 | switch (d->props.rc.core.protocol) { | 514 | switch (d->props.rc.core.protocol) { |
513 | case IR_TYPE_NEC: | 515 | case RC_TYPE_NEC: |
514 | /* NEC protocol sends repeat code as 0 0 0 FF */ | 516 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
515 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && | 517 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && |
516 | (key[3] == 0xff)) | 518 | (key[3] == 0xff)) |
@@ -520,13 +522,13 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) | |||
520 | d->last_event = keycode; | 522 | d->last_event = keycode; |
521 | } | 523 | } |
522 | 524 | ||
523 | ir_keydown(d->rc_input_dev, keycode, 0); | 525 | rc_keydown(d->rc_dev, keycode, 0); |
524 | break; | 526 | break; |
525 | default: | 527 | default: |
526 | /* RC-5 protocol changes toggle bit on new keypress */ | 528 | /* RC-5 protocol changes toggle bit on new keypress */ |
527 | keycode = key[3-2] << 8 | key[3-3]; | 529 | keycode = key[3-2] << 8 | key[3-3]; |
528 | toggle = key[3-1]; | 530 | toggle = key[3-1]; |
529 | ir_keydown(d->rc_input_dev, keycode, toggle); | 531 | rc_keydown(d->rc_dev, keycode, toggle); |
530 | 532 | ||
531 | break; | 533 | break; |
532 | } | 534 | } |
@@ -870,6 +872,23 @@ static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) | |||
870 | return 0; | 872 | return 0; |
871 | } | 873 | } |
872 | 874 | ||
875 | static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index, | ||
876 | u16 pid, int onoff) | ||
877 | { | ||
878 | struct dib0700_state *st = adapter->dev->priv; | ||
879 | if (st->is_dib7000pc) | ||
880 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); | ||
881 | return dib7000m_pid_filter(adapter->fe, index, pid, onoff); | ||
882 | } | ||
883 | |||
884 | static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) | ||
885 | { | ||
886 | struct dib0700_state *st = adapter->dev->priv; | ||
887 | if (st->is_dib7000pc) | ||
888 | return dib7000p_pid_filter_ctrl(adapter->fe, onoff); | ||
889 | return dib7000m_pid_filter_ctrl(adapter->fe, onoff); | ||
890 | } | ||
891 | |||
873 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) | 892 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) |
874 | { | 893 | { |
875 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); | 894 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); |
@@ -1226,13 +1245,13 @@ static int dib807x_tuner_attach(struct dvb_usb_adapter *adap) | |||
1226 | static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index, | 1245 | static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index, |
1227 | u16 pid, int onoff) | 1246 | u16 pid, int onoff) |
1228 | { | 1247 | { |
1229 | return dib8000_pid_filter(adapter->fe, index, pid, onoff); | 1248 | return dib8000_pid_filter(adapter->fe, index, pid, onoff); |
1230 | } | 1249 | } |
1231 | 1250 | ||
1232 | static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter, | 1251 | static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter, |
1233 | int onoff) | 1252 | int onoff) |
1234 | { | 1253 | { |
1235 | return dib8000_pid_filter_ctrl(adapter->fe, onoff); | 1254 | return dib8000_pid_filter_ctrl(adapter->fe, onoff); |
1236 | } | 1255 | } |
1237 | 1256 | ||
1238 | /* STK807x */ | 1257 | /* STK807x */ |
@@ -1304,11 +1323,11 @@ static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap) | |||
1304 | 1323 | ||
1305 | /* STK8096GP */ | 1324 | /* STK8096GP */ |
1306 | struct dibx000_agc_config dib8090_agc_config[2] = { | 1325 | struct dibx000_agc_config dib8090_agc_config[2] = { |
1307 | { | 1326 | { |
1308 | BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, | 1327 | BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, |
1309 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, | 1328 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, |
1310 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 1329 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
1311 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 1330 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ |
1312 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 1331 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
1313 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 1332 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
1314 | 1333 | ||
@@ -1345,12 +1364,12 @@ struct dibx000_agc_config dib8090_agc_config[2] = { | |||
1345 | 51, | 1364 | 51, |
1346 | 1365 | ||
1347 | 0, | 1366 | 0, |
1348 | }, | 1367 | }, |
1349 | { | 1368 | { |
1350 | BAND_CBAND, | 1369 | BAND_CBAND, |
1351 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, | 1370 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, |
1352 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 1371 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
1353 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 1372 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ |
1354 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 1373 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
1355 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 1374 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
1356 | 1375 | ||
@@ -1387,135 +1406,153 @@ struct dibx000_agc_config dib8090_agc_config[2] = { | |||
1387 | 51, | 1406 | 51, |
1388 | 1407 | ||
1389 | 0, | 1408 | 0, |
1390 | } | 1409 | } |
1391 | }; | 1410 | }; |
1392 | 1411 | ||
1393 | static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = { | 1412 | static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = { |
1394 | 54000, 13500, | 1413 | 54000, 13500, |
1395 | 1, 18, 3, 1, 0, | 1414 | 1, 18, 3, 1, 0, |
1396 | 0, 0, 1, 1, 2, | 1415 | 0, 0, 1, 1, 2, |
1397 | (3 << 14) | (1 << 12) | (599 << 0), | 1416 | (3 << 14) | (1 << 12) | (599 << 0), |
1398 | (0 << 25) | 0, | 1417 | (0 << 25) | 0, |
1399 | 20199727, | 1418 | 20199727, |
1400 | 12000000, | 1419 | 12000000, |
1401 | }; | 1420 | }; |
1402 | 1421 | ||
1403 | static int dib8090_get_adc_power(struct dvb_frontend *fe) | 1422 | static int dib8090_get_adc_power(struct dvb_frontend *fe) |
1404 | { | 1423 | { |
1405 | return dib8000_get_adc_power(fe, 1); | 1424 | return dib8000_get_adc_power(fe, 1); |
1406 | } | 1425 | } |
1407 | 1426 | ||
1408 | static struct dib8000_config dib809x_dib8000_config = { | 1427 | static struct dib8000_config dib809x_dib8000_config[2] = { |
1409 | .output_mpeg2_in_188_bytes = 1, | 1428 | { |
1410 | 1429 | .output_mpeg2_in_188_bytes = 1, | |
1411 | .agc_config_count = 2, | 1430 | |
1412 | .agc = dib8090_agc_config, | 1431 | .agc_config_count = 2, |
1413 | .agc_control = dib0090_dcc_freq, | 1432 | .agc = dib8090_agc_config, |
1414 | .pll = &dib8090_pll_config_12mhz, | 1433 | .agc_control = dib0090_dcc_freq, |
1415 | .tuner_is_baseband = 1, | 1434 | .pll = &dib8090_pll_config_12mhz, |
1416 | 1435 | .tuner_is_baseband = 1, | |
1417 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, | 1436 | |
1418 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, | 1437 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, |
1419 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | 1438 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, |
1420 | 1439 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | |
1421 | .hostbus_diversity = 1, | 1440 | |
1422 | .div_cfg = 0x31, | 1441 | .hostbus_diversity = 1, |
1423 | .output_mode = OUTMODE_MPEG2_FIFO, | 1442 | .div_cfg = 0x31, |
1424 | .drives = 0x2d98, | 1443 | .output_mode = OUTMODE_MPEG2_FIFO, |
1425 | .diversity_delay = 144, | 1444 | .drives = 0x2d98, |
1426 | .refclksel = 3, | 1445 | .diversity_delay = 48, |
1446 | .refclksel = 3, | ||
1447 | }, { | ||
1448 | .output_mpeg2_in_188_bytes = 1, | ||
1449 | |||
1450 | .agc_config_count = 2, | ||
1451 | .agc = dib8090_agc_config, | ||
1452 | .agc_control = dib0090_dcc_freq, | ||
1453 | .pll = &dib8090_pll_config_12mhz, | ||
1454 | .tuner_is_baseband = 1, | ||
1455 | |||
1456 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, | ||
1457 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, | ||
1458 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | ||
1459 | |||
1460 | .hostbus_diversity = 1, | ||
1461 | .div_cfg = 0x31, | ||
1462 | .output_mode = OUTMODE_DIVERSITY, | ||
1463 | .drives = 0x2d08, | ||
1464 | .diversity_delay = 1, | ||
1465 | .refclksel = 3, | ||
1466 | } | ||
1467 | }; | ||
1468 | |||
1469 | static struct dib0090_wbd_slope dib8090_wbd_table[] = { | ||
1470 | /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */ | ||
1471 | { 120, 0, 500, 0, 500, 4 }, /* CBAND */ | ||
1472 | { 170, 0, 450, 0, 450, 4 }, /* CBAND */ | ||
1473 | { 380, 48, 373, 28, 259, 6 }, /* VHF */ | ||
1474 | { 860, 34, 700, 36, 616, 6 }, /* high UHF */ | ||
1475 | { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */ | ||
1427 | }; | 1476 | }; |
1428 | 1477 | ||
1429 | static struct dib0090_config dib809x_dib0090_config = { | 1478 | static struct dib0090_config dib809x_dib0090_config = { |
1430 | .io.pll_bypass = 1, | 1479 | .io.pll_bypass = 1, |
1431 | .io.pll_range = 1, | 1480 | .io.pll_range = 1, |
1432 | .io.pll_prediv = 1, | 1481 | .io.pll_prediv = 1, |
1433 | .io.pll_loopdiv = 20, | 1482 | .io.pll_loopdiv = 20, |
1434 | .io.adc_clock_ratio = 8, | 1483 | .io.adc_clock_ratio = 8, |
1435 | .io.pll_int_loop_filt = 0, | 1484 | .io.pll_int_loop_filt = 0, |
1436 | .io.clock_khz = 12000, | 1485 | .io.clock_khz = 12000, |
1437 | .reset = dib80xx_tuner_reset, | 1486 | .reset = dib80xx_tuner_reset, |
1438 | .sleep = dib80xx_tuner_sleep, | 1487 | .sleep = dib80xx_tuner_sleep, |
1439 | .clkouttobamse = 1, | 1488 | .clkouttobamse = 1, |
1440 | .analog_output = 1, | 1489 | .analog_output = 1, |
1441 | .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS, | 1490 | .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS, |
1442 | .wbd_vhf_offset = 100, | 1491 | .use_pwm_agc = 1, |
1443 | .wbd_cband_offset = 450, | 1492 | .clkoutdrive = 1, |
1444 | .use_pwm_agc = 1, | 1493 | .get_adc_power = dib8090_get_adc_power, |
1445 | .clkoutdrive = 1, | 1494 | .freq_offset_khz_uhf = -63, |
1446 | .get_adc_power = dib8090_get_adc_power, | ||
1447 | .freq_offset_khz_uhf = 0, | ||
1448 | .freq_offset_khz_vhf = -143, | 1495 | .freq_offset_khz_vhf = -143, |
1496 | .wbd = dib8090_wbd_table, | ||
1497 | .fref_clock_ratio = 6, | ||
1449 | }; | 1498 | }; |
1450 | 1499 | ||
1451 | static int dib8096_set_param_override(struct dvb_frontend *fe, | 1500 | static int dib8096_set_param_override(struct dvb_frontend *fe, |
1452 | struct dvb_frontend_parameters *fep) | 1501 | struct dvb_frontend_parameters *fep) |
1453 | { | 1502 | { |
1454 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 1503 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
1455 | struct dib0700_adapter_state *state = adap->priv; | 1504 | struct dib0700_adapter_state *state = adap->priv; |
1456 | u8 band = BAND_OF_FREQUENCY(fep->frequency/1000); | 1505 | u8 band = BAND_OF_FREQUENCY(fep->frequency/1000); |
1457 | u16 offset; | 1506 | u16 target; |
1458 | int ret = 0; | 1507 | int ret = 0; |
1459 | enum frontend_tune_state tune_state = CT_SHUTDOWN; | 1508 | enum frontend_tune_state tune_state = CT_SHUTDOWN; |
1460 | u16 ltgain, rf_gain_limit; | 1509 | u16 ltgain, rf_gain_limit; |
1461 | 1510 | ||
1462 | ret = state->set_param_save(fe, fep); | 1511 | ret = state->set_param_save(fe, fep); |
1463 | if (ret < 0) | 1512 | if (ret < 0) |
1464 | return ret; | 1513 | return ret; |
1465 | 1514 | ||
1466 | switch (band) { | 1515 | target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2; |
1467 | case BAND_VHF: | 1516 | dib8000_set_wbd_ref(fe, target); |
1468 | offset = 100; | 1517 | |
1469 | break; | 1518 | |
1470 | case BAND_UHF: | 1519 | if (band == BAND_CBAND) { |
1471 | offset = 550; | 1520 | deb_info("tuning in CBAND - soft-AGC startup\n"); |
1472 | break; | 1521 | dib0090_set_tune_state(fe, CT_AGC_START); |
1473 | default: | 1522 | do { |
1474 | offset = 0; | 1523 | ret = dib0090_gain_control(fe); |
1475 | break; | 1524 | msleep(ret); |
1476 | } | 1525 | tune_state = dib0090_get_tune_state(fe); |
1477 | offset += (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2; | 1526 | if (tune_state == CT_AGC_STEP_0) |
1478 | dib8000_set_wbd_ref(fe, offset); | 1527 | dib8000_set_gpio(fe, 6, 0, 1); |
1479 | 1528 | else if (tune_state == CT_AGC_STEP_1) { | |
1480 | 1529 | dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain); | |
1481 | if (band == BAND_CBAND) { | 1530 | if (rf_gain_limit == 0) |
1482 | deb_info("tuning in CBAND - soft-AGC startup\n"); | 1531 | dib8000_set_gpio(fe, 6, 0, 0); |
1483 | /* TODO specific wbd target for dib0090 - needed for startup ? */ | 1532 | } |
1484 | dib0090_set_tune_state(fe, CT_AGC_START); | 1533 | } while (tune_state < CT_AGC_STOP); |
1485 | do { | 1534 | dib0090_pwm_gain_reset(fe); |
1486 | ret = dib0090_gain_control(fe); | 1535 | dib8000_pwm_agc_reset(fe); |
1487 | msleep(ret); | 1536 | dib8000_set_tune_state(fe, CT_DEMOD_START); |
1488 | tune_state = dib0090_get_tune_state(fe); | 1537 | } else { |
1489 | if (tune_state == CT_AGC_STEP_0) | 1538 | deb_info("not tuning in CBAND - standard AGC startup\n"); |
1490 | dib8000_set_gpio(fe, 6, 0, 1); | 1539 | dib0090_pwm_gain_reset(fe); |
1491 | else if (tune_state == CT_AGC_STEP_1) { | 1540 | } |
1492 | dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain); | ||
1493 | if (rf_gain_limit == 0) | ||
1494 | dib8000_set_gpio(fe, 6, 0, 0); | ||
1495 | } | ||
1496 | } while (tune_state < CT_AGC_STOP); | ||
1497 | dib0090_pwm_gain_reset(fe); | ||
1498 | dib8000_pwm_agc_reset(fe); | ||
1499 | dib8000_set_tune_state(fe, CT_DEMOD_START); | ||
1500 | } else { | ||
1501 | deb_info("not tuning in CBAND - standard AGC startup\n"); | ||
1502 | dib0090_pwm_gain_reset(fe); | ||
1503 | } | ||
1504 | 1541 | ||
1505 | return 0; | 1542 | return 0; |
1506 | } | 1543 | } |
1507 | 1544 | ||
1508 | static int dib809x_tuner_attach(struct dvb_usb_adapter *adap) | 1545 | static int dib809x_tuner_attach(struct dvb_usb_adapter *adap) |
1509 | { | 1546 | { |
1510 | struct dib0700_adapter_state *st = adap->priv; | 1547 | struct dib0700_adapter_state *st = adap->priv; |
1511 | struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 1548 | struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
1512 | 1549 | ||
1513 | if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL) | 1550 | if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL) |
1514 | return -ENODEV; | 1551 | return -ENODEV; |
1515 | 1552 | ||
1516 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | 1553 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; |
1517 | adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override; | 1554 | adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override; |
1518 | return 0; | 1555 | return 0; |
1519 | } | 1556 | } |
1520 | 1557 | ||
1521 | static int stk809x_frontend_attach(struct dvb_usb_adapter *adap) | 1558 | static int stk809x_frontend_attach(struct dvb_usb_adapter *adap) |
@@ -1537,11 +1574,930 @@ static int stk809x_frontend_attach(struct dvb_usb_adapter *adap) | |||
1537 | 1574 | ||
1538 | dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80); | 1575 | dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80); |
1539 | 1576 | ||
1540 | adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config); | 1577 | adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); |
1578 | |||
1579 | return adap->fe == NULL ? -ENODEV : 0; | ||
1580 | } | ||
1581 | |||
1582 | static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap) | ||
1583 | { | ||
1584 | struct dib0700_adapter_state *st = adap->priv; | ||
1585 | struct i2c_adapter *tun_i2c; | ||
1586 | struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe, 1); | ||
1587 | |||
1588 | if (fe_slave) { | ||
1589 | tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1); | ||
1590 | if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL) | ||
1591 | return -ENODEV; | ||
1592 | fe_slave->dvb = adap->fe->dvb; | ||
1593 | fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override; | ||
1594 | } | ||
1595 | tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); | ||
1596 | if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL) | ||
1597 | return -ENODEV; | ||
1598 | |||
1599 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | ||
1600 | adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override; | ||
1601 | |||
1602 | return 0; | ||
1603 | } | ||
1604 | |||
1605 | static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap) | ||
1606 | { | ||
1607 | struct dvb_frontend *fe_slave; | ||
1608 | |||
1609 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | ||
1610 | msleep(20); | ||
1611 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
1612 | msleep(1000); | ||
1613 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
1614 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
1615 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
1616 | |||
1617 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
1618 | |||
1619 | dib0700_ctrl_clock(adap->dev, 72, 1); | ||
1620 | |||
1621 | msleep(20); | ||
1622 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
1623 | msleep(20); | ||
1624 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
1625 | |||
1626 | dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80); | ||
1627 | |||
1628 | adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); | ||
1629 | if (adap->fe == NULL) | ||
1630 | return -ENODEV; | ||
1631 | |||
1632 | fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]); | ||
1633 | dib8000_set_slave_frontend(adap->fe, fe_slave); | ||
1634 | |||
1635 | return fe_slave == NULL ? -ENODEV : 0; | ||
1636 | } | ||
1637 | |||
1638 | /* STK9090M */ | ||
1639 | static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) | ||
1640 | { | ||
1641 | return dib9000_fw_pid_filter(adapter->fe, index, pid, onoff); | ||
1642 | } | ||
1643 | |||
1644 | static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) | ||
1645 | { | ||
1646 | return dib9000_fw_pid_filter_ctrl(adapter->fe, onoff); | ||
1647 | } | ||
1648 | |||
1649 | static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff) | ||
1650 | { | ||
1651 | return dib9000_set_gpio(fe, 5, 0, !onoff); | ||
1652 | } | ||
1653 | |||
1654 | static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff) | ||
1655 | { | ||
1656 | return dib9000_set_gpio(fe, 0, 0, onoff); | ||
1657 | } | ||
1658 | |||
1659 | static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len) | ||
1660 | { | ||
1661 | u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 }; | ||
1662 | u8 rb[2]; | ||
1663 | struct i2c_msg msg[2] = { | ||
1664 | {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2}, | ||
1665 | {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2}, | ||
1666 | }; | ||
1667 | u8 index_data; | ||
1668 | |||
1669 | dibx000_i2c_set_speed(i2c, 250); | ||
1670 | |||
1671 | if (i2c_transfer(i2c, msg, 2) != 2) | ||
1672 | return -EIO; | ||
1673 | |||
1674 | switch (rb[0] << 8 | rb[1]) { | ||
1675 | case 0: | ||
1676 | deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n"); | ||
1677 | return -EIO; | ||
1678 | case 1: | ||
1679 | deb_info("Found DiB0170 rev2"); | ||
1680 | break; | ||
1681 | case 2: | ||
1682 | deb_info("Found DiB0190 rev2"); | ||
1683 | break; | ||
1684 | default: | ||
1685 | deb_info("DiB01x0 not found"); | ||
1686 | return -EIO; | ||
1687 | } | ||
1688 | |||
1689 | for (index_data = 0; index_data < len; index_data += 2) { | ||
1690 | wb[2] = (data[index_data + 1] >> 8) & 0xff; | ||
1691 | wb[3] = (data[index_data + 1]) & 0xff; | ||
1692 | |||
1693 | if (data[index_data] == 0) { | ||
1694 | wb[0] = (data[index_data] >> 8) & 0xff; | ||
1695 | wb[1] = (data[index_data]) & 0xff; | ||
1696 | msg[0].len = 2; | ||
1697 | if (i2c_transfer(i2c, msg, 2) != 2) | ||
1698 | return -EIO; | ||
1699 | wb[2] |= rb[0]; | ||
1700 | wb[3] |= rb[1] & ~(3 << 4); | ||
1701 | } | ||
1702 | |||
1703 | wb[0] = (data[index_data] >> 8)&0xff; | ||
1704 | wb[1] = (data[index_data])&0xff; | ||
1705 | msg[0].len = 4; | ||
1706 | if (i2c_transfer(i2c, &msg[0], 1) != 1) | ||
1707 | return -EIO; | ||
1708 | } | ||
1709 | return 0; | ||
1710 | } | ||
1711 | |||
1712 | static struct dib9000_config stk9090m_config = { | ||
1713 | .output_mpeg2_in_188_bytes = 1, | ||
1714 | .output_mode = OUTMODE_MPEG2_FIFO, | ||
1715 | .vcxo_timer = 279620, | ||
1716 | .timing_frequency = 20452225, | ||
1717 | .demod_clock_khz = 60000, | ||
1718 | .xtal_clock_khz = 30000, | ||
1719 | .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), | ||
1720 | .subband = { | ||
1721 | 2, | ||
1722 | { | ||
1723 | { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */ | ||
1724 | { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */ | ||
1725 | { 0 }, | ||
1726 | }, | ||
1727 | }, | ||
1728 | .gpio_function = { | ||
1729 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 }, | ||
1730 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 }, | ||
1731 | }, | ||
1732 | }; | ||
1733 | |||
1734 | static struct dib9000_config nim9090md_config[2] = { | ||
1735 | { | ||
1736 | .output_mpeg2_in_188_bytes = 1, | ||
1737 | .output_mode = OUTMODE_MPEG2_FIFO, | ||
1738 | .vcxo_timer = 279620, | ||
1739 | .timing_frequency = 20452225, | ||
1740 | .demod_clock_khz = 60000, | ||
1741 | .xtal_clock_khz = 30000, | ||
1742 | .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), | ||
1743 | }, { | ||
1744 | .output_mpeg2_in_188_bytes = 1, | ||
1745 | .output_mode = OUTMODE_DIVERSITY, | ||
1746 | .vcxo_timer = 279620, | ||
1747 | .timing_frequency = 20452225, | ||
1748 | .demod_clock_khz = 60000, | ||
1749 | .xtal_clock_khz = 30000, | ||
1750 | .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), | ||
1751 | .subband = { | ||
1752 | 2, | ||
1753 | { | ||
1754 | { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */ | ||
1755 | { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */ | ||
1756 | { 0 }, | ||
1757 | }, | ||
1758 | }, | ||
1759 | .gpio_function = { | ||
1760 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 }, | ||
1761 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 }, | ||
1762 | }, | ||
1763 | } | ||
1764 | }; | ||
1765 | |||
1766 | static struct dib0090_config dib9090_dib0090_config = { | ||
1767 | .io.pll_bypass = 0, | ||
1768 | .io.pll_range = 1, | ||
1769 | .io.pll_prediv = 1, | ||
1770 | .io.pll_loopdiv = 8, | ||
1771 | .io.adc_clock_ratio = 8, | ||
1772 | .io.pll_int_loop_filt = 0, | ||
1773 | .io.clock_khz = 30000, | ||
1774 | .reset = dib90x0_tuner_reset, | ||
1775 | .sleep = dib90x0_tuner_sleep, | ||
1776 | .clkouttobamse = 0, | ||
1777 | .analog_output = 0, | ||
1778 | .use_pwm_agc = 0, | ||
1779 | .clkoutdrive = 0, | ||
1780 | .freq_offset_khz_uhf = 0, | ||
1781 | .freq_offset_khz_vhf = 0, | ||
1782 | }; | ||
1783 | |||
1784 | static struct dib0090_config nim9090md_dib0090_config[2] = { | ||
1785 | { | ||
1786 | .io.pll_bypass = 0, | ||
1787 | .io.pll_range = 1, | ||
1788 | .io.pll_prediv = 1, | ||
1789 | .io.pll_loopdiv = 8, | ||
1790 | .io.adc_clock_ratio = 8, | ||
1791 | .io.pll_int_loop_filt = 0, | ||
1792 | .io.clock_khz = 30000, | ||
1793 | .reset = dib90x0_tuner_reset, | ||
1794 | .sleep = dib90x0_tuner_sleep, | ||
1795 | .clkouttobamse = 1, | ||
1796 | .analog_output = 0, | ||
1797 | .use_pwm_agc = 0, | ||
1798 | .clkoutdrive = 0, | ||
1799 | .freq_offset_khz_uhf = 0, | ||
1800 | .freq_offset_khz_vhf = 0, | ||
1801 | }, { | ||
1802 | .io.pll_bypass = 0, | ||
1803 | .io.pll_range = 1, | ||
1804 | .io.pll_prediv = 1, | ||
1805 | .io.pll_loopdiv = 8, | ||
1806 | .io.adc_clock_ratio = 8, | ||
1807 | .io.pll_int_loop_filt = 0, | ||
1808 | .io.clock_khz = 30000, | ||
1809 | .reset = dib90x0_tuner_reset, | ||
1810 | .sleep = dib90x0_tuner_sleep, | ||
1811 | .clkouttobamse = 0, | ||
1812 | .analog_output = 0, | ||
1813 | .use_pwm_agc = 0, | ||
1814 | .clkoutdrive = 0, | ||
1815 | .freq_offset_khz_uhf = 0, | ||
1816 | .freq_offset_khz_vhf = 0, | ||
1817 | } | ||
1818 | }; | ||
1819 | |||
1820 | |||
1821 | static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap) | ||
1822 | { | ||
1823 | struct dib0700_adapter_state *state = adap->priv; | ||
1824 | struct dib0700_state *st = adap->dev->priv; | ||
1825 | u32 fw_version; | ||
1826 | |||
1827 | /* Make use of the new i2c functions from FW 1.20 */ | ||
1828 | dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); | ||
1829 | if (fw_version >= 0x10200) | ||
1830 | st->fw_use_new_i2c_api = 1; | ||
1831 | dib0700_set_i2c_speed(adap->dev, 340); | ||
1832 | |||
1833 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
1834 | msleep(20); | ||
1835 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
1836 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
1837 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
1838 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
1839 | |||
1840 | dib0700_ctrl_clock(adap->dev, 72, 1); | ||
1841 | |||
1842 | msleep(20); | ||
1843 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
1844 | msleep(20); | ||
1845 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
1846 | |||
1847 | dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80); | ||
1848 | |||
1849 | if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { | ||
1850 | deb_info("%s: Upload failed. (file not found?)\n", __func__); | ||
1851 | return -ENODEV; | ||
1852 | } else { | ||
1853 | deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size); | ||
1854 | } | ||
1855 | stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size; | ||
1856 | stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data; | ||
1857 | |||
1858 | adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config); | ||
1859 | |||
1860 | return adap->fe == NULL ? -ENODEV : 0; | ||
1861 | } | ||
1862 | |||
1863 | static int dib9090_tuner_attach(struct dvb_usb_adapter *adap) | ||
1864 | { | ||
1865 | struct dib0700_adapter_state *state = adap->priv; | ||
1866 | struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe); | ||
1867 | u16 data_dib190[10] = { | ||
1868 | 1, 0x1374, | ||
1869 | 2, 0x01a2, | ||
1870 | 7, 0x0020, | ||
1871 | 0, 0x00ef, | ||
1872 | 8, 0x0486, | ||
1873 | }; | ||
1874 | |||
1875 | if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &dib9090_dib0090_config) == NULL) | ||
1876 | return -ENODEV; | ||
1877 | i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); | ||
1878 | if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0) | ||
1879 | return -ENODEV; | ||
1880 | dib0700_set_i2c_speed(adap->dev, 2000); | ||
1881 | if (dib9000_firmware_post_pll_init(adap->fe) < 0) | ||
1882 | return -ENODEV; | ||
1883 | release_firmware(state->frontend_firmware); | ||
1884 | return 0; | ||
1885 | } | ||
1886 | |||
1887 | static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap) | ||
1888 | { | ||
1889 | struct dib0700_adapter_state *state = adap->priv; | ||
1890 | struct dib0700_state *st = adap->dev->priv; | ||
1891 | struct i2c_adapter *i2c; | ||
1892 | struct dvb_frontend *fe_slave; | ||
1893 | u32 fw_version; | ||
1894 | |||
1895 | /* Make use of the new i2c functions from FW 1.20 */ | ||
1896 | dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); | ||
1897 | if (fw_version >= 0x10200) | ||
1898 | st->fw_use_new_i2c_api = 1; | ||
1899 | dib0700_set_i2c_speed(adap->dev, 340); | ||
1900 | |||
1901 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
1902 | msleep(20); | ||
1903 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
1904 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
1905 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
1906 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
1907 | |||
1908 | dib0700_ctrl_clock(adap->dev, 72, 1); | ||
1909 | |||
1910 | msleep(20); | ||
1911 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
1912 | msleep(20); | ||
1913 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
1914 | |||
1915 | if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { | ||
1916 | deb_info("%s: Upload failed. (file not found?)\n", __func__); | ||
1917 | return -EIO; | ||
1918 | } else { | ||
1919 | deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size); | ||
1920 | } | ||
1921 | nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size; | ||
1922 | nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data; | ||
1923 | nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size; | ||
1924 | nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data; | ||
1925 | |||
1926 | dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80); | ||
1927 | adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]); | ||
1928 | |||
1929 | if (adap->fe == NULL) | ||
1930 | return -ENODEV; | ||
1931 | |||
1932 | i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0); | ||
1933 | dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82); | ||
1934 | |||
1935 | fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]); | ||
1936 | dib9000_set_slave_frontend(adap->fe, fe_slave); | ||
1937 | |||
1938 | return fe_slave == NULL ? -ENODEV : 0; | ||
1939 | } | ||
1940 | |||
1941 | static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap) | ||
1942 | { | ||
1943 | struct dib0700_adapter_state *state = adap->priv; | ||
1944 | struct i2c_adapter *i2c; | ||
1945 | struct dvb_frontend *fe_slave; | ||
1946 | u16 data_dib190[10] = { | ||
1947 | 1, 0x5374, | ||
1948 | 2, 0x01ae, | ||
1949 | 7, 0x0020, | ||
1950 | 0, 0x00ef, | ||
1951 | 8, 0x0406, | ||
1952 | }; | ||
1953 | i2c = dib9000_get_tuner_interface(adap->fe); | ||
1954 | if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &nim9090md_dib0090_config[0]) == NULL) | ||
1955 | return -ENODEV; | ||
1956 | i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); | ||
1957 | if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0) | ||
1958 | return -ENODEV; | ||
1959 | dib0700_set_i2c_speed(adap->dev, 2000); | ||
1960 | if (dib9000_firmware_post_pll_init(adap->fe) < 0) | ||
1961 | return -ENODEV; | ||
1962 | |||
1963 | fe_slave = dib9000_get_slave_frontend(adap->fe, 1); | ||
1964 | if (fe_slave != NULL) { | ||
1965 | i2c = dib9000_get_component_bus_interface(adap->fe); | ||
1966 | dib9000_set_i2c_adapter(fe_slave, i2c); | ||
1967 | |||
1968 | i2c = dib9000_get_tuner_interface(fe_slave); | ||
1969 | if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL) | ||
1970 | return -ENODEV; | ||
1971 | fe_slave->dvb = adap->fe->dvb; | ||
1972 | dib9000_fw_set_component_bus_speed(adap->fe, 2000); | ||
1973 | if (dib9000_firmware_post_pll_init(fe_slave) < 0) | ||
1974 | return -ENODEV; | ||
1975 | } | ||
1976 | release_firmware(state->frontend_firmware); | ||
1977 | |||
1978 | return 0; | ||
1979 | } | ||
1980 | |||
1981 | /* NIM7090 */ | ||
1982 | struct dib7090p_best_adc { | ||
1983 | u32 timf; | ||
1984 | u32 pll_loopdiv; | ||
1985 | u32 pll_prediv; | ||
1986 | }; | ||
1987 | |||
1988 | static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc) | ||
1989 | { | ||
1990 | u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1; | ||
1991 | |||
1992 | u16 xtal = 12000; | ||
1993 | u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */ | ||
1994 | u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */ | ||
1995 | u32 fdem_max = 76000; | ||
1996 | u32 fdem_min = 69500; | ||
1997 | u32 fcp = 0, fs = 0, fdem = 0; | ||
1998 | u32 harmonic_id = 0; | ||
1999 | |||
2000 | adc->pll_loopdiv = loopdiv; | ||
2001 | adc->pll_prediv = prediv; | ||
2002 | adc->timf = 0; | ||
2003 | |||
2004 | deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min); | ||
2005 | |||
2006 | /* Find Min and Max prediv */ | ||
2007 | while ((xtal/max_prediv) >= fcp_min) | ||
2008 | max_prediv++; | ||
2009 | |||
2010 | max_prediv--; | ||
2011 | min_prediv = max_prediv; | ||
2012 | while ((xtal/min_prediv) <= fcp_max) { | ||
2013 | min_prediv--; | ||
2014 | if (min_prediv == 1) | ||
2015 | break; | ||
2016 | } | ||
2017 | deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv); | ||
2018 | |||
2019 | min_prediv = 2; | ||
2020 | |||
2021 | for (prediv = min_prediv ; prediv < max_prediv; prediv++) { | ||
2022 | fcp = xtal / prediv; | ||
2023 | if (fcp > fcp_min && fcp < fcp_max) { | ||
2024 | for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) { | ||
2025 | fdem = ((xtal/prediv) * loopdiv); | ||
2026 | fs = fdem / 4; | ||
2027 | /* test min/max system restrictions */ | ||
2028 | |||
2029 | if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) { | ||
2030 | spur = 0; | ||
2031 | /* test fs harmonics positions */ | ||
2032 | for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) { | ||
2033 | if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) && ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) { | ||
2034 | spur = 1; | ||
2035 | break; | ||
2036 | } | ||
2037 | } | ||
2038 | |||
2039 | if (!spur) { | ||
2040 | adc->pll_loopdiv = loopdiv; | ||
2041 | adc->pll_prediv = prediv; | ||
2042 | adc->timf = 2396745143UL/fdem*(1 << 9); | ||
2043 | adc->timf += ((2396745143UL%fdem) << 9)/fdem; | ||
2044 | deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf); | ||
2045 | break; | ||
2046 | } | ||
2047 | } | ||
2048 | } | ||
2049 | } | ||
2050 | if (!spur) | ||
2051 | break; | ||
2052 | } | ||
2053 | |||
2054 | |||
2055 | if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0) | ||
2056 | return -EINVAL; | ||
2057 | else | ||
2058 | return 0; | ||
2059 | } | ||
2060 | |||
2061 | static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) | ||
2062 | { | ||
2063 | struct dvb_usb_adapter *adap = fe->dvb->priv; | ||
2064 | struct dib0700_adapter_state *state = adap->priv; | ||
2065 | struct dibx000_bandwidth_config pll; | ||
2066 | u16 target; | ||
2067 | struct dib7090p_best_adc adc; | ||
2068 | int ret; | ||
2069 | |||
2070 | ret = state->set_param_save(fe, fep); | ||
2071 | if (ret < 0) | ||
2072 | return ret; | ||
2073 | |||
2074 | memset(&pll, 0, sizeof(struct dibx000_bandwidth_config)); | ||
2075 | dib0090_pwm_gain_reset(fe); | ||
2076 | target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2; | ||
2077 | dib7000p_set_wbd_ref(fe, target); | ||
2078 | |||
2079 | if (dib7090p_get_best_sampling(fe, &adc) == 0) { | ||
2080 | pll.pll_ratio = adc.pll_loopdiv; | ||
2081 | pll.pll_prediv = adc.pll_prediv; | ||
2082 | |||
2083 | dib7000p_update_pll(fe, &pll); | ||
2084 | dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf); | ||
2085 | } | ||
2086 | return 0; | ||
2087 | } | ||
2088 | |||
2089 | static struct dib0090_wbd_slope dib7090_wbd_table[] = { | ||
2090 | { 380, 81, 850, 64, 540, 4}, | ||
2091 | { 860, 51, 866, 21, 375, 4}, | ||
2092 | {1700, 0, 250, 0, 100, 6}, | ||
2093 | {2600, 0, 250, 0, 100, 6}, | ||
2094 | { 0xFFFF, 0, 0, 0, 0, 0}, | ||
2095 | }; | ||
2096 | |||
2097 | struct dibx000_agc_config dib7090_agc_config[2] = { | ||
2098 | { | ||
2099 | .band_caps = BAND_UHF, | ||
2100 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, | ||
2101 | * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | ||
2102 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | ||
2103 | |||
2104 | .inv_gain = 687, | ||
2105 | .time_stabiliz = 10, | ||
2106 | |||
2107 | .alpha_level = 0, | ||
2108 | .thlock = 118, | ||
2109 | |||
2110 | .wbd_inv = 0, | ||
2111 | .wbd_ref = 1200, | ||
2112 | .wbd_sel = 3, | ||
2113 | .wbd_alpha = 5, | ||
2114 | |||
2115 | .agc1_max = 65535, | ||
2116 | .agc1_min = 0, | ||
2117 | |||
2118 | .agc2_max = 65535, | ||
2119 | .agc2_min = 0, | ||
2120 | |||
2121 | .agc1_pt1 = 0, | ||
2122 | .agc1_pt2 = 32, | ||
2123 | .agc1_pt3 = 114, | ||
2124 | .agc1_slope1 = 143, | ||
2125 | .agc1_slope2 = 144, | ||
2126 | .agc2_pt1 = 114, | ||
2127 | .agc2_pt2 = 227, | ||
2128 | .agc2_slope1 = 116, | ||
2129 | .agc2_slope2 = 117, | ||
2130 | |||
2131 | .alpha_mant = 18, | ||
2132 | .alpha_exp = 0, | ||
2133 | .beta_mant = 20, | ||
2134 | .beta_exp = 59, | ||
2135 | |||
2136 | .perform_agc_softsplit = 0, | ||
2137 | } , { | ||
2138 | .band_caps = BAND_FM | BAND_VHF | BAND_CBAND, | ||
2139 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, | ||
2140 | * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | ||
2141 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | ||
2142 | |||
2143 | .inv_gain = 732, | ||
2144 | .time_stabiliz = 10, | ||
2145 | |||
2146 | .alpha_level = 0, | ||
2147 | .thlock = 118, | ||
2148 | |||
2149 | .wbd_inv = 0, | ||
2150 | .wbd_ref = 1200, | ||
2151 | .wbd_sel = 3, | ||
2152 | .wbd_alpha = 5, | ||
2153 | |||
2154 | .agc1_max = 65535, | ||
2155 | .agc1_min = 0, | ||
2156 | |||
2157 | .agc2_max = 65535, | ||
2158 | .agc2_min = 0, | ||
2159 | |||
2160 | .agc1_pt1 = 0, | ||
2161 | .agc1_pt2 = 0, | ||
2162 | .agc1_pt3 = 98, | ||
2163 | .agc1_slope1 = 0, | ||
2164 | .agc1_slope2 = 167, | ||
2165 | .agc2_pt1 = 98, | ||
2166 | .agc2_pt2 = 255, | ||
2167 | .agc2_slope1 = 104, | ||
2168 | .agc2_slope2 = 0, | ||
2169 | |||
2170 | .alpha_mant = 18, | ||
2171 | .alpha_exp = 0, | ||
2172 | .beta_mant = 20, | ||
2173 | .beta_exp = 59, | ||
2174 | |||
2175 | .perform_agc_softsplit = 0, | ||
2176 | } | ||
2177 | }; | ||
2178 | |||
2179 | static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = { | ||
2180 | 60000, 15000, | ||
2181 | 1, 5, 0, 0, 0, | ||
2182 | 0, 0, 1, 1, 2, | ||
2183 | (3 << 14) | (1 << 12) | (524 << 0), | ||
2184 | (0 << 25) | 0, | ||
2185 | 20452225, | ||
2186 | 15000000, | ||
2187 | }; | ||
2188 | |||
2189 | static struct dib7000p_config nim7090_dib7000p_config = { | ||
2190 | .output_mpeg2_in_188_bytes = 1, | ||
2191 | .hostbus_diversity = 1, | ||
2192 | .tuner_is_baseband = 1, | ||
2193 | .update_lna = NULL, | ||
2194 | |||
2195 | .agc_config_count = 2, | ||
2196 | .agc = dib7090_agc_config, | ||
2197 | |||
2198 | .bw = &dib7090_clock_config_12_mhz, | ||
2199 | |||
2200 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | ||
2201 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | ||
2202 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
2203 | |||
2204 | .pwm_freq_div = 0, | ||
2205 | |||
2206 | .agc_control = dib7090_agc_restart, | ||
2207 | |||
2208 | .spur_protect = 0, | ||
2209 | .disable_sample_and_hold = 0, | ||
2210 | .enable_current_mirror = 0, | ||
2211 | .diversity_delay = 0, | ||
2212 | |||
2213 | .output_mode = OUTMODE_MPEG2_FIFO, | ||
2214 | .enMpegOutput = 1, | ||
2215 | }; | ||
2216 | |||
2217 | static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = { | ||
2218 | { | ||
2219 | .output_mpeg2_in_188_bytes = 1, | ||
2220 | .hostbus_diversity = 1, | ||
2221 | .tuner_is_baseband = 1, | ||
2222 | .update_lna = NULL, | ||
2223 | |||
2224 | .agc_config_count = 2, | ||
2225 | .agc = dib7090_agc_config, | ||
2226 | |||
2227 | .bw = &dib7090_clock_config_12_mhz, | ||
2228 | |||
2229 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | ||
2230 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | ||
2231 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
2232 | |||
2233 | .pwm_freq_div = 0, | ||
2234 | |||
2235 | .agc_control = dib7090_agc_restart, | ||
2236 | |||
2237 | .spur_protect = 0, | ||
2238 | .disable_sample_and_hold = 0, | ||
2239 | .enable_current_mirror = 0, | ||
2240 | .diversity_delay = 0, | ||
2241 | |||
2242 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, | ||
2243 | .default_i2c_addr = 0x90, | ||
2244 | .enMpegOutput = 1, | ||
2245 | }, { | ||
2246 | .output_mpeg2_in_188_bytes = 1, | ||
2247 | .hostbus_diversity = 1, | ||
2248 | .tuner_is_baseband = 1, | ||
2249 | .update_lna = NULL, | ||
2250 | |||
2251 | .agc_config_count = 2, | ||
2252 | .agc = dib7090_agc_config, | ||
2253 | |||
2254 | .bw = &dib7090_clock_config_12_mhz, | ||
2255 | |||
2256 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | ||
2257 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | ||
2258 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
2259 | |||
2260 | .pwm_freq_div = 0, | ||
2261 | |||
2262 | .agc_control = dib7090_agc_restart, | ||
2263 | |||
2264 | .spur_protect = 0, | ||
2265 | .disable_sample_and_hold = 0, | ||
2266 | .enable_current_mirror = 0, | ||
2267 | .diversity_delay = 0, | ||
2268 | |||
2269 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, | ||
2270 | .default_i2c_addr = 0x92, | ||
2271 | .enMpegOutput = 0, | ||
2272 | } | ||
2273 | }; | ||
2274 | |||
2275 | static const struct dib0090_config nim7090_dib0090_config = { | ||
2276 | .io.clock_khz = 12000, | ||
2277 | .io.pll_bypass = 0, | ||
2278 | .io.pll_range = 0, | ||
2279 | .io.pll_prediv = 3, | ||
2280 | .io.pll_loopdiv = 6, | ||
2281 | .io.adc_clock_ratio = 0, | ||
2282 | .io.pll_int_loop_filt = 0, | ||
2283 | .reset = dib7090_tuner_sleep, | ||
2284 | .sleep = dib7090_tuner_sleep, | ||
2285 | |||
2286 | .freq_offset_khz_uhf = 0, | ||
2287 | .freq_offset_khz_vhf = 0, | ||
2288 | |||
2289 | .get_adc_power = dib7090_get_adc_power, | ||
2290 | |||
2291 | .clkouttobamse = 1, | ||
2292 | .analog_output = 0, | ||
2293 | |||
2294 | .wbd_vhf_offset = 0, | ||
2295 | .wbd_cband_offset = 0, | ||
2296 | .use_pwm_agc = 1, | ||
2297 | .clkoutdrive = 0, | ||
2298 | |||
2299 | .fref_clock_ratio = 0, | ||
2300 | |||
2301 | .wbd = dib7090_wbd_table, | ||
2302 | |||
2303 | .ls_cfg_pad_drv = 0, | ||
2304 | .data_tx_drv = 0, | ||
2305 | .low_if = NULL, | ||
2306 | .in_soc = 1, | ||
2307 | }; | ||
2308 | |||
2309 | static const struct dib0090_config tfe7090pvr_dib0090_config[2] = { | ||
2310 | { | ||
2311 | .io.clock_khz = 12000, | ||
2312 | .io.pll_bypass = 0, | ||
2313 | .io.pll_range = 0, | ||
2314 | .io.pll_prediv = 3, | ||
2315 | .io.pll_loopdiv = 6, | ||
2316 | .io.adc_clock_ratio = 0, | ||
2317 | .io.pll_int_loop_filt = 0, | ||
2318 | .reset = dib7090_tuner_sleep, | ||
2319 | .sleep = dib7090_tuner_sleep, | ||
2320 | |||
2321 | .freq_offset_khz_uhf = 50, | ||
2322 | .freq_offset_khz_vhf = 70, | ||
2323 | |||
2324 | .get_adc_power = dib7090_get_adc_power, | ||
2325 | |||
2326 | .clkouttobamse = 1, | ||
2327 | .analog_output = 0, | ||
2328 | |||
2329 | .wbd_vhf_offset = 0, | ||
2330 | .wbd_cband_offset = 0, | ||
2331 | .use_pwm_agc = 1, | ||
2332 | .clkoutdrive = 0, | ||
2333 | |||
2334 | .fref_clock_ratio = 0, | ||
2335 | |||
2336 | .wbd = dib7090_wbd_table, | ||
2337 | |||
2338 | .ls_cfg_pad_drv = 0, | ||
2339 | .data_tx_drv = 0, | ||
2340 | .low_if = NULL, | ||
2341 | .in_soc = 1, | ||
2342 | }, { | ||
2343 | .io.clock_khz = 12000, | ||
2344 | .io.pll_bypass = 0, | ||
2345 | .io.pll_range = 0, | ||
2346 | .io.pll_prediv = 3, | ||
2347 | .io.pll_loopdiv = 6, | ||
2348 | .io.adc_clock_ratio = 0, | ||
2349 | .io.pll_int_loop_filt = 0, | ||
2350 | .reset = dib7090_tuner_sleep, | ||
2351 | .sleep = dib7090_tuner_sleep, | ||
2352 | |||
2353 | .freq_offset_khz_uhf = -50, | ||
2354 | .freq_offset_khz_vhf = -70, | ||
2355 | |||
2356 | .get_adc_power = dib7090_get_adc_power, | ||
2357 | |||
2358 | .clkouttobamse = 1, | ||
2359 | .analog_output = 0, | ||
2360 | |||
2361 | .wbd_vhf_offset = 0, | ||
2362 | .wbd_cband_offset = 0, | ||
2363 | .use_pwm_agc = 1, | ||
2364 | .clkoutdrive = 0, | ||
2365 | |||
2366 | .fref_clock_ratio = 0, | ||
2367 | |||
2368 | .wbd = dib7090_wbd_table, | ||
2369 | |||
2370 | .ls_cfg_pad_drv = 0, | ||
2371 | .data_tx_drv = 0, | ||
2372 | .low_if = NULL, | ||
2373 | .in_soc = 1, | ||
2374 | } | ||
2375 | }; | ||
2376 | |||
2377 | static int nim7090_frontend_attach(struct dvb_usb_adapter *adap) | ||
2378 | { | ||
2379 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
2380 | msleep(20); | ||
2381 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
2382 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
2383 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
2384 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
2385 | |||
2386 | msleep(20); | ||
2387 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
2388 | msleep(20); | ||
2389 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
2390 | |||
2391 | if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) { | ||
2392 | err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__); | ||
2393 | return -ENODEV; | ||
2394 | } | ||
2395 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config); | ||
1541 | 2396 | ||
1542 | return adap->fe == NULL ? -ENODEV : 0; | 2397 | return adap->fe == NULL ? -ENODEV : 0; |
1543 | } | 2398 | } |
1544 | 2399 | ||
2400 | static int nim7090_tuner_attach(struct dvb_usb_adapter *adap) | ||
2401 | { | ||
2402 | struct dib0700_adapter_state *st = adap->priv; | ||
2403 | struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe); | ||
2404 | |||
2405 | if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &nim7090_dib0090_config) == NULL) | ||
2406 | return -ENODEV; | ||
2407 | |||
2408 | dib7000p_set_gpio(adap->fe, 8, 0, 1); | ||
2409 | |||
2410 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | ||
2411 | adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup; | ||
2412 | return 0; | ||
2413 | } | ||
2414 | |||
2415 | static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap) | ||
2416 | { | ||
2417 | struct dib0700_state *st = adap->dev->priv; | ||
2418 | |||
2419 | /* The TFE7090 requires the dib0700 to not be in master mode */ | ||
2420 | st->disable_streaming_master_mode = 1; | ||
2421 | |||
2422 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
2423 | msleep(20); | ||
2424 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
2425 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
2426 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
2427 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
2428 | |||
2429 | msleep(20); | ||
2430 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
2431 | msleep(20); | ||
2432 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
2433 | |||
2434 | /* initialize IC 0 */ | ||
2435 | if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) { | ||
2436 | err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__); | ||
2437 | return -ENODEV; | ||
2438 | } | ||
2439 | |||
2440 | dib0700_set_i2c_speed(adap->dev, 340); | ||
2441 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); | ||
2442 | if (adap->fe == NULL) | ||
2443 | return -ENODEV; | ||
2444 | |||
2445 | dib7090_slave_reset(adap->fe); | ||
2446 | |||
2447 | return 0; | ||
2448 | } | ||
2449 | |||
2450 | static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap) | ||
2451 | { | ||
2452 | struct i2c_adapter *i2c; | ||
2453 | |||
2454 | if (adap->dev->adapter[0].fe == NULL) { | ||
2455 | err("the master dib7090 has to be initialized first"); | ||
2456 | return -ENODEV; /* the master device has not been initialized */ | ||
2457 | } | ||
2458 | |||
2459 | i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1); | ||
2460 | if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) { | ||
2461 | err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__); | ||
2462 | return -ENODEV; | ||
2463 | } | ||
2464 | |||
2465 | adap->fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]); | ||
2466 | dib0700_set_i2c_speed(adap->dev, 200); | ||
2467 | |||
2468 | return adap->fe == NULL ? -ENODEV : 0; | ||
2469 | } | ||
2470 | |||
2471 | static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap) | ||
2472 | { | ||
2473 | struct dib0700_adapter_state *st = adap->priv; | ||
2474 | struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe); | ||
2475 | |||
2476 | if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL) | ||
2477 | return -ENODEV; | ||
2478 | |||
2479 | dib7000p_set_gpio(adap->fe, 8, 0, 1); | ||
2480 | |||
2481 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | ||
2482 | adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup; | ||
2483 | return 0; | ||
2484 | } | ||
2485 | |||
2486 | static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap) | ||
2487 | { | ||
2488 | struct dib0700_adapter_state *st = adap->priv; | ||
2489 | struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe); | ||
2490 | |||
2491 | if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL) | ||
2492 | return -ENODEV; | ||
2493 | |||
2494 | dib7000p_set_gpio(adap->fe, 8, 0, 1); | ||
2495 | |||
2496 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | ||
2497 | adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup; | ||
2498 | return 0; | ||
2499 | } | ||
2500 | |||
1545 | /* STK7070PD */ | 2501 | /* STK7070PD */ |
1546 | static struct dib7000p_config stk7070pd_dib7000p_config[2] = { | 2502 | static struct dib7000p_config stk7070pd_dib7000p_config[2] = { |
1547 | { | 2503 | { |
@@ -1839,6 +2795,13 @@ struct usb_device_id dib0700_usb_id_table[] = { | |||
1839 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, | 2795 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, |
1840 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) }, | 2796 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) }, |
1841 | { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) }, | 2797 | { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) }, |
2798 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) }, | ||
2799 | /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) }, | ||
2800 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) }, | ||
2801 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) }, | ||
2802 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) }, | ||
2803 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) }, | ||
2804 | /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) }, | ||
1842 | { 0 } /* Terminating entry */ | 2805 | { 0 } /* Terminating entry */ |
1843 | }; | 2806 | }; |
1844 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); | 2807 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); |
@@ -1875,8 +2838,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1875 | { | 2838 | { |
1876 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 2839 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
1877 | .pid_filter_count = 32, | 2840 | .pid_filter_count = 32, |
1878 | .pid_filter = stk70x0p_pid_filter, | 2841 | .pid_filter = stk7700p_pid_filter, |
1879 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 2842 | .pid_filter_ctrl = stk7700p_pid_filter_ctrl, |
1880 | .frontend_attach = stk7700p_frontend_attach, | 2843 | .frontend_attach = stk7700p_frontend_attach, |
1881 | .tuner_attach = stk7700p_tuner_attach, | 2844 | .tuner_attach = stk7700p_tuner_attach, |
1882 | 2845 | ||
@@ -1924,12 +2887,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1924 | .rc_interval = DEFAULT_RC_INTERVAL, | 2887 | .rc_interval = DEFAULT_RC_INTERVAL, |
1925 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 2888 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
1926 | .rc_query = dib0700_rc_query_old_firmware, | 2889 | .rc_query = dib0700_rc_query_old_firmware, |
1927 | .rc_props = { | 2890 | .allowed_protos = RC_TYPE_RC5 | |
1928 | .allowed_protos = IR_TYPE_RC5 | | 2891 | RC_TYPE_RC6 | |
1929 | IR_TYPE_RC6 | | 2892 | RC_TYPE_NEC, |
1930 | IR_TYPE_NEC, | 2893 | .change_protocol = dib0700_change_protocol, |
1931 | .change_protocol = dib0700_change_protocol, | ||
1932 | }, | ||
1933 | }, | 2894 | }, |
1934 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2895 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
1935 | 2896 | ||
@@ -1960,12 +2921,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1960 | .rc_interval = DEFAULT_RC_INTERVAL, | 2921 | .rc_interval = DEFAULT_RC_INTERVAL, |
1961 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 2922 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
1962 | .rc_query = dib0700_rc_query_old_firmware, | 2923 | .rc_query = dib0700_rc_query_old_firmware, |
1963 | .rc_props = { | 2924 | .allowed_protos = RC_TYPE_RC5 | |
1964 | .allowed_protos = IR_TYPE_RC5 | | 2925 | RC_TYPE_RC6 | |
1965 | IR_TYPE_RC6 | | 2926 | RC_TYPE_NEC, |
1966 | IR_TYPE_NEC, | 2927 | .change_protocol = dib0700_change_protocol, |
1967 | .change_protocol = dib0700_change_protocol, | ||
1968 | }, | ||
1969 | }, | 2928 | }, |
1970 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2929 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
1971 | 2930 | ||
@@ -2021,12 +2980,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2021 | .rc_interval = DEFAULT_RC_INTERVAL, | 2980 | .rc_interval = DEFAULT_RC_INTERVAL, |
2022 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 2981 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2023 | .rc_query = dib0700_rc_query_old_firmware, | 2982 | .rc_query = dib0700_rc_query_old_firmware, |
2024 | .rc_props = { | 2983 | .allowed_protos = RC_TYPE_RC5 | |
2025 | .allowed_protos = IR_TYPE_RC5 | | 2984 | RC_TYPE_RC6 | |
2026 | IR_TYPE_RC6 | | 2985 | RC_TYPE_NEC, |
2027 | IR_TYPE_NEC, | 2986 | .change_protocol = dib0700_change_protocol, |
2028 | .change_protocol = dib0700_change_protocol, | ||
2029 | }, | ||
2030 | }, | 2987 | }, |
2031 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2988 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2032 | 2989 | ||
@@ -2065,12 +3022,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2065 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3022 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2066 | .module_name = "dib0700", | 3023 | .module_name = "dib0700", |
2067 | .rc_query = dib0700_rc_query_old_firmware, | 3024 | .rc_query = dib0700_rc_query_old_firmware, |
2068 | .rc_props = { | 3025 | .allowed_protos = RC_TYPE_RC5 | |
2069 | .allowed_protos = IR_TYPE_RC5 | | 3026 | RC_TYPE_RC6 | |
2070 | IR_TYPE_RC6 | | 3027 | RC_TYPE_NEC, |
2071 | IR_TYPE_NEC, | 3028 | .change_protocol = dib0700_change_protocol, |
2072 | .change_protocol = dib0700_change_protocol, | ||
2073 | }, | ||
2074 | }, | 3029 | }, |
2075 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3030 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2076 | 3031 | ||
@@ -2143,12 +3098,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2143 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3098 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2144 | .module_name = "dib0700", | 3099 | .module_name = "dib0700", |
2145 | .rc_query = dib0700_rc_query_old_firmware, | 3100 | .rc_query = dib0700_rc_query_old_firmware, |
2146 | .rc_props = { | 3101 | .allowed_protos = RC_TYPE_RC5 | |
2147 | .allowed_protos = IR_TYPE_RC5 | | 3102 | RC_TYPE_RC6 | |
2148 | IR_TYPE_RC6 | | 3103 | RC_TYPE_NEC, |
2149 | IR_TYPE_NEC, | 3104 | .change_protocol = dib0700_change_protocol, |
2150 | .change_protocol = dib0700_change_protocol, | ||
2151 | }, | ||
2152 | }, | 3105 | }, |
2153 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3106 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2154 | 3107 | ||
@@ -2189,12 +3142,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2189 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3142 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2190 | .module_name = "dib0700", | 3143 | .module_name = "dib0700", |
2191 | .rc_query = dib0700_rc_query_old_firmware, | 3144 | .rc_query = dib0700_rc_query_old_firmware, |
2192 | .rc_props = { | 3145 | .allowed_protos = RC_TYPE_RC5 | |
2193 | .allowed_protos = IR_TYPE_RC5 | | 3146 | RC_TYPE_RC6 | |
2194 | IR_TYPE_RC6 | | 3147 | RC_TYPE_NEC, |
2195 | IR_TYPE_NEC, | 3148 | .change_protocol = dib0700_change_protocol, |
2196 | .change_protocol = dib0700_change_protocol, | ||
2197 | }, | ||
2198 | }, | 3149 | }, |
2199 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3150 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2200 | 3151 | ||
@@ -2259,12 +3210,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2259 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3210 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2260 | .module_name = "dib0700", | 3211 | .module_name = "dib0700", |
2261 | .rc_query = dib0700_rc_query_old_firmware, | 3212 | .rc_query = dib0700_rc_query_old_firmware, |
2262 | .rc_props = { | 3213 | .allowed_protos = RC_TYPE_RC5 | |
2263 | .allowed_protos = IR_TYPE_RC5 | | 3214 | RC_TYPE_RC6 | |
2264 | IR_TYPE_RC6 | | 3215 | RC_TYPE_NEC, |
2265 | IR_TYPE_NEC, | 3216 | .change_protocol = dib0700_change_protocol, |
2266 | .change_protocol = dib0700_change_protocol, | ||
2267 | }, | ||
2268 | }, | 3217 | }, |
2269 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3218 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2270 | 3219 | ||
@@ -2308,12 +3257,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2308 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, | 3257 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
2309 | .module_name = "dib0700", | 3258 | .module_name = "dib0700", |
2310 | .rc_query = dib0700_rc_query_old_firmware, | 3259 | .rc_query = dib0700_rc_query_old_firmware, |
2311 | .rc_props = { | 3260 | .allowed_protos = RC_TYPE_RC5 | |
2312 | .allowed_protos = IR_TYPE_RC5 | | 3261 | RC_TYPE_RC6 | |
2313 | IR_TYPE_RC6 | | 3262 | RC_TYPE_NEC, |
2314 | IR_TYPE_NEC, | 3263 | .change_protocol = dib0700_change_protocol, |
2315 | .change_protocol = dib0700_change_protocol, | ||
2316 | }, | ||
2317 | }, | 3264 | }, |
2318 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3265 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2319 | 3266 | ||
@@ -2379,12 +3326,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2379 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3326 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2380 | .module_name = "dib0700", | 3327 | .module_name = "dib0700", |
2381 | .rc_query = dib0700_rc_query_old_firmware, | 3328 | .rc_query = dib0700_rc_query_old_firmware, |
2382 | .rc_props = { | 3329 | .allowed_protos = RC_TYPE_RC5 | |
2383 | .allowed_protos = IR_TYPE_RC5 | | 3330 | RC_TYPE_RC6 | |
2384 | IR_TYPE_RC6 | | 3331 | RC_TYPE_NEC, |
2385 | IR_TYPE_NEC, | 3332 | .change_protocol = dib0700_change_protocol, |
2386 | .change_protocol = dib0700_change_protocol, | ||
2387 | }, | ||
2388 | }, | 3333 | }, |
2389 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3334 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2390 | .num_adapters = 1, | 3335 | .num_adapters = 1, |
@@ -2417,12 +3362,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2417 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3362 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2418 | .module_name = "dib0700", | 3363 | .module_name = "dib0700", |
2419 | .rc_query = dib0700_rc_query_old_firmware, | 3364 | .rc_query = dib0700_rc_query_old_firmware, |
2420 | .rc_props = { | 3365 | .allowed_protos = RC_TYPE_RC5 | |
2421 | .allowed_protos = IR_TYPE_RC5 | | 3366 | RC_TYPE_RC6 | |
2422 | IR_TYPE_RC6 | | 3367 | RC_TYPE_NEC, |
2423 | IR_TYPE_NEC, | 3368 | .change_protocol = dib0700_change_protocol, |
2424 | .change_protocol = dib0700_change_protocol, | ||
2425 | }, | ||
2426 | }, | 3369 | }, |
2427 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3370 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2428 | .num_adapters = 1, | 3371 | .num_adapters = 1, |
@@ -2468,7 +3411,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2468 | }, | 3411 | }, |
2469 | }, | 3412 | }, |
2470 | 3413 | ||
2471 | .num_device_descs = 2, | 3414 | .num_device_descs = 4, |
2472 | .devices = { | 3415 | .devices = { |
2473 | { "DiBcom STK7770P reference design", | 3416 | { "DiBcom STK7770P reference design", |
2474 | { &dib0700_usb_id_table[59], NULL }, | 3417 | { &dib0700_usb_id_table[59], NULL }, |
@@ -2480,6 +3423,14 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2480 | &dib0700_usb_id_table[60], NULL}, | 3423 | &dib0700_usb_id_table[60], NULL}, |
2481 | { NULL }, | 3424 | { NULL }, |
2482 | }, | 3425 | }, |
3426 | { "TechniSat AirStar TeleStick 2", | ||
3427 | { &dib0700_usb_id_table[74], NULL }, | ||
3428 | { NULL }, | ||
3429 | }, | ||
3430 | { "Medion CTX1921 DVB-T USB", | ||
3431 | { &dib0700_usb_id_table[75], NULL }, | ||
3432 | { NULL }, | ||
3433 | }, | ||
2483 | }, | 3434 | }, |
2484 | 3435 | ||
2485 | .rc.core = { | 3436 | .rc.core = { |
@@ -2487,12 +3438,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2487 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3438 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2488 | .module_name = "dib0700", | 3439 | .module_name = "dib0700", |
2489 | .rc_query = dib0700_rc_query_old_firmware, | 3440 | .rc_query = dib0700_rc_query_old_firmware, |
2490 | .rc_props = { | 3441 | .allowed_protos = RC_TYPE_RC5 | |
2491 | .allowed_protos = IR_TYPE_RC5 | | 3442 | RC_TYPE_RC6 | |
2492 | IR_TYPE_RC6 | | 3443 | RC_TYPE_NEC, |
2493 | IR_TYPE_NEC, | 3444 | .change_protocol = dib0700_change_protocol, |
2494 | .change_protocol = dib0700_change_protocol, | ||
2495 | }, | ||
2496 | }, | 3445 | }, |
2497 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3446 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2498 | .num_adapters = 1, | 3447 | .num_adapters = 1, |
@@ -2533,12 +3482,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2533 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, | 3482 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
2534 | .module_name = "dib0700", | 3483 | .module_name = "dib0700", |
2535 | .rc_query = dib0700_rc_query_old_firmware, | 3484 | .rc_query = dib0700_rc_query_old_firmware, |
2536 | .rc_props = { | 3485 | .allowed_protos = RC_TYPE_RC5 | |
2537 | .allowed_protos = IR_TYPE_RC5 | | 3486 | RC_TYPE_RC6 | |
2538 | IR_TYPE_RC6 | | 3487 | RC_TYPE_NEC, |
2539 | IR_TYPE_NEC, | 3488 | .change_protocol = dib0700_change_protocol, |
2540 | .change_protocol = dib0700_change_protocol, | ||
2541 | }, | ||
2542 | }, | 3489 | }, |
2543 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3490 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2544 | .num_adapters = 2, | 3491 | .num_adapters = 2, |
@@ -2584,12 +3531,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2584 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3531 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2585 | .module_name = "dib0700", | 3532 | .module_name = "dib0700", |
2586 | .rc_query = dib0700_rc_query_old_firmware, | 3533 | .rc_query = dib0700_rc_query_old_firmware, |
2587 | .rc_props = { | 3534 | .allowed_protos = RC_TYPE_RC5 | |
2588 | .allowed_protos = IR_TYPE_RC5 | | 3535 | RC_TYPE_RC6 | |
2589 | IR_TYPE_RC6 | | 3536 | RC_TYPE_NEC, |
2590 | IR_TYPE_NEC, | 3537 | .change_protocol = dib0700_change_protocol, |
2591 | .change_protocol = dib0700_change_protocol, | ||
2592 | }, | ||
2593 | }, | 3538 | }, |
2594 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3539 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
2595 | .num_adapters = 1, | 3540 | .num_adapters = 1, |
@@ -2623,13 +3568,210 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2623 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3568 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
2624 | .module_name = "dib0700", | 3569 | .module_name = "dib0700", |
2625 | .rc_query = dib0700_rc_query_old_firmware, | 3570 | .rc_query = dib0700_rc_query_old_firmware, |
2626 | .rc_props = { | 3571 | .allowed_protos = RC_TYPE_RC5 | |
2627 | .allowed_protos = IR_TYPE_RC5 | | 3572 | RC_TYPE_RC6 | |
2628 | IR_TYPE_RC6 | | 3573 | RC_TYPE_NEC, |
2629 | IR_TYPE_NEC, | 3574 | .change_protocol = dib0700_change_protocol, |
2630 | .change_protocol = dib0700_change_protocol, | 3575 | }, |
3576 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
3577 | .num_adapters = 1, | ||
3578 | .adapter = { | ||
3579 | { | ||
3580 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
3581 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
3582 | .pid_filter_count = 32, | ||
3583 | .pid_filter = dib90x0_pid_filter, | ||
3584 | .pid_filter_ctrl = dib90x0_pid_filter_ctrl, | ||
3585 | .frontend_attach = stk9090m_frontend_attach, | ||
3586 | .tuner_attach = dib9090_tuner_attach, | ||
3587 | |||
3588 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
3589 | |||
3590 | .size_of_priv = | ||
3591 | sizeof(struct dib0700_adapter_state), | ||
3592 | }, | ||
3593 | }, | ||
3594 | |||
3595 | .num_device_descs = 1, | ||
3596 | .devices = { | ||
3597 | { "DiBcom STK9090M reference design", | ||
3598 | { &dib0700_usb_id_table[69], NULL }, | ||
3599 | { NULL }, | ||
3600 | }, | ||
3601 | }, | ||
3602 | |||
3603 | .rc.core = { | ||
3604 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
3605 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | ||
3606 | .module_name = "dib0700", | ||
3607 | .rc_query = dib0700_rc_query_old_firmware, | ||
3608 | .allowed_protos = RC_TYPE_RC5 | | ||
3609 | RC_TYPE_RC6 | | ||
3610 | RC_TYPE_NEC, | ||
3611 | .change_protocol = dib0700_change_protocol, | ||
3612 | }, | ||
3613 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
3614 | .num_adapters = 1, | ||
3615 | .adapter = { | ||
3616 | { | ||
3617 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
3618 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
3619 | .pid_filter_count = 32, | ||
3620 | .pid_filter = stk80xx_pid_filter, | ||
3621 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, | ||
3622 | .frontend_attach = nim8096md_frontend_attach, | ||
3623 | .tuner_attach = nim8096md_tuner_attach, | ||
3624 | |||
3625 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
3626 | |||
3627 | .size_of_priv = | ||
3628 | sizeof(struct dib0700_adapter_state), | ||
3629 | }, | ||
3630 | }, | ||
3631 | |||
3632 | .num_device_descs = 1, | ||
3633 | .devices = { | ||
3634 | { "DiBcom NIM8096MD reference design", | ||
3635 | { &dib0700_usb_id_table[70], NULL }, | ||
3636 | { NULL }, | ||
3637 | }, | ||
3638 | }, | ||
3639 | |||
3640 | .rc.core = { | ||
3641 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
3642 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | ||
3643 | .module_name = "dib0700", | ||
3644 | .rc_query = dib0700_rc_query_old_firmware, | ||
3645 | .allowed_protos = RC_TYPE_RC5 | | ||
3646 | RC_TYPE_RC6 | | ||
3647 | RC_TYPE_NEC, | ||
3648 | .change_protocol = dib0700_change_protocol, | ||
3649 | }, | ||
3650 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
3651 | .num_adapters = 1, | ||
3652 | .adapter = { | ||
3653 | { | ||
3654 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
3655 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
3656 | .pid_filter_count = 32, | ||
3657 | .pid_filter = dib90x0_pid_filter, | ||
3658 | .pid_filter_ctrl = dib90x0_pid_filter_ctrl, | ||
3659 | .frontend_attach = nim9090md_frontend_attach, | ||
3660 | .tuner_attach = nim9090md_tuner_attach, | ||
3661 | |||
3662 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
3663 | |||
3664 | .size_of_priv = | ||
3665 | sizeof(struct dib0700_adapter_state), | ||
3666 | }, | ||
3667 | }, | ||
3668 | |||
3669 | .num_device_descs = 1, | ||
3670 | .devices = { | ||
3671 | { "DiBcom NIM9090MD reference design", | ||
3672 | { &dib0700_usb_id_table[71], NULL }, | ||
3673 | { NULL }, | ||
2631 | }, | 3674 | }, |
2632 | }, | 3675 | }, |
3676 | |||
3677 | .rc.core = { | ||
3678 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
3679 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | ||
3680 | .module_name = "dib0700", | ||
3681 | .rc_query = dib0700_rc_query_old_firmware, | ||
3682 | .allowed_protos = RC_TYPE_RC5 | | ||
3683 | RC_TYPE_RC6 | | ||
3684 | RC_TYPE_NEC, | ||
3685 | .change_protocol = dib0700_change_protocol, | ||
3686 | }, | ||
3687 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
3688 | .num_adapters = 1, | ||
3689 | .adapter = { | ||
3690 | { | ||
3691 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
3692 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
3693 | .pid_filter_count = 32, | ||
3694 | .pid_filter = stk70x0p_pid_filter, | ||
3695 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | ||
3696 | .frontend_attach = nim7090_frontend_attach, | ||
3697 | .tuner_attach = nim7090_tuner_attach, | ||
3698 | |||
3699 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
3700 | |||
3701 | .size_of_priv = | ||
3702 | sizeof(struct dib0700_adapter_state), | ||
3703 | }, | ||
3704 | }, | ||
3705 | |||
3706 | .num_device_descs = 1, | ||
3707 | .devices = { | ||
3708 | { "DiBcom NIM7090 reference design", | ||
3709 | { &dib0700_usb_id_table[72], NULL }, | ||
3710 | { NULL }, | ||
3711 | }, | ||
3712 | }, | ||
3713 | |||
3714 | .rc.core = { | ||
3715 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
3716 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | ||
3717 | .module_name = "dib0700", | ||
3718 | .rc_query = dib0700_rc_query_old_firmware, | ||
3719 | .allowed_protos = RC_TYPE_RC5 | | ||
3720 | RC_TYPE_RC6 | | ||
3721 | RC_TYPE_NEC, | ||
3722 | .change_protocol = dib0700_change_protocol, | ||
3723 | }, | ||
3724 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
3725 | .num_adapters = 2, | ||
3726 | .adapter = { | ||
3727 | { | ||
3728 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
3729 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
3730 | .pid_filter_count = 32, | ||
3731 | .pid_filter = stk70x0p_pid_filter, | ||
3732 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | ||
3733 | .frontend_attach = tfe7090pvr_frontend0_attach, | ||
3734 | .tuner_attach = tfe7090pvr_tuner0_attach, | ||
3735 | |||
3736 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | ||
3737 | |||
3738 | .size_of_priv = | ||
3739 | sizeof(struct dib0700_adapter_state), | ||
3740 | }, | ||
3741 | { | ||
3742 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
3743 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
3744 | .pid_filter_count = 32, | ||
3745 | .pid_filter = stk70x0p_pid_filter, | ||
3746 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | ||
3747 | .frontend_attach = tfe7090pvr_frontend1_attach, | ||
3748 | .tuner_attach = tfe7090pvr_tuner1_attach, | ||
3749 | |||
3750 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
3751 | |||
3752 | .size_of_priv = | ||
3753 | sizeof(struct dib0700_adapter_state), | ||
3754 | }, | ||
3755 | }, | ||
3756 | |||
3757 | .num_device_descs = 1, | ||
3758 | .devices = { | ||
3759 | { "DiBcom TFE7090PVR reference design", | ||
3760 | { &dib0700_usb_id_table[73], NULL }, | ||
3761 | { NULL }, | ||
3762 | }, | ||
3763 | }, | ||
3764 | |||
3765 | .rc.core = { | ||
3766 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
3767 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | ||
3768 | .module_name = "dib0700", | ||
3769 | .rc_query = dib0700_rc_query_old_firmware, | ||
3770 | .allowed_protos = RC_TYPE_RC5 | | ||
3771 | RC_TYPE_RC6 | | ||
3772 | RC_TYPE_NEC, | ||
3773 | .change_protocol = dib0700_change_protocol, | ||
3774 | }, | ||
2633 | }, | 3775 | }, |
2634 | }; | 3776 | }; |
2635 | 3777 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index ba991aa21aff..4c2a689c820e 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -327,7 +327,7 @@ EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | |||
327 | /* | 327 | /* |
328 | * common remote control stuff | 328 | * common remote control stuff |
329 | */ | 329 | */ |
330 | struct ir_scancode ir_codes_dibusb_table[] = { | 330 | struct rc_map_table rc_map_dibusb_table[] = { |
331 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ | 331 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ |
332 | { 0x0016, KEY_POWER }, | 332 | { 0x0016, KEY_POWER }, |
333 | { 0x0010, KEY_MUTE }, | 333 | { 0x0010, KEY_MUTE }, |
@@ -408,7 +408,7 @@ struct ir_scancode ir_codes_dibusb_table[] = { | |||
408 | 408 | ||
409 | { 0x8008, KEY_DVD }, | 409 | { 0x8008, KEY_DVD }, |
410 | { 0x8009, KEY_AUDIO }, | 410 | { 0x8009, KEY_AUDIO }, |
411 | { 0x800a, KEY_MEDIA }, /* Pictures */ | 411 | { 0x800a, KEY_IMAGES }, /* Pictures */ |
412 | { 0x800b, KEY_VIDEO }, | 412 | { 0x800b, KEY_VIDEO }, |
413 | 413 | ||
414 | { 0x800c, KEY_BACK }, | 414 | { 0x800c, KEY_BACK }, |
@@ -456,7 +456,7 @@ struct ir_scancode ir_codes_dibusb_table[] = { | |||
456 | { 0x804e, KEY_ENTER }, | 456 | { 0x804e, KEY_ENTER }, |
457 | { 0x804f, KEY_VOLUMEDOWN }, | 457 | { 0x804f, KEY_VOLUMEDOWN }, |
458 | }; | 458 | }; |
459 | EXPORT_SYMBOL(ir_codes_dibusb_table); | 459 | EXPORT_SYMBOL(rc_map_dibusb_table); |
460 | 460 | ||
461 | int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 461 | int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
462 | { | 462 | { |
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 8e3c0d2cce16..04d91bdd3562 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c | |||
@@ -213,8 +213,8 @@ static struct dvb_usb_device_properties dibusb1_1_properties = { | |||
213 | 213 | ||
214 | .rc.legacy = { | 214 | .rc.legacy = { |
215 | .rc_interval = DEFAULT_RC_INTERVAL, | 215 | .rc_interval = DEFAULT_RC_INTERVAL, |
216 | .rc_key_map = ir_codes_dibusb_table, | 216 | .rc_map_table = rc_map_dibusb_table, |
217 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 217 | .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
218 | .rc_query = dibusb_rc_query, | 218 | .rc_query = dibusb_rc_query, |
219 | }, | 219 | }, |
220 | 220 | ||
@@ -299,8 +299,8 @@ static struct dvb_usb_device_properties dibusb1_1_an2235_properties = { | |||
299 | 299 | ||
300 | .rc.legacy = { | 300 | .rc.legacy = { |
301 | .rc_interval = DEFAULT_RC_INTERVAL, | 301 | .rc_interval = DEFAULT_RC_INTERVAL, |
302 | .rc_key_map = ir_codes_dibusb_table, | 302 | .rc_map_table = rc_map_dibusb_table, |
303 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 303 | .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
304 | .rc_query = dibusb_rc_query, | 304 | .rc_query = dibusb_rc_query, |
305 | }, | 305 | }, |
306 | 306 | ||
@@ -365,8 +365,8 @@ static struct dvb_usb_device_properties dibusb2_0b_properties = { | |||
365 | 365 | ||
366 | .rc.legacy = { | 366 | .rc.legacy = { |
367 | .rc_interval = DEFAULT_RC_INTERVAL, | 367 | .rc_interval = DEFAULT_RC_INTERVAL, |
368 | .rc_key_map = ir_codes_dibusb_table, | 368 | .rc_map_table = rc_map_dibusb_table, |
369 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 369 | .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
370 | .rc_query = dibusb_rc_query, | 370 | .rc_query = dibusb_rc_query, |
371 | }, | 371 | }, |
372 | 372 | ||
@@ -424,8 +424,8 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties = { | |||
424 | 424 | ||
425 | .rc.legacy = { | 425 | .rc.legacy = { |
426 | .rc_interval = DEFAULT_RC_INTERVAL, | 426 | .rc_interval = DEFAULT_RC_INTERVAL, |
427 | .rc_key_map = ir_codes_dibusb_table, | 427 | .rc_map_table = rc_map_dibusb_table, |
428 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 428 | .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
429 | .rc_query = dibusb_rc_query, | 429 | .rc_query = dibusb_rc_query, |
430 | }, | 430 | }, |
431 | 431 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index 1cbc41cb4e8f..c1d9094b61e5 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
@@ -83,8 +83,8 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { | |||
83 | 83 | ||
84 | .rc.legacy = { | 84 | .rc.legacy = { |
85 | .rc_interval = DEFAULT_RC_INTERVAL, | 85 | .rc_interval = DEFAULT_RC_INTERVAL, |
86 | .rc_key_map = ir_codes_dibusb_table, | 86 | .rc_map_table = rc_map_dibusb_table, |
87 | .rc_key_map_size = 111, /* FIXME */ | 87 | .rc_map_size = 111, /* FIXME */ |
88 | .rc_query = dibusb_rc_query, | 88 | .rc_query = dibusb_rc_query, |
89 | }, | 89 | }, |
90 | 90 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h index 61a6bf389472..e47c321b3ffc 100644 --- a/drivers/media/dvb/dvb-usb/dibusb.h +++ b/drivers/media/dvb/dvb-usb/dibusb.h | |||
@@ -124,7 +124,7 @@ extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); | |||
124 | #define DEFAULT_RC_INTERVAL 150 | 124 | #define DEFAULT_RC_INTERVAL 150 |
125 | //#define DEFAULT_RC_INTERVAL 100000 | 125 | //#define DEFAULT_RC_INTERVAL 100000 |
126 | 126 | ||
127 | extern struct ir_scancode ir_codes_dibusb_table[]; | 127 | extern struct rc_map_table rc_map_dibusb_table[]; |
128 | extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); | 128 | extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); |
129 | extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); | 129 | extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); |
130 | 130 | ||
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 13d006bb19db..f6344cdd360f 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -161,7 +161,7 @@ static int digitv_tuner_attach(struct dvb_usb_adapter *adap) | |||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static struct ir_scancode ir_codes_digitv_table[] = { | 164 | static struct rc_map_table rc_map_digitv_table[] = { |
165 | { 0x5f55, KEY_0 }, | 165 | { 0x5f55, KEY_0 }, |
166 | { 0x6f55, KEY_1 }, | 166 | { 0x6f55, KEY_1 }, |
167 | { 0x9f55, KEY_2 }, | 167 | { 0x9f55, KEY_2 }, |
@@ -176,7 +176,7 @@ static struct ir_scancode ir_codes_digitv_table[] = { | |||
176 | { 0xaf59, KEY_AUX }, | 176 | { 0xaf59, KEY_AUX }, |
177 | { 0x5f5a, KEY_DVD }, | 177 | { 0x5f5a, KEY_DVD }, |
178 | { 0x6f5a, KEY_POWER }, | 178 | { 0x6f5a, KEY_POWER }, |
179 | { 0x9f5a, KEY_MHP }, /* labelled 'Picture' */ | 179 | { 0x9f5a, KEY_CAMERA }, /* labelled 'Picture' */ |
180 | { 0xaf5a, KEY_AUDIO }, | 180 | { 0xaf5a, KEY_AUDIO }, |
181 | { 0x5f65, KEY_INFO }, | 181 | { 0x5f65, KEY_INFO }, |
182 | { 0x6f65, KEY_F13 }, /* 16:9 */ | 182 | { 0x6f65, KEY_F13 }, /* 16:9 */ |
@@ -237,10 +237,10 @@ static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
237 | /* if something is inside the buffer, simulate key press */ | 237 | /* if something is inside the buffer, simulate key press */ |
238 | if (key[1] != 0) | 238 | if (key[1] != 0) |
239 | { | 239 | { |
240 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | 240 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
241 | if (rc5_custom(&d->props.rc.legacy.rc_key_map[i]) == key[1] && | 241 | if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] && |
242 | rc5_data(&d->props.rc.legacy.rc_key_map[i]) == key[2]) { | 242 | rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) { |
243 | *event = d->props.rc.legacy.rc_key_map[i].keycode; | 243 | *event = d->props.rc.legacy.rc_map_table[i].keycode; |
244 | *state = REMOTE_KEY_PRESSED; | 244 | *state = REMOTE_KEY_PRESSED; |
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
@@ -312,8 +312,8 @@ static struct dvb_usb_device_properties digitv_properties = { | |||
312 | 312 | ||
313 | .rc.legacy = { | 313 | .rc.legacy = { |
314 | .rc_interval = 1000, | 314 | .rc_interval = 1000, |
315 | .rc_key_map = ir_codes_digitv_table, | 315 | .rc_map_table = rc_map_digitv_table, |
316 | .rc_key_map_size = ARRAY_SIZE(ir_codes_digitv_table), | 316 | .rc_map_size = ARRAY_SIZE(rc_map_digitv_table), |
317 | .rc_query = digitv_rc_query, | 317 | .rc_query = digitv_rc_query, |
318 | }, | 318 | }, |
319 | 319 | ||
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index ca495e07f35c..ecd86eca2548 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
@@ -57,7 +57,7 @@ static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, | |||
57 | 57 | ||
58 | /* remote control */ | 58 | /* remote control */ |
59 | /* key list for the tiny remote control (Yakumo, don't know about the others) */ | 59 | /* key list for the tiny remote control (Yakumo, don't know about the others) */ |
60 | static struct ir_scancode ir_codes_dtt200u_table[] = { | 60 | static struct rc_map_table rc_map_dtt200u_table[] = { |
61 | { 0x8001, KEY_MUTE }, | 61 | { 0x8001, KEY_MUTE }, |
62 | { 0x8002, KEY_CHANNELDOWN }, | 62 | { 0x8002, KEY_CHANNELDOWN }, |
63 | { 0x8003, KEY_VOLUMEDOWN }, | 63 | { 0x8003, KEY_VOLUMEDOWN }, |
@@ -163,8 +163,8 @@ static struct dvb_usb_device_properties dtt200u_properties = { | |||
163 | 163 | ||
164 | .rc.legacy = { | 164 | .rc.legacy = { |
165 | .rc_interval = 300, | 165 | .rc_interval = 300, |
166 | .rc_key_map = ir_codes_dtt200u_table, | 166 | .rc_map_table = rc_map_dtt200u_table, |
167 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 167 | .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), |
168 | .rc_query = dtt200u_rc_query, | 168 | .rc_query = dtt200u_rc_query, |
169 | }, | 169 | }, |
170 | 170 | ||
@@ -210,8 +210,8 @@ static struct dvb_usb_device_properties wt220u_properties = { | |||
210 | 210 | ||
211 | .rc.legacy = { | 211 | .rc.legacy = { |
212 | .rc_interval = 300, | 212 | .rc_interval = 300, |
213 | .rc_key_map = ir_codes_dtt200u_table, | 213 | .rc_map_table = rc_map_dtt200u_table, |
214 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 214 | .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), |
215 | .rc_query = dtt200u_rc_query, | 215 | .rc_query = dtt200u_rc_query, |
216 | }, | 216 | }, |
217 | 217 | ||
@@ -257,8 +257,8 @@ static struct dvb_usb_device_properties wt220u_fc_properties = { | |||
257 | 257 | ||
258 | .rc.legacy = { | 258 | .rc.legacy = { |
259 | .rc_interval = 300, | 259 | .rc_interval = 300, |
260 | .rc_key_map = ir_codes_dtt200u_table, | 260 | .rc_map_table = rc_map_dtt200u_table, |
261 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 261 | .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), |
262 | .rc_query = dtt200u_rc_query, | 262 | .rc_query = dtt200u_rc_query, |
263 | }, | 263 | }, |
264 | 264 | ||
@@ -304,8 +304,8 @@ static struct dvb_usb_device_properties wt220u_zl0353_properties = { | |||
304 | 304 | ||
305 | .rc.legacy = { | 305 | .rc.legacy = { |
306 | .rc_interval = 300, | 306 | .rc_interval = 300, |
307 | .rc_key_map = ir_codes_dtt200u_table, | 307 | .rc_map_table = rc_map_dtt200u_table, |
308 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 308 | .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), |
309 | .rc_query = dtt200u_rc_query, | 309 | .rc_query = dtt200u_rc_query, |
310 | }, | 310 | }, |
311 | 311 | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index df1ec3e69f4a..b3cb626ed56e 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | |||
@@ -12,7 +12,7 @@ | |||
12 | static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | 12 | static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) |
13 | { | 13 | { |
14 | struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv; | 14 | struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv; |
15 | int newfeedcount,ret; | 15 | int newfeedcount, ret; |
16 | 16 | ||
17 | if (adap == NULL) | 17 | if (adap == NULL) |
18 | return -ENODEV; | 18 | return -ENODEV; |
@@ -24,9 +24,13 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | |||
24 | deb_ts("stop feeding\n"); | 24 | deb_ts("stop feeding\n"); |
25 | usb_urb_kill(&adap->stream); | 25 | usb_urb_kill(&adap->stream); |
26 | 26 | ||
27 | if (adap->props.streaming_ctrl != NULL) | 27 | if (adap->props.streaming_ctrl != NULL) { |
28 | if ((ret = adap->props.streaming_ctrl(adap,0))) | 28 | ret = adap->props.streaming_ctrl(adap, 0); |
29 | if (ret < 0) { | ||
29 | err("error while stopping stream."); | 30 | err("error while stopping stream."); |
31 | return ret; | ||
32 | } | ||
33 | } | ||
30 | } | 34 | } |
31 | 35 | ||
32 | adap->feedcount = newfeedcount; | 36 | adap->feedcount = newfeedcount; |
@@ -49,17 +53,24 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | |||
49 | 53 | ||
50 | deb_ts("controlling pid parser\n"); | 54 | deb_ts("controlling pid parser\n"); |
51 | if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER && | 55 | if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER && |
52 | adap->props.caps & DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF && | 56 | adap->props.caps & |
53 | adap->props.pid_filter_ctrl != NULL) | 57 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF && |
54 | if (adap->props.pid_filter_ctrl(adap,adap->pid_filtering) < 0) | 58 | adap->props.pid_filter_ctrl != NULL) { |
59 | ret = adap->props.pid_filter_ctrl(adap, | ||
60 | adap->pid_filtering); | ||
61 | if (ret < 0) { | ||
55 | err("could not handle pid_parser"); | 62 | err("could not handle pid_parser"); |
56 | 63 | return ret; | |
64 | } | ||
65 | } | ||
57 | deb_ts("start feeding\n"); | 66 | deb_ts("start feeding\n"); |
58 | if (adap->props.streaming_ctrl != NULL) | 67 | if (adap->props.streaming_ctrl != NULL) { |
59 | if (adap->props.streaming_ctrl(adap,1)) { | 68 | ret = adap->props.streaming_ctrl(adap, 1); |
69 | if (ret < 0) { | ||
60 | err("error while enabling fifo."); | 70 | err("error while enabling fifo."); |
61 | return -ENODEV; | 71 | return ret; |
62 | } | 72 | } |
73 | } | ||
63 | 74 | ||
64 | } | 75 | } |
65 | return 0; | 76 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c index cead089bbb4f..88e4a62abc44 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | |||
@@ -20,7 +20,6 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d) | |||
20 | } | 20 | } |
21 | 21 | ||
22 | strlcpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); | 22 | strlcpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); |
23 | d->i2c_adap.class = I2C_CLASS_TV_DIGITAL, | ||
24 | d->i2c_adap.algo = d->props.i2c_algo; | 23 | d->i2c_adap.algo = d->props.i2c_algo; |
25 | d->i2c_adap.algo_data = NULL; | 24 | d->i2c_adap.algo_data = NULL; |
26 | d->i2c_adap.dev.parent = &d->udev->dev; | 25 | d->i2c_adap.dev.parent = &d->udev->dev; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 1a774d58d664..21b15495d2d7 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define USB_VID_EMPIA 0xeb1a | 32 | #define USB_VID_EMPIA 0xeb1a |
33 | #define USB_VID_GENPIX 0x09c0 | 33 | #define USB_VID_GENPIX 0x09c0 |
34 | #define USB_VID_GRANDTEC 0x5032 | 34 | #define USB_VID_GRANDTEC 0x5032 |
35 | #define USB_VID_GTEK 0x1f4d | ||
35 | #define USB_VID_HANFTEK 0x15f4 | 36 | #define USB_VID_HANFTEK 0x15f4 |
36 | #define USB_VID_HAUPPAUGE 0x2040 | 37 | #define USB_VID_HAUPPAUGE 0x2040 |
37 | #define USB_VID_HYPER_PALTEK 0x1025 | 38 | #define USB_VID_HYPER_PALTEK 0x1025 |
@@ -90,6 +91,7 @@ | |||
90 | #define USB_PID_COMPRO_VIDEOMATE_U500_PC 0x1e80 | 91 | #define USB_PID_COMPRO_VIDEOMATE_U500_PC 0x1e80 |
91 | #define USB_PID_CONCEPTRONIC_CTVDIGRCU 0xe397 | 92 | #define USB_PID_CONCEPTRONIC_CTVDIGRCU 0xe397 |
92 | #define USB_PID_CONEXANT_D680_DMB 0x86d6 | 93 | #define USB_PID_CONEXANT_D680_DMB 0x86d6 |
94 | #define USB_PID_CREATIX_CTX1921 0x1921 | ||
93 | #define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064 | 95 | #define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064 |
94 | #define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065 | 96 | #define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065 |
95 | #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 | 97 | #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 |
@@ -105,8 +107,13 @@ | |||
105 | #define USB_PID_DIBCOM_STK807XP 0x1f90 | 107 | #define USB_PID_DIBCOM_STK807XP 0x1f90 |
106 | #define USB_PID_DIBCOM_STK807XPVR 0x1f98 | 108 | #define USB_PID_DIBCOM_STK807XPVR 0x1f98 |
107 | #define USB_PID_DIBCOM_STK8096GP 0x1fa0 | 109 | #define USB_PID_DIBCOM_STK8096GP 0x1fa0 |
110 | #define USB_PID_DIBCOM_NIM8096MD 0x1fa8 | ||
108 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 | 111 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 |
109 | #define USB_PID_DIBCOM_STK7770P 0x1e80 | 112 | #define USB_PID_DIBCOM_STK7770P 0x1e80 |
113 | #define USB_PID_DIBCOM_NIM7090 0x1bb2 | ||
114 | #define USB_PID_DIBCOM_TFE7090PVR 0x1bb4 | ||
115 | #define USB_PID_DIBCOM_NIM9090M 0x2383 | ||
116 | #define USB_PID_DIBCOM_NIM9090MD 0x2384 | ||
110 | #define USB_PID_DPOSH_M9206_COLD 0x9206 | 117 | #define USB_PID_DPOSH_M9206_COLD 0x9206 |
111 | #define USB_PID_DPOSH_M9206_WARM 0xa090 | 118 | #define USB_PID_DPOSH_M9206_WARM 0xa090 |
112 | #define USB_PID_E3C_EC168 0x1689 | 119 | #define USB_PID_E3C_EC168 0x1689 |
@@ -133,6 +140,8 @@ | |||
133 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df | 140 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df |
134 | #define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055 | 141 | #define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055 |
135 | #define USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2 0x0069 | 142 | #define USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2 0x0069 |
143 | #define USB_PID_TERRATEC_CINERGY_T_STICK_RC 0x0097 | ||
144 | #define USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC 0x0099 | ||
136 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 | 145 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 |
137 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 | 146 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 |
138 | #define USB_PID_TWINHAN_VP7020_COLD 0x3203 | 147 | #define USB_PID_TWINHAN_VP7020_COLD 0x3203 |
@@ -143,6 +152,7 @@ | |||
143 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 | 152 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 |
144 | #define USB_PID_TINYTWIN 0x3226 | 153 | #define USB_PID_TINYTWIN 0x3226 |
145 | #define USB_PID_TINYTWIN_2 0xe402 | 154 | #define USB_PID_TINYTWIN_2 0xe402 |
155 | #define USB_PID_TINYTWIN_3 0x9016 | ||
146 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 | 156 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 |
147 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 | 157 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 |
148 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | 158 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 |
@@ -196,6 +206,7 @@ | |||
196 | #define USB_PID_AVERMEDIA_A309 0xa309 | 206 | #define USB_PID_AVERMEDIA_A309 0xa309 |
197 | #define USB_PID_AVERMEDIA_A310 0xa310 | 207 | #define USB_PID_AVERMEDIA_A310 0xa310 |
198 | #define USB_PID_AVERMEDIA_A850 0x850a | 208 | #define USB_PID_AVERMEDIA_A850 0x850a |
209 | #define USB_PID_AVERMEDIA_A850T 0x850b | ||
199 | #define USB_PID_AVERMEDIA_A805 0xa805 | 210 | #define USB_PID_AVERMEDIA_A805 0xa805 |
200 | #define USB_PID_AVERMEDIA_A815M 0x815a | 211 | #define USB_PID_AVERMEDIA_A815M 0x815a |
201 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 | 212 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 |
@@ -268,6 +279,7 @@ | |||
268 | #define USB_PID_GENPIX_8PSK_REV_2 0x0202 | 279 | #define USB_PID_GENPIX_8PSK_REV_2 0x0202 |
269 | #define USB_PID_GENPIX_SKYWALKER_1 0x0203 | 280 | #define USB_PID_GENPIX_SKYWALKER_1 0x0203 |
270 | #define USB_PID_GENPIX_SKYWALKER_CW3K 0x0204 | 281 | #define USB_PID_GENPIX_SKYWALKER_CW3K 0x0204 |
282 | #define USB_PID_GENPIX_SKYWALKER_2 0x0206 | ||
271 | #define USB_PID_SIGMATEK_DVB_110 0x6610 | 283 | #define USB_PID_SIGMATEK_DVB_110 0x6610 |
272 | #define USB_PID_MSI_DIGI_VOX_MINI_II 0x1513 | 284 | #define USB_PID_MSI_DIGI_VOX_MINI_II 0x1513 |
273 | #define USB_PID_MSI_DIGIVOX_DUO 0x8801 | 285 | #define USB_PID_MSI_DIGIVOX_DUO 0x8801 |
@@ -295,6 +307,7 @@ | |||
295 | #define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011 | 307 | #define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011 |
296 | #define USB_PID_ELGATO_EYETV_DTT 0x0021 | 308 | #define USB_PID_ELGATO_EYETV_DTT 0x0021 |
297 | #define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020 | 309 | #define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020 |
310 | #define USB_PID_ELGATO_EYETV_SAT 0x002a | ||
298 | #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000 | 311 | #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000 |
299 | #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM 0x5001 | 312 | #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM 0x5001 |
300 | #define USB_PID_FRIIO_WHITE 0x0001 | 313 | #define USB_PID_FRIIO_WHITE 0x0001 |
@@ -305,4 +318,6 @@ | |||
305 | #define USB_PID_TERRATEC_DVBS2CI_V2 0x10ac | 318 | #define USB_PID_TERRATEC_DVBS2CI_V2 0x10ac |
306 | #define USB_PID_TECHNISAT_USB2_HDCI_V1 0x0001 | 319 | #define USB_PID_TECHNISAT_USB2_HDCI_V1 0x0001 |
307 | #define USB_PID_TECHNISAT_USB2_HDCI_V2 0x0002 | 320 | #define USB_PID_TECHNISAT_USB2_HDCI_V2 0x0002 |
321 | #define USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2 0x0004 | ||
322 | #define USB_PID_TECHNISAT_USB2_DVB_S2 0x0500 | ||
308 | #endif | 323 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index b579fed3ab3f..41bacff24960 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
@@ -8,60 +8,71 @@ | |||
8 | #include "dvb-usb-common.h" | 8 | #include "dvb-usb-common.h" |
9 | #include <linux/usb/input.h> | 9 | #include <linux/usb/input.h> |
10 | 10 | ||
11 | static int legacy_dvb_usb_getkeycode(struct input_dev *dev, | 11 | static unsigned int |
12 | unsigned int scancode, unsigned int *keycode) | 12 | legacy_dvb_usb_get_keymap_index(const struct input_keymap_entry *ke, |
13 | struct rc_map_table *keymap, | ||
14 | unsigned int keymap_size) | ||
13 | { | 15 | { |
14 | struct dvb_usb_device *d = input_get_drvdata(dev); | 16 | unsigned int index; |
15 | 17 | unsigned int scancode; | |
16 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 18 | |
17 | int i; | 19 | if (ke->flags & INPUT_KEYMAP_BY_INDEX) { |
18 | 20 | index = ke->index; | |
19 | /* See if we can match the raw key code. */ | 21 | } else { |
20 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) | 22 | if (input_scancode_to_scalar(ke, &scancode)) |
21 | if (keymap[i].scancode == scancode) { | 23 | return keymap_size; |
22 | *keycode = keymap[i].keycode; | 24 | |
23 | return 0; | 25 | /* See if we can match the raw key code. */ |
24 | } | 26 | for (index = 0; index < keymap_size; index++) |
27 | if (keymap[index].scancode == scancode) | ||
28 | break; | ||
25 | 29 | ||
26 | /* | 30 | /* See if there is an unused hole in the map */ |
27 | * If is there extra space, returns KEY_RESERVED, | 31 | if (index >= keymap_size) { |
28 | * otherwise, input core won't let legacy_dvb_usb_setkeycode | 32 | for (index = 0; index < keymap_size; index++) { |
29 | * to work | 33 | if (keymap[index].keycode == KEY_RESERVED || |
30 | */ | 34 | keymap[index].keycode == KEY_UNKNOWN) { |
31 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) | 35 | break; |
32 | if (keymap[i].keycode == KEY_RESERVED || | 36 | } |
33 | keymap[i].keycode == KEY_UNKNOWN) { | 37 | } |
34 | *keycode = KEY_RESERVED; | ||
35 | return 0; | ||
36 | } | 38 | } |
39 | } | ||
37 | 40 | ||
38 | return -EINVAL; | 41 | return index; |
39 | } | 42 | } |
40 | 43 | ||
41 | static int legacy_dvb_usb_setkeycode(struct input_dev *dev, | 44 | static int legacy_dvb_usb_getkeycode(struct input_dev *dev, |
42 | unsigned int scancode, unsigned int keycode) | 45 | struct input_keymap_entry *ke) |
43 | { | 46 | { |
44 | struct dvb_usb_device *d = input_get_drvdata(dev); | 47 | struct dvb_usb_device *d = input_get_drvdata(dev); |
48 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; | ||
49 | unsigned int keymap_size = d->props.rc.legacy.rc_map_size; | ||
50 | unsigned int index; | ||
45 | 51 | ||
46 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 52 | index = legacy_dvb_usb_get_keymap_index(ke, keymap, keymap_size); |
47 | int i; | 53 | if (index >= keymap_size) |
54 | return -EINVAL; | ||
48 | 55 | ||
49 | /* Search if it is replacing an existing keycode */ | 56 | ke->keycode = keymap[index].keycode; |
50 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) | 57 | if (ke->keycode == KEY_UNKNOWN) |
51 | if (keymap[i].scancode == scancode) { | 58 | ke->keycode = KEY_RESERVED; |
52 | keymap[i].keycode = keycode; | 59 | ke->len = sizeof(keymap[index].scancode); |
53 | return 0; | 60 | memcpy(&ke->scancode, &keymap[index].scancode, ke->len); |
54 | } | 61 | ke->index = index; |
55 | 62 | ||
56 | /* Search if is there a clean entry. If so, use it */ | 63 | return 0; |
57 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) | 64 | } |
58 | if (keymap[i].keycode == KEY_RESERVED || | 65 | |
59 | keymap[i].keycode == KEY_UNKNOWN) { | 66 | static int legacy_dvb_usb_setkeycode(struct input_dev *dev, |
60 | keymap[i].scancode = scancode; | 67 | const struct input_keymap_entry *ke, |
61 | keymap[i].keycode = keycode; | 68 | unsigned int *old_keycode) |
62 | return 0; | 69 | { |
63 | } | 70 | struct dvb_usb_device *d = input_get_drvdata(dev); |
71 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; | ||
72 | unsigned int keymap_size = d->props.rc.legacy.rc_map_size; | ||
73 | unsigned int index; | ||
64 | 74 | ||
75 | index = legacy_dvb_usb_get_keymap_index(ke, keymap, keymap_size); | ||
65 | /* | 76 | /* |
66 | * FIXME: Currently, it is not possible to increase the size of | 77 | * FIXME: Currently, it is not possible to increase the size of |
67 | * scancode table. For it to happen, one possibility | 78 | * scancode table. For it to happen, one possibility |
@@ -69,8 +80,24 @@ static int legacy_dvb_usb_setkeycode(struct input_dev *dev, | |||
69 | * copying data, appending the new key on it, and freeing | 80 | * copying data, appending the new key on it, and freeing |
70 | * the old one - or maybe just allocating some spare space | 81 | * the old one - or maybe just allocating some spare space |
71 | */ | 82 | */ |
83 | if (index >= keymap_size) | ||
84 | return -EINVAL; | ||
85 | |||
86 | *old_keycode = keymap[index].keycode; | ||
87 | keymap->keycode = ke->keycode; | ||
88 | __set_bit(ke->keycode, dev->keybit); | ||
89 | |||
90 | if (*old_keycode != KEY_RESERVED) { | ||
91 | __clear_bit(*old_keycode, dev->keybit); | ||
92 | for (index = 0; index < keymap_size; index++) { | ||
93 | if (keymap[index].keycode == *old_keycode) { | ||
94 | __set_bit(*old_keycode, dev->keybit); | ||
95 | break; | ||
96 | } | ||
97 | } | ||
98 | } | ||
72 | 99 | ||
73 | return -EINVAL; | 100 | return 0; |
74 | } | 101 | } |
75 | 102 | ||
76 | /* Remote-control poll function - called every dib->rc_query_interval ms to see | 103 | /* Remote-control poll function - called every dib->rc_query_interval ms to see |
@@ -106,10 +133,10 @@ static void legacy_dvb_usb_read_remote_control(struct work_struct *work) | |||
106 | d->last_event = event; | 133 | d->last_event = event; |
107 | case REMOTE_KEY_REPEAT: | 134 | case REMOTE_KEY_REPEAT: |
108 | deb_rc("key repeated\n"); | 135 | deb_rc("key repeated\n"); |
109 | input_event(d->rc_input_dev, EV_KEY, event, 1); | 136 | input_event(d->input_dev, EV_KEY, event, 1); |
110 | input_sync(d->rc_input_dev); | 137 | input_sync(d->input_dev); |
111 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); | 138 | input_event(d->input_dev, EV_KEY, d->last_event, 0); |
112 | input_sync(d->rc_input_dev); | 139 | input_sync(d->input_dev); |
113 | break; | 140 | break; |
114 | default: | 141 | default: |
115 | break; | 142 | break; |
@@ -154,20 +181,32 @@ schedule: | |||
154 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval)); | 181 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval)); |
155 | } | 182 | } |
156 | 183 | ||
157 | static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d, | 184 | static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d) |
158 | struct input_dev *input_dev) | ||
159 | { | 185 | { |
160 | int i, err, rc_interval; | 186 | int i, err, rc_interval; |
187 | struct input_dev *input_dev; | ||
188 | |||
189 | input_dev = input_allocate_device(); | ||
190 | if (!input_dev) | ||
191 | return -ENOMEM; | ||
192 | |||
193 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
194 | input_dev->name = "IR-receiver inside an USB DVB receiver"; | ||
195 | input_dev->phys = d->rc_phys; | ||
196 | usb_to_input_id(d->udev, &input_dev->id); | ||
197 | input_dev->dev.parent = &d->udev->dev; | ||
198 | d->input_dev = input_dev; | ||
199 | d->rc_dev = NULL; | ||
161 | 200 | ||
162 | input_dev->getkeycode = legacy_dvb_usb_getkeycode; | 201 | input_dev->getkeycode = legacy_dvb_usb_getkeycode; |
163 | input_dev->setkeycode = legacy_dvb_usb_setkeycode; | 202 | input_dev->setkeycode = legacy_dvb_usb_setkeycode; |
164 | 203 | ||
165 | /* set the bits for the keys */ | 204 | /* set the bits for the keys */ |
166 | deb_rc("key map size: %d\n", d->props.rc.legacy.rc_key_map_size); | 205 | deb_rc("key map size: %d\n", d->props.rc.legacy.rc_map_size); |
167 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | 206 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
168 | deb_rc("setting bit for event %d item %d\n", | 207 | deb_rc("setting bit for event %d item %d\n", |
169 | d->props.rc.legacy.rc_key_map[i].keycode, i); | 208 | d->props.rc.legacy.rc_map_table[i].keycode, i); |
170 | set_bit(d->props.rc.legacy.rc_key_map[i].keycode, input_dev->keybit); | 209 | set_bit(d->props.rc.legacy.rc_map_table[i].keycode, input_dev->keybit); |
171 | } | 210 | } |
172 | 211 | ||
173 | /* setting these two values to non-zero, we have to manage key repeats */ | 212 | /* setting these two values to non-zero, we have to manage key repeats */ |
@@ -221,18 +260,34 @@ static void dvb_usb_read_remote_control(struct work_struct *work) | |||
221 | msecs_to_jiffies(d->props.rc.core.rc_interval)); | 260 | msecs_to_jiffies(d->props.rc.core.rc_interval)); |
222 | } | 261 | } |
223 | 262 | ||
224 | static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d, | 263 | static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d) |
225 | struct input_dev *input_dev) | ||
226 | { | 264 | { |
227 | int err, rc_interval; | 265 | int err, rc_interval; |
266 | struct rc_dev *dev; | ||
267 | |||
268 | dev = rc_allocate_device(); | ||
269 | if (!dev) | ||
270 | return -ENOMEM; | ||
228 | 271 | ||
229 | d->props.rc.core.rc_props.priv = d; | 272 | dev->driver_name = d->props.rc.core.module_name; |
230 | err = ir_input_register(input_dev, | 273 | dev->map_name = d->props.rc.core.rc_codes; |
231 | d->props.rc.core.rc_codes, | 274 | dev->change_protocol = d->props.rc.core.change_protocol; |
232 | &d->props.rc.core.rc_props, | 275 | dev->allowed_protos = d->props.rc.core.allowed_protos; |
233 | d->props.rc.core.module_name); | 276 | dev->driver_type = d->props.rc.core.driver_type; |
234 | if (err < 0) | 277 | usb_to_input_id(d->udev, &dev->input_id); |
278 | dev->input_name = "IR-receiver inside an USB DVB receiver"; | ||
279 | dev->input_phys = d->rc_phys; | ||
280 | dev->dev.parent = &d->udev->dev; | ||
281 | dev->priv = d; | ||
282 | |||
283 | err = rc_register_device(dev); | ||
284 | if (err < 0) { | ||
285 | rc_free_device(dev); | ||
235 | return err; | 286 | return err; |
287 | } | ||
288 | |||
289 | d->input_dev = NULL; | ||
290 | d->rc_dev = dev; | ||
236 | 291 | ||
237 | if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode) | 292 | if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode) |
238 | return 0; | 293 | return 0; |
@@ -251,13 +306,12 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d, | |||
251 | 306 | ||
252 | int dvb_usb_remote_init(struct dvb_usb_device *d) | 307 | int dvb_usb_remote_init(struct dvb_usb_device *d) |
253 | { | 308 | { |
254 | struct input_dev *input_dev; | ||
255 | int err; | 309 | int err; |
256 | 310 | ||
257 | if (dvb_usb_disable_rc_polling) | 311 | if (dvb_usb_disable_rc_polling) |
258 | return 0; | 312 | return 0; |
259 | 313 | ||
260 | if (d->props.rc.legacy.rc_key_map && d->props.rc.legacy.rc_query) | 314 | if (d->props.rc.legacy.rc_map_table && d->props.rc.legacy.rc_query) |
261 | d->props.rc.mode = DVB_RC_LEGACY; | 315 | d->props.rc.mode = DVB_RC_LEGACY; |
262 | else if (d->props.rc.core.rc_codes) | 316 | else if (d->props.rc.core.rc_codes) |
263 | d->props.rc.mode = DVB_RC_CORE; | 317 | d->props.rc.mode = DVB_RC_CORE; |
@@ -267,26 +321,14 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
267 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); | 321 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); |
268 | strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); | 322 | strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); |
269 | 323 | ||
270 | input_dev = input_allocate_device(); | ||
271 | if (!input_dev) | ||
272 | return -ENOMEM; | ||
273 | |||
274 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
275 | input_dev->name = "IR-receiver inside an USB DVB receiver"; | ||
276 | input_dev->phys = d->rc_phys; | ||
277 | usb_to_input_id(d->udev, &input_dev->id); | ||
278 | input_dev->dev.parent = &d->udev->dev; | ||
279 | |||
280 | /* Start the remote-control polling. */ | 324 | /* Start the remote-control polling. */ |
281 | if (d->props.rc.legacy.rc_interval < 40) | 325 | if (d->props.rc.legacy.rc_interval < 40) |
282 | d->props.rc.legacy.rc_interval = 100; /* default */ | 326 | d->props.rc.legacy.rc_interval = 100; /* default */ |
283 | 327 | ||
284 | d->rc_input_dev = input_dev; | ||
285 | |||
286 | if (d->props.rc.mode == DVB_RC_LEGACY) | 328 | if (d->props.rc.mode == DVB_RC_LEGACY) |
287 | err = legacy_dvb_usb_remote_init(d, input_dev); | 329 | err = legacy_dvb_usb_remote_init(d); |
288 | else | 330 | else |
289 | err = rc_core_dvb_usb_remote_init(d, input_dev); | 331 | err = rc_core_dvb_usb_remote_init(d); |
290 | if (err) | 332 | if (err) |
291 | return err; | 333 | return err; |
292 | 334 | ||
@@ -298,12 +340,11 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
298 | int dvb_usb_remote_exit(struct dvb_usb_device *d) | 340 | int dvb_usb_remote_exit(struct dvb_usb_device *d) |
299 | { | 341 | { |
300 | if (d->state & DVB_USB_STATE_REMOTE) { | 342 | if (d->state & DVB_USB_STATE_REMOTE) { |
301 | cancel_rearming_delayed_work(&d->rc_query_work); | 343 | cancel_delayed_work_sync(&d->rc_query_work); |
302 | flush_scheduled_work(); | ||
303 | if (d->props.rc.mode == DVB_RC_LEGACY) | 344 | if (d->props.rc.mode == DVB_RC_LEGACY) |
304 | input_unregister_device(d->rc_input_dev); | 345 | input_unregister_device(d->input_dev); |
305 | else | 346 | else |
306 | ir_input_unregister(d->rc_input_dev); | 347 | rc_unregister_device(d->rc_dev); |
307 | } | 348 | } |
308 | d->state &= ~DVB_USB_STATE_REMOTE; | 349 | d->state &= ~DVB_USB_STATE_REMOTE; |
309 | return 0; | 350 | return 0; |
@@ -316,7 +357,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, | |||
316 | u8 keybuf[5], u32 *event, int *state) | 357 | u8 keybuf[5], u32 *event, int *state) |
317 | { | 358 | { |
318 | int i; | 359 | int i; |
319 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 360 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
320 | *event = 0; | 361 | *event = 0; |
321 | *state = REMOTE_NO_KEY_PRESSED; | 362 | *state = REMOTE_NO_KEY_PRESSED; |
322 | switch (keybuf[0]) { | 363 | switch (keybuf[0]) { |
@@ -329,7 +370,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, | |||
329 | break; | 370 | break; |
330 | } | 371 | } |
331 | /* See if we can match the raw key code. */ | 372 | /* See if we can match the raw key code. */ |
332 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) | 373 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) |
333 | if (rc5_custom(&keymap[i]) == keybuf[1] && | 374 | if (rc5_custom(&keymap[i]) == keybuf[1] && |
334 | rc5_data(&keymap[i]) == keybuf[3]) { | 375 | rc5_data(&keymap[i]) == keybuf[3]) { |
335 | *event = keymap[i].keycode; | 376 | *event = keymap[i].keycode; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 34f7b3ba8cc7..76a80968482a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/usb.h> | 14 | #include <linux/usb.h> |
15 | #include <linux/firmware.h> | 15 | #include <linux/firmware.h> |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <media/ir-core.h> | 17 | #include <media/rc-core.h> |
18 | 18 | ||
19 | #include "dvb_frontend.h" | 19 | #include "dvb_frontend.h" |
20 | #include "dvb_demux.h" | 20 | #include "dvb_demux.h" |
@@ -75,17 +75,17 @@ struct dvb_usb_device_description { | |||
75 | struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; | 75 | struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | static inline u8 rc5_custom(struct ir_scancode *key) | 78 | static inline u8 rc5_custom(struct rc_map_table *key) |
79 | { | 79 | { |
80 | return (key->scancode >> 8) & 0xff; | 80 | return (key->scancode >> 8) & 0xff; |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline u8 rc5_data(struct ir_scancode *key) | 83 | static inline u8 rc5_data(struct rc_map_table *key) |
84 | { | 84 | { |
85 | return key->scancode & 0xff; | 85 | return key->scancode & 0xff; |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline u8 rc5_scan(struct ir_scancode *key) | 88 | static inline u8 rc5_scan(struct rc_map_table *key) |
89 | { | 89 | { |
90 | return key->scancode & 0xffff; | 90 | return key->scancode & 0xffff; |
91 | } | 91 | } |
@@ -159,9 +159,9 @@ struct dvb_usb_adapter_properties { | |||
159 | 159 | ||
160 | /** | 160 | /** |
161 | * struct dvb_rc_legacy - old properties of remote controller | 161 | * struct dvb_rc_legacy - old properties of remote controller |
162 | * @rc_key_map: a hard-wired array of struct ir_scancode (NULL to disable | 162 | * @rc_map_table: a hard-wired array of struct rc_map_table (NULL to disable |
163 | * remote control handling). | 163 | * remote control handling). |
164 | * @rc_key_map_size: number of items in @rc_key_map. | 164 | * @rc_map_size: number of items in @rc_map_table. |
165 | * @rc_query: called to query an event event. | 165 | * @rc_query: called to query an event event. |
166 | * @rc_interval: time in ms between two queries. | 166 | * @rc_interval: time in ms between two queries. |
167 | */ | 167 | */ |
@@ -170,8 +170,8 @@ struct dvb_rc_legacy { | |||
170 | #define REMOTE_NO_KEY_PRESSED 0x00 | 170 | #define REMOTE_NO_KEY_PRESSED 0x00 |
171 | #define REMOTE_KEY_PRESSED 0x01 | 171 | #define REMOTE_KEY_PRESSED 0x01 |
172 | #define REMOTE_KEY_REPEAT 0x02 | 172 | #define REMOTE_KEY_REPEAT 0x02 |
173 | struct ir_scancode *rc_key_map; | 173 | struct rc_map_table *rc_map_table; |
174 | int rc_key_map_size; | 174 | int rc_map_size; |
175 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); | 175 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); |
176 | int rc_interval; | 176 | int rc_interval; |
177 | }; | 177 | }; |
@@ -180,18 +180,22 @@ struct dvb_rc_legacy { | |||
180 | * struct dvb_rc properties of remote controller, using rc-core | 180 | * struct dvb_rc properties of remote controller, using rc-core |
181 | * @rc_codes: name of rc codes table | 181 | * @rc_codes: name of rc codes table |
182 | * @protocol: type of protocol(s) currently used by the driver | 182 | * @protocol: type of protocol(s) currently used by the driver |
183 | * @allowed_protos: protocol(s) supported by the driver | ||
184 | * @driver_type: Used to point if a device supports raw mode | ||
185 | * @change_protocol: callback to change protocol | ||
183 | * @rc_query: called to query an event event. | 186 | * @rc_query: called to query an event event. |
184 | * @rc_interval: time in ms between two queries. | 187 | * @rc_interval: time in ms between two queries. |
185 | * @rc_props: remote controller properties | ||
186 | * @bulk_mode: device supports bulk mode for RC (disable polling mode) | 188 | * @bulk_mode: device supports bulk mode for RC (disable polling mode) |
187 | */ | 189 | */ |
188 | struct dvb_rc { | 190 | struct dvb_rc { |
189 | char *rc_codes; | 191 | char *rc_codes; |
190 | u64 protocol; | 192 | u64 protocol; |
193 | u64 allowed_protos; | ||
194 | enum rc_driver_type driver_type; | ||
195 | int (*change_protocol)(struct rc_dev *dev, u64 rc_type); | ||
191 | char *module_name; | 196 | char *module_name; |
192 | int (*rc_query) (struct dvb_usb_device *d); | 197 | int (*rc_query) (struct dvb_usb_device *d); |
193 | int rc_interval; | 198 | int rc_interval; |
194 | struct ir_dev_props rc_props; | ||
195 | bool bulk_mode; /* uses bulk mode */ | 199 | bool bulk_mode; /* uses bulk mode */ |
196 | }; | 200 | }; |
197 | 201 | ||
@@ -385,7 +389,8 @@ struct dvb_usb_adapter { | |||
385 | * | 389 | * |
386 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB | 390 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB |
387 | * | 391 | * |
388 | * @rc_input_dev: input device for the remote control. | 392 | * @rc_dev: rc device for the remote control (rc-core mode) |
393 | * @input_dev: input device for the remote control (legacy mode) | ||
389 | * @rc_query_work: struct work_struct frequent rc queries | 394 | * @rc_query_work: struct work_struct frequent rc queries |
390 | * @last_event: last triggered event | 395 | * @last_event: last triggered event |
391 | * @last_state: last state (no, pressed, repeat) | 396 | * @last_state: last state (no, pressed, repeat) |
@@ -418,7 +423,8 @@ struct dvb_usb_device { | |||
418 | struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; | 423 | struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; |
419 | 424 | ||
420 | /* remote control */ | 425 | /* remote control */ |
421 | struct input_dev *rc_input_dev; | 426 | struct rc_dev *rc_dev; |
427 | struct input_dev *input_dev; | ||
422 | char rc_phys[64]; | 428 | char rc_phys[64]; |
423 | struct delayed_work rc_query_work; | 429 | struct delayed_work rc_query_work; |
424 | u32 last_event; | 430 | u32 last_event; |
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index 774df88dc6e3..058b2318abed 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c | |||
@@ -1,15 +1,16 @@ | |||
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, | 3 | * TeVii S600, S630, S650, S660, S480, |
4 | * Prof 1100, 7500 Cards | 4 | * Prof 1100, 7500, |
5 | * Copyright (C) 2008,2009 Igor M. Liplianin (liplianin@me.by) | 5 | * Geniatech SU3000 Cards |
6 | * | 6 | * Copyright (C) 2008-2011 Igor M. Liplianin (liplianin@me.by) |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * |
8 | * under the terms of the GNU General Public License as published by the | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * Free Software Foundation, version 2. | 9 | * under the terms of the GNU General Public License as published by the |
10 | * | 10 | * Free Software Foundation, version 2. |
11 | * see Documentation/dvb/README.dvb-usb for more information | 11 | * |
12 | */ | 12 | * see Documentation/dvb/README.dvb-usb for more information |
13 | */ | ||
13 | #include "dw2102.h" | 14 | #include "dw2102.h" |
14 | #include "si21xx.h" | 15 | #include "si21xx.h" |
15 | #include "stv0299.h" | 16 | #include "stv0299.h" |
@@ -55,6 +56,14 @@ | |||
55 | #define USB_PID_TEVII_S660 0xd660 | 56 | #define USB_PID_TEVII_S660 0xd660 |
56 | #endif | 57 | #endif |
57 | 58 | ||
59 | #ifndef USB_PID_TEVII_S480_1 | ||
60 | #define USB_PID_TEVII_S480_1 0xd481 | ||
61 | #endif | ||
62 | |||
63 | #ifndef USB_PID_TEVII_S480_2 | ||
64 | #define USB_PID_TEVII_S480_2 0xd482 | ||
65 | #endif | ||
66 | |||
58 | #ifndef USB_PID_PROF_1100 | 67 | #ifndef USB_PID_PROF_1100 |
59 | #define USB_PID_PROF_1100 0xb012 | 68 | #define USB_PID_PROF_1100 0xb012 |
60 | #endif | 69 | #endif |
@@ -67,17 +76,27 @@ | |||
67 | #define REG_21_SYMBOLRATE_BYTE2 0x21 | 76 | #define REG_21_SYMBOLRATE_BYTE2 0x21 |
68 | /* on my own*/ | 77 | /* on my own*/ |
69 | #define DW2102_VOLTAGE_CTRL (0x1800) | 78 | #define DW2102_VOLTAGE_CTRL (0x1800) |
79 | #define SU3000_STREAM_CTRL (0x1900) | ||
70 | #define DW2102_RC_QUERY (0x1a00) | 80 | #define DW2102_RC_QUERY (0x1a00) |
81 | #define DW2102_LED_CTRL (0x1b00) | ||
71 | 82 | ||
72 | #define err_str "did not find the firmware file. (%s) " \ | 83 | #define err_str "did not find the firmware file. (%s) " \ |
73 | "Please see linux/Documentation/dvb/ for more details " \ | 84 | "Please see linux/Documentation/dvb/ for more details " \ |
74 | "on firmware-problems." | 85 | "on firmware-problems." |
75 | 86 | ||
76 | struct ir_codes_dvb_usb_table_table { | 87 | struct rc_map_dvb_usb_table_table { |
77 | struct ir_scancode *rc_keys; | 88 | struct rc_map_table *rc_keys; |
78 | int rc_keys_size; | 89 | int rc_keys_size; |
79 | }; | 90 | }; |
80 | 91 | ||
92 | struct su3000_state { | ||
93 | u8 initialized; | ||
94 | }; | ||
95 | |||
96 | struct s6x0_state { | ||
97 | int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v); | ||
98 | }; | ||
99 | |||
81 | /* debug */ | 100 | /* debug */ |
82 | static int dvb_usb_dw2102_debug; | 101 | static int dvb_usb_dw2102_debug; |
83 | module_param_named(debug, dvb_usb_dw2102_debug, int, 0644); | 102 | module_param_named(debug, dvb_usb_dw2102_debug, int, 0644); |
@@ -87,7 +106,8 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer 4=rc(or-able))." | |||
87 | /* keymaps */ | 106 | /* keymaps */ |
88 | static int ir_keymap; | 107 | static int ir_keymap; |
89 | module_param_named(keymap, ir_keymap, int, 0644); | 108 | module_param_named(keymap, ir_keymap, int, 0644); |
90 | MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs ..."); | 109 | MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs ..." |
110 | " 256=none"); | ||
91 | 111 | ||
92 | /* demod probe */ | 112 | /* demod probe */ |
93 | static int demod_probe = 1; | 113 | static int demod_probe = 1; |
@@ -101,12 +121,16 @@ static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value, | |||
101 | u16 index, u8 * data, u16 len, int flags) | 121 | u16 index, u8 * data, u16 len, int flags) |
102 | { | 122 | { |
103 | int ret; | 123 | int ret; |
104 | u8 u8buf[len]; | 124 | u8 *u8buf; |
105 | |||
106 | unsigned int pipe = (flags == DW210X_READ_MSG) ? | 125 | unsigned int pipe = (flags == DW210X_READ_MSG) ? |
107 | usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0); | 126 | usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0); |
108 | u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; | 127 | u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; |
109 | 128 | ||
129 | u8buf = kmalloc(len, GFP_KERNEL); | ||
130 | if (!u8buf) | ||
131 | return -ENOMEM; | ||
132 | |||
133 | |||
110 | if (flags == DW210X_WRITE_MSG) | 134 | if (flags == DW210X_WRITE_MSG) |
111 | memcpy(u8buf, data, len); | 135 | memcpy(u8buf, data, len); |
112 | ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, | 136 | ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, |
@@ -114,6 +138,8 @@ static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value, | |||
114 | 138 | ||
115 | if (flags == DW210X_READ_MSG) | 139 | if (flags == DW210X_READ_MSG) |
116 | memcpy(data, u8buf, len); | 140 | memcpy(data, u8buf, len); |
141 | |||
142 | kfree(u8buf); | ||
117 | return ret; | 143 | return ret; |
118 | } | 144 | } |
119 | 145 | ||
@@ -136,8 +162,7 @@ static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
136 | /* read stv0299 register */ | 162 | /* read stv0299 register */ |
137 | value = msg[0].buf[0];/* register */ | 163 | value = msg[0].buf[0];/* register */ |
138 | for (i = 0; i < msg[1].len; i++) { | 164 | for (i = 0; i < msg[1].len; i++) { |
139 | value = value + i; | 165 | ret = dw210x_op_rw(d->udev, 0xb5, value + i, 0, |
140 | ret = dw210x_op_rw(d->udev, 0xb5, value, 0, | ||
141 | buf6, 2, DW210X_READ_MSG); | 166 | buf6, 2, DW210X_READ_MSG); |
142 | msg[1].buf[i] = buf6[0]; | 167 | msg[1].buf[i] = buf6[0]; |
143 | } | 168 | } |
@@ -483,10 +508,10 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
483 | for (j = 0; j < num; j++) { | 508 | for (j = 0; j < num; j++) { |
484 | switch (msg[j].addr) { | 509 | switch (msg[j].addr) { |
485 | case (DW2102_RC_QUERY): { | 510 | case (DW2102_RC_QUERY): { |
486 | u8 ibuf[4]; | 511 | u8 ibuf[5]; |
487 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, | 512 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
488 | ibuf, 4, DW210X_READ_MSG); | 513 | ibuf, 5, DW210X_READ_MSG); |
489 | memcpy(msg[j].buf, ibuf + 1, 2); | 514 | memcpy(msg[j].buf, ibuf + 3, 2); |
490 | break; | 515 | break; |
491 | } | 516 | } |
492 | case (DW2102_VOLTAGE_CTRL): { | 517 | case (DW2102_VOLTAGE_CTRL): { |
@@ -502,6 +527,15 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
502 | obuf, 2, DW210X_WRITE_MSG); | 527 | obuf, 2, DW210X_WRITE_MSG); |
503 | break; | 528 | break; |
504 | } | 529 | } |
530 | case (DW2102_LED_CTRL): { | ||
531 | u8 obuf[2]; | ||
532 | |||
533 | obuf[0] = 5; | ||
534 | obuf[1] = msg[j].buf[0]; | ||
535 | ret = dw210x_op_rw(d->udev, 0x8a, 0, 0, | ||
536 | obuf, 2, DW210X_WRITE_MSG); | ||
537 | break; | ||
538 | } | ||
505 | /*case 0x55: cx24116 | 539 | /*case 0x55: cx24116 |
506 | case 0x6a: stv0903 | 540 | case 0x6a: stv0903 |
507 | case 0x68: ds3000, stv0903 | 541 | case 0x68: ds3000, stv0903 |
@@ -535,14 +569,15 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
535 | i += 16; | 569 | i += 16; |
536 | len -= 16; | 570 | len -= 16; |
537 | } while (len > 0); | 571 | } while (len > 0); |
538 | } else if ((udev->descriptor.idProduct == 0x7500) | 572 | } else if (j < (num - 1)) { |
539 | && (j < (num - 1))) { | ||
540 | /* write register addr before read */ | 573 | /* write register addr before read */ |
541 | u8 obuf[msg[j].len + 2]; | 574 | u8 obuf[msg[j].len + 2]; |
542 | obuf[0] = msg[j + 1].len; | 575 | obuf[0] = msg[j + 1].len; |
543 | obuf[1] = (msg[j].addr << 1); | 576 | obuf[1] = (msg[j].addr << 1); |
544 | memcpy(obuf + 2, msg[j].buf, msg[j].len); | 577 | memcpy(obuf + 2, msg[j].buf, msg[j].len); |
545 | ret = dw210x_op_rw(d->udev, 0x92, 0, 0, | 578 | ret = dw210x_op_rw(d->udev, |
579 | udev->descriptor.idProduct == | ||
580 | 0x7500 ? 0x92 : 0x90, 0, 0, | ||
546 | obuf, msg[j].len + 2, | 581 | obuf, msg[j].len + 2, |
547 | DW210X_WRITE_MSG); | 582 | DW210X_WRITE_MSG); |
548 | break; | 583 | break; |
@@ -552,8 +587,7 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
552 | obuf[0] = msg[j].len + 1; | 587 | obuf[0] = msg[j].len + 1; |
553 | obuf[1] = (msg[j].addr << 1); | 588 | obuf[1] = (msg[j].addr << 1); |
554 | memcpy(obuf + 2, msg[j].buf, msg[j].len); | 589 | memcpy(obuf + 2, msg[j].buf, msg[j].len); |
555 | ret = dw210x_op_rw(d->udev, | 590 | ret = dw210x_op_rw(d->udev, 0x80, 0, 0, |
556 | (num > 1 ? 0x90 : 0x80), 0, 0, | ||
557 | obuf, msg[j].len + 2, | 591 | obuf, msg[j].len + 2, |
558 | DW210X_WRITE_MSG); | 592 | DW210X_WRITE_MSG); |
559 | break; | 593 | break; |
@@ -561,14 +595,76 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
561 | break; | 595 | break; |
562 | } | 596 | } |
563 | } | 597 | } |
564 | |||
565 | msleep(3); | ||
566 | } | 598 | } |
567 | 599 | ||
568 | mutex_unlock(&d->i2c_mutex); | 600 | mutex_unlock(&d->i2c_mutex); |
569 | return num; | 601 | return num; |
570 | } | 602 | } |
571 | 603 | ||
604 | static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
605 | int num) | ||
606 | { | ||
607 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
608 | u8 obuf[0x40], ibuf[0x40]; | ||
609 | |||
610 | if (!d) | ||
611 | return -ENODEV; | ||
612 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
613 | return -EAGAIN; | ||
614 | |||
615 | switch (num) { | ||
616 | case 1: | ||
617 | switch (msg[0].addr) { | ||
618 | case SU3000_STREAM_CTRL: | ||
619 | obuf[0] = msg[0].buf[0] + 0x36; | ||
620 | obuf[1] = 3; | ||
621 | obuf[2] = 0; | ||
622 | if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 0, 0) < 0) | ||
623 | err("i2c transfer failed."); | ||
624 | break; | ||
625 | case DW2102_RC_QUERY: | ||
626 | obuf[0] = 0x10; | ||
627 | if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 2, 0) < 0) | ||
628 | err("i2c transfer failed."); | ||
629 | msg[0].buf[1] = ibuf[0]; | ||
630 | msg[0].buf[0] = ibuf[1]; | ||
631 | break; | ||
632 | default: | ||
633 | /* always i2c write*/ | ||
634 | obuf[0] = 0x08; | ||
635 | obuf[1] = msg[0].addr; | ||
636 | obuf[2] = msg[0].len; | ||
637 | |||
638 | memcpy(&obuf[3], msg[0].buf, msg[0].len); | ||
639 | |||
640 | if (dvb_usb_generic_rw(d, obuf, msg[0].len + 3, | ||
641 | ibuf, 1, 0) < 0) | ||
642 | err("i2c transfer failed."); | ||
643 | |||
644 | } | ||
645 | break; | ||
646 | case 2: | ||
647 | /* always i2c read */ | ||
648 | obuf[0] = 0x09; | ||
649 | obuf[1] = msg[0].len; | ||
650 | obuf[2] = msg[1].len; | ||
651 | obuf[3] = msg[0].addr; | ||
652 | memcpy(&obuf[4], msg[0].buf, msg[0].len); | ||
653 | |||
654 | if (dvb_usb_generic_rw(d, obuf, msg[0].len + 4, | ||
655 | ibuf, msg[1].len + 1, 0) < 0) | ||
656 | err("i2c transfer failed."); | ||
657 | |||
658 | memcpy(msg[1].buf, &ibuf[1], msg[1].len); | ||
659 | break; | ||
660 | default: | ||
661 | warn("more than 2 i2c messages at a time is not handled yet."); | ||
662 | break; | ||
663 | } | ||
664 | mutex_unlock(&d->i2c_mutex); | ||
665 | return num; | ||
666 | } | ||
667 | |||
572 | static u32 dw210x_i2c_func(struct i2c_adapter *adapter) | 668 | static u32 dw210x_i2c_func(struct i2c_adapter *adapter) |
573 | { | 669 | { |
574 | return I2C_FUNC_I2C; | 670 | return I2C_FUNC_I2C; |
@@ -604,6 +700,11 @@ static struct i2c_algorithm s6x0_i2c_algo = { | |||
604 | .functionality = dw210x_i2c_func, | 700 | .functionality = dw210x_i2c_func, |
605 | }; | 701 | }; |
606 | 702 | ||
703 | static struct i2c_algorithm su3000_i2c_algo = { | ||
704 | .master_xfer = su3000_i2c_transfer, | ||
705 | .functionality = dw210x_i2c_func, | ||
706 | }; | ||
707 | |||
607 | static int dw210x_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) | 708 | static int dw210x_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) |
608 | { | 709 | { |
609 | int i; | 710 | int i; |
@@ -668,6 +769,82 @@ static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) | |||
668 | return 0; | 769 | return 0; |
669 | }; | 770 | }; |
670 | 771 | ||
772 | static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | ||
773 | { | ||
774 | static u8 command_start[] = {0x00}; | ||
775 | static u8 command_stop[] = {0x01}; | ||
776 | struct i2c_msg msg = { | ||
777 | .addr = SU3000_STREAM_CTRL, | ||
778 | .flags = 0, | ||
779 | .buf = onoff ? command_start : command_stop, | ||
780 | .len = 1 | ||
781 | }; | ||
782 | |||
783 | i2c_transfer(&adap->dev->i2c_adap, &msg, 1); | ||
784 | |||
785 | return 0; | ||
786 | } | ||
787 | |||
788 | static int su3000_power_ctrl(struct dvb_usb_device *d, int i) | ||
789 | { | ||
790 | struct su3000_state *state = (struct su3000_state *)d->priv; | ||
791 | u8 obuf[] = {0xde, 0}; | ||
792 | |||
793 | info("%s: %d, initialized %d\n", __func__, i, state->initialized); | ||
794 | |||
795 | if (i && !state->initialized) { | ||
796 | state->initialized = 1; | ||
797 | /* reset board */ | ||
798 | dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0); | ||
799 | } | ||
800 | |||
801 | return 0; | ||
802 | } | ||
803 | |||
804 | static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) | ||
805 | { | ||
806 | int i; | ||
807 | u8 obuf[] = { 0x1f, 0xf0 }; | ||
808 | u8 ibuf[] = { 0 }; | ||
809 | struct i2c_msg msg[] = { | ||
810 | { | ||
811 | .addr = 0x51, | ||
812 | .flags = 0, | ||
813 | .buf = obuf, | ||
814 | .len = 2, | ||
815 | }, { | ||
816 | .addr = 0x51, | ||
817 | .flags = I2C_M_RD, | ||
818 | .buf = ibuf, | ||
819 | .len = 1, | ||
820 | |||
821 | } | ||
822 | }; | ||
823 | |||
824 | for (i = 0; i < 6; i++) { | ||
825 | obuf[1] = 0xf0 + i; | ||
826 | if (i2c_transfer(&d->i2c_adap, msg, 2) != 2) | ||
827 | break; | ||
828 | else | ||
829 | mac[i] = ibuf[0]; | ||
830 | |||
831 | debug_dump(mac, 6, printk); | ||
832 | } | ||
833 | |||
834 | return 0; | ||
835 | } | ||
836 | |||
837 | static int su3000_identify_state(struct usb_device *udev, | ||
838 | struct dvb_usb_device_properties *props, | ||
839 | struct dvb_usb_device_description **desc, | ||
840 | int *cold) | ||
841 | { | ||
842 | info("%s\n", __func__); | ||
843 | |||
844 | *cold = 0; | ||
845 | return 0; | ||
846 | } | ||
847 | |||
671 | static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 848 | static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
672 | { | 849 | { |
673 | static u8 command_13v[] = {0x00, 0x01}; | 850 | static u8 command_13v[] = {0x00, 0x01}; |
@@ -692,6 +869,37 @@ static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | |||
692 | return 0; | 869 | return 0; |
693 | } | 870 | } |
694 | 871 | ||
872 | static int s660_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | ||
873 | { | ||
874 | struct dvb_usb_adapter *d = | ||
875 | (struct dvb_usb_adapter *)(fe->dvb->priv); | ||
876 | struct s6x0_state *st = (struct s6x0_state *)d->dev->priv; | ||
877 | |||
878 | dw210x_set_voltage(fe, voltage); | ||
879 | if (st->old_set_voltage) | ||
880 | st->old_set_voltage(fe, voltage); | ||
881 | |||
882 | return 0; | ||
883 | } | ||
884 | |||
885 | static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon) | ||
886 | { | ||
887 | static u8 led_off[] = { 0 }; | ||
888 | static u8 led_on[] = { 1 }; | ||
889 | struct i2c_msg msg = { | ||
890 | .addr = DW2102_LED_CTRL, | ||
891 | .flags = 0, | ||
892 | .buf = led_off, | ||
893 | .len = 1 | ||
894 | }; | ||
895 | struct dvb_usb_adapter *udev_adap = | ||
896 | (struct dvb_usb_adapter *)(fe->dvb->priv); | ||
897 | |||
898 | if (offon) | ||
899 | msg.buf = led_on; | ||
900 | i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1); | ||
901 | } | ||
902 | |||
695 | static struct stv0299_config sharp_z0194a_config = { | 903 | static struct stv0299_config sharp_z0194a_config = { |
696 | .demod_address = 0x68, | 904 | .demod_address = 0x68, |
697 | .inittab = sharp_z0194a_inittab, | 905 | .inittab = sharp_z0194a_inittab, |
@@ -771,6 +979,12 @@ static struct stv0900_config prof_7500_stv0900_config = { | |||
771 | .tun1_adc = 0,/* 2 Vpp */ | 979 | .tun1_adc = 0,/* 2 Vpp */ |
772 | .path1_mode = 3, | 980 | .path1_mode = 3, |
773 | .tun1_type = 3, | 981 | .tun1_type = 3, |
982 | .set_lock_led = dw210x_led_ctrl, | ||
983 | }; | ||
984 | |||
985 | static struct ds3000_config su3000_ds3000_config = { | ||
986 | .demod_address = 0x68, | ||
987 | .ci_mode = 1, | ||
774 | }; | 988 | }; |
775 | 989 | ||
776 | static int dw2104_frontend_attach(struct dvb_usb_adapter *d) | 990 | static int dw2104_frontend_attach(struct dvb_usb_adapter *d) |
@@ -885,7 +1099,7 @@ static int dw3101_frontend_attach(struct dvb_usb_adapter *d) | |||
885 | return -EIO; | 1099 | return -EIO; |
886 | } | 1100 | } |
887 | 1101 | ||
888 | static int s6x0_frontend_attach(struct dvb_usb_adapter *d) | 1102 | static int zl100313_frontend_attach(struct dvb_usb_adapter *d) |
889 | { | 1103 | { |
890 | d->fe = dvb_attach(mt312_attach, &zl313_config, | 1104 | d->fe = dvb_attach(mt312_attach, &zl313_config, |
891 | &d->dev->i2c_adap); | 1105 | &d->dev->i2c_adap); |
@@ -898,41 +1112,108 @@ static int s6x0_frontend_attach(struct dvb_usb_adapter *d) | |||
898 | } | 1112 | } |
899 | } | 1113 | } |
900 | 1114 | ||
1115 | return -EIO; | ||
1116 | } | ||
1117 | |||
1118 | static int stv0288_frontend_attach(struct dvb_usb_adapter *d) | ||
1119 | { | ||
1120 | u8 obuf[] = {7, 1}; | ||
1121 | |||
901 | d->fe = dvb_attach(stv0288_attach, &earda_config, | 1122 | d->fe = dvb_attach(stv0288_attach, &earda_config, |
902 | &d->dev->i2c_adap); | 1123 | &d->dev->i2c_adap); |
903 | if (d->fe != NULL) { | 1124 | |
904 | if (dvb_attach(stb6000_attach, d->fe, 0x61, | 1125 | if (d->fe == NULL) |
905 | &d->dev->i2c_adap)) { | 1126 | return -EIO; |
906 | d->fe->ops.set_voltage = dw210x_set_voltage; | 1127 | |
907 | info("Attached stv0288+stb6000!\n"); | 1128 | if (NULL == dvb_attach(stb6000_attach, d->fe, 0x61, &d->dev->i2c_adap)) |
908 | return 0; | 1129 | return -EIO; |
909 | } | 1130 | |
910 | } | 1131 | d->fe->ops.set_voltage = dw210x_set_voltage; |
1132 | |||
1133 | dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG); | ||
1134 | |||
1135 | info("Attached stv0288+stb6000!\n"); | ||
1136 | |||
1137 | return 0; | ||
1138 | |||
1139 | } | ||
1140 | |||
1141 | static int ds3000_frontend_attach(struct dvb_usb_adapter *d) | ||
1142 | { | ||
1143 | struct s6x0_state *st = (struct s6x0_state *)d->dev->priv; | ||
1144 | u8 obuf[] = {7, 1}; | ||
911 | 1145 | ||
912 | d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config, | 1146 | d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config, |
913 | &d->dev->i2c_adap); | 1147 | &d->dev->i2c_adap); |
914 | if (d->fe != NULL) { | ||
915 | d->fe->ops.set_voltage = dw210x_set_voltage; | ||
916 | info("Attached ds3000+ds2020!\n"); | ||
917 | return 0; | ||
918 | } | ||
919 | 1148 | ||
920 | return -EIO; | 1149 | if (d->fe == NULL) |
1150 | return -EIO; | ||
1151 | |||
1152 | st->old_set_voltage = d->fe->ops.set_voltage; | ||
1153 | d->fe->ops.set_voltage = s660_set_voltage; | ||
1154 | |||
1155 | dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG); | ||
1156 | |||
1157 | info("Attached ds3000+ds2020!\n"); | ||
1158 | |||
1159 | return 0; | ||
921 | } | 1160 | } |
922 | 1161 | ||
923 | static int prof_7500_frontend_attach(struct dvb_usb_adapter *d) | 1162 | static int prof_7500_frontend_attach(struct dvb_usb_adapter *d) |
924 | { | 1163 | { |
1164 | u8 obuf[] = {7, 1}; | ||
1165 | |||
925 | d->fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config, | 1166 | d->fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config, |
926 | &d->dev->i2c_adap, 0); | 1167 | &d->dev->i2c_adap, 0); |
927 | if (d->fe == NULL) | 1168 | if (d->fe == NULL) |
928 | return -EIO; | 1169 | return -EIO; |
1170 | |||
929 | d->fe->ops.set_voltage = dw210x_set_voltage; | 1171 | d->fe->ops.set_voltage = dw210x_set_voltage; |
930 | 1172 | ||
1173 | dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG); | ||
1174 | |||
931 | info("Attached STV0900+STB6100A!\n"); | 1175 | info("Attached STV0900+STB6100A!\n"); |
932 | 1176 | ||
933 | return 0; | 1177 | return 0; |
934 | } | 1178 | } |
935 | 1179 | ||
1180 | static int su3000_frontend_attach(struct dvb_usb_adapter *d) | ||
1181 | { | ||
1182 | u8 obuf[3] = { 0xe, 0x80, 0 }; | ||
1183 | u8 ibuf[] = { 0 }; | ||
1184 | |||
1185 | if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) | ||
1186 | err("command 0x0e transfer failed."); | ||
1187 | |||
1188 | obuf[0] = 0xe; | ||
1189 | obuf[1] = 0x83; | ||
1190 | obuf[2] = 0; | ||
1191 | |||
1192 | if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) | ||
1193 | err("command 0x0e transfer failed."); | ||
1194 | |||
1195 | obuf[0] = 0xe; | ||
1196 | obuf[1] = 0x83; | ||
1197 | obuf[2] = 1; | ||
1198 | |||
1199 | if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) | ||
1200 | err("command 0x0e transfer failed."); | ||
1201 | |||
1202 | obuf[0] = 0x51; | ||
1203 | |||
1204 | if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) | ||
1205 | err("command 0x51 transfer failed."); | ||
1206 | |||
1207 | d->fe = dvb_attach(ds3000_attach, &su3000_ds3000_config, | ||
1208 | &d->dev->i2c_adap); | ||
1209 | if (d->fe == NULL) | ||
1210 | return -EIO; | ||
1211 | |||
1212 | info("Attached DS3000!\n"); | ||
1213 | |||
1214 | return 0; | ||
1215 | } | ||
1216 | |||
936 | static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) | 1217 | static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) |
937 | { | 1218 | { |
938 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, | 1219 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, |
@@ -948,9 +1229,9 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) | |||
948 | return 0; | 1229 | return 0; |
949 | } | 1230 | } |
950 | 1231 | ||
951 | static struct ir_scancode ir_codes_dw210x_table[] = { | 1232 | static struct rc_map_table rc_map_dw210x_table[] = { |
952 | { 0xf80a, KEY_Q }, /*power*/ | 1233 | { 0xf80a, KEY_POWER2 }, /*power*/ |
953 | { 0xf80c, KEY_M }, /*mute*/ | 1234 | { 0xf80c, KEY_MUTE }, /*mute*/ |
954 | { 0xf811, KEY_1 }, | 1235 | { 0xf811, KEY_1 }, |
955 | { 0xf812, KEY_2 }, | 1236 | { 0xf812, KEY_2 }, |
956 | { 0xf813, KEY_3 }, | 1237 | { 0xf813, KEY_3 }, |
@@ -961,28 +1242,28 @@ static struct ir_scancode ir_codes_dw210x_table[] = { | |||
961 | { 0xf818, KEY_8 }, | 1242 | { 0xf818, KEY_8 }, |
962 | { 0xf819, KEY_9 }, | 1243 | { 0xf819, KEY_9 }, |
963 | { 0xf810, KEY_0 }, | 1244 | { 0xf810, KEY_0 }, |
964 | { 0xf81c, KEY_PAGEUP }, /*ch+*/ | 1245 | { 0xf81c, KEY_CHANNELUP }, /*ch+*/ |
965 | { 0xf80f, KEY_PAGEDOWN }, /*ch-*/ | 1246 | { 0xf80f, KEY_CHANNELDOWN }, /*ch-*/ |
966 | { 0xf81a, KEY_O }, /*vol+*/ | 1247 | { 0xf81a, KEY_VOLUMEUP }, /*vol+*/ |
967 | { 0xf80e, KEY_Z }, /*vol-*/ | 1248 | { 0xf80e, KEY_VOLUMEDOWN }, /*vol-*/ |
968 | { 0xf804, KEY_R }, /*rec*/ | 1249 | { 0xf804, KEY_RECORD }, /*rec*/ |
969 | { 0xf809, KEY_D }, /*fav*/ | 1250 | { 0xf809, KEY_FAVORITES }, /*fav*/ |
970 | { 0xf808, KEY_BACKSPACE }, /*rewind*/ | 1251 | { 0xf808, KEY_REWIND }, /*rewind*/ |
971 | { 0xf807, KEY_A }, /*fast*/ | 1252 | { 0xf807, KEY_FASTFORWARD }, /*fast*/ |
972 | { 0xf80b, KEY_P }, /*pause*/ | 1253 | { 0xf80b, KEY_PAUSE }, /*pause*/ |
973 | { 0xf802, KEY_ESC }, /*cancel*/ | 1254 | { 0xf802, KEY_ESC }, /*cancel*/ |
974 | { 0xf803, KEY_G }, /*tab*/ | 1255 | { 0xf803, KEY_TAB }, /*tab*/ |
975 | { 0xf800, KEY_UP }, /*up*/ | 1256 | { 0xf800, KEY_UP }, /*up*/ |
976 | { 0xf81f, KEY_ENTER }, /*ok*/ | 1257 | { 0xf81f, KEY_OK }, /*ok*/ |
977 | { 0xf801, KEY_DOWN }, /*down*/ | 1258 | { 0xf801, KEY_DOWN }, /*down*/ |
978 | { 0xf805, KEY_C }, /*cap*/ | 1259 | { 0xf805, KEY_CAMERA }, /*cap*/ |
979 | { 0xf806, KEY_S }, /*stop*/ | 1260 | { 0xf806, KEY_STOP }, /*stop*/ |
980 | { 0xf840, KEY_F }, /*full*/ | 1261 | { 0xf840, KEY_ZOOM }, /*full*/ |
981 | { 0xf81e, KEY_W }, /*tvmode*/ | 1262 | { 0xf81e, KEY_TV }, /*tvmode*/ |
982 | { 0xf81b, KEY_B }, /*recall*/ | 1263 | { 0xf81b, KEY_LAST }, /*recall*/ |
983 | }; | 1264 | }; |
984 | 1265 | ||
985 | static struct ir_scancode ir_codes_tevii_table[] = { | 1266 | static struct rc_map_table rc_map_tevii_table[] = { |
986 | { 0xf80a, KEY_POWER }, | 1267 | { 0xf80a, KEY_POWER }, |
987 | { 0xf80c, KEY_MUTE }, | 1268 | { 0xf80c, KEY_MUTE }, |
988 | { 0xf811, KEY_1 }, | 1269 | { 0xf811, KEY_1 }, |
@@ -1032,7 +1313,7 @@ static struct ir_scancode ir_codes_tevii_table[] = { | |||
1032 | { 0xf858, KEY_SWITCHVIDEOMODE }, | 1313 | { 0xf858, KEY_SWITCHVIDEOMODE }, |
1033 | }; | 1314 | }; |
1034 | 1315 | ||
1035 | static struct ir_scancode ir_codes_tbs_table[] = { | 1316 | static struct rc_map_table rc_map_tbs_table[] = { |
1036 | { 0xf884, KEY_POWER }, | 1317 | { 0xf884, KEY_POWER }, |
1037 | { 0xf894, KEY_MUTE }, | 1318 | { 0xf894, KEY_MUTE }, |
1038 | { 0xf887, KEY_1 }, | 1319 | { 0xf887, KEY_1 }, |
@@ -1067,16 +1348,55 @@ static struct ir_scancode ir_codes_tbs_table[] = { | |||
1067 | { 0xf89b, KEY_MODE } | 1348 | { 0xf89b, KEY_MODE } |
1068 | }; | 1349 | }; |
1069 | 1350 | ||
1070 | static struct ir_codes_dvb_usb_table_table keys_tables[] = { | 1351 | static struct rc_map_table rc_map_su3000_table[] = { |
1071 | { ir_codes_dw210x_table, ARRAY_SIZE(ir_codes_dw210x_table) }, | 1352 | { 0x25, KEY_POWER }, /* right-bottom Red */ |
1072 | { ir_codes_tevii_table, ARRAY_SIZE(ir_codes_tevii_table) }, | 1353 | { 0x0a, KEY_MUTE }, /* -/-- */ |
1073 | { ir_codes_tbs_table, ARRAY_SIZE(ir_codes_tbs_table) }, | 1354 | { 0x01, KEY_1 }, |
1355 | { 0x02, KEY_2 }, | ||
1356 | { 0x03, KEY_3 }, | ||
1357 | { 0x04, KEY_4 }, | ||
1358 | { 0x05, KEY_5 }, | ||
1359 | { 0x06, KEY_6 }, | ||
1360 | { 0x07, KEY_7 }, | ||
1361 | { 0x08, KEY_8 }, | ||
1362 | { 0x09, KEY_9 }, | ||
1363 | { 0x00, KEY_0 }, | ||
1364 | { 0x20, KEY_UP }, /* CH+ */ | ||
1365 | { 0x21, KEY_DOWN }, /* CH+ */ | ||
1366 | { 0x12, KEY_VOLUMEUP }, /* Brightness Up */ | ||
1367 | { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */ | ||
1368 | { 0x1f, KEY_RECORD }, | ||
1369 | { 0x17, KEY_PLAY }, | ||
1370 | { 0x16, KEY_PAUSE }, | ||
1371 | { 0x0b, KEY_STOP }, | ||
1372 | { 0x27, KEY_FASTFORWARD },/* >> */ | ||
1373 | { 0x26, KEY_REWIND }, /* << */ | ||
1374 | { 0x0d, KEY_OK }, /* Mute */ | ||
1375 | { 0x11, KEY_LEFT }, /* VOL- */ | ||
1376 | { 0x10, KEY_RIGHT }, /* VOL+ */ | ||
1377 | { 0x29, KEY_BACK }, /* button under 9 */ | ||
1378 | { 0x2c, KEY_MENU }, /* TTX */ | ||
1379 | { 0x2b, KEY_EPG }, /* EPG */ | ||
1380 | { 0x1e, KEY_RED }, /* OSD */ | ||
1381 | { 0x0e, KEY_GREEN }, /* Window */ | ||
1382 | { 0x2d, KEY_YELLOW }, /* button under << */ | ||
1383 | { 0x0f, KEY_BLUE }, /* bottom yellow button */ | ||
1384 | { 0x14, KEY_AUDIO }, /* Snapshot */ | ||
1385 | { 0x38, KEY_TV }, /* TV/Radio */ | ||
1386 | { 0x0c, KEY_ESC } /* upper Red button */ | ||
1387 | }; | ||
1388 | |||
1389 | static struct rc_map_dvb_usb_table_table keys_tables[] = { | ||
1390 | { rc_map_dw210x_table, ARRAY_SIZE(rc_map_dw210x_table) }, | ||
1391 | { rc_map_tevii_table, ARRAY_SIZE(rc_map_tevii_table) }, | ||
1392 | { rc_map_tbs_table, ARRAY_SIZE(rc_map_tbs_table) }, | ||
1393 | { rc_map_su3000_table, ARRAY_SIZE(rc_map_su3000_table) }, | ||
1074 | }; | 1394 | }; |
1075 | 1395 | ||
1076 | static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 1396 | static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
1077 | { | 1397 | { |
1078 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | 1398 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
1079 | int keymap_size = d->props.rc.legacy.rc_key_map_size; | 1399 | int keymap_size = d->props.rc.legacy.rc_map_size; |
1080 | u8 key[2]; | 1400 | u8 key[2]; |
1081 | struct i2c_msg msg = { | 1401 | struct i2c_msg msg = { |
1082 | .addr = DW2102_RC_QUERY, | 1402 | .addr = DW2102_RC_QUERY, |
@@ -1089,7 +1409,8 @@ static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
1089 | if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) { | 1409 | if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) { |
1090 | keymap = keys_tables[ir_keymap - 1].rc_keys ; | 1410 | keymap = keys_tables[ir_keymap - 1].rc_keys ; |
1091 | keymap_size = keys_tables[ir_keymap - 1].rc_keys_size; | 1411 | keymap_size = keys_tables[ir_keymap - 1].rc_keys_size; |
1092 | } | 1412 | } else if (ir_keymap > ARRAY_SIZE(keys_tables)) |
1413 | return 0; /* none */ | ||
1093 | 1414 | ||
1094 | *state = REMOTE_NO_KEY_PRESSED; | 1415 | *state = REMOTE_NO_KEY_PRESSED; |
1095 | if (d->props.i2c_algo->master_xfer(&d->i2c_adap, &msg, 1) == 1) { | 1416 | if (d->props.i2c_algo->master_xfer(&d->i2c_adap, &msg, 1) == 1) { |
@@ -1125,6 +1446,11 @@ static struct usb_device_id dw2102_table[] = { | |||
1125 | {USB_DEVICE(0x3011, USB_PID_PROF_1100)}, | 1446 | {USB_DEVICE(0x3011, USB_PID_PROF_1100)}, |
1126 | {USB_DEVICE(0x9022, USB_PID_TEVII_S660)}, | 1447 | {USB_DEVICE(0x9022, USB_PID_TEVII_S660)}, |
1127 | {USB_DEVICE(0x3034, 0x7500)}, | 1448 | {USB_DEVICE(0x3034, 0x7500)}, |
1449 | {USB_DEVICE(0x1f4d, 0x3000)}, | ||
1450 | {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)}, | ||
1451 | {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)}, | ||
1452 | {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)}, | ||
1453 | {USB_DEVICE(0x1f4d, 0x3100)}, | ||
1128 | { } | 1454 | { } |
1129 | }; | 1455 | }; |
1130 | 1456 | ||
@@ -1184,15 +1510,10 @@ static int dw2102_load_firmware(struct usb_device *dev, | |||
1184 | } | 1510 | } |
1185 | /* init registers */ | 1511 | /* init registers */ |
1186 | switch (dev->descriptor.idProduct) { | 1512 | switch (dev->descriptor.idProduct) { |
1187 | case USB_PID_PROF_1100: | ||
1188 | s6x0_properties.rc.legacy.rc_key_map = ir_codes_tbs_table; | ||
1189 | s6x0_properties.rc.legacy.rc_key_map_size = | ||
1190 | ARRAY_SIZE(ir_codes_tbs_table); | ||
1191 | break; | ||
1192 | case USB_PID_TEVII_S650: | 1513 | case USB_PID_TEVII_S650: |
1193 | dw2104_properties.rc.legacy.rc_key_map = ir_codes_tevii_table; | 1514 | dw2104_properties.rc.legacy.rc_map_table = rc_map_tevii_table; |
1194 | dw2104_properties.rc.legacy.rc_key_map_size = | 1515 | dw2104_properties.rc.legacy.rc_map_size = |
1195 | ARRAY_SIZE(ir_codes_tevii_table); | 1516 | ARRAY_SIZE(rc_map_tevii_table); |
1196 | case USB_PID_DW2104: | 1517 | case USB_PID_DW2104: |
1197 | reset = 1; | 1518 | reset = 1; |
1198 | dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1, | 1519 | dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1, |
@@ -1257,8 +1578,8 @@ static struct dvb_usb_device_properties dw2102_properties = { | |||
1257 | .i2c_algo = &dw2102_serit_i2c_algo, | 1578 | .i2c_algo = &dw2102_serit_i2c_algo, |
1258 | 1579 | ||
1259 | .rc.legacy = { | 1580 | .rc.legacy = { |
1260 | .rc_key_map = ir_codes_dw210x_table, | 1581 | .rc_map_table = rc_map_dw210x_table, |
1261 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), | 1582 | .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table), |
1262 | .rc_interval = 150, | 1583 | .rc_interval = 150, |
1263 | .rc_query = dw2102_rc_query, | 1584 | .rc_query = dw2102_rc_query, |
1264 | }, | 1585 | }, |
@@ -1271,8 +1592,6 @@ static struct dvb_usb_device_properties dw2102_properties = { | |||
1271 | .adapter = { | 1592 | .adapter = { |
1272 | { | 1593 | { |
1273 | .frontend_attach = dw2102_frontend_attach, | 1594 | .frontend_attach = dw2102_frontend_attach, |
1274 | .streaming_ctrl = NULL, | ||
1275 | .tuner_attach = NULL, | ||
1276 | .stream = { | 1595 | .stream = { |
1277 | .type = USB_BULK, | 1596 | .type = USB_BULK, |
1278 | .count = 8, | 1597 | .count = 8, |
@@ -1310,8 +1629,8 @@ static struct dvb_usb_device_properties dw2104_properties = { | |||
1310 | 1629 | ||
1311 | .i2c_algo = &dw2104_i2c_algo, | 1630 | .i2c_algo = &dw2104_i2c_algo, |
1312 | .rc.legacy = { | 1631 | .rc.legacy = { |
1313 | .rc_key_map = ir_codes_dw210x_table, | 1632 | .rc_map_table = rc_map_dw210x_table, |
1314 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), | 1633 | .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table), |
1315 | .rc_interval = 150, | 1634 | .rc_interval = 150, |
1316 | .rc_query = dw2102_rc_query, | 1635 | .rc_query = dw2102_rc_query, |
1317 | }, | 1636 | }, |
@@ -1324,8 +1643,6 @@ static struct dvb_usb_device_properties dw2104_properties = { | |||
1324 | .adapter = { | 1643 | .adapter = { |
1325 | { | 1644 | { |
1326 | .frontend_attach = dw2104_frontend_attach, | 1645 | .frontend_attach = dw2104_frontend_attach, |
1327 | .streaming_ctrl = NULL, | ||
1328 | /*.tuner_attach = dw2104_tuner_attach,*/ | ||
1329 | .stream = { | 1646 | .stream = { |
1330 | .type = USB_BULK, | 1647 | .type = USB_BULK, |
1331 | .count = 8, | 1648 | .count = 8, |
@@ -1359,8 +1676,8 @@ static struct dvb_usb_device_properties dw3101_properties = { | |||
1359 | 1676 | ||
1360 | .i2c_algo = &dw3101_i2c_algo, | 1677 | .i2c_algo = &dw3101_i2c_algo, |
1361 | .rc.legacy = { | 1678 | .rc.legacy = { |
1362 | .rc_key_map = ir_codes_dw210x_table, | 1679 | .rc_map_table = rc_map_dw210x_table, |
1363 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), | 1680 | .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table), |
1364 | .rc_interval = 150, | 1681 | .rc_interval = 150, |
1365 | .rc_query = dw2102_rc_query, | 1682 | .rc_query = dw2102_rc_query, |
1366 | }, | 1683 | }, |
@@ -1373,7 +1690,6 @@ static struct dvb_usb_device_properties dw3101_properties = { | |||
1373 | .adapter = { | 1690 | .adapter = { |
1374 | { | 1691 | { |
1375 | .frontend_attach = dw3101_frontend_attach, | 1692 | .frontend_attach = dw3101_frontend_attach, |
1376 | .streaming_ctrl = NULL, | ||
1377 | .tuner_attach = dw3101_tuner_attach, | 1693 | .tuner_attach = dw3101_tuner_attach, |
1378 | .stream = { | 1694 | .stream = { |
1379 | .type = USB_BULK, | 1695 | .type = USB_BULK, |
@@ -1399,13 +1715,14 @@ static struct dvb_usb_device_properties dw3101_properties = { | |||
1399 | static struct dvb_usb_device_properties s6x0_properties = { | 1715 | static struct dvb_usb_device_properties s6x0_properties = { |
1400 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | 1716 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
1401 | .usb_ctrl = DEVICE_SPECIFIC, | 1717 | .usb_ctrl = DEVICE_SPECIFIC, |
1718 | .size_of_priv = sizeof(struct s6x0_state), | ||
1402 | .firmware = "dvb-usb-s630.fw", | 1719 | .firmware = "dvb-usb-s630.fw", |
1403 | .no_reconnect = 1, | 1720 | .no_reconnect = 1, |
1404 | 1721 | ||
1405 | .i2c_algo = &s6x0_i2c_algo, | 1722 | .i2c_algo = &s6x0_i2c_algo, |
1406 | .rc.legacy = { | 1723 | .rc.legacy = { |
1407 | .rc_key_map = ir_codes_tevii_table, | 1724 | .rc_map_table = rc_map_tevii_table, |
1408 | .rc_key_map_size = ARRAY_SIZE(ir_codes_tevii_table), | 1725 | .rc_map_size = ARRAY_SIZE(rc_map_tevii_table), |
1409 | .rc_interval = 150, | 1726 | .rc_interval = 150, |
1410 | .rc_query = dw2102_rc_query, | 1727 | .rc_query = dw2102_rc_query, |
1411 | }, | 1728 | }, |
@@ -1416,9 +1733,7 @@ static struct dvb_usb_device_properties s6x0_properties = { | |||
1416 | .read_mac_address = s6x0_read_mac_address, | 1733 | .read_mac_address = s6x0_read_mac_address, |
1417 | .adapter = { | 1734 | .adapter = { |
1418 | { | 1735 | { |
1419 | .frontend_attach = s6x0_frontend_attach, | 1736 | .frontend_attach = zl100313_frontend_attach, |
1420 | .streaming_ctrl = NULL, | ||
1421 | .tuner_attach = NULL, | ||
1422 | .stream = { | 1737 | .stream = { |
1423 | .type = USB_BULK, | 1738 | .type = USB_BULK, |
1424 | .count = 8, | 1739 | .count = 8, |
@@ -1431,23 +1746,41 @@ static struct dvb_usb_device_properties s6x0_properties = { | |||
1431 | }, | 1746 | }, |
1432 | } | 1747 | } |
1433 | }, | 1748 | }, |
1434 | .num_device_descs = 3, | 1749 | .num_device_descs = 1, |
1435 | .devices = { | 1750 | .devices = { |
1436 | {"TeVii S630 USB", | 1751 | {"TeVii S630 USB", |
1437 | {&dw2102_table[6], NULL}, | 1752 | {&dw2102_table[6], NULL}, |
1438 | {NULL}, | 1753 | {NULL}, |
1439 | }, | 1754 | }, |
1440 | {"Prof 1100 USB ", | ||
1441 | {&dw2102_table[7], NULL}, | ||
1442 | {NULL}, | ||
1443 | }, | ||
1444 | {"TeVii S660 USB", | ||
1445 | {&dw2102_table[8], NULL}, | ||
1446 | {NULL}, | ||
1447 | }, | ||
1448 | } | 1755 | } |
1449 | }; | 1756 | }; |
1450 | 1757 | ||
1758 | struct dvb_usb_device_properties *p1100; | ||
1759 | static struct dvb_usb_device_description d1100 = { | ||
1760 | "Prof 1100 USB ", | ||
1761 | {&dw2102_table[7], NULL}, | ||
1762 | {NULL}, | ||
1763 | }; | ||
1764 | |||
1765 | struct dvb_usb_device_properties *s660; | ||
1766 | static struct dvb_usb_device_description d660 = { | ||
1767 | "TeVii S660 USB", | ||
1768 | {&dw2102_table[8], NULL}, | ||
1769 | {NULL}, | ||
1770 | }; | ||
1771 | |||
1772 | static struct dvb_usb_device_description d480_1 = { | ||
1773 | "TeVii S480.1 USB", | ||
1774 | {&dw2102_table[12], NULL}, | ||
1775 | {NULL}, | ||
1776 | }; | ||
1777 | |||
1778 | static struct dvb_usb_device_description d480_2 = { | ||
1779 | "TeVii S480.2 USB", | ||
1780 | {&dw2102_table[13], NULL}, | ||
1781 | {NULL}, | ||
1782 | }; | ||
1783 | |||
1451 | struct dvb_usb_device_properties *p7500; | 1784 | struct dvb_usb_device_properties *p7500; |
1452 | static struct dvb_usb_device_description d7500 = { | 1785 | static struct dvb_usb_device_description d7500 = { |
1453 | "Prof 7500 USB DVB-S2", | 1786 | "Prof 7500 USB DVB-S2", |
@@ -1455,21 +1788,101 @@ static struct dvb_usb_device_description d7500 = { | |||
1455 | {NULL}, | 1788 | {NULL}, |
1456 | }; | 1789 | }; |
1457 | 1790 | ||
1791 | static struct dvb_usb_device_properties su3000_properties = { | ||
1792 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1793 | .usb_ctrl = DEVICE_SPECIFIC, | ||
1794 | .size_of_priv = sizeof(struct su3000_state), | ||
1795 | .power_ctrl = su3000_power_ctrl, | ||
1796 | .num_adapters = 1, | ||
1797 | .identify_state = su3000_identify_state, | ||
1798 | .i2c_algo = &su3000_i2c_algo, | ||
1799 | |||
1800 | .rc.legacy = { | ||
1801 | .rc_map_table = rc_map_su3000_table, | ||
1802 | .rc_map_size = ARRAY_SIZE(rc_map_su3000_table), | ||
1803 | .rc_interval = 150, | ||
1804 | .rc_query = dw2102_rc_query, | ||
1805 | }, | ||
1806 | |||
1807 | .read_mac_address = su3000_read_mac_address, | ||
1808 | |||
1809 | .generic_bulk_ctrl_endpoint = 0x01, | ||
1810 | |||
1811 | .adapter = { | ||
1812 | { | ||
1813 | .streaming_ctrl = su3000_streaming_ctrl, | ||
1814 | .frontend_attach = su3000_frontend_attach, | ||
1815 | .stream = { | ||
1816 | .type = USB_BULK, | ||
1817 | .count = 8, | ||
1818 | .endpoint = 0x82, | ||
1819 | .u = { | ||
1820 | .bulk = { | ||
1821 | .buffersize = 4096, | ||
1822 | } | ||
1823 | } | ||
1824 | } | ||
1825 | } | ||
1826 | }, | ||
1827 | .num_device_descs = 3, | ||
1828 | .devices = { | ||
1829 | { "SU3000HD DVB-S USB2.0", | ||
1830 | { &dw2102_table[10], NULL }, | ||
1831 | { NULL }, | ||
1832 | }, | ||
1833 | { "Terratec Cinergy S2 USB HD", | ||
1834 | { &dw2102_table[11], NULL }, | ||
1835 | { NULL }, | ||
1836 | }, | ||
1837 | { "X3M TV SPC1400HD PCI", | ||
1838 | { &dw2102_table[14], NULL }, | ||
1839 | { NULL }, | ||
1840 | }, | ||
1841 | } | ||
1842 | }; | ||
1843 | |||
1458 | static int dw2102_probe(struct usb_interface *intf, | 1844 | static int dw2102_probe(struct usb_interface *intf, |
1459 | const struct usb_device_id *id) | 1845 | const struct usb_device_id *id) |
1460 | { | 1846 | { |
1847 | p1100 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
1848 | if (!p1100) | ||
1849 | return -ENOMEM; | ||
1850 | /* copy default structure */ | ||
1851 | memcpy(p1100, &s6x0_properties, | ||
1852 | sizeof(struct dvb_usb_device_properties)); | ||
1853 | /* fill only different fields */ | ||
1854 | p1100->firmware = "dvb-usb-p1100.fw"; | ||
1855 | p1100->devices[0] = d1100; | ||
1856 | p1100->rc.legacy.rc_map_table = rc_map_tbs_table; | ||
1857 | p1100->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table); | ||
1858 | p1100->adapter->frontend_attach = stv0288_frontend_attach; | ||
1859 | |||
1860 | s660 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
1861 | if (!s660) { | ||
1862 | kfree(p1100); | ||
1863 | return -ENOMEM; | ||
1864 | } | ||
1865 | memcpy(s660, &s6x0_properties, | ||
1866 | sizeof(struct dvb_usb_device_properties)); | ||
1867 | s660->firmware = "dvb-usb-s660.fw"; | ||
1868 | s660->num_device_descs = 3; | ||
1869 | s660->devices[0] = d660; | ||
1870 | s660->devices[1] = d480_1; | ||
1871 | s660->devices[2] = d480_2; | ||
1872 | s660->adapter->frontend_attach = ds3000_frontend_attach; | ||
1461 | 1873 | ||
1462 | p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | 1874 | p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
1463 | if (!p7500) | 1875 | if (!p7500) { |
1876 | kfree(p1100); | ||
1877 | kfree(s660); | ||
1464 | return -ENOMEM; | 1878 | return -ENOMEM; |
1465 | /* copy default structure */ | 1879 | } |
1466 | memcpy(p7500, &s6x0_properties, | 1880 | memcpy(p7500, &s6x0_properties, |
1467 | sizeof(struct dvb_usb_device_properties)); | 1881 | sizeof(struct dvb_usb_device_properties)); |
1468 | /* fill only different fields */ | ||
1469 | p7500->firmware = "dvb-usb-p7500.fw"; | 1882 | p7500->firmware = "dvb-usb-p7500.fw"; |
1470 | p7500->devices[0] = d7500; | 1883 | p7500->devices[0] = d7500; |
1471 | p7500->rc.legacy.rc_key_map = ir_codes_tbs_table; | 1884 | p7500->rc.legacy.rc_map_table = rc_map_tbs_table; |
1472 | p7500->rc.legacy.rc_key_map_size = ARRAY_SIZE(ir_codes_tbs_table); | 1885 | p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table); |
1473 | p7500->adapter->frontend_attach = prof_7500_frontend_attach; | 1886 | p7500->adapter->frontend_attach = prof_7500_frontend_attach; |
1474 | 1887 | ||
1475 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, | 1888 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
@@ -1480,8 +1893,14 @@ static int dw2102_probe(struct usb_interface *intf, | |||
1480 | THIS_MODULE, NULL, adapter_nr) || | 1893 | THIS_MODULE, NULL, adapter_nr) || |
1481 | 0 == dvb_usb_device_init(intf, &s6x0_properties, | 1894 | 0 == dvb_usb_device_init(intf, &s6x0_properties, |
1482 | THIS_MODULE, NULL, adapter_nr) || | 1895 | THIS_MODULE, NULL, adapter_nr) || |
1896 | 0 == dvb_usb_device_init(intf, p1100, | ||
1897 | THIS_MODULE, NULL, adapter_nr) || | ||
1898 | 0 == dvb_usb_device_init(intf, s660, | ||
1899 | THIS_MODULE, NULL, adapter_nr) || | ||
1483 | 0 == dvb_usb_device_init(intf, p7500, | 1900 | 0 == dvb_usb_device_init(intf, p7500, |
1484 | THIS_MODULE, NULL, adapter_nr)) | 1901 | THIS_MODULE, NULL, adapter_nr) || |
1902 | 0 == dvb_usb_device_init(intf, &su3000_properties, | ||
1903 | THIS_MODULE, NULL, adapter_nr)) | ||
1485 | return 0; | 1904 | return 0; |
1486 | 1905 | ||
1487 | return -ENODEV; | 1906 | return -ENODEV; |
@@ -1514,7 +1933,8 @@ module_exit(dw2102_module_exit); | |||
1514 | MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); | 1933 | MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); |
1515 | MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," | 1934 | MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," |
1516 | " DVB-C 3101 USB2.0," | 1935 | " DVB-C 3101 USB2.0," |
1517 | " TeVii S600, S630, S650, S660 USB2.0," | 1936 | " TeVii S600, S630, S650, S660, S480," |
1518 | " Prof 1100, 7500 USB2.0 devices"); | 1937 | " Prof 1100, 7500 USB2.0," |
1938 | " Geniatech SU3000 devices"); | ||
1519 | MODULE_VERSION("0.1"); | 1939 | MODULE_VERSION("0.1"); |
1520 | MODULE_LICENSE("GPL"); | 1940 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/dvb-usb/ec168.c b/drivers/media/dvb/dvb-usb/ec168.c index 52f5d4f0f230..1ba3e5dbee10 100644 --- a/drivers/media/dvb/dvb-usb/ec168.c +++ b/drivers/media/dvb/dvb-usb/ec168.c | |||
@@ -36,7 +36,9 @@ static int ec168_rw_udev(struct usb_device *udev, struct ec168_req *req) | |||
36 | int ret; | 36 | int ret; |
37 | unsigned int pipe; | 37 | unsigned int pipe; |
38 | u8 request, requesttype; | 38 | u8 request, requesttype; |
39 | u8 buf[req->size]; | 39 | u8 *buf; |
40 | |||
41 | |||
40 | 42 | ||
41 | switch (req->cmd) { | 43 | switch (req->cmd) { |
42 | case DOWNLOAD_FIRMWARE: | 44 | case DOWNLOAD_FIRMWARE: |
@@ -72,6 +74,12 @@ static int ec168_rw_udev(struct usb_device *udev, struct ec168_req *req) | |||
72 | goto error; | 74 | goto error; |
73 | } | 75 | } |
74 | 76 | ||
77 | buf = kmalloc(req->size, GFP_KERNEL); | ||
78 | if (!buf) { | ||
79 | ret = -ENOMEM; | ||
80 | goto error; | ||
81 | } | ||
82 | |||
75 | if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) { | 83 | if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) { |
76 | /* write */ | 84 | /* write */ |
77 | memcpy(buf, req->data, req->size); | 85 | memcpy(buf, req->data, req->size); |
@@ -84,13 +92,13 @@ static int ec168_rw_udev(struct usb_device *udev, struct ec168_req *req) | |||
84 | msleep(1); /* avoid I2C errors */ | 92 | msleep(1); /* avoid I2C errors */ |
85 | 93 | ||
86 | ret = usb_control_msg(udev, pipe, request, requesttype, req->value, | 94 | ret = usb_control_msg(udev, pipe, request, requesttype, req->value, |
87 | req->index, buf, sizeof(buf), EC168_USB_TIMEOUT); | 95 | req->index, buf, req->size, EC168_USB_TIMEOUT); |
88 | 96 | ||
89 | ec168_debug_dump(request, requesttype, req->value, req->index, buf, | 97 | ec168_debug_dump(request, requesttype, req->value, req->index, buf, |
90 | req->size, deb_xfer); | 98 | req->size, deb_xfer); |
91 | 99 | ||
92 | if (ret < 0) | 100 | if (ret < 0) |
93 | goto error; | 101 | goto err_dealloc; |
94 | else | 102 | else |
95 | ret = 0; | 103 | ret = 0; |
96 | 104 | ||
@@ -98,7 +106,11 @@ static int ec168_rw_udev(struct usb_device *udev, struct ec168_req *req) | |||
98 | if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN)) | 106 | if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN)) |
99 | memcpy(req->data, buf, req->size); | 107 | memcpy(req->data, buf, req->size); |
100 | 108 | ||
109 | kfree(buf); | ||
101 | return ret; | 110 | return ret; |
111 | |||
112 | err_dealloc: | ||
113 | kfree(buf); | ||
102 | error: | 114 | error: |
103 | deb_info("%s: failed:%d\n", __func__, ret); | 115 | deb_info("%s: failed:%d\n", __func__, ret); |
104 | return ret; | 116 | return ret; |
diff --git a/drivers/media/dvb/dvb-usb/friio-fe.c b/drivers/media/dvb/dvb-usb/friio-fe.c index 93c21ddd0b77..015b4e8af1a5 100644 --- a/drivers/media/dvb/dvb-usb/friio-fe.c +++ b/drivers/media/dvb/dvb-usb/friio-fe.c | |||
@@ -75,7 +75,7 @@ static int jdvbt90502_single_reg_write(struct jdvbt90502_state *state, | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | static int _jdvbt90502_write(struct dvb_frontend *fe, u8 *buf, int len) | 78 | static int _jdvbt90502_write(struct dvb_frontend *fe, const u8 buf[], int len) |
79 | { | 79 | { |
80 | struct jdvbt90502_state *state = fe->demodulator_priv; | 80 | struct jdvbt90502_state *state = fe->demodulator_priv; |
81 | int err, i; | 81 | int err, i; |
diff --git a/drivers/media/dvb/dvb-usb/friio.c b/drivers/media/dvb/dvb-usb/friio.c index 14a65b4aec07..76159aed9bb0 100644 --- a/drivers/media/dvb/dvb-usb/friio.c +++ b/drivers/media/dvb/dvb-usb/friio.c | |||
@@ -142,17 +142,20 @@ static u32 gl861_i2c_func(struct i2c_adapter *adapter) | |||
142 | return I2C_FUNC_I2C; | 142 | return I2C_FUNC_I2C; |
143 | } | 143 | } |
144 | 144 | ||
145 | |||
146 | static int friio_ext_ctl(struct dvb_usb_adapter *adap, | 145 | static int friio_ext_ctl(struct dvb_usb_adapter *adap, |
147 | u32 sat_color, int lnb_on) | 146 | u32 sat_color, int lnb_on) |
148 | { | 147 | { |
149 | int i; | 148 | int i; |
150 | int ret; | 149 | int ret; |
151 | struct i2c_msg msg; | 150 | struct i2c_msg msg; |
152 | u8 buf[2]; | 151 | u8 *buf; |
153 | u32 mask; | 152 | u32 mask; |
154 | u8 lnb = (lnb_on) ? FRIIO_CTL_LNB : 0; | 153 | u8 lnb = (lnb_on) ? FRIIO_CTL_LNB : 0; |
155 | 154 | ||
155 | buf = kmalloc(2, GFP_KERNEL); | ||
156 | if (!buf) | ||
157 | return -ENOMEM; | ||
158 | |||
156 | msg.addr = 0x00; | 159 | msg.addr = 0x00; |
157 | msg.flags = 0; | 160 | msg.flags = 0; |
158 | msg.len = 2; | 161 | msg.len = 2; |
@@ -189,6 +192,7 @@ static int friio_ext_ctl(struct dvb_usb_adapter *adap, | |||
189 | buf[1] |= FRIIO_CTL_CLK; | 192 | buf[1] |= FRIIO_CTL_CLK; |
190 | ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); | 193 | ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); |
191 | 194 | ||
195 | kfree(buf); | ||
192 | return (ret == 70); | 196 | return (ret == 70); |
193 | } | 197 | } |
194 | 198 | ||
@@ -219,11 +223,20 @@ static int friio_initialize(struct dvb_usb_device *d) | |||
219 | int ret; | 223 | int ret; |
220 | int i; | 224 | int i; |
221 | int retry = 0; | 225 | int retry = 0; |
222 | u8 rbuf[2]; | 226 | u8 *rbuf, *wbuf; |
223 | u8 wbuf[3]; | ||
224 | 227 | ||
225 | deb_info("%s called.\n", __func__); | 228 | deb_info("%s called.\n", __func__); |
226 | 229 | ||
230 | wbuf = kmalloc(3, GFP_KERNEL); | ||
231 | if (!wbuf) | ||
232 | return -ENOMEM; | ||
233 | |||
234 | rbuf = kmalloc(2, GFP_KERNEL); | ||
235 | if (!rbuf) { | ||
236 | kfree(wbuf); | ||
237 | return -ENOMEM; | ||
238 | } | ||
239 | |||
227 | /* use gl861_i2c_msg instead of gl861_i2c_xfer(), */ | 240 | /* use gl861_i2c_msg instead of gl861_i2c_xfer(), */ |
228 | /* because the i2c device is not set up yet. */ | 241 | /* because the i2c device is not set up yet. */ |
229 | wbuf[0] = 0x11; | 242 | wbuf[0] = 0x11; |
@@ -358,6 +371,8 @@ restart: | |||
358 | return 0; | 371 | return 0; |
359 | 372 | ||
360 | error: | 373 | error: |
374 | kfree(wbuf); | ||
375 | kfree(rbuf); | ||
361 | deb_info("%s:ret == %d\n", __func__, ret); | 376 | deb_info("%s:ret == %d\n", __func__, ret); |
362 | return -EIO; | 377 | return -EIO; |
363 | } | 378 | } |
diff --git a/drivers/media/dvb/dvb-usb/friio.h b/drivers/media/dvb/dvb-usb/friio.h index af8d55e390fb..0f461ca10cb9 100644 --- a/drivers/media/dvb/dvb-usb/friio.h +++ b/drivers/media/dvb/dvb-usb/friio.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * Frontend: comtech JDVBT-90502 | 20 | * Frontend: comtech JDVBT-90502 |
21 | * (tuner PLL: tua6034, I2C addr:(0xC0 >> 1)) | 21 | * (tuner PLL: tua6034, I2C addr:(0xC0 >> 1)) |
22 | * (OFDM demodulator: TC90502, I2C addr:(0x30 >> 1)) | 22 | * (OFDM demodulator: TC90502, I2C addr:(0x30 >> 1)) |
23 | * LED x3 (+LNB) controll: PIC 16F676 | 23 | * LED x3 (+LNB) control: PIC 16F676 |
24 | * EEPROM: 24C08 | 24 | * EEPROM: 24C08 |
25 | * | 25 | * |
26 | * (USB smart card reader: AU9522) | 26 | * (USB smart card reader: AU9522) |
diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c index dbdb5347b2a8..60d11e57e7d0 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk-fe.c +++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c | |||
@@ -109,7 +109,7 @@ static int gp8psk_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength | |||
109 | 109 | ||
110 | static int gp8psk_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 110 | static int gp8psk_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
111 | { | 111 | { |
112 | tune->min_delay_ms = 200; | 112 | tune->min_delay_ms = 800; |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | 115 | ||
@@ -334,7 +334,7 @@ success: | |||
334 | 334 | ||
335 | static struct dvb_frontend_ops gp8psk_fe_ops = { | 335 | static struct dvb_frontend_ops gp8psk_fe_ops = { |
336 | .info = { | 336 | .info = { |
337 | .name = "Genpix 8psk-to-USB2 DVB-S", | 337 | .name = "Genpix DVB-S", |
338 | .type = FE_QPSK, | 338 | .type = FE_QPSK, |
339 | .frequency_min = 800000, | 339 | .frequency_min = 800000, |
340 | .frequency_max = 2250000, | 340 | .frequency_max = 2250000, |
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c index 45106ac49674..1cb3d9a66e02 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.c +++ b/drivers/media/dvb/dvb-usb/gp8psk.c | |||
@@ -24,6 +24,33 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DV | |||
24 | 24 | ||
25 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 25 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
26 | 26 | ||
27 | static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers) | ||
28 | { | ||
29 | return (gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6)); | ||
30 | } | ||
31 | |||
32 | static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers) | ||
33 | { | ||
34 | return (gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1)); | ||
35 | } | ||
36 | |||
37 | static void gp8psk_info(struct dvb_usb_device *d) | ||
38 | { | ||
39 | u8 fpga_vers, fw_vers[6]; | ||
40 | |||
41 | if (!gp8psk_get_fw_version(d, fw_vers)) | ||
42 | info("FW Version = %i.%02i.%i (0x%x) Build %4i/%02i/%02i", | ||
43 | fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers), | ||
44 | 2000 + fw_vers[5], fw_vers[4], fw_vers[3]); | ||
45 | else | ||
46 | info("failed to get FW version"); | ||
47 | |||
48 | if (!gp8psk_get_fpga_version(d, &fpga_vers)) | ||
49 | info("FPGA Version = %i", fpga_vers); | ||
50 | else | ||
51 | info("failed to get FPGA version"); | ||
52 | } | ||
53 | |||
27 | int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | 54 | int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) |
28 | { | 55 | { |
29 | int ret = 0,try = 0; | 56 | int ret = 0,try = 0; |
@@ -146,6 +173,7 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
146 | gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); | 173 | gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); |
147 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) | 174 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) |
148 | return -EINVAL; | 175 | return -EINVAL; |
176 | gp8psk_info(d); | ||
149 | } | 177 | } |
150 | 178 | ||
151 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) | 179 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) |
@@ -227,6 +255,7 @@ static struct usb_device_id gp8psk_usb_table [] = { | |||
227 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_1_WARM) }, | 255 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_1_WARM) }, |
228 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_2) }, | 256 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_2) }, |
229 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_1) }, | 257 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_1) }, |
258 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_2) }, | ||
230 | /* { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_CW3K) }, */ | 259 | /* { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_CW3K) }, */ |
231 | { 0 }, | 260 | { 0 }, |
232 | }; | 261 | }; |
@@ -258,7 +287,7 @@ static struct dvb_usb_device_properties gp8psk_properties = { | |||
258 | 287 | ||
259 | .generic_bulk_ctrl_endpoint = 0x01, | 288 | .generic_bulk_ctrl_endpoint = 0x01, |
260 | 289 | ||
261 | .num_device_descs = 3, | 290 | .num_device_descs = 4, |
262 | .devices = { | 291 | .devices = { |
263 | { .name = "Genpix 8PSK-to-USB2 Rev.1 DVB-S receiver", | 292 | { .name = "Genpix 8PSK-to-USB2 Rev.1 DVB-S receiver", |
264 | .cold_ids = { &gp8psk_usb_table[0], NULL }, | 293 | .cold_ids = { &gp8psk_usb_table[0], NULL }, |
@@ -272,6 +301,10 @@ static struct dvb_usb_device_properties gp8psk_properties = { | |||
272 | .cold_ids = { NULL }, | 301 | .cold_ids = { NULL }, |
273 | .warm_ids = { &gp8psk_usb_table[3], NULL }, | 302 | .warm_ids = { &gp8psk_usb_table[3], NULL }, |
274 | }, | 303 | }, |
304 | { .name = "Genpix SkyWalker-2 DVB-S receiver", | ||
305 | .cold_ids = { NULL }, | ||
306 | .warm_ids = { &gp8psk_usb_table[4], NULL }, | ||
307 | }, | ||
275 | { NULL }, | 308 | { NULL }, |
276 | } | 309 | } |
277 | }; | 310 | }; |
@@ -306,6 +339,6 @@ module_init(gp8psk_usb_module_init); | |||
306 | module_exit(gp8psk_usb_module_exit); | 339 | module_exit(gp8psk_usb_module_exit); |
307 | 340 | ||
308 | MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>"); | 341 | MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>"); |
309 | MODULE_DESCRIPTION("Driver for Genpix 8psk-to-USB2 DVB-S"); | 342 | MODULE_DESCRIPTION("Driver for Genpix DVB-S"); |
310 | MODULE_VERSION("1.1"); | 343 | MODULE_VERSION("1.1"); |
311 | MODULE_LICENSE("GPL"); | 344 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h b/drivers/media/dvb/dvb-usb/gp8psk.h index e83a57506cfa..831749a518cb 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.h +++ b/drivers/media/dvb/dvb-usb/gp8psk.h | |||
@@ -25,7 +25,6 @@ extern int dvb_usb_gp8psk_debug; | |||
25 | #define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args) | 25 | #define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args) |
26 | #define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args) | 26 | #define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args) |
27 | #define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args) | 27 | #define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args) |
28 | /* gp8psk commands */ | ||
29 | 28 | ||
30 | /* Twinhan Vendor requests */ | 29 | /* Twinhan Vendor requests */ |
31 | #define TH_COMMAND_IN 0xC0 | 30 | #define TH_COMMAND_IN 0xC0 |
@@ -49,8 +48,10 @@ extern int dvb_usb_gp8psk_debug; | |||
49 | #define SET_DVB_MODE 0x8E | 48 | #define SET_DVB_MODE 0x8E |
50 | #define SET_DN_SWITCH 0x8F | 49 | #define SET_DN_SWITCH 0x8F |
51 | #define GET_SIGNAL_LOCK 0x90 /* in */ | 50 | #define GET_SIGNAL_LOCK 0x90 /* in */ |
51 | #define GET_FW_VERS 0x92 | ||
52 | #define GET_SERIAL_NUMBER 0x93 /* in */ | 52 | #define GET_SERIAL_NUMBER 0x93 /* in */ |
53 | #define USE_EXTRA_VOLT 0x94 | 53 | #define USE_EXTRA_VOLT 0x94 |
54 | #define GET_FPGA_VERS 0x95 | ||
54 | #define CW3K_INIT 0x9d | 55 | #define CW3K_INIT 0x9d |
55 | 56 | ||
56 | /* PSK_configuration bits */ | 57 | /* PSK_configuration bits */ |
@@ -88,6 +89,11 @@ extern int dvb_usb_gp8psk_debug; | |||
88 | #define PRODUCT_STRING_READ 0x0D | 89 | #define PRODUCT_STRING_READ 0x0D |
89 | #define FW_BCD_VERSION_READ 0x14 | 90 | #define FW_BCD_VERSION_READ 0x14 |
90 | 91 | ||
92 | /* firmware revision id's */ | ||
93 | #define GP8PSK_FW_REV1 0x020604 | ||
94 | #define GP8PSK_FW_REV2 0x020704 | ||
95 | #define GP8PSK_FW_VERS(_fw_vers) ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0]) | ||
96 | |||
91 | extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d); | 97 | extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d); |
92 | extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); | 98 | extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); |
93 | extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | 99 | extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, |
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c new file mode 100644 index 000000000000..37b146961ae2 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/lmedm04.c | |||
@@ -0,0 +1,1310 @@ | |||
1 | /* DVB USB compliant linux driver for | ||
2 | * | ||
3 | * DM04/QQBOX DVB-S USB BOX LME2510C + SHARP:BS2F7HZ7395 | ||
4 | * LME2510C + LG TDQY-P001F | ||
5 | * LME2510C + BS2F7HZ0194 | ||
6 | * LME2510 + LG TDQY-P001F | ||
7 | * LME2510 + BS2F7HZ0194 | ||
8 | * | ||
9 | * MVB7395 (LME2510C+SHARP:BS2F7HZ7395) | ||
10 | * SHARP:BS2F7HZ7395 = (STV0288+Sharp IX2505V) | ||
11 | * | ||
12 | * MV001F (LME2510+LGTDQY-P001F) | ||
13 | * LG TDQY - P001F =(TDA8263 + TDA10086H) | ||
14 | * | ||
15 | * MVB0001F (LME2510C+LGTDQT-P001F) | ||
16 | * | ||
17 | * MV0194 (LME2510+SHARP:BS2F7HZ0194) | ||
18 | * SHARP:BS2F7HZ0194 = (STV0299+IX2410) | ||
19 | * | ||
20 | * MVB0194 (LME2510C+SHARP0194) | ||
21 | * | ||
22 | * For firmware see Documentation/dvb/lmedm04.txt | ||
23 | * | ||
24 | * I2C addresses: | ||
25 | * 0xd0 - STV0288 - Demodulator | ||
26 | * 0xc0 - Sharp IX2505V - Tuner | ||
27 | * -- | ||
28 | * 0x1c - TDA10086 - Demodulator | ||
29 | * 0xc0 - TDA8263 - Tuner | ||
30 | * -- | ||
31 | * 0xd0 - STV0299 - Demodulator | ||
32 | * 0xc0 - IX2410 - Tuner | ||
33 | * | ||
34 | * | ||
35 | * VID = 3344 PID LME2510=1122 LME2510C=1120 | ||
36 | * | ||
37 | * Copyright (C) 2010 Malcolm Priestley (tvboxspy@gmail.com) | ||
38 | * LME2510(C)(C) Leaguerme (Shenzhen) MicroElectronics Co., Ltd. | ||
39 | * | ||
40 | * This program is free software; you can redistribute it and/or modify | ||
41 | * it under the terms of the GNU General Public License Version 2, as | ||
42 | * published by the Free Software Foundation. | ||
43 | * | ||
44 | * This program is distributed in the hope that it will be useful, | ||
45 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
46 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
47 | * GNU General Public License for more details. | ||
48 | * | ||
49 | * You should have received a copy of the GNU General Public License | ||
50 | * along with this program; if not, write to the Free Software | ||
51 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
52 | * | ||
53 | * | ||
54 | * see Documentation/dvb/README.dvb-usb for more information | ||
55 | * | ||
56 | * Known Issues : | ||
57 | * LME2510: Non Intel USB chipsets fail to maintain High Speed on | ||
58 | * Boot or Hot Plug. | ||
59 | * | ||
60 | * QQbox suffers from noise on LNB voltage. | ||
61 | * | ||
62 | * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system | ||
63 | * with other tuners. After a cold reset streaming will not start. | ||
64 | * | ||
65 | */ | ||
66 | #define DVB_USB_LOG_PREFIX "LME2510(C)" | ||
67 | #include <linux/usb.h> | ||
68 | #include <linux/usb/input.h> | ||
69 | #include <media/rc-core.h> | ||
70 | |||
71 | #include "dvb-usb.h" | ||
72 | #include "lmedm04.h" | ||
73 | #include "tda826x.h" | ||
74 | #include "tda10086.h" | ||
75 | #include "stv0288.h" | ||
76 | #include "ix2505v.h" | ||
77 | #include "stv0299.h" | ||
78 | #include "dvb-pll.h" | ||
79 | #include "z0194a.h" | ||
80 | |||
81 | |||
82 | |||
83 | /* debug */ | ||
84 | static int dvb_usb_lme2510_debug; | ||
85 | #define l_dprintk(var, level, args...) do { \ | ||
86 | if ((var >= level)) \ | ||
87 | printk(KERN_DEBUG DVB_USB_LOG_PREFIX ": " args); \ | ||
88 | } while (0) | ||
89 | |||
90 | #define deb_info(level, args...) l_dprintk(dvb_usb_lme2510_debug, level, args) | ||
91 | #define debug_data_snipet(level, name, p) \ | ||
92 | deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \ | ||
93 | *p, *(p+1), *(p+2), *(p+3), *(p+4), \ | ||
94 | *(p+5), *(p+6), *(p+7)); | ||
95 | |||
96 | |||
97 | module_param_named(debug, dvb_usb_lme2510_debug, int, 0644); | ||
98 | MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." | ||
99 | DVB_USB_DEBUG_STATUS); | ||
100 | |||
101 | static int dvb_usb_lme2510_firmware; | ||
102 | module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644); | ||
103 | MODULE_PARM_DESC(firmware, "set default firmware 0=Sharp7395 1=LG"); | ||
104 | |||
105 | static int pid_filter; | ||
106 | module_param_named(pid, pid_filter, int, 0644); | ||
107 | MODULE_PARM_DESC(pid, "set default 0=on 1=off"); | ||
108 | |||
109 | |||
110 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
111 | |||
112 | #define TUNER_DEFAULT 0x0 | ||
113 | #define TUNER_LG 0x1 | ||
114 | #define TUNER_S7395 0x2 | ||
115 | #define TUNER_S0194 0x3 | ||
116 | |||
117 | struct lme2510_state { | ||
118 | u8 id; | ||
119 | u8 tuner_config; | ||
120 | u8 signal_lock; | ||
121 | u8 signal_level; | ||
122 | u8 signal_sn; | ||
123 | u8 time_key; | ||
124 | u8 i2c_talk_onoff; | ||
125 | u8 i2c_gate; | ||
126 | u8 i2c_tuner_gate_w; | ||
127 | u8 i2c_tuner_gate_r; | ||
128 | u8 i2c_tuner_addr; | ||
129 | u8 stream_on; | ||
130 | u8 pid_size; | ||
131 | void *buffer; | ||
132 | struct urb *lme_urb; | ||
133 | void *usb_buffer; | ||
134 | |||
135 | }; | ||
136 | |||
137 | static int lme2510_bulk_write(struct usb_device *dev, | ||
138 | u8 *snd, int len, u8 pipe) | ||
139 | { | ||
140 | int ret, actual_l; | ||
141 | |||
142 | ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe), | ||
143 | snd, len , &actual_l, 100); | ||
144 | return ret; | ||
145 | } | ||
146 | |||
147 | static int lme2510_bulk_read(struct usb_device *dev, | ||
148 | u8 *rev, int len, u8 pipe) | ||
149 | { | ||
150 | int ret, actual_l; | ||
151 | |||
152 | ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe), | ||
153 | rev, len , &actual_l, 200); | ||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | static int lme2510_usb_talk(struct dvb_usb_device *d, | ||
158 | u8 *wbuf, int wlen, u8 *rbuf, int rlen) | ||
159 | { | ||
160 | struct lme2510_state *st = d->priv; | ||
161 | u8 *buff; | ||
162 | int ret = 0; | ||
163 | |||
164 | if (st->usb_buffer == NULL) { | ||
165 | st->usb_buffer = kmalloc(512, GFP_KERNEL); | ||
166 | if (st->usb_buffer == NULL) { | ||
167 | info("MEM Error no memory"); | ||
168 | return -ENOMEM; | ||
169 | } | ||
170 | } | ||
171 | buff = st->usb_buffer; | ||
172 | |||
173 | ret = mutex_lock_interruptible(&d->usb_mutex); | ||
174 | |||
175 | if (ret < 0) | ||
176 | return -EAGAIN; | ||
177 | |||
178 | /* the read/write capped at 512 */ | ||
179 | memcpy(buff, wbuf, (wlen > 512) ? 512 : wlen); | ||
180 | |||
181 | ret |= usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01)); | ||
182 | |||
183 | ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01); | ||
184 | |||
185 | msleep(10); | ||
186 | |||
187 | ret |= usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x01)); | ||
188 | |||
189 | ret |= lme2510_bulk_read(d->udev, buff, (rlen > 512) ? | ||
190 | 512 : rlen , 0x01); | ||
191 | |||
192 | if (rlen > 0) | ||
193 | memcpy(rbuf, buff, rlen); | ||
194 | |||
195 | mutex_unlock(&d->usb_mutex); | ||
196 | |||
197 | return (ret < 0) ? -ENODEV : 0; | ||
198 | } | ||
199 | |||
200 | static int lme2510_stream_restart(struct dvb_usb_device *d) | ||
201 | { | ||
202 | static u8 stream_on[] = LME_ST_ON_W; | ||
203 | int ret; | ||
204 | u8 rbuff[10]; | ||
205 | /*Restart Stream Command*/ | ||
206 | ret = lme2510_usb_talk(d, stream_on, sizeof(stream_on), | ||
207 | rbuff, sizeof(rbuff)); | ||
208 | return ret; | ||
209 | } | ||
210 | |||
211 | static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) | ||
212 | { | ||
213 | struct lme2510_state *st = d->priv; | ||
214 | static u8 pid_buff[] = LME_ZERO_PID; | ||
215 | static u8 rbuf[1]; | ||
216 | u8 pid_no = index * 2; | ||
217 | u8 pid_len = pid_no + 2; | ||
218 | int ret = 0; | ||
219 | deb_info(1, "PID Setting Pid %04x", pid_out); | ||
220 | |||
221 | if (st->pid_size == 0) | ||
222 | ret |= lme2510_stream_restart(d); | ||
223 | |||
224 | pid_buff[2] = pid_no; | ||
225 | pid_buff[3] = (u8)pid_out & 0xff; | ||
226 | pid_buff[4] = pid_no + 1; | ||
227 | pid_buff[5] = (u8)(pid_out >> 8); | ||
228 | |||
229 | if (pid_len > st->pid_size) | ||
230 | st->pid_size = pid_len; | ||
231 | pid_buff[7] = 0x80 + st->pid_size; | ||
232 | |||
233 | ret |= lme2510_usb_talk(d, pid_buff , | ||
234 | sizeof(pid_buff) , rbuf, sizeof(rbuf)); | ||
235 | |||
236 | if (st->stream_on) | ||
237 | ret |= lme2510_stream_restart(d); | ||
238 | |||
239 | return ret; | ||
240 | } | ||
241 | |||
242 | static void lme2510_int_response(struct urb *lme_urb) | ||
243 | { | ||
244 | struct dvb_usb_adapter *adap = lme_urb->context; | ||
245 | struct lme2510_state *st = adap->dev->priv; | ||
246 | static u8 *ibuf, *rbuf; | ||
247 | int i = 0, offset; | ||
248 | u32 key; | ||
249 | |||
250 | switch (lme_urb->status) { | ||
251 | case 0: | ||
252 | case -ETIMEDOUT: | ||
253 | break; | ||
254 | case -ECONNRESET: | ||
255 | case -ENOENT: | ||
256 | case -ESHUTDOWN: | ||
257 | return; | ||
258 | default: | ||
259 | info("Error %x", lme_urb->status); | ||
260 | break; | ||
261 | } | ||
262 | |||
263 | rbuf = (u8 *) lme_urb->transfer_buffer; | ||
264 | |||
265 | offset = ((lme_urb->actual_length/8) > 4) | ||
266 | ? 4 : (lme_urb->actual_length/8) ; | ||
267 | |||
268 | for (i = 0; i < offset; ++i) { | ||
269 | ibuf = (u8 *)&rbuf[i*8]; | ||
270 | deb_info(5, "INT O/S C =%02x C/O=%02x Type =%02x%02x", | ||
271 | offset, i, ibuf[0], ibuf[1]); | ||
272 | |||
273 | switch (ibuf[0]) { | ||
274 | case 0xaa: | ||
275 | debug_data_snipet(1, "INT Remote data snipet", ibuf); | ||
276 | if ((ibuf[4] + ibuf[5]) == 0xff) { | ||
277 | key = ibuf[5]; | ||
278 | key += (ibuf[3] > 0) | ||
279 | ? (ibuf[3] ^ 0xff) << 8 : 0; | ||
280 | key += (ibuf[2] ^ 0xff) << 16; | ||
281 | deb_info(1, "INT Key =%08x", key); | ||
282 | if (adap->dev->rc_dev != NULL) | ||
283 | rc_keydown(adap->dev->rc_dev, key, 0); | ||
284 | } | ||
285 | break; | ||
286 | case 0xbb: | ||
287 | switch (st->tuner_config) { | ||
288 | case TUNER_LG: | ||
289 | if (ibuf[2] > 0) | ||
290 | st->signal_lock = ibuf[2]; | ||
291 | st->signal_level = ibuf[4]; | ||
292 | st->signal_sn = ibuf[3]; | ||
293 | st->time_key = ibuf[7]; | ||
294 | break; | ||
295 | case TUNER_S7395: | ||
296 | case TUNER_S0194: | ||
297 | /* Tweak for earlier firmware*/ | ||
298 | if (ibuf[1] == 0x03) { | ||
299 | if (ibuf[2] > 1) | ||
300 | st->signal_lock = ibuf[2]; | ||
301 | st->signal_level = ibuf[3]; | ||
302 | st->signal_sn = ibuf[4]; | ||
303 | } else { | ||
304 | st->signal_level = ibuf[4]; | ||
305 | st->signal_sn = ibuf[5]; | ||
306 | st->signal_lock = | ||
307 | (st->signal_lock & 0xf7) + | ||
308 | ((ibuf[2] & 0x01) << 0x03); | ||
309 | } | ||
310 | break; | ||
311 | default: | ||
312 | break; | ||
313 | } | ||
314 | debug_data_snipet(5, "INT Remote data snipet in", ibuf); | ||
315 | break; | ||
316 | case 0xcc: | ||
317 | debug_data_snipet(1, "INT Control data snipet", ibuf); | ||
318 | break; | ||
319 | default: | ||
320 | debug_data_snipet(1, "INT Unknown data snipet", ibuf); | ||
321 | break; | ||
322 | } | ||
323 | } | ||
324 | usb_submit_urb(lme_urb, GFP_ATOMIC); | ||
325 | } | ||
326 | |||
327 | static int lme2510_int_read(struct dvb_usb_adapter *adap) | ||
328 | { | ||
329 | struct lme2510_state *lme_int = adap->dev->priv; | ||
330 | |||
331 | lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC); | ||
332 | |||
333 | if (lme_int->lme_urb == NULL) | ||
334 | return -ENOMEM; | ||
335 | |||
336 | lme_int->buffer = usb_alloc_coherent(adap->dev->udev, 5000, GFP_ATOMIC, | ||
337 | &lme_int->lme_urb->transfer_dma); | ||
338 | |||
339 | if (lme_int->buffer == NULL) | ||
340 | return -ENOMEM; | ||
341 | |||
342 | usb_fill_int_urb(lme_int->lme_urb, | ||
343 | adap->dev->udev, | ||
344 | usb_rcvintpipe(adap->dev->udev, 0xa), | ||
345 | lme_int->buffer, | ||
346 | 4096, | ||
347 | lme2510_int_response, | ||
348 | adap, | ||
349 | 11); | ||
350 | |||
351 | lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
352 | |||
353 | usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC); | ||
354 | info("INT Interrupt Service Started"); | ||
355 | |||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) | ||
360 | { | ||
361 | struct lme2510_state *st = adap->dev->priv; | ||
362 | static u8 clear_pid_reg[] = LME_CLEAR_PID; | ||
363 | static u8 rbuf[1]; | ||
364 | int ret; | ||
365 | |||
366 | deb_info(1, "PID Clearing Filter"); | ||
367 | |||
368 | ret = mutex_lock_interruptible(&adap->dev->i2c_mutex); | ||
369 | if (ret < 0) | ||
370 | return -EAGAIN; | ||
371 | |||
372 | if (!onoff) | ||
373 | ret |= lme2510_usb_talk(adap->dev, clear_pid_reg, | ||
374 | sizeof(clear_pid_reg), rbuf, sizeof(rbuf)); | ||
375 | |||
376 | st->pid_size = 0; | ||
377 | |||
378 | mutex_unlock(&adap->dev->i2c_mutex); | ||
379 | |||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, | ||
384 | int onoff) | ||
385 | { | ||
386 | int ret = 0; | ||
387 | |||
388 | deb_info(3, "%s PID=%04x Index=%04x onoff=%02x", __func__, | ||
389 | pid, index, onoff); | ||
390 | |||
391 | if (onoff) | ||
392 | if (!pid_filter) { | ||
393 | ret = mutex_lock_interruptible(&adap->dev->i2c_mutex); | ||
394 | if (ret < 0) | ||
395 | return -EAGAIN; | ||
396 | ret |= lme2510_enable_pid(adap->dev, index, pid); | ||
397 | mutex_unlock(&adap->dev->i2c_mutex); | ||
398 | } | ||
399 | |||
400 | |||
401 | return ret; | ||
402 | } | ||
403 | |||
404 | |||
405 | static int lme2510_return_status(struct usb_device *dev) | ||
406 | { | ||
407 | int ret = 0; | ||
408 | u8 *data; | ||
409 | |||
410 | data = kzalloc(10, GFP_KERNEL); | ||
411 | if (!data) | ||
412 | return -ENOMEM; | ||
413 | |||
414 | ret |= usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
415 | 0x06, 0x80, 0x0302, 0x00, data, 0x0006, 200); | ||
416 | info("Firmware Status: %x (%x)", ret , data[2]); | ||
417 | |||
418 | ret = (ret < 0) ? -ENODEV : data[2]; | ||
419 | kfree(data); | ||
420 | return ret; | ||
421 | } | ||
422 | |||
423 | static int lme2510_msg(struct dvb_usb_device *d, | ||
424 | u8 *wbuf, int wlen, u8 *rbuf, int rlen) | ||
425 | { | ||
426 | int ret = 0; | ||
427 | struct lme2510_state *st = d->priv; | ||
428 | |||
429 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
430 | return -EAGAIN; | ||
431 | |||
432 | if (st->i2c_talk_onoff == 1) { | ||
433 | |||
434 | ret = lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); | ||
435 | |||
436 | switch (st->tuner_config) { | ||
437 | case TUNER_LG: | ||
438 | if (wbuf[2] == 0x1c) { | ||
439 | if (wbuf[3] == 0x0e) { | ||
440 | st->signal_lock = rbuf[1]; | ||
441 | if ((st->stream_on & 1) && | ||
442 | (st->signal_lock & 0x10)) { | ||
443 | lme2510_stream_restart(d); | ||
444 | st->i2c_talk_onoff = 0; | ||
445 | } | ||
446 | msleep(80); | ||
447 | } | ||
448 | } | ||
449 | break; | ||
450 | case TUNER_S7395: | ||
451 | if (wbuf[2] == 0xd0) { | ||
452 | if (wbuf[3] == 0x24) { | ||
453 | st->signal_lock = rbuf[1]; | ||
454 | if ((st->stream_on & 1) && | ||
455 | (st->signal_lock & 0x8)) { | ||
456 | lme2510_stream_restart(d); | ||
457 | st->i2c_talk_onoff = 0; | ||
458 | } | ||
459 | } | ||
460 | if ((wbuf[3] != 0x6) & (wbuf[3] != 0x5)) | ||
461 | msleep(5); | ||
462 | } | ||
463 | break; | ||
464 | case TUNER_S0194: | ||
465 | if (wbuf[2] == 0xd0) { | ||
466 | if (wbuf[3] == 0x1b) { | ||
467 | st->signal_lock = rbuf[1]; | ||
468 | if ((st->stream_on & 1) && | ||
469 | (st->signal_lock & 0x8)) { | ||
470 | lme2510_stream_restart(d); | ||
471 | st->i2c_talk_onoff = 0; | ||
472 | } | ||
473 | } | ||
474 | } | ||
475 | break; | ||
476 | default: | ||
477 | break; | ||
478 | } | ||
479 | } else { | ||
480 | switch (st->tuner_config) { | ||
481 | case TUNER_LG: | ||
482 | switch (wbuf[3]) { | ||
483 | case 0x0e: | ||
484 | rbuf[0] = 0x55; | ||
485 | rbuf[1] = st->signal_lock; | ||
486 | break; | ||
487 | case 0x43: | ||
488 | rbuf[0] = 0x55; | ||
489 | rbuf[1] = st->signal_level; | ||
490 | break; | ||
491 | case 0x1c: | ||
492 | rbuf[0] = 0x55; | ||
493 | rbuf[1] = st->signal_sn; | ||
494 | break; | ||
495 | case 0x15: | ||
496 | case 0x16: | ||
497 | case 0x17: | ||
498 | case 0x18: | ||
499 | rbuf[0] = 0x55; | ||
500 | rbuf[1] = 0x00; | ||
501 | break; | ||
502 | default: | ||
503 | lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); | ||
504 | st->i2c_talk_onoff = 1; | ||
505 | break; | ||
506 | } | ||
507 | break; | ||
508 | case TUNER_S7395: | ||
509 | switch (wbuf[3]) { | ||
510 | case 0x10: | ||
511 | rbuf[0] = 0x55; | ||
512 | rbuf[1] = (st->signal_level & 0x80) | ||
513 | ? 0 : (st->signal_level * 2); | ||
514 | break; | ||
515 | case 0x2d: | ||
516 | rbuf[0] = 0x55; | ||
517 | rbuf[1] = st->signal_sn; | ||
518 | break; | ||
519 | case 0x24: | ||
520 | rbuf[0] = 0x55; | ||
521 | rbuf[1] = st->signal_lock; | ||
522 | break; | ||
523 | case 0x2e: | ||
524 | case 0x26: | ||
525 | case 0x27: | ||
526 | rbuf[0] = 0x55; | ||
527 | rbuf[1] = 0x00; | ||
528 | break; | ||
529 | default: | ||
530 | lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); | ||
531 | st->i2c_talk_onoff = 1; | ||
532 | break; | ||
533 | } | ||
534 | break; | ||
535 | case TUNER_S0194: | ||
536 | switch (wbuf[3]) { | ||
537 | case 0x18: | ||
538 | rbuf[0] = 0x55; | ||
539 | rbuf[1] = (st->signal_level & 0x80) | ||
540 | ? 0 : (st->signal_level * 2); | ||
541 | break; | ||
542 | case 0x24: | ||
543 | rbuf[0] = 0x55; | ||
544 | rbuf[1] = st->signal_sn; | ||
545 | break; | ||
546 | case 0x1b: | ||
547 | rbuf[0] = 0x55; | ||
548 | rbuf[1] = st->signal_lock; | ||
549 | break; | ||
550 | case 0x19: | ||
551 | case 0x25: | ||
552 | case 0x1e: | ||
553 | case 0x1d: | ||
554 | rbuf[0] = 0x55; | ||
555 | rbuf[1] = 0x00; | ||
556 | break; | ||
557 | default: | ||
558 | lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); | ||
559 | st->i2c_talk_onoff = 1; | ||
560 | break; | ||
561 | } | ||
562 | break; | ||
563 | default: | ||
564 | break; | ||
565 | } | ||
566 | |||
567 | deb_info(4, "I2C From Interrupt Message out(%02x) in(%02x)", | ||
568 | wbuf[3], rbuf[1]); | ||
569 | |||
570 | } | ||
571 | |||
572 | mutex_unlock(&d->i2c_mutex); | ||
573 | |||
574 | return ret; | ||
575 | } | ||
576 | |||
577 | |||
578 | static int lme2510_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
579 | int num) | ||
580 | { | ||
581 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
582 | struct lme2510_state *st = d->priv; | ||
583 | static u8 obuf[64], ibuf[512]; | ||
584 | int i, read, read_o; | ||
585 | u16 len; | ||
586 | u8 gate = st->i2c_gate; | ||
587 | |||
588 | if (gate == 0) | ||
589 | gate = 5; | ||
590 | |||
591 | if (num > 2) | ||
592 | warn("more than 2 i2c messages" | ||
593 | "at a time is not handled yet. TODO."); | ||
594 | |||
595 | for (i = 0; i < num; i++) { | ||
596 | read_o = 1 & (msg[i].flags & I2C_M_RD); | ||
597 | read = i+1 < num && (msg[i+1].flags & I2C_M_RD); | ||
598 | read |= read_o; | ||
599 | gate = (msg[i].addr == st->i2c_tuner_addr) | ||
600 | ? (read) ? st->i2c_tuner_gate_r | ||
601 | : st->i2c_tuner_gate_w | ||
602 | : st->i2c_gate; | ||
603 | obuf[0] = gate | (read << 7); | ||
604 | |||
605 | if (gate == 5) | ||
606 | obuf[1] = (read) ? 2 : msg[i].len + 1; | ||
607 | else | ||
608 | obuf[1] = msg[i].len + read + 1; | ||
609 | |||
610 | obuf[2] = msg[i].addr; | ||
611 | if (read) { | ||
612 | if (read_o) | ||
613 | len = 3; | ||
614 | else { | ||
615 | memcpy(&obuf[3], msg[i].buf, msg[i].len); | ||
616 | obuf[msg[i].len+3] = msg[i+1].len; | ||
617 | len = msg[i].len+4; | ||
618 | } | ||
619 | } else { | ||
620 | memcpy(&obuf[3], msg[i].buf, msg[i].len); | ||
621 | len = msg[i].len+3; | ||
622 | } | ||
623 | |||
624 | if (lme2510_msg(d, obuf, len, ibuf, 512) < 0) { | ||
625 | deb_info(1, "i2c transfer failed."); | ||
626 | return -EAGAIN; | ||
627 | } | ||
628 | |||
629 | if (read) { | ||
630 | if (read_o) | ||
631 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); | ||
632 | else { | ||
633 | memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); | ||
634 | i++; | ||
635 | } | ||
636 | } | ||
637 | } | ||
638 | return i; | ||
639 | } | ||
640 | |||
641 | static u32 lme2510_i2c_func(struct i2c_adapter *adapter) | ||
642 | { | ||
643 | return I2C_FUNC_I2C; | ||
644 | } | ||
645 | |||
646 | static struct i2c_algorithm lme2510_i2c_algo = { | ||
647 | .master_xfer = lme2510_i2c_xfer, | ||
648 | .functionality = lme2510_i2c_func, | ||
649 | }; | ||
650 | |||
651 | /* Callbacks for DVB USB */ | ||
652 | static int lme2510_identify_state(struct usb_device *udev, | ||
653 | struct dvb_usb_device_properties *props, | ||
654 | struct dvb_usb_device_description **desc, | ||
655 | int *cold) | ||
656 | { | ||
657 | *cold = 0; | ||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | ||
662 | { | ||
663 | struct lme2510_state *st = adap->dev->priv; | ||
664 | static u8 clear_reg_3[] = LME_CLEAR_PID; | ||
665 | static u8 rbuf[1]; | ||
666 | int ret = 0, rlen = sizeof(rbuf); | ||
667 | |||
668 | deb_info(1, "STM (%02x)", onoff); | ||
669 | |||
670 | /* Streaming is started by FE_HAS_LOCK */ | ||
671 | if (onoff == 1) | ||
672 | st->stream_on = 1; | ||
673 | else { | ||
674 | deb_info(1, "STM Steam Off"); | ||
675 | /* mutex is here only to avoid collision with I2C */ | ||
676 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) | ||
677 | return -EAGAIN; | ||
678 | |||
679 | ret = lme2510_usb_talk(adap->dev, clear_reg_3, | ||
680 | sizeof(clear_reg_3), rbuf, rlen); | ||
681 | st->stream_on = 0; | ||
682 | st->i2c_talk_onoff = 1; | ||
683 | |||
684 | mutex_unlock(&adap->dev->i2c_mutex); | ||
685 | } | ||
686 | |||
687 | return (ret < 0) ? -ENODEV : 0; | ||
688 | } | ||
689 | |||
690 | static u8 check_sum(u8 *p, u8 len) | ||
691 | { | ||
692 | u8 sum = 0; | ||
693 | while (len--) | ||
694 | sum += *p++; | ||
695 | return sum; | ||
696 | } | ||
697 | |||
698 | static int lme2510_download_firmware(struct usb_device *dev, | ||
699 | const struct firmware *fw) | ||
700 | { | ||
701 | int ret = 0; | ||
702 | u8 *data; | ||
703 | u16 j, wlen, len_in, start, end; | ||
704 | u8 packet_size, dlen, i; | ||
705 | u8 *fw_data; | ||
706 | |||
707 | packet_size = 0x31; | ||
708 | len_in = 1; | ||
709 | |||
710 | data = kzalloc(512, GFP_KERNEL); | ||
711 | if (!data) { | ||
712 | info("FRM Could not start Firmware Download (Buffer allocation failed)"); | ||
713 | return -ENOMEM; | ||
714 | } | ||
715 | |||
716 | info("FRM Starting Firmware Download"); | ||
717 | |||
718 | for (i = 1; i < 3; i++) { | ||
719 | start = (i == 1) ? 0 : 512; | ||
720 | end = (i == 1) ? 512 : fw->size; | ||
721 | for (j = start; j < end; j += (packet_size+1)) { | ||
722 | fw_data = (u8 *)(fw->data + j); | ||
723 | if ((end - j) > packet_size) { | ||
724 | data[0] = i; | ||
725 | dlen = packet_size; | ||
726 | } else { | ||
727 | data[0] = i | 0x80; | ||
728 | dlen = (u8)(end - j)-1; | ||
729 | } | ||
730 | data[1] = dlen; | ||
731 | memcpy(&data[2], fw_data, dlen+1); | ||
732 | wlen = (u8) dlen + 4; | ||
733 | data[wlen-1] = check_sum(fw_data, dlen+1); | ||
734 | deb_info(1, "Data S=%02x:E=%02x CS= %02x", data[3], | ||
735 | data[dlen+2], data[dlen+3]); | ||
736 | ret |= lme2510_bulk_write(dev, data, wlen, 1); | ||
737 | ret |= lme2510_bulk_read(dev, data, len_in , 1); | ||
738 | ret |= (data[0] == 0x88) ? 0 : -1; | ||
739 | } | ||
740 | } | ||
741 | |||
742 | usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
743 | 0x06, 0x80, 0x0200, 0x00, data, 0x0109, 1000); | ||
744 | |||
745 | |||
746 | data[0] = 0x8a; | ||
747 | len_in = 1; | ||
748 | msleep(2000); | ||
749 | ret |= lme2510_bulk_write(dev, data , len_in, 1); /*Resetting*/ | ||
750 | ret |= lme2510_bulk_read(dev, data, len_in, 1); | ||
751 | msleep(400); | ||
752 | |||
753 | if (ret < 0) | ||
754 | info("FRM Firmware Download Failed (%04x)" , ret); | ||
755 | else | ||
756 | info("FRM Firmware Download Completed - Resetting Device"); | ||
757 | |||
758 | kfree(data); | ||
759 | return (ret < 0) ? -ENODEV : 0; | ||
760 | } | ||
761 | |||
762 | static void lme_coldreset(struct usb_device *dev) | ||
763 | { | ||
764 | int ret = 0, len_in; | ||
765 | u8 data[512] = {0}; | ||
766 | |||
767 | data[0] = 0x0a; | ||
768 | len_in = 1; | ||
769 | info("FRM Firmware Cold Reset"); | ||
770 | ret |= lme2510_bulk_write(dev, data , len_in, 1); /*Cold Resetting*/ | ||
771 | ret |= lme2510_bulk_read(dev, data, len_in, 1); | ||
772 | |||
773 | return; | ||
774 | } | ||
775 | |||
776 | static int lme_firmware_switch(struct usb_device *udev, int cold) | ||
777 | { | ||
778 | const struct firmware *fw = NULL; | ||
779 | const char fw_c_s7395[] = "dvb-usb-lme2510c-s7395.fw"; | ||
780 | const char fw_c_lg[] = "dvb-usb-lme2510c-lg.fw"; | ||
781 | const char fw_c_s0194[] = "dvb-usb-lme2510c-s0194.fw"; | ||
782 | const char fw_lg[] = "dvb-usb-lme2510-lg.fw"; | ||
783 | const char fw_s0194[] = "dvb-usb-lme2510-s0194.fw"; | ||
784 | const char *fw_lme; | ||
785 | int ret, cold_fw; | ||
786 | |||
787 | cold = (cold > 0) ? (cold & 1) : 0; | ||
788 | |||
789 | cold_fw = !cold; | ||
790 | |||
791 | if (le16_to_cpu(udev->descriptor.idProduct) == 0x1122) { | ||
792 | switch (dvb_usb_lme2510_firmware) { | ||
793 | default: | ||
794 | dvb_usb_lme2510_firmware = TUNER_S0194; | ||
795 | case TUNER_S0194: | ||
796 | fw_lme = fw_s0194; | ||
797 | ret = request_firmware(&fw, fw_lme, &udev->dev); | ||
798 | if (ret == 0) { | ||
799 | cold = 0; | ||
800 | break; | ||
801 | } | ||
802 | dvb_usb_lme2510_firmware = TUNER_LG; | ||
803 | case TUNER_LG: | ||
804 | fw_lme = fw_lg; | ||
805 | ret = request_firmware(&fw, fw_lme, &udev->dev); | ||
806 | if (ret == 0) | ||
807 | break; | ||
808 | info("FRM No Firmware Found - please install"); | ||
809 | dvb_usb_lme2510_firmware = TUNER_DEFAULT; | ||
810 | cold = 0; | ||
811 | cold_fw = 0; | ||
812 | break; | ||
813 | } | ||
814 | } else { | ||
815 | switch (dvb_usb_lme2510_firmware) { | ||
816 | default: | ||
817 | dvb_usb_lme2510_firmware = TUNER_S7395; | ||
818 | case TUNER_S7395: | ||
819 | fw_lme = fw_c_s7395; | ||
820 | ret = request_firmware(&fw, fw_lme, &udev->dev); | ||
821 | if (ret == 0) { | ||
822 | cold = 0; | ||
823 | break; | ||
824 | } | ||
825 | dvb_usb_lme2510_firmware = TUNER_LG; | ||
826 | case TUNER_LG: | ||
827 | fw_lme = fw_c_lg; | ||
828 | ret = request_firmware(&fw, fw_lme, &udev->dev); | ||
829 | if (ret == 0) | ||
830 | break; | ||
831 | dvb_usb_lme2510_firmware = TUNER_S0194; | ||
832 | case TUNER_S0194: | ||
833 | fw_lme = fw_c_s0194; | ||
834 | ret = request_firmware(&fw, fw_lme, &udev->dev); | ||
835 | if (ret == 0) | ||
836 | break; | ||
837 | info("FRM No Firmware Found - please install"); | ||
838 | dvb_usb_lme2510_firmware = TUNER_DEFAULT; | ||
839 | cold = 0; | ||
840 | cold_fw = 0; | ||
841 | break; | ||
842 | } | ||
843 | } | ||
844 | |||
845 | if (cold_fw) { | ||
846 | info("FRM Loading %s file", fw_lme); | ||
847 | ret = lme2510_download_firmware(udev, fw); | ||
848 | } | ||
849 | |||
850 | release_firmware(fw); | ||
851 | |||
852 | if (cold) { | ||
853 | info("FRM Changing to %s firmware", fw_lme); | ||
854 | lme_coldreset(udev); | ||
855 | return -ENODEV; | ||
856 | } | ||
857 | |||
858 | return ret; | ||
859 | } | ||
860 | |||
861 | static int lme2510_kill_urb(struct usb_data_stream *stream) | ||
862 | { | ||
863 | int i; | ||
864 | |||
865 | for (i = 0; i < stream->urbs_submitted; i++) { | ||
866 | deb_info(3, "killing URB no. %d.", i); | ||
867 | /* stop the URB */ | ||
868 | usb_kill_urb(stream->urb_list[i]); | ||
869 | } | ||
870 | stream->urbs_submitted = 0; | ||
871 | |||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | static struct tda10086_config tda10086_config = { | ||
876 | .demod_address = 0x1c, | ||
877 | .invert = 0, | ||
878 | .diseqc_tone = 1, | ||
879 | .xtal_freq = TDA10086_XTAL_16M, | ||
880 | }; | ||
881 | |||
882 | static struct stv0288_config lme_config = { | ||
883 | .demod_address = 0xd0, | ||
884 | .min_delay_ms = 15, | ||
885 | .inittab = s7395_inittab, | ||
886 | }; | ||
887 | |||
888 | static struct ix2505v_config lme_tuner = { | ||
889 | .tuner_address = 0xc0, | ||
890 | .min_delay_ms = 100, | ||
891 | .tuner_gain = 0x0, | ||
892 | .tuner_chargepump = 0x3, | ||
893 | }; | ||
894 | |||
895 | static struct stv0299_config sharp_z0194_config = { | ||
896 | .demod_address = 0xd0, | ||
897 | .inittab = sharp_z0194a_inittab, | ||
898 | .mclk = 88000000UL, | ||
899 | .invert = 0, | ||
900 | .skip_reinit = 0, | ||
901 | .lock_output = STV0299_LOCKOUTPUT_1, | ||
902 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | ||
903 | .min_delay_ms = 100, | ||
904 | .set_symbol_rate = sharp_z0194a_set_symbol_rate, | ||
905 | }; | ||
906 | |||
907 | static int dm04_lme2510_set_voltage(struct dvb_frontend *fe, | ||
908 | fe_sec_voltage_t voltage) | ||
909 | { | ||
910 | struct dvb_usb_adapter *adap = fe->dvb->priv; | ||
911 | static u8 voltage_low[] = LME_VOLTAGE_L; | ||
912 | static u8 voltage_high[] = LME_VOLTAGE_H; | ||
913 | static u8 rbuf[1]; | ||
914 | int ret = 0, len = 3, rlen = 1; | ||
915 | |||
916 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) | ||
917 | return -EAGAIN; | ||
918 | |||
919 | switch (voltage) { | ||
920 | case SEC_VOLTAGE_18: | ||
921 | ret |= lme2510_usb_talk(adap->dev, | ||
922 | voltage_high, len, rbuf, rlen); | ||
923 | break; | ||
924 | |||
925 | case SEC_VOLTAGE_OFF: | ||
926 | case SEC_VOLTAGE_13: | ||
927 | default: | ||
928 | ret |= lme2510_usb_talk(adap->dev, | ||
929 | voltage_low, len, rbuf, rlen); | ||
930 | break; | ||
931 | } | ||
932 | |||
933 | mutex_unlock(&adap->dev->i2c_mutex); | ||
934 | |||
935 | return (ret < 0) ? -ENODEV : 0; | ||
936 | } | ||
937 | |||
938 | static int lme_name(struct dvb_usb_adapter *adap) | ||
939 | { | ||
940 | struct lme2510_state *st = adap->dev->priv; | ||
941 | const char *desc = adap->dev->desc->name; | ||
942 | char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395", | ||
943 | " SHARP:BS2F7HZ0194"}; | ||
944 | char *name = adap->fe->ops.info.name; | ||
945 | |||
946 | strlcpy(name, desc, 128); | ||
947 | strlcat(name, fe_name[st->tuner_config], 128); | ||
948 | |||
949 | return 0; | ||
950 | } | ||
951 | |||
952 | static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) | ||
953 | { | ||
954 | struct lme2510_state *st = adap->dev->priv; | ||
955 | |||
956 | int ret = 0; | ||
957 | |||
958 | st->i2c_talk_onoff = 1; | ||
959 | |||
960 | st->i2c_gate = 4; | ||
961 | adap->fe = dvb_attach(tda10086_attach, &tda10086_config, | ||
962 | &adap->dev->i2c_adap); | ||
963 | |||
964 | if (adap->fe) { | ||
965 | info("TUN Found Frontend TDA10086"); | ||
966 | st->i2c_tuner_gate_w = 4; | ||
967 | st->i2c_tuner_gate_r = 4; | ||
968 | st->i2c_tuner_addr = 0xc0; | ||
969 | st->tuner_config = TUNER_LG; | ||
970 | if (dvb_usb_lme2510_firmware != TUNER_LG) { | ||
971 | dvb_usb_lme2510_firmware = TUNER_LG; | ||
972 | ret = lme_firmware_switch(adap->dev->udev, 1); | ||
973 | } | ||
974 | goto end; | ||
975 | } | ||
976 | |||
977 | st->i2c_gate = 4; | ||
978 | adap->fe = dvb_attach(stv0299_attach, &sharp_z0194_config, | ||
979 | &adap->dev->i2c_adap); | ||
980 | if (adap->fe) { | ||
981 | info("FE Found Stv0299"); | ||
982 | st->i2c_tuner_gate_w = 4; | ||
983 | st->i2c_tuner_gate_r = 5; | ||
984 | st->i2c_tuner_addr = 0xc0; | ||
985 | st->tuner_config = TUNER_S0194; | ||
986 | if (dvb_usb_lme2510_firmware != TUNER_S0194) { | ||
987 | dvb_usb_lme2510_firmware = TUNER_S0194; | ||
988 | ret = lme_firmware_switch(adap->dev->udev, 1); | ||
989 | } | ||
990 | goto end; | ||
991 | } | ||
992 | |||
993 | st->i2c_gate = 5; | ||
994 | adap->fe = dvb_attach(stv0288_attach, &lme_config, | ||
995 | &adap->dev->i2c_adap); | ||
996 | if (adap->fe) { | ||
997 | info("FE Found Stv0288"); | ||
998 | st->i2c_tuner_gate_w = 4; | ||
999 | st->i2c_tuner_gate_r = 5; | ||
1000 | st->i2c_tuner_addr = 0xc0; | ||
1001 | st->tuner_config = TUNER_S7395; | ||
1002 | if (dvb_usb_lme2510_firmware != TUNER_S7395) { | ||
1003 | dvb_usb_lme2510_firmware = TUNER_S7395; | ||
1004 | ret = lme_firmware_switch(adap->dev->udev, 1); | ||
1005 | } | ||
1006 | } else { | ||
1007 | info("DM04 Not Supported"); | ||
1008 | return -ENODEV; | ||
1009 | } | ||
1010 | |||
1011 | |||
1012 | end: if (ret) { | ||
1013 | if (adap->fe) { | ||
1014 | dvb_frontend_detach(adap->fe); | ||
1015 | adap->fe = NULL; | ||
1016 | } | ||
1017 | adap->dev->props.rc.core.rc_codes = NULL; | ||
1018 | return -ENODEV; | ||
1019 | } | ||
1020 | |||
1021 | adap->fe->ops.set_voltage = dm04_lme2510_set_voltage; | ||
1022 | ret = lme_name(adap); | ||
1023 | return ret; | ||
1024 | } | ||
1025 | |||
1026 | static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) | ||
1027 | { | ||
1028 | struct lme2510_state *st = adap->dev->priv; | ||
1029 | char *tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA"}; | ||
1030 | int ret = 0; | ||
1031 | |||
1032 | switch (st->tuner_config) { | ||
1033 | case TUNER_LG: | ||
1034 | if (dvb_attach(tda826x_attach, adap->fe, 0xc0, | ||
1035 | &adap->dev->i2c_adap, 1)) | ||
1036 | ret = st->tuner_config; | ||
1037 | break; | ||
1038 | case TUNER_S7395: | ||
1039 | if (dvb_attach(ix2505v_attach , adap->fe, &lme_tuner, | ||
1040 | &adap->dev->i2c_adap)) | ||
1041 | ret = st->tuner_config; | ||
1042 | break; | ||
1043 | case TUNER_S0194: | ||
1044 | if (dvb_attach(dvb_pll_attach , adap->fe, 0xc0, | ||
1045 | &adap->dev->i2c_adap, DVB_PLL_OPERA1)) | ||
1046 | ret = st->tuner_config; | ||
1047 | break; | ||
1048 | default: | ||
1049 | break; | ||
1050 | } | ||
1051 | |||
1052 | if (ret) | ||
1053 | info("TUN Found %s tuner", tun_msg[ret]); | ||
1054 | else { | ||
1055 | info("TUN No tuner found --- reseting device"); | ||
1056 | lme_coldreset(adap->dev->udev); | ||
1057 | return -ENODEV; | ||
1058 | } | ||
1059 | |||
1060 | /* Start the Interrupt*/ | ||
1061 | ret = lme2510_int_read(adap); | ||
1062 | if (ret < 0) { | ||
1063 | info("INT Unable to start Interrupt Service"); | ||
1064 | return -ENODEV; | ||
1065 | } | ||
1066 | |||
1067 | return ret; | ||
1068 | } | ||
1069 | |||
1070 | static int lme2510_powerup(struct dvb_usb_device *d, int onoff) | ||
1071 | { | ||
1072 | struct lme2510_state *st = d->priv; | ||
1073 | static u8 lnb_on[] = LNB_ON; | ||
1074 | static u8 lnb_off[] = LNB_OFF; | ||
1075 | static u8 rbuf[1]; | ||
1076 | int ret, len = 3, rlen = 1; | ||
1077 | |||
1078 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
1079 | return -EAGAIN; | ||
1080 | |||
1081 | if (onoff) | ||
1082 | ret = lme2510_usb_talk(d, lnb_on, len, rbuf, rlen); | ||
1083 | else | ||
1084 | ret = lme2510_usb_talk(d, lnb_off, len, rbuf, rlen); | ||
1085 | |||
1086 | st->i2c_talk_onoff = 1; | ||
1087 | |||
1088 | mutex_unlock(&d->i2c_mutex); | ||
1089 | |||
1090 | return ret; | ||
1091 | } | ||
1092 | |||
1093 | /* DVB USB Driver stuff */ | ||
1094 | static struct dvb_usb_device_properties lme2510_properties; | ||
1095 | static struct dvb_usb_device_properties lme2510c_properties; | ||
1096 | |||
1097 | static int lme2510_probe(struct usb_interface *intf, | ||
1098 | const struct usb_device_id *id) | ||
1099 | { | ||
1100 | struct usb_device *udev = interface_to_usbdev(intf); | ||
1101 | int ret = 0; | ||
1102 | |||
1103 | usb_reset_configuration(udev); | ||
1104 | |||
1105 | usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 1); | ||
1106 | |||
1107 | if (udev->speed != USB_SPEED_HIGH) { | ||
1108 | ret = usb_reset_device(udev); | ||
1109 | info("DEV Failed to connect in HIGH SPEED mode"); | ||
1110 | return -ENODEV; | ||
1111 | } | ||
1112 | |||
1113 | if (lme2510_return_status(udev) == 0x44) { | ||
1114 | lme_firmware_switch(udev, 0); | ||
1115 | return -ENODEV; | ||
1116 | } | ||
1117 | |||
1118 | if (0 == dvb_usb_device_init(intf, &lme2510_properties, | ||
1119 | THIS_MODULE, NULL, adapter_nr)) { | ||
1120 | info("DEV registering device driver"); | ||
1121 | return 0; | ||
1122 | } | ||
1123 | if (0 == dvb_usb_device_init(intf, &lme2510c_properties, | ||
1124 | THIS_MODULE, NULL, adapter_nr)) { | ||
1125 | info("DEV registering device driver"); | ||
1126 | return 0; | ||
1127 | } | ||
1128 | |||
1129 | info("DEV lme2510 Error"); | ||
1130 | return -ENODEV; | ||
1131 | |||
1132 | } | ||
1133 | |||
1134 | static struct usb_device_id lme2510_table[] = { | ||
1135 | { USB_DEVICE(0x3344, 0x1122) }, /* LME2510 */ | ||
1136 | { USB_DEVICE(0x3344, 0x1120) }, /* LME2510C */ | ||
1137 | {} /* Terminating entry */ | ||
1138 | }; | ||
1139 | |||
1140 | MODULE_DEVICE_TABLE(usb, lme2510_table); | ||
1141 | |||
1142 | static struct dvb_usb_device_properties lme2510_properties = { | ||
1143 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1144 | .size_of_priv = sizeof(struct lme2510_state), | ||
1145 | .num_adapters = 1, | ||
1146 | .adapter = { | ||
1147 | { | ||
1148 | .caps = DVB_USB_ADAP_HAS_PID_FILTER| | ||
1149 | DVB_USB_ADAP_NEED_PID_FILTERING| | ||
1150 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
1151 | .streaming_ctrl = lme2510_streaming_ctrl, | ||
1152 | .pid_filter_count = 15, | ||
1153 | .pid_filter = lme2510_pid_filter, | ||
1154 | .pid_filter_ctrl = lme2510_pid_filter_ctrl, | ||
1155 | .frontend_attach = dm04_lme2510_frontend_attach, | ||
1156 | .tuner_attach = dm04_lme2510_tuner, | ||
1157 | /* parameter for the MPEG2-data transfer */ | ||
1158 | .stream = { | ||
1159 | .type = USB_BULK, | ||
1160 | .count = 10, | ||
1161 | .endpoint = 0x06, | ||
1162 | .u = { | ||
1163 | .bulk = { | ||
1164 | .buffersize = 4096, | ||
1165 | |||
1166 | } | ||
1167 | } | ||
1168 | } | ||
1169 | } | ||
1170 | }, | ||
1171 | .rc.core = { | ||
1172 | .protocol = RC_TYPE_NEC, | ||
1173 | .module_name = "LME2510 Remote Control", | ||
1174 | .allowed_protos = RC_TYPE_NEC, | ||
1175 | .rc_codes = RC_MAP_LME2510, | ||
1176 | }, | ||
1177 | .power_ctrl = lme2510_powerup, | ||
1178 | .identify_state = lme2510_identify_state, | ||
1179 | .i2c_algo = &lme2510_i2c_algo, | ||
1180 | .generic_bulk_ctrl_endpoint = 0, | ||
1181 | .num_device_descs = 1, | ||
1182 | .devices = { | ||
1183 | { "DM04_LME2510_DVB-S", | ||
1184 | { &lme2510_table[0], NULL }, | ||
1185 | }, | ||
1186 | |||
1187 | } | ||
1188 | }; | ||
1189 | |||
1190 | static struct dvb_usb_device_properties lme2510c_properties = { | ||
1191 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1192 | .size_of_priv = sizeof(struct lme2510_state), | ||
1193 | .num_adapters = 1, | ||
1194 | .adapter = { | ||
1195 | { | ||
1196 | .caps = DVB_USB_ADAP_HAS_PID_FILTER| | ||
1197 | DVB_USB_ADAP_NEED_PID_FILTERING| | ||
1198 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
1199 | .streaming_ctrl = lme2510_streaming_ctrl, | ||
1200 | .pid_filter_count = 15, | ||
1201 | .pid_filter = lme2510_pid_filter, | ||
1202 | .pid_filter_ctrl = lme2510_pid_filter_ctrl, | ||
1203 | .frontend_attach = dm04_lme2510_frontend_attach, | ||
1204 | .tuner_attach = dm04_lme2510_tuner, | ||
1205 | /* parameter for the MPEG2-data transfer */ | ||
1206 | .stream = { | ||
1207 | .type = USB_BULK, | ||
1208 | .count = 10, | ||
1209 | .endpoint = 0x8, | ||
1210 | .u = { | ||
1211 | .bulk = { | ||
1212 | .buffersize = 4096, | ||
1213 | |||
1214 | } | ||
1215 | } | ||
1216 | } | ||
1217 | } | ||
1218 | }, | ||
1219 | .rc.core = { | ||
1220 | .protocol = RC_TYPE_NEC, | ||
1221 | .module_name = "LME2510 Remote Control", | ||
1222 | .allowed_protos = RC_TYPE_NEC, | ||
1223 | .rc_codes = RC_MAP_LME2510, | ||
1224 | }, | ||
1225 | .power_ctrl = lme2510_powerup, | ||
1226 | .identify_state = lme2510_identify_state, | ||
1227 | .i2c_algo = &lme2510_i2c_algo, | ||
1228 | .generic_bulk_ctrl_endpoint = 0, | ||
1229 | .num_device_descs = 1, | ||
1230 | .devices = { | ||
1231 | { "DM04_LME2510C_DVB-S", | ||
1232 | { &lme2510_table[1], NULL }, | ||
1233 | }, | ||
1234 | } | ||
1235 | }; | ||
1236 | |||
1237 | static void *lme2510_exit_int(struct dvb_usb_device *d) | ||
1238 | { | ||
1239 | struct lme2510_state *st = d->priv; | ||
1240 | struct dvb_usb_adapter *adap = &d->adapter[0]; | ||
1241 | void *buffer = NULL; | ||
1242 | |||
1243 | if (adap != NULL) { | ||
1244 | lme2510_kill_urb(&adap->stream); | ||
1245 | adap->feedcount = 0; | ||
1246 | } | ||
1247 | |||
1248 | if (st->usb_buffer != NULL) { | ||
1249 | st->i2c_talk_onoff = 1; | ||
1250 | st->signal_lock = 0; | ||
1251 | st->signal_level = 0; | ||
1252 | st->signal_sn = 0; | ||
1253 | buffer = st->usb_buffer; | ||
1254 | } | ||
1255 | |||
1256 | if (st->lme_urb != NULL) { | ||
1257 | usb_kill_urb(st->lme_urb); | ||
1258 | usb_free_coherent(d->udev, 5000, st->buffer, | ||
1259 | st->lme_urb->transfer_dma); | ||
1260 | info("Interrupt Service Stopped"); | ||
1261 | } | ||
1262 | |||
1263 | return buffer; | ||
1264 | } | ||
1265 | |||
1266 | static void lme2510_exit(struct usb_interface *intf) | ||
1267 | { | ||
1268 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
1269 | void *usb_buffer; | ||
1270 | |||
1271 | if (d != NULL) { | ||
1272 | usb_buffer = lme2510_exit_int(d); | ||
1273 | dvb_usb_device_exit(intf); | ||
1274 | if (usb_buffer != NULL) | ||
1275 | kfree(usb_buffer); | ||
1276 | } | ||
1277 | } | ||
1278 | |||
1279 | static struct usb_driver lme2510_driver = { | ||
1280 | .name = "LME2510C_DVB-S", | ||
1281 | .probe = lme2510_probe, | ||
1282 | .disconnect = lme2510_exit, | ||
1283 | .id_table = lme2510_table, | ||
1284 | }; | ||
1285 | |||
1286 | /* module stuff */ | ||
1287 | static int __init lme2510_module_init(void) | ||
1288 | { | ||
1289 | int result = usb_register(&lme2510_driver); | ||
1290 | if (result) { | ||
1291 | err("usb_register failed. Error number %d", result); | ||
1292 | return result; | ||
1293 | } | ||
1294 | |||
1295 | return 0; | ||
1296 | } | ||
1297 | |||
1298 | static void __exit lme2510_module_exit(void) | ||
1299 | { | ||
1300 | /* deregister this driver from the USB subsystem */ | ||
1301 | usb_deregister(&lme2510_driver); | ||
1302 | } | ||
1303 | |||
1304 | module_init(lme2510_module_init); | ||
1305 | module_exit(lme2510_module_exit); | ||
1306 | |||
1307 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | ||
1308 | MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); | ||
1309 | MODULE_VERSION("1.88"); | ||
1310 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.h b/drivers/media/dvb/dvb-usb/lmedm04.h new file mode 100644 index 000000000000..ab21e2ef53fa --- /dev/null +++ b/drivers/media/dvb/dvb-usb/lmedm04.h | |||
@@ -0,0 +1,174 @@ | |||
1 | /* DVB USB compliant linux driver for | ||
2 | * | ||
3 | * DM04/QQBOX DVB-S USB BOX LME2510C + SHARP:BS2F7HZ7395 | ||
4 | * LME2510C + LG TDQY-P001F | ||
5 | * LME2510 + LG TDQY-P001F | ||
6 | * | ||
7 | * MVB7395 (LME2510C+SHARP:BS2F7HZ7395) | ||
8 | * SHARP:BS2F7HZ7395 = (STV0288+Sharp IX2505V) | ||
9 | * | ||
10 | * MVB001F (LME2510+LGTDQT-P001F) | ||
11 | * LG TDQY - P001F =(TDA8263 + TDA10086H) | ||
12 | * | ||
13 | * MVB0001F (LME2510C+LGTDQT-P001F) | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the Free | ||
17 | * Software Foundation, version 2. | ||
18 | * * | ||
19 | * see Documentation/dvb/README.dvb-usb for more information | ||
20 | */ | ||
21 | #ifndef _DVB_USB_LME2510_H_ | ||
22 | #define _DVB_USB_LME2510_H_ | ||
23 | |||
24 | /* Streamer & PID | ||
25 | * | ||
26 | * Note: These commands do not actually stop the streaming | ||
27 | * but form some kind of packet filtering/stream count | ||
28 | * or tuning related functions. | ||
29 | * 06 XX | ||
30 | * offset 1 = 00 Enable Streaming | ||
31 | * | ||
32 | * | ||
33 | * PID | ||
34 | * 03 XX XX ----> reg number ---> setting....20 XX | ||
35 | * offset 1 = length | ||
36 | * offset 2 = start of data | ||
37 | * end byte -1 = 20 | ||
38 | * end byte = clear pid always a0, other wise 9c, 9a ?? | ||
39 | * | ||
40 | */ | ||
41 | #define LME_ST_ON_W {0x06, 0x00} | ||
42 | #define LME_CLEAR_PID {0x03, 0x02, 0x20, 0xa0} | ||
43 | #define LME_ZERO_PID {0x03, 0x06, 0x00, 0x00, 0x01, 0x00, 0x20, 0x9c} | ||
44 | |||
45 | /* LNB Voltage | ||
46 | * 07 XX XX | ||
47 | * offset 1 = 01 | ||
48 | * offset 2 = 00=Voltage low 01=Voltage high | ||
49 | * | ||
50 | * LNB Power | ||
51 | * 03 01 XX | ||
52 | * offset 2 = 00=ON 01=OFF | ||
53 | */ | ||
54 | |||
55 | #define LME_VOLTAGE_L {0x07, 0x01, 0x00} | ||
56 | #define LME_VOLTAGE_H {0x07, 0x01, 0x01} | ||
57 | #define LNB_ON {0x3a, 0x01, 0x00} | ||
58 | #define LNB_OFF {0x3a, 0x01, 0x01} | ||
59 | |||
60 | /* Initial stv0288 settings for 7395 Frontend */ | ||
61 | static u8 s7395_inittab[] = { | ||
62 | 0x01, 0x15, | ||
63 | 0x02, 0x20, | ||
64 | 0x03, 0xa0, | ||
65 | 0x04, 0xa0, | ||
66 | 0x05, 0x12, | ||
67 | 0x06, 0x00, | ||
68 | 0x09, 0x00, | ||
69 | 0x0a, 0x04, | ||
70 | 0x0b, 0x00, | ||
71 | 0x0c, 0x00, | ||
72 | 0x0d, 0x00, | ||
73 | 0x0e, 0xc1, | ||
74 | 0x0f, 0x54, | ||
75 | 0x11, 0x7a, | ||
76 | 0x12, 0x03, | ||
77 | 0x13, 0x48, | ||
78 | 0x14, 0x84, | ||
79 | 0x15, 0xc5, | ||
80 | 0x16, 0xb8, | ||
81 | 0x17, 0x9c, | ||
82 | 0x18, 0x00, | ||
83 | 0x19, 0xa6, | ||
84 | 0x1a, 0x88, | ||
85 | 0x1b, 0x8f, | ||
86 | 0x1c, 0xf0, | ||
87 | 0x20, 0x0b, | ||
88 | 0x21, 0x54, | ||
89 | 0x22, 0xff, | ||
90 | 0x23, 0x01, | ||
91 | 0x28, 0x46, | ||
92 | 0x29, 0x66, | ||
93 | 0x2a, 0x90, | ||
94 | 0x2b, 0xfa, | ||
95 | 0x2c, 0xd9, | ||
96 | 0x30, 0x0, | ||
97 | 0x31, 0x1e, | ||
98 | 0x32, 0x14, | ||
99 | 0x33, 0x0f, | ||
100 | 0x34, 0x09, | ||
101 | 0x35, 0x0c, | ||
102 | 0x36, 0x05, | ||
103 | 0x37, 0x2f, | ||
104 | 0x38, 0x16, | ||
105 | 0x39, 0xbd, | ||
106 | 0x3a, 0x0, | ||
107 | 0x3b, 0x13, | ||
108 | 0x3c, 0x11, | ||
109 | 0x3d, 0x30, | ||
110 | 0x40, 0x63, | ||
111 | 0x41, 0x04, | ||
112 | 0x42, 0x20, | ||
113 | 0x43, 0x00, | ||
114 | 0x44, 0x00, | ||
115 | 0x45, 0x00, | ||
116 | 0x46, 0x00, | ||
117 | 0x47, 0x00, | ||
118 | 0x4a, 0x00, | ||
119 | 0x50, 0x10, | ||
120 | 0x51, 0x36, | ||
121 | 0x52, 0x21, | ||
122 | 0x53, 0x94, | ||
123 | 0x54, 0xb2, | ||
124 | 0x55, 0x29, | ||
125 | 0x56, 0x64, | ||
126 | 0x57, 0x2b, | ||
127 | 0x58, 0x54, | ||
128 | 0x59, 0x86, | ||
129 | 0x5a, 0x00, | ||
130 | 0x5b, 0x9b, | ||
131 | 0x5c, 0x08, | ||
132 | 0x5d, 0x7f, | ||
133 | 0x5e, 0xff, | ||
134 | 0x5f, 0x8d, | ||
135 | 0x70, 0x0, | ||
136 | 0x71, 0x0, | ||
137 | 0x72, 0x0, | ||
138 | 0x74, 0x0, | ||
139 | 0x75, 0x0, | ||
140 | 0x76, 0x0, | ||
141 | 0x81, 0x0, | ||
142 | 0x82, 0x3f, | ||
143 | 0x83, 0x3f, | ||
144 | 0x84, 0x0, | ||
145 | 0x85, 0x0, | ||
146 | 0x88, 0x0, | ||
147 | 0x89, 0x0, | ||
148 | 0x8a, 0x0, | ||
149 | 0x8b, 0x0, | ||
150 | 0x8c, 0x0, | ||
151 | 0x90, 0x0, | ||
152 | 0x91, 0x0, | ||
153 | 0x92, 0x0, | ||
154 | 0x93, 0x0, | ||
155 | 0x94, 0x1c, | ||
156 | 0x97, 0x0, | ||
157 | 0xa0, 0x48, | ||
158 | 0xa1, 0x0, | ||
159 | 0xb0, 0xb8, | ||
160 | 0xb1, 0x3a, | ||
161 | 0xb2, 0x10, | ||
162 | 0xb3, 0x82, | ||
163 | 0xb4, 0x80, | ||
164 | 0xb5, 0x82, | ||
165 | 0xb6, 0x82, | ||
166 | 0xb7, 0x82, | ||
167 | 0xb8, 0x20, | ||
168 | 0xb9, 0x0, | ||
169 | 0xf0, 0x0, | ||
170 | 0xf1, 0x0, | ||
171 | 0xf2, 0xc0, | ||
172 | 0xff, 0xff, | ||
173 | }; | ||
174 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index bdef1a18b664..9456792f219b 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
@@ -134,22 +134,26 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
134 | { | 134 | { |
135 | struct m920x_state *m = d->priv; | 135 | struct m920x_state *m = d->priv; |
136 | int i, ret = 0; | 136 | int i, ret = 0; |
137 | u8 rc_state[2]; | 137 | u8 *rc_state; |
138 | |||
139 | rc_state = kmalloc(2, GFP_KERNEL); | ||
140 | if (!rc_state) | ||
141 | return -ENOMEM; | ||
138 | 142 | ||
139 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) | 143 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) |
140 | goto unlock; | 144 | goto out; |
141 | 145 | ||
142 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) | 146 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) |
143 | goto unlock; | 147 | goto out; |
144 | 148 | ||
145 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) | 149 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) |
146 | if (rc5_data(&d->props.rc.legacy.rc_key_map[i]) == rc_state[1]) { | 150 | if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { |
147 | *event = d->props.rc.legacy.rc_key_map[i].keycode; | 151 | *event = d->props.rc.legacy.rc_map_table[i].keycode; |
148 | 152 | ||
149 | switch(rc_state[0]) { | 153 | switch(rc_state[0]) { |
150 | case 0x80: | 154 | case 0x80: |
151 | *state = REMOTE_NO_KEY_PRESSED; | 155 | *state = REMOTE_NO_KEY_PRESSED; |
152 | goto unlock; | 156 | goto out; |
153 | 157 | ||
154 | case 0x88: /* framing error or "invalid code" */ | 158 | case 0x88: /* framing error or "invalid code" */ |
155 | case 0x99: | 159 | case 0x99: |
@@ -157,7 +161,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
157 | case 0xd8: | 161 | case 0xd8: |
158 | *state = REMOTE_NO_KEY_PRESSED; | 162 | *state = REMOTE_NO_KEY_PRESSED; |
159 | m->rep_count = 0; | 163 | m->rep_count = 0; |
160 | goto unlock; | 164 | goto out; |
161 | 165 | ||
162 | case 0x93: | 166 | case 0x93: |
163 | case 0x92: | 167 | case 0x92: |
@@ -165,7 +169,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
165 | case 0x82: | 169 | case 0x82: |
166 | m->rep_count = 0; | 170 | m->rep_count = 0; |
167 | *state = REMOTE_KEY_PRESSED; | 171 | *state = REMOTE_KEY_PRESSED; |
168 | goto unlock; | 172 | goto out; |
169 | 173 | ||
170 | case 0x91: | 174 | case 0x91: |
171 | case 0x81: /* pinnacle PCTV310e */ | 175 | case 0x81: /* pinnacle PCTV310e */ |
@@ -174,12 +178,12 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
174 | *state = REMOTE_KEY_REPEAT; | 178 | *state = REMOTE_KEY_REPEAT; |
175 | else | 179 | else |
176 | *state = REMOTE_NO_KEY_PRESSED; | 180 | *state = REMOTE_NO_KEY_PRESSED; |
177 | goto unlock; | 181 | goto out; |
178 | 182 | ||
179 | default: | 183 | default: |
180 | deb("Unexpected rc state %02x\n", rc_state[0]); | 184 | deb("Unexpected rc state %02x\n", rc_state[0]); |
181 | *state = REMOTE_NO_KEY_PRESSED; | 185 | *state = REMOTE_NO_KEY_PRESSED; |
182 | goto unlock; | 186 | goto out; |
183 | } | 187 | } |
184 | } | 188 | } |
185 | 189 | ||
@@ -188,8 +192,8 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
188 | 192 | ||
189 | *state = REMOTE_NO_KEY_PRESSED; | 193 | *state = REMOTE_NO_KEY_PRESSED; |
190 | 194 | ||
191 | unlock: | 195 | out: |
192 | 196 | kfree(rc_state); | |
193 | return ret; | 197 | return ret; |
194 | } | 198 | } |
195 | 199 | ||
@@ -339,13 +343,19 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, in | |||
339 | static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) | 343 | static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) |
340 | { | 344 | { |
341 | u16 value, index, size; | 345 | u16 value, index, size; |
342 | u8 read[4], *buff; | 346 | u8 *read, *buff; |
343 | int i, pass, ret = 0; | 347 | int i, pass, ret = 0; |
344 | 348 | ||
345 | buff = kmalloc(65536, GFP_KERNEL); | 349 | buff = kmalloc(65536, GFP_KERNEL); |
346 | if (buff == NULL) | 350 | if (buff == NULL) |
347 | return -ENOMEM; | 351 | return -ENOMEM; |
348 | 352 | ||
353 | read = kmalloc(4, GFP_KERNEL); | ||
354 | if (!read) { | ||
355 | kfree(buff); | ||
356 | return -ENOMEM; | ||
357 | } | ||
358 | |||
349 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) | 359 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) |
350 | goto done; | 360 | goto done; |
351 | deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); | 361 | deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); |
@@ -396,6 +406,7 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar | |||
396 | deb("firmware uploaded!\n"); | 406 | deb("firmware uploaded!\n"); |
397 | 407 | ||
398 | done: | 408 | done: |
409 | kfree(read); | ||
399 | kfree(buff); | 410 | kfree(buff); |
400 | 411 | ||
401 | return ret; | 412 | return ret; |
@@ -589,7 +600,7 @@ static struct m920x_inits pinnacle310e_init[] = { | |||
589 | }; | 600 | }; |
590 | 601 | ||
591 | /* ir keymaps */ | 602 | /* ir keymaps */ |
592 | static struct ir_scancode ir_codes_megasky_table[] = { | 603 | static struct rc_map_table rc_map_megasky_table[] = { |
593 | { 0x0012, KEY_POWER }, | 604 | { 0x0012, KEY_POWER }, |
594 | { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ | 605 | { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ |
595 | { 0x0002, KEY_CHANNELUP }, | 606 | { 0x0002, KEY_CHANNELUP }, |
@@ -608,7 +619,7 @@ static struct ir_scancode ir_codes_megasky_table[] = { | |||
608 | { 0x000e, KEY_COFFEE }, /* "MTS" */ | 619 | { 0x000e, KEY_COFFEE }, /* "MTS" */ |
609 | }; | 620 | }; |
610 | 621 | ||
611 | static struct ir_scancode ir_codes_tvwalkertwin_table[] = { | 622 | static struct rc_map_table rc_map_tvwalkertwin_table[] = { |
612 | { 0x0001, KEY_ZOOM }, /* Full Screen */ | 623 | { 0x0001, KEY_ZOOM }, /* Full Screen */ |
613 | { 0x0002, KEY_CAMERA }, /* snapshot */ | 624 | { 0x0002, KEY_CAMERA }, /* snapshot */ |
614 | { 0x0003, KEY_MUTE }, | 625 | { 0x0003, KEY_MUTE }, |
@@ -628,13 +639,13 @@ static struct ir_scancode ir_codes_tvwalkertwin_table[] = { | |||
628 | { 0x001e, KEY_VOLUMEUP }, | 639 | { 0x001e, KEY_VOLUMEUP }, |
629 | }; | 640 | }; |
630 | 641 | ||
631 | static struct ir_scancode ir_codes_pinnacle310e_table[] = { | 642 | static struct rc_map_table rc_map_pinnacle310e_table[] = { |
632 | { 0x16, KEY_POWER }, | 643 | { 0x16, KEY_POWER }, |
633 | { 0x17, KEY_FAVORITES }, | 644 | { 0x17, KEY_FAVORITES }, |
634 | { 0x0f, KEY_TEXT }, | 645 | { 0x0f, KEY_TEXT }, |
635 | { 0x48, KEY_MEDIA }, /* preview */ | 646 | { 0x48, KEY_PROGRAM }, /* preview */ |
636 | { 0x1c, KEY_EPG }, | 647 | { 0x1c, KEY_EPG }, |
637 | { 0x04, KEY_LIST }, /* record list */ | 648 | { 0x04, KEY_LIST }, /* record list */ |
638 | { 0x03, KEY_1 }, | 649 | { 0x03, KEY_1 }, |
639 | { 0x01, KEY_2 }, | 650 | { 0x01, KEY_2 }, |
640 | { 0x06, KEY_3 }, | 651 | { 0x06, KEY_3 }, |
@@ -674,14 +685,14 @@ static struct ir_scancode ir_codes_pinnacle310e_table[] = { | |||
674 | { 0x0e, KEY_MUTE }, | 685 | { 0x0e, KEY_MUTE }, |
675 | /* { 0x49, KEY_LR }, */ /* L/R */ | 686 | /* { 0x49, KEY_LR }, */ /* L/R */ |
676 | { 0x07, KEY_SLEEP }, /* Hibernate */ | 687 | { 0x07, KEY_SLEEP }, /* Hibernate */ |
677 | { 0x08, KEY_MEDIA }, /* A/V */ | 688 | { 0x08, KEY_VIDEO }, /* A/V */ |
678 | { 0x0e, KEY_MENU }, /* Recall */ | 689 | { 0x0e, KEY_MENU }, /* Recall */ |
679 | { 0x45, KEY_ZOOMIN }, | 690 | { 0x45, KEY_ZOOMIN }, |
680 | { 0x46, KEY_ZOOMOUT }, | 691 | { 0x46, KEY_ZOOMOUT }, |
681 | { 0x18, KEY_TV }, /* Red */ | 692 | { 0x18, KEY_RED }, /* Red */ |
682 | { 0x53, KEY_VCR }, /* Green */ | 693 | { 0x53, KEY_GREEN }, /* Green */ |
683 | { 0x5e, KEY_SAT }, /* Yellow */ | 694 | { 0x5e, KEY_YELLOW }, /* Yellow */ |
684 | { 0x5f, KEY_PLAYER }, /* Blue */ | 695 | { 0x5f, KEY_BLUE }, /* Blue */ |
685 | }; | 696 | }; |
686 | 697 | ||
687 | /* DVB USB Driver stuff */ | 698 | /* DVB USB Driver stuff */ |
@@ -786,8 +797,8 @@ static struct dvb_usb_device_properties megasky_properties = { | |||
786 | 797 | ||
787 | .rc.legacy = { | 798 | .rc.legacy = { |
788 | .rc_interval = 100, | 799 | .rc_interval = 100, |
789 | .rc_key_map = ir_codes_megasky_table, | 800 | .rc_map_table = rc_map_megasky_table, |
790 | .rc_key_map_size = ARRAY_SIZE(ir_codes_megasky_table), | 801 | .rc_map_size = ARRAY_SIZE(rc_map_megasky_table), |
791 | .rc_query = m920x_rc_query, | 802 | .rc_query = m920x_rc_query, |
792 | }, | 803 | }, |
793 | 804 | ||
@@ -889,8 +900,8 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { | |||
889 | 900 | ||
890 | .rc.legacy = { | 901 | .rc.legacy = { |
891 | .rc_interval = 100, | 902 | .rc_interval = 100, |
892 | .rc_key_map = ir_codes_tvwalkertwin_table, | 903 | .rc_map_table = rc_map_tvwalkertwin_table, |
893 | .rc_key_map_size = ARRAY_SIZE(ir_codes_tvwalkertwin_table), | 904 | .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table), |
894 | .rc_query = m920x_rc_query, | 905 | .rc_query = m920x_rc_query, |
895 | }, | 906 | }, |
896 | 907 | ||
@@ -998,8 +1009,8 @@ static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { | |||
998 | 1009 | ||
999 | .rc.legacy = { | 1010 | .rc.legacy = { |
1000 | .rc_interval = 100, | 1011 | .rc_interval = 100, |
1001 | .rc_key_map = ir_codes_pinnacle310e_table, | 1012 | .rc_map_table = rc_map_pinnacle310e_table, |
1002 | .rc_key_map_size = ARRAY_SIZE(ir_codes_pinnacle310e_table), | 1013 | .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table), |
1003 | .rc_query = m920x_rc_query, | 1014 | .rc_query = m920x_rc_query, |
1004 | }, | 1015 | }, |
1005 | 1016 | ||
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index 181f36a12e2a..bc350e982b72 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c | |||
@@ -21,7 +21,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
21 | #define deb_ee(args...) dprintk(debug,0x02,args) | 21 | #define deb_ee(args...) dprintk(debug,0x02,args) |
22 | 22 | ||
23 | /* Hauppauge NOVA-T USB2 keys */ | 23 | /* Hauppauge NOVA-T USB2 keys */ |
24 | static struct ir_scancode ir_codes_haupp_table[] = { | 24 | static struct rc_map_table rc_map_haupp_table[] = { |
25 | { 0x1e00, KEY_0 }, | 25 | { 0x1e00, KEY_0 }, |
26 | { 0x1e01, KEY_1 }, | 26 | { 0x1e01, KEY_1 }, |
27 | { 0x1e02, KEY_2 }, | 27 | { 0x1e02, KEY_2 }, |
@@ -47,7 +47,7 @@ static struct ir_scancode ir_codes_haupp_table[] = { | |||
47 | { 0x1e17, KEY_RIGHT }, | 47 | { 0x1e17, KEY_RIGHT }, |
48 | { 0x1e18, KEY_VIDEO }, | 48 | { 0x1e18, KEY_VIDEO }, |
49 | { 0x1e19, KEY_AUDIO }, | 49 | { 0x1e19, KEY_AUDIO }, |
50 | { 0x1e1a, KEY_MEDIA }, | 50 | { 0x1e1a, KEY_IMAGES }, |
51 | { 0x1e1b, KEY_EPG }, | 51 | { 0x1e1b, KEY_EPG }, |
52 | { 0x1e1c, KEY_TV }, | 52 | { 0x1e1c, KEY_TV }, |
53 | { 0x1e1e, KEY_NEXT }, | 53 | { 0x1e1e, KEY_NEXT }, |
@@ -91,14 +91,14 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
91 | 91 | ||
92 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); | 92 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); |
93 | 93 | ||
94 | for (i = 0; i < ARRAY_SIZE(ir_codes_haupp_table); i++) { | 94 | for (i = 0; i < ARRAY_SIZE(rc_map_haupp_table); i++) { |
95 | if (rc5_data(&ir_codes_haupp_table[i]) == data && | 95 | if (rc5_data(&rc_map_haupp_table[i]) == data && |
96 | rc5_custom(&ir_codes_haupp_table[i]) == custom) { | 96 | rc5_custom(&rc_map_haupp_table[i]) == custom) { |
97 | 97 | ||
98 | deb_rc("c: %x, d: %x\n", rc5_data(&ir_codes_haupp_table[i]), | 98 | deb_rc("c: %x, d: %x\n", rc5_data(&rc_map_haupp_table[i]), |
99 | rc5_custom(&ir_codes_haupp_table[i])); | 99 | rc5_custom(&rc_map_haupp_table[i])); |
100 | 100 | ||
101 | *event = ir_codes_haupp_table[i].keycode; | 101 | *event = rc_map_haupp_table[i].keycode; |
102 | *state = REMOTE_KEY_PRESSED; | 102 | *state = REMOTE_KEY_PRESSED; |
103 | if (st->old_toggle == toggle) { | 103 | if (st->old_toggle == toggle) { |
104 | if (st->last_repeat_count++ < 2) | 104 | if (st->last_repeat_count++ < 2) |
@@ -197,8 +197,8 @@ static struct dvb_usb_device_properties nova_t_properties = { | |||
197 | 197 | ||
198 | .rc.legacy = { | 198 | .rc.legacy = { |
199 | .rc_interval = 100, | 199 | .rc_interval = 100, |
200 | .rc_key_map = ir_codes_haupp_table, | 200 | .rc_map_table = rc_map_haupp_table, |
201 | .rc_key_map_size = ARRAY_SIZE(ir_codes_haupp_table), | 201 | .rc_map_size = ARRAY_SIZE(rc_map_haupp_table), |
202 | .rc_query = nova_t_rc_query, | 202 | .rc_query = nova_t_rc_query, |
203 | }, | 203 | }, |
204 | 204 | ||
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index f896337b4535..2e4fab7215f5 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -35,7 +35,7 @@ | |||
35 | struct opera1_state { | 35 | struct opera1_state { |
36 | u32 last_key_pressed; | 36 | u32 last_key_pressed; |
37 | }; | 37 | }; |
38 | struct ir_codes_opera_table { | 38 | struct rc_map_opera_table { |
39 | u32 keycode; | 39 | u32 keycode; |
40 | u32 event; | 40 | u32 event; |
41 | }; | 41 | }; |
@@ -53,27 +53,36 @@ static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value, | |||
53 | u8 * data, u16 len, int flags) | 53 | u8 * data, u16 len, int flags) |
54 | { | 54 | { |
55 | int ret; | 55 | int ret; |
56 | u8 r; | 56 | u8 tmp; |
57 | u8 u8buf[len]; | 57 | u8 *buf; |
58 | |||
59 | unsigned int pipe = (flags == OPERA_READ_MSG) ? | 58 | unsigned int pipe = (flags == OPERA_READ_MSG) ? |
60 | usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0); | 59 | usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0); |
61 | u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; | 60 | u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; |
62 | 61 | ||
62 | buf = kmalloc(len, GFP_KERNEL); | ||
63 | if (!buf) | ||
64 | return -ENOMEM; | ||
65 | |||
63 | if (flags == OPERA_WRITE_MSG) | 66 | if (flags == OPERA_WRITE_MSG) |
64 | memcpy(u8buf, data, len); | 67 | memcpy(buf, data, len); |
65 | ret = | 68 | ret = usb_control_msg(dev, pipe, request, |
66 | usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, | 69 | request_type | USB_TYPE_VENDOR, value, 0x0, |
67 | value, 0x0, u8buf, len, 2000); | 70 | buf, len, 2000); |
68 | 71 | ||
69 | if (request == OPERA_TUNER_REQ) { | 72 | if (request == OPERA_TUNER_REQ) { |
73 | tmp = buf[0]; | ||
70 | if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | 74 | if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), |
71 | OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR, | 75 | OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR, |
72 | 0x01, 0x0, &r, 1, 2000)<1 || r!=0x08) | 76 | 0x01, 0x0, buf, 1, 2000) < 1 || buf[0] != 0x08) { |
73 | return 0; | 77 | ret = 0; |
78 | goto out; | ||
79 | } | ||
80 | buf[0] = tmp; | ||
74 | } | 81 | } |
75 | if (flags == OPERA_READ_MSG) | 82 | if (flags == OPERA_READ_MSG) |
76 | memcpy(data, u8buf, len); | 83 | memcpy(data, buf, len); |
84 | out: | ||
85 | kfree(buf); | ||
77 | return ret; | 86 | return ret; |
78 | } | 87 | } |
79 | 88 | ||
@@ -189,7 +198,7 @@ static int opera1_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, | |||
189 | static u8 opera1_inittab[] = { | 198 | static u8 opera1_inittab[] = { |
190 | 0x00, 0xa1, | 199 | 0x00, 0xa1, |
191 | 0x01, 0x15, | 200 | 0x01, 0x15, |
192 | 0x02, 0x00, | 201 | 0x02, 0x30, |
193 | 0x03, 0x00, | 202 | 0x03, 0x00, |
194 | 0x04, 0x7d, | 203 | 0x04, 0x7d, |
195 | 0x05, 0x05, | 204 | 0x05, 0x05, |
@@ -331,7 +340,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) | |||
331 | return 0; | 340 | return 0; |
332 | } | 341 | } |
333 | 342 | ||
334 | static struct ir_scancode ir_codes_opera1_table[] = { | 343 | static struct rc_map_table rc_map_opera1_table[] = { |
335 | {0x5fa0, KEY_1}, | 344 | {0x5fa0, KEY_1}, |
336 | {0x51af, KEY_2}, | 345 | {0x51af, KEY_2}, |
337 | {0x5da2, KEY_3}, | 346 | {0x5da2, KEY_3}, |
@@ -342,23 +351,22 @@ static struct ir_scancode ir_codes_opera1_table[] = { | |||
342 | {0x49b6, KEY_8}, | 351 | {0x49b6, KEY_8}, |
343 | {0x05fa, KEY_9}, | 352 | {0x05fa, KEY_9}, |
344 | {0x45ba, KEY_0}, | 353 | {0x45ba, KEY_0}, |
345 | {0x09f6, KEY_UP}, /*chanup */ | 354 | {0x09f6, KEY_CHANNELUP}, /*chanup */ |
346 | {0x1be5, KEY_DOWN}, /*chandown */ | 355 | {0x1be5, KEY_CHANNELDOWN}, /*chandown */ |
347 | {0x5da3, KEY_LEFT}, /*voldown */ | 356 | {0x5da3, KEY_VOLUMEDOWN}, /*voldown */ |
348 | {0x5fa1, KEY_RIGHT}, /*volup */ | 357 | {0x5fa1, KEY_VOLUMEUP}, /*volup */ |
349 | {0x07f8, KEY_SPACE}, /*tab */ | 358 | {0x07f8, KEY_SPACE}, /*tab */ |
350 | {0x1fe1, KEY_ENTER}, /*play ok */ | 359 | {0x1fe1, KEY_OK}, /*play ok */ |
351 | {0x1be4, KEY_Z}, /*zoom */ | 360 | {0x1be4, KEY_ZOOM}, /*zoom */ |
352 | {0x59a6, KEY_M}, /*mute */ | 361 | {0x59a6, KEY_MUTE}, /*mute */ |
353 | {0x5ba5, KEY_F}, /*tv/f */ | 362 | {0x5ba5, KEY_RADIO}, /*tv/f */ |
354 | {0x19e7, KEY_R}, /*rec */ | 363 | {0x19e7, KEY_RECORD}, /*rec */ |
355 | {0x01fe, KEY_S}, /*Stop */ | 364 | {0x01fe, KEY_STOP}, /*Stop */ |
356 | {0x03fd, KEY_P}, /*pause */ | 365 | {0x03fd, KEY_PAUSE}, /*pause */ |
357 | {0x03fc, KEY_W}, /*<- -> */ | 366 | {0x03fc, KEY_SCREEN}, /*<- -> */ |
358 | {0x07f9, KEY_C}, /*capture */ | 367 | {0x07f9, KEY_CAMERA}, /*capture */ |
359 | {0x47b9, KEY_Q}, /*exit */ | 368 | {0x47b9, KEY_ESC}, /*exit */ |
360 | {0x43bc, KEY_O}, /*power */ | 369 | {0x43bc, KEY_POWER2}, /*power */ |
361 | |||
362 | }; | 370 | }; |
363 | 371 | ||
364 | static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) | 372 | static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) |
@@ -404,12 +412,12 @@ static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) | |||
404 | 412 | ||
405 | send_key = (send_key & 0xffff) | 0x0100; | 413 | send_key = (send_key & 0xffff) | 0x0100; |
406 | 414 | ||
407 | for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { | 415 | for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) { |
408 | if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { | 416 | if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0xffff)) { |
409 | *state = REMOTE_KEY_PRESSED; | 417 | *state = REMOTE_KEY_PRESSED; |
410 | *event = ir_codes_opera1_table[i].keycode; | 418 | *event = rc_map_opera1_table[i].keycode; |
411 | opst->last_key_pressed = | 419 | opst->last_key_pressed = |
412 | ir_codes_opera1_table[i].keycode; | 420 | rc_map_opera1_table[i].keycode; |
413 | break; | 421 | break; |
414 | } | 422 | } |
415 | opst->last_key_pressed = 0; | 423 | opst->last_key_pressed = 0; |
@@ -497,8 +505,8 @@ static struct dvb_usb_device_properties opera1_properties = { | |||
497 | .i2c_algo = &opera1_i2c_algo, | 505 | .i2c_algo = &opera1_i2c_algo, |
498 | 506 | ||
499 | .rc.legacy = { | 507 | .rc.legacy = { |
500 | .rc_key_map = ir_codes_opera1_table, | 508 | .rc_map_table = rc_map_opera1_table, |
501 | .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), | 509 | .rc_map_size = ARRAY_SIZE(rc_map_opera1_table), |
502 | .rc_interval = 200, | 510 | .rc_interval = 200, |
503 | .rc_query = opera1_rc_query, | 511 | .rc_query = opera1_rc_query, |
504 | }, | 512 | }, |
diff --git a/drivers/media/dvb/dvb-usb/technisat-usb2.c b/drivers/media/dvb/dvb-usb/technisat-usb2.c new file mode 100644 index 000000000000..08f8842ad280 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/technisat-usb2.c | |||
@@ -0,0 +1,807 @@ | |||
1 | /* | ||
2 | * Linux driver for Technisat DVB-S/S2 USB 2.0 device | ||
3 | * | ||
4 | * Copyright (C) 2010 Patrick Boettcher, | ||
5 | * Kernel Labs Inc. PO Box 745, St James, NY 11780 | ||
6 | * | ||
7 | * Development was sponsored by Technisat Digital UK Limited, whose | ||
8 | * registered office is Witan Gate House 500 - 600 Witan Gate West, | ||
9 | * Milton Keynes, MK9 1SH | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License as | ||
13 | * published by the Free Software Foundation; either version 2 of the | ||
14 | * License, or (at your option) any later version. | ||
15 | * | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | * | ||
21 | * THIS PROGRAM IS PROVIDED "AS IS" AND BOTH THE COPYRIGHT HOLDER AND | ||
22 | * TECHNISAT DIGITAL UK LTD DISCLAIM ALL WARRANTIES WITH REGARD TO | ||
23 | * THIS PROGRAM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR | ||
24 | * FITNESS FOR A PARTICULAR PURPOSE. NEITHER THE COPYRIGHT HOLDER | ||
25 | * NOR TECHNISAT DIGITAL UK LIMITED SHALL BE LIABLE FOR ANY SPECIAL, | ||
26 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER | ||
27 | * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
28 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | ||
29 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS PROGRAM. See the | ||
30 | * GNU General Public License for more details. | ||
31 | */ | ||
32 | |||
33 | #define DVB_USB_LOG_PREFIX "technisat-usb2" | ||
34 | #include "dvb-usb.h" | ||
35 | |||
36 | #include "stv6110x.h" | ||
37 | #include "stv090x.h" | ||
38 | |||
39 | /* module parameters */ | ||
40 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
41 | |||
42 | static int debug; | ||
43 | module_param(debug, int, 0644); | ||
44 | MODULE_PARM_DESC(debug, | ||
45 | "set debugging level (bit-mask: 1=info,2=eeprom,4=i2c,8=rc)." \ | ||
46 | DVB_USB_DEBUG_STATUS); | ||
47 | |||
48 | /* disables all LED control command and | ||
49 | * also does not start the signal polling thread */ | ||
50 | static int disable_led_control; | ||
51 | module_param(disable_led_control, int, 0444); | ||
52 | MODULE_PARM_DESC(disable_led_control, | ||
53 | "disable LED control of the device " | ||
54 | "(default: 0 - LED control is active)."); | ||
55 | |||
56 | /* device private data */ | ||
57 | struct technisat_usb2_state { | ||
58 | struct dvb_usb_device *dev; | ||
59 | struct delayed_work green_led_work; | ||
60 | u8 power_state; | ||
61 | |||
62 | u16 last_scan_code; | ||
63 | }; | ||
64 | |||
65 | /* debug print helpers */ | ||
66 | #define deb_info(args...) dprintk(debug, 0x01, args) | ||
67 | #define deb_eeprom(args...) dprintk(debug, 0x02, args) | ||
68 | #define deb_i2c(args...) dprintk(debug, 0x04, args) | ||
69 | #define deb_rc(args...) dprintk(debug, 0x08, args) | ||
70 | |||
71 | /* vendor requests */ | ||
72 | #define SET_IFCLK_TO_EXTERNAL_TSCLK_VENDOR_REQUEST 0xB3 | ||
73 | #define SET_FRONT_END_RESET_VENDOR_REQUEST 0xB4 | ||
74 | #define GET_VERSION_INFO_VENDOR_REQUEST 0xB5 | ||
75 | #define SET_GREEN_LED_VENDOR_REQUEST 0xB6 | ||
76 | #define SET_RED_LED_VENDOR_REQUEST 0xB7 | ||
77 | #define GET_IR_DATA_VENDOR_REQUEST 0xB8 | ||
78 | #define SET_LED_TIMER_DIVIDER_VENDOR_REQUEST 0xB9 | ||
79 | #define SET_USB_REENUMERATION 0xBA | ||
80 | |||
81 | /* i2c-access methods */ | ||
82 | #define I2C_SPEED_100KHZ_BIT 0x40 | ||
83 | |||
84 | #define I2C_STATUS_NAK 7 | ||
85 | #define I2C_STATUS_OK 8 | ||
86 | |||
87 | static int technisat_usb2_i2c_access(struct usb_device *udev, | ||
88 | u8 device_addr, u8 *tx, u8 txlen, u8 *rx, u8 rxlen) | ||
89 | { | ||
90 | u8 b[64]; | ||
91 | int ret, actual_length; | ||
92 | |||
93 | deb_i2c("i2c-access: %02x, tx: ", device_addr); | ||
94 | debug_dump(tx, txlen, deb_i2c); | ||
95 | deb_i2c(" "); | ||
96 | |||
97 | if (txlen > 62) { | ||
98 | err("i2c TX buffer can't exceed 62 bytes (dev 0x%02x)", | ||
99 | device_addr); | ||
100 | txlen = 62; | ||
101 | } | ||
102 | if (rxlen > 62) { | ||
103 | err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)", | ||
104 | device_addr); | ||
105 | txlen = 62; | ||
106 | } | ||
107 | |||
108 | b[0] = I2C_SPEED_100KHZ_BIT; | ||
109 | b[1] = device_addr << 1; | ||
110 | |||
111 | if (rx != NULL) { | ||
112 | b[0] |= rxlen; | ||
113 | b[1] |= 1; | ||
114 | } | ||
115 | |||
116 | memcpy(&b[2], tx, txlen); | ||
117 | ret = usb_bulk_msg(udev, | ||
118 | usb_sndbulkpipe(udev, 0x01), | ||
119 | b, 2 + txlen, | ||
120 | NULL, 1000); | ||
121 | |||
122 | if (ret < 0) { | ||
123 | err("i2c-error: out failed %02x = %d", device_addr, ret); | ||
124 | return -ENODEV; | ||
125 | } | ||
126 | |||
127 | ret = usb_bulk_msg(udev, | ||
128 | usb_rcvbulkpipe(udev, 0x01), | ||
129 | b, 64, &actual_length, 1000); | ||
130 | if (ret < 0) { | ||
131 | err("i2c-error: in failed %02x = %d", device_addr, ret); | ||
132 | return -ENODEV; | ||
133 | } | ||
134 | |||
135 | if (b[0] != I2C_STATUS_OK) { | ||
136 | err("i2c-error: %02x = %d", device_addr, b[0]); | ||
137 | /* handle tuner-i2c-nak */ | ||
138 | if (!(b[0] == I2C_STATUS_NAK && | ||
139 | device_addr == 0x60 | ||
140 | /* && device_is_technisat_usb2 */)) | ||
141 | return -ENODEV; | ||
142 | } | ||
143 | |||
144 | deb_i2c("status: %d, ", b[0]); | ||
145 | |||
146 | if (rx != NULL) { | ||
147 | memcpy(rx, &b[2], rxlen); | ||
148 | |||
149 | deb_i2c("rx (%d): ", rxlen); | ||
150 | debug_dump(rx, rxlen, deb_i2c); | ||
151 | } | ||
152 | |||
153 | deb_i2c("\n"); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static int technisat_usb2_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, | ||
159 | int num) | ||
160 | { | ||
161 | int ret = 0, i; | ||
162 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
163 | |||
164 | /* Ensure nobody else hits the i2c bus while we're sending our | ||
165 | sequence of messages, (such as the remote control thread) */ | ||
166 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
167 | return -EAGAIN; | ||
168 | |||
169 | for (i = 0; i < num; i++) { | ||
170 | if (i+1 < num && msg[i+1].flags & I2C_M_RD) { | ||
171 | ret = technisat_usb2_i2c_access(d->udev, msg[i+1].addr, | ||
172 | msg[i].buf, msg[i].len, | ||
173 | msg[i+1].buf, msg[i+1].len); | ||
174 | if (ret != 0) | ||
175 | break; | ||
176 | i++; | ||
177 | } else { | ||
178 | ret = technisat_usb2_i2c_access(d->udev, msg[i].addr, | ||
179 | msg[i].buf, msg[i].len, | ||
180 | NULL, 0); | ||
181 | if (ret != 0) | ||
182 | break; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | if (ret == 0) | ||
187 | ret = i; | ||
188 | |||
189 | mutex_unlock(&d->i2c_mutex); | ||
190 | |||
191 | return ret; | ||
192 | } | ||
193 | |||
194 | static u32 technisat_usb2_i2c_func(struct i2c_adapter *adapter) | ||
195 | { | ||
196 | return I2C_FUNC_I2C; | ||
197 | } | ||
198 | |||
199 | static struct i2c_algorithm technisat_usb2_i2c_algo = { | ||
200 | .master_xfer = technisat_usb2_i2c_xfer, | ||
201 | .functionality = technisat_usb2_i2c_func, | ||
202 | }; | ||
203 | |||
204 | #if 0 | ||
205 | static void technisat_usb2_frontend_reset(struct usb_device *udev) | ||
206 | { | ||
207 | usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
208 | SET_FRONT_END_RESET_VENDOR_REQUEST, | ||
209 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
210 | 10, 0, | ||
211 | NULL, 0, 500); | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | /* LED control */ | ||
216 | enum technisat_usb2_led_state { | ||
217 | LED_OFF, | ||
218 | LED_BLINK, | ||
219 | LED_ON, | ||
220 | LED_UNDEFINED | ||
221 | }; | ||
222 | |||
223 | static int technisat_usb2_set_led(struct dvb_usb_device *d, int red, enum technisat_usb2_led_state state) | ||
224 | { | ||
225 | int ret; | ||
226 | |||
227 | u8 led[8] = { | ||
228 | red ? SET_RED_LED_VENDOR_REQUEST : SET_GREEN_LED_VENDOR_REQUEST, | ||
229 | 0 | ||
230 | }; | ||
231 | |||
232 | if (disable_led_control && state != LED_OFF) | ||
233 | return 0; | ||
234 | |||
235 | switch (state) { | ||
236 | case LED_ON: | ||
237 | led[1] = 0x82; | ||
238 | break; | ||
239 | case LED_BLINK: | ||
240 | led[1] = 0x82; | ||
241 | if (red) { | ||
242 | led[2] = 0x02; | ||
243 | led[3] = 10; | ||
244 | led[4] = 10; | ||
245 | } else { | ||
246 | led[2] = 0xff; | ||
247 | led[3] = 50; | ||
248 | led[4] = 50; | ||
249 | } | ||
250 | led[5] = 1; | ||
251 | break; | ||
252 | |||
253 | default: | ||
254 | case LED_OFF: | ||
255 | led[1] = 0x80; | ||
256 | break; | ||
257 | } | ||
258 | |||
259 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
260 | return -EAGAIN; | ||
261 | |||
262 | ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0), | ||
263 | red ? SET_RED_LED_VENDOR_REQUEST : SET_GREEN_LED_VENDOR_REQUEST, | ||
264 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
265 | 0, 0, | ||
266 | led, sizeof(led), 500); | ||
267 | |||
268 | mutex_unlock(&d->i2c_mutex); | ||
269 | return ret; | ||
270 | } | ||
271 | |||
272 | static int technisat_usb2_set_led_timer(struct dvb_usb_device *d, u8 red, u8 green) | ||
273 | { | ||
274 | int ret; | ||
275 | u8 b = 0; | ||
276 | |||
277 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
278 | return -EAGAIN; | ||
279 | |||
280 | ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0), | ||
281 | SET_LED_TIMER_DIVIDER_VENDOR_REQUEST, | ||
282 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
283 | (red << 8) | green, 0, | ||
284 | &b, 1, 500); | ||
285 | |||
286 | mutex_unlock(&d->i2c_mutex); | ||
287 | |||
288 | return ret; | ||
289 | } | ||
290 | |||
291 | static void technisat_usb2_green_led_control(struct work_struct *work) | ||
292 | { | ||
293 | struct technisat_usb2_state *state = | ||
294 | container_of(work, struct technisat_usb2_state, green_led_work.work); | ||
295 | struct dvb_frontend *fe = state->dev->adapter[0].fe; | ||
296 | |||
297 | if (state->power_state == 0) | ||
298 | goto schedule; | ||
299 | |||
300 | if (fe != NULL) { | ||
301 | enum fe_status status; | ||
302 | |||
303 | if (fe->ops.read_status(fe, &status) != 0) | ||
304 | goto schedule; | ||
305 | |||
306 | if (status & FE_HAS_LOCK) { | ||
307 | u32 ber; | ||
308 | |||
309 | if (fe->ops.read_ber(fe, &ber) != 0) | ||
310 | goto schedule; | ||
311 | |||
312 | if (ber > 1000) | ||
313 | technisat_usb2_set_led(state->dev, 0, LED_BLINK); | ||
314 | else | ||
315 | technisat_usb2_set_led(state->dev, 0, LED_ON); | ||
316 | } else | ||
317 | technisat_usb2_set_led(state->dev, 0, LED_OFF); | ||
318 | } | ||
319 | |||
320 | schedule: | ||
321 | schedule_delayed_work(&state->green_led_work, | ||
322 | msecs_to_jiffies(500)); | ||
323 | } | ||
324 | |||
325 | /* method to find out whether the firmware has to be downloaded or not */ | ||
326 | static int technisat_usb2_identify_state(struct usb_device *udev, | ||
327 | struct dvb_usb_device_properties *props, | ||
328 | struct dvb_usb_device_description **desc, int *cold) | ||
329 | { | ||
330 | int ret; | ||
331 | u8 version[3]; | ||
332 | |||
333 | /* first select the interface */ | ||
334 | if (usb_set_interface(udev, 0, 1) != 0) | ||
335 | err("could not set alternate setting to 0"); | ||
336 | else | ||
337 | info("set alternate setting"); | ||
338 | |||
339 | *cold = 0; /* by default do not download a firmware - just in case something is wrong */ | ||
340 | |||
341 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
342 | GET_VERSION_INFO_VENDOR_REQUEST, | ||
343 | USB_TYPE_VENDOR | USB_DIR_IN, | ||
344 | 0, 0, | ||
345 | version, sizeof(version), 500); | ||
346 | |||
347 | if (ret < 0) | ||
348 | *cold = 1; | ||
349 | else { | ||
350 | info("firmware version: %d.%d", version[1], version[2]); | ||
351 | *cold = 0; | ||
352 | } | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | /* power control */ | ||
358 | static int technisat_usb2_power_ctrl(struct dvb_usb_device *d, int level) | ||
359 | { | ||
360 | struct technisat_usb2_state *state = d->priv; | ||
361 | |||
362 | state->power_state = level; | ||
363 | |||
364 | if (disable_led_control) | ||
365 | return 0; | ||
366 | |||
367 | /* green led is turned off in any case - will be turned on when tuning */ | ||
368 | technisat_usb2_set_led(d, 0, LED_OFF); | ||
369 | /* red led is turned on all the time */ | ||
370 | technisat_usb2_set_led(d, 1, LED_ON); | ||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | /* mac address reading - from the eeprom */ | ||
375 | #if 0 | ||
376 | static void technisat_usb2_eeprom_dump(struct dvb_usb_device *d) | ||
377 | { | ||
378 | u8 reg; | ||
379 | u8 b[16]; | ||
380 | int i, j; | ||
381 | |||
382 | /* full EEPROM dump */ | ||
383 | for (j = 0; j < 256 * 4; j += 16) { | ||
384 | reg = j; | ||
385 | if (technisat_usb2_i2c_access(d->udev, 0x50 + j / 256, ®, 1, b, 16) != 0) | ||
386 | break; | ||
387 | |||
388 | deb_eeprom("EEPROM: %01x%02x: ", j / 256, reg); | ||
389 | for (i = 0; i < 16; i++) | ||
390 | deb_eeprom("%02x ", b[i]); | ||
391 | deb_eeprom("\n"); | ||
392 | } | ||
393 | } | ||
394 | #endif | ||
395 | |||
396 | static u8 technisat_usb2_calc_lrc(const u8 *b, u16 length) | ||
397 | { | ||
398 | u8 lrc = 0; | ||
399 | while (--length) | ||
400 | lrc ^= *b++; | ||
401 | return lrc; | ||
402 | } | ||
403 | |||
404 | static int technisat_usb2_eeprom_lrc_read(struct dvb_usb_device *d, | ||
405 | u16 offset, u8 *b, u16 length, u8 tries) | ||
406 | { | ||
407 | u8 bo = offset & 0xff; | ||
408 | struct i2c_msg msg[] = { | ||
409 | { | ||
410 | .addr = 0x50 | ((offset >> 8) & 0x3), | ||
411 | .buf = &bo, | ||
412 | .len = 1 | ||
413 | }, { | ||
414 | .addr = 0x50 | ((offset >> 8) & 0x3), | ||
415 | .flags = I2C_M_RD, | ||
416 | .buf = b, | ||
417 | .len = length | ||
418 | } | ||
419 | }; | ||
420 | |||
421 | while (tries--) { | ||
422 | int status; | ||
423 | |||
424 | if (i2c_transfer(&d->i2c_adap, msg, 2) != 2) | ||
425 | break; | ||
426 | |||
427 | status = | ||
428 | technisat_usb2_calc_lrc(b, length - 1) == b[length - 1]; | ||
429 | |||
430 | if (status) | ||
431 | return 0; | ||
432 | } | ||
433 | |||
434 | return -EREMOTEIO; | ||
435 | } | ||
436 | |||
437 | #define EEPROM_MAC_START 0x3f8 | ||
438 | #define EEPROM_MAC_TOTAL 8 | ||
439 | static int technisat_usb2_read_mac_address(struct dvb_usb_device *d, | ||
440 | u8 mac[]) | ||
441 | { | ||
442 | u8 buf[EEPROM_MAC_TOTAL]; | ||
443 | |||
444 | if (technisat_usb2_eeprom_lrc_read(d, EEPROM_MAC_START, | ||
445 | buf, EEPROM_MAC_TOTAL, 4) != 0) | ||
446 | return -ENODEV; | ||
447 | |||
448 | memcpy(mac, buf, 6); | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | /* frontend attach */ | ||
453 | static int technisat_usb2_set_voltage(struct dvb_frontend *fe, | ||
454 | fe_sec_voltage_t voltage) | ||
455 | { | ||
456 | int i; | ||
457 | u8 gpio[3] = { 0 }; /* 0 = 2, 1 = 3, 2 = 4 */ | ||
458 | |||
459 | gpio[2] = 1; /* high - voltage ? */ | ||
460 | |||
461 | switch (voltage) { | ||
462 | case SEC_VOLTAGE_13: | ||
463 | gpio[0] = 1; | ||
464 | break; | ||
465 | case SEC_VOLTAGE_18: | ||
466 | gpio[0] = 1; | ||
467 | gpio[1] = 1; | ||
468 | break; | ||
469 | default: | ||
470 | case SEC_VOLTAGE_OFF: | ||
471 | break; | ||
472 | } | ||
473 | |||
474 | for (i = 0; i < 3; i++) | ||
475 | if (stv090x_set_gpio(fe, i+2, 0, gpio[i], 0) != 0) | ||
476 | return -EREMOTEIO; | ||
477 | return 0; | ||
478 | } | ||
479 | |||
480 | static struct stv090x_config technisat_usb2_stv090x_config = { | ||
481 | .device = STV0903, | ||
482 | .demod_mode = STV090x_SINGLE, | ||
483 | .clk_mode = STV090x_CLK_EXT, | ||
484 | |||
485 | .xtal = 8000000, | ||
486 | .address = 0x68, | ||
487 | |||
488 | .ts1_mode = STV090x_TSMODE_DVBCI, | ||
489 | .ts1_clk = 13400000, | ||
490 | .ts1_tei = 1, | ||
491 | |||
492 | .repeater_level = STV090x_RPTLEVEL_64, | ||
493 | |||
494 | .tuner_bbgain = 6, | ||
495 | }; | ||
496 | |||
497 | static struct stv6110x_config technisat_usb2_stv6110x_config = { | ||
498 | .addr = 0x60, | ||
499 | .refclk = 16000000, | ||
500 | .clk_div = 2, | ||
501 | }; | ||
502 | |||
503 | static int technisat_usb2_frontend_attach(struct dvb_usb_adapter *a) | ||
504 | { | ||
505 | struct usb_device *udev = a->dev->udev; | ||
506 | int ret; | ||
507 | |||
508 | a->fe = dvb_attach(stv090x_attach, &technisat_usb2_stv090x_config, | ||
509 | &a->dev->i2c_adap, STV090x_DEMODULATOR_0); | ||
510 | |||
511 | if (a->fe) { | ||
512 | struct stv6110x_devctl *ctl; | ||
513 | |||
514 | ctl = dvb_attach(stv6110x_attach, | ||
515 | a->fe, | ||
516 | &technisat_usb2_stv6110x_config, | ||
517 | &a->dev->i2c_adap); | ||
518 | |||
519 | if (ctl) { | ||
520 | technisat_usb2_stv090x_config.tuner_init = ctl->tuner_init; | ||
521 | technisat_usb2_stv090x_config.tuner_sleep = ctl->tuner_sleep; | ||
522 | technisat_usb2_stv090x_config.tuner_set_mode = ctl->tuner_set_mode; | ||
523 | technisat_usb2_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency; | ||
524 | technisat_usb2_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency; | ||
525 | technisat_usb2_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth; | ||
526 | technisat_usb2_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth; | ||
527 | technisat_usb2_stv090x_config.tuner_set_bbgain = ctl->tuner_set_bbgain; | ||
528 | technisat_usb2_stv090x_config.tuner_get_bbgain = ctl->tuner_get_bbgain; | ||
529 | technisat_usb2_stv090x_config.tuner_set_refclk = ctl->tuner_set_refclk; | ||
530 | technisat_usb2_stv090x_config.tuner_get_status = ctl->tuner_get_status; | ||
531 | |||
532 | /* call the init function once to initialize | ||
533 | tuner's clock output divider and demod's | ||
534 | master clock */ | ||
535 | if (a->fe->ops.init) | ||
536 | a->fe->ops.init(a->fe); | ||
537 | |||
538 | if (mutex_lock_interruptible(&a->dev->i2c_mutex) < 0) | ||
539 | return -EAGAIN; | ||
540 | |||
541 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
542 | SET_IFCLK_TO_EXTERNAL_TSCLK_VENDOR_REQUEST, | ||
543 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
544 | 0, 0, | ||
545 | NULL, 0, 500); | ||
546 | mutex_unlock(&a->dev->i2c_mutex); | ||
547 | |||
548 | if (ret != 0) | ||
549 | err("could not set IF_CLK to external"); | ||
550 | |||
551 | a->fe->ops.set_voltage = technisat_usb2_set_voltage; | ||
552 | |||
553 | /* if everything was successful assign a nice name to the frontend */ | ||
554 | strlcpy(a->fe->ops.info.name, a->dev->desc->name, | ||
555 | sizeof(a->fe->ops.info.name)); | ||
556 | } else { | ||
557 | dvb_frontend_detach(a->fe); | ||
558 | a->fe = NULL; | ||
559 | } | ||
560 | } | ||
561 | |||
562 | technisat_usb2_set_led_timer(a->dev, 1, 1); | ||
563 | |||
564 | return a->fe == NULL ? -ENODEV : 0; | ||
565 | } | ||
566 | |||
567 | /* Remote control */ | ||
568 | |||
569 | /* the device is giving providing raw IR-signals to the host mapping | ||
570 | * it only to one remote control is just the default implementation | ||
571 | */ | ||
572 | #define NOMINAL_IR_BIT_TRANSITION_TIME_US 889 | ||
573 | #define NOMINAL_IR_BIT_TIME_US (2 * NOMINAL_IR_BIT_TRANSITION_TIME_US) | ||
574 | |||
575 | #define FIRMWARE_CLOCK_TICK 83333 | ||
576 | #define FIRMWARE_CLOCK_DIVISOR 256 | ||
577 | |||
578 | #define IR_PERCENT_TOLERANCE 15 | ||
579 | |||
580 | #define NOMINAL_IR_BIT_TRANSITION_TICKS ((NOMINAL_IR_BIT_TRANSITION_TIME_US * 1000 * 1000) / FIRMWARE_CLOCK_TICK) | ||
581 | #define NOMINAL_IR_BIT_TRANSITION_TICK_COUNT (NOMINAL_IR_BIT_TRANSITION_TICKS / FIRMWARE_CLOCK_DIVISOR) | ||
582 | |||
583 | #define NOMINAL_IR_BIT_TIME_TICKS ((NOMINAL_IR_BIT_TIME_US * 1000 * 1000) / FIRMWARE_CLOCK_TICK) | ||
584 | #define NOMINAL_IR_BIT_TIME_TICK_COUNT (NOMINAL_IR_BIT_TIME_TICKS / FIRMWARE_CLOCK_DIVISOR) | ||
585 | |||
586 | #define MINIMUM_IR_BIT_TRANSITION_TICK_COUNT (NOMINAL_IR_BIT_TRANSITION_TICK_COUNT - ((NOMINAL_IR_BIT_TRANSITION_TICK_COUNT * IR_PERCENT_TOLERANCE) / 100)) | ||
587 | #define MAXIMUM_IR_BIT_TRANSITION_TICK_COUNT (NOMINAL_IR_BIT_TRANSITION_TICK_COUNT + ((NOMINAL_IR_BIT_TRANSITION_TICK_COUNT * IR_PERCENT_TOLERANCE) / 100)) | ||
588 | |||
589 | #define MINIMUM_IR_BIT_TIME_TICK_COUNT (NOMINAL_IR_BIT_TIME_TICK_COUNT - ((NOMINAL_IR_BIT_TIME_TICK_COUNT * IR_PERCENT_TOLERANCE) / 100)) | ||
590 | #define MAXIMUM_IR_BIT_TIME_TICK_COUNT (NOMINAL_IR_BIT_TIME_TICK_COUNT + ((NOMINAL_IR_BIT_TIME_TICK_COUNT * IR_PERCENT_TOLERANCE) / 100)) | ||
591 | |||
592 | static int technisat_usb2_get_ir(struct dvb_usb_device *d) | ||
593 | { | ||
594 | u8 buf[62], *b; | ||
595 | int ret; | ||
596 | struct ir_raw_event ev; | ||
597 | |||
598 | buf[0] = GET_IR_DATA_VENDOR_REQUEST; | ||
599 | buf[1] = 0x08; | ||
600 | buf[2] = 0x8f; | ||
601 | buf[3] = MINIMUM_IR_BIT_TRANSITION_TICK_COUNT; | ||
602 | buf[4] = MAXIMUM_IR_BIT_TIME_TICK_COUNT; | ||
603 | |||
604 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
605 | return -EAGAIN; | ||
606 | ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0), | ||
607 | GET_IR_DATA_VENDOR_REQUEST, | ||
608 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
609 | 0, 0, | ||
610 | buf, 5, 500); | ||
611 | if (ret < 0) | ||
612 | goto unlock; | ||
613 | |||
614 | buf[1] = 0; | ||
615 | buf[2] = 0; | ||
616 | ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), | ||
617 | GET_IR_DATA_VENDOR_REQUEST, | ||
618 | USB_TYPE_VENDOR | USB_DIR_IN, | ||
619 | 0x8080, 0, | ||
620 | buf, sizeof(buf), 500); | ||
621 | |||
622 | unlock: | ||
623 | mutex_unlock(&d->i2c_mutex); | ||
624 | |||
625 | if (ret < 0) | ||
626 | return ret; | ||
627 | |||
628 | if (ret == 1) | ||
629 | return 0; /* no key pressed */ | ||
630 | |||
631 | /* decoding */ | ||
632 | b = buf+1; | ||
633 | |||
634 | #if 0 | ||
635 | deb_rc("RC: %d ", ret); | ||
636 | debug_dump(b, ret, deb_rc); | ||
637 | #endif | ||
638 | |||
639 | ev.pulse = 0; | ||
640 | while (1) { | ||
641 | ev.pulse = !ev.pulse; | ||
642 | ev.duration = (*b * FIRMWARE_CLOCK_DIVISOR * FIRMWARE_CLOCK_TICK) / 1000; | ||
643 | ir_raw_event_store(d->rc_dev, &ev); | ||
644 | |||
645 | b++; | ||
646 | if (*b == 0xff) { | ||
647 | ev.pulse = 0; | ||
648 | ev.duration = 888888*2; | ||
649 | ir_raw_event_store(d->rc_dev, &ev); | ||
650 | break; | ||
651 | } | ||
652 | } | ||
653 | |||
654 | ir_raw_event_handle(d->rc_dev); | ||
655 | |||
656 | return 1; | ||
657 | } | ||
658 | |||
659 | static int technisat_usb2_rc_query(struct dvb_usb_device *d) | ||
660 | { | ||
661 | int ret = technisat_usb2_get_ir(d); | ||
662 | |||
663 | if (ret < 0) | ||
664 | return ret; | ||
665 | |||
666 | if (ret == 0) | ||
667 | return 0; | ||
668 | |||
669 | if (!disable_led_control) | ||
670 | technisat_usb2_set_led(d, 1, LED_BLINK); | ||
671 | |||
672 | return 0; | ||
673 | } | ||
674 | |||
675 | /* DVB-USB and USB stuff follows */ | ||
676 | static struct usb_device_id technisat_usb2_id_table[] = { | ||
677 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_DVB_S2) }, | ||
678 | { 0 } /* Terminating entry */ | ||
679 | }; | ||
680 | |||
681 | /* device description */ | ||
682 | static struct dvb_usb_device_properties technisat_usb2_devices = { | ||
683 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
684 | |||
685 | .usb_ctrl = CYPRESS_FX2, | ||
686 | |||
687 | .identify_state = technisat_usb2_identify_state, | ||
688 | .firmware = "dvb-usb-SkyStar_USB_HD_FW_v17_63.HEX.fw", | ||
689 | |||
690 | .size_of_priv = sizeof(struct technisat_usb2_state), | ||
691 | |||
692 | .i2c_algo = &technisat_usb2_i2c_algo, | ||
693 | |||
694 | .power_ctrl = technisat_usb2_power_ctrl, | ||
695 | .read_mac_address = technisat_usb2_read_mac_address, | ||
696 | |||
697 | .num_adapters = 1, | ||
698 | .adapter = { | ||
699 | { | ||
700 | .frontend_attach = technisat_usb2_frontend_attach, | ||
701 | |||
702 | .stream = { | ||
703 | .type = USB_ISOC, | ||
704 | .count = 8, | ||
705 | .endpoint = 0x2, | ||
706 | .u = { | ||
707 | .isoc = { | ||
708 | .framesperurb = 32, | ||
709 | .framesize = 2048, | ||
710 | .interval = 3, | ||
711 | } | ||
712 | } | ||
713 | }, | ||
714 | |||
715 | .size_of_priv = 0, | ||
716 | }, | ||
717 | }, | ||
718 | |||
719 | .num_device_descs = 1, | ||
720 | .devices = { | ||
721 | { "Technisat SkyStar USB HD (DVB-S/S2)", | ||
722 | { &technisat_usb2_id_table[0], NULL }, | ||
723 | { NULL }, | ||
724 | }, | ||
725 | }, | ||
726 | |||
727 | .rc.core = { | ||
728 | .rc_interval = 100, | ||
729 | .rc_codes = RC_MAP_TECHNISAT_USB2, | ||
730 | .module_name = "technisat-usb2", | ||
731 | .rc_query = technisat_usb2_rc_query, | ||
732 | .allowed_protos = RC_TYPE_ALL, | ||
733 | .driver_type = RC_DRIVER_IR_RAW, | ||
734 | } | ||
735 | }; | ||
736 | |||
737 | static int technisat_usb2_probe(struct usb_interface *intf, | ||
738 | const struct usb_device_id *id) | ||
739 | { | ||
740 | struct dvb_usb_device *dev; | ||
741 | |||
742 | if (dvb_usb_device_init(intf, &technisat_usb2_devices, THIS_MODULE, | ||
743 | &dev, adapter_nr) != 0) | ||
744 | return -ENODEV; | ||
745 | |||
746 | if (dev) { | ||
747 | struct technisat_usb2_state *state = dev->priv; | ||
748 | state->dev = dev; | ||
749 | |||
750 | if (!disable_led_control) { | ||
751 | INIT_DELAYED_WORK(&state->green_led_work, | ||
752 | technisat_usb2_green_led_control); | ||
753 | schedule_delayed_work(&state->green_led_work, | ||
754 | msecs_to_jiffies(500)); | ||
755 | } | ||
756 | } | ||
757 | |||
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static void technisat_usb2_disconnect(struct usb_interface *intf) | ||
762 | { | ||
763 | struct dvb_usb_device *dev = usb_get_intfdata(intf); | ||
764 | |||
765 | /* work and stuff was only created when the device is is hot-state */ | ||
766 | if (dev != NULL) { | ||
767 | struct technisat_usb2_state *state = dev->priv; | ||
768 | if (state != NULL) { | ||
769 | cancel_delayed_work_sync(&state->green_led_work); | ||
770 | flush_scheduled_work(); | ||
771 | } | ||
772 | } | ||
773 | |||
774 | dvb_usb_device_exit(intf); | ||
775 | } | ||
776 | |||
777 | static struct usb_driver technisat_usb2_driver = { | ||
778 | .name = "dvb_usb_technisat_usb2", | ||
779 | .probe = technisat_usb2_probe, | ||
780 | .disconnect = technisat_usb2_disconnect, | ||
781 | .id_table = technisat_usb2_id_table, | ||
782 | }; | ||
783 | |||
784 | /* module stuff */ | ||
785 | static int __init technisat_usb2_module_init(void) | ||
786 | { | ||
787 | int result = usb_register(&technisat_usb2_driver); | ||
788 | if (result) { | ||
789 | err("usb_register failed. Code %d", result); | ||
790 | return result; | ||
791 | } | ||
792 | |||
793 | return 0; | ||
794 | } | ||
795 | |||
796 | static void __exit technisat_usb2_module_exit(void) | ||
797 | { | ||
798 | usb_deregister(&technisat_usb2_driver); | ||
799 | } | ||
800 | |||
801 | module_init(technisat_usb2_module_init); | ||
802 | module_exit(technisat_usb2_module_exit); | ||
803 | |||
804 | MODULE_AUTHOR("Patrick Boettcher <pboettcher@kernellabs.com>"); | ||
805 | MODULE_DESCRIPTION("Driver for Technisat DVB-S/S2 USB 2.0 device"); | ||
806 | MODULE_VERSION("1.0"); | ||
807 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c index a6de489a6a39..0d4709ff9cbb 100644 --- a/drivers/media/dvb/dvb-usb/ttusb2.c +++ b/drivers/media/dvb/dvb-usb/ttusb2.c | |||
@@ -43,6 +43,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
43 | 43 | ||
44 | struct ttusb2_state { | 44 | struct ttusb2_state { |
45 | u8 id; | 45 | u8 id; |
46 | u16 last_rc_key; | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | static int ttusb2_msg(struct dvb_usb_device *d, u8 cmd, | 49 | static int ttusb2_msg(struct dvb_usb_device *d, u8 cmd, |
@@ -128,6 +129,33 @@ static struct i2c_algorithm ttusb2_i2c_algo = { | |||
128 | .functionality = ttusb2_i2c_func, | 129 | .functionality = ttusb2_i2c_func, |
129 | }; | 130 | }; |
130 | 131 | ||
132 | /* command to poll IR receiver (copied from pctv452e.c) */ | ||
133 | #define CMD_GET_IR_CODE 0x1b | ||
134 | |||
135 | /* IR */ | ||
136 | static int tt3650_rc_query(struct dvb_usb_device *d) | ||
137 | { | ||
138 | int ret; | ||
139 | u8 rx[9]; /* A CMD_GET_IR_CODE reply is 9 bytes long */ | ||
140 | struct ttusb2_state *st = d->priv; | ||
141 | ret = ttusb2_msg(d, CMD_GET_IR_CODE, NULL, 0, rx, sizeof(rx)); | ||
142 | if (ret != 0) | ||
143 | return ret; | ||
144 | |||
145 | if (rx[8] & 0x01) { | ||
146 | /* got a "press" event */ | ||
147 | st->last_rc_key = (rx[3] << 8) | rx[2]; | ||
148 | deb_info("%s: cmd=0x%02x sys=0x%02x\n", __func__, rx[2], rx[3]); | ||
149 | rc_keydown(d->rc_dev, st->last_rc_key, 0); | ||
150 | } else if (st->last_rc_key) { | ||
151 | rc_keyup(d->rc_dev); | ||
152 | st->last_rc_key = 0; | ||
153 | } | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | |||
131 | /* Callbacks for DVB USB */ | 159 | /* Callbacks for DVB USB */ |
132 | static int ttusb2_identify_state (struct usb_device *udev, struct | 160 | static int ttusb2_identify_state (struct usb_device *udev, struct |
133 | dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, | 161 | dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, |
@@ -345,6 +373,13 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = { | |||
345 | 373 | ||
346 | .size_of_priv = sizeof(struct ttusb2_state), | 374 | .size_of_priv = sizeof(struct ttusb2_state), |
347 | 375 | ||
376 | .rc.core = { | ||
377 | .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */ | ||
378 | .rc_codes = RC_MAP_TT_1500, | ||
379 | .rc_query = tt3650_rc_query, | ||
380 | .allowed_protos = RC_TYPE_UNKNOWN, | ||
381 | }, | ||
382 | |||
348 | .num_adapters = 1, | 383 | .num_adapters = 1, |
349 | .adapter = { | 384 | .adapter = { |
350 | { | 385 | { |
diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c index ccc7e4452664..2bb8d4cc8d88 100644 --- a/drivers/media/dvb/dvb-usb/vp702x-fe.c +++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c | |||
@@ -41,14 +41,23 @@ struct vp702x_fe_state { | |||
41 | 41 | ||
42 | static int vp702x_fe_refresh_state(struct vp702x_fe_state *st) | 42 | static int vp702x_fe_refresh_state(struct vp702x_fe_state *st) |
43 | { | 43 | { |
44 | u8 buf[10]; | 44 | struct vp702x_device_state *dst = st->d->priv; |
45 | if (time_after(jiffies,st->next_status_check)) { | 45 | u8 *buf; |
46 | vp702x_usb_in_op(st->d,READ_STATUS,0,0,buf,10); | ||
47 | 46 | ||
47 | if (time_after(jiffies, st->next_status_check)) { | ||
48 | mutex_lock(&dst->buf_mutex); | ||
49 | buf = dst->buf; | ||
50 | |||
51 | vp702x_usb_in_op(st->d, READ_STATUS, 0, 0, buf, 10); | ||
48 | st->lock = buf[4]; | 52 | st->lock = buf[4]; |
49 | vp702x_usb_in_op(st->d,READ_TUNER_REG_REQ,0x11,0,&st->snr,1); | ||
50 | vp702x_usb_in_op(st->d,READ_TUNER_REG_REQ,0x15,0,&st->sig,1); | ||
51 | 53 | ||
54 | vp702x_usb_in_op(st->d, READ_TUNER_REG_REQ, 0x11, 0, buf, 1); | ||
55 | st->snr = buf[0]; | ||
56 | |||
57 | vp702x_usb_in_op(st->d, READ_TUNER_REG_REQ, 0x15, 0, buf, 1); | ||
58 | st->sig = buf[0]; | ||
59 | |||
60 | mutex_unlock(&dst->buf_mutex); | ||
52 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; | 61 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; |
53 | } | 62 | } |
54 | return 0; | 63 | return 0; |
@@ -130,11 +139,17 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe, | |||
130 | struct dvb_frontend_parameters *fep) | 139 | struct dvb_frontend_parameters *fep) |
131 | { | 140 | { |
132 | struct vp702x_fe_state *st = fe->demodulator_priv; | 141 | struct vp702x_fe_state *st = fe->demodulator_priv; |
142 | struct vp702x_device_state *dst = st->d->priv; | ||
133 | u32 freq = fep->frequency/1000; | 143 | u32 freq = fep->frequency/1000; |
134 | /*CalFrequency*/ | 144 | /*CalFrequency*/ |
135 | /* u16 frequencyRef[16] = { 2, 4, 8, 16, 32, 64, 128, 256, 24, 5, 10, 20, 40, 80, 160, 320 }; */ | 145 | /* u16 frequencyRef[16] = { 2, 4, 8, 16, 32, 64, 128, 256, 24, 5, 10, 20, 40, 80, 160, 320 }; */ |
136 | u64 sr; | 146 | u64 sr; |
137 | u8 cmd[8] = { 0 },ibuf[10]; | 147 | u8 *cmd; |
148 | |||
149 | mutex_lock(&dst->buf_mutex); | ||
150 | |||
151 | cmd = dst->buf; | ||
152 | memset(cmd, 0, 10); | ||
138 | 153 | ||
139 | cmd[0] = (freq >> 8) & 0x7f; | 154 | cmd[0] = (freq >> 8) & 0x7f; |
140 | cmd[1] = freq & 0xff; | 155 | cmd[1] = freq & 0xff; |
@@ -170,13 +185,15 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe, | |||
170 | st->status_check_interval = 250; | 185 | st->status_check_interval = 250; |
171 | st->next_status_check = jiffies; | 186 | st->next_status_check = jiffies; |
172 | 187 | ||
173 | vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); | 188 | vp702x_usb_inout_op(st->d, cmd, 8, cmd, 10, 100); |
174 | 189 | ||
175 | if (ibuf[2] == 0 && ibuf[3] == 0) | 190 | if (cmd[2] == 0 && cmd[3] == 0) |
176 | deb_fe("tuning failed.\n"); | 191 | deb_fe("tuning failed.\n"); |
177 | else | 192 | else |
178 | deb_fe("tuning succeeded.\n"); | 193 | deb_fe("tuning succeeded.\n"); |
179 | 194 | ||
195 | mutex_unlock(&dst->buf_mutex); | ||
196 | |||
180 | return 0; | 197 | return 0; |
181 | } | 198 | } |
182 | 199 | ||
@@ -204,27 +221,32 @@ static int vp702x_fe_get_frontend(struct dvb_frontend* fe, | |||
204 | static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, | 221 | static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, |
205 | struct dvb_diseqc_master_cmd *m) | 222 | struct dvb_diseqc_master_cmd *m) |
206 | { | 223 | { |
224 | u8 *cmd; | ||
207 | struct vp702x_fe_state *st = fe->demodulator_priv; | 225 | struct vp702x_fe_state *st = fe->demodulator_priv; |
208 | u8 cmd[8],ibuf[10]; | 226 | struct vp702x_device_state *dst = st->d->priv; |
209 | memset(cmd,0,8); | ||
210 | 227 | ||
211 | deb_fe("%s\n",__func__); | 228 | deb_fe("%s\n",__func__); |
212 | 229 | ||
213 | if (m->msg_len > 4) | 230 | if (m->msg_len > 4) |
214 | return -EINVAL; | 231 | return -EINVAL; |
215 | 232 | ||
233 | mutex_lock(&dst->buf_mutex); | ||
234 | |||
235 | cmd = dst->buf; | ||
216 | cmd[1] = SET_DISEQC_CMD; | 236 | cmd[1] = SET_DISEQC_CMD; |
217 | cmd[2] = m->msg_len; | 237 | cmd[2] = m->msg_len; |
218 | memcpy(&cmd[3], m->msg, m->msg_len); | 238 | memcpy(&cmd[3], m->msg, m->msg_len); |
219 | cmd[7] = vp702x_chksum(cmd,0,7); | 239 | cmd[7] = vp702x_chksum(cmd, 0, 7); |
220 | 240 | ||
221 | vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); | 241 | vp702x_usb_inout_op(st->d, cmd, 8, cmd, 10, 100); |
222 | 242 | ||
223 | if (ibuf[2] == 0 && ibuf[3] == 0) | 243 | if (cmd[2] == 0 && cmd[3] == 0) |
224 | deb_fe("diseqc cmd failed.\n"); | 244 | deb_fe("diseqc cmd failed.\n"); |
225 | else | 245 | else |
226 | deb_fe("diseqc cmd succeeded.\n"); | 246 | deb_fe("diseqc cmd succeeded.\n"); |
227 | 247 | ||
248 | mutex_unlock(&dst->buf_mutex); | ||
249 | |||
228 | return 0; | 250 | return 0; |
229 | } | 251 | } |
230 | 252 | ||
@@ -237,7 +259,9 @@ static int vp702x_fe_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd | |||
237 | static int vp702x_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 259 | static int vp702x_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
238 | { | 260 | { |
239 | struct vp702x_fe_state *st = fe->demodulator_priv; | 261 | struct vp702x_fe_state *st = fe->demodulator_priv; |
240 | u8 ibuf[10]; | 262 | struct vp702x_device_state *dst = st->d->priv; |
263 | u8 *buf; | ||
264 | |||
241 | deb_fe("%s\n",__func__); | 265 | deb_fe("%s\n",__func__); |
242 | 266 | ||
243 | st->tone_mode = tone; | 267 | st->tone_mode = tone; |
@@ -247,14 +271,21 @@ static int vp702x_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
247 | else | 271 | else |
248 | st->lnb_buf[2] = 0x00; | 272 | st->lnb_buf[2] = 0x00; |
249 | 273 | ||
250 | st->lnb_buf[7] = vp702x_chksum(st->lnb_buf,0,7); | 274 | st->lnb_buf[7] = vp702x_chksum(st->lnb_buf, 0, 7); |
275 | |||
276 | mutex_lock(&dst->buf_mutex); | ||
277 | |||
278 | buf = dst->buf; | ||
279 | memcpy(buf, st->lnb_buf, 8); | ||
251 | 280 | ||
252 | vp702x_usb_inout_op(st->d,st->lnb_buf,8,ibuf,10,100); | 281 | vp702x_usb_inout_op(st->d, buf, 8, buf, 10, 100); |
253 | if (ibuf[2] == 0 && ibuf[3] == 0) | 282 | if (buf[2] == 0 && buf[3] == 0) |
254 | deb_fe("set_tone cmd failed.\n"); | 283 | deb_fe("set_tone cmd failed.\n"); |
255 | else | 284 | else |
256 | deb_fe("set_tone cmd succeeded.\n"); | 285 | deb_fe("set_tone cmd succeeded.\n"); |
257 | 286 | ||
287 | mutex_unlock(&dst->buf_mutex); | ||
288 | |||
258 | return 0; | 289 | return 0; |
259 | } | 290 | } |
260 | 291 | ||
@@ -262,7 +293,8 @@ static int vp702x_fe_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t | |||
262 | voltage) | 293 | voltage) |
263 | { | 294 | { |
264 | struct vp702x_fe_state *st = fe->demodulator_priv; | 295 | struct vp702x_fe_state *st = fe->demodulator_priv; |
265 | u8 ibuf[10]; | 296 | struct vp702x_device_state *dst = st->d->priv; |
297 | u8 *buf; | ||
266 | deb_fe("%s\n",__func__); | 298 | deb_fe("%s\n",__func__); |
267 | 299 | ||
268 | st->voltage = voltage; | 300 | st->voltage = voltage; |
@@ -272,14 +304,20 @@ static int vp702x_fe_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t | |||
272 | else | 304 | else |
273 | st->lnb_buf[4] = 0x00; | 305 | st->lnb_buf[4] = 0x00; |
274 | 306 | ||
275 | st->lnb_buf[7] = vp702x_chksum(st->lnb_buf,0,7); | 307 | st->lnb_buf[7] = vp702x_chksum(st->lnb_buf, 0, 7); |
308 | |||
309 | mutex_lock(&dst->buf_mutex); | ||
310 | |||
311 | buf = dst->buf; | ||
312 | memcpy(buf, st->lnb_buf, 8); | ||
276 | 313 | ||
277 | vp702x_usb_inout_op(st->d,st->lnb_buf,8,ibuf,10,100); | 314 | vp702x_usb_inout_op(st->d, buf, 8, buf, 10, 100); |
278 | if (ibuf[2] == 0 && ibuf[3] == 0) | 315 | if (buf[2] == 0 && buf[3] == 0) |
279 | deb_fe("set_voltage cmd failed.\n"); | 316 | deb_fe("set_voltage cmd failed.\n"); |
280 | else | 317 | else |
281 | deb_fe("set_voltage cmd succeeded.\n"); | 318 | deb_fe("set_voltage cmd succeeded.\n"); |
282 | 319 | ||
320 | mutex_unlock(&dst->buf_mutex); | ||
283 | return 0; | 321 | return 0; |
284 | } | 322 | } |
285 | 323 | ||
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index 5c9f3275aaa0..54355f84a98f 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * see Documentation/dvb/README.dvb-usb for more information | 15 | * see Documentation/dvb/README.dvb-usb for more information |
16 | */ | 16 | */ |
17 | #include "vp702x.h" | 17 | #include "vp702x.h" |
18 | #include <linux/mutex.h> | ||
18 | 19 | ||
19 | /* debug */ | 20 | /* debug */ |
20 | int dvb_usb_vp702x_debug; | 21 | int dvb_usb_vp702x_debug; |
@@ -23,27 +24,23 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DV | |||
23 | 24 | ||
24 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 25 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
25 | 26 | ||
26 | struct vp702x_state { | 27 | struct vp702x_adapter_state { |
27 | int pid_filter_count; | 28 | int pid_filter_count; |
28 | int pid_filter_can_bypass; | 29 | int pid_filter_can_bypass; |
29 | u8 pid_filter_state; | 30 | u8 pid_filter_state; |
30 | }; | 31 | }; |
31 | 32 | ||
32 | struct vp702x_device_state { | 33 | static int vp702x_usb_in_op_unlocked(struct dvb_usb_device *d, u8 req, |
33 | u8 power_state; | 34 | u16 value, u16 index, u8 *b, int blen) |
34 | }; | ||
35 | |||
36 | /* check for mutex FIXME */ | ||
37 | int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | ||
38 | { | 35 | { |
39 | int ret = -1; | 36 | int ret; |
40 | 37 | ||
41 | ret = usb_control_msg(d->udev, | 38 | ret = usb_control_msg(d->udev, |
42 | usb_rcvctrlpipe(d->udev,0), | 39 | usb_rcvctrlpipe(d->udev, 0), |
43 | req, | 40 | req, |
44 | USB_TYPE_VENDOR | USB_DIR_IN, | 41 | USB_TYPE_VENDOR | USB_DIR_IN, |
45 | value,index,b,blen, | 42 | value, index, b, blen, |
46 | 2000); | 43 | 2000); |
47 | 44 | ||
48 | if (ret < 0) { | 45 | if (ret < 0) { |
49 | warn("usb in operation failed. (%d)", ret); | 46 | warn("usb in operation failed. (%d)", ret); |
@@ -58,8 +55,20 @@ int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 | |||
58 | return ret; | 55 | return ret; |
59 | } | 56 | } |
60 | 57 | ||
61 | static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | 58 | int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, |
62 | u16 index, u8 *b, int blen) | 59 | u16 index, u8 *b, int blen) |
60 | { | ||
61 | int ret; | ||
62 | |||
63 | mutex_lock(&d->usb_mutex); | ||
64 | ret = vp702x_usb_in_op_unlocked(d, req, value, index, b, blen); | ||
65 | mutex_unlock(&d->usb_mutex); | ||
66 | |||
67 | return ret; | ||
68 | } | ||
69 | |||
70 | int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, u16 value, | ||
71 | u16 index, u8 *b, int blen) | ||
63 | { | 72 | { |
64 | int ret; | 73 | int ret; |
65 | deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); | 74 | deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); |
@@ -77,6 +86,18 @@ static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | |||
77 | return 0; | 86 | return 0; |
78 | } | 87 | } |
79 | 88 | ||
89 | int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | ||
90 | u16 index, u8 *b, int blen) | ||
91 | { | ||
92 | int ret; | ||
93 | |||
94 | mutex_lock(&d->usb_mutex); | ||
95 | ret = vp702x_usb_out_op_unlocked(d, req, value, index, b, blen); | ||
96 | mutex_unlock(&d->usb_mutex); | ||
97 | |||
98 | return ret; | ||
99 | } | ||
100 | |||
80 | int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec) | 101 | int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec) |
81 | { | 102 | { |
82 | int ret; | 103 | int ret; |
@@ -84,50 +105,93 @@ int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int il | |||
84 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) | 105 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) |
85 | return ret; | 106 | return ret; |
86 | 107 | ||
87 | ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen); | 108 | ret = vp702x_usb_out_op_unlocked(d, REQUEST_OUT, 0, 0, o, olen); |
88 | msleep(msec); | 109 | msleep(msec); |
89 | ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen); | 110 | ret = vp702x_usb_in_op_unlocked(d, REQUEST_IN, 0, 0, i, ilen); |
90 | 111 | ||
91 | mutex_unlock(&d->usb_mutex); | 112 | mutex_unlock(&d->usb_mutex); |
92 | |||
93 | return ret; | 113 | return ret; |
94 | } | 114 | } |
95 | 115 | ||
96 | static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, | 116 | static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, |
97 | int olen, u8 *i, int ilen, int msec) | 117 | int olen, u8 *i, int ilen, int msec) |
98 | { | 118 | { |
99 | u8 bout[olen+2]; | 119 | struct vp702x_device_state *st = d->priv; |
100 | u8 bin[ilen+1]; | ||
101 | int ret = 0; | 120 | int ret = 0; |
121 | u8 *buf; | ||
122 | int buflen = max(olen + 2, ilen + 1); | ||
123 | |||
124 | ret = mutex_lock_interruptible(&st->buf_mutex); | ||
125 | if (ret < 0) | ||
126 | return ret; | ||
127 | |||
128 | if (buflen > st->buf_len) { | ||
129 | buf = kmalloc(buflen, GFP_KERNEL); | ||
130 | if (!buf) { | ||
131 | mutex_unlock(&st->buf_mutex); | ||
132 | return -ENOMEM; | ||
133 | } | ||
134 | info("successfully reallocated a bigger buffer"); | ||
135 | kfree(st->buf); | ||
136 | st->buf = buf; | ||
137 | st->buf_len = buflen; | ||
138 | } else { | ||
139 | buf = st->buf; | ||
140 | } | ||
102 | 141 | ||
103 | bout[0] = 0x00; | 142 | buf[0] = 0x00; |
104 | bout[1] = cmd; | 143 | buf[1] = cmd; |
105 | memcpy(&bout[2],o,olen); | 144 | memcpy(&buf[2], o, olen); |
106 | 145 | ||
107 | ret = vp702x_usb_inout_op(d, bout, olen+2, bin, ilen+1,msec); | 146 | ret = vp702x_usb_inout_op(d, buf, olen+2, buf, ilen+1, msec); |
108 | 147 | ||
109 | if (ret == 0) | 148 | if (ret == 0) |
110 | memcpy(i,&bin[1],ilen); | 149 | memcpy(i, &buf[1], ilen); |
150 | mutex_unlock(&st->buf_mutex); | ||
111 | 151 | ||
112 | return ret; | 152 | return ret; |
113 | } | 153 | } |
114 | 154 | ||
115 | static int vp702x_set_pld_mode(struct dvb_usb_adapter *adap, u8 bypass) | 155 | static int vp702x_set_pld_mode(struct dvb_usb_adapter *adap, u8 bypass) |
116 | { | 156 | { |
117 | u8 buf[16] = { 0 }; | 157 | int ret; |
118 | return vp702x_usb_in_op(adap->dev, 0xe0, (bypass << 8) | 0x0e, 0, buf, 16); | 158 | struct vp702x_device_state *st = adap->dev->priv; |
159 | u8 *buf; | ||
160 | |||
161 | mutex_lock(&st->buf_mutex); | ||
162 | |||
163 | buf = st->buf; | ||
164 | memset(buf, 0, 16); | ||
165 | |||
166 | ret = vp702x_usb_in_op(adap->dev, 0xe0, (bypass << 8) | 0x0e, | ||
167 | 0, buf, 16); | ||
168 | mutex_unlock(&st->buf_mutex); | ||
169 | return ret; | ||
119 | } | 170 | } |
120 | 171 | ||
121 | static int vp702x_set_pld_state(struct dvb_usb_adapter *adap, u8 state) | 172 | static int vp702x_set_pld_state(struct dvb_usb_adapter *adap, u8 state) |
122 | { | 173 | { |
123 | u8 buf[16] = { 0 }; | 174 | int ret; |
124 | return vp702x_usb_in_op(adap->dev, 0xe0, (state << 8) | 0x0f, 0, buf, 16); | 175 | struct vp702x_device_state *st = adap->dev->priv; |
176 | u8 *buf; | ||
177 | |||
178 | mutex_lock(&st->buf_mutex); | ||
179 | |||
180 | buf = st->buf; | ||
181 | memset(buf, 0, 16); | ||
182 | ret = vp702x_usb_in_op(adap->dev, 0xe0, (state << 8) | 0x0f, | ||
183 | 0, buf, 16); | ||
184 | |||
185 | mutex_unlock(&st->buf_mutex); | ||
186 | |||
187 | return ret; | ||
125 | } | 188 | } |
126 | 189 | ||
127 | static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onoff) | 190 | static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onoff) |
128 | { | 191 | { |
129 | struct vp702x_state *st = adap->priv; | 192 | struct vp702x_adapter_state *st = adap->priv; |
130 | u8 buf[16] = { 0 }; | 193 | struct vp702x_device_state *dst = adap->dev->priv; |
194 | u8 *buf; | ||
131 | 195 | ||
132 | if (onoff) | 196 | if (onoff) |
133 | st->pid_filter_state |= (1 << id); | 197 | st->pid_filter_state |= (1 << id); |
@@ -139,32 +203,45 @@ static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onof | |||
139 | id = 0x10 + id*2; | 203 | id = 0x10 + id*2; |
140 | 204 | ||
141 | vp702x_set_pld_state(adap, st->pid_filter_state); | 205 | vp702x_set_pld_state(adap, st->pid_filter_state); |
206 | |||
207 | mutex_lock(&dst->buf_mutex); | ||
208 | |||
209 | buf = dst->buf; | ||
210 | memset(buf, 0, 16); | ||
142 | vp702x_usb_in_op(adap->dev, 0xe0, (((pid >> 8) & 0xff) << 8) | (id), 0, buf, 16); | 211 | vp702x_usb_in_op(adap->dev, 0xe0, (((pid >> 8) & 0xff) << 8) | (id), 0, buf, 16); |
143 | vp702x_usb_in_op(adap->dev, 0xe0, (((pid ) & 0xff) << 8) | (id+1), 0, buf, 16); | 212 | vp702x_usb_in_op(adap->dev, 0xe0, (((pid ) & 0xff) << 8) | (id+1), 0, buf, 16); |
213 | |||
214 | mutex_unlock(&dst->buf_mutex); | ||
215 | |||
144 | return 0; | 216 | return 0; |
145 | } | 217 | } |
146 | 218 | ||
147 | 219 | ||
148 | static int vp702x_init_pid_filter(struct dvb_usb_adapter *adap) | 220 | static int vp702x_init_pid_filter(struct dvb_usb_adapter *adap) |
149 | { | 221 | { |
150 | struct vp702x_state *st = adap->priv; | 222 | struct vp702x_adapter_state *st = adap->priv; |
223 | struct vp702x_device_state *dst = adap->dev->priv; | ||
151 | int i; | 224 | int i; |
152 | u8 b[10] = { 0 }; | 225 | u8 *b; |
153 | 226 | ||
154 | st->pid_filter_count = 8; | 227 | st->pid_filter_count = 8; |
155 | st->pid_filter_can_bypass = 1; | 228 | st->pid_filter_can_bypass = 1; |
156 | st->pid_filter_state = 0x00; | 229 | st->pid_filter_state = 0x00; |
157 | 230 | ||
158 | vp702x_set_pld_mode(adap, 1); // bypass | 231 | vp702x_set_pld_mode(adap, 1); /* bypass */ |
159 | 232 | ||
160 | for (i = 0; i < st->pid_filter_count; i++) | 233 | for (i = 0; i < st->pid_filter_count; i++) |
161 | vp702x_set_pid(adap, 0xffff, i, 1); | 234 | vp702x_set_pid(adap, 0xffff, i, 1); |
162 | 235 | ||
236 | mutex_lock(&dst->buf_mutex); | ||
237 | b = dst->buf; | ||
238 | memset(b, 0, 10); | ||
163 | vp702x_usb_in_op(adap->dev, 0xb5, 3, 0, b, 10); | 239 | vp702x_usb_in_op(adap->dev, 0xb5, 3, 0, b, 10); |
164 | vp702x_usb_in_op(adap->dev, 0xb5, 0, 0, b, 10); | 240 | vp702x_usb_in_op(adap->dev, 0xb5, 0, 0, b, 10); |
165 | vp702x_usb_in_op(adap->dev, 0xb5, 1, 0, b, 10); | 241 | vp702x_usb_in_op(adap->dev, 0xb5, 1, 0, b, 10); |
242 | mutex_unlock(&dst->buf_mutex); | ||
243 | /*vp702x_set_pld_mode(d, 0); // filter */ | ||
166 | 244 | ||
167 | //vp702x_set_pld_mode(d, 0); // filter | ||
168 | return 0; | 245 | return 0; |
169 | } | 246 | } |
170 | 247 | ||
@@ -174,7 +251,7 @@ static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
174 | } | 251 | } |
175 | 252 | ||
176 | /* keys for the enclosed remote control */ | 253 | /* keys for the enclosed remote control */ |
177 | static struct ir_scancode ir_codes_vp702x_table[] = { | 254 | static struct rc_map_table rc_map_vp702x_table[] = { |
178 | { 0x0001, KEY_1 }, | 255 | { 0x0001, KEY_1 }, |
179 | { 0x0002, KEY_2 }, | 256 | { 0x0002, KEY_2 }, |
180 | }; | 257 | }; |
@@ -182,36 +259,49 @@ static struct ir_scancode ir_codes_vp702x_table[] = { | |||
182 | /* remote control stuff (does not work with my box) */ | 259 | /* remote control stuff (does not work with my box) */ |
183 | static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 260 | static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
184 | { | 261 | { |
185 | u8 key[10]; | 262 | u8 *key; |
186 | int i; | 263 | int i; |
187 | 264 | ||
188 | /* remove the following return to enabled remote querying */ | 265 | /* remove the following return to enabled remote querying */ |
189 | return 0; | 266 | return 0; |
190 | 267 | ||
268 | key = kmalloc(10, GFP_KERNEL); | ||
269 | if (!key) | ||
270 | return -ENOMEM; | ||
271 | |||
191 | vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10); | 272 | vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10); |
192 | 273 | ||
193 | deb_rc("remote query key: %x %d\n",key[1],key[1]); | 274 | deb_rc("remote query key: %x %d\n",key[1],key[1]); |
194 | 275 | ||
195 | if (key[1] == 0x44) { | 276 | if (key[1] == 0x44) { |
196 | *state = REMOTE_NO_KEY_PRESSED; | 277 | *state = REMOTE_NO_KEY_PRESSED; |
278 | kfree(key); | ||
197 | return 0; | 279 | return 0; |
198 | } | 280 | } |
199 | 281 | ||
200 | for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++) | 282 | for (i = 0; i < ARRAY_SIZE(rc_map_vp702x_table); i++) |
201 | if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) { | 283 | if (rc5_custom(&rc_map_vp702x_table[i]) == key[1]) { |
202 | *state = REMOTE_KEY_PRESSED; | 284 | *state = REMOTE_KEY_PRESSED; |
203 | *event = ir_codes_vp702x_table[i].keycode; | 285 | *event = rc_map_vp702x_table[i].keycode; |
204 | break; | 286 | break; |
205 | } | 287 | } |
288 | kfree(key); | ||
206 | return 0; | 289 | return 0; |
207 | } | 290 | } |
208 | 291 | ||
209 | 292 | ||
210 | static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) | 293 | static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) |
211 | { | 294 | { |
212 | u8 i; | 295 | u8 i, *buf; |
296 | struct vp702x_device_state *st = d->priv; | ||
297 | |||
298 | mutex_lock(&st->buf_mutex); | ||
299 | buf = st->buf; | ||
213 | for (i = 6; i < 12; i++) | 300 | for (i = 6; i < 12; i++) |
214 | vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &mac[i - 6], 1); | 301 | vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1); |
302 | |||
303 | memcpy(mac, buf, 6); | ||
304 | mutex_unlock(&st->buf_mutex); | ||
215 | return 0; | 305 | return 0; |
216 | } | 306 | } |
217 | 307 | ||
@@ -221,7 +311,8 @@ static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) | |||
221 | 311 | ||
222 | vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0); | 312 | vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0); |
223 | 313 | ||
224 | if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0, buf, 10, 10)) | 314 | if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0, |
315 | buf, 10, 10)) | ||
225 | return -EIO; | 316 | return -EIO; |
226 | 317 | ||
227 | buf[9] = '\0'; | 318 | buf[9] = '\0'; |
@@ -240,8 +331,38 @@ static struct dvb_usb_device_properties vp702x_properties; | |||
240 | static int vp702x_usb_probe(struct usb_interface *intf, | 331 | static int vp702x_usb_probe(struct usb_interface *intf, |
241 | const struct usb_device_id *id) | 332 | const struct usb_device_id *id) |
242 | { | 333 | { |
243 | return dvb_usb_device_init(intf, &vp702x_properties, | 334 | struct dvb_usb_device *d; |
244 | THIS_MODULE, NULL, adapter_nr); | 335 | struct vp702x_device_state *st; |
336 | int ret; | ||
337 | |||
338 | ret = dvb_usb_device_init(intf, &vp702x_properties, | ||
339 | THIS_MODULE, &d, adapter_nr); | ||
340 | if (ret) | ||
341 | goto out; | ||
342 | |||
343 | st = d->priv; | ||
344 | st->buf_len = 16; | ||
345 | st->buf = kmalloc(st->buf_len, GFP_KERNEL); | ||
346 | if (!st->buf) { | ||
347 | ret = -ENOMEM; | ||
348 | dvb_usb_device_exit(intf); | ||
349 | goto out; | ||
350 | } | ||
351 | mutex_init(&st->buf_mutex); | ||
352 | |||
353 | out: | ||
354 | return ret; | ||
355 | |||
356 | } | ||
357 | |||
358 | static void vp702x_usb_disconnect(struct usb_interface *intf) | ||
359 | { | ||
360 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
361 | struct vp702x_device_state *st = d->priv; | ||
362 | mutex_lock(&st->buf_mutex); | ||
363 | kfree(st->buf); | ||
364 | mutex_unlock(&st->buf_mutex); | ||
365 | dvb_usb_device_exit(intf); | ||
245 | } | 366 | } |
246 | 367 | ||
247 | static struct usb_device_id vp702x_usb_table [] = { | 368 | static struct usb_device_id vp702x_usb_table [] = { |
@@ -278,14 +399,14 @@ static struct dvb_usb_device_properties vp702x_properties = { | |||
278 | } | 399 | } |
279 | } | 400 | } |
280 | }, | 401 | }, |
281 | .size_of_priv = sizeof(struct vp702x_state), | 402 | .size_of_priv = sizeof(struct vp702x_adapter_state), |
282 | } | 403 | } |
283 | }, | 404 | }, |
284 | .read_mac_address = vp702x_read_mac_addr, | 405 | .read_mac_address = vp702x_read_mac_addr, |
285 | 406 | ||
286 | .rc.legacy = { | 407 | .rc.legacy = { |
287 | .rc_key_map = ir_codes_vp702x_table, | 408 | .rc_map_table = rc_map_vp702x_table, |
288 | .rc_key_map_size = ARRAY_SIZE(ir_codes_vp702x_table), | 409 | .rc_map_size = ARRAY_SIZE(rc_map_vp702x_table), |
289 | .rc_interval = 400, | 410 | .rc_interval = 400, |
290 | .rc_query = vp702x_rc_query, | 411 | .rc_query = vp702x_rc_query, |
291 | }, | 412 | }, |
@@ -307,9 +428,9 @@ static struct dvb_usb_device_properties vp702x_properties = { | |||
307 | /* usb specific object needed to register this driver with the usb subsystem */ | 428 | /* usb specific object needed to register this driver with the usb subsystem */ |
308 | static struct usb_driver vp702x_usb_driver = { | 429 | static struct usb_driver vp702x_usb_driver = { |
309 | .name = "dvb_usb_vp702x", | 430 | .name = "dvb_usb_vp702x", |
310 | .probe = vp702x_usb_probe, | 431 | .probe = vp702x_usb_probe, |
311 | .disconnect = dvb_usb_device_exit, | 432 | .disconnect = vp702x_usb_disconnect, |
312 | .id_table = vp702x_usb_table, | 433 | .id_table = vp702x_usb_table, |
313 | }; | 434 | }; |
314 | 435 | ||
315 | /* module stuff */ | 436 | /* module stuff */ |
diff --git a/drivers/media/dvb/dvb-usb/vp702x.h b/drivers/media/dvb/dvb-usb/vp702x.h index c2f97f96c21f..20b90055e7ac 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.h +++ b/drivers/media/dvb/dvb-usb/vp702x.h | |||
@@ -98,6 +98,13 @@ extern int dvb_usb_vp702x_debug; | |||
98 | #define RESET_TUNER 0xBE | 98 | #define RESET_TUNER 0xBE |
99 | /* IN i: 0, v: 0, no extra buffer */ | 99 | /* IN i: 0, v: 0, no extra buffer */ |
100 | 100 | ||
101 | struct vp702x_device_state { | ||
102 | struct mutex buf_mutex; | ||
103 | int buf_len; | ||
104 | u8 *buf; | ||
105 | }; | ||
106 | |||
107 | |||
101 | extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); | 108 | extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); |
102 | 109 | ||
103 | extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); | 110 | extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); |
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index f13791ca5994..3db89e3cb0bb 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -28,9 +28,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
28 | int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec) | 28 | int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec) |
29 | { | 29 | { |
30 | int ret = 0; | 30 | int ret = 0; |
31 | u8 inbuf[12] = { 0 }, outbuf[20] = { 0 }; | 31 | u8 *buf = d->priv; |
32 | 32 | ||
33 | outbuf[0] = cmd; | 33 | buf[0] = cmd; |
34 | 34 | ||
35 | if (outlen > 19) | 35 | if (outlen > 19) |
36 | outlen = 19; | 36 | outlen = 19; |
@@ -38,19 +38,21 @@ int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, | |||
38 | if (inlen > 11) | 38 | if (inlen > 11) |
39 | inlen = 11; | 39 | inlen = 11; |
40 | 40 | ||
41 | ret = mutex_lock_interruptible(&d->usb_mutex); | ||
42 | if (ret) | ||
43 | return ret; | ||
44 | |||
41 | if (out != NULL && outlen > 0) | 45 | if (out != NULL && outlen > 0) |
42 | memcpy(&outbuf[1], out, outlen); | 46 | memcpy(&buf[1], out, outlen); |
43 | 47 | ||
44 | deb_xfer("out buffer: "); | 48 | deb_xfer("out buffer: "); |
45 | debug_dump(outbuf,outlen+1,deb_xfer); | 49 | debug_dump(buf, outlen+1, deb_xfer); |
46 | 50 | ||
47 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) | ||
48 | return ret; | ||
49 | 51 | ||
50 | if (usb_control_msg(d->udev, | 52 | if (usb_control_msg(d->udev, |
51 | usb_sndctrlpipe(d->udev,0), | 53 | usb_sndctrlpipe(d->udev,0), |
52 | TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, | 54 | TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, |
53 | outbuf, 20, 2000) != 20) { | 55 | buf, 20, 2000) != 20) { |
54 | err("USB control message 'out' went wrong."); | 56 | err("USB control message 'out' went wrong."); |
55 | ret = -EIO; | 57 | ret = -EIO; |
56 | goto unlock; | 58 | goto unlock; |
@@ -61,17 +63,17 @@ int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, | |||
61 | if (usb_control_msg(d->udev, | 63 | if (usb_control_msg(d->udev, |
62 | usb_rcvctrlpipe(d->udev,0), | 64 | usb_rcvctrlpipe(d->udev,0), |
63 | TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | 65 | TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
64 | inbuf, 12, 2000) != 12) { | 66 | buf, 12, 2000) != 12) { |
65 | err("USB control message 'in' went wrong."); | 67 | err("USB control message 'in' went wrong."); |
66 | ret = -EIO; | 68 | ret = -EIO; |
67 | goto unlock; | 69 | goto unlock; |
68 | } | 70 | } |
69 | 71 | ||
70 | deb_xfer("in buffer: "); | 72 | deb_xfer("in buffer: "); |
71 | debug_dump(inbuf,12,deb_xfer); | 73 | debug_dump(buf, 12, deb_xfer); |
72 | 74 | ||
73 | if (in != NULL && inlen > 0) | 75 | if (in != NULL && inlen > 0) |
74 | memcpy(in,&inbuf[1],inlen); | 76 | memcpy(in, &buf[1], inlen); |
75 | 77 | ||
76 | unlock: | 78 | unlock: |
77 | mutex_unlock(&d->usb_mutex); | 79 | mutex_unlock(&d->usb_mutex); |
@@ -99,7 +101,7 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
99 | 101 | ||
100 | /* The keymapping struct. Somehow this should be loaded to the driver, but | 102 | /* The keymapping struct. Somehow this should be loaded to the driver, but |
101 | * currently it is hardcoded. */ | 103 | * currently it is hardcoded. */ |
102 | static struct ir_scancode ir_codes_vp7045_table[] = { | 104 | static struct rc_map_table rc_map_vp7045_table[] = { |
103 | { 0x0016, KEY_POWER }, | 105 | { 0x0016, KEY_POWER }, |
104 | { 0x0010, KEY_MUTE }, | 106 | { 0x0010, KEY_MUTE }, |
105 | { 0x0003, KEY_1 }, | 107 | { 0x0003, KEY_1 }, |
@@ -165,10 +167,10 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
165 | return 0; | 167 | return 0; |
166 | } | 168 | } |
167 | 169 | ||
168 | for (i = 0; i < ARRAY_SIZE(ir_codes_vp7045_table); i++) | 170 | for (i = 0; i < ARRAY_SIZE(rc_map_vp7045_table); i++) |
169 | if (rc5_data(&ir_codes_vp7045_table[i]) == key) { | 171 | if (rc5_data(&rc_map_vp7045_table[i]) == key) { |
170 | *state = REMOTE_KEY_PRESSED; | 172 | *state = REMOTE_KEY_PRESSED; |
171 | *event = ir_codes_vp7045_table[i].keycode; | 173 | *event = rc_map_vp7045_table[i].keycode; |
172 | break; | 174 | break; |
173 | } | 175 | } |
174 | return 0; | 176 | return 0; |
@@ -222,8 +224,26 @@ static struct dvb_usb_device_properties vp7045_properties; | |||
222 | static int vp7045_usb_probe(struct usb_interface *intf, | 224 | static int vp7045_usb_probe(struct usb_interface *intf, |
223 | const struct usb_device_id *id) | 225 | const struct usb_device_id *id) |
224 | { | 226 | { |
225 | return dvb_usb_device_init(intf, &vp7045_properties, | 227 | struct dvb_usb_device *d; |
226 | THIS_MODULE, NULL, adapter_nr); | 228 | int ret = dvb_usb_device_init(intf, &vp7045_properties, |
229 | THIS_MODULE, &d, adapter_nr); | ||
230 | if (ret) | ||
231 | return ret; | ||
232 | |||
233 | d->priv = kmalloc(20, GFP_KERNEL); | ||
234 | if (!d->priv) { | ||
235 | dvb_usb_device_exit(intf); | ||
236 | return -ENOMEM; | ||
237 | } | ||
238 | |||
239 | return ret; | ||
240 | } | ||
241 | |||
242 | static void vp7045_usb_disconnect(struct usb_interface *intf) | ||
243 | { | ||
244 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
245 | kfree(d->priv); | ||
246 | dvb_usb_device_exit(intf); | ||
227 | } | 247 | } |
228 | 248 | ||
229 | static struct usb_device_id vp7045_usb_table [] = { | 249 | static struct usb_device_id vp7045_usb_table [] = { |
@@ -238,6 +258,7 @@ MODULE_DEVICE_TABLE(usb, vp7045_usb_table); | |||
238 | static struct dvb_usb_device_properties vp7045_properties = { | 258 | static struct dvb_usb_device_properties vp7045_properties = { |
239 | .usb_ctrl = CYPRESS_FX2, | 259 | .usb_ctrl = CYPRESS_FX2, |
240 | .firmware = "dvb-usb-vp7045-01.fw", | 260 | .firmware = "dvb-usb-vp7045-01.fw", |
261 | .size_of_priv = sizeof(u8 *), | ||
241 | 262 | ||
242 | .num_adapters = 1, | 263 | .num_adapters = 1, |
243 | .adapter = { | 264 | .adapter = { |
@@ -261,8 +282,8 @@ static struct dvb_usb_device_properties vp7045_properties = { | |||
261 | 282 | ||
262 | .rc.legacy = { | 283 | .rc.legacy = { |
263 | .rc_interval = 400, | 284 | .rc_interval = 400, |
264 | .rc_key_map = ir_codes_vp7045_table, | 285 | .rc_map_table = rc_map_vp7045_table, |
265 | .rc_key_map_size = ARRAY_SIZE(ir_codes_vp7045_table), | 286 | .rc_map_size = ARRAY_SIZE(rc_map_vp7045_table), |
266 | .rc_query = vp7045_rc_query, | 287 | .rc_query = vp7045_rc_query, |
267 | }, | 288 | }, |
268 | 289 | ||
@@ -284,7 +305,7 @@ static struct dvb_usb_device_properties vp7045_properties = { | |||
284 | static struct usb_driver vp7045_usb_driver = { | 305 | static struct usb_driver vp7045_usb_driver = { |
285 | .name = "dvb_usb_vp7045", | 306 | .name = "dvb_usb_vp7045", |
286 | .probe = vp7045_usb_probe, | 307 | .probe = vp7045_usb_probe, |
287 | .disconnect = dvb_usb_device_exit, | 308 | .disconnect = vp7045_usb_disconnect, |
288 | .id_table = vp7045_usb_table, | 309 | .id_table = vp7045_usb_table, |
289 | }; | 310 | }; |
290 | 311 | ||