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