Commit | Line | Data |
---|---|---|
6d4e6972 US |
1 | /**************************************************************** |
2 | ||
3 | Siano Mobile Silicon, Inc. | |
4 | MDTV receiver kernel modules. | |
5 | Copyright (C) 2005-2009, Uri Shkolnik, Anatoly Greenblat | |
6 | ||
7 | This program is free software: you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation, either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | ****************************************************************/ | |
8d4f9d0e | 21 | |
2e5c1ec8 MK |
22 | #include <linux/kernel.h> |
23 | #include <linux/init.h> | |
2e5c1ec8 MK |
24 | #include <linux/usb.h> |
25 | #include <linux/firmware.h> | |
26 | ||
2e5c1ec8 | 27 | #include "smscoreapi.h" |
1c11d546 | 28 | #include "sms-cards.h" |
c7ce8d37 | 29 | #include "smsendian.h" |
2e5c1ec8 | 30 | |
0d02efe4 MK |
31 | static int sms_dbg; |
32 | module_param_named(debug, sms_dbg, int, 0644); | |
33 | MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))"); | |
34 | ||
2e5c1ec8 MK |
35 | #define USB1_BUFFER_SIZE 0x1000 |
36 | #define USB2_BUFFER_SIZE 0x4000 | |
37 | ||
38 | #define MAX_BUFFERS 50 | |
39 | #define MAX_URBS 10 | |
40 | ||
18245e18 | 41 | struct smsusb_device_t; |
2e5c1ec8 | 42 | |
18245e18 MK |
43 | struct smsusb_urb_t { |
44 | struct smscore_buffer_t *cb; | |
45 | struct smsusb_device_t *dev; | |
2e5c1ec8 | 46 | |
18245e18 MK |
47 | struct urb urb; |
48 | }; | |
2e5c1ec8 | 49 | |
18245e18 | 50 | struct smsusb_device_t { |
a83ccdd6 | 51 | struct usb_device *udev; |
18245e18 | 52 | struct smscore_device_t *coredev; |
2e5c1ec8 | 53 | |
18245e18 | 54 | struct smsusb_urb_t surbs[MAX_URBS]; |
2e5c1ec8 | 55 | |
82237416 MK |
56 | int response_alignment; |
57 | int buffer_size; | |
18245e18 | 58 | }; |
2e5c1ec8 | 59 | |
0c071f37 MK |
60 | static int smsusb_submit_urb(struct smsusb_device_t *dev, |
61 | struct smsusb_urb_t *surb); | |
2e5c1ec8 | 62 | |
0c071f37 | 63 | static void smsusb_onresponse(struct urb *urb) |
2e5c1ec8 | 64 | { |
18245e18 MK |
65 | struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context; |
66 | struct smsusb_device_t *dev = surb->dev; | |
2e5c1ec8 | 67 | |
8f12d0a4 US |
68 | if (urb->status == -ESHUTDOWN) { |
69 | sms_err("error, urb status %d (-ESHUTDOWN), %d bytes", | |
eb250942 | 70 | urb->status, urb->actual_length); |
2e5c1ec8 MK |
71 | return; |
72 | } | |
73 | ||
8f12d0a4 US |
74 | if ((urb->actual_length > 0) && (urb->status == 0)) { |
75 | struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)surb->cb->p; | |
2e5c1ec8 | 76 | |
9c9c68a8 | 77 | smsendian_handle_message_header(phdr); |
82237416 | 78 | if (urb->actual_length >= phdr->msgLength) { |
2e5c1ec8 MK |
79 | surb->cb->size = phdr->msgLength; |
80 | ||
82237416 MK |
81 | if (dev->response_alignment && |
82 | (phdr->msgFlags & MSG_HDR_FLAG_SPLIT_MSG)) { | |
83 | ||
84 | surb->cb->offset = | |
85 | dev->response_alignment + | |
86 | ((phdr->msgFlags >> 8) & 3); | |
87 | ||
88 | /* sanity check */ | |
89 | if (((int) phdr->msgLength + | |
90 | surb->cb->offset) > urb->actual_length) { | |
eb250942 MK |
91 | sms_err("invalid response " |
92 | "msglen %d offset %d " | |
93 | "size %d", | |
94 | phdr->msgLength, | |
95 | surb->cb->offset, | |
96 | urb->actual_length); | |
2e5c1ec8 MK |
97 | goto exit_and_resubmit; |
98 | } | |
99 | ||
82237416 MK |
100 | /* move buffer pointer and |
101 | * copy header to its new location */ | |
55ad310c | 102 | memcpy((char *) phdr + surb->cb->offset, |
18245e18 | 103 | phdr, sizeof(struct SmsMsgHdr_ST)); |
82237416 | 104 | } else |
2e5c1ec8 MK |
105 | surb->cb->offset = 0; |
106 | ||
107 | smscore_onresponse(dev->coredev, surb->cb); | |
108 | surb->cb = NULL; | |
82237416 | 109 | } else { |
eb250942 MK |
110 | sms_err("invalid response " |
111 | "msglen %d actual %d", | |
112 | phdr->msgLength, urb->actual_length); | |
2e5c1ec8 | 113 | } |
8f12d0a4 US |
114 | } else |
115 | sms_err("error, urb status %d, %d bytes", | |
116 | urb->status, urb->actual_length); | |
117 | ||
2e5c1ec8 MK |
118 | |
119 | exit_and_resubmit: | |
120 | smsusb_submit_urb(dev, surb); | |
121 | } | |
122 | ||
0c071f37 MK |
123 | static int smsusb_submit_urb(struct smsusb_device_t *dev, |
124 | struct smsusb_urb_t *surb) | |
2e5c1ec8 | 125 | { |
82237416 | 126 | if (!surb->cb) { |
2e5c1ec8 | 127 | surb->cb = smscore_getbuffer(dev->coredev); |
82237416 | 128 | if (!surb->cb) { |
eb250942 | 129 | sms_err("smscore_getbuffer(...) returned NULL"); |
2e5c1ec8 MK |
130 | return -ENOMEM; |
131 | } | |
132 | } | |
133 | ||
134 | usb_fill_bulk_urb( | |
135 | &surb->urb, | |
136 | dev->udev, | |
137 | usb_rcvbulkpipe(dev->udev, 0x81), | |
138 | surb->cb->p, | |
139 | dev->buffer_size, | |
140 | smsusb_onresponse, | |
141 | surb | |
142 | ); | |
143 | surb->urb.transfer_dma = surb->cb->phys; | |
144 | surb->urb.transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | |
145 | ||
146 | return usb_submit_urb(&surb->urb, GFP_ATOMIC); | |
147 | } | |
148 | ||
0c071f37 | 149 | static void smsusb_stop_streaming(struct smsusb_device_t *dev) |
2e5c1ec8 MK |
150 | { |
151 | int i; | |
152 | ||
fa830e8a | 153 | for (i = 0; i < MAX_URBS; i++) { |
2e5c1ec8 MK |
154 | usb_kill_urb(&dev->surbs[i].urb); |
155 | ||
82237416 | 156 | if (dev->surbs[i].cb) { |
2e5c1ec8 MK |
157 | smscore_putbuffer(dev->coredev, dev->surbs[i].cb); |
158 | dev->surbs[i].cb = NULL; | |
159 | } | |
160 | } | |
161 | } | |
162 | ||
0c071f37 | 163 | static int smsusb_start_streaming(struct smsusb_device_t *dev) |
2e5c1ec8 MK |
164 | { |
165 | int i, rc; | |
166 | ||
fa830e8a | 167 | for (i = 0; i < MAX_URBS; i++) { |
2e5c1ec8 | 168 | rc = smsusb_submit_urb(dev, &dev->surbs[i]); |
82237416 | 169 | if (rc < 0) { |
eb250942 | 170 | sms_err("smsusb_submit_urb(...) failed"); |
2e5c1ec8 MK |
171 | smsusb_stop_streaming(dev); |
172 | break; | |
173 | } | |
174 | } | |
175 | ||
176 | return rc; | |
177 | } | |
178 | ||
0c071f37 | 179 | static int smsusb_sendrequest(void *context, void *buffer, size_t size) |
2e5c1ec8 | 180 | { |
18245e18 | 181 | struct smsusb_device_t *dev = (struct smsusb_device_t *) context; |
2e5c1ec8 MK |
182 | int dummy; |
183 | ||
c7ce8d37 | 184 | smsendian_handle_message_header((struct SmsMsgHdr_ST *)buffer); |
82237416 MK |
185 | return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), |
186 | buffer, size, &dummy, 1000); | |
2e5c1ec8 MK |
187 | } |
188 | ||
0c071f37 | 189 | static char *smsusb1_fw_lkup[] = { |
2e5c1ec8 MK |
190 | "dvbt_stellar_usb.inp", |
191 | "dvbh_stellar_usb.inp", | |
192 | "tdmb_stellar_usb.inp", | |
193 | "none", | |
194 | "dvbt_bda_stellar_usb.inp", | |
195 | }; | |
196 | ||
1fbc3caf MK |
197 | static inline char *sms_get_fw_name(int mode, int board_id) |
198 | { | |
199 | char **fw = sms_get_board(board_id)->fw; | |
200 | return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode]; | |
201 | } | |
202 | ||
203 | static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id) | |
2e5c1ec8 MK |
204 | { |
205 | const struct firmware *fw; | |
a83ccdd6 | 206 | u8 *fw_buffer; |
2e5c1ec8 | 207 | int rc, dummy; |
1fbc3caf | 208 | char *fw_filename; |
2e5c1ec8 | 209 | |
82237416 | 210 | if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { |
eb250942 | 211 | sms_err("invalid firmware id specified %d", id); |
2e5c1ec8 MK |
212 | return -EINVAL; |
213 | } | |
214 | ||
1fbc3caf MK |
215 | fw_filename = sms_get_fw_name(id, board_id); |
216 | ||
217 | rc = request_firmware(&fw, fw_filename, &udev->dev); | |
82237416 | 218 | if (rc < 0) { |
1fbc3caf MK |
219 | sms_warn("failed to open \"%s\" mode %d, " |
220 | "trying again with default firmware", fw_filename, id); | |
221 | ||
222 | fw_filename = smsusb1_fw_lkup[id]; | |
223 | rc = request_firmware(&fw, fw_filename, &udev->dev); | |
224 | if (rc < 0) { | |
225 | sms_warn("failed to open \"%s\" mode %d", | |
226 | fw_filename, id); | |
227 | ||
228 | return rc; | |
229 | } | |
2e5c1ec8 MK |
230 | } |
231 | ||
232 | fw_buffer = kmalloc(fw->size, GFP_KERNEL); | |
82237416 | 233 | if (fw_buffer) { |
2e5c1ec8 MK |
234 | memcpy(fw_buffer, fw->data, fw->size); |
235 | ||
82237416 MK |
236 | rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), |
237 | fw_buffer, fw->size, &dummy, 1000); | |
2e5c1ec8 | 238 | |
0f2a1ee1 | 239 | sms_info("sent %zd(%d) bytes, rc %d", fw->size, dummy, rc); |
2e5c1ec8 MK |
240 | |
241 | kfree(fw_buffer); | |
82237416 | 242 | } else { |
eb250942 | 243 | sms_err("failed to allocate firmware buffer"); |
2e5c1ec8 MK |
244 | rc = -ENOMEM; |
245 | } | |
1fbc3caf | 246 | sms_info("read FW %s, size=%zd", fw_filename, fw->size); |
2e5c1ec8 MK |
247 | |
248 | release_firmware(fw); | |
249 | ||
250 | return rc; | |
251 | } | |
252 | ||
0c071f37 | 253 | static void smsusb1_detectmode(void *context, int *mode) |
2e5c1ec8 | 254 | { |
18245e18 MK |
255 | char *product_string = |
256 | ((struct smsusb_device_t *) context)->udev->product; | |
2e5c1ec8 MK |
257 | |
258 | *mode = DEVICE_MODE_NONE; | |
259 | ||
82237416 | 260 | if (!product_string) { |
2e5c1ec8 | 261 | product_string = "none"; |
a0c0abcb | 262 | sms_err("product string not found"); |
82237416 MK |
263 | } else if (strstr(product_string, "DVBH")) |
264 | *mode = 1; | |
265 | else if (strstr(product_string, "BDA")) | |
266 | *mode = 4; | |
267 | else if (strstr(product_string, "DVBT")) | |
268 | *mode = 0; | |
269 | else if (strstr(product_string, "TDMB")) | |
270 | *mode = 2; | |
2e5c1ec8 | 271 | |
a0c0abcb | 272 | sms_info("%d \"%s\"", *mode, product_string); |
2e5c1ec8 MK |
273 | } |
274 | ||
0c071f37 | 275 | static int smsusb1_setmode(void *context, int mode) |
2e5c1ec8 | 276 | { |
18245e18 MK |
277 | struct SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, |
278 | sizeof(struct SmsMsgHdr_ST), 0 }; | |
2e5c1ec8 | 279 | |
82237416 | 280 | if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { |
eb250942 | 281 | sms_err("invalid firmware id specified %d", mode); |
2e5c1ec8 MK |
282 | return -EINVAL; |
283 | } | |
284 | ||
285 | return smsusb_sendrequest(context, &Msg, sizeof(Msg)); | |
286 | } | |
287 | ||
0c071f37 | 288 | static void smsusb_term_device(struct usb_interface *intf) |
2e5c1ec8 | 289 | { |
18245e18 MK |
290 | struct smsusb_device_t *dev = |
291 | (struct smsusb_device_t *) usb_get_intfdata(intf); | |
2e5c1ec8 | 292 | |
82237416 | 293 | if (dev) { |
2e5c1ec8 MK |
294 | smsusb_stop_streaming(dev); |
295 | ||
fa830e8a | 296 | /* unregister from smscore */ |
2e5c1ec8 MK |
297 | if (dev->coredev) |
298 | smscore_unregister_device(dev->coredev); | |
299 | ||
300 | kfree(dev); | |
301 | ||
a0c0abcb | 302 | sms_info("device %p destroyed", dev); |
2e5c1ec8 MK |
303 | } |
304 | ||
305 | usb_set_intfdata(intf, NULL); | |
306 | } | |
307 | ||
0c071f37 | 308 | static int smsusb_init_device(struct usb_interface *intf, int board_id) |
2e5c1ec8 | 309 | { |
18245e18 MK |
310 | struct smsdevice_params_t params; |
311 | struct smsusb_device_t *dev; | |
2e5c1ec8 MK |
312 | int i, rc; |
313 | ||
fa830e8a | 314 | /* create device object */ |
18245e18 | 315 | dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); |
82237416 | 316 | if (!dev) { |
eb250942 | 317 | sms_err("kzalloc(sizeof(struct smsusb_device_t) failed"); |
2e5c1ec8 MK |
318 | return -ENOMEM; |
319 | } | |
320 | ||
321 | memset(¶ms, 0, sizeof(params)); | |
322 | usb_set_intfdata(intf, dev); | |
323 | dev->udev = interface_to_usbdev(intf); | |
324 | ||
2708e888 | 325 | params.device_type = sms_get_board(board_id)->type; |
73104fb3 | 326 | |
2708e888 | 327 | switch (params.device_type) { |
1c11d546 | 328 | case SMS_STELLAR: |
f17407a8 MK |
329 | dev->buffer_size = USB1_BUFFER_SIZE; |
330 | ||
331 | params.setmode_handler = smsusb1_setmode; | |
332 | params.detectmode_handler = smsusb1_detectmode; | |
f17407a8 MK |
333 | break; |
334 | default: | |
2708e888 MK |
335 | sms_err("Unspecified sms device type!"); |
336 | /* fall-thru */ | |
337 | case SMS_NOVA_A0: | |
338 | case SMS_NOVA_B0: | |
339 | case SMS_VEGA: | |
f17407a8 | 340 | dev->buffer_size = USB2_BUFFER_SIZE; |
82237416 | 341 | dev->response_alignment = |
c7ce8d37 US |
342 | le16_to_cpu(dev->udev->ep_in[1]->desc.wMaxPacketSize) - |
343 | sizeof(struct SmsMsgHdr_ST); | |
2e5c1ec8 | 344 | |
f17407a8 MK |
345 | params.flags |= SMS_DEVICE_FAMILY2; |
346 | break; | |
2e5c1ec8 MK |
347 | } |
348 | ||
349 | params.device = &dev->udev->dev; | |
350 | params.buffer_size = dev->buffer_size; | |
351 | params.num_buffers = MAX_BUFFERS; | |
352 | params.sendrequest_handler = smsusb_sendrequest; | |
353 | params.context = dev; | |
82237416 MK |
354 | snprintf(params.devpath, sizeof(params.devpath), |
355 | "usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath); | |
2e5c1ec8 | 356 | |
82237416 | 357 | /* register in smscore */ |
2e5c1ec8 | 358 | rc = smscore_register_device(¶ms, &dev->coredev); |
82237416 | 359 | if (rc < 0) { |
eb250942 | 360 | sms_err("smscore_register_device(...) failed, rc %d", rc); |
2e5c1ec8 MK |
361 | smsusb_term_device(intf); |
362 | return rc; | |
363 | } | |
364 | ||
1c11d546 MK |
365 | smscore_set_board_id(dev->coredev, board_id); |
366 | ||
fa830e8a | 367 | /* initialize urbs */ |
82237416 | 368 | for (i = 0; i < MAX_URBS; i++) { |
2e5c1ec8 MK |
369 | dev->surbs[i].dev = dev; |
370 | usb_init_urb(&dev->surbs[i].urb); | |
371 | } | |
372 | ||
a0c0abcb | 373 | sms_info("smsusb_start_streaming(...)."); |
2e5c1ec8 | 374 | rc = smsusb_start_streaming(dev); |
82237416 | 375 | if (rc < 0) { |
eb250942 | 376 | sms_err("smsusb_start_streaming(...) failed"); |
2e5c1ec8 MK |
377 | smsusb_term_device(intf); |
378 | return rc; | |
379 | } | |
380 | ||
381 | rc = smscore_start_device(dev->coredev); | |
82237416 | 382 | if (rc < 0) { |
eb250942 | 383 | sms_err("smscore_start_device(...) failed"); |
2e5c1ec8 MK |
384 | smsusb_term_device(intf); |
385 | return rc; | |
386 | } | |
387 | ||
a0c0abcb | 388 | sms_info("device %p created", dev); |
2e5c1ec8 MK |
389 | |
390 | return rc; | |
391 | } | |
392 | ||
0c071f37 MK |
393 | static int smsusb_probe(struct usb_interface *intf, |
394 | const struct usb_device_id *id) | |
2e5c1ec8 MK |
395 | { |
396 | struct usb_device *udev = interface_to_usbdev(intf); | |
397 | char devpath[32]; | |
398 | int i, rc; | |
399 | ||
f17407a8 MK |
400 | rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x81)); |
401 | rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x02)); | |
402 | ||
82237416 | 403 | if (intf->num_altsetting > 0) { |
59bf6b8e MK |
404 | rc = usb_set_interface( |
405 | udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); | |
82237416 | 406 | if (rc < 0) { |
eb250942 | 407 | sms_err("usb_set_interface failed, rc %d", rc); |
2e5c1ec8 MK |
408 | return rc; |
409 | } | |
410 | } | |
411 | ||
a0c0abcb | 412 | sms_info("smsusb_probe %d", |
82237416 | 413 | intf->cur_altsetting->desc.bInterfaceNumber); |
fa830e8a | 414 | for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) |
a0c0abcb | 415 | sms_info("endpoint %d %02x %02x %d", i, |
82237416 MK |
416 | intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, |
417 | intf->cur_altsetting->endpoint[i].desc.bmAttributes, | |
418 | intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); | |
2e5c1ec8 | 419 | |
82237416 MK |
420 | if ((udev->actconfig->desc.bNumInterfaces == 2) && |
421 | (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { | |
eb250942 | 422 | sms_err("rom interface 0 is not used"); |
2e5c1ec8 MK |
423 | return -ENODEV; |
424 | } | |
425 | ||
82237416 MK |
426 | if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { |
427 | snprintf(devpath, sizeof(devpath), "usb\\%d-%s", | |
428 | udev->bus->busnum, udev->devpath); | |
a0c0abcb | 429 | sms_info("stellar device was found."); |
59bf6b8e | 430 | return smsusb1_load_firmware( |
1fbc3caf MK |
431 | udev, smscore_registry_getmode(devpath), |
432 | id->driver_info); | |
2e5c1ec8 MK |
433 | } |
434 | ||
1c11d546 | 435 | rc = smsusb_init_device(intf, id->driver_info); |
a0c0abcb | 436 | sms_info("rc %d", rc); |
05860f2d | 437 | sms_board_load_modules(id->driver_info); |
f17407a8 | 438 | return rc; |
2e5c1ec8 MK |
439 | } |
440 | ||
0c071f37 | 441 | static void smsusb_disconnect(struct usb_interface *intf) |
2e5c1ec8 MK |
442 | { |
443 | smsusb_term_device(intf); | |
444 | } | |
445 | ||
2f56c34b US |
446 | static int smsusb_suspend(struct usb_interface *intf, pm_message_t msg) |
447 | { | |
448 | struct smsusb_device_t *dev = | |
449 | (struct smsusb_device_t *)usb_get_intfdata(intf); | |
b9391f41 | 450 | printk(KERN_INFO "%s: Entering status %d.\n", __func__, msg.event); |
2f56c34b US |
451 | smsusb_stop_streaming(dev); |
452 | return 0; | |
453 | } | |
454 | ||
455 | static int smsusb_resume(struct usb_interface *intf) | |
456 | { | |
457 | int rc, i; | |
458 | struct smsusb_device_t *dev = | |
459 | (struct smsusb_device_t *)usb_get_intfdata(intf); | |
460 | struct usb_device *udev = interface_to_usbdev(intf); | |
461 | ||
b9391f41 | 462 | printk(KERN_INFO "%s: Entering.\n", __func__); |
2f56c34b US |
463 | usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x81)); |
464 | usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x02)); | |
465 | ||
466 | for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) | |
467 | printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, | |
468 | intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, | |
469 | intf->cur_altsetting->endpoint[i].desc.bmAttributes, | |
470 | intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); | |
471 | ||
472 | if (intf->num_altsetting > 0) { | |
473 | rc = usb_set_interface(udev, | |
474 | intf->cur_altsetting->desc. | |
475 | bInterfaceNumber, 0); | |
476 | if (rc < 0) { | |
b9391f41 MK |
477 | printk(KERN_INFO "%s usb_set_interface failed, " |
478 | "rc %d\n", __func__, rc); | |
2f56c34b US |
479 | return rc; |
480 | } | |
481 | } | |
482 | ||
483 | smsusb_start_streaming(dev); | |
484 | return 0; | |
485 | } | |
486 | ||
841a3f0d | 487 | struct usb_device_id smsusb_id_table[] = { |
841a3f0d MK |
488 | { USB_DEVICE(0x187f, 0x0010), |
489 | .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, | |
490 | { USB_DEVICE(0x187f, 0x0100), | |
491 | .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, | |
492 | { USB_DEVICE(0x187f, 0x0200), | |
493 | .driver_info = SMS1XXX_BOARD_SIANO_NOVA_A }, | |
494 | { USB_DEVICE(0x187f, 0x0201), | |
495 | .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B }, | |
496 | { USB_DEVICE(0x187f, 0x0300), | |
497 | .driver_info = SMS1XXX_BOARD_SIANO_VEGA }, | |
841a3f0d MK |
498 | { USB_DEVICE(0x2040, 0x1700), |
499 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT }, | |
500 | { USB_DEVICE(0x2040, 0x1800), | |
501 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A }, | |
502 | { USB_DEVICE(0x2040, 0x1801), | |
503 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B }, | |
504 | { USB_DEVICE(0x2040, 0x2000), | |
505 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, | |
506 | { USB_DEVICE(0x2040, 0x2009), | |
507 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 }, | |
508 | { USB_DEVICE(0x2040, 0x200a), | |
509 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, | |
510 | { USB_DEVICE(0x2040, 0x2010), | |
511 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, | |
512 | { USB_DEVICE(0x2040, 0x2011), | |
513 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, | |
514 | { USB_DEVICE(0x2040, 0x2019), | |
515 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, | |
516 | { USB_DEVICE(0x2040, 0x5500), | |
517 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
518 | { USB_DEVICE(0x2040, 0x5510), | |
519 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
520 | { USB_DEVICE(0x2040, 0x5520), | |
521 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
522 | { USB_DEVICE(0x2040, 0x5530), | |
523 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
524 | { USB_DEVICE(0x2040, 0x5580), | |
525 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
526 | { USB_DEVICE(0x2040, 0x5590), | |
527 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
d0b66180 US |
528 | { USB_DEVICE(0x187f, 0x0202), |
529 | .driver_info = SMS1XXX_BOARD_SIANO_NICE }, | |
530 | { USB_DEVICE(0x187f, 0x0301), | |
531 | .driver_info = SMS1XXX_BOARD_SIANO_VENICE }, | |
78c948ab MK |
532 | { USB_DEVICE(0x2040, 0xb900), |
533 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
534 | { USB_DEVICE(0x2040, 0xb910), | |
535 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
536 | { USB_DEVICE(0x2040, 0xc000), | |
537 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | |
d0b66180 US |
538 | { } /* Terminating entry */ |
539 | }; | |
540 | ||
841a3f0d MK |
541 | MODULE_DEVICE_TABLE(usb, smsusb_id_table); |
542 | ||
2e5c1ec8 | 543 | static struct usb_driver smsusb_driver = { |
dba843af | 544 | .name = "smsusb", |
2e5c1ec8 | 545 | .probe = smsusb_probe, |
82237416 | 546 | .disconnect = smsusb_disconnect, |
2e5c1ec8 | 547 | .id_table = smsusb_id_table, |
2f56c34b US |
548 | |
549 | .suspend = smsusb_suspend, | |
550 | .resume = smsusb_resume, | |
2e5c1ec8 MK |
551 | }; |
552 | ||
e0f14c25 | 553 | int smsusb_module_init(void) |
2e5c1ec8 MK |
554 | { |
555 | int rc = usb_register(&smsusb_driver); | |
556 | if (rc) | |
eb250942 | 557 | sms_err("usb_register failed. Error number %d", rc); |
2e5c1ec8 | 558 | |
a0c0abcb | 559 | sms_debug(""); |
2e5c1ec8 MK |
560 | |
561 | return rc; | |
562 | } | |
563 | ||
e0f14c25 | 564 | void smsusb_module_exit(void) |
2e5c1ec8 | 565 | { |
3dd24378 | 566 | /* Regular USB Cleanup */ |
2e5c1ec8 | 567 | usb_deregister(&smsusb_driver); |
bebfa762 | 568 | sms_info("end"); |
2e5c1ec8 MK |
569 | } |
570 | ||
e0f14c25 US |
571 | module_init(smsusb_module_init); |
572 | module_exit(smsusb_module_exit); | |
573 | ||
05a07376 | 574 | MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle"); |
e0f14c25 US |
575 | MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)"); |
576 | MODULE_LICENSE("GPL"); |