diff options
Diffstat (limited to 'drivers/media/usb/siano')
-rw-r--r-- | drivers/media/usb/siano/smsusb.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index 03761c6f472..05bd91a60c0 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -209,8 +209,10 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size) struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer; int dummy; - if (dev->state != SMSUSB_ACTIVE) + if (dev->state != SMSUSB_ACTIVE) { + sms_debug("Device not active yet"); return -ENOENT; + } sms_debug("sending %s(%d) size: %d", smscore_translate_msg(phdr->msg_type), phdr->msg_type, @@ -243,6 +245,9 @@ static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id) int rc, dummy; char *fw_filename; + if (id < 0) + id = sms_get_board(board_id)->default_mode; + if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { sms_err("invalid firmware id specified %d", id); return -EINVAL; @@ -445,14 +450,15 @@ static int smsusb_probe(struct usb_interface *intf, char devpath[32]; int i, rc; - sms_info("interface number %d", + sms_info("board id=%lu, interface number %d", + id->driver_info, intf->cur_altsetting->desc.bInterfaceNumber); if (sms_get_board(id->driver_info)->intf_num != intf->cur_altsetting->desc.bInterfaceNumber) { - sms_err("interface number is %d expecting %d", - sms_get_board(id->driver_info)->intf_num, - intf->cur_altsetting->desc.bInterfaceNumber); + sms_debug("interface %d won't be used. Expecting interface %d to popup", + intf->cur_altsetting->desc.bInterfaceNumber, + sms_get_board(id->driver_info)->intf_num); return -ENODEV; } @@ -483,22 +489,32 @@ static int smsusb_probe(struct usb_interface *intf, } if ((udev->actconfig->desc.bNumInterfaces == 2) && (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { - sms_err("rom interface 0 is not used"); + sms_debug("rom interface 0 is not used"); return -ENODEV; } if (id->driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) { - sms_info("stellar device was found."); + /* Detected a Siano Stellar uninitialized */ + snprintf(devpath, sizeof(devpath), "usb\\%d-%s", udev->bus->busnum, udev->devpath); - sms_info("stellar device was found."); - return smsusb1_load_firmware( + sms_info("stellar device in cold state was found at %s.", devpath); + rc = smsusb1_load_firmware( udev, smscore_registry_getmode(devpath), id->driver_info); + + /* This device will reset and gain another USB ID */ + if (!rc) + sms_info("stellar device now in warm state"); + else + sms_err("Failed to put stellar in warm state. Error: %d", rc); + + return rc; + } else { + rc = smsusb_init_device(intf, id->driver_info); } - rc = smsusb_init_device(intf, id->driver_info); - sms_info("rc %d", rc); + sms_info("Device initialized with return code %d", rc); sms_board_load_modules(id->driver_info); return rc; } @@ -550,10 +566,13 @@ static int smsusb_resume(struct usb_interface *intf) } static const struct usb_device_id smsusb_id_table[] = { + /* This device is only present before firmware load */ { USB_DEVICE(0x187f, 0x0010), - .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, + .driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM }, + /* This device pops up after firmware load */ { USB_DEVICE(0x187f, 0x0100), .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, + { USB_DEVICE(0x187f, 0x0200), .driver_info = SMS1XXX_BOARD_SIANO_NOVA_A }, { USB_DEVICE(0x187f, 0x0201), |