aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dtt200u.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2005-07-07 20:58:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:24:03 -0400
commitd590f9c20e15620ba708e5bd71d345bf1b7b0d73 (patch)
tree938e37de3c945d3fb035f487a802ae574aa599a8 /drivers/media/dvb/dvb-usb/dtt200u.c
parent4b2bd30eb79c292a83b1dfd3cca6d435c02fd5c0 (diff)
[PATCH] dvb: usb: add supprt for WideView WT-220U
Add support and rewrote some parts with the help of vendor information (Thanks to Steve Chang from WideView, Inc.): o added support for the WT-220U (Pensize DVB-T receiver) o corrected byte order for unc,ber and the pid filter o corrected number of pids that can be fetched at the same time. o added some comments in Kconfig-file o added USB IDs for the WT-220U Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dtt200u.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c86
1 files changed, 74 insertions, 12 deletions
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index 1ebd3eff96d1..47dba6e45968 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
5 * 5 *
6 * Thanks to Steve Chang from WideView for providing support for the WT-220U.
7 *
6 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free 9 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation, version 2. 10 * Software Foundation, version 2.
@@ -16,14 +18,24 @@ int dvb_usb_dtt200u_debug;
16module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); 18module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
17MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); 19MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
18 20
21static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
22{
23 u8 b = SET_INIT;
24
25 if (onoff)
26 dvb_usb_generic_write(d,&b,2);
27
28 return 0;
29}
30
19static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff) 31static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff)
20{ 32{
21 u8 b_streaming[2] = { SET_TS_CTRL, onoff }; 33 u8 b_streaming[2] = { SET_STREAMING, onoff };
22 u8 b_rst_pid = RESET_PID_FILTER; 34 u8 b_rst_pid = RESET_PID_FILTER;
23 35
24 dvb_usb_generic_write(d,b_streaming,2); 36 dvb_usb_generic_write(d,b_streaming,2);
25 37
26 if (!onoff) 38 if (onoff == 0)
27 dvb_usb_generic_write(d,&b_rst_pid,1); 39 dvb_usb_generic_write(d,&b_rst_pid,1);
28 return 0; 40 return 0;
29} 41}
@@ -36,7 +48,7 @@ static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int
36 b_pid[0] = SET_PID_FILTER; 48 b_pid[0] = SET_PID_FILTER;
37 b_pid[1] = index; 49 b_pid[1] = index;
38 b_pid[2] = pid & 0xff; 50 b_pid[2] = pid & 0xff;
39 b_pid[3] = (pid >> 8) & 0xff; 51 b_pid[3] = (pid >> 8) & 0x1f;
40 52
41 return dvb_usb_generic_write(d,b_pid,4); 53 return dvb_usb_generic_write(d,b_pid,4);
42} 54}
@@ -54,9 +66,9 @@ static struct dvb_usb_rc_key dtt200u_rc_keys[] = {
54 { 0x80, 0x08, KEY_5 }, 66 { 0x80, 0x08, KEY_5 },
55 { 0x80, 0x09, KEY_6 }, 67 { 0x80, 0x09, KEY_6 },
56 { 0x80, 0x0a, KEY_7 }, 68 { 0x80, 0x0a, KEY_7 },
57 { 0x00, 0x0c, KEY_ZOOM }, 69 { 0x80, 0x0c, KEY_ZOOM },
58 { 0x80, 0x0d, KEY_0 }, 70 { 0x80, 0x0d, KEY_0 },
59 { 0x00, 0x0e, KEY_SELECT }, 71 { 0x80, 0x0e, KEY_SELECT },
60 { 0x80, 0x12, KEY_POWER }, 72 { 0x80, 0x12, KEY_POWER },
61 { 0x80, 0x1a, KEY_CHANNELUP }, 73 { 0x80, 0x1a, KEY_CHANNELUP },
62 { 0x80, 0x1b, KEY_8 }, 74 { 0x80, 0x1b, KEY_8 },
@@ -66,7 +78,7 @@ static struct dvb_usb_rc_key dtt200u_rc_keys[] = {
66 78
67static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 79static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
68{ 80{
69 u8 key[5],cmd = GET_RC_KEY; 81 u8 key[5],cmd = GET_RC_CODE;
70 dvb_usb_generic_rw(d,&cmd,1,key,5,0); 82 dvb_usb_generic_rw(d,&cmd,1,key,5,0);
71 dvb_usb_nec_rc_key_to_event(d,key,event,state); 83 dvb_usb_nec_rc_key_to_event(d,key,event,state);
72 if (key[0] != 0) 84 if (key[0] != 0)
@@ -81,32 +93,41 @@ static int dtt200u_frontend_attach(struct dvb_usb_device *d)
81} 93}
82 94
83static struct dvb_usb_properties dtt200u_properties; 95static struct dvb_usb_properties dtt200u_properties;
96static struct dvb_usb_properties wt220u_properties;
84 97
85static int dtt200u_usb_probe(struct usb_interface *intf, 98static int dtt200u_usb_probe(struct usb_interface *intf,
86 const struct usb_device_id *id) 99 const struct usb_device_id *id)
87{ 100{
88 return dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE); 101 if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE) == 0 ||
102 dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE) == 0)
103 return 0;
104
105 return -ENODEV;
89} 106}
90 107
91static struct usb_device_id dtt200u_usb_table [] = { 108static struct usb_device_id dtt200u_usb_table [] = {
109// { USB_DEVICE(0x04b4,0x8613) },
92 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) }, 110 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) },
93 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) }, 111 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) },
112 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) },
113 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) },
94 { 0 }, 114 { 0 },
95}; 115};
96MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); 116MODULE_DEVICE_TABLE(usb, dtt200u_usb_table);
97 117
98static struct dvb_usb_properties dtt200u_properties = { 118static struct dvb_usb_properties dtt200u_properties = {
99 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, 119 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
100 .pid_filter_count = 255, /* It is a guess, but there are at least 10 */ 120 .pid_filter_count = 15,
101 121
102 .usb_ctrl = CYPRESS_FX2, 122 .usb_ctrl = CYPRESS_FX2,
103 .firmware = "dvb-usb-dtt200u-01.fw", 123 .firmware = "dvb-usb-dtt200u-01.fw",
104 124
125 .power_ctrl = dtt200u_power_ctrl,
105 .streaming_ctrl = dtt200u_streaming_ctrl, 126 .streaming_ctrl = dtt200u_streaming_ctrl,
106 .pid_filter = dtt200u_pid_filter, 127 .pid_filter = dtt200u_pid_filter,
107 .frontend_attach = dtt200u_frontend_attach, 128 .frontend_attach = dtt200u_frontend_attach,
108 129
109 .rc_interval = 200, 130 .rc_interval = 300,
110 .rc_key_map = dtt200u_rc_keys, 131 .rc_key_map = dtt200u_rc_keys,
111 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), 132 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
112 .rc_query = dtt200u_rc_query, 133 .rc_query = dtt200u_rc_query,
@@ -127,7 +148,7 @@ static struct dvb_usb_properties dtt200u_properties = {
127 148
128 .num_device_descs = 1, 149 .num_device_descs = 1,
129 .devices = { 150 .devices = {
130 { .name = "WideView/Yakumo/Hama/Typhoon DVB-T USB2.0)", 151 { .name = "WideView/Yuan/Yakumo/Hama/Typhoon DVB-T USB2.0 (WT-200U)",
131 .cold_ids = { &dtt200u_usb_table[0], NULL }, 152 .cold_ids = { &dtt200u_usb_table[0], NULL },
132 .warm_ids = { &dtt200u_usb_table[1], NULL }, 153 .warm_ids = { &dtt200u_usb_table[1], NULL },
133 }, 154 },
@@ -135,10 +156,51 @@ static struct dvb_usb_properties dtt200u_properties = {
135 } 156 }
136}; 157};
137 158
159static struct dvb_usb_properties wt220u_properties = {
160 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
161 .pid_filter_count = 15,
162
163 .usb_ctrl = CYPRESS_FX2,
164 .firmware = "dvb-usb-wt220u-01.fw",
165
166 .power_ctrl = dtt200u_power_ctrl,
167 .streaming_ctrl = dtt200u_streaming_ctrl,
168 .pid_filter = dtt200u_pid_filter,
169 .frontend_attach = dtt200u_frontend_attach,
170
171 .rc_interval = 300,
172 .rc_key_map = dtt200u_rc_keys,
173 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
174 .rc_query = dtt200u_rc_query,
175
176 .generic_bulk_ctrl_endpoint = 0x01,
177
178 /* parameter for the MPEG2-data transfer */
179 .urb = {
180 .type = DVB_USB_BULK,
181 .count = 7,
182 .endpoint = 0x02,
183 .u = {
184 .bulk = {
185 .buffersize = 4096,
186 }
187 }
188 },
189
190 .num_device_descs = 1,
191 .devices = {
192 { .name = "WideView WT-220U PenType Receiver (and clones)",
193 .cold_ids = { &dtt200u_usb_table[2], NULL },
194 .warm_ids = { &dtt200u_usb_table[3], NULL },
195 },
196 { 0 },
197 }
198};
199
138/* usb specific object needed to register this driver with the usb subsystem */ 200/* usb specific object needed to register this driver with the usb subsystem */
139static struct usb_driver dtt200u_usb_driver = { 201static struct usb_driver dtt200u_usb_driver = {
140 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
141 .name = "dtt200u", 203 .name = "dvb_usb_dtt200u",
142 .probe = dtt200u_usb_probe, 204 .probe = dtt200u_usb_probe,
143 .disconnect = dvb_usb_device_exit, 205 .disconnect = dvb_usb_device_exit,
144 .id_table = dtt200u_usb_table, 206 .id_table = dtt200u_usb_table,
@@ -166,6 +228,6 @@ module_init(dtt200u_usb_module_init);
166module_exit(dtt200u_usb_module_exit); 228module_exit(dtt200u_usb_module_exit);
167 229
168MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 230MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
169MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon DVB-T USB2.0 device"); 231MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon DVB-T USB2.0 devices");
170MODULE_VERSION("1.0"); 232MODULE_VERSION("1.0");
171MODULE_LICENSE("GPL"); 233MODULE_LICENSE("GPL");