aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano/smsusb.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-06-18 21:09:55 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:22:27 -0400
commit1c11d546b6c31399ac60f42d3103227cc1164d80 (patch)
tree4998b2168547180e0cf2ed22b7d7279c485fe011 /drivers/media/dvb/siano/smsusb.c
parentdd5b2a5c2a6c793d855910864593ad26dd844154 (diff)
V4L/DVB (8292): sms1xxx: add code to allow device-specific functionality
Set board ID in the usb_device_id table's driver_info field. Use board name when registering the dvb adapter. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/siano/smsusb.c')
-rw-r--r--drivers/media/dvb/siano/smsusb.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index 29183884d7ec..bb8a364477fb 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -25,6 +25,7 @@
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26 26
27#include "smscoreapi.h" 27#include "smscoreapi.h"
28#include "sms-cards.h"
28 29
29#define USB1_BUFFER_SIZE 0x1000 30#define USB1_BUFFER_SIZE 0x1000
30#define USB2_BUFFER_SIZE 0x4000 31#define USB2_BUFFER_SIZE 0x4000
@@ -32,14 +33,6 @@
32#define MAX_BUFFERS 50 33#define MAX_BUFFERS 50
33#define MAX_URBS 10 34#define MAX_URBS 10
34 35
35/* TO DO: move these to a header file */
36#define USB_VID_SIANO 0x187f
37
38#define USB_PID_STELLAR 0x0100
39#define USB_PID_NOVA_A 0x0200
40#define USB_PID_NOVA_B 0x0201
41#define USB_PID_VEGA 0x0300
42
43struct smsusb_device_t; 36struct smsusb_device_t;
44 37
45struct smsusb_urb_t { 38struct smsusb_urb_t {
@@ -287,10 +280,11 @@ void smsusb_term_device(struct usb_interface *intf)
287 usb_set_intfdata(intf, NULL); 280 usb_set_intfdata(intf, NULL);
288} 281}
289 282
290int smsusb_init_device(struct usb_interface *intf) 283int smsusb_init_device(struct usb_interface *intf, int board_id)
291{ 284{
292 struct smsdevice_params_t params; 285 struct smsdevice_params_t params;
293 struct smsusb_device_t *dev; 286 struct smsusb_device_t *dev;
287 struct sms_board *board;
294 int i, rc; 288 int i, rc;
295 289
296 /* create device object */ 290 /* create device object */
@@ -305,9 +299,11 @@ int smsusb_init_device(struct usb_interface *intf)
305 usb_set_intfdata(intf, dev); 299 usb_set_intfdata(intf, dev);
306 dev->udev = interface_to_usbdev(intf); 300 dev->udev = interface_to_usbdev(intf);
307 301
308 switch (dev->udev->descriptor.idProduct) { 302 board = sms_get_board(board_id);
303
304 switch (board->type) {
309 305
310 case USB_PID_STELLAR: 306 case SMS_STELLAR:
311 dev->buffer_size = USB1_BUFFER_SIZE; 307 dev->buffer_size = USB1_BUFFER_SIZE;
312 308
313 params.setmode_handler = smsusb1_setmode; 309 params.setmode_handler = smsusb1_setmode;
@@ -316,19 +312,22 @@ int smsusb_init_device(struct usb_interface *intf)
316 printk(KERN_INFO "%s stellar device found\n", __func__); 312 printk(KERN_INFO "%s stellar device found\n", __func__);
317 break; 313 break;
318 default: 314 default:
319 switch (dev->udev->descriptor.idProduct) { 315 switch (board->type) {
320 case USB_PID_NOVA_A: 316 case SMS_NOVA_A0:
321 params.device_type = SMS_NOVA_A0; 317 params.device_type = SMS_NOVA_A0;
322 printk(KERN_INFO "%s nova A0 found\n", __func__); 318 printk(KERN_INFO "%s nova A0 found\n", __func__);
323 break; 319 break;
324 default: 320 case SMS_NOVA_B0:
325 case USB_PID_NOVA_B:
326 params.device_type = SMS_NOVA_B0; 321 params.device_type = SMS_NOVA_B0;
327 printk(KERN_INFO "%s nova B0 found\n", __func__); 322 printk(KERN_INFO "%s nova B0 found\n", __func__);
328 break; 323 break;
329 case USB_PID_VEGA: 324 case SMS_VEGA:
330 params.device_type = SMS_VEGA; 325 params.device_type = SMS_VEGA;
331 printk(KERN_INFO "%s Vega found\n", __func__); 326 printk(KERN_INFO "%s Vega found\n", __func__);
327 break;
328 default:
329 printk(KERN_ERR "%s Unspecified sms device type!\n",
330 __func__);
332 } 331 }
333 332
334 dev->buffer_size = USB2_BUFFER_SIZE; 333 dev->buffer_size = USB2_BUFFER_SIZE;
@@ -357,6 +356,8 @@ int smsusb_init_device(struct usb_interface *intf)
357 return rc; 356 return rc;
358 } 357 }
359 358
359 smscore_set_board_id(dev->coredev, board_id);
360
360 /* initialize urbs */ 361 /* initialize urbs */
361 for (i = 0; i < MAX_URBS; i++) { 362 for (i = 0; i < MAX_URBS; i++) {
362 dev->surbs[i].dev = dev; 363 dev->surbs[i].dev = dev;
@@ -426,7 +427,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
426 udev, smscore_registry_getmode(devpath)); 427 udev, smscore_registry_getmode(devpath));
427 } 428 }
428 429
429 rc = smsusb_init_device(intf); 430 rc = smsusb_init_device(intf, id->driver_info);
430 printk(KERN_INFO "%s rc %d\n", __func__, rc); 431 printk(KERN_INFO "%s rc %d\n", __func__, rc);
431 return rc; 432 return rc;
432} 433}
@@ -436,15 +437,6 @@ void smsusb_disconnect(struct usb_interface *intf)
436 smsusb_term_device(intf); 437 smsusb_term_device(intf);
437} 438}
438 439
439static struct usb_device_id smsusb_id_table [] = {
440 { USB_DEVICE(USB_VID_SIANO, USB_PID_STELLAR) },
441 { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) },
442 { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_B) },
443 { USB_DEVICE(USB_VID_SIANO, USB_PID_VEGA) },
444 { } /* Terminating entry */
445};
446MODULE_DEVICE_TABLE(usb, smsusb_id_table);
447
448static struct usb_driver smsusb_driver = { 440static struct usb_driver smsusb_driver = {
449 .name = "smsusb", 441 .name = "smsusb",
450 .probe = smsusb_probe, 442 .probe = smsusb_probe,