diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-06-14 00:43:26 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 07:21:09 -0300 |
commit | f17407a85db3b86526d54e65698348873a6df617 (patch) | |
tree | ed1271461dc9faa88bcadf58a57fcc16b1adebf7 /drivers/media | |
parent | 55ad310c2f21281f50fa040b7765a4a1151bd420 (diff) |
V4L/DVB (8277): sms1xxx: update latest siano drop to 1.2.17
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/siano/smscoreapi.c | 363 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smscoreapi.h | 11 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smsdvb.c | 7 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smsusb.c | 48 |
4 files changed, 273 insertions, 156 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 86a4b5de5e1..76fa0f50775 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -33,32 +33,47 @@ #include "smscoreapi.h" +#define PERROR(fmt, args...) printk( KERN_ERR "smscore error: line %d- %s(): " fmt,__LINE__, __func__, ## args) + +#ifdef SMSCORE_DEBUG + +#undef PWARNING +# define PWARNING(fmt, args...) printk( KERN_INFO "smscore warning: line %d- %s(): " fmt,__LINE__, __func__, ## args) +#undef PDEBUG /* undef it, just in case */ +# define PDEBUG(fmt, args...) printk( KERN_INFO "smscore - %s(): " fmt, __func__, ## args) + +#else /*SMSCORE_DEBUG*/ + +#define PDEBUG(fmt, args...) +#define PWARNING(fmt, args...) + +#endif + + typedef struct _smscore_device_notifyee { struct list_head entry; hotplug_t hotplug; } smscore_device_notifyee_t; +typedef struct _smscore_subclient +{ + struct list_head entry; + int id; + int data_type; +} smscore_idlist_t; + typedef struct _smscore_client { struct list_head entry; smscore_device_t *coredev; - void *context; - - int data_type; - + struct list_head idlist; onresponse_t onresponse_handler; onremove_t onremove_handler; } *psmscore_client_t; -typedef struct _smscore_subclient -{ - struct list_head entry; - smscore_client_t *client; - int id; -} smscore_subclient_t; typedef struct _smscore_device { @@ -99,6 +114,7 @@ typedef struct _smscore_registry_entry struct list_head entry; char devpath[32]; int mode; + sms_device_type_st type; } smscore_registry_entry_t; struct list_head g_smscore_notifyees; @@ -109,63 +125,102 @@ struct list_head g_smscore_registry; kmutex_t g_smscore_registrylock; static int default_mode = 1; + module_param(default_mode, int, 0644); MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); -int smscore_registry_getmode(char *devpath) +static smscore_registry_entry_t *smscore_find_registry ( char *devpath ) { smscore_registry_entry_t *entry; struct list_head *next; kmutex_lock(&g_smscore_registrylock); - for (next = g_smscore_registry.next; next != &g_smscore_registry; next = next->next) { entry = (smscore_registry_entry_t *) next; - if (!strcmp(entry->devpath, devpath)) { kmutex_unlock(&g_smscore_registrylock); - return entry->mode; + return entry; } } - entry = (smscore_registry_entry_t *) kmalloc(sizeof(smscore_registry_entry_t), GFP_KERNEL); if (entry) { entry->mode = default_mode; strcpy(entry->devpath, devpath); - list_add(&entry->entry, &g_smscore_registry); } - + else + printk ( KERN_ERR "%s failed to create smscore_registry.\n", __func__ ); kmutex_unlock(&g_smscore_registrylock); + return entry; +} +int smscore_registry_getmode ( char *devpath ) +{ + smscore_registry_entry_t *entry; + + entry = smscore_find_registry ( devpath ); + if ( entry ) + { + return entry->mode; + } + else + { + printk ( KERN_ERR "%s No registry found.\n", __func__ ); + } return default_mode; } -void smscore_registry_setmode(char *devpath, int mode) +sms_device_type_st smscore_registry_gettype ( char *devpath ) { smscore_registry_entry_t *entry; - struct list_head *next; - kmutex_lock(&g_smscore_registrylock); + entry = smscore_find_registry ( devpath ); + if ( entry ) + { + return entry->type; + } + else + { + printk ( KERN_ERR "%s No registry found.\n", __func__ ); + } + return -1; +} - for (next = g_smscore_registry.next; next != &g_smscore_registry; next = next->next) +void smscore_registry_setmode ( char *devpath, int mode ) { - entry = (smscore_registry_entry_t *) next; + smscore_registry_entry_t *entry; - if (!strcmp(entry->devpath, devpath)) + entry = smscore_find_registry ( devpath ); + if ( entry ) { entry->mode = mode; - break; + } + else + { + printk ( KERN_ERR "%s No registry found.\n", __func__ ); } } - kmutex_unlock(&g_smscore_registrylock); +void smscore_registry_settype ( char *devpath, sms_device_type_st type ) +{ + smscore_registry_entry_t *entry; + + entry = smscore_find_registry ( devpath ); + if ( entry ) + { + entry->type = type; + } + else + { + printk ( KERN_ERR "%s No registry found.\n", __func__ ); +} } + void list_add_locked(struct list_head *new, struct list_head *head, spinlock_t *lock) { @@ -324,7 +379,6 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored // init queues INIT_LIST_HEAD(&dev->clients); - INIT_LIST_HEAD(&dev->subclients); INIT_LIST_HEAD(&dev->buffers); // init locks @@ -375,6 +429,8 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored dev->device_flags = params->flags; strcpy(dev->devpath, params->devpath); + smscore_registry_settype ( dev->devpath, params->device_type ); + // add device to devices list kmutex_lock(&g_smscore_deviceslock); list_add(&dev->entry, &g_smscore_devices); @@ -398,7 +454,10 @@ int smscore_start_device(smscore_device_t *coredev) { int rc = smscore_set_device_mode(coredev, smscore_registry_getmode(coredev->devpath)); if (rc < 0) + { + printk ( KERN_INFO "%s set device mode faile , rc %d\n", __func__, rc ); return rc; + } kmutex_lock(&g_smscore_deviceslock); @@ -416,9 +475,12 @@ int smscore_sendrequest_and_wait(smscore_device_t *coredev, void *buffer, { int rc = coredev->sendrequest_handler(coredev->context, buffer, size); if (rc < 0) + { + printk(KERN_INFO "%s sendrequest returned error %d\n", __func__, rc); return rc; + } - return wait_for_completion_timeout(completion, msecs_to_jiffies(1000)) ? 0 : -ETIME; + return wait_for_completion_timeout(completion, msecs_to_jiffies(10000)) ? 0 : -ETIME; } int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_t size) @@ -429,6 +491,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ u8 *payload = firmware->Payload; int rc = 0; + printk(KERN_INFO "%s loading FW to addr 0x%x size %d\n", __func__, mem_address,firmware->Length); if (coredev->preload_handler) { rc = coredev->preload_handler(coredev->context); @@ -443,6 +506,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ if (coredev->mode != DEVICE_MODE_NONE) { + PDEBUG("Sending reload command\n"); SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ, sizeof(SmsMsgHdr_ST)); rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->reload_start_done); mem_address = *(UINT32*) &payload[20]; @@ -496,13 +560,14 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ rc = coredev->sendrequest_handler(coredev->context, msg, msg->msgLength); } + msleep ( 500 ); } - printk("%s %d \n", __func__, rc); + printk("%s rc=%d, postload=%p \n", __func__, rc, coredev->postload_handler); kfree(msg); - return (rc >= 0 && coredev->postload_handler) ? + return ((rc >= 0) && coredev->postload_handler) ? coredev->postload_handler(coredev->context) : rc; } @@ -516,8 +581,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ * * @return 0 on success, <0 on error. */ -int smscore_load_firmware(smscore_device_t *coredev, char *filename, - loadfirmware_t loadfirmware_handler) +int smscore_load_firmware_from_file(smscore_device_t *coredev, char *filename, loadfirmware_t loadfirmware_handler) { int rc = -ENOENT; @@ -533,7 +597,7 @@ int smscore_load_firmware(smscore_device_t *coredev, char *filename, printk(KERN_INFO "%s failed to open \"%s\"\n", __func__, filename); return rc; } - + printk(KERN_INFO "%s read FW %s, size=%d\"\n", __func__, filename, fw->size); fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), GFP_KERNEL | GFP_DMA); if (fw_buffer) { @@ -556,6 +620,12 @@ int smscore_load_firmware(smscore_device_t *coredev, char *filename, return rc; } +int smscore_load_firmware_from_buffer(smscore_device_t *coredev, u8* buffer, int size, int new_mode) +{ + PERROR("Feature not implemented yet\n"); + return -EFAULT; +} + /** * notifies all clients registered with the device, notifies hotplugs, frees all buffers and coredev object * @@ -567,6 +637,7 @@ void smscore_unregister_device(smscore_device_t *coredev) { smscore_buffer_t *cb; int num_buffers = 0; + int retry = 0; kmutex_lock(&g_smscore_deviceslock); @@ -583,9 +654,13 @@ void smscore_unregister_device(smscore_device_t *coredev) kfree(cb); num_buffers ++; } - if (num_buffers == coredev->num_buffers) break; + if (++retry > 10) + { + printk(KERN_INFO "%s exiting although not all buffers released.\n", __func__); + break; + } printk(KERN_INFO "%s waiting for %d buffer(s)\n", __func__, coredev->num_buffers - num_buffers); msleep(100); @@ -637,19 +712,20 @@ int smscore_detect_mode(smscore_device_t *coredev) return rc; } -char *smscore_fw_lkup[] = +char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { - "dvb_nova_12mhz.inp", - "dvb_nova_12mhz.inp", - "tdmb_nova.inp", - "none", - "dvb_nova_12mhz.inp", - "isdbt_nova_12mhz.inp", - "isdbt_nova_12mhz.inp", - "cmmb_nova_12mhz.inp", - "none", + /*Stellar NOVA A0 Nova B0 VEGA*/ + /*DVBT*/ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, + /*DVBH*/ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, + /*TDMB*/ {"none", "tdmb_nova_12mhz.inp", "none" "none"}, + /*DABIP*/ {"none", "none", "none", "none"}, + /*BDA*/ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, + /*ISDBT*/ {"none", "isdbt_nova_12mhz.inp", "dvb_nova_12mhz.inp", "none"}, + /*ISDBTBDA*/{"none", "isdbt_nova_12mhz.inp", "isdbt_nova_12mhz_b0.inp", "none"}, + /*CMMB*/ {"none", "none", "none", "cmmb_vega_12mhz.inp"} }; + /** * calls device handler to change mode of operation * NOTE: stellar/usb may disconnect when changing mode @@ -663,7 +739,9 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) { void *buffer; int rc = 0; + sms_device_type_st type; + PDEBUG("set device mode to %d\n", mode ); if (coredev->device_flags & SMS_DEVICE_FAMILY2) { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) @@ -672,12 +750,17 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) return -EINVAL; } + smscore_registry_setmode(coredev->devpath, mode); + if (!(coredev->device_flags & SMS_DEVICE_NOT_READY)) { rc = smscore_detect_mode(coredev); if (rc < 0) + { + printk(KERN_INFO "%s mode detect failed %d\n", __func__, rc); return rc; } + } if (coredev->mode == mode) { @@ -687,10 +770,14 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) if (!(coredev->modes_supported & (1 << mode))) { - rc = smscore_load_firmware(coredev, smscore_fw_lkup[mode], NULL); + type = smscore_registry_gettype ( coredev->devpath ); + rc = smscore_load_firmware_from_file ( coredev, smscore_fw_lkup[mode][type], NULL ); if (rc < 0) + { + printk(KERN_INFO "%s load firmware failed %d\n", __func__, rc); return rc; } + } else { printk(KERN_INFO "%s mode %d supported by running firmware\n", __func__, mode); @@ -709,10 +796,21 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) kfree(buffer); } else + { + printk(KERN_INFO "%s Could not allocate buffer for init device message.\n", __func__); rc = -ENOMEM; } + } else { + if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) + { + printk(KERN_INFO "%s invalid mode specified %d\n", __func__, mode); + return -EINVAL; + } + + smscore_registry_setmode(coredev->devpath, mode); + if (coredev->detectmode_handler) coredev->detectmode_handler(coredev->context, &coredev->mode); @@ -720,14 +818,14 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) rc = coredev->setmode_handler(coredev->context, mode); } - smscore_registry_setmode(coredev->devpath, mode); - if (rc >= 0) { coredev->mode = mode; coredev->device_flags &= ~SMS_DEVICE_NOT_READY; } + if (rc != 0) + printk(KERN_INFO "%s return error code %d.\n", __func__, rc); return rc; } @@ -743,55 +841,40 @@ int smscore_get_device_mode(smscore_device_t *coredev) return coredev->mode; } -smscore_client_t *smscore_getclient_by_type(smscore_device_t *coredev, - int data_type) +/** + * find client by response id & type within the clients list. + * return client handle or NULL. + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * @param data_type client data type (SMS_DONT_CARE for all types) + * @param id client id (SMS_DONT_CARE for all id ) + * + */ +smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, int id) { smscore_client_t *client = NULL; struct list_head *next, *first; unsigned long flags; + struct list_head *firstid, *nextid; - if (!data_type) - return NULL; spin_lock_irqsave(&coredev->clientslock, flags); - first = &coredev->clients; - - for (next = first->next; next != first; next = next->next) + for (next = first->next; (next != first) && !client; next = next->next) + { + firstid = &((smscore_client_t*)next )->idlist; + for (nextid = firstid->next ; nextid != firstid ; nextid = nextid->next) { - if (((smscore_client_t*) next)->data_type == data_type) + if ((((smscore_idlist_t*)nextid)->id == id) && + (((smscore_idlist_t*)nextid)->data_type == data_type || + (((smscore_idlist_t*)nextid)->data_type == 0))) { client = (smscore_client_t*) next; break; } } - - spin_unlock_irqrestore(&coredev->clientslock, flags); - - return client; -} - -smscore_client_t *smscore_getclient_by_id(smscore_device_t *coredev, int id) -{ - smscore_client_t *client = NULL; - struct list_head *next, *first; - unsigned long flags; - - spin_lock_irqsave(&coredev->clientslock, flags); - - first = &coredev->subclients; - - for (next = first->next; next != first; next = next->next) - { - if (((smscore_subclient_t*) next)->id == id) - { - client = ((smscore_subclient_t*) next)->client; - break; - } } - spin_unlock_irqrestore(&coredev->clientslock, flags); - return client; } @@ -806,8 +889,7 @@ smscore_client_t *smscore_getclient_by_id(smscore_device_t *coredev, int id) void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) { SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)((u8*) cb->p + cb->offset); - smscore_client_t *client = smscore_getclient_by_type(coredev, - phdr->msgType); + smscore_client_t *client = smscore_find_client(coredev, phdr->msgType, phdr->msgDstId); int rc = -EBUSY; static unsigned long last_sample_time = 0; @@ -826,10 +908,9 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) } data_total += cb->size; - - if (!client) - client = smscore_getclient_by_id(coredev, phdr->msgDstId); - + /* If no client registered for type & id, check for control client where type is not registered*/ +// if (!client) +// client = smscore_find_client( coredev, 0, phdr->msgDstId); if (client) rc = client->onresponse_handler(client->context, cb); @@ -877,7 +958,8 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) break; default: - printk(KERN_INFO "%s no client (%p) or error (%d), type:%d dstid:%d\n", __func__, client, rc, phdr->msgType, phdr->msgDstId); + //printk(KERN_INFO "%s no client (%p) or error (%d), type:%d dstid:%d\n", __func__, client, rc, phdr->msgType, phdr->msgDstId); + break; } smscore_putbuffer(coredev, cb); @@ -921,30 +1003,35 @@ void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb) list_add_locked(&cb->entry, &coredev->buffers, &coredev->bufferslock); } -int smscore_validate_client(smscore_device_t *coredev, smscore_client_t *client, int id) +int smscore_validate_client(smscore_device_t *coredev, smscore_client_t *client, int data_type, int id) { - smscore_client_t *existing_client; - smscore_subclient_t *subclient; + smscore_idlist_t *listentry; + smscore_client_t *registered_client; - if (!id) - return 0; - - existing_client = smscore_getclient_by_id(coredev, id); - if (existing_client == client) + if ( !client ) + { + PERROR("bad parameter.\n"); + return -EFAULT; + } + registered_client = smscore_find_client(coredev, data_type, id); + if (registered_client == client) + { return 0; - - if (existing_client) - return -EBUSY; - - subclient = kzalloc(sizeof(smscore_subclient_t), GFP_KERNEL); - if (!subclient) + } + if (registered_client) + { + PERROR("The msg ID already registered to another client.\n"); + return -EEXIST; + } + listentry = kzalloc ( sizeof ( smscore_idlist_t ), GFP_KERNEL ); + if ( !listentry ) + { + PERROR("Can't allocate memory for client id.\n"); return -ENOMEM; - - subclient->client = client; - subclient->id = id; - - list_add_locked(&subclient->entry, &coredev->subclients, &coredev->clientslock); - + } + listentry->id = id; + listentry->data_type = data_type; + list_add_locked ( &listentry->entry, &client->idlist, &coredev->clientslock ); return 0; } @@ -964,35 +1051,29 @@ int smscore_validate_client(smscore_device_t *coredev, smscore_client_t *client, int smscore_register_client(smscore_device_t *coredev, smsclient_params_t *params, smscore_client_t **client) { smscore_client_t *newclient; - int rc; - - // check that no other channel with same data type exists - if (params->data_type && smscore_getclient_by_type(coredev, params->data_type)) + // check that no other channel with same parameters exists + if (smscore_find_client(coredev, params->data_type, params->initial_id)) + { + PERROR("Client already exist.\n"); return -EEXIST; + } newclient = kzalloc(sizeof(smscore_client_t), GFP_KERNEL); if (!newclient) - return -ENOMEM; - - // check that no other channel with same id exists - rc = smscore_validate_client(coredev, newclient, params->initial_id); - if (rc < 0) { - kfree(newclient); - return rc; + PERROR("Failed to allocate memory for client.\n"); + return -ENOMEM; } + INIT_LIST_HEAD ( &newclient->idlist); newclient->coredev = coredev; - newclient->data_type = params->data_type; newclient->onresponse_handler = params->onresponse_handler; newclient->onremove_handler = params->onremove_handler; newclient->context = params->context; - list_add_locked(&newclient->entry, &coredev->clients, &coredev->clientslock); - + smscore_validate_client(coredev, newclient, params->data_type, params->initial_id); *client = newclient; - - printk(KERN_INFO "%s %p %d %d\n", __func__, params->context, params->data_type, params->initial_id); + PDEBUG ( "%p %d %d\n", params->context, params->data_type, params->initial_id ); return 0; } @@ -1006,26 +1087,19 @@ int smscore_register_client(smscore_device_t *coredev, smsclient_params_t *param void smscore_unregister_client(smscore_client_t *client) { smscore_device_t *coredev = client->coredev; - struct list_head *next, *first; unsigned long flags; spin_lock_irqsave(&coredev->clientslock, flags); - first = &coredev->subclients; - for (next = first->next; next != first;) - { - smscore_subclient_t *subclient = (smscore_subclient_t *) next; - next = next->next; - - if (subclient->client == client) + while (!list_empty( &client->idlist)) { - list_del(&subclient->entry); - kfree(subclient); - } + smscore_idlist_t *identry = (smscore_idlist_t*)client->idlist.next; + list_del ( &identry->entry ); + kfree ( identry ); } - printk(KERN_INFO "%s %p %d\n", __func__, client->context, client->data_type); + printk(KERN_INFO "%s %p\n", __func__, client->context); list_del(&client->entry); kfree(client); @@ -1045,11 +1119,26 @@ void smscore_unregister_client(smscore_client_t *client) */ int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size) { - smscore_device_t *coredev = client->coredev; + smscore_device_t *coredev; SmsMsgHdr_ST* phdr = (SmsMsgHdr_ST*) buffer; + int rc; + + if ( client == NULL ) + { + printk(KERN_ERR "%s Got NULL client\n", __func__ ); + return -EINVAL; + } + + coredev = client->coredev; // check that no other channel with same id exists - int rc = smscore_validate_client(client->coredev, client, phdr->msgSrcId); + if ( coredev == NULL ) + { + printk(KERN_ERR "%s Got NULL coredev\n", __func__ ); + return -EINVAL; + } + + rc = smscore_validate_client(client->coredev, client, 0, phdr->msgSrcId); if (rc < 0) return rc; @@ -1160,6 +1249,6 @@ module_init(smscore_module_init); module_exit(smscore_module_exit); MODULE_DESCRIPTION("smscore"); -MODULE_AUTHOR("Anatoly Greenblatt,,, (anatolyg@siano-ms.com)"); +MODULE_AUTHOR ( "Siano Mobile Silicon,,, (doronc@siano-ms.com)" ); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index e44507417d2..c0a3be2fae7 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -56,6 +56,14 @@ typedef struct mutex kmutex_t; #define SMS_ROM_NO_RESPONSE 2 #define SMS_DEVICE_NOT_READY 0x8000000 +typedef enum { + SMS_STELLAR= 0, + SMS_NOVA_A0, + SMS_NOVA_B0, + SMS_VEGA, + SMS_NUM_OF_DEVICE_TYPES +} sms_device_type_st; + typedef struct _smscore_device smscore_device_t; typedef struct _smscore_client smscore_client_t; typedef struct _smscore_buffer smscore_buffer_t; @@ -102,6 +110,7 @@ typedef struct _smsdevice_params postload_t postload_handler; void *context; + sms_device_type_st device_type; } smsdevice_params_t; typedef struct _smsclient_params @@ -506,6 +515,8 @@ extern int smscore_start_device(smscore_device_t *coredev); extern int smscore_load_firmware(smscore_device_t *coredev, char *filename, loadfirmware_t loadfirmware_handler); +extern int smscore_load_firmware_from_buffer(smscore_device_t *coredev, u8* buffer, int size, int new_mode); + extern int smscore_set_device_mode(smscore_device_t *coredev, int mode); extern int smscore_get_device_mode(smscore_device_t *coredev); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 6975e7c61f8..e050e0da790 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -300,9 +300,8 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, if (smscore_get_device_mode(coredev) != 4) { - rc = smscore_set_device_mode(coredev, 4); - if (rc < 0) - return rc; + printk(KERN_ERR "%sSMS Device mode is not set for DVB operation.\n", __func__); + return 0; } client = kzalloc(sizeof(smsdvb_client_t), GFP_KERNEL); @@ -356,7 +355,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, goto frontend_error; } - params.initial_id = 0; + params.initial_id = 1; params.data_type = MSG_SMS_DVBT_BDA_DATA; params.onresponse_handler = smsdvb_onresponse; params.onremove_handler = smsdvb_onremove; diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 1677f859150..f719b72424d 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -301,21 +301,32 @@ int smsusb_init_device(struct usb_interface *intf) usb_set_intfdata(intf, dev); dev->udev = interface_to_usbdev(intf); - switch (dev->udev->descriptor.idProduct) - { - case 0x100: - dev->buffer_size = USB1_BUFFER_SIZE; - - params.setmode_handler = smsusb1_setmode; - params.detectmode_handler = smsusb1_detectmode; - break; + switch (dev->udev->descriptor.idProduct) { + case 0x100: + dev->buffer_size = USB1_BUFFER_SIZE; + + params.setmode_handler = smsusb1_setmode; + params.detectmode_handler = smsusb1_detectmode; + params.device_type = SMS_STELLAR; + printk(KERN_INFO "%s stellar device found\n", __func__ ); + break; + default: + if (dev->udev->descriptor.idProduct == 0x200) { + params.device_type = SMS_NOVA_A0; + printk(KERN_INFO "%s nova A0 found\n", __FUNCTION__ ); + } else if (dev->udev->descriptor.idProduct == 0x201) { + params.device_type = SMS_NOVA_B0; + printk(KERN_INFO "%s nova B0 found\n", __FUNCTION__); + } else { + params.device_type = SMS_VEGA; + printk(KERN_INFO "%s Vega found\n", __FUNCTION__); + } - default: - dev->buffer_size = USB2_BUFFER_SIZE; - dev->response_alignment = dev->udev->ep_in[1]->desc.wMaxPacketSize - sizeof(SmsMsgHdr_ST); + dev->buffer_size = USB2_BUFFER_SIZE; + dev->response_alignment = dev->udev->ep_in[1]->desc.wMaxPacketSize - sizeof(SmsMsgHdr_ST); - params.flags |= SMS_DEVICE_FAMILY2; - break; + params.flags |= SMS_DEVICE_FAMILY2; + break; } params.device = &dev->udev->dev; @@ -341,6 +352,7 @@ int smsusb_init_device(struct usb_interface *intf) usb_init_urb(&dev->surbs[i].urb); } + printk(KERN_INFO "%s smsusb_start_streaming(...).\n", __func__); rc = smsusb_start_streaming(dev); if (rc < 0) { @@ -368,6 +380,9 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) char devpath[32]; int i, rc; + rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x81)); + rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x02)); + if (intf->num_altsetting > 0) { rc = usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); @@ -390,11 +405,14 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { - snprintf(devpath, 32, "%d:%s", udev->bus->busnum, udev->devpath); + snprintf(devpath, sizeof(devpath), "usb\\%d-%s", udev->bus->busnum, udev->devpath); + printk(KERN_INFO "stellar device was found.\n"); return smsusb1_load_firmware(udev, smscore_registry_getmode(devpath)); } - return smsusb_init_device(intf); + rc = smsusb_init_device(intf); + printk(KERN_INFO "%s rc %d\n", __FUNCTION__, rc); + return rc; } void smsusb_disconnect(struct usb_interface *intf) |