xref: /openbmc/linux/drivers/media/usb/siano/smsusb.c (revision 0c3df9ed)
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 ****************************************************************/
21 
22 #include "smscoreapi.h"
23 
24 #include <linux/kernel.h>
25 #include <linux/init.h>
26 #include <linux/usb.h>
27 #include <linux/firmware.h>
28 #include <linux/slab.h>
29 #include <linux/module.h>
30 #include <media/media-device.h>
31 
32 #include "sms-cards.h"
33 #include "smsendian.h"
34 
35 #define USB1_BUFFER_SIZE		0x1000
36 #define USB2_BUFFER_SIZE		0x2000
37 
38 #define MAX_BUFFERS		50
39 #define MAX_URBS		10
40 
41 struct smsusb_device_t;
42 
43 enum smsusb_state {
44 	SMSUSB_DISCONNECTED,
45 	SMSUSB_SUSPENDED,
46 	SMSUSB_ACTIVE
47 };
48 
49 struct smsusb_urb_t {
50 	struct list_head entry;
51 	struct smscore_buffer_t *cb;
52 	struct smsusb_device_t *dev;
53 
54 	struct urb urb;
55 
56 	/* For the bottom half */
57 	struct work_struct wq;
58 };
59 
60 struct smsusb_device_t {
61 	struct usb_device *udev;
62 	struct smscore_device_t *coredev;
63 
64 	struct smsusb_urb_t	surbs[MAX_URBS];
65 
66 	int		response_alignment;
67 	int		buffer_size;
68 
69 	unsigned char in_ep;
70 	unsigned char out_ep;
71 	enum smsusb_state state;
72 };
73 
74 static int smsusb_submit_urb(struct smsusb_device_t *dev,
75 			     struct smsusb_urb_t *surb);
76 
77 /*
78  * Completing URB's callback handler - bottom half (proccess context)
79  * submits the URB prepared on smsusb_onresponse()
80  */
81 static void do_submit_urb(struct work_struct *work)
82 {
83 	struct smsusb_urb_t *surb = container_of(work, struct smsusb_urb_t, wq);
84 	struct smsusb_device_t *dev = surb->dev;
85 
86 	smsusb_submit_urb(dev, surb);
87 }
88 
89 /*
90  * Completing URB's callback handler - top half (interrupt context)
91  * adds completing sms urb to the global surbs list and activtes the worker
92  * thread the surb
93  * IMPORTANT - blocking functions must not be called from here !!!
94 
95  * @param urb pointer to a completing urb object
96  */
97 static void smsusb_onresponse(struct urb *urb)
98 {
99 	struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context;
100 	struct smsusb_device_t *dev = surb->dev;
101 
102 	if (urb->status == -ESHUTDOWN) {
103 		pr_err("error, urb status %d (-ESHUTDOWN), %d bytes\n",
104 			urb->status, urb->actual_length);
105 		return;
106 	}
107 
108 	if ((urb->actual_length > 0) && (urb->status == 0)) {
109 		struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)surb->cb->p;
110 
111 		smsendian_handle_message_header(phdr);
112 		if (urb->actual_length >= phdr->msg_length) {
113 			surb->cb->size = phdr->msg_length;
114 
115 			if (dev->response_alignment &&
116 			    (phdr->msg_flags & MSG_HDR_FLAG_SPLIT_MSG)) {
117 
118 				surb->cb->offset =
119 					dev->response_alignment +
120 					((phdr->msg_flags >> 8) & 3);
121 
122 				/* sanity check */
123 				if (((int) phdr->msg_length +
124 				     surb->cb->offset) > urb->actual_length) {
125 					pr_err("invalid response msglen %d offset %d size %d\n",
126 						phdr->msg_length,
127 						surb->cb->offset,
128 						urb->actual_length);
129 					goto exit_and_resubmit;
130 				}
131 
132 				/* move buffer pointer and
133 				 * copy header to its new location */
134 				memcpy((char *) phdr + surb->cb->offset,
135 				       phdr, sizeof(struct sms_msg_hdr));
136 			} else
137 				surb->cb->offset = 0;
138 
139 			pr_debug("received %s(%d) size: %d\n",
140 				  smscore_translate_msg(phdr->msg_type),
141 				  phdr->msg_type, phdr->msg_length);
142 
143 			smsendian_handle_rx_message((struct sms_msg_data *) phdr);
144 
145 			smscore_onresponse(dev->coredev, surb->cb);
146 			surb->cb = NULL;
147 		} else {
148 			pr_err("invalid response msglen %d actual %d\n",
149 				phdr->msg_length, urb->actual_length);
150 		}
151 	} else
152 		pr_err("error, urb status %d, %d bytes\n",
153 			urb->status, urb->actual_length);
154 
155 
156 exit_and_resubmit:
157 	INIT_WORK(&surb->wq, do_submit_urb);
158 	schedule_work(&surb->wq);
159 }
160 
161 static int smsusb_submit_urb(struct smsusb_device_t *dev,
162 			     struct smsusb_urb_t *surb)
163 {
164 	if (!surb->cb) {
165 		/* This function can sleep */
166 		surb->cb = smscore_getbuffer(dev->coredev);
167 		if (!surb->cb) {
168 			pr_err("smscore_getbuffer(...) returned NULL\n");
169 			return -ENOMEM;
170 		}
171 	}
172 
173 	usb_fill_bulk_urb(
174 		&surb->urb,
175 		dev->udev,
176 		usb_rcvbulkpipe(dev->udev, dev->in_ep),
177 		surb->cb->p,
178 		dev->buffer_size,
179 		smsusb_onresponse,
180 		surb
181 	);
182 	surb->urb.transfer_flags |= URB_FREE_BUFFER;
183 
184 	return usb_submit_urb(&surb->urb, GFP_ATOMIC);
185 }
186 
187 static void smsusb_stop_streaming(struct smsusb_device_t *dev)
188 {
189 	int i;
190 
191 	for (i = 0; i < MAX_URBS; i++) {
192 		usb_kill_urb(&dev->surbs[i].urb);
193 
194 		if (dev->surbs[i].cb) {
195 			smscore_putbuffer(dev->coredev, dev->surbs[i].cb);
196 			dev->surbs[i].cb = NULL;
197 		}
198 	}
199 }
200 
201 static int smsusb_start_streaming(struct smsusb_device_t *dev)
202 {
203 	int i, rc;
204 
205 	for (i = 0; i < MAX_URBS; i++) {
206 		rc = smsusb_submit_urb(dev, &dev->surbs[i]);
207 		if (rc < 0) {
208 			pr_err("smsusb_submit_urb(...) failed\n");
209 			smsusb_stop_streaming(dev);
210 			break;
211 		}
212 	}
213 
214 	return rc;
215 }
216 
217 static int smsusb_sendrequest(void *context, void *buffer, size_t size)
218 {
219 	struct smsusb_device_t *dev = (struct smsusb_device_t *) context;
220 	struct sms_msg_hdr *phdr;
221 	int dummy, ret;
222 
223 	if (dev->state != SMSUSB_ACTIVE) {
224 		pr_debug("Device not active yet\n");
225 		return -ENOENT;
226 	}
227 
228 	phdr = kmemdup(buffer, size, GFP_KERNEL);
229 	if (!phdr)
230 		return -ENOMEM;
231 
232 	pr_debug("sending %s(%d) size: %d\n",
233 		  smscore_translate_msg(phdr->msg_type), phdr->msg_type,
234 		  phdr->msg_length);
235 
236 	smsendian_handle_tx_message((struct sms_msg_data *) phdr);
237 	smsendian_handle_message_header((struct sms_msg_hdr *)phdr);
238 	ret = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
239 			    phdr, size, &dummy, 1000);
240 
241 	kfree(phdr);
242 	return ret;
243 }
244 
245 static char *smsusb1_fw_lkup[] = {
246 	"dvbt_stellar_usb.inp",
247 	"dvbh_stellar_usb.inp",
248 	"tdmb_stellar_usb.inp",
249 	"none",
250 	"dvbt_bda_stellar_usb.inp",
251 };
252 
253 static inline char *sms_get_fw_name(int mode, int board_id)
254 {
255 	char **fw = sms_get_board(board_id)->fw;
256 	return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode];
257 }
258 
259 static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id)
260 {
261 	const struct firmware *fw;
262 	u8 *fw_buffer;
263 	int rc, dummy;
264 	char *fw_filename;
265 
266 	if (id < 0)
267 		id = sms_get_board(board_id)->default_mode;
268 
269 	if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) {
270 		pr_err("invalid firmware id specified %d\n", id);
271 		return -EINVAL;
272 	}
273 
274 	fw_filename = sms_get_fw_name(id, board_id);
275 
276 	rc = request_firmware(&fw, fw_filename, &udev->dev);
277 	if (rc < 0) {
278 		pr_warn("failed to open '%s' mode %d, trying again with default firmware\n",
279 			fw_filename, id);
280 
281 		fw_filename = smsusb1_fw_lkup[id];
282 		rc = request_firmware(&fw, fw_filename, &udev->dev);
283 		if (rc < 0) {
284 			pr_warn("failed to open '%s' mode %d\n",
285 				 fw_filename, id);
286 
287 			return rc;
288 		}
289 	}
290 
291 	fw_buffer = kmalloc(fw->size, GFP_KERNEL);
292 	if (fw_buffer) {
293 		memcpy(fw_buffer, fw->data, fw->size);
294 
295 		rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2),
296 				  fw_buffer, fw->size, &dummy, 1000);
297 
298 		pr_debug("sent %zu(%d) bytes, rc %d\n", fw->size, dummy, rc);
299 
300 		kfree(fw_buffer);
301 	} else {
302 		pr_err("failed to allocate firmware buffer\n");
303 		rc = -ENOMEM;
304 	}
305 	pr_debug("read FW %s, size=%zu\n", fw_filename, fw->size);
306 
307 	release_firmware(fw);
308 
309 	return rc;
310 }
311 
312 static void smsusb1_detectmode(void *context, int *mode)
313 {
314 	char *product_string =
315 		((struct smsusb_device_t *) context)->udev->product;
316 
317 	*mode = DEVICE_MODE_NONE;
318 
319 	if (!product_string) {
320 		product_string = "none";
321 		pr_err("product string not found\n");
322 	} else if (strstr(product_string, "DVBH"))
323 		*mode = 1;
324 	else if (strstr(product_string, "BDA"))
325 		*mode = 4;
326 	else if (strstr(product_string, "DVBT"))
327 		*mode = 0;
328 	else if (strstr(product_string, "TDMB"))
329 		*mode = 2;
330 
331 	pr_debug("%d \"%s\"\n", *mode, product_string);
332 }
333 
334 static int smsusb1_setmode(void *context, int mode)
335 {
336 	struct sms_msg_hdr msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK,
337 			     sizeof(struct sms_msg_hdr), 0 };
338 
339 	if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) {
340 		pr_err("invalid firmware id specified %d\n", mode);
341 		return -EINVAL;
342 	}
343 
344 	return smsusb_sendrequest(context, &msg, sizeof(msg));
345 }
346 
347 static void smsusb_term_device(struct usb_interface *intf)
348 {
349 	struct smsusb_device_t *dev = usb_get_intfdata(intf);
350 
351 	if (dev) {
352 		dev->state = SMSUSB_DISCONNECTED;
353 
354 		smsusb_stop_streaming(dev);
355 
356 		/* unregister from smscore */
357 		if (dev->coredev)
358 			smscore_unregister_device(dev->coredev);
359 
360 		pr_debug("device 0x%p destroyed\n", dev);
361 		kfree(dev);
362 	}
363 
364 	usb_set_intfdata(intf, NULL);
365 }
366 
367 static void *siano_media_device_register(struct smsusb_device_t *dev,
368 					int board_id)
369 {
370 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
371 	struct media_device *mdev;
372 	struct usb_device *udev = dev->udev;
373 	struct sms_board *board = sms_get_board(board_id);
374 	int ret;
375 
376 	mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
377 	if (!mdev)
378 		return NULL;
379 
380 	media_device_usb_init(mdev, udev, board->name);
381 
382 	ret = media_device_register(mdev);
383 	if (ret) {
384 		media_device_cleanup(mdev);
385 		kfree(mdev);
386 		return NULL;
387 	}
388 
389 	pr_info("media controller created\n");
390 
391 	return mdev;
392 #else
393 	return NULL;
394 #endif
395 }
396 
397 static int smsusb_init_device(struct usb_interface *intf, int board_id)
398 {
399 	struct smsdevice_params_t params;
400 	struct smsusb_device_t *dev;
401 	void *mdev;
402 	int i, rc;
403 
404 	/* create device object */
405 	dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
406 	if (!dev)
407 		return -ENOMEM;
408 
409 	memset(&params, 0, sizeof(params));
410 	usb_set_intfdata(intf, dev);
411 	dev->udev = interface_to_usbdev(intf);
412 	dev->state = SMSUSB_DISCONNECTED;
413 
414 	params.device_type = sms_get_board(board_id)->type;
415 
416 	switch (params.device_type) {
417 	case SMS_STELLAR:
418 		dev->buffer_size = USB1_BUFFER_SIZE;
419 
420 		params.setmode_handler = smsusb1_setmode;
421 		params.detectmode_handler = smsusb1_detectmode;
422 		break;
423 	case SMS_UNKNOWN_TYPE:
424 		pr_err("Unspecified sms device type!\n");
425 		/* fall-thru */
426 	default:
427 		dev->buffer_size = USB2_BUFFER_SIZE;
428 		dev->response_alignment =
429 		    le16_to_cpu(dev->udev->ep_in[1]->desc.wMaxPacketSize) -
430 		    sizeof(struct sms_msg_hdr);
431 
432 		params.flags |= SMS_DEVICE_FAMILY2;
433 		break;
434 	}
435 
436 	for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
437 		if (intf->cur_altsetting->endpoint[i].desc. bEndpointAddress & USB_DIR_IN)
438 			dev->in_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
439 		else
440 			dev->out_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
441 	}
442 
443 	pr_debug("in_ep = %02x, out_ep = %02x\n",
444 		dev->in_ep, dev->out_ep);
445 
446 	params.device = &dev->udev->dev;
447 	params.usb_device = dev->udev;
448 	params.buffer_size = dev->buffer_size;
449 	params.num_buffers = MAX_BUFFERS;
450 	params.sendrequest_handler = smsusb_sendrequest;
451 	params.context = dev;
452 	usb_make_path(dev->udev, params.devpath, sizeof(params.devpath));
453 
454 	mdev = siano_media_device_register(dev, board_id);
455 
456 	/* register in smscore */
457 	rc = smscore_register_device(&params, &dev->coredev, 0, mdev);
458 	if (rc < 0) {
459 		pr_err("smscore_register_device(...) failed, rc %d\n", rc);
460 		smsusb_term_device(intf);
461 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
462 		media_device_unregister(mdev);
463 #endif
464 		kfree(mdev);
465 		return rc;
466 	}
467 
468 	smscore_set_board_id(dev->coredev, board_id);
469 
470 	dev->coredev->is_usb_device = true;
471 
472 	/* initialize urbs */
473 	for (i = 0; i < MAX_URBS; i++) {
474 		dev->surbs[i].dev = dev;
475 		usb_init_urb(&dev->surbs[i].urb);
476 	}
477 
478 	pr_debug("smsusb_start_streaming(...).\n");
479 	rc = smsusb_start_streaming(dev);
480 	if (rc < 0) {
481 		pr_err("smsusb_start_streaming(...) failed\n");
482 		smsusb_term_device(intf);
483 		return rc;
484 	}
485 
486 	dev->state = SMSUSB_ACTIVE;
487 
488 	rc = smscore_start_device(dev->coredev);
489 	if (rc < 0) {
490 		pr_err("smscore_start_device(...) failed\n");
491 		smsusb_term_device(intf);
492 		return rc;
493 	}
494 
495 	pr_debug("device 0x%p created\n", dev);
496 
497 	return rc;
498 }
499 
500 static int smsusb_probe(struct usb_interface *intf,
501 			const struct usb_device_id *id)
502 {
503 	struct usb_device *udev = interface_to_usbdev(intf);
504 	char devpath[32];
505 	int i, rc;
506 
507 	pr_info("board id=%lu, interface number %d\n",
508 		 id->driver_info,
509 		 intf->cur_altsetting->desc.bInterfaceNumber);
510 
511 	if (sms_get_board(id->driver_info)->intf_num !=
512 	    intf->cur_altsetting->desc.bInterfaceNumber) {
513 		pr_debug("interface %d won't be used. Expecting interface %d to popup\n",
514 			intf->cur_altsetting->desc.bInterfaceNumber,
515 			sms_get_board(id->driver_info)->intf_num);
516 		return -ENODEV;
517 	}
518 
519 	if (intf->num_altsetting > 1) {
520 		rc = usb_set_interface(udev,
521 				       intf->cur_altsetting->desc.bInterfaceNumber,
522 				       0);
523 		if (rc < 0) {
524 			pr_err("usb_set_interface failed, rc %d\n", rc);
525 			return rc;
526 		}
527 	}
528 
529 	pr_debug("smsusb_probe %d\n",
530 	       intf->cur_altsetting->desc.bInterfaceNumber);
531 	for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
532 		pr_debug("endpoint %d %02x %02x %d\n", i,
533 		       intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
534 		       intf->cur_altsetting->endpoint[i].desc.bmAttributes,
535 		       intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
536 		if (intf->cur_altsetting->endpoint[i].desc.bEndpointAddress &
537 		    USB_DIR_IN)
538 			rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev,
539 				intf->cur_altsetting->endpoint[i].desc.bEndpointAddress));
540 		else
541 			rc = usb_clear_halt(udev, usb_sndbulkpipe(udev,
542 				intf->cur_altsetting->endpoint[i].desc.bEndpointAddress));
543 	}
544 	if ((udev->actconfig->desc.bNumInterfaces == 2) &&
545 	    (intf->cur_altsetting->desc.bInterfaceNumber == 0)) {
546 		pr_debug("rom interface 0 is not used\n");
547 		return -ENODEV;
548 	}
549 
550 	if (id->driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
551 		/* Detected a Siano Stellar uninitialized */
552 
553 		snprintf(devpath, sizeof(devpath), "usb\\%d-%s",
554 			 udev->bus->busnum, udev->devpath);
555 		pr_info("stellar device in cold state was found at %s.\n",
556 			devpath);
557 		rc = smsusb1_load_firmware(
558 				udev, smscore_registry_getmode(devpath),
559 				id->driver_info);
560 
561 		/* This device will reset and gain another USB ID */
562 		if (!rc)
563 			pr_info("stellar device now in warm state\n");
564 		else
565 			pr_err("Failed to put stellar in warm state. Error: %d\n",
566 			       rc);
567 
568 		return rc;
569 	} else {
570 		rc = smsusb_init_device(intf, id->driver_info);
571 	}
572 
573 	pr_info("Device initialized with return code %d\n", rc);
574 	sms_board_load_modules(id->driver_info);
575 	return rc;
576 }
577 
578 static void smsusb_disconnect(struct usb_interface *intf)
579 {
580 	smsusb_term_device(intf);
581 }
582 
583 static int smsusb_suspend(struct usb_interface *intf, pm_message_t msg)
584 {
585 	struct smsusb_device_t *dev = usb_get_intfdata(intf);
586 	printk(KERN_INFO "%s  Entering status %d.\n", __func__, msg.event);
587 	dev->state = SMSUSB_SUSPENDED;
588 	/*smscore_set_power_mode(dev, SMS_POWER_MODE_SUSPENDED);*/
589 	smsusb_stop_streaming(dev);
590 	return 0;
591 }
592 
593 static int smsusb_resume(struct usb_interface *intf)
594 {
595 	int rc, i;
596 	struct smsusb_device_t *dev = usb_get_intfdata(intf);
597 	struct usb_device *udev = interface_to_usbdev(intf);
598 
599 	printk(KERN_INFO "%s  Entering.\n", __func__);
600 	usb_clear_halt(udev, usb_rcvbulkpipe(udev, dev->in_ep));
601 	usb_clear_halt(udev, usb_sndbulkpipe(udev, dev->out_ep));
602 
603 	for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++)
604 		printk(KERN_INFO "endpoint %d %02x %02x %d\n", i,
605 		       intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
606 		       intf->cur_altsetting->endpoint[i].desc.bmAttributes,
607 		       intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
608 
609 	if (intf->num_altsetting > 0) {
610 		rc = usb_set_interface(udev,
611 				       intf->cur_altsetting->desc.
612 				       bInterfaceNumber, 0);
613 		if (rc < 0) {
614 			printk(KERN_INFO "%s usb_set_interface failed, rc %d\n",
615 			       __func__, rc);
616 			return rc;
617 		}
618 	}
619 
620 	smsusb_start_streaming(dev);
621 	return 0;
622 }
623 
624 static const struct usb_device_id smsusb_id_table[] = {
625 	/* This device is only present before firmware load */
626 	{ USB_DEVICE(0x187f, 0x0010),
627 		.driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM },
628 	/* This device pops up after firmware load */
629 	{ USB_DEVICE(0x187f, 0x0100),
630 		.driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
631 
632 	{ USB_DEVICE(0x187f, 0x0200),
633 		.driver_info = SMS1XXX_BOARD_SIANO_NOVA_A },
634 	{ USB_DEVICE(0x187f, 0x0201),
635 		.driver_info = SMS1XXX_BOARD_SIANO_NOVA_B },
636 	{ USB_DEVICE(0x187f, 0x0300),
637 		.driver_info = SMS1XXX_BOARD_SIANO_VEGA },
638 	{ USB_DEVICE(0x2040, 0x1700),
639 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT },
640 	{ USB_DEVICE(0x2040, 0x1800),
641 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A },
642 	{ USB_DEVICE(0x2040, 0x1801),
643 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
644 	{ USB_DEVICE(0x2040, 0x2000),
645 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
646 	{ USB_DEVICE(0x2040, 0x2009),
647 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 },
648 	{ USB_DEVICE(0x2040, 0x200a),
649 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
650 	{ USB_DEVICE(0x2040, 0x2010),
651 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
652 	{ USB_DEVICE(0x2040, 0x2011),
653 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
654 	{ USB_DEVICE(0x2040, 0x2019),
655 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
656 	{ USB_DEVICE(0x2040, 0x5500),
657 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
658 	{ USB_DEVICE(0x2040, 0x5510),
659 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
660 	{ USB_DEVICE(0x2040, 0x5520),
661 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
662 	{ USB_DEVICE(0x2040, 0x5530),
663 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
664 	{ USB_DEVICE(0x2040, 0x5580),
665 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
666 	{ USB_DEVICE(0x2040, 0x5590),
667 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
668 	{ USB_DEVICE(0x187f, 0x0202),
669 		.driver_info = SMS1XXX_BOARD_SIANO_NICE },
670 	{ USB_DEVICE(0x187f, 0x0301),
671 		.driver_info = SMS1XXX_BOARD_SIANO_VENICE },
672 	{ USB_DEVICE(0x2040, 0xb900),
673 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
674 	{ USB_DEVICE(0x2040, 0xb910),
675 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
676 	{ USB_DEVICE(0x2040, 0xb980),
677 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
678 	{ USB_DEVICE(0x2040, 0xb990),
679 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
680 	{ USB_DEVICE(0x2040, 0xc000),
681 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
682 	{ USB_DEVICE(0x2040, 0xc010),
683 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
684 	{ USB_DEVICE(0x2040, 0xc080),
685 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
686 	{ USB_DEVICE(0x2040, 0xc090),
687 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
688 	{ USB_DEVICE(0x2040, 0xc0a0),
689 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
690 	{ USB_DEVICE(0x2040, 0xf5a0),
691 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
692 	{ USB_DEVICE(0x187f, 0x0202),
693 		.driver_info = SMS1XXX_BOARD_SIANO_NICE },
694 	{ USB_DEVICE(0x187f, 0x0301),
695 		.driver_info = SMS1XXX_BOARD_SIANO_VENICE },
696 	{ USB_DEVICE(0x187f, 0x0302),
697 		.driver_info = SMS1XXX_BOARD_SIANO_VENICE },
698 	{ USB_DEVICE(0x187f, 0x0310),
699 		.driver_info = SMS1XXX_BOARD_SIANO_MING },
700 	{ USB_DEVICE(0x187f, 0x0500),
701 		.driver_info = SMS1XXX_BOARD_SIANO_PELE },
702 	{ USB_DEVICE(0x187f, 0x0600),
703 		.driver_info = SMS1XXX_BOARD_SIANO_RIO },
704 	{ USB_DEVICE(0x187f, 0x0700),
705 		.driver_info = SMS1XXX_BOARD_SIANO_DENVER_2160 },
706 	{ USB_DEVICE(0x187f, 0x0800),
707 		.driver_info = SMS1XXX_BOARD_SIANO_DENVER_1530 },
708 	{ USB_DEVICE(0x19D2, 0x0086),
709 		.driver_info = SMS1XXX_BOARD_ZTE_DVB_DATA_CARD },
710 	{ USB_DEVICE(0x19D2, 0x0078),
711 		.driver_info = SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD },
712 	{ USB_DEVICE(0x3275, 0x0080),
713 		.driver_info = SMS1XXX_BOARD_SIANO_RIO },
714 	{ USB_DEVICE(0x2013, 0x0257),
715 		.driver_info = SMS1XXX_BOARD_PCTV_77E },
716 	{ } /* Terminating entry */
717 	};
718 
719 MODULE_DEVICE_TABLE(usb, smsusb_id_table);
720 
721 static struct usb_driver smsusb_driver = {
722 	.name			= "smsusb",
723 	.probe			= smsusb_probe,
724 	.disconnect		= smsusb_disconnect,
725 	.id_table		= smsusb_id_table,
726 
727 	.suspend		= smsusb_suspend,
728 	.resume			= smsusb_resume,
729 };
730 
731 module_usb_driver(smsusb_driver);
732 
733 MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle");
734 MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)");
735 MODULE_LICENSE("GPL");
736