From 854470606070d91955f03a7dca3a8024fc2a2540 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 22 May 2008 18:29:20 -0300 Subject: V4L/DVB (8272): sms1xxx: move driver from media/mdtv/ to media/dvb/siano/ Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/Kconfig | 16 + drivers/media/dvb/siano/Makefile | 8 + drivers/media/dvb/siano/smscoreapi.c | 1158 ++++++++++++++++++++++++++++++++++ drivers/media/dvb/siano/smscoreapi.h | 531 ++++++++++++++++ drivers/media/dvb/siano/smsdvb.c | 425 +++++++++++++ drivers/media/dvb/siano/smsusb.c | 436 +++++++++++++ 6 files changed, 2574 insertions(+) create mode 100644 drivers/media/dvb/siano/Kconfig create mode 100644 drivers/media/dvb/siano/Makefile create mode 100644 drivers/media/dvb/siano/smscoreapi.c create mode 100644 drivers/media/dvb/siano/smscoreapi.h create mode 100644 drivers/media/dvb/siano/smsdvb.c create mode 100644 drivers/media/dvb/siano/smsusb.c (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/Kconfig b/drivers/media/dvb/siano/Kconfig new file mode 100644 index 00000000000..878d48c1cfc --- /dev/null +++ b/drivers/media/dvb/siano/Kconfig @@ -0,0 +1,16 @@ +# +# Siano Mobile Silicon Digital TV device configuration +# + +config DVB_SIANO_SMS1XXX + tristate "Siano SMS1xxx USB dongle support" + depends on DVB_CORE && USB + ---help--- + Choose Y here if you have USB dongle with SMS1xxx chipset. + + Further documentation on this driver can be found on the WWW at + . + + To compile this driver as a module, choose M here: the + module will be called sms1xxx. + diff --git a/drivers/media/dvb/siano/Makefile b/drivers/media/dvb/siano/Makefile new file mode 100644 index 00000000000..e549c4e2bbe --- /dev/null +++ b/drivers/media/dvb/siano/Makefile @@ -0,0 +1,8 @@ +sms1xxx-objs := smscoreapi.o smsusb.o smsdvb.o + +obj-$(CONFIG_DVB_SIANO_SMS1XXX) += sms1xxx.o + +EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core + +EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) + diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c new file mode 100644 index 00000000000..d3ba1fcde54 --- /dev/null +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -0,0 +1,1158 @@ +/* + * Siano core API module + * + * This file contains implementation for the interface to sms core component + * + * author: Anatoly Greenblat + * + * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation; + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "smscoreapi.h" + +typedef struct _smscore_device_notifyee +{ + struct list_head entry; + hotplug_t hotplug; +} smscore_device_notifyee_t; + +typedef struct _smscore_client +{ + struct list_head entry; + smscore_device_t *coredev; + + void *context; + + int data_type; + + 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 +{ + struct list_head entry; + + struct list_head clients; + struct list_head subclients; + spinlock_t clientslock; + + struct list_head buffers; + spinlock_t bufferslock; + int num_buffers; + + void *common_buffer; + int common_buffer_size; + dma_addr_t common_buffer_phys; + + void *context; + struct device *device; + + char devpath[32]; + unsigned long device_flags; + + setmode_t setmode_handler; + detectmode_t detectmode_handler; + sendrequest_t sendrequest_handler; + preload_t preload_handler; + postload_t postload_handler; + + int mode, modes_supported; + + struct completion version_ex_done, data_download_done, trigger_done; + struct completion init_device_done, reload_start_done, resume_done; +} *psmscore_device_t; + +typedef struct _smscore_registry_entry +{ + struct list_head entry; + char devpath[32]; + int mode; +} smscore_registry_entry_t; + +struct list_head g_smscore_notifyees; +struct list_head g_smscore_devices; +kmutex_t g_smscore_deviceslock; + +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) +{ + 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; + } + } + + 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); + } + + kmutex_unlock(&g_smscore_registrylock); + + return default_mode; +} + +void smscore_registry_setmode(char* devpath, int mode) +{ + 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)) + { + entry->mode = mode; + break; + } + } + + kmutex_unlock(&g_smscore_registrylock); +} + + +void list_add_locked(struct list_head *new, struct list_head *head, spinlock_t* lock) +{ + unsigned long flags; + + spin_lock_irqsave(lock, flags); + + list_add(new, head); + + spin_unlock_irqrestore(lock, flags); +} + +/** + * register a client callback that called when device plugged in/unplugged + * NOTE: if devices exist callback is called immediately for each device + * + * @param hotplug callback + * + * @return 0 on success, <0 on error. + */ +int smscore_register_hotplug(hotplug_t hotplug) +{ + smscore_device_notifyee_t *notifyee; + struct list_head *next, *first; + int rc = 0; + + kmutex_lock(&g_smscore_deviceslock); + + notifyee = kmalloc(sizeof(smscore_device_notifyee_t), GFP_KERNEL); + if (notifyee) + { + // now notify callback about existing devices + first = &g_smscore_devices; + for (next = first->next; next != first && !rc; next = next->next) + { + smscore_device_t *coredev = (smscore_device_t *) next; + rc = hotplug(coredev, coredev->device, 1); + } + + if (rc >= 0) + { + notifyee->hotplug = hotplug; + list_add(¬ifyee->entry, &g_smscore_notifyees); + } + else + kfree(notifyee); + } + else + rc = -ENOMEM; + + kmutex_unlock(&g_smscore_deviceslock); + + return rc; +} + +/** + * unregister a client callback that called when device plugged in/unplugged + * + * @param hotplug callback + * + */ +void smscore_unregister_hotplug(hotplug_t hotplug) +{ + struct list_head *next, *first; + + kmutex_lock(&g_smscore_deviceslock); + + first = &g_smscore_notifyees; + + for (next = first->next; next != first;) + { + smscore_device_notifyee_t *notifyee = (smscore_device_notifyee_t *) next; + next = next->next; + + if (notifyee->hotplug == hotplug) + { + list_del(¬ifyee->entry); + kfree(notifyee); + } + } + + kmutex_unlock(&g_smscore_deviceslock); +} + +void smscore_notify_clients(smscore_device_t *coredev) +{ + smscore_client_t* client; + + // the client must call smscore_unregister_client from remove handler + while (!list_empty(&coredev->clients)) + { + client = (smscore_client_t *) coredev->clients.next; + client->onremove_handler(client->context); + } +} + +int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, int arrival) +{ + struct list_head *next, *first; + int rc = 0; + + // note: must be called under g_deviceslock + + first = &g_smscore_notifyees; + + for (next = first->next; next != first; next = next->next) + { + rc = ((smscore_device_notifyee_t *) next)->hotplug(coredev, device, arrival); + if (rc < 0) + break; + } + + return rc; +} + +smscore_buffer_t *smscore_createbuffer(u8* buffer, void* common_buffer, dma_addr_t common_buffer_phys) +{ + smscore_buffer_t *cb = kmalloc(sizeof(smscore_buffer_t), GFP_KERNEL); + if (!cb) + { + printk(KERN_INFO "%s kmalloc(...) failed\n", __FUNCTION__); + return NULL; + } + + cb->p = buffer; + cb->offset_in_common = buffer - (u8*) common_buffer; + cb->phys = common_buffer_phys + cb->offset_in_common; + + return cb; +} + +/** + * creates coredev object for a device, prepares buffers, creates buffer mappings, notifies + * registered hotplugs about new device. + * + * @param params device pointer to struct with device specific parameters and handlers + * @param coredev pointer to a value that receives created coredev object + * + * @return 0 on success, <0 on error. + */ +int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev) +{ + smscore_device_t* dev; + u8 *buffer; + + dev = kzalloc(sizeof(smscore_device_t), GFP_KERNEL); + if (!dev) + { + printk(KERN_INFO "%s kzalloc(...) failed\n", __FUNCTION__); + return -ENOMEM; + } + + // init list entry so it could be safe in smscore_unregister_device + INIT_LIST_HEAD(&dev->entry); + + // init queues + INIT_LIST_HEAD(&dev->clients); + INIT_LIST_HEAD(&dev->subclients); + INIT_LIST_HEAD(&dev->buffers); + + // init locks + spin_lock_init(&dev->clientslock); + spin_lock_init(&dev->bufferslock); + + // init completion events + init_completion(&dev->version_ex_done); + init_completion(&dev->data_download_done); + init_completion(&dev->trigger_done); + init_completion(&dev->init_device_done); + init_completion(&dev->reload_start_done); + init_completion(&dev->resume_done); + + // alloc common buffer + dev->common_buffer_size = params->buffer_size * params->num_buffers; + dev->common_buffer = dma_alloc_coherent(NULL, dev->common_buffer_size, &dev->common_buffer_phys, GFP_KERNEL | GFP_DMA); + if (!dev->common_buffer) + { + smscore_unregister_device(dev); + return -ENOMEM; + } + + // prepare dma buffers + for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; dev->num_buffers ++, buffer += params->buffer_size) + { + smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); + if (!cb) + { + smscore_unregister_device(dev); + return -ENOMEM; + } + + smscore_putbuffer(dev, cb); + } + + printk(KERN_INFO "%s allocated %d buffers\n", __FUNCTION__, dev->num_buffers); + + dev->mode = DEVICE_MODE_NONE; + dev->context = params->context; + dev->device = params->device; + dev->setmode_handler = params->setmode_handler; + dev->detectmode_handler = params->detectmode_handler; + dev->sendrequest_handler = params->sendrequest_handler; + dev->preload_handler = params->preload_handler; + dev->postload_handler = params->postload_handler; + + dev->device_flags = params->flags; + strcpy(dev->devpath, params->devpath); + + // add device to devices list + kmutex_lock(&g_smscore_deviceslock); + list_add(&dev->entry, &g_smscore_devices); + kmutex_unlock(&g_smscore_deviceslock); + + *coredev = dev; + + printk(KERN_INFO "%s device %p created\n", __FUNCTION__, dev); + + return 0; +} + +/** + * sets initial device mode and notifies client hotplugs that device is ready + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * + * @return 0 on success, <0 on error. + */ +int smscore_start_device(smscore_device_t *coredev) +{ + int rc = smscore_set_device_mode(coredev, smscore_registry_getmode(coredev->devpath)); + if (rc < 0) + return rc; + + kmutex_lock(&g_smscore_deviceslock); + + rc = smscore_notify_callbacks(coredev, coredev->device, 1); + + printk(KERN_INFO "%s device %p started, rc %d\n", __FUNCTION__, coredev, rc); + + kmutex_unlock(&g_smscore_deviceslock); + + return rc; +} + +int smscore_sendrequest_and_wait(smscore_device_t *coredev, void* buffer, size_t size, struct completion *completion) +{ + int rc = coredev->sendrequest_handler(coredev->context, buffer, size); + if (rc < 0) + return rc; + + return wait_for_completion_timeout(completion, msecs_to_jiffies(1000)) ? 0 : -ETIME; +} + +int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_t size) +{ + SmsFirmware_ST* firmware = (SmsFirmware_ST*) buffer; + SmsMsgHdr_ST *msg; + UINT32 mem_address = firmware->StartAddress; + u8* payload = firmware->Payload; + int rc = 0; + + if (coredev->preload_handler) + { + rc = coredev->preload_handler(coredev->context); + if (rc < 0) + return rc; + } + + // PAGE_SIZE buffer shall be enough and dma aligned + msg = (SmsMsgHdr_ST *) kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); + if (!msg) + return -ENOMEM; + + if (coredev->mode != DEVICE_MODE_NONE) + { + 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]; + } + + while (size && rc >= 0) + { + SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg; + int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); + + SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, (UINT16)(sizeof(SmsMsgHdr_ST) + sizeof(UINT32) + payload_size)); + + DataMsg->MemAddr = mem_address; + memcpy(DataMsg->Payload, payload, payload_size); + + if (coredev->device_flags & SMS_ROM_NO_RESPONSE && coredev->mode == DEVICE_MODE_NONE) + rc = coredev->sendrequest_handler(coredev->context, DataMsg, DataMsg->xMsgHeader.msgLength); + else + rc = smscore_sendrequest_and_wait(coredev, DataMsg, DataMsg->xMsgHeader.msgLength, &coredev->data_download_done); + + payload += payload_size; + size -= payload_size; + mem_address += payload_size; + } + + if (rc >= 0) + { + if (coredev->mode == DEVICE_MODE_NONE) + { + SmsMsgData_ST* TriggerMsg = (SmsMsgData_ST*) msg; + + SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, sizeof(SmsMsgHdr_ST) + sizeof(UINT32) * 5); + + TriggerMsg->msgData[0] = firmware->StartAddress; // Entry point + TriggerMsg->msgData[1] = 5; // Priority + TriggerMsg->msgData[2] = 0x200; // Stack size + TriggerMsg->msgData[3] = 0; // Parameter + TriggerMsg->msgData[4] = 4; // Task ID + + if (coredev->device_flags & SMS_ROM_NO_RESPONSE) + { + rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength); + msleep(100); + } + else + rc = smscore_sendrequest_and_wait(coredev, TriggerMsg, TriggerMsg->xMsgHeader.msgLength, &coredev->trigger_done); + } + else + { + SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ, sizeof(SmsMsgHdr_ST)); + + rc = coredev->sendrequest_handler(coredev->context, msg, msg->msgLength); + } + } + + printk("%s %d \n", __func__, rc); + + kfree(msg); + + return (rc >= 0 && coredev->postload_handler) ? + coredev->postload_handler(coredev->context) : + rc; +} + +/** + * loads specified firmware into a buffer and calls device loadfirmware_handler + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * @param filename null-terminated string specifies firmware file name + * @param loadfirmware_handler device handler that loads firmware + * + * @return 0 on success, <0 on error. + */ +int smscore_load_firmware(smscore_device_t *coredev, char* filename, loadfirmware_t loadfirmware_handler) +{ + int rc = -ENOENT; + + const struct firmware *fw; + u8* fw_buffer; + + if (loadfirmware_handler == NULL && !(coredev->device_flags & SMS_DEVICE_FAMILY2)) + return -EINVAL; + + rc = request_firmware(&fw, filename, coredev->device); + if (rc < 0) + { + printk(KERN_INFO "%s failed to open \"%s\"\n", __FUNCTION__, filename); + return rc; + } + + fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), GFP_KERNEL | GFP_DMA); + if (fw_buffer) + { + memcpy(fw_buffer, fw->data, fw->size); + + rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? + smscore_load_firmware_family2(coredev, fw_buffer, fw->size) : + loadfirmware_handler(coredev->context, fw_buffer, fw->size); + + kfree(fw_buffer); + } + else + { + printk(KERN_INFO "%s failed to allocate firmware buffer\n", __FUNCTION__); + rc = -ENOMEM; + } + + release_firmware(fw); + + return rc; +} + +/** + * notifies all clients registered with the device, notifies hotplugs, frees all buffers and coredev object + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * + * @return 0 on success, <0 on error. + */ +void smscore_unregister_device(smscore_device_t *coredev) +{ + smscore_buffer_t *cb; + int num_buffers = 0; + + kmutex_lock(&g_smscore_deviceslock); + + smscore_notify_clients(coredev); + smscore_notify_callbacks(coredev, NULL, 0); + + // at this point all buffers should be back + // onresponse must no longer be called + + while (1) + { + while ((cb = smscore_getbuffer(coredev))) + { + kfree(cb); + num_buffers ++; + } + + if (num_buffers == coredev->num_buffers) + break; + + printk(KERN_INFO "%s waiting for %d buffer(s)\n", __FUNCTION__, coredev->num_buffers - num_buffers); + msleep(100); + } + + printk(KERN_INFO "%s freed %d buffers\n", __FUNCTION__, num_buffers); + + if (coredev->common_buffer) + dma_free_coherent(NULL, coredev->common_buffer_size, coredev->common_buffer, coredev->common_buffer_phys); + + list_del(&coredev->entry); + kfree(coredev); + + kmutex_unlock(&g_smscore_deviceslock); + + printk(KERN_INFO "%s device %p destroyed\n", __FUNCTION__, coredev); +} + +int smscore_detect_mode(smscore_device_t *coredev) +{ + void *buffer = kmalloc(sizeof(SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); + SmsMsgHdr_ST *msg = (SmsMsgHdr_ST *) SMS_ALIGN_ADDRESS(buffer); + int rc; + + if (!buffer) + return -ENOMEM; + + SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ, sizeof(SmsMsgHdr_ST)); + + rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); + if (rc == -ETIME) + { + printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", __FUNCTION__); + + if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) + { + rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); + if (rc < 0) + { + printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d\n", __FUNCTION__, rc); + } + } + else + rc = -ETIME; + } + + kfree(buffer); + + return rc; +} + +char *smscore_fw_lkup[] = +{ + "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", +}; + +/** + * calls device handler to change mode of operation + * NOTE: stellar/usb may disconnect when changing mode + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * @param mode requested mode of operation + * + * @return 0 on success, <0 on error. + */ +int smscore_set_device_mode(smscore_device_t *coredev, int mode) +{ + void *buffer; + int rc = 0; + + if (coredev->device_flags & SMS_DEVICE_FAMILY2) + { + if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) + { + printk(KERN_INFO "%s invalid mode specified %d\n", __FUNCTION__, mode); + return -EINVAL; + } + + if (!(coredev->device_flags & SMS_DEVICE_NOT_READY)) + { + rc = smscore_detect_mode(coredev); + if (rc < 0) + return rc; + } + + if (coredev->mode == mode) + { + printk(KERN_INFO "%s device mode %d already set\n", __FUNCTION__, mode); + return 0; + } + + if (!(coredev->modes_supported & (1 << mode))) + { + rc = smscore_load_firmware(coredev, smscore_fw_lkup[mode], NULL); + if (rc < 0) + return rc; + } + else + { + printk(KERN_INFO "%s mode %d supported by running firmware\n", __FUNCTION__, mode); + } + + buffer = kmalloc(sizeof(SmsMsgData_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); + if (buffer) + { + SmsMsgData_ST *msg = (SmsMsgData_ST *) SMS_ALIGN_ADDRESS(buffer); + + SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ, sizeof(SmsMsgData_ST)); + msg->msgData[0] = mode; + + rc = smscore_sendrequest_and_wait(coredev, msg, msg->xMsgHeader.msgLength, &coredev->init_device_done); + + kfree(buffer); + } + else + rc = -ENOMEM; + } + else + { + if (coredev->detectmode_handler) + coredev->detectmode_handler(coredev->context, &coredev->mode); + + if (coredev->mode != mode && coredev->setmode_handler) + 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; + } + + return rc; +} + +/** + * calls device handler to get current mode of operation + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * + * @return current mode + */ +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) +{ + smscore_client_t *client = NULL; + struct list_head *next, *first; + unsigned long flags; + + if (!data_type) + return NULL; + + spin_lock_irqsave(&coredev->clientslock, flags); + + first = &coredev->clients; + + for (next = first->next; next != first; next = next->next) + { + if (((smscore_client_t*) next)->data_type == data_type) + { + 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; +} + +/** + * find client by response id/type, call clients onresponse handler + * return buffer to pool on error + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * @param cb pointer to response buffer descriptor + * + */ +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); + int rc = -EBUSY; + + static unsigned long last_sample_time = 0; + static int data_total = 0; + unsigned long time_now = jiffies_to_msecs(jiffies); + + if (!last_sample_time) + last_sample_time = time_now; + + if (time_now - last_sample_time > 10000) + { + printk("\n%s data rate %d bytes/secs\n", __func__, (int)((data_total * 1000) / (time_now - last_sample_time))); + + last_sample_time = time_now; + data_total = 0; + } + + data_total += cb->size; + + if (!client) + client = smscore_getclient_by_id(coredev, phdr->msgDstId); + + if (client) + rc = client->onresponse_handler(client->context, cb); + + if (rc < 0) + { + switch (phdr->msgType) + { + case MSG_SMS_GET_VERSION_EX_RES: + { + SmsVersionRes_ST *ver = (SmsVersionRes_ST*) phdr; + printk("%s: MSG_SMS_GET_VERSION_EX_RES id %d prots 0x%x ver %d.%d\n", __FUNCTION__, ver->FirmwareId, ver->SupportedProtocols, ver->RomVersionMajor, ver->RomVersionMinor); + + coredev->mode = ver->FirmwareId == 255 ? DEVICE_MODE_NONE : ver->FirmwareId; + coredev->modes_supported = ver->SupportedProtocols; + + complete(&coredev->version_ex_done); + break; + } + + case MSG_SMS_INIT_DEVICE_RES: + printk("%s: MSG_SMS_INIT_DEVICE_RES\n", __FUNCTION__); + complete(&coredev->init_device_done); + break; + + case MSG_SW_RELOAD_START_RES: + printk("%s: MSG_SW_RELOAD_START_RES\n", __FUNCTION__); + complete(&coredev->reload_start_done); + break; + + case MSG_SMS_DATA_DOWNLOAD_RES: + complete(&coredev->data_download_done); + break; + + case MSG_SW_RELOAD_EXEC_RES: + printk("%s: MSG_SW_RELOAD_EXEC_RES\n", __FUNCTION__); + break; + + case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: + printk("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", __FUNCTION__); + complete(&coredev->trigger_done); + break; + + case MSG_SMS_SLEEP_RESUME_COMP_IND: + complete(&coredev->resume_done); + break; + + default: + printk(KERN_INFO "%s no client (%p) or error (%d), type:%d dstid:%d\n", __FUNCTION__, client, rc, phdr->msgType, phdr->msgDstId); + } + + smscore_putbuffer(coredev, cb); + } +} + +/** + * return pointer to next free buffer descriptor from core pool + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * + * @return pointer to descriptor on success, NULL on error. + */ +smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev) +{ + smscore_buffer_t *cb = NULL; + unsigned long flags; + + spin_lock_irqsave(&coredev->bufferslock, flags); + + if (!list_empty(&coredev->buffers)) + { + cb = (smscore_buffer_t *) coredev->buffers.next; + list_del(&cb->entry); + } + + spin_unlock_irqrestore(&coredev->bufferslock, flags); + + return cb; +} + +/** + * return buffer descriptor to a pool + * + * @param coredev pointer to a coredev object returned by smscore_register_device + * @param cb pointer buffer descriptor + * + */ +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) +{ + smscore_client_t *existing_client; + smscore_subclient_t *subclient; + + if (!id) + return 0; + + existing_client = smscore_getclient_by_id(coredev, id); + if (existing_client == client) + return 0; + + if (existing_client) + return -EBUSY; + + subclient = kzalloc(sizeof(smscore_subclient_t), GFP_KERNEL); + if (!subclient) + return -ENOMEM; + + subclient->client = client; + subclient->id = id; + + list_add_locked(&subclient->entry, &coredev->subclients, &coredev->clientslock); + + return 0; +} + +/** + * creates smsclient object, check that id is taken by another client + * + * @param coredev pointer to a coredev object from clients hotplug + * @param initial_id all messages with this id would be sent to this client + * @param data_type all messages of this type would be sent to this client + * @param onresponse_handler client handler that is called to process incoming messages + * @param onremove_handler client handler that is called when device is removed + * @param context client-specific context + * @param client pointer to a value that receives created smsclient object + * + * @return 0 on success, <0 on error. + */ +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)) + 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; + } + + 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); + + *client = newclient; + + printk(KERN_INFO "%s %p %d %d\n", __FUNCTION__, params->context, params->data_type, params->initial_id); + + return 0; +} + +/** + * frees smsclient object and all subclients associated with it + * + * @param client pointer to smsclient object returned by smscore_register_client + * + */ +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) + { + list_del(&subclient->entry); + kfree(subclient); + } + } + + printk(KERN_INFO "%s %p %d\n", __FUNCTION__, client->context, client->data_type); + + list_del(&client->entry); + kfree(client); + + spin_unlock_irqrestore(&coredev->clientslock, flags); +} + +/** + * verifies that source id is not taken by another client, + * calls device handler to send requests to the device + * + * @param client pointer to smsclient object returned by smscore_register_client + * @param buffer pointer to a request buffer + * @param size size (in bytes) of request buffer + * + * @return 0 on success, <0 on error. + */ +int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size) +{ + smscore_device_t* coredev = client->coredev; + SmsMsgHdr_ST* phdr = (SmsMsgHdr_ST*) buffer; + + // check that no other channel with same id exists + int rc = smscore_validate_client(client->coredev, client, phdr->msgSrcId); + if (rc < 0) + return rc; + + return coredev->sendrequest_handler(coredev->context, buffer, size); +} + +/** + * return the size of large (common) buffer + * + * @param coredev pointer to a coredev object from clients hotplug + * + * @return size (in bytes) of the buffer + */ +int smscore_get_common_buffer_size(smscore_device_t *coredev) +{ + return coredev->common_buffer_size; +} + +/** + * maps common buffer (if supported by platform) + * + * @param coredev pointer to a coredev object from clients hotplug + * @param vma pointer to vma struct from mmap handler + * + * @return 0 on success, <0 on error. + */ +int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma) +{ + unsigned long end = vma->vm_end, start = vma->vm_start, size = PAGE_ALIGN(coredev->common_buffer_size); + + if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || (vma->vm_flags & VM_WRITE)) + { + printk(KERN_INFO "%s invalid vm flags\n", __FUNCTION__); + return -EINVAL; + } + + if ((end - start) != size) + { + printk(KERN_INFO "%s invalid size %d expected %d\n", __FUNCTION__, (int)(end - start), (int) size); + return -EINVAL; + } + + if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, size, pgprot_noncached(vma->vm_page_prot))) + { + printk(KERN_INFO "%s remap_page_range failed\n", __FUNCTION__); + return -EAGAIN; + } + + return 0; +} + +int smscore_module_init(void) +{ + int rc = 0; + + INIT_LIST_HEAD(&g_smscore_notifyees); + INIT_LIST_HEAD(&g_smscore_devices); + kmutex_init(&g_smscore_deviceslock); + + INIT_LIST_HEAD(&g_smscore_registry); + kmutex_init(&g_smscore_registrylock); + + /* USB Register */ + rc = smsusb_register(); + + /* DVB Register */ + rc = smsdvb_register(); + + printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc); + + return rc; +} + +void smscore_module_exit(void) +{ + + kmutex_lock(&g_smscore_deviceslock); + while (!list_empty(&g_smscore_notifyees)) + { + smscore_device_notifyee_t *notifyee = (smscore_device_notifyee_t *) g_smscore_notifyees.next; + + list_del(¬ifyee->entry); + kfree(notifyee); + } + kmutex_unlock(&g_smscore_deviceslock); + + kmutex_lock(&g_smscore_registrylock); + while (!list_empty(&g_smscore_registry)) + { + smscore_registry_entry_t *entry = (smscore_registry_entry_t *) g_smscore_registry.next; + + list_del(&entry->entry); + kfree(entry); + } + kmutex_unlock(&g_smscore_registrylock); + + /* DVB UnRegister */ + smsdvb_unregister(); + + /* Unregister USB */ + smsusb_unregister(); + + printk(KERN_INFO "%s\n", __FUNCTION__); +} + +module_init(smscore_module_init); +module_exit(smscore_module_exit); + +MODULE_DESCRIPTION("smscore"); +MODULE_AUTHOR("Anatoly Greenblatt,,, (anatolyg@siano-ms.com)"); +MODULE_LICENSE("GPL"); + diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h new file mode 100644 index 00000000000..679487df8a5 --- /dev/null +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -0,0 +1,531 @@ +/* + * Driver for the Siano SMS1xxx USB dongle + * + * author: Anatoly Greenblat + * + * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation; + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __smscoreapi_h__ +#define __smscoreapi_h__ + +#include +#include +#include +#include +#include +#include + +#include "dmxdev.h" +#include "dvbdev.h" +#include "dvb_demux.h" +#include "dvb_frontend.h" + +#include + +typedef struct mutex kmutex_t; + +#define kmutex_init(_p_) mutex_init(_p_) +#define kmutex_lock(_p_) mutex_lock(_p_) +#define kmutex_trylock(_p_) mutex_trylock(_p_) +#define kmutex_unlock(_p_) mutex_unlock(_p_) + + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +#define SMS_ALLOC_ALIGNMENT 128 +#define SMS_DMA_ALIGNMENT 16 +#define SMS_ALIGN_ADDRESS(addr) ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) + +#define SMS_DEVICE_FAMILY2 1 +#define SMS_ROM_NO_RESPONSE 2 +#define SMS_DEVICE_NOT_READY 0x8000000 + +typedef struct _smscore_device smscore_device_t; +typedef struct _smscore_client smscore_client_t; +typedef struct _smscore_buffer smscore_buffer_t; + +typedef int (*hotplug_t)(smscore_device_t *coredev, struct device *device, int arrival); + +typedef int (*setmode_t)(void *context, int mode); +typedef void (*detectmode_t)(void *context, int *mode); +typedef int (*sendrequest_t)(void *context, void *buffer, size_t size); +typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size); +typedef int (*preload_t)(void *context); +typedef int (*postload_t)(void *context); + +typedef int (*onresponse_t)(void *context, smscore_buffer_t *cb); +typedef void (*onremove_t)(void *context); + +typedef struct _smscore_buffer +{ + // public members, once passed to clients can be changed freely + struct list_head entry; + int size; + int offset; + + // private members, read-only for clients + void *p; + dma_addr_t phys; + unsigned long offset_in_common; +} *psmscore_buffer_t; + +typedef struct _smsdevice_params +{ + struct device *device; + + int buffer_size; + int num_buffers; + + char devpath[32]; + unsigned long flags; + + setmode_t setmode_handler; + detectmode_t detectmode_handler; + sendrequest_t sendrequest_handler; + preload_t preload_handler; + postload_t postload_handler; + + void *context; +} smsdevice_params_t; + +typedef struct _smsclient_params +{ + int initial_id; + int data_type; + onresponse_t onresponse_handler; + onremove_t onremove_handler; + + void *context; +} smsclient_params_t; + +// GPIO definitions for antenna frequency domain control (SMS8021) +#define SMS_ANTENNA_GPIO_0 1 +#define SMS_ANTENNA_GPIO_1 0 + +#define BW_8_MHZ 0 +#define BW_7_MHZ 1 +#define BW_6_MHZ 2 +#define BW_5_MHZ 3 +#define BW_ISDBT_1SEG 4 +#define BW_ISDBT_3SEG 5 + +#define MSG_HDR_FLAG_SPLIT_MSG 4 + +#define MAX_GPIO_PIN_NUMBER 31 + +#define HIF_TASK 11 +#define SMS_HOST_LIB 150 +#define DVBT_BDA_CONTROL_MSG_ID 201 + +#define SMS_MAX_PAYLOAD_SIZE 240 +#define SMS_TUNE_TIMEOUT 500 + +#define MSG_SMS_GPIO_CONFIG_REQ 507 +#define MSG_SMS_GPIO_CONFIG_RES 508 +#define MSG_SMS_GPIO_SET_LEVEL_REQ 509 +#define MSG_SMS_GPIO_SET_LEVEL_RES 510 +#define MSG_SMS_GPIO_GET_LEVEL_REQ 511 +#define MSG_SMS_GPIO_GET_LEVEL_RES 512 +#define MSG_SMS_RF_TUNE_REQ 561 +#define MSG_SMS_RF_TUNE_RES 562 +#define MSG_SMS_INIT_DEVICE_REQ 578 +#define MSG_SMS_INIT_DEVICE_RES 579 +#define MSG_SMS_ADD_PID_FILTER_REQ 601 +#define MSG_SMS_ADD_PID_FILTER_RES 602 +#define MSG_SMS_REMOVE_PID_FILTER_REQ 603 +#define MSG_SMS_REMOVE_PID_FILTER_RES 604 +#define MSG_SMS_DAB_CHANNEL 607 +#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608 +#define MSG_SMS_GET_PID_FILTER_LIST_RES 609 +#define MSG_SMS_GET_STATISTICS_REQ 615 +#define MSG_SMS_GET_STATISTICS_RES 616 +#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651 +#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652 +#define MSG_SMS_GET_STATISTICS_EX_REQ 653 +#define MSG_SMS_GET_STATISTICS_EX_RES 654 +#define MSG_SMS_SLEEP_RESUME_COMP_IND 655 +#define MSG_SMS_DATA_DOWNLOAD_REQ 660 +#define MSG_SMS_DATA_DOWNLOAD_RES 661 +#define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664 +#define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665 +#define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666 +#define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667 +#define MSG_SMS_GET_VERSION_EX_REQ 668 +#define MSG_SMS_GET_VERSION_EX_RES 669 +#define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670 +#define MSG_SMS_I2C_SET_FREQ_REQ 685 +#define MSG_SMS_GENERIC_I2C_REQ 687 +#define MSG_SMS_GENERIC_I2C_RES 688 +#define MSG_SMS_DVBT_BDA_DATA 693 +#define MSG_SW_RELOAD_REQ 697 +#define MSG_SMS_DATA_MSG 699 +#define MSG_SW_RELOAD_START_REQ 702 +#define MSG_SW_RELOAD_START_RES 703 +#define MSG_SW_RELOAD_EXEC_REQ 704 +#define MSG_SW_RELOAD_EXEC_RES 705 +#define MSG_SMS_SPI_INT_LINE_SET_REQ 710 +#define MSG_SMS_ISDBT_TUNE_REQ 776 +#define MSG_SMS_ISDBT_TUNE_RES 777 + +#define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \ + (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \ + (ptr)->msgLength = len; (ptr)->msgFlags = 0; \ +} while (0) +#define SMS_INIT_MSG(ptr, type, len) SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len) + +typedef enum +{ + DEVICE_MODE_NONE = -1, + DEVICE_MODE_DVBT = 0, + DEVICE_MODE_DVBH, + DEVICE_MODE_DAB_TDMB, + DEVICE_MODE_DAB_TDMB_DABIP, + DEVICE_MODE_DVBT_BDA, + DEVICE_MODE_ISDBT, + DEVICE_MODE_ISDBT_BDA, + DEVICE_MODE_CMMB, + DEVICE_MODE_RAW_TUNER, + DEVICE_MODE_MAX, +} SMS_DEVICE_MODE; + +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned int UINT32; +typedef int INT32; + +typedef struct SmsMsgHdr_S +{ + UINT16 msgType; + UINT8 msgSrcId; + UINT8 msgDstId; + UINT16 msgLength; // Length is of the entire message, including header + UINT16 msgFlags; +} SmsMsgHdr_ST; + +typedef struct SmsMsgData_S +{ + SmsMsgHdr_ST xMsgHeader; + UINT32 msgData[1]; +} SmsMsgData_ST; + +typedef struct SmsDataDownload_S +{ + SmsMsgHdr_ST xMsgHeader; + UINT32 MemAddr; + UINT8 Payload[SMS_MAX_PAYLOAD_SIZE]; +} SmsDataDownload_ST; + +typedef struct SmsVersionRes_S +{ + SmsMsgHdr_ST xMsgHeader; + + UINT16 ChipModel; // e.g. 0x1102 for SMS-1102 "Nova" + UINT8 Step; // 0 - Step A + UINT8 MetalFix; // 0 - Metal 0 + + UINT8 FirmwareId; // 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E + UINT8 SupportedProtocols; // Bitwise OR combination of supported protocols + + UINT8 VersionMajor; + UINT8 VersionMinor; + UINT8 VersionPatch; + UINT8 VersionFieldPatch; + + UINT8 RomVersionMajor; + UINT8 RomVersionMinor; + UINT8 RomVersionPatch; + UINT8 RomVersionFieldPatch; + + UINT8 TextLabel[34]; +} SmsVersionRes_ST; + +typedef struct SmsFirmware_S +{ + UINT32 CheckSum; + UINT32 Length; + UINT32 StartAddress; + UINT8 Payload[1]; +} SmsFirmware_ST; + +typedef struct SMSHOSTLIB_STATISTICS_S +{ + UINT32 Reserved; //!< Reserved + + /// Common parameters + UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked + UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked + UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on + + /// Reception quality + INT32 SNR; //!< dB + UINT32 BER; //!< Post Viterbi BER [1E-5] + UINT32 FIB_CRC; //!< CRC errors percentage, valid only for DAB + UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H + UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H + INT32 RSSI; //!< dBm + INT32 InBandPwr; //!< In band power in dBM + INT32 CarrierOffset; //!< Carrier Offset in bin/1024 + + /// Transmission parameters + UINT32 Frequency; //!< Frequency in Hz + UINT32 Bandwidth; //!< Bandwidth in MHz, valid only for DVB-T/H + UINT32 TransmissionMode; //!< Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos + UINT32 ModemState; //!< from SMS_DvbModemState_ET , valid only for DVB-T/H + UINT32 GuardInterval; //!< Guard Interval, 1 divided by value , valid only for DVB-T/H + UINT32 CodeRate; //!< Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H + UINT32 LPCodeRate; //!< Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H + UINT32 Hierarchy; //!< Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H + UINT32 Constellation; //!< Constellation from SMS_Constellation_ET, valid only for DVB-T/H + + /// Burst parameters, valid only for DVB-H + UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H + UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H + UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H + UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H + UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H + UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H + UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H + UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets + UINT32 TotalTSPackets; //!< Total number of transport-stream packets + UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding + UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding + UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding + /// Common params + UINT32 BERErrorCount; //!< Number of errornous SYNC bits. + UINT32 BERBitCount; //!< Total number of SYNC bits. + + /// Interface information + UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. + + /// DAB/T-DMB + UINT32 PreBER; //!< DAB/T-DMB only: Pre Viterbi BER [1E-5] + + /// DVB-H TPS parameters + UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered + +} SMSHOSTLIB_STATISTICS_ST; + +typedef struct +{ + UINT32 RequestResult; + + SMSHOSTLIB_STATISTICS_ST Stat; + + // Split the calc of the SNR in DAB + UINT32 Signal; //!< dB + UINT32 Noise; //!< dB + +} SmsMsgStatisticsInfo_ST; + +typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S +{ + // Per-layer information + UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist + UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist + UINT32 BER; //!< Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A + UINT32 BERErrorCount; //!< Post Viterbi Error Bits Count + UINT32 BERBitCount; //!< Post Viterbi Total Bits Count + UINT32 PreBER; //!< Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A + UINT32 TS_PER; //!< Transport stream PER [%], 0xFFFFFFFF indicate N/A + UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets + UINT32 TotalTSPackets; //!< Total number of transport-stream packets + UINT32 TILdepthI; //!< Time interleaver depth I parameter, 255 means layer does not exist + UINT32 NumberOfSegments; //!< Number of segments in layer A, 255 means layer does not exist + UINT32 TMCCErrors; //!< TMCC errors +} SMSHOSTLIB_ISDBT_LAYER_STAT_ST; + +typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S +{ + UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E + //!< This fiels MUST always first in any statistics structure + + UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by + //!< the host is smaller than FullSize, the struct will be truncated + + // Common parameters + UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked + UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked + UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on + + // Reception quality + INT32 SNR; //!< dB + INT32 RSSI; //!< dBm + INT32 InBandPwr; //!< In band power in dBM + INT32 CarrierOffset; //!< Carrier Offset in Hz + + // Transmission parameters + UINT32 Frequency; //!< Frequency in Hz + UINT32 Bandwidth; //!< Bandwidth in MHz + UINT32 TransmissionMode; //!< ISDB-T transmission mode + UINT32 ModemState; //!< 0 - Acquisition, 1 - Locked + UINT32 GuardInterval; //!< Guard Interval, 1 divided by value + UINT32 SystemType; //!< ISDB-T system type (ISDB-T / ISDB-Tsb) + UINT32 PartialReception; //!< TRUE - partial reception, FALSE otherwise + UINT32 NumOfLayers; //!< Number of ISDB-T layers in the network + + // Per-layer information + // Layers A, B and C + SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; //!< Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST + + // Interface information + UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. + +} SMSHOSTLIB_STATISTICS_ISDBT_ST; + +typedef struct SMSHOSTLIB_STATISTICS_DVB_S +{ + UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E + //!< This fiels MUST always first in any statistics structure + + UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by + //!< the host is smaller than FullSize, the struct will be truncated + // Common parameters + UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked + UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked + UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on + + // Reception quality + INT32 SNR; //!< dB + UINT32 BER; //!< Post Viterbi BER [1E-5] + UINT32 BERErrorCount; //!< Number of errornous SYNC bits. + UINT32 BERBitCount; //!< Total number of SYNC bits. + UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A + UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H + INT32 RSSI; //!< dBm + INT32 InBandPwr; //!< In band power in dBM + INT32 CarrierOffset; //!< Carrier Offset in bin/1024 + + // Transmission parameters + UINT32 Frequency; //!< Frequency in Hz + UINT32 Bandwidth; //!< Bandwidth in MHz + UINT32 ModemState; //!< from SMSHOSTLIB_DVB_MODEM_STATE_ET + UINT32 TransmissionMode; //!< FFT mode carriers in Kilos + UINT32 GuardInterval; //!< Guard Interval, 1 divided by value + UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET + UINT32 LPCodeRate; //!< Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET + UINT32 Hierarchy; //!< Hierarchy from SMSHOSTLIB_HIERARCHY_ET + UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET + + // Burst parameters, valid only for DVB-H + UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H + UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H + UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H + UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H + UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H + UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H + UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H + UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets + UINT32 TotalTSPackets; //!< Total number of transport-stream packets + UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H + UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H + UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H + UINT32 NumMPEReceived; //!< DVB-H, Num MPE section received + + // DVB-H TPS parameters + UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered + UINT32 DvbhSrvIndHP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator + UINT32 DvbhSrvIndLP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator + + // Interface information + UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. + +} SMSHOSTLIB_STATISTICS_DVB_ST; + +typedef struct SMSHOSTLIB_GPIO_CONFIG_S +{ + UINT8 Direction; //!< GPIO direction: Input - 0, Output - 1 + UINT8 PullUpDown; //!< PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 + UINT8 InputCharacteristics; //!< Input Characteristics: Normal - 0, Schmitt trigger - 1 + UINT8 OutputSlewRate; //!< Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 + UINT8 OutputDriving; //!< Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 +} SMSHOSTLIB_GPIO_CONFIG_ST; + +typedef struct SMSHOSTLIB_I2C_REQ_S +{ + UINT32 DeviceAddress; // I2c device address + UINT32 WriteCount; // number of bytes to write + UINT32 ReadCount; // number of bytes to read + UINT8 Data[1]; +} SMSHOSTLIB_I2C_REQ_ST; + +typedef struct SMSHOSTLIB_I2C_RES_S +{ + UINT32 Status; // non-zero value in case of failure + UINT32 ReadCount; // number of bytes read + UINT8 Data[1]; +} SMSHOSTLIB_I2C_RES_ST; + +typedef struct _smsdvb_client +{ + struct list_head entry; + + smscore_device_t *coredev; + smscore_client_t *smsclient; + + struct dvb_adapter adapter; + struct dvb_demux demux; + struct dmxdev dmxdev; + struct dvb_frontend frontend; + + fe_status_t fe_status; + int fe_ber, fe_snr, fe_signal_strength; + + struct completion tune_done, stat_done; + + // todo: save freq/band instead whole struct + struct dvb_frontend_parameters fe_params; + +} smsdvb_client_t; + +extern void smscore_registry_setmode(char *devpath, int mode); +extern int smscore_registry_getmode(char *devpath); + +extern int smscore_register_hotplug(hotplug_t hotplug); +extern void smscore_unregister_hotplug(hotplug_t hotplug); + +extern int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev); +extern void smscore_unregister_device(smscore_device_t *coredev); + +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_set_device_mode(smscore_device_t *coredev, int mode); +extern int smscore_get_device_mode(smscore_device_t *coredev); + +extern int smscore_register_client(smscore_device_t *coredev, smsclient_params_t* params, smscore_client_t **client); +extern void smscore_unregister_client(smscore_client_t *client); + +extern int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size); +extern void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb); + +extern int smscore_get_common_buffer_size(smscore_device_t *coredev); +extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma); + +extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); +extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); + +/* smsdvb.c */ +int smsdvb_register(void); +void smsdvb_unregister(void); + +/* smsusb.c */ +int smsusb_register(void); +void smsusb_unregister(void); + +#endif // __smscoreapi_h__ diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c new file mode 100644 index 00000000000..e1a14a812c2 --- /dev/null +++ b/drivers/media/dvb/siano/smsdvb.c @@ -0,0 +1,425 @@ +/* + * Driver for the Siano SMS10xx USB dongle + * + * author: Anatoly Greenblat + * + * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation; + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#include "smscoreapi.h" + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +struct list_head g_smsdvb_clients; +kmutex_t g_smsdvb_clientslock; + +int smsdvb_onresponse(void *context, smscore_buffer_t *cb) +{ + smsdvb_client_t *client = (smsdvb_client_t *) context; + SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8*) cb->p) + cb->offset); + + switch(phdr->msgType) + { + case MSG_SMS_DVBT_BDA_DATA: + dvb_dmx_swfilter(&client->demux, (u8*)(phdr + 1), cb->size - sizeof(SmsMsgHdr_ST)); + break; + + case MSG_SMS_RF_TUNE_RES: + complete(&client->tune_done); + break; + + case MSG_SMS_GET_STATISTICS_RES: + { + SmsMsgStatisticsInfo_ST* p = (SmsMsgStatisticsInfo_ST*)(phdr + 1); + + if (p->Stat.IsDemodLocked) + { + client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; + client->fe_snr = p->Stat.SNR; + client->fe_ber = p->Stat.BER; + + if (p->Stat.InBandPwr < -95) + client->fe_signal_strength = 0; + else if (p->Stat.InBandPwr > -29) + client->fe_signal_strength = 100; + else + client->fe_signal_strength = (p->Stat.InBandPwr + 95) * 3 / 2; + } + else + { + client->fe_status = 0; + client->fe_snr = + client->fe_ber = + client->fe_signal_strength = 0; + } + + complete(&client->stat_done); + break; + } + } + + smscore_putbuffer(client->coredev, cb); + + return 0; +} + +void smsdvb_unregister_client(smsdvb_client_t* client) +{ + // must be called under clientslock + + list_del(&client->entry); + + smscore_unregister_client(client->smsclient); + dvb_unregister_frontend(&client->frontend); + dvb_dmxdev_release(&client->dmxdev); + dvb_dmx_release(&client->demux); + dvb_unregister_adapter(&client->adapter); + kfree(client); +} + +void smsdvb_onremove(void *context) +{ + kmutex_lock(&g_smsdvb_clientslock); + + smsdvb_unregister_client((smsdvb_client_t*) context); + + kmutex_unlock(&g_smsdvb_clientslock); +} + +static int smsdvb_start_feed(struct dvb_demux_feed *feed) +{ + smsdvb_client_t *client = container_of(feed->demux, smsdvb_client_t, demux); + SmsMsgData_ST PidMsg; + + printk("%s add pid %d(%x)\n", __FUNCTION__, feed->pid, feed->pid); + + PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; + PidMsg.xMsgHeader.msgDstId = HIF_TASK; + PidMsg.xMsgHeader.msgFlags = 0; + PidMsg.xMsgHeader.msgType = MSG_SMS_ADD_PID_FILTER_REQ; + PidMsg.xMsgHeader.msgLength = sizeof(PidMsg); + PidMsg.msgData[0] = feed->pid; + + return smsclient_sendrequest(client->smsclient, &PidMsg, sizeof(PidMsg)); +} + +static int smsdvb_stop_feed(struct dvb_demux_feed *feed) +{ + smsdvb_client_t *client = container_of(feed->demux, smsdvb_client_t, demux); + SmsMsgData_ST PidMsg; + + printk("%s remove pid %d(%x)\n", __FUNCTION__, feed->pid, feed->pid); + + PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; + PidMsg.xMsgHeader.msgDstId = HIF_TASK; + PidMsg.xMsgHeader.msgFlags = 0; + PidMsg.xMsgHeader.msgType = MSG_SMS_REMOVE_PID_FILTER_REQ; + PidMsg.xMsgHeader.msgLength = sizeof(PidMsg); + PidMsg.msgData[0] = feed->pid; + + return smsclient_sendrequest(client->smsclient, &PidMsg, sizeof(PidMsg)); +} + +static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, void* buffer, size_t size, struct completion *completion) +{ + int rc = smsclient_sendrequest(client->smsclient, buffer, size); + if (rc < 0) + return rc; + + return wait_for_completion_timeout(completion, msecs_to_jiffies(2000)) ? 0 : -ETIME; +} + +static int smsdvb_send_statistics_request(smsdvb_client_t *client) +{ + SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, DVBT_BDA_CONTROL_MSG_ID, HIF_TASK, sizeof(SmsMsgHdr_ST), 0 }; + return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), &client->stat_done); +} + +static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) +{ + smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + int rc = smsdvb_send_statistics_request(client); + + if (!rc) + *stat = client->fe_status; + + return rc; +} + +static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) +{ + smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + int rc = smsdvb_send_statistics_request(client); + + if (!rc) + *ber = client->fe_ber; + + return rc; +} + +static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) +{ + smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + int rc = smsdvb_send_statistics_request(client); + + if (!rc) + *strength = client->fe_signal_strength; + + return rc; +} + +static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) +{ + smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + int rc = smsdvb_send_statistics_request(client); + + if (!rc) + *snr = client->fe_snr; + + return rc; +} + +static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) +{ + printk("%s\n", __FUNCTION__); + + tune->min_delay_ms = 400; + tune->step_size = 250000; + tune->max_drift = 0; + return 0; +} + +static int smsdvb_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) +{ + smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + + struct + { + SmsMsgHdr_ST Msg; + u32 Data[3]; + } Msg; + + Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; + Msg.Msg.msgDstId = HIF_TASK; + Msg.Msg.msgFlags = 0; + Msg.Msg.msgType = MSG_SMS_RF_TUNE_REQ; + Msg.Msg.msgLength = sizeof(Msg); + Msg.Data[0] = fep->frequency; + Msg.Data[2] = 12000000; + + printk("%s freq %d band %d\n", __FUNCTION__, fep->frequency, fep->u.ofdm.bandwidth); + + switch(fep->u.ofdm.bandwidth) + { + case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; + case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; + case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; +// case BANDWIDTH_5_MHZ: Msg.Data[1] = BW_5_MHZ; break; + case BANDWIDTH_AUTO: return -EOPNOTSUPP; + default: return -EINVAL; + } + + return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), &client->tune_done); +} + +static int smsdvb_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) +{ + smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + + printk("%s\n", __FUNCTION__); + + // todo: + memcpy(fep, &client->fe_params, sizeof(struct dvb_frontend_parameters)); + return 0; +} + +static void smsdvb_release(struct dvb_frontend *fe) +{ + // do nothing +} + +static struct dvb_frontend_ops smsdvb_fe_ops = { + .info = { + .name = "Siano Mobile Digital SMS10xx", + .type = FE_OFDM, + .frequency_min = 44250000, + .frequency_max = 867250000, + .frequency_stepsize = 250000, + .caps = FE_CAN_INVERSION_AUTO | + FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | + FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | + FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | + FE_CAN_TRANSMISSION_MODE_AUTO | + FE_CAN_GUARD_INTERVAL_AUTO | + FE_CAN_RECOVER | + FE_CAN_HIERARCHY_AUTO, + }, + + .release = smsdvb_release, + + .set_frontend = smsdvb_set_frontend, + .get_frontend = smsdvb_get_frontend, + .get_tune_settings = smsdvb_get_tune_settings, + + .read_status = smsdvb_read_status, + .read_ber = smsdvb_read_ber, + .read_signal_strength = smsdvb_read_signal_strength, + .read_snr = smsdvb_read_snr, +}; + +int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival) +{ + smsclient_params_t params; + smsdvb_client_t* client; + int rc; + + // device removal handled by onremove callback + if (!arrival) + return 0; + + if (smscore_get_device_mode(coredev) != 4) + { + rc = smscore_set_device_mode(coredev, 4); + if (rc < 0) + return rc; + } + + client = kzalloc(sizeof(smsdvb_client_t), GFP_KERNEL); + if (!client) + { + printk(KERN_INFO "%s kmalloc() failed\n", __FUNCTION__); + return -ENOMEM; + } + + // register dvb adapter + rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", THIS_MODULE, device, adapter_nr); + if (rc < 0) + { + printk("%s dvb_register_adapter() failed %d\n", __func__, rc); + goto adapter_error; + } + + // init dvb demux + client->demux.dmx.capabilities = DMX_TS_FILTERING; + client->demux.filternum = 32; // todo: nova ??? + client->demux.feednum = 32; + client->demux.start_feed = smsdvb_start_feed; + client->demux.stop_feed = smsdvb_stop_feed; + + rc = dvb_dmx_init(&client->demux); + if (rc < 0) + { + printk("%s dvb_dmx_init failed %d\n\n", __FUNCTION__, rc); + goto dvbdmx_error; + } + + // init dmxdev + client->dmxdev.filternum = 32; + client->dmxdev.demux = &client->demux.dmx; + client->dmxdev.capabilities = 0; + + rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); + if (rc < 0) + { + printk("%s dvb_dmxdev_init failed %d\n", __FUNCTION__, rc); + goto dmxdev_error; + } + + // init and register frontend + memcpy(&client->frontend.ops, &smsdvb_fe_ops, sizeof(struct dvb_frontend_ops)); + + rc = dvb_register_frontend(&client->adapter, &client->frontend); + if (rc < 0) + { + printk("%s frontend registration failed %d\n", __FUNCTION__, rc); + goto frontend_error; + } + + params.initial_id = 0; + params.data_type = MSG_SMS_DVBT_BDA_DATA; + params.onresponse_handler = smsdvb_onresponse; + params.onremove_handler = smsdvb_onremove; + params.context = client; + + rc = smscore_register_client(coredev, ¶ms, &client->smsclient); + if (rc < 0) + { + printk(KERN_INFO "%s smscore_register_client() failed %d\n", __FUNCTION__, rc); + goto client_error; + } + + client->coredev = coredev; + + init_completion(&client->tune_done); + init_completion(&client->stat_done); + + kmutex_lock(&g_smsdvb_clientslock); + + list_add(&client->entry, &g_smsdvb_clients); + + kmutex_unlock(&g_smsdvb_clientslock); + + printk(KERN_INFO "%s success\n", __FUNCTION__); + + return 0; + +client_error: + dvb_unregister_frontend(&client->frontend); + +frontend_error: + dvb_dmxdev_release(&client->dmxdev); + +dmxdev_error: + dvb_dmx_release(&client->demux); + +dvbdmx_error: + dvb_unregister_adapter(&client->adapter); + +adapter_error: + kfree(client); + return rc; +} + +int smsdvb_register(void) +{ + int rc; + + INIT_LIST_HEAD(&g_smsdvb_clients); + kmutex_init(&g_smsdvb_clientslock); + + rc = smscore_register_hotplug(smsdvb_hotplug); + + printk(KERN_INFO "%s\n", __FUNCTION__); + + return rc; +} + +void smsdvb_unregister(void) +{ + smscore_unregister_hotplug(smsdvb_hotplug); + + kmutex_lock(&g_smsdvb_clientslock); + + while (!list_empty(&g_smsdvb_clients)) + smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next); + + kmutex_unlock(&g_smsdvb_clientslock); + +} + diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c new file mode 100644 index 00000000000..20aa878d9d5 --- /dev/null +++ b/drivers/media/dvb/siano/smsusb.c @@ -0,0 +1,436 @@ +/* + * Driver for the Siano SMS10xx USB dongle + * + * author: Anatoly Greenblat + * + * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation; + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +#include "smscoreapi.h" + +#define USB1_BUFFER_SIZE 0x1000 +#define USB2_BUFFER_SIZE 0x4000 + +#define MAX_BUFFERS 50 +#define MAX_URBS 10 + +typedef struct _smsusb_device smsusb_device_t; + +typedef struct _smsusb_urb +{ + smscore_buffer_t *cb; + smsusb_device_t *dev; + + struct urb urb; +} smsusb_urb_t; + +typedef struct _smsusb_device +{ + struct usb_device* udev; + smscore_device_t *coredev; + + smsusb_urb_t surbs[MAX_URBS]; + + int response_alignment; + int buffer_size; +} *psmsusb_device_t; + +int smsusb_submit_urb(smsusb_device_t* dev, smsusb_urb_t* surb); + +void smsusb_onresponse(struct urb *urb) +{ + smsusb_urb_t *surb = (smsusb_urb_t *) urb->context; + smsusb_device_t *dev = surb->dev; + + if (urb->status < 0) + { + printk(KERN_INFO "%s error, urb status %d, %d bytes\n", __FUNCTION__, urb->status, urb->actual_length); + return; + } + + if (urb->actual_length > 0) + { + SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *) surb->cb->p; + + if (urb->actual_length >= phdr->msgLength) + { + surb->cb->size = phdr->msgLength; + + if (dev->response_alignment && (phdr->msgFlags & MSG_HDR_FLAG_SPLIT_MSG)) + { + surb->cb->offset = dev->response_alignment + ((phdr->msgFlags >> 8) & 3); + + // sanity check + if (((int) phdr->msgLength + surb->cb->offset) > urb->actual_length) + { + printk("%s: invalid response msglen %d offset %d size %d\n", __FUNCTION__, phdr->msgLength, surb->cb->offset, urb->actual_length); + goto exit_and_resubmit; + } + + // move buffer pointer and copy header to its new location + memcpy((char*) phdr + surb->cb->offset, phdr, sizeof(SmsMsgHdr_ST)); + } + else + surb->cb->offset = 0; + + smscore_onresponse(dev->coredev, surb->cb); + surb->cb = NULL; + } + else + { + printk("%s invalid response msglen %d actual %d\n", __FUNCTION__, phdr->msgLength, urb->actual_length); + } + } + +exit_and_resubmit: + smsusb_submit_urb(dev, surb); +} + +int smsusb_submit_urb(smsusb_device_t* dev, smsusb_urb_t* surb) +{ + if (!surb->cb) + { + surb->cb = smscore_getbuffer(dev->coredev); + if (!surb->cb) + { + printk(KERN_INFO "%s smscore_getbuffer(...) returned NULL\n", __FUNCTION__); + return -ENOMEM; + } + } + + usb_fill_bulk_urb( + &surb->urb, + dev->udev, + usb_rcvbulkpipe(dev->udev, 0x81), + surb->cb->p, + dev->buffer_size, + smsusb_onresponse, + surb + ); + surb->urb.transfer_dma = surb->cb->phys; + surb->urb.transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + + return usb_submit_urb(&surb->urb, GFP_ATOMIC); +} + +void smsusb_stop_streaming(smsusb_device_t* dev) +{ + int i; + + for (i = 0; i < MAX_URBS; i ++) + { + usb_kill_urb(&dev->surbs[i].urb); + + if (dev->surbs[i].cb) + { + smscore_putbuffer(dev->coredev, dev->surbs[i].cb); + dev->surbs[i].cb = NULL; + } + } +} + +int smsusb_start_streaming(smsusb_device_t* dev) +{ + int i, rc; + + for (i = 0; i < MAX_URBS; i ++) + { + rc = smsusb_submit_urb(dev, &dev->surbs[i]); + if (rc < 0) + { + printk(KERN_INFO "%s smsusb_submit_urb(...) failed\n", __FUNCTION__); + smsusb_stop_streaming(dev); + break; + } + } + + return rc; +} + +int smsusb_sendrequest(void *context, void *buffer, size_t size) +{ + smsusb_device_t* dev = (smsusb_device_t*) context; + int dummy; + + return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), buffer, size, &dummy, 1000); +} + +char *smsusb1_fw_lkup[] = +{ + "dvbt_stellar_usb.inp", + "dvbh_stellar_usb.inp", + "tdmb_stellar_usb.inp", + "none", + "dvbt_bda_stellar_usb.inp", +}; + +int smsusb1_load_firmware(struct usb_device *udev, int id) +{ + const struct firmware *fw; + u8* fw_buffer; + int rc, dummy; + + if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) + { + printk(KERN_INFO "%s invalid firmware id specified %d\n", __FUNCTION__, id); + return -EINVAL; + } + + rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); + if (rc < 0) + { + printk(KERN_INFO "%s failed to open \"%s\" mode %d\n", __FUNCTION__, smsusb1_fw_lkup[id], id); + return rc; + } + + fw_buffer = kmalloc(fw->size, GFP_KERNEL); + if (fw_buffer) + { + memcpy(fw_buffer, fw->data, fw->size); + + rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), fw_buffer, fw->size, &dummy, 1000); + + printk(KERN_INFO "%s: sent %d(%d) bytes, rc %d\n", __FUNCTION__, fw->size, dummy, rc); + + kfree(fw_buffer); + } + else + { + printk(KERN_INFO "failed to allocate firmware buffer\n"); + rc = -ENOMEM; + } + + release_firmware(fw); + + return rc; +} + +void smsusb1_detectmode(void *context, int *mode) +{ + char *product_string = ((smsusb_device_t *) context)->udev->product; + + *mode = DEVICE_MODE_NONE; + + if (!product_string) + { + product_string = "none"; + printk("%s product string not found\n", __FUNCTION__); + } + else + { + if (strstr(product_string, "DVBH")) + *mode = 1; + else if (strstr(product_string, "BDA")) + *mode = 4; + else if (strstr(product_string, "DVBT")) + *mode = 0; + else if (strstr(product_string, "TDMB")) + *mode = 2; + } + + printk("%s: %d \"%s\"\n", __FUNCTION__, *mode, product_string); +} + +int smsusb1_setmode(void *context, int mode) +{ + SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, sizeof(SmsMsgHdr_ST), 0 }; + + if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) + { + printk(KERN_INFO "%s invalid firmware id specified %d\n", __FUNCTION__, mode); + return -EINVAL; + } + + return smsusb_sendrequest(context, &Msg, sizeof(Msg)); +} + +void smsusb_term_device(struct usb_interface *intf) +{ + smsusb_device_t *dev = (smsusb_device_t*) usb_get_intfdata(intf); + + if (dev) + { + smsusb_stop_streaming(dev); + + // unregister from smscore + if (dev->coredev) + smscore_unregister_device(dev->coredev); + + kfree(dev); + + printk(KERN_INFO "%s device %p destroyed\n", __FUNCTION__, dev); + } + + usb_set_intfdata(intf, NULL); +} + +int smsusb_init_device(struct usb_interface *intf) +{ + smsdevice_params_t params; + smsusb_device_t* dev; + int i, rc; + + // create device object + dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); + if (!dev) + { + printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", __FUNCTION__); + return -ENOMEM; + } + + memset(¶ms, 0, sizeof(params)); + 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; + + default: + 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.device = &dev->udev->dev; + params.buffer_size = dev->buffer_size; + params.num_buffers = MAX_BUFFERS; + params.sendrequest_handler = smsusb_sendrequest; + params.context = dev; + snprintf(params.devpath, sizeof(params.devpath), "usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath); + + // register in smscore + rc = smscore_register_device(¶ms, &dev->coredev); + if (rc < 0) + { + printk(KERN_INFO "%s smscore_register_device(...) failed, rc %d\n", __FUNCTION__, rc); + smsusb_term_device(intf); + return rc; + } + + // initialize urbs + for (i = 0; i < MAX_URBS; i ++) + { + dev->surbs[i].dev = dev; + usb_init_urb(&dev->surbs[i].urb); + } + + rc = smsusb_start_streaming(dev); + if (rc < 0) + { + printk(KERN_INFO "%s smsusb_start_streaming(...) failed\n", __FUNCTION__); + smsusb_term_device(intf); + return rc; + } + + rc = smscore_start_device(dev->coredev); + if (rc < 0) + { + printk(KERN_INFO "%s smscore_start_device(...) failed\n", __FUNCTION__); + smsusb_term_device(intf); + return rc; + } + + printk(KERN_INFO "%s device %p created\n", __FUNCTION__, dev); + + return rc; +} + +int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) +{ + struct usb_device *udev = interface_to_usbdev(intf); + char devpath[32]; + int i, rc; + + if (intf->num_altsetting > 0) + { + rc = usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); + if (rc < 0) + { + printk(KERN_INFO "%s usb_set_interface failed, rc %d\n", __FUNCTION__, rc); + return rc; + } + } + + printk(KERN_INFO "smsusb_probe %d\n", intf->cur_altsetting->desc.bInterfaceNumber); + for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++) + printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, intf->cur_altsetting->endpoint[i].desc.bmAttributes, intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); + + if (udev->actconfig->desc.bNumInterfaces == 2 && intf->cur_altsetting->desc.bInterfaceNumber == 0) + { + printk(KERN_INFO "rom interface 0 is not used\n"); + return -ENODEV; + } + + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) + { + snprintf(devpath, 32, "%d:%s", udev->bus->busnum, udev->devpath); + return smsusb1_load_firmware(udev, smscore_registry_getmode(devpath)); + } + + return smsusb_init_device(intf); +} + +void smsusb_disconnect(struct usb_interface *intf) +{ + smsusb_term_device(intf); +} + +static struct usb_device_id smsusb_id_table [] = { + { USB_DEVICE(0x187F, 0x0010) }, + { USB_DEVICE(0x187F, 0x0100) }, + { USB_DEVICE(0x187F, 0x0200) }, + { } /* Terminating entry */ +}; +MODULE_DEVICE_TABLE (usb, smsusb_id_table); + +static struct usb_driver smsusb_driver = { + .name = "smsusb", + .probe = smsusb_probe, + .disconnect = smsusb_disconnect, + .id_table = smsusb_id_table, +}; + +int smsusb_register(void) +{ + int rc = usb_register(&smsusb_driver); + if (rc) + printk(KERN_INFO "usb_register failed. Error number %d\n", rc); + + printk(KERN_INFO "%s\n", __FUNCTION__); + + return rc; +} + +void smsusb_unregister(void) +{ + /* Regular USB Cleanup */ + usb_deregister(&smsusb_driver); + printk(KERN_INFO "%s\n", __FUNCTION__); +} + -- cgit v1.2.3 From 18658117ff844e8117f6b363cb7fa8c5f8ad2cb8 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 22 May 2008 18:30:17 -0300 Subject: V4L/DVB (8273): sms1xxx: replace __FUNCTION__ with __func__ Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 56 ++++++++++++++++++------------------ drivers/media/dvb/siano/smsdvb.c | 24 ++++++++-------- drivers/media/dvb/siano/smsusb.c | 40 +++++++++++++------------- 3 files changed, 60 insertions(+), 60 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index d3ba1fcde54..e55138e6627 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -285,7 +285,7 @@ smscore_buffer_t *smscore_createbuffer(u8* buffer, void* common_buffer, dma_addr smscore_buffer_t *cb = kmalloc(sizeof(smscore_buffer_t), GFP_KERNEL); if (!cb) { - printk(KERN_INFO "%s kmalloc(...) failed\n", __FUNCTION__); + printk(KERN_INFO "%s kmalloc(...) failed\n", __func__); return NULL; } @@ -313,7 +313,7 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored dev = kzalloc(sizeof(smscore_device_t), GFP_KERNEL); if (!dev) { - printk(KERN_INFO "%s kzalloc(...) failed\n", __FUNCTION__); + printk(KERN_INFO "%s kzalloc(...) failed\n", __func__); return -ENOMEM; } @@ -359,7 +359,7 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored smscore_putbuffer(dev, cb); } - printk(KERN_INFO "%s allocated %d buffers\n", __FUNCTION__, dev->num_buffers); + printk(KERN_INFO "%s allocated %d buffers\n", __func__, dev->num_buffers); dev->mode = DEVICE_MODE_NONE; dev->context = params->context; @@ -380,7 +380,7 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored *coredev = dev; - printk(KERN_INFO "%s device %p created\n", __FUNCTION__, dev); + printk(KERN_INFO "%s device %p created\n", __func__, dev); return 0; } @@ -402,7 +402,7 @@ int smscore_start_device(smscore_device_t *coredev) rc = smscore_notify_callbacks(coredev, coredev->device, 1); - printk(KERN_INFO "%s device %p started, rc %d\n", __FUNCTION__, coredev, rc); + printk(KERN_INFO "%s device %p started, rc %d\n", __func__, coredev, rc); kmutex_unlock(&g_smscore_deviceslock); @@ -526,7 +526,7 @@ int smscore_load_firmware(smscore_device_t *coredev, char* filename, loadfirmwar rc = request_firmware(&fw, filename, coredev->device); if (rc < 0) { - printk(KERN_INFO "%s failed to open \"%s\"\n", __FUNCTION__, filename); + printk(KERN_INFO "%s failed to open \"%s\"\n", __func__, filename); return rc; } @@ -543,7 +543,7 @@ int smscore_load_firmware(smscore_device_t *coredev, char* filename, loadfirmwar } else { - printk(KERN_INFO "%s failed to allocate firmware buffer\n", __FUNCTION__); + printk(KERN_INFO "%s failed to allocate firmware buffer\n", __func__); rc = -ENOMEM; } @@ -583,11 +583,11 @@ void smscore_unregister_device(smscore_device_t *coredev) if (num_buffers == coredev->num_buffers) break; - printk(KERN_INFO "%s waiting for %d buffer(s)\n", __FUNCTION__, coredev->num_buffers - num_buffers); + printk(KERN_INFO "%s waiting for %d buffer(s)\n", __func__, coredev->num_buffers - num_buffers); msleep(100); } - printk(KERN_INFO "%s freed %d buffers\n", __FUNCTION__, num_buffers); + printk(KERN_INFO "%s freed %d buffers\n", __func__, num_buffers); if (coredev->common_buffer) dma_free_coherent(NULL, coredev->common_buffer_size, coredev->common_buffer, coredev->common_buffer_phys); @@ -597,7 +597,7 @@ void smscore_unregister_device(smscore_device_t *coredev) kmutex_unlock(&g_smscore_deviceslock); - printk(KERN_INFO "%s device %p destroyed\n", __FUNCTION__, coredev); + printk(KERN_INFO "%s device %p destroyed\n", __func__, coredev); } int smscore_detect_mode(smscore_device_t *coredev) @@ -614,14 +614,14 @@ int smscore_detect_mode(smscore_device_t *coredev) rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc == -ETIME) { - printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", __FUNCTION__); + printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", __func__); if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) { rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc < 0) { - printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d\n", __FUNCTION__, rc); + printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d\n", __func__, rc); } } else @@ -664,7 +664,7 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) { - printk(KERN_INFO "%s invalid mode specified %d\n", __FUNCTION__, mode); + printk(KERN_INFO "%s invalid mode specified %d\n", __func__, mode); return -EINVAL; } @@ -677,7 +677,7 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) if (coredev->mode == mode) { - printk(KERN_INFO "%s device mode %d already set\n", __FUNCTION__, mode); + printk(KERN_INFO "%s device mode %d already set\n", __func__, mode); return 0; } @@ -689,7 +689,7 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) } else { - printk(KERN_INFO "%s mode %d supported by running firmware\n", __FUNCTION__, mode); + printk(KERN_INFO "%s mode %d supported by running firmware\n", __func__, mode); } buffer = kmalloc(sizeof(SmsMsgData_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); @@ -834,7 +834,7 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) case MSG_SMS_GET_VERSION_EX_RES: { SmsVersionRes_ST *ver = (SmsVersionRes_ST*) phdr; - printk("%s: MSG_SMS_GET_VERSION_EX_RES id %d prots 0x%x ver %d.%d\n", __FUNCTION__, ver->FirmwareId, ver->SupportedProtocols, ver->RomVersionMajor, ver->RomVersionMinor); + printk("%s: MSG_SMS_GET_VERSION_EX_RES id %d prots 0x%x ver %d.%d\n", __func__, ver->FirmwareId, ver->SupportedProtocols, ver->RomVersionMajor, ver->RomVersionMinor); coredev->mode = ver->FirmwareId == 255 ? DEVICE_MODE_NONE : ver->FirmwareId; coredev->modes_supported = ver->SupportedProtocols; @@ -844,12 +844,12 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) } case MSG_SMS_INIT_DEVICE_RES: - printk("%s: MSG_SMS_INIT_DEVICE_RES\n", __FUNCTION__); + printk("%s: MSG_SMS_INIT_DEVICE_RES\n", __func__); complete(&coredev->init_device_done); break; case MSG_SW_RELOAD_START_RES: - printk("%s: MSG_SW_RELOAD_START_RES\n", __FUNCTION__); + printk("%s: MSG_SW_RELOAD_START_RES\n", __func__); complete(&coredev->reload_start_done); break; @@ -858,11 +858,11 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) break; case MSG_SW_RELOAD_EXEC_RES: - printk("%s: MSG_SW_RELOAD_EXEC_RES\n", __FUNCTION__); + printk("%s: MSG_SW_RELOAD_EXEC_RES\n", __func__); break; case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: - printk("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", __FUNCTION__); + printk("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", __func__); complete(&coredev->trigger_done); break; @@ -871,7 +871,7 @@ 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", __FUNCTION__, 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); } smscore_putbuffer(coredev, cb); @@ -986,7 +986,7 @@ int smscore_register_client(smscore_device_t *coredev, smsclient_params_t *param *client = newclient; - printk(KERN_INFO "%s %p %d %d\n", __FUNCTION__, params->context, params->data_type, params->initial_id); + printk(KERN_INFO "%s %p %d %d\n", __func__, params->context, params->data_type, params->initial_id); return 0; } @@ -1019,7 +1019,7 @@ void smscore_unregister_client(smscore_client_t *client) } } - printk(KERN_INFO "%s %p %d\n", __FUNCTION__, client->context, client->data_type); + printk(KERN_INFO "%s %p %d\n", __func__, client->context, client->data_type); list_del(&client->entry); kfree(client); @@ -1076,19 +1076,19 @@ int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || (vma->vm_flags & VM_WRITE)) { - printk(KERN_INFO "%s invalid vm flags\n", __FUNCTION__); + printk(KERN_INFO "%s invalid vm flags\n", __func__); return -EINVAL; } if ((end - start) != size) { - printk(KERN_INFO "%s invalid size %d expected %d\n", __FUNCTION__, (int)(end - start), (int) size); + printk(KERN_INFO "%s invalid size %d expected %d\n", __func__, (int)(end - start), (int) size); return -EINVAL; } if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, size, pgprot_noncached(vma->vm_page_prot))) { - printk(KERN_INFO "%s remap_page_range failed\n", __FUNCTION__); + printk(KERN_INFO "%s remap_page_range failed\n", __func__); return -EAGAIN; } @@ -1112,7 +1112,7 @@ int smscore_module_init(void) /* DVB Register */ rc = smsdvb_register(); - printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc); + printk(KERN_INFO "%s, rc %d\n", __func__, rc); return rc; } @@ -1146,7 +1146,7 @@ void smscore_module_exit(void) /* Unregister USB */ smsusb_unregister(); - printk(KERN_INFO "%s\n", __FUNCTION__); + printk(KERN_INFO "%s\n", __func__); } module_init(smscore_module_init); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index e1a14a812c2..1a75033c35d 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -107,7 +107,7 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed) smsdvb_client_t *client = container_of(feed->demux, smsdvb_client_t, demux); SmsMsgData_ST PidMsg; - printk("%s add pid %d(%x)\n", __FUNCTION__, feed->pid, feed->pid); + printk("%s add pid %d(%x)\n", __func__, feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; PidMsg.xMsgHeader.msgDstId = HIF_TASK; @@ -124,7 +124,7 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) smsdvb_client_t *client = container_of(feed->demux, smsdvb_client_t, demux); SmsMsgData_ST PidMsg; - printk("%s remove pid %d(%x)\n", __FUNCTION__, feed->pid, feed->pid); + printk("%s remove pid %d(%x)\n", __func__, feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; PidMsg.xMsgHeader.msgDstId = HIF_TASK; @@ -197,7 +197,7 @@ static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) { - printk("%s\n", __FUNCTION__); + printk("%s\n", __func__); tune->min_delay_ms = 400; tune->step_size = 250000; @@ -223,7 +223,7 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_para Msg.Data[0] = fep->frequency; Msg.Data[2] = 12000000; - printk("%s freq %d band %d\n", __FUNCTION__, fep->frequency, fep->u.ofdm.bandwidth); + printk("%s freq %d band %d\n", __func__, fep->frequency, fep->u.ofdm.bandwidth); switch(fep->u.ofdm.bandwidth) { @@ -242,7 +242,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_para { smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); - printk("%s\n", __FUNCTION__); + printk("%s\n", __func__); // todo: memcpy(fep, &client->fe_params, sizeof(struct dvb_frontend_parameters)); @@ -303,7 +303,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival client = kzalloc(sizeof(smsdvb_client_t), GFP_KERNEL); if (!client) { - printk(KERN_INFO "%s kmalloc() failed\n", __FUNCTION__); + printk(KERN_INFO "%s kmalloc() failed\n", __func__); return -ENOMEM; } @@ -325,7 +325,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival rc = dvb_dmx_init(&client->demux); if (rc < 0) { - printk("%s dvb_dmx_init failed %d\n\n", __FUNCTION__, rc); + printk("%s dvb_dmx_init failed %d\n\n", __func__, rc); goto dvbdmx_error; } @@ -337,7 +337,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); if (rc < 0) { - printk("%s dvb_dmxdev_init failed %d\n", __FUNCTION__, rc); + printk("%s dvb_dmxdev_init failed %d\n", __func__, rc); goto dmxdev_error; } @@ -347,7 +347,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival rc = dvb_register_frontend(&client->adapter, &client->frontend); if (rc < 0) { - printk("%s frontend registration failed %d\n", __FUNCTION__, rc); + printk("%s frontend registration failed %d\n", __func__, rc); goto frontend_error; } @@ -360,7 +360,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival rc = smscore_register_client(coredev, ¶ms, &client->smsclient); if (rc < 0) { - printk(KERN_INFO "%s smscore_register_client() failed %d\n", __FUNCTION__, rc); + printk(KERN_INFO "%s smscore_register_client() failed %d\n", __func__, rc); goto client_error; } @@ -375,7 +375,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival kmutex_unlock(&g_smsdvb_clientslock); - printk(KERN_INFO "%s success\n", __FUNCTION__); + printk(KERN_INFO "%s success\n", __func__); return 0; @@ -405,7 +405,7 @@ int smsdvb_register(void) rc = smscore_register_hotplug(smsdvb_hotplug); - printk(KERN_INFO "%s\n", __FUNCTION__); + printk(KERN_INFO "%s\n", __func__); return rc; } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 20aa878d9d5..e15f0342d06 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -62,7 +62,7 @@ void smsusb_onresponse(struct urb *urb) if (urb->status < 0) { - printk(KERN_INFO "%s error, urb status %d, %d bytes\n", __FUNCTION__, urb->status, urb->actual_length); + printk(KERN_INFO "%s error, urb status %d, %d bytes\n", __func__, urb->status, urb->actual_length); return; } @@ -81,7 +81,7 @@ void smsusb_onresponse(struct urb *urb) // sanity check if (((int) phdr->msgLength + surb->cb->offset) > urb->actual_length) { - printk("%s: invalid response msglen %d offset %d size %d\n", __FUNCTION__, phdr->msgLength, surb->cb->offset, urb->actual_length); + printk("%s: invalid response msglen %d offset %d size %d\n", __func__, phdr->msgLength, surb->cb->offset, urb->actual_length); goto exit_and_resubmit; } @@ -96,7 +96,7 @@ void smsusb_onresponse(struct urb *urb) } else { - printk("%s invalid response msglen %d actual %d\n", __FUNCTION__, phdr->msgLength, urb->actual_length); + printk("%s invalid response msglen %d actual %d\n", __func__, phdr->msgLength, urb->actual_length); } } @@ -111,7 +111,7 @@ int smsusb_submit_urb(smsusb_device_t* dev, smsusb_urb_t* surb) surb->cb = smscore_getbuffer(dev->coredev); if (!surb->cb) { - printk(KERN_INFO "%s smscore_getbuffer(...) returned NULL\n", __FUNCTION__); + printk(KERN_INFO "%s smscore_getbuffer(...) returned NULL\n", __func__); return -ENOMEM; } } @@ -156,7 +156,7 @@ int smsusb_start_streaming(smsusb_device_t* dev) rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { - printk(KERN_INFO "%s smsusb_submit_urb(...) failed\n", __FUNCTION__); + printk(KERN_INFO "%s smsusb_submit_urb(...) failed\n", __func__); smsusb_stop_streaming(dev); break; } @@ -190,14 +190,14 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { - printk(KERN_INFO "%s invalid firmware id specified %d\n", __FUNCTION__, id); + printk(KERN_INFO "%s invalid firmware id specified %d\n", __func__, id); return -EINVAL; } rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); if (rc < 0) { - printk(KERN_INFO "%s failed to open \"%s\" mode %d\n", __FUNCTION__, smsusb1_fw_lkup[id], id); + printk(KERN_INFO "%s failed to open \"%s\" mode %d\n", __func__, smsusb1_fw_lkup[id], id); return rc; } @@ -208,7 +208,7 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), fw_buffer, fw->size, &dummy, 1000); - printk(KERN_INFO "%s: sent %d(%d) bytes, rc %d\n", __FUNCTION__, fw->size, dummy, rc); + printk(KERN_INFO "%s: sent %d(%d) bytes, rc %d\n", __func__, fw->size, dummy, rc); kfree(fw_buffer); } @@ -232,7 +232,7 @@ void smsusb1_detectmode(void *context, int *mode) if (!product_string) { product_string = "none"; - printk("%s product string not found\n", __FUNCTION__); + printk("%s product string not found\n", __func__); } else { @@ -246,7 +246,7 @@ void smsusb1_detectmode(void *context, int *mode) *mode = 2; } - printk("%s: %d \"%s\"\n", __FUNCTION__, *mode, product_string); + printk("%s: %d \"%s\"\n", __func__, *mode, product_string); } int smsusb1_setmode(void *context, int mode) @@ -255,7 +255,7 @@ int smsusb1_setmode(void *context, int mode) if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { - printk(KERN_INFO "%s invalid firmware id specified %d\n", __FUNCTION__, mode); + printk(KERN_INFO "%s invalid firmware id specified %d\n", __func__, mode); return -EINVAL; } @@ -276,7 +276,7 @@ void smsusb_term_device(struct usb_interface *intf) kfree(dev); - printk(KERN_INFO "%s device %p destroyed\n", __FUNCTION__, dev); + printk(KERN_INFO "%s device %p destroyed\n", __func__, dev); } usb_set_intfdata(intf, NULL); @@ -292,7 +292,7 @@ int smsusb_init_device(struct usb_interface *intf) dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); if (!dev) { - printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", __FUNCTION__); + printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", __func__); return -ENOMEM; } @@ -328,7 +328,7 @@ int smsusb_init_device(struct usb_interface *intf) rc = smscore_register_device(¶ms, &dev->coredev); if (rc < 0) { - printk(KERN_INFO "%s smscore_register_device(...) failed, rc %d\n", __FUNCTION__, rc); + printk(KERN_INFO "%s smscore_register_device(...) failed, rc %d\n", __func__, rc); smsusb_term_device(intf); return rc; } @@ -343,7 +343,7 @@ int smsusb_init_device(struct usb_interface *intf) rc = smsusb_start_streaming(dev); if (rc < 0) { - printk(KERN_INFO "%s smsusb_start_streaming(...) failed\n", __FUNCTION__); + printk(KERN_INFO "%s smsusb_start_streaming(...) failed\n", __func__); smsusb_term_device(intf); return rc; } @@ -351,12 +351,12 @@ int smsusb_init_device(struct usb_interface *intf) rc = smscore_start_device(dev->coredev); if (rc < 0) { - printk(KERN_INFO "%s smscore_start_device(...) failed\n", __FUNCTION__); + printk(KERN_INFO "%s smscore_start_device(...) failed\n", __func__); smsusb_term_device(intf); return rc; } - printk(KERN_INFO "%s device %p created\n", __FUNCTION__, dev); + printk(KERN_INFO "%s device %p created\n", __func__, dev); return rc; } @@ -372,7 +372,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) rc = usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); if (rc < 0) { - printk(KERN_INFO "%s usb_set_interface failed, rc %d\n", __FUNCTION__, rc); + printk(KERN_INFO "%s usb_set_interface failed, rc %d\n", __func__, rc); return rc; } } @@ -422,7 +422,7 @@ int smsusb_register(void) if (rc) printk(KERN_INFO "usb_register failed. Error number %d\n", rc); - printk(KERN_INFO "%s\n", __FUNCTION__); + printk(KERN_INFO "%s\n", __func__); return rc; } @@ -431,6 +431,6 @@ void smsusb_unregister(void) { /* Regular USB Cleanup */ usb_deregister(&smsusb_driver); - printk(KERN_INFO "%s\n", __FUNCTION__); + printk(KERN_INFO "%s\n", __func__); } -- cgit v1.2.3 From a83ccdd6a952eb25d3f51dfdc175c1e9bf8f7cae Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 6 May 2008 03:11:51 -0300 Subject: V4L/DVB (8275): sms1xxx: codingstyle cleanup: "foo* bar"/"foo * bar" should be "foo *bar" ERROR: "foo* bar" should be "foo *bar" ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 39 +++++++++++++++++++++--------------- drivers/media/dvb/siano/smscoreapi.h | 10 ++++++--- drivers/media/dvb/siano/smsdvb.c | 11 ++++++---- drivers/media/dvb/siano/smsusb.c | 16 +++++++-------- 4 files changed, 45 insertions(+), 31 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index e55138e6627..86a4b5de5e1 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -112,7 +112,7 @@ 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) +int smscore_registry_getmode(char *devpath) { smscore_registry_entry_t *entry; struct list_head *next; @@ -144,7 +144,7 @@ int smscore_registry_getmode(char* devpath) return default_mode; } -void smscore_registry_setmode(char* devpath, int mode) +void smscore_registry_setmode(char *devpath, int mode) { smscore_registry_entry_t *entry; struct list_head *next; @@ -166,7 +166,8 @@ void smscore_registry_setmode(char* devpath, int mode) } -void list_add_locked(struct list_head *new, struct list_head *head, spinlock_t* lock) +void list_add_locked(struct list_head *new, struct list_head *head, + spinlock_t *lock) { unsigned long flags; @@ -251,7 +252,7 @@ void smscore_unregister_hotplug(hotplug_t hotplug) void smscore_notify_clients(smscore_device_t *coredev) { - smscore_client_t* client; + smscore_client_t *client; // the client must call smscore_unregister_client from remove handler while (!list_empty(&coredev->clients)) @@ -280,7 +281,8 @@ int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, i return rc; } -smscore_buffer_t *smscore_createbuffer(u8* buffer, void* common_buffer, dma_addr_t common_buffer_phys) +smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, + dma_addr_t common_buffer_phys) { smscore_buffer_t *cb = kmalloc(sizeof(smscore_buffer_t), GFP_KERNEL); if (!cb) @@ -307,7 +309,7 @@ smscore_buffer_t *smscore_createbuffer(u8* buffer, void* common_buffer, dma_addr */ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev) { - smscore_device_t* dev; + smscore_device_t *dev; u8 *buffer; dev = kzalloc(sizeof(smscore_device_t), GFP_KERNEL); @@ -409,7 +411,8 @@ int smscore_start_device(smscore_device_t *coredev) return rc; } -int smscore_sendrequest_and_wait(smscore_device_t *coredev, void* buffer, size_t size, struct completion *completion) +int smscore_sendrequest_and_wait(smscore_device_t *coredev, void *buffer, + size_t size, struct completion *completion) { int rc = coredev->sendrequest_handler(coredev->context, buffer, size); if (rc < 0) @@ -423,7 +426,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ SmsFirmware_ST* firmware = (SmsFirmware_ST*) buffer; SmsMsgHdr_ST *msg; UINT32 mem_address = firmware->StartAddress; - u8* payload = firmware->Payload; + u8 *payload = firmware->Payload; int rc = 0; if (coredev->preload_handler) @@ -513,12 +516,13 @@ 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(smscore_device_t *coredev, char *filename, + loadfirmware_t loadfirmware_handler) { int rc = -ENOENT; const struct firmware *fw; - u8* fw_buffer; + u8 *fw_buffer; if (loadfirmware_handler == NULL && !(coredev->device_flags & SMS_DEVICE_FAMILY2)) return -EINVAL; @@ -739,7 +743,8 @@ 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) +smscore_client_t *smscore_getclient_by_type(smscore_device_t *coredev, + int data_type) { smscore_client_t *client = NULL; struct list_head *next, *first; @@ -766,7 +771,7 @@ smscore_client_t* smscore_getclient_by_type(smscore_device_t *coredev, int data_ return client; } -smscore_client_t* smscore_getclient_by_id(smscore_device_t *coredev, int id) +smscore_client_t *smscore_getclient_by_id(smscore_device_t *coredev, int id) { smscore_client_t *client = NULL; struct list_head *next, *first; @@ -801,7 +806,8 @@ 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_getclient_by_type(coredev, + phdr->msgType); int rc = -EBUSY; static unsigned long last_sample_time = 0; @@ -957,7 +963,7 @@ 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; + smscore_client_t *newclient; int rc; // check that no other channel with same data type exists @@ -1039,7 +1045,7 @@ 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 = client->coredev; SmsMsgHdr_ST* phdr = (SmsMsgHdr_ST*) buffer; // check that no other channel with same id exists @@ -1070,7 +1076,8 @@ int smscore_get_common_buffer_size(smscore_device_t *coredev) * * @return 0 on success, <0 on error. */ -int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma) +int smscore_map_common_buffer(smscore_device_t *coredev, + struct vm_area_struct *vma) { unsigned long end = vma->vm_end, start = vma->vm_start, size = PAGE_ALIGN(coredev->common_buffer_size); diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 679487df8a5..e44507417d2 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -503,19 +503,23 @@ extern int smscore_register_device(smsdevice_params_t *params, smscore_device_t extern void smscore_unregister_device(smscore_device_t *coredev); 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(smscore_device_t *coredev, char *filename, + loadfirmware_t loadfirmware_handler); extern int smscore_set_device_mode(smscore_device_t *coredev, int mode); extern int smscore_get_device_mode(smscore_device_t *coredev); -extern int smscore_register_client(smscore_device_t *coredev, smsclient_params_t* params, smscore_client_t **client); +extern int smscore_register_client(smscore_device_t *coredev, + smsclient_params_t *params, + smscore_client_t **client); extern void smscore_unregister_client(smscore_client_t *client); extern int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size); extern void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb); extern int smscore_get_common_buffer_size(smscore_device_t *coredev); -extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma); +extern int smscore_map_common_buffer(smscore_device_t *coredev, + struct vm_area_struct *vma); extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 1a75033c35d..717e0e97fd1 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -79,7 +79,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) return 0; } -void smsdvb_unregister_client(smsdvb_client_t* client) +void smsdvb_unregister_client(smsdvb_client_t *client) { // must be called under clientslock @@ -136,7 +136,9 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) return smsclient_sendrequest(client->smsclient, &PidMsg, sizeof(PidMsg)); } -static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, void* buffer, size_t size, struct completion *completion) +static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, + void *buffer, size_t size, + struct completion *completion) { int rc = smsclient_sendrequest(client->smsclient, buffer, size); if (rc < 0) @@ -283,10 +285,11 @@ static struct dvb_frontend_ops smsdvb_fe_ops = { .read_snr = smsdvb_read_snr, }; -int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival) +int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, + int arrival) { smsclient_params_t params; - smsdvb_client_t* client; + smsdvb_client_t *client; int rc; // device removal handled by onremove callback diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index e15f0342d06..87dda39a798 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -44,7 +44,7 @@ typedef struct _smsusb_urb typedef struct _smsusb_device { - struct usb_device* udev; + struct usb_device *udev; smscore_device_t *coredev; smsusb_urb_t surbs[MAX_URBS]; @@ -53,7 +53,7 @@ typedef struct _smsusb_device int buffer_size; } *psmsusb_device_t; -int smsusb_submit_urb(smsusb_device_t* dev, smsusb_urb_t* surb); +int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb); void smsusb_onresponse(struct urb *urb) { @@ -104,7 +104,7 @@ exit_and_resubmit: smsusb_submit_urb(dev, surb); } -int smsusb_submit_urb(smsusb_device_t* dev, smsusb_urb_t* surb) +int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb) { if (!surb->cb) { @@ -131,7 +131,7 @@ int smsusb_submit_urb(smsusb_device_t* dev, smsusb_urb_t* surb) return usb_submit_urb(&surb->urb, GFP_ATOMIC); } -void smsusb_stop_streaming(smsusb_device_t* dev) +void smsusb_stop_streaming(smsusb_device_t *dev) { int i; @@ -147,7 +147,7 @@ void smsusb_stop_streaming(smsusb_device_t* dev) } } -int smsusb_start_streaming(smsusb_device_t* dev) +int smsusb_start_streaming(smsusb_device_t *dev) { int i, rc; @@ -167,7 +167,7 @@ int smsusb_start_streaming(smsusb_device_t* dev) int smsusb_sendrequest(void *context, void *buffer, size_t size) { - smsusb_device_t* dev = (smsusb_device_t*) context; + smsusb_device_t *dev = (smsusb_device_t *) context; int dummy; return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), buffer, size, &dummy, 1000); @@ -185,7 +185,7 @@ char *smsusb1_fw_lkup[] = int smsusb1_load_firmware(struct usb_device *udev, int id) { const struct firmware *fw; - u8* fw_buffer; + u8 *fw_buffer; int rc, dummy; if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) @@ -285,7 +285,7 @@ void smsusb_term_device(struct usb_interface *intf) int smsusb_init_device(struct usb_interface *intf) { smsdevice_params_t params; - smsusb_device_t* dev; + smsusb_device_t *dev; int i, rc; // create device object -- cgit v1.2.3 From 55ad310c2f21281f50fa040b7765a4a1151bd420 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 6 May 2008 03:52:44 -0300 Subject: V4L/DVB (8276): sms1xxx: codingstyle cleanup: "(foo*)" should be "(foo *)" ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smsdvb.c | 12 +++++++----- drivers/media/dvb/siano/smsusb.c | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 717e0e97fd1..6975e7c61f8 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -32,12 +32,13 @@ kmutex_t g_smsdvb_clientslock; int smsdvb_onresponse(void *context, smscore_buffer_t *cb) { smsdvb_client_t *client = (smsdvb_client_t *) context; - SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8*) cb->p) + cb->offset); + SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); switch(phdr->msgType) { case MSG_SMS_DVBT_BDA_DATA: - dvb_dmx_swfilter(&client->demux, (u8*)(phdr + 1), cb->size - sizeof(SmsMsgHdr_ST)); + dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), + cb->size - sizeof(SmsMsgHdr_ST)); break; case MSG_SMS_RF_TUNE_RES: @@ -46,7 +47,8 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) case MSG_SMS_GET_STATISTICS_RES: { - SmsMsgStatisticsInfo_ST* p = (SmsMsgStatisticsInfo_ST*)(phdr + 1); + SmsMsgStatisticsInfo_ST *p = + (SmsMsgStatisticsInfo_ST *)(phdr + 1); if (p->Stat.IsDemodLocked) { @@ -97,7 +99,7 @@ void smsdvb_onremove(void *context) { kmutex_lock(&g_smsdvb_clientslock); - smsdvb_unregister_client((smsdvb_client_t*) context); + smsdvb_unregister_client((smsdvb_client_t *) context); kmutex_unlock(&g_smsdvb_clientslock); } @@ -420,7 +422,7 @@ void smsdvb_unregister(void) kmutex_lock(&g_smsdvb_clientslock); while (!list_empty(&g_smsdvb_clients)) - smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next); + smsdvb_unregister_client((smsdvb_client_t *) g_smsdvb_clients.next); kmutex_unlock(&g_smsdvb_clientslock); diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 87dda39a798..1677f859150 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -86,7 +86,8 @@ void smsusb_onresponse(struct urb *urb) } // move buffer pointer and copy header to its new location - memcpy((char*) phdr + surb->cb->offset, phdr, sizeof(SmsMsgHdr_ST)); + memcpy((char *) phdr + surb->cb->offset, + phdr, sizeof(SmsMsgHdr_ST)); } else surb->cb->offset = 0; @@ -264,7 +265,7 @@ int smsusb1_setmode(void *context, int mode) void smsusb_term_device(struct usb_interface *intf) { - smsusb_device_t *dev = (smsusb_device_t*) usb_get_intfdata(intf); + smsusb_device_t *dev = (smsusb_device_t *) usb_get_intfdata(intf); if (dev) { -- cgit v1.2.3 From f17407a85db3b86526d54e65698348873a6df617 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 14 Jun 2008 00:43:26 -0300 Subject: V4L/DVB (8277): sms1xxx: update latest siano drop to 1.2.17 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 363 ++++++++++++++++++++++------------- drivers/media/dvb/siano/smscoreapi.h | 11 ++ drivers/media/dvb/siano/smsdvb.c | 7 +- drivers/media/dvb/siano/smsusb.c | 48 +++-- 4 files changed, 273 insertions(+), 156 deletions(-) (limited to 'drivers/media/dvb/siano') 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) -- cgit v1.2.3 From 494d24c527e5ab43aecb8e77bfdc7e939466b134 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 14 Jun 2008 07:40:41 -0300 Subject: V4L/DVB (8278): sms1xxx: more codingstyle cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 8 ++++---- drivers/media/dvb/siano/smscoreapi.h | 2 +- drivers/media/dvb/siano/smsusb.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 76fa0f50775..41c63e5622d 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -347,7 +347,7 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, } cb->p = buffer; - cb->offset_in_common = buffer - (u8*) common_buffer; + cb->offset_in_common = buffer - (u8 *) common_buffer; cb->phys = common_buffer_phys + cb->offset_in_common; return cb; @@ -620,7 +620,7 @@ int smscore_load_firmware_from_file(smscore_device_t *coredev, char *filename, l return rc; } -int smscore_load_firmware_from_buffer(smscore_device_t *coredev, u8* buffer, int size, int new_mode) +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; @@ -888,7 +888,7 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, */ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) { - SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)((u8*) cb->p + cb->offset); + SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)((u8 *) cb->p + cb->offset); smscore_client_t *client = smscore_find_client(coredev, phdr->msgType, phdr->msgDstId); int rc = -EBUSY; @@ -1120,7 +1120,7 @@ void smscore_unregister_client(smscore_client_t *client) int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size) { smscore_device_t *coredev; - SmsMsgHdr_ST* phdr = (SmsMsgHdr_ST*) buffer; + SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *) buffer; int rc; if ( client == NULL ) diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index c0a3be2fae7..601bdb8304d 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -515,7 +515,7 @@ 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_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/smsusb.c b/drivers/media/dvb/siano/smsusb.c index f719b72424d..02528f12ecf 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -313,13 +313,13 @@ int smsusb_init_device(struct usb_interface *intf) default: if (dev->udev->descriptor.idProduct == 0x200) { params.device_type = SMS_NOVA_A0; - printk(KERN_INFO "%s nova A0 found\n", __FUNCTION__ ); + printk(KERN_INFO "%s nova A0 found\n", __func__ ); } else if (dev->udev->descriptor.idProduct == 0x201) { params.device_type = SMS_NOVA_B0; - printk(KERN_INFO "%s nova B0 found\n", __FUNCTION__); + printk(KERN_INFO "%s nova B0 found\n", __func__); } else { params.device_type = SMS_VEGA; - printk(KERN_INFO "%s Vega found\n", __FUNCTION__); + printk(KERN_INFO "%s Vega found\n", __func__); } dev->buffer_size = USB2_BUFFER_SIZE; @@ -411,7 +411,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) } rc = smsusb_init_device(intf); - printk(KERN_INFO "%s rc %d\n", __FUNCTION__, rc); + printk(KERN_INFO "%s rc %d\n", __func__, rc); return rc; } -- cgit v1.2.3 From 73104fb3e4e692cb1f9505b548ab073b0859b256 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 14 Jun 2008 18:27:18 -0300 Subject: V4L/DVB (8279): sms1xxx: #define usb vid:pid's Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smsusb.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 02528f12ecf..ca9bb36544c 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -32,6 +32,14 @@ #define MAX_BUFFERS 50 #define MAX_URBS 10 +/* TO DO: move these to a header file */ +#define USB_VID_SIANO 0x187f + +#define USB_PID_STELLAR 0x0100 +#define USB_PID_NOVA_A 0x0200 +#define USB_PID_NOVA_B 0x0201 +#define USB_PID_VEGA 0x0300 + typedef struct _smsusb_device smsusb_device_t; typedef struct _smsusb_urb @@ -302,7 +310,8 @@ int smsusb_init_device(struct usb_interface *intf) dev->udev = interface_to_usbdev(intf); switch (dev->udev->descriptor.idProduct) { - case 0x100: + + case USB_PID_STELLAR: dev->buffer_size = USB1_BUFFER_SIZE; params.setmode_handler = smsusb1_setmode; @@ -311,13 +320,17 @@ int smsusb_init_device(struct usb_interface *intf) printk(KERN_INFO "%s stellar device found\n", __func__ ); break; default: - if (dev->udev->descriptor.idProduct == 0x200) { + switch (dev->udev->descriptor.idProduct) { + case USB_PID_NOVA_A: params.device_type = SMS_NOVA_A0; printk(KERN_INFO "%s nova A0 found\n", __func__ ); - } else if (dev->udev->descriptor.idProduct == 0x201) { + break; + default: + case USB_PID_NOVA_B: params.device_type = SMS_NOVA_B0; printk(KERN_INFO "%s nova B0 found\n", __func__); - } else { + break; + case USB_PID_VEGA: params.device_type = SMS_VEGA; printk(KERN_INFO "%s Vega found\n", __func__); } @@ -421,9 +434,9 @@ void smsusb_disconnect(struct usb_interface *intf) } static struct usb_device_id smsusb_id_table [] = { - { USB_DEVICE(0x187F, 0x0010) }, - { USB_DEVICE(0x187F, 0x0100) }, - { USB_DEVICE(0x187F, 0x0200) }, + { USB_DEVICE(USB_VID_SIANO, 0x0010) }, + { USB_DEVICE(USB_VID_SIANO, USB_PID_STELLAR) }, + { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, smsusb_id_table); -- cgit v1.2.3 From 822374165d6b11733467cfa2fa18234319198233 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 15:14:13 -0300 Subject: V4L/DVB (8280): sms1xxx: more codingstyle cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 651 +++++++++++++++++------------------ drivers/media/dvb/siano/smscoreapi.h | 394 ++++++++++----------- drivers/media/dvb/siano/smsdvb.c | 175 +++++----- drivers/media/dvb/siano/smsusb.c | 209 +++++------ 4 files changed, 714 insertions(+), 715 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 41c63e5622d..ba72daf5ced 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -33,23 +33,23 @@ #include "smscoreapi.h" -#define PERROR(fmt, args...) printk( KERN_ERR "smscore error: line %d- %s(): " fmt,__LINE__, __func__, ## args) +#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) +# 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) - +# 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; @@ -129,100 +129,86 @@ static int default_mode = 1; module_param(default_mode, int, 0644); MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); -static smscore_registry_entry_t *smscore_find_registry ( 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) - { + for (next = g_smscore_registry.next; + next != &g_smscore_registry; + next = next->next) { entry = (smscore_registry_entry_t *) next; - if (!strcmp(entry->devpath, devpath)) - { + if (!strcmp(entry->devpath, devpath)) { kmutex_unlock(&g_smscore_registrylock); return entry; } } - entry = (smscore_registry_entry_t *) kmalloc(sizeof(smscore_registry_entry_t), GFP_KERNEL); - if (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__ ); + } 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 ) +int smscore_registry_getmode(char *devpath) { smscore_registry_entry_t *entry; - entry = smscore_find_registry ( devpath ); - if ( entry ) - { + entry = smscore_find_registry(devpath); + if (entry) return entry->mode; - } else - { - printk ( KERN_ERR "%s No registry found.\n", __func__ ); - } + printk(KERN_ERR "%s No registry found.\n", __func__); + return default_mode; } -sms_device_type_st smscore_registry_gettype ( char *devpath ) +sms_device_type_st smscore_registry_gettype(char *devpath) { smscore_registry_entry_t *entry; - entry = smscore_find_registry ( devpath ); - if ( entry ) - { + entry = smscore_find_registry(devpath); + if (entry) return entry->type; - } else - { - printk ( KERN_ERR "%s No registry found.\n", __func__ ); - } + printk(KERN_ERR "%s No registry found.\n", __func__); + return -1; } -void smscore_registry_setmode ( char *devpath, int mode ) - { +void smscore_registry_setmode(char *devpath, int mode) +{ smscore_registry_entry_t *entry; - entry = smscore_find_registry ( devpath ); - if ( entry ) - { - entry->mode = mode; - } + entry = smscore_find_registry(devpath); + if (entry) + entry->mode = mode; else - { - printk ( KERN_ERR "%s No registry found.\n", __func__ ); - } - } + printk(KERN_ERR "%s No registry found.\n", __func__); +} -void smscore_registry_settype ( char *devpath, sms_device_type_st type ) +void smscore_registry_settype(char *devpath, sms_device_type_st type) { smscore_registry_entry_t *entry; - entry = smscore_find_registry ( devpath ); - if ( entry ) - { + entry = smscore_find_registry(devpath); + if (entry) entry->type = type; - } else - { - printk ( KERN_ERR "%s No registry found.\n", __func__ ); -} + printk(KERN_ERR "%s No registry found.\n", __func__); } void list_add_locked(struct list_head *new, struct list_head *head, - spinlock_t *lock) + spinlock_t *lock) { unsigned long flags; @@ -250,25 +236,22 @@ int smscore_register_hotplug(hotplug_t hotplug) kmutex_lock(&g_smscore_deviceslock); notifyee = kmalloc(sizeof(smscore_device_notifyee_t), GFP_KERNEL); - if (notifyee) - { - // now notify callback about existing devices + if (notifyee) { + /* now notify callback about existing devices */ first = &g_smscore_devices; - for (next = first->next; next != first && !rc; next = next->next) - { + for (next = first->next; + next != first && !rc; + next = next->next) { smscore_device_t *coredev = (smscore_device_t *) next; rc = hotplug(coredev, coredev->device, 1); } - if (rc >= 0) - { + if (rc >= 0) { notifyee->hotplug = hotplug; list_add(¬ifyee->entry, &g_smscore_notifyees); - } - else + } else kfree(notifyee); - } - else + } else rc = -ENOMEM; kmutex_unlock(&g_smscore_deviceslock); @@ -290,13 +273,12 @@ void smscore_unregister_hotplug(hotplug_t hotplug) first = &g_smscore_notifyees; - for (next = first->next; next != first;) - { - smscore_device_notifyee_t *notifyee = (smscore_device_notifyee_t *) next; + for (next = first->next; next != first;) { + smscore_device_notifyee_t *notifyee = + (smscore_device_notifyee_t *) next; next = next->next; - if (notifyee->hotplug == hotplug) - { + if (notifyee->hotplug == hotplug) { list_del(¬ifyee->entry); kfree(notifyee); } @@ -309,25 +291,24 @@ void smscore_notify_clients(smscore_device_t *coredev) { smscore_client_t *client; - // the client must call smscore_unregister_client from remove handler - while (!list_empty(&coredev->clients)) - { + /* the client must call smscore_unregister_client from remove handler */ + while (!list_empty(&coredev->clients)) { client = (smscore_client_t *) coredev->clients.next; client->onremove_handler(client->context); } } -int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, int arrival) +int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, + int arrival) { struct list_head *next, *first; int rc = 0; - // note: must be called under g_deviceslock + /* note: must be called under g_deviceslock */ first = &g_smscore_notifyees; - for (next = first->next; next != first; next = next->next) - { + for (next = first->next; next != first; next = next->next) { rc = ((smscore_device_notifyee_t *) next)->hotplug(coredev, device, arrival); if (rc < 0) break; @@ -340,8 +321,7 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, dma_addr_t common_buffer_phys) { smscore_buffer_t *cb = kmalloc(sizeof(smscore_buffer_t), GFP_KERNEL); - if (!cb) - { + if (!cb) { printk(KERN_INFO "%s kmalloc(...) failed\n", __func__); return NULL; } @@ -354,38 +334,38 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, } /** - * creates coredev object for a device, prepares buffers, creates buffer mappings, notifies - * registered hotplugs about new device. + * creates coredev object for a device, prepares buffers, + * creates buffer mappings, notifies registered hotplugs about new device. * * @param params device pointer to struct with device specific parameters and handlers * @param coredev pointer to a value that receives created coredev object * * @return 0 on success, <0 on error. */ -int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev) +int smscore_register_device(smsdevice_params_t *params, + smscore_device_t **coredev) { smscore_device_t *dev; u8 *buffer; dev = kzalloc(sizeof(smscore_device_t), GFP_KERNEL); - if (!dev) - { + if (!dev) { printk(KERN_INFO "%s kzalloc(...) failed\n", __func__); return -ENOMEM; } - // init list entry so it could be safe in smscore_unregister_device + /* init list entry so it could be safe in smscore_unregister_device */ INIT_LIST_HEAD(&dev->entry); - // init queues + /* init queues */ INIT_LIST_HEAD(&dev->clients); INIT_LIST_HEAD(&dev->buffers); - // init locks + /* init locks */ spin_lock_init(&dev->clientslock); spin_lock_init(&dev->bufferslock); - // init completion events + /* init completion events */ init_completion(&dev->version_ex_done); init_completion(&dev->data_download_done); init_completion(&dev->trigger_done); @@ -393,21 +373,22 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored init_completion(&dev->reload_start_done); init_completion(&dev->resume_done); - // alloc common buffer + /* alloc common buffer */ dev->common_buffer_size = params->buffer_size * params->num_buffers; - dev->common_buffer = dma_alloc_coherent(NULL, dev->common_buffer_size, &dev->common_buffer_phys, GFP_KERNEL | GFP_DMA); - if (!dev->common_buffer) - { + dev->common_buffer = dma_alloc_coherent(NULL, dev->common_buffer_size, + &dev->common_buffer_phys, + GFP_KERNEL | GFP_DMA); + if (!dev->common_buffer) { smscore_unregister_device(dev); return -ENOMEM; } - // prepare dma buffers - for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; dev->num_buffers ++, buffer += params->buffer_size) - { + /* prepare dma buffers */ + for (buffer = dev->common_buffer; + dev->num_buffers < params->num_buffers; + dev->num_buffers ++, buffer += params->buffer_size) { smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); - if (!cb) - { + if (!cb) { smscore_unregister_device(dev); return -ENOMEM; } @@ -415,7 +396,8 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored smscore_putbuffer(dev, cb); } - printk(KERN_INFO "%s allocated %d buffers\n", __func__, dev->num_buffers); + printk(KERN_INFO "%s allocated %d buffers\n", + __func__, dev->num_buffers); dev->mode = DEVICE_MODE_NONE; dev->context = params->context; @@ -429,9 +411,9 @@ 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 ); + smscore_registry_settype(dev->devpath, params->device_type); - // add device to devices list + /* add device to devices list */ kmutex_lock(&g_smscore_deviceslock); list_add(&dev->entry, &g_smscore_devices); kmutex_unlock(&g_smscore_deviceslock); @@ -453,9 +435,8 @@ int smscore_register_device(smsdevice_params_t *params, smscore_device_t **cored 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 ); + if (rc < 0) { + printk(KERN_INFO "%s set device mode faile , rc %d\n", __func__, rc); return rc; } @@ -463,7 +444,8 @@ int smscore_start_device(smscore_device_t *coredev) rc = smscore_notify_callbacks(coredev, coredev->device, 1); - printk(KERN_INFO "%s device %p started, rc %d\n", __func__, coredev, rc); + printk(KERN_INFO "%s device %p started, rc %d\n", + __func__, coredev, rc); kmutex_unlock(&g_smscore_deviceslock); @@ -471,44 +453,49 @@ int smscore_start_device(smscore_device_t *coredev) } int smscore_sendrequest_and_wait(smscore_device_t *coredev, void *buffer, - size_t size, struct completion *completion) + size_t size, struct completion *completion) { int rc = coredev->sendrequest_handler(coredev->context, buffer, size); - if (rc < 0) - { - printk(KERN_INFO "%s sendrequest returned error %d\n", __func__, rc); + 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(10000)) ? 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) +int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, + size_t size) { - SmsFirmware_ST* firmware = (SmsFirmware_ST*) buffer; + SmsFirmware_ST *firmware = (SmsFirmware_ST *) buffer; SmsMsgHdr_ST *msg; UINT32 mem_address = firmware->StartAddress; 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) - { + 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); if (rc < 0) return rc; } - // PAGE_SIZE buffer shall be enough and dma aligned + /* PAGE_SIZE buffer shall be enough and dma aligned */ msg = (SmsMsgHdr_ST *) kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!msg) return -ENOMEM; - if (coredev->mode != DEVICE_MODE_NONE) - { + 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); + 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]; } @@ -517,12 +504,15 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg; int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); - SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, (UINT16)(sizeof(SmsMsgHdr_ST) + sizeof(UINT32) + payload_size)); + SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, + (UINT16)(sizeof(SmsMsgHdr_ST) + + sizeof(UINT32) + payload_size)); DataMsg->MemAddr = mem_address; memcpy(DataMsg->Payload, payload, payload_size); - if (coredev->device_flags & SMS_ROM_NO_RESPONSE && coredev->mode == DEVICE_MODE_NONE) + if ((coredev->device_flags & SMS_ROM_NO_RESPONSE) && + (coredev->mode == DEVICE_MODE_NONE)) rc = coredev->sendrequest_handler(coredev->context, DataMsg, DataMsg->xMsgHeader.msgLength); else rc = smscore_sendrequest_and_wait(coredev, DataMsg, DataMsg->xMsgHeader.msgLength, &coredev->data_download_done); @@ -532,13 +522,13 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ mem_address += payload_size; } - if (rc >= 0) - { - if (coredev->mode == DEVICE_MODE_NONE) - { - SmsMsgData_ST* TriggerMsg = (SmsMsgData_ST*) msg; + if (rc >= 0) { + if (coredev->mode == DEVICE_MODE_NONE) { + SmsMsgData_ST *TriggerMsg = (SmsMsgData_ST *) msg; - SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, sizeof(SmsMsgHdr_ST) + sizeof(UINT32) * 5); + SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, + sizeof(SmsMsgHdr_ST) + + sizeof(UINT32) * 5); TriggerMsg->msgData[0] = firmware->StartAddress; // Entry point TriggerMsg->msgData[1] = 5; // Priority @@ -546,24 +536,23 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ TriggerMsg->msgData[3] = 0; // Parameter TriggerMsg->msgData[4] = 4; // Task ID - if (coredev->device_flags & SMS_ROM_NO_RESPONSE) - { + if (coredev->device_flags & SMS_ROM_NO_RESPONSE) { rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength); msleep(100); - } - else + } else rc = smscore_sendrequest_and_wait(coredev, TriggerMsg, TriggerMsg->xMsgHeader.msgLength, &coredev->trigger_done); - } - else - { - SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ, sizeof(SmsMsgHdr_ST)); + } else { + SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ, + sizeof(SmsMsgHdr_ST)); - rc = coredev->sendrequest_handler(coredev->context, msg, msg->msgLength); + rc = coredev->sendrequest_handler(coredev->context, + msg, msg->msgLength); } - msleep ( 500 ); + msleep(500); } - printk("%s rc=%d, postload=%p \n", __func__, rc, coredev->postload_handler); + printk("%s rc=%d, postload=%p \n", __func__, rc, + coredev->postload_handler); kfree(msg); @@ -581,37 +570,39 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, size_ * * @return 0 on success, <0 on error. */ -int smscore_load_firmware_from_file(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; const struct firmware *fw; u8 *fw_buffer; - if (loadfirmware_handler == NULL && !(coredev->device_flags & SMS_DEVICE_FAMILY2)) + if (loadfirmware_handler == NULL && !(coredev->device_flags & + SMS_DEVICE_FAMILY2)) return -EINVAL; rc = request_firmware(&fw, filename, coredev->device); - if (rc < 0) - { - printk(KERN_INFO "%s failed to open \"%s\"\n", __func__, filename); + if (rc < 0) { + 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) - { + 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) { memcpy(fw_buffer, fw->data, fw->size); rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? - smscore_load_firmware_family2(coredev, fw_buffer, fw->size) : + smscore_load_firmware_family2(coredev, fw_buffer, fw->size) : loadfirmware_handler(coredev->context, fw_buffer, fw->size); kfree(fw_buffer); - } - else - { - printk(KERN_INFO "%s failed to allocate firmware buffer\n", __func__); + } else { + printk(KERN_INFO "%s failed to allocate firmware buffer\n", + __func__); rc = -ENOMEM; } @@ -620,7 +611,8 @@ int smscore_load_firmware_from_file(smscore_device_t *coredev, char *filename, l return rc; } -int smscore_load_firmware_from_buffer(smscore_device_t *coredev, u8 *buffer, int size, int new_mode) +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; @@ -644,32 +636,33 @@ void smscore_unregister_device(smscore_device_t *coredev) smscore_notify_clients(coredev); smscore_notify_callbacks(coredev, NULL, 0); - // at this point all buffers should be back - // onresponse must no longer be called + /* at this point all buffers should be back + * onresponse must no longer be called */ - while (1) - { - while ((cb = smscore_getbuffer(coredev))) - { + while (1) { + while ((cb = smscore_getbuffer(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__); + 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); + printk(KERN_INFO "%s waiting for %d buffer(s)\n", __func__, + coredev->num_buffers - num_buffers); msleep(100); } printk(KERN_INFO "%s freed %d buffers\n", __func__, num_buffers); if (coredev->common_buffer) - dma_free_coherent(NULL, coredev->common_buffer_size, coredev->common_buffer, coredev->common_buffer_phys); + dma_free_coherent(NULL, coredev->common_buffer_size, + coredev->common_buffer, + coredev->common_buffer_phys); list_del(&coredev->entry); kfree(coredev); @@ -681,7 +674,8 @@ void smscore_unregister_device(smscore_device_t *coredev) int smscore_detect_mode(smscore_device_t *coredev) { - void *buffer = kmalloc(sizeof(SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); + void *buffer = kmalloc(sizeof(SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, + GFP_KERNEL | GFP_DMA); SmsMsgHdr_ST *msg = (SmsMsgHdr_ST *) SMS_ALIGN_ADDRESS(buffer); int rc; @@ -690,20 +684,17 @@ int smscore_detect_mode(smscore_device_t *coredev) SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ, sizeof(SmsMsgHdr_ST)); - rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); - if (rc == -ETIME) - { + rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, + &coredev->version_ex_done); + if (rc == -ETIME) { printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", __func__); - if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) - { + if (wait_for_completion_timeout(&coredev->resume_done, + msecs_to_jiffies(5000))) { rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc < 0) - { printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d\n", __func__, rc); - } - } - else + } else rc = -ETIME; } @@ -712,17 +703,16 @@ int smscore_detect_mode(smscore_device_t *coredev) return rc; } -char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = -{ +char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { /*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"} + /*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"} }; @@ -741,51 +731,44 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) 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) - { - printk(KERN_INFO "%s invalid mode specified %d\n", __func__, mode); + 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) { + printk(KERN_INFO "%s invalid mode specified %d\n", + __func__, mode); return -EINVAL; } smscore_registry_setmode(coredev->devpath, mode); - if (!(coredev->device_flags & SMS_DEVICE_NOT_READY)) - { + 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); + if (rc < 0) { + printk(KERN_INFO "%s mode detect failed %d\n", + __func__, rc); return rc; - } + } } - if (coredev->mode == mode) - { - printk(KERN_INFO "%s device mode %d already set\n", __func__, mode); + if (coredev->mode == mode) { + printk(KERN_INFO "%s device mode %d already set\n", + __func__, mode); return 0; } - if (!(coredev->modes_supported & (1 << mode))) - { - type = smscore_registry_gettype ( coredev->devpath ); - rc = smscore_load_firmware_from_file ( coredev, smscore_fw_lkup[mode][type], NULL ); - if (rc < 0) - { + if (!(coredev->modes_supported & (1 << mode))) { + 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 - { + } + } else printk(KERN_INFO "%s mode %d supported by running firmware\n", __func__, mode); - } - buffer = kmalloc(sizeof(SmsMsgData_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); - if (buffer) - { + buffer = kmalloc(sizeof(SmsMsgData_ST) + SMS_DMA_ALIGNMENT, + GFP_KERNEL | GFP_DMA); + if (buffer) { SmsMsgData_ST *msg = (SmsMsgData_ST *) SMS_ALIGN_ADDRESS(buffer); SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ, sizeof(SmsMsgData_ST)); @@ -794,32 +777,28 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) rc = smscore_sendrequest_and_wait(coredev, msg, msg->xMsgHeader.msgLength, &coredev->init_device_done); kfree(buffer); - } - else - { + } 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); + } + } 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); + coredev->detectmode_handler(coredev->context, + &coredev->mode); if (coredev->mode != mode && coredev->setmode_handler) rc = coredev->setmode_handler(coredev->context, mode); } - if (rc >= 0) - { + if (rc >= 0) { coredev->mode = mode; coredev->device_flags &= ~SMS_DEVICE_NOT_READY; } @@ -847,7 +826,7 @@ int smscore_get_device_mode(smscore_device_t *coredev) * * @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 ) + * @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) @@ -860,20 +839,21 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, spin_lock_irqsave(&coredev->clientslock, flags); first = &coredev->clients; - 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) - { + 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_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; + (((smscore_idlist_t*)nextid)->data_type == 0))) { + client = (smscore_client_t*) next; + break; + } } } - } spin_unlock_irqrestore(&coredev->clientslock, flags); return client; } @@ -889,7 +869,8 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, 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_find_client(coredev, phdr->msgType, phdr->msgDstId); + smscore_client_t *client = smscore_find_client(coredev, phdr->msgType, + phdr->msgDstId); int rc = -EBUSY; static unsigned long last_sample_time = 0; @@ -901,67 +882,62 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) if (time_now - last_sample_time > 10000) { - printk("\n%s data rate %d bytes/secs\n", __func__, (int)((data_total * 1000) / (time_now - last_sample_time))); + printk("\n%s data rate %d bytes/secs\n", __func__, + (int)((data_total * 1000) / + (time_now - last_sample_time))); last_sample_time = time_now; data_total = 0; } data_total += cb->size; - /* 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 no client registered for type & id, + * check for control client where type is not registered */ if (client) rc = client->onresponse_handler(client->context, cb); - if (rc < 0) - { - switch (phdr->msgType) + if (rc < 0) { + switch (phdr->msgType) { + case MSG_SMS_GET_VERSION_EX_RES: { - case MSG_SMS_GET_VERSION_EX_RES: - { - SmsVersionRes_ST *ver = (SmsVersionRes_ST*) phdr; - printk("%s: MSG_SMS_GET_VERSION_EX_RES id %d prots 0x%x ver %d.%d\n", __func__, ver->FirmwareId, ver->SupportedProtocols, ver->RomVersionMajor, ver->RomVersionMinor); - - coredev->mode = ver->FirmwareId == 255 ? DEVICE_MODE_NONE : ver->FirmwareId; - coredev->modes_supported = ver->SupportedProtocols; - - complete(&coredev->version_ex_done); - break; - } - - case MSG_SMS_INIT_DEVICE_RES: - printk("%s: MSG_SMS_INIT_DEVICE_RES\n", __func__); - complete(&coredev->init_device_done); - break; - - case MSG_SW_RELOAD_START_RES: - printk("%s: MSG_SW_RELOAD_START_RES\n", __func__); - complete(&coredev->reload_start_done); - break; - - case MSG_SMS_DATA_DOWNLOAD_RES: - complete(&coredev->data_download_done); - break; - - case MSG_SW_RELOAD_EXEC_RES: - printk("%s: MSG_SW_RELOAD_EXEC_RES\n", __func__); - break; + SmsVersionRes_ST *ver = (SmsVersionRes_ST *) phdr; + printk("%s: MSG_SMS_GET_VERSION_EX_RES id %d " + "prots 0x%x ver %d.%d\n", __func__, + ver->FirmwareId, ver->SupportedProtocols, + ver->RomVersionMajor, ver->RomVersionMinor); - case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: - printk("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", __func__); - complete(&coredev->trigger_done); - break; - - case MSG_SMS_SLEEP_RESUME_COMP_IND: - complete(&coredev->resume_done); - break; + coredev->mode = ver->FirmwareId == 255 ? + DEVICE_MODE_NONE : ver->FirmwareId; + coredev->modes_supported = ver->SupportedProtocols; - default: - //printk(KERN_INFO "%s no client (%p) or error (%d), type:%d dstid:%d\n", __func__, client, rc, phdr->msgType, phdr->msgDstId); - break; + complete(&coredev->version_ex_done); + break; + } + case MSG_SMS_INIT_DEVICE_RES: + printk("%s: MSG_SMS_INIT_DEVICE_RES\n", __func__); + complete(&coredev->init_device_done); + break; + case MSG_SW_RELOAD_START_RES: + printk("%s: MSG_SW_RELOAD_START_RES\n", __func__); + complete(&coredev->reload_start_done); + break; + case MSG_SMS_DATA_DOWNLOAD_RES: + complete(&coredev->data_download_done); + break; + case MSG_SW_RELOAD_EXEC_RES: + printk("%s: MSG_SW_RELOAD_EXEC_RES\n", __func__); + break; + case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: + printk("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", + __func__); + complete(&coredev->trigger_done); + break; + case MSG_SMS_SLEEP_RESUME_COMP_IND: + complete(&coredev->resume_done); + break; + default: + break; } - smscore_putbuffer(coredev, cb); } } @@ -980,8 +956,7 @@ smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev) spin_lock_irqsave(&coredev->bufferslock, flags); - if (!list_empty(&coredev->buffers)) - { + if (!list_empty(&coredev->buffers)) { cb = (smscore_buffer_t *) coredev->buffers.next; list_del(&cb->entry); } @@ -1003,35 +978,33 @@ 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 data_type, int id) +int smscore_validate_client(smscore_device_t *coredev, + smscore_client_t *client, int data_type, int id) { smscore_idlist_t *listentry; smscore_client_t *registered_client; - if ( !client ) - { + if (!client) { PERROR("bad parameter.\n"); return -EFAULT; } registered_client = smscore_find_client(coredev, data_type, id); - if (registered_client == client) - { + if (registered_client == client) { return 0; } - if (registered_client) - { + 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 ) - { + listentry = kzalloc(sizeof(smscore_idlist_t), GFP_KERNEL); + if (!listentry) { PERROR("Can't allocate memory for client id.\n"); return -ENOMEM; } listentry->id = id; listentry->data_type = data_type; - list_add_locked ( &listentry->entry, &client->idlist, &coredev->clientslock ); + list_add_locked(&listentry->entry, &client->idlist, + &coredev->clientslock); return 0; } @@ -1051,29 +1024,31 @@ 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; - // check that no other channel with same parameters exists - if (smscore_find_client(coredev, params->data_type, params->initial_id)) - { + /* 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) - { + if (!newclient) { PERROR("Failed to allocate memory for client.\n"); return -ENOMEM; } - INIT_LIST_HEAD ( &newclient->idlist); + INIT_LIST_HEAD(&newclient->idlist); newclient->coredev = coredev; 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); + list_add_locked(&newclient->entry, &coredev->clients, + &coredev->clientslock); + smscore_validate_client(coredev, newclient, params->data_type, + params->initial_id); *client = newclient; - PDEBUG ( "%p %d %d\n", params->context, params->data_type, params->initial_id ); + PDEBUG("%p %d %d\n", params->context, params->data_type, + params->initial_id); return 0; } @@ -1092,11 +1067,11 @@ void smscore_unregister_client(smscore_client_t *client) spin_lock_irqsave(&coredev->clientslock, flags); - while (!list_empty( &client->idlist)) - { - smscore_idlist_t *identry = (smscore_idlist_t*)client->idlist.next; - list_del ( &identry->entry ); - kfree ( identry ); + while (!list_empty(&client->idlist)) { + smscore_idlist_t *identry = + (smscore_idlist_t*) client->idlist.next; + list_del(&identry->entry); + kfree(identry); } printk(KERN_INFO "%s %p\n", __func__, client->context); @@ -1123,22 +1098,21 @@ int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size) SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *) buffer; int rc; - if ( client == NULL ) - { - printk(KERN_ERR "%s Got NULL client\n", __func__ ); + 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 - if ( coredev == NULL ) - { - printk(KERN_ERR "%s Got NULL coredev\n", __func__ ); + /* check that no other channel with same id exists */ + if (coredev == NULL) { + printk(KERN_ERR "%s Got NULL coredev\n", __func__); return -EINVAL; } - rc = smscore_validate_client(client->coredev, client, 0, phdr->msgSrcId); + rc = smscore_validate_client(client->coredev, client, 0, + phdr->msgSrcId); if (rc < 0) return rc; @@ -1168,21 +1142,25 @@ int smscore_get_common_buffer_size(smscore_device_t *coredev) int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct *vma) { - unsigned long end = vma->vm_end, start = vma->vm_start, size = PAGE_ALIGN(coredev->common_buffer_size); + unsigned long end = vma->vm_end, + start = vma->vm_start, + size = PAGE_ALIGN(coredev->common_buffer_size); - if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || (vma->vm_flags & VM_WRITE)) - { + if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || + (vma->vm_flags & VM_WRITE)) { printk(KERN_INFO "%s invalid vm flags\n", __func__); return -EINVAL; } - if ((end - start) != size) - { - printk(KERN_INFO "%s invalid size %d expected %d\n", __func__, (int)(end - start), (int) size); + if ((end - start) != size) { + printk(KERN_INFO "%s invalid size %d expected %d\n", + __func__, (int)(end - start), (int) size); return -EINVAL; } - if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, size, pgprot_noncached(vma->vm_page_prot))) + if (remap_pfn_range(vma, start, + coredev->common_buffer_phys >> PAGE_SHIFT, + size, pgprot_noncached(vma->vm_page_prot))) { printk(KERN_INFO "%s remap_page_range failed\n", __func__); return -EAGAIN; @@ -1217,9 +1195,9 @@ void smscore_module_exit(void) { kmutex_lock(&g_smscore_deviceslock); - while (!list_empty(&g_smscore_notifyees)) - { - smscore_device_notifyee_t *notifyee = (smscore_device_notifyee_t *) g_smscore_notifyees.next; + while (!list_empty(&g_smscore_notifyees)) { + smscore_device_notifyee_t *notifyee = + (smscore_device_notifyee_t *) g_smscore_notifyees.next; list_del(¬ifyee->entry); kfree(notifyee); @@ -1227,9 +1205,9 @@ void smscore_module_exit(void) kmutex_unlock(&g_smscore_deviceslock); kmutex_lock(&g_smscore_registrylock); - while (!list_empty(&g_smscore_registry)) - { - smscore_registry_entry_t *entry = (smscore_registry_entry_t *) g_smscore_registry.next; + while (!list_empty(&g_smscore_registry)) { + smscore_registry_entry_t *entry = + (smscore_registry_entry_t *) g_smscore_registry.next; list_del(&entry->entry); kfree(entry); @@ -1249,6 +1227,5 @@ module_init(smscore_module_init); module_exit(smscore_module_exit); MODULE_DESCRIPTION("smscore"); -MODULE_AUTHOR ( "Siano Mobile Silicon,,, (doronc@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 601bdb8304d..79fa71a5f28 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -82,12 +82,12 @@ typedef void (*onremove_t)(void *context); typedef struct _smscore_buffer { - // public members, once passed to clients can be changed freely + /* public members, once passed to clients can be changed freely */ struct list_head entry; int size; int offset; - // private members, read-only for clients + /* private members, read-only for clients */ void *p; dma_addr_t phys; unsigned long offset_in_common; @@ -123,7 +123,7 @@ typedef struct _smsclient_params void *context; } smsclient_params_t; -// GPIO definitions for antenna frequency domain control (SMS8021) +/* GPIO definitions for antenna frequency domain control (SMS8021) */ #define SMS_ANTENNA_GPIO_0 1 #define SMS_ANTENNA_GPIO_1 0 @@ -223,7 +223,7 @@ typedef struct SmsMsgHdr_S UINT16 msgType; UINT8 msgSrcId; UINT8 msgDstId; - UINT16 msgLength; // Length is of the entire message, including header + UINT16 msgLength; /* Length of entire message, including header */ UINT16 msgFlags; } SmsMsgHdr_ST; @@ -244,24 +244,24 @@ typedef struct SmsVersionRes_S { SmsMsgHdr_ST xMsgHeader; - UINT16 ChipModel; // e.g. 0x1102 for SMS-1102 "Nova" - UINT8 Step; // 0 - Step A - UINT8 MetalFix; // 0 - Metal 0 + UINT16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */ + UINT8 Step; /* 0 - Step A */ + UINT8 MetalFix; /* 0 - Metal 0 */ - UINT8 FirmwareId; // 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E - UINT8 SupportedProtocols; // Bitwise OR combination of supported protocols + UINT8 FirmwareId; /* 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E */ + UINT8 SupportedProtocols; /* Bitwise OR combination of supported protocols */ - UINT8 VersionMajor; - UINT8 VersionMinor; - UINT8 VersionPatch; - UINT8 VersionFieldPatch; + UINT8 VersionMajor; + UINT8 VersionMinor; + UINT8 VersionPatch; + UINT8 VersionFieldPatch; - UINT8 RomVersionMajor; - UINT8 RomVersionMinor; - UINT8 RomVersionPatch; - UINT8 RomVersionFieldPatch; + UINT8 RomVersionMajor; + UINT8 RomVersionMinor; + UINT8 RomVersionPatch; + UINT8 RomVersionFieldPatch; - UINT8 TextLabel[34]; + UINT8 TextLabel[34]; } SmsVersionRes_ST; typedef struct SmsFirmware_S @@ -274,59 +274,60 @@ typedef struct SmsFirmware_S typedef struct SMSHOSTLIB_STATISTICS_S { - UINT32 Reserved; //!< Reserved - - /// Common parameters - UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked - UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked - UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on - - /// Reception quality - INT32 SNR; //!< dB - UINT32 BER; //!< Post Viterbi BER [1E-5] - UINT32 FIB_CRC; //!< CRC errors percentage, valid only for DAB - UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H - UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H - INT32 RSSI; //!< dBm - INT32 InBandPwr; //!< In band power in dBM - INT32 CarrierOffset; //!< Carrier Offset in bin/1024 - - /// Transmission parameters - UINT32 Frequency; //!< Frequency in Hz - UINT32 Bandwidth; //!< Bandwidth in MHz, valid only for DVB-T/H - UINT32 TransmissionMode; //!< Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos - UINT32 ModemState; //!< from SMS_DvbModemState_ET , valid only for DVB-T/H - UINT32 GuardInterval; //!< Guard Interval, 1 divided by value , valid only for DVB-T/H - UINT32 CodeRate; //!< Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H - UINT32 LPCodeRate; //!< Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H - UINT32 Hierarchy; //!< Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H - UINT32 Constellation; //!< Constellation from SMS_Constellation_ET, valid only for DVB-T/H - - /// Burst parameters, valid only for DVB-H - UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H - UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H - UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H - UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H - UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H - UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H - UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H - UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets - UINT32 TotalTSPackets; //!< Total number of transport-stream packets - UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding - UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding - UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding - /// Common params - UINT32 BERErrorCount; //!< Number of errornous SYNC bits. - UINT32 BERBitCount; //!< Total number of SYNC bits. - - /// Interface information - UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. - - /// DAB/T-DMB - UINT32 PreBER; //!< DAB/T-DMB only: Pre Viterbi BER [1E-5] - - /// DVB-H TPS parameters - UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered + UINT32 Reserved; /* Reserved */ + + /* Common parameters */ + UINT32 IsRfLocked; /* 0 - not locked, 1 - locked */ + UINT32 IsDemodLocked; /* 0 - not locked, 1 - locked */ + UINT32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ + + /* Reception quality */ + INT32 SNR; /* dB */ + UINT32 BER; /* Post Viterbi BER [1E-5] */ + UINT32 FIB_CRC; /* CRC errors percentage, valid only for DAB */ + UINT32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */ + UINT32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ + INT32 RSSI; /* dBm */ + INT32 InBandPwr; /* In band power in dBM */ + INT32 CarrierOffset; /* Carrier Offset in bin/1024 */ + + /* Transmission parameters */ + UINT32 Frequency; /* Frequency in Hz */ + UINT32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */ + UINT32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos */ + UINT32 ModemState; /* from SMS_DvbModemState_ET , valid only for DVB-T/H */ + UINT32 GuardInterval; /* Guard Interval, 1 divided by value , valid only for DVB-T/H */ + UINT32 CodeRate; /* Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ + UINT32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ + UINT32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H */ + UINT32 Constellation; /* Constellation from SMS_Constellation_ET, valid only for DVB-T/H */ + + /* Burst parameters, valid only for DVB-H */ + UINT32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ + UINT32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ + UINT32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ + UINT32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ + UINT32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ + UINT32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ + UINT32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ + UINT32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ + UINT32 TotalTSPackets; /* Total number of transport-stream packets */ + UINT32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding */ + UINT32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding */ + UINT32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding */ + + /* Common params */ + UINT32 BERErrorCount; /* Number of errornous SYNC bits. */ + UINT32 BERBitCount; /* Total number of SYNC bits. */ + + /* Interface information */ + UINT32 SmsToHostTxErrors; /* Total number of transmission errors. */ + + /* DAB/T-DMB */ + UINT32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */ + + /* DVB-H TPS parameters */ + UINT32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ } SMSHOSTLIB_STATISTICS_ST; @@ -336,147 +337,151 @@ typedef struct SMSHOSTLIB_STATISTICS_ST Stat; - // Split the calc of the SNR in DAB - UINT32 Signal; //!< dB - UINT32 Noise; //!< dB + /* Split the calc of the SNR in DAB */ + UINT32 Signal; /* dB */ + UINT32 Noise; /* dB */ } SmsMsgStatisticsInfo_ST; typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S { - // Per-layer information - UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist - UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist - UINT32 BER; //!< Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A - UINT32 BERErrorCount; //!< Post Viterbi Error Bits Count - UINT32 BERBitCount; //!< Post Viterbi Total Bits Count - UINT32 PreBER; //!< Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A - UINT32 TS_PER; //!< Transport stream PER [%], 0xFFFFFFFF indicate N/A - UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets - UINT32 TotalTSPackets; //!< Total number of transport-stream packets - UINT32 TILdepthI; //!< Time interleaver depth I parameter, 255 means layer does not exist - UINT32 NumberOfSegments; //!< Number of segments in layer A, 255 means layer does not exist - UINT32 TMCCErrors; //!< TMCC errors + /* Per-layer information */ + UINT32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist */ + UINT32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist */ + UINT32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ + UINT32 BERErrorCount; /* Post Viterbi Error Bits Count */ + UINT32 BERBitCount; /* Post Viterbi Total Bits Count */ + UINT32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ + UINT32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ + UINT32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ + UINT32 TotalTSPackets; /* Total number of transport-stream packets */ + UINT32 TILdepthI; /* Time interleaver depth I parameter, 255 means layer does not exist */ + UINT32 NumberOfSegments; /* Number of segments in layer A, 255 means layer does not exist */ + UINT32 TMCCErrors; /* TMCC errors */ } SMSHOSTLIB_ISDBT_LAYER_STAT_ST; typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S { - UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E - //!< This fiels MUST always first in any statistics structure - - UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by - //!< the host is smaller than FullSize, the struct will be truncated - - // Common parameters - UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked - UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked - UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on - - // Reception quality - INT32 SNR; //!< dB - INT32 RSSI; //!< dBm - INT32 InBandPwr; //!< In band power in dBM - INT32 CarrierOffset; //!< Carrier Offset in Hz - - // Transmission parameters - UINT32 Frequency; //!< Frequency in Hz - UINT32 Bandwidth; //!< Bandwidth in MHz - UINT32 TransmissionMode; //!< ISDB-T transmission mode - UINT32 ModemState; //!< 0 - Acquisition, 1 - Locked - UINT32 GuardInterval; //!< Guard Interval, 1 divided by value - UINT32 SystemType; //!< ISDB-T system type (ISDB-T / ISDB-Tsb) - UINT32 PartialReception; //!< TRUE - partial reception, FALSE otherwise - UINT32 NumOfLayers; //!< Number of ISDB-T layers in the network - - // Per-layer information - // Layers A, B and C - SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; //!< Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST - - // Interface information - UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. + UINT32 StatisticsType; /* Enumerator identifying the type of the + * structure. Values are the same as + * SMSHOSTLIB_DEVICE_MODES_E + * + * This field MUST always be first in any + * statistics structure */ + + UINT32 FullSize; /* Total size of the structure returned by the modem. If the size requested by + * the host is smaller than FullSize, the struct will be truncated */ + + /* Common parameters */ + UINT32 IsRfLocked; /* 0 - not locked, 1 - locked */ + UINT32 IsDemodLocked; /* 0 - not locked, 1 - locked */ + UINT32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ + + /* Reception quality */ + INT32 SNR; /* dB */ + INT32 RSSI; /* dBm */ + INT32 InBandPwr; /* In band power in dBM */ + INT32 CarrierOffset; /* Carrier Offset in Hz */ + + /* Transmission parameters */ + UINT32 Frequency; /* Frequency in Hz */ + UINT32 Bandwidth; /* Bandwidth in MHz */ + UINT32 TransmissionMode; /* ISDB-T transmission mode */ + UINT32 ModemState; /* 0 - Acquisition, 1 - Locked */ + UINT32 GuardInterval; /* Guard Interval, 1 divided by value */ + UINT32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ + UINT32 PartialReception; /* TRUE - partial reception, FALSE otherwise */ + UINT32 NumOfLayers; /* Number of ISDB-T layers in the network */ + + /* Per-layer information */ + /* Layers A, B and C */ + SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ + + /* Interface information */ + UINT32 SmsToHostTxErrors; /* Total number of transmission errors. */ } SMSHOSTLIB_STATISTICS_ISDBT_ST; typedef struct SMSHOSTLIB_STATISTICS_DVB_S { - UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E - //!< This fiels MUST always first in any statistics structure - - UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by - //!< the host is smaller than FullSize, the struct will be truncated - // Common parameters - UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked - UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked - UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on - - // Reception quality - INT32 SNR; //!< dB - UINT32 BER; //!< Post Viterbi BER [1E-5] - UINT32 BERErrorCount; //!< Number of errornous SYNC bits. - UINT32 BERBitCount; //!< Total number of SYNC bits. - UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A - UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H - INT32 RSSI; //!< dBm - INT32 InBandPwr; //!< In band power in dBM - INT32 CarrierOffset; //!< Carrier Offset in bin/1024 - - // Transmission parameters - UINT32 Frequency; //!< Frequency in Hz - UINT32 Bandwidth; //!< Bandwidth in MHz - UINT32 ModemState; //!< from SMSHOSTLIB_DVB_MODEM_STATE_ET - UINT32 TransmissionMode; //!< FFT mode carriers in Kilos - UINT32 GuardInterval; //!< Guard Interval, 1 divided by value - UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET - UINT32 LPCodeRate; //!< Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET - UINT32 Hierarchy; //!< Hierarchy from SMSHOSTLIB_HIERARCHY_ET - UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET - - // Burst parameters, valid only for DVB-H - UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H - UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H - UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H - UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H - UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H - UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H - UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H - UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets - UINT32 TotalTSPackets; //!< Total number of transport-stream packets - UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H - UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H - UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H - UINT32 NumMPEReceived; //!< DVB-H, Num MPE section received - - // DVB-H TPS parameters - UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered - UINT32 DvbhSrvIndHP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator - UINT32 DvbhSrvIndLP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator - - // Interface information - UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. + UINT32 StatisticsType; /* Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E + * This fiels MUST always first in any statistics structure */ + + UINT32 FullSize; /* Total size of the structure returned by the modem. If the size requested by + * the host is smaller than FullSize, the struct will be truncated */ + /* Common parameters */ + UINT32 IsRfLocked; /* 0 - not locked, 1 - locked */ + UINT32 IsDemodLocked; /* 0 - not locked, 1 - locked */ + UINT32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ + + /* Reception quality */ + INT32 SNR; /* dB */ + UINT32 BER; /* Post Viterbi BER [1E-5] */ + UINT32 BERErrorCount; /* Number of errornous SYNC bits. */ + UINT32 BERBitCount; /* Total number of SYNC bits. */ + UINT32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */ + UINT32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ + INT32 RSSI; /* dBm */ + INT32 InBandPwr; /* In band power in dBM */ + INT32 CarrierOffset; /* Carrier Offset in bin/1024 */ + + /* Transmission parameters */ + UINT32 Frequency; /* Frequency in Hz */ + UINT32 Bandwidth; /* Bandwidth in MHz */ + UINT32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ + UINT32 TransmissionMode; /* FFT mode carriers in Kilos */ + UINT32 GuardInterval; /* Guard Interval, 1 divided by value */ + UINT32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ + UINT32 LPCodeRate; /* Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET */ + UINT32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */ + UINT32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */ + + /* Burst parameters, valid only for DVB-H */ + UINT32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ + UINT32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ + UINT32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ + UINT32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ + UINT32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ + UINT32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ + UINT32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ + UINT32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ + UINT32 TotalTSPackets; /* Total number of transport-stream packets */ + UINT32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H */ + UINT32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H */ + UINT32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H */ + UINT32 NumMPEReceived; /* DVB-H, Num MPE section received */ + + /* DVB-H TPS parameters */ + UINT32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ + UINT32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ + UINT32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ + + /* Interface information */ + UINT32 SmsToHostTxErrors; /* Total number of transmission errors. */ } SMSHOSTLIB_STATISTICS_DVB_ST; typedef struct SMSHOSTLIB_GPIO_CONFIG_S { - UINT8 Direction; //!< GPIO direction: Input - 0, Output - 1 - UINT8 PullUpDown; //!< PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 - UINT8 InputCharacteristics; //!< Input Characteristics: Normal - 0, Schmitt trigger - 1 - UINT8 OutputSlewRate; //!< Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 - UINT8 OutputDriving; //!< Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 + UINT8 Direction; /* GPIO direction: Input - 0, Output - 1 */ + UINT8 PullUpDown; /* PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 */ + UINT8 InputCharacteristics; /* Input Characteristics: Normal - 0, Schmitt trigger - 1 */ + UINT8 OutputSlewRate; /* Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 */ + UINT8 OutputDriving; /* Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */ } SMSHOSTLIB_GPIO_CONFIG_ST; typedef struct SMSHOSTLIB_I2C_REQ_S { - UINT32 DeviceAddress; // I2c device address - UINT32 WriteCount; // number of bytes to write - UINT32 ReadCount; // number of bytes to read + UINT32 DeviceAddress; /* I2c device address */ + UINT32 WriteCount; /* number of bytes to write */ + UINT32 ReadCount; /* number of bytes to read */ UINT8 Data[1]; } SMSHOSTLIB_I2C_REQ_ST; typedef struct SMSHOSTLIB_I2C_RES_S { - UINT32 Status; // non-zero value in case of failure - UINT32 ReadCount; // number of bytes read + UINT32 Status; /* non-zero value in case of failure */ + UINT32 ReadCount; /* number of bytes read */ UINT8 Data[1]; } SMSHOSTLIB_I2C_RES_ST; @@ -492,12 +497,12 @@ typedef struct _smsdvb_client struct dmxdev dmxdev; struct dvb_frontend frontend; - fe_status_t fe_status; - int fe_ber, fe_snr, fe_signal_strength; + fe_status_t fe_status; + int fe_ber, fe_snr, fe_signal_strength; struct completion tune_done, stat_done; - // todo: save freq/band instead whole struct + /* todo: save freq/band instead whole struct */ struct dvb_frontend_parameters fe_params; } smsdvb_client_t; @@ -508,14 +513,17 @@ extern int smscore_registry_getmode(char *devpath); extern int smscore_register_hotplug(hotplug_t hotplug); extern void smscore_unregister_hotplug(hotplug_t hotplug); -extern int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev); +extern int smscore_register_device(smsdevice_params_t *params, + smscore_device_t **coredev); extern void smscore_unregister_device(smscore_device_t *coredev); 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_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); @@ -525,8 +533,10 @@ extern int smscore_register_client(smscore_device_t *coredev, smscore_client_t **client); extern void smscore_unregister_client(smscore_client_t *client); -extern int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size); -extern void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb); +extern int smsclient_sendrequest(smscore_client_t *client, + void *buffer, size_t size); +extern void smscore_onresponse(smscore_device_t *coredev, + smscore_buffer_t *cb); extern int smscore_get_common_buffer_size(smscore_device_t *coredev); extern int smscore_map_common_buffer(smscore_device_t *coredev, @@ -543,4 +553,4 @@ void smsdvb_unregister(void); int smsusb_register(void); void smsusb_unregister(void); -#endif // __smscoreapi_h__ +#endif /* __smscoreapi_h__ */ diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index e050e0da790..13980fb649c 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -34,47 +34,49 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) smsdvb_client_t *client = (smsdvb_client_t *) context; SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); - switch(phdr->msgType) - { - case MSG_SMS_DVBT_BDA_DATA: - dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), - cb->size - sizeof(SmsMsgHdr_ST)); - break; + switch(phdr->msgType) { + case MSG_SMS_DVBT_BDA_DATA: + dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), + cb->size - sizeof(SmsMsgHdr_ST)); + break; + + case MSG_SMS_RF_TUNE_RES: + complete(&client->tune_done); + break; - case MSG_SMS_RF_TUNE_RES: - complete(&client->tune_done); - break; + case MSG_SMS_GET_STATISTICS_RES: + { + SmsMsgStatisticsInfo_ST *p = + (SmsMsgStatisticsInfo_ST *)(phdr + 1); - case MSG_SMS_GET_STATISTICS_RES: + if (p->Stat.IsDemodLocked) { - SmsMsgStatisticsInfo_ST *p = - (SmsMsgStatisticsInfo_ST *)(phdr + 1); - - if (p->Stat.IsDemodLocked) - { - client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; - client->fe_snr = p->Stat.SNR; - client->fe_ber = p->Stat.BER; - - if (p->Stat.InBandPwr < -95) - client->fe_signal_strength = 0; - else if (p->Stat.InBandPwr > -29) - client->fe_signal_strength = 100; - else - client->fe_signal_strength = (p->Stat.InBandPwr + 95) * 3 / 2; - } - else - { - client->fe_status = 0; - client->fe_snr = - client->fe_ber = - client->fe_signal_strength = 0; - } + client->fe_status = FE_HAS_SIGNAL | + FE_HAS_CARRIER | + FE_HAS_VITERBI | + FE_HAS_SYNC | + FE_HAS_LOCK; + + client->fe_snr = p->Stat.SNR; + client->fe_ber = p->Stat.BER; - complete(&client->stat_done); - break; + if (p->Stat.InBandPwr < -95) + client->fe_signal_strength = 0; + else if (p->Stat.InBandPwr > -29) + client->fe_signal_strength = 100; + else + client->fe_signal_strength = + (p->Stat.InBandPwr + 95) * 3 / 2; + } else { + client->fe_status = 0; + client->fe_snr = + client->fe_ber = + client->fe_signal_strength = 0; } - } + + complete(&client->stat_done); + break; + } } smscore_putbuffer(client->coredev, cb); @@ -106,7 +108,8 @@ void smsdvb_onremove(void *context) static int smsdvb_start_feed(struct dvb_demux_feed *feed) { - smsdvb_client_t *client = container_of(feed->demux, smsdvb_client_t, demux); + smsdvb_client_t *client = + container_of(feed->demux, smsdvb_client_t, demux); SmsMsgData_ST PidMsg; printk("%s add pid %d(%x)\n", __func__, feed->pid, feed->pid); @@ -118,12 +121,14 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed) PidMsg.xMsgHeader.msgLength = sizeof(PidMsg); PidMsg.msgData[0] = feed->pid; - return smsclient_sendrequest(client->smsclient, &PidMsg, sizeof(PidMsg)); + return smsclient_sendrequest(client->smsclient, + &PidMsg, sizeof(PidMsg)); } static int smsdvb_stop_feed(struct dvb_demux_feed *feed) { - smsdvb_client_t *client = container_of(feed->demux, smsdvb_client_t, demux); + smsdvb_client_t *client = + container_of(feed->demux, smsdvb_client_t, demux); SmsMsgData_ST PidMsg; printk("%s remove pid %d(%x)\n", __func__, feed->pid, feed->pid); @@ -135,7 +140,8 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) PidMsg.xMsgHeader.msgLength = sizeof(PidMsg); PidMsg.msgData[0] = feed->pid; - return smsclient_sendrequest(client->smsclient, &PidMsg, sizeof(PidMsg)); + return smsclient_sendrequest(client->smsclient, + &PidMsg, sizeof(PidMsg)); } static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, @@ -146,13 +152,18 @@ static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, if (rc < 0) return rc; - return wait_for_completion_timeout(completion, msecs_to_jiffies(2000)) ? 0 : -ETIME; + return wait_for_completion_timeout(completion, + msecs_to_jiffies(2000)) ? + 0 : -ETIME; } static int smsdvb_send_statistics_request(smsdvb_client_t *client) { - SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, DVBT_BDA_CONTROL_MSG_ID, HIF_TASK, sizeof(SmsMsgHdr_ST), 0 }; - return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), &client->stat_done); + SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, + DVBT_BDA_CONTROL_MSG_ID, + HIF_TASK, sizeof(SmsMsgHdr_ST), 0 }; + return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), + &client->stat_done); } static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) @@ -199,7 +210,8 @@ static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) return rc; } -static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) +static int smsdvb_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *tune) { printk("%s\n", __func__); @@ -209,14 +221,15 @@ static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend return 0; } -static int smsdvb_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) +static int smsdvb_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *fep) { smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); struct { SmsMsgHdr_ST Msg; - u32 Data[3]; + u32 Data[3]; } Msg; Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; @@ -227,29 +240,32 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_para Msg.Data[0] = fep->frequency; Msg.Data[2] = 12000000; - printk("%s freq %d band %d\n", __func__, fep->frequency, fep->u.ofdm.bandwidth); + printk("%s freq %d band %d\n", __func__, + fep->frequency, fep->u.ofdm.bandwidth); switch(fep->u.ofdm.bandwidth) { case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; -// case BANDWIDTH_5_MHZ: Msg.Data[1] = BW_5_MHZ; break; case BANDWIDTH_AUTO: return -EOPNOTSUPP; default: return -EINVAL; } - return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), &client->tune_done); + return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), + &client->tune_done); } -static int smsdvb_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) +static int smsdvb_get_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *fep) { smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); printk("%s\n", __func__); // todo: - memcpy(fep, &client->fe_params, sizeof(struct dvb_frontend_parameters)); + memcpy(fep, &client->fe_params, + sizeof(struct dvb_frontend_parameters)); return 0; } @@ -260,19 +276,19 @@ static void smsdvb_release(struct dvb_frontend *fe) static struct dvb_frontend_ops smsdvb_fe_ops = { .info = { - .name = "Siano Mobile Digital SMS10xx", - .type = FE_OFDM, + .name = "Siano Mobile Digital SMS10xx", + .type = FE_OFDM, .frequency_min = 44250000, .frequency_max = 867250000, .frequency_stepsize = 250000, .caps = FE_CAN_INVERSION_AUTO | - FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | - FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | - FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | - FE_CAN_TRANSMISSION_MODE_AUTO | - FE_CAN_GUARD_INTERVAL_AUTO | - FE_CAN_RECOVER | - FE_CAN_HIERARCHY_AUTO, + FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | + FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | + FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | + FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | + FE_CAN_GUARD_INTERVAL_AUTO | + FE_CAN_RECOVER | + FE_CAN_HIERARCHY_AUTO, }, .release = smsdvb_release, @@ -287,8 +303,8 @@ static struct dvb_frontend_ops smsdvb_fe_ops = { .read_snr = smsdvb_read_snr, }; -int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, - int arrival) +int smsdvb_hotplug(smscore_device_t *coredev, + struct device *device, int arrival) { smsclient_params_t params; smsdvb_client_t *client; @@ -298,23 +314,21 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, if (!arrival) return 0; - if (smscore_get_device_mode(coredev) != 4) - { + if (smscore_get_device_mode(coredev) != 4) { printk(KERN_ERR "%sSMS Device mode is not set for DVB operation.\n", __func__); return 0; } client = kzalloc(sizeof(smsdvb_client_t), GFP_KERNEL); - if (!client) - { + if (!client) { printk(KERN_INFO "%s kmalloc() failed\n", __func__); return -ENOMEM; } // register dvb adapter - rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", THIS_MODULE, device, adapter_nr); - if (rc < 0) - { + rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", + THIS_MODULE, device, adapter_nr); + if (rc < 0) { printk("%s dvb_register_adapter() failed %d\n", __func__, rc); goto adapter_error; } @@ -327,8 +341,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, client->demux.stop_feed = smsdvb_stop_feed; rc = dvb_dmx_init(&client->demux); - if (rc < 0) - { + if (rc < 0) { printk("%s dvb_dmx_init failed %d\n\n", __func__, rc); goto dvbdmx_error; } @@ -339,18 +352,17 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, client->dmxdev.capabilities = 0; rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); - if (rc < 0) - { + if (rc < 0) { printk("%s dvb_dmxdev_init failed %d\n", __func__, rc); goto dmxdev_error; } // init and register frontend - memcpy(&client->frontend.ops, &smsdvb_fe_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&client->frontend.ops, &smsdvb_fe_ops, + sizeof(struct dvb_frontend_ops)); rc = dvb_register_frontend(&client->adapter, &client->frontend); - if (rc < 0) - { + if (rc < 0) { printk("%s frontend registration failed %d\n", __func__, rc); goto frontend_error; } @@ -362,9 +374,9 @@ int smsdvb_hotplug(smscore_device_t *coredev, struct device *device, params.context = client; rc = smscore_register_client(coredev, ¶ms, &client->smsclient); - if (rc < 0) - { - printk(KERN_INFO "%s smscore_register_client() failed %d\n", __func__, rc); + if (rc < 0) { + printk(KERN_INFO "%s smscore_register_client() failed %d\n", + __func__, rc); goto client_error; } @@ -421,9 +433,8 @@ void smsdvb_unregister(void) kmutex_lock(&g_smsdvb_clientslock); while (!list_empty(&g_smsdvb_clients)) - smsdvb_unregister_client((smsdvb_client_t *) g_smsdvb_clients.next); + smsdvb_unregister_client( + (smsdvb_client_t *) g_smsdvb_clients.next); kmutex_unlock(&g_smsdvb_clientslock); - } - diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index ca9bb36544c..d9ce3ba0910 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -57,8 +57,8 @@ typedef struct _smsusb_device smsusb_urb_t surbs[MAX_URBS]; - int response_alignment; - int buffer_size; + int response_alignment; + int buffer_size; } *psmsusb_device_t; int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb); @@ -68,44 +68,50 @@ void smsusb_onresponse(struct urb *urb) smsusb_urb_t *surb = (smsusb_urb_t *) urb->context; smsusb_device_t *dev = surb->dev; - if (urb->status < 0) - { - printk(KERN_INFO "%s error, urb status %d, %d bytes\n", __func__, urb->status, urb->actual_length); + if (urb->status < 0) { + printk(KERN_INFO "%s error, urb status %d, %d bytes\n", + __func__, urb->status, urb->actual_length); return; } - if (urb->actual_length > 0) - { + if (urb->actual_length > 0) { SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *) surb->cb->p; - if (urb->actual_length >= phdr->msgLength) - { + if (urb->actual_length >= phdr->msgLength) { surb->cb->size = phdr->msgLength; - if (dev->response_alignment && (phdr->msgFlags & MSG_HDR_FLAG_SPLIT_MSG)) - { - surb->cb->offset = dev->response_alignment + ((phdr->msgFlags >> 8) & 3); - - // sanity check - if (((int) phdr->msgLength + surb->cb->offset) > urb->actual_length) - { - printk("%s: invalid response msglen %d offset %d size %d\n", __func__, phdr->msgLength, surb->cb->offset, urb->actual_length); + if (dev->response_alignment && + (phdr->msgFlags & MSG_HDR_FLAG_SPLIT_MSG)) { + + surb->cb->offset = + dev->response_alignment + + ((phdr->msgFlags >> 8) & 3); + + /* sanity check */ + if (((int) phdr->msgLength + + surb->cb->offset) > urb->actual_length) { + printk(KERN_INFO "%s: invalid " + "response msglen %d offset %d " + "size %d\n", __func__, + phdr->msgLength, + surb->cb->offset, + urb->actual_length); goto exit_and_resubmit; } - // move buffer pointer and copy header to its new location + /* move buffer pointer and + * copy header to its new location */ memcpy((char *) phdr + surb->cb->offset, phdr, sizeof(SmsMsgHdr_ST)); - } - else + } else surb->cb->offset = 0; smscore_onresponse(dev->coredev, surb->cb); surb->cb = NULL; - } - else - { - printk("%s invalid response msglen %d actual %d\n", __func__, phdr->msgLength, urb->actual_length); + } else { + printk(KERN_INFO "%s invalid response " + "msglen %d actual %d\n", __func__, + phdr->msgLength, urb->actual_length); } } @@ -115,12 +121,11 @@ exit_and_resubmit: int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb) { - if (!surb->cb) - { + if (!surb->cb) { surb->cb = smscore_getbuffer(dev->coredev); - if (!surb->cb) - { - printk(KERN_INFO "%s smscore_getbuffer(...) returned NULL\n", __func__); + if (!surb->cb) { + printk(KERN_INFO "%s smscore_getbuffer(...) " + "returned NULL\n", __func__); return -ENOMEM; } } @@ -144,12 +149,10 @@ void smsusb_stop_streaming(smsusb_device_t *dev) { int i; - for (i = 0; i < MAX_URBS; i ++) - { + for (i = 0; i < MAX_URBS; i ++) { usb_kill_urb(&dev->surbs[i].urb); - if (dev->surbs[i].cb) - { + if (dev->surbs[i].cb) { smscore_putbuffer(dev->coredev, dev->surbs[i].cb); dev->surbs[i].cb = NULL; } @@ -160,12 +163,11 @@ int smsusb_start_streaming(smsusb_device_t *dev) { int i, rc; - for (i = 0; i < MAX_URBS; i ++) - { + for (i = 0; i < MAX_URBS; i ++) { rc = smsusb_submit_urb(dev, &dev->surbs[i]); - if (rc < 0) - { - printk(KERN_INFO "%s smsusb_submit_urb(...) failed\n", __func__); + if (rc < 0) { + printk(KERN_INFO "%s smsusb_submit_urb(...) " + "failed\n", __func__); smsusb_stop_streaming(dev); break; } @@ -179,11 +181,11 @@ int smsusb_sendrequest(void *context, void *buffer, size_t size) smsusb_device_t *dev = (smsusb_device_t *) context; int dummy; - return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), buffer, size, &dummy, 1000); + return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), + buffer, size, &dummy, 1000); } -char *smsusb1_fw_lkup[] = -{ +char *smsusb1_fw_lkup[] = { "dvbt_stellar_usb.inp", "dvbh_stellar_usb.inp", "tdmb_stellar_usb.inp", @@ -197,32 +199,31 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) u8 *fw_buffer; int rc, dummy; - if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) - { - printk(KERN_INFO "%s invalid firmware id specified %d\n", __func__, id); + if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { + printk(KERN_INFO "%s invalid firmware id specified %d\n", + __func__, id); return -EINVAL; } rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); - if (rc < 0) - { - printk(KERN_INFO "%s failed to open \"%s\" mode %d\n", __func__, smsusb1_fw_lkup[id], id); + if (rc < 0) { + printk(KERN_INFO "%s failed to open \"%s\" mode %d\n", + __func__, smsusb1_fw_lkup[id], id); return rc; } fw_buffer = kmalloc(fw->size, GFP_KERNEL); - if (fw_buffer) - { + if (fw_buffer) { memcpy(fw_buffer, fw->data, fw->size); - rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), fw_buffer, fw->size, &dummy, 1000); + rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), + fw_buffer, fw->size, &dummy, 1000); - printk(KERN_INFO "%s: sent %d(%d) bytes, rc %d\n", __func__, fw->size, dummy, rc); + printk(KERN_INFO "%s: sent %d(%d) bytes, rc %d\n", + __func__, fw->size, dummy, rc); kfree(fw_buffer); - } - else - { + } else { printk(KERN_INFO "failed to allocate firmware buffer\n"); rc = -ENOMEM; } @@ -238,33 +239,29 @@ void smsusb1_detectmode(void *context, int *mode) *mode = DEVICE_MODE_NONE; - if (!product_string) - { + if (!product_string) { product_string = "none"; printk("%s product string not found\n", __func__); - } - else - { - if (strstr(product_string, "DVBH")) - *mode = 1; - else if (strstr(product_string, "BDA")) - *mode = 4; - else if (strstr(product_string, "DVBT")) - *mode = 0; - else if (strstr(product_string, "TDMB")) - *mode = 2; - } + } else if (strstr(product_string, "DVBH")) + *mode = 1; + else if (strstr(product_string, "BDA")) + *mode = 4; + else if (strstr(product_string, "DVBT")) + *mode = 0; + else if (strstr(product_string, "TDMB")) + *mode = 2; printk("%s: %d \"%s\"\n", __func__, *mode, product_string); } int smsusb1_setmode(void *context, int mode) { - SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, sizeof(SmsMsgHdr_ST), 0 }; + SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, + sizeof(SmsMsgHdr_ST), 0 }; - if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) - { - printk(KERN_INFO "%s invalid firmware id specified %d\n", __func__, mode); + if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { + printk(KERN_INFO "%s invalid firmware id specified %d\n", + __func__, mode); return -EINVAL; } @@ -275,8 +272,7 @@ void smsusb_term_device(struct usb_interface *intf) { smsusb_device_t *dev = (smsusb_device_t *) usb_get_intfdata(intf); - if (dev) - { + if (dev) { smsusb_stop_streaming(dev); // unregister from smscore @@ -299,9 +295,9 @@ int smsusb_init_device(struct usb_interface *intf) // create device object dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); - if (!dev) - { - printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", __func__); + if (!dev) { + printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", + __func__); return -ENOMEM; } @@ -336,7 +332,9 @@ int smsusb_init_device(struct usb_interface *intf) } dev->buffer_size = USB2_BUFFER_SIZE; - dev->response_alignment = dev->udev->ep_in[1]->desc.wMaxPacketSize - sizeof(SmsMsgHdr_ST); + dev->response_alignment = + dev->udev->ep_in[1]->desc.wMaxPacketSize - + sizeof(SmsMsgHdr_ST); params.flags |= SMS_DEVICE_FAMILY2; break; @@ -347,37 +345,37 @@ int smsusb_init_device(struct usb_interface *intf) params.num_buffers = MAX_BUFFERS; params.sendrequest_handler = smsusb_sendrequest; params.context = dev; - snprintf(params.devpath, sizeof(params.devpath), "usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath); + snprintf(params.devpath, sizeof(params.devpath), + "usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath); - // register in smscore + /* register in smscore */ rc = smscore_register_device(¶ms, &dev->coredev); - if (rc < 0) - { - printk(KERN_INFO "%s smscore_register_device(...) failed, rc %d\n", __func__, rc); + if (rc < 0) { + printk(KERN_INFO "%s smscore_register_device(...) failed, " + "rc %d\n", __func__, rc); smsusb_term_device(intf); return rc; } // initialize urbs - for (i = 0; i < MAX_URBS; i ++) - { + for (i = 0; i < MAX_URBS; i++) { dev->surbs[i].dev = dev; usb_init_urb(&dev->surbs[i].urb); } printk(KERN_INFO "%s smsusb_start_streaming(...).\n", __func__); rc = smsusb_start_streaming(dev); - if (rc < 0) - { - printk(KERN_INFO "%s smsusb_start_streaming(...) failed\n", __func__); + if (rc < 0) { + printk(KERN_INFO "%s smsusb_start_streaming(...) failed\n", + __func__); smsusb_term_device(intf); return rc; } rc = smscore_start_device(dev->coredev); - if (rc < 0) - { - printk(KERN_INFO "%s smscore_start_device(...) failed\n", __func__); + if (rc < 0) { + printk(KERN_INFO "%s smscore_start_device(...) failed\n", + __func__); smsusb_term_device(intf); return rc; } @@ -396,29 +394,32 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x81)); rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x02)); - if (intf->num_altsetting > 0) - { + if (intf->num_altsetting > 0) { rc = usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); - if (rc < 0) - { - printk(KERN_INFO "%s usb_set_interface failed, rc %d\n", __func__, rc); + if (rc < 0) { + printk(KERN_INFO "%s usb_set_interface failed, " + "rc %d\n", __func__, rc); return rc; } } - printk(KERN_INFO "smsusb_probe %d\n", intf->cur_altsetting->desc.bInterfaceNumber); + printk(KERN_INFO "smsusb_probe %d\n", + intf->cur_altsetting->desc.bInterfaceNumber); for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++) - printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, intf->cur_altsetting->endpoint[i].desc.bmAttributes, intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); + printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, + intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, + intf->cur_altsetting->endpoint[i].desc.bmAttributes, + intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); - if (udev->actconfig->desc.bNumInterfaces == 2 && intf->cur_altsetting->desc.bInterfaceNumber == 0) - { + if ((udev->actconfig->desc.bNumInterfaces == 2) && + (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { printk(KERN_INFO "rom interface 0 is not used\n"); return -ENODEV; } - if (intf->cur_altsetting->desc.bInterfaceNumber == 1) - { - snprintf(devpath, sizeof(devpath), "usb\\%d-%s", udev->bus->busnum, udev->devpath); + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { + 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)); } @@ -444,7 +445,7 @@ MODULE_DEVICE_TABLE (usb, smsusb_id_table); static struct usb_driver smsusb_driver = { .name = "smsusb", .probe = smsusb_probe, - .disconnect = smsusb_disconnect, + .disconnect = smsusb_disconnect, .id_table = smsusb_id_table, }; -- cgit v1.2.3 From f0333e3de0e06fb9a6662a6df7d3d1cc8e5dbeca Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 15:32:00 -0300 Subject: V4L/DVB (8281): sms1xxx: remove INT / UINT typedefs Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 10 +- drivers/media/dvb/siano/smscoreapi.h | 303 +++++++++++++++++------------------ 2 files changed, 154 insertions(+), 159 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index ba72daf5ced..5e8869a747f 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -472,7 +472,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, { SmsFirmware_ST *firmware = (SmsFirmware_ST *) buffer; SmsMsgHdr_ST *msg; - UINT32 mem_address = firmware->StartAddress; + u32 mem_address = firmware->StartAddress; u8 *payload = firmware->Payload; int rc = 0; @@ -496,7 +496,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->reload_start_done); - mem_address = *(UINT32*) &payload[20]; + mem_address = *(u32 *) &payload[20]; } while (size && rc >= 0) @@ -505,8 +505,8 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, - (UINT16)(sizeof(SmsMsgHdr_ST) + - sizeof(UINT32) + payload_size)); + (u16)(sizeof(SmsMsgHdr_ST) + + sizeof(u32) + payload_size)); DataMsg->MemAddr = mem_address; memcpy(DataMsg->Payload, payload, payload_size); @@ -528,7 +528,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, sizeof(SmsMsgHdr_ST) + - sizeof(UINT32) * 5); + sizeof(u32) * 5); TriggerMsg->msgData[0] = firmware->StartAddress; // Entry point TriggerMsg->msgData[1] = 5; // Priority diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 79fa71a5f28..a5c4c0409a2 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -213,276 +213,271 @@ typedef enum DEVICE_MODE_MAX, } SMS_DEVICE_MODE; -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef unsigned int UINT32; -typedef int INT32; - typedef struct SmsMsgHdr_S { - UINT16 msgType; - UINT8 msgSrcId; - UINT8 msgDstId; - UINT16 msgLength; /* Length of entire message, including header */ - UINT16 msgFlags; + u16 msgType; + u8 msgSrcId; + u8 msgDstId; + u16 msgLength; /* Length of entire message, including header */ + u16 msgFlags; } SmsMsgHdr_ST; typedef struct SmsMsgData_S { SmsMsgHdr_ST xMsgHeader; - UINT32 msgData[1]; + u32 msgData[1]; } SmsMsgData_ST; typedef struct SmsDataDownload_S { SmsMsgHdr_ST xMsgHeader; - UINT32 MemAddr; - UINT8 Payload[SMS_MAX_PAYLOAD_SIZE]; + u32 MemAddr; + u8 Payload[SMS_MAX_PAYLOAD_SIZE]; } SmsDataDownload_ST; typedef struct SmsVersionRes_S { SmsMsgHdr_ST xMsgHeader; - UINT16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */ - UINT8 Step; /* 0 - Step A */ - UINT8 MetalFix; /* 0 - Metal 0 */ + u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */ + u8 Step; /* 0 - Step A */ + u8 MetalFix; /* 0 - Metal 0 */ - UINT8 FirmwareId; /* 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E */ - UINT8 SupportedProtocols; /* Bitwise OR combination of supported protocols */ + u8 FirmwareId; /* 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E */ + u8 SupportedProtocols; /* Bitwise OR combination of supported protocols */ - UINT8 VersionMajor; - UINT8 VersionMinor; - UINT8 VersionPatch; - UINT8 VersionFieldPatch; + u8 VersionMajor; + u8 VersionMinor; + u8 VersionPatch; + u8 VersionFieldPatch; - UINT8 RomVersionMajor; - UINT8 RomVersionMinor; - UINT8 RomVersionPatch; - UINT8 RomVersionFieldPatch; + u8 RomVersionMajor; + u8 RomVersionMinor; + u8 RomVersionPatch; + u8 RomVersionFieldPatch; - UINT8 TextLabel[34]; + u8 TextLabel[34]; } SmsVersionRes_ST; typedef struct SmsFirmware_S { - UINT32 CheckSum; - UINT32 Length; - UINT32 StartAddress; - UINT8 Payload[1]; + u32 CheckSum; + u32 Length; + u32 StartAddress; + u8 Payload[1]; } SmsFirmware_ST; typedef struct SMSHOSTLIB_STATISTICS_S { - UINT32 Reserved; /* Reserved */ + u32 Reserved; /* Reserved */ /* Common parameters */ - UINT32 IsRfLocked; /* 0 - not locked, 1 - locked */ - UINT32 IsDemodLocked; /* 0 - not locked, 1 - locked */ - UINT32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ + u32 IsRfLocked; /* 0 - not locked, 1 - locked */ + u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ + u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ /* Reception quality */ - INT32 SNR; /* dB */ - UINT32 BER; /* Post Viterbi BER [1E-5] */ - UINT32 FIB_CRC; /* CRC errors percentage, valid only for DAB */ - UINT32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */ - UINT32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ - INT32 RSSI; /* dBm */ - INT32 InBandPwr; /* In band power in dBM */ - INT32 CarrierOffset; /* Carrier Offset in bin/1024 */ + s32 SNR; /* dB */ + u32 BER; /* Post Viterbi BER [1E-5] */ + u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */ + u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */ + u32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ + s32 RSSI; /* dBm */ + s32 InBandPwr; /* In band power in dBM */ + s32 CarrierOffset; /* Carrier Offset in bin/1024 */ /* Transmission parameters */ - UINT32 Frequency; /* Frequency in Hz */ - UINT32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */ - UINT32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos */ - UINT32 ModemState; /* from SMS_DvbModemState_ET , valid only for DVB-T/H */ - UINT32 GuardInterval; /* Guard Interval, 1 divided by value , valid only for DVB-T/H */ - UINT32 CodeRate; /* Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ - UINT32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ - UINT32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H */ - UINT32 Constellation; /* Constellation from SMS_Constellation_ET, valid only for DVB-T/H */ + u32 Frequency; /* Frequency in Hz */ + u32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */ + u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos */ + u32 ModemState; /* from SMS_DvbModemState_ET , valid only for DVB-T/H */ + u32 GuardInterval; /* Guard Interval, 1 divided by value , valid only for DVB-T/H */ + u32 CodeRate; /* Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ + u32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ + u32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H */ + u32 Constellation; /* Constellation from SMS_Constellation_ET, valid only for DVB-T/H */ /* Burst parameters, valid only for DVB-H */ - UINT32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ - UINT32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ - UINT32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ - UINT32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ - UINT32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ - UINT32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ - UINT32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ - UINT32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ - UINT32 TotalTSPackets; /* Total number of transport-stream packets */ - UINT32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding */ - UINT32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding */ - UINT32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding */ + u32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ + u32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ + u32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ + u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ + u32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ + u32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ + u32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ + u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ + u32 TotalTSPackets; /* Total number of transport-stream packets */ + u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding */ + u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding */ + u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding */ /* Common params */ - UINT32 BERErrorCount; /* Number of errornous SYNC bits. */ - UINT32 BERBitCount; /* Total number of SYNC bits. */ + u32 BERErrorCount; /* Number of errornous SYNC bits. */ + u32 BERBitCount; /* Total number of SYNC bits. */ /* Interface information */ - UINT32 SmsToHostTxErrors; /* Total number of transmission errors. */ + u32 SmsToHostTxErrors; /* Total number of transmission errors. */ /* DAB/T-DMB */ - UINT32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */ + u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */ /* DVB-H TPS parameters */ - UINT32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ + u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ } SMSHOSTLIB_STATISTICS_ST; typedef struct { - UINT32 RequestResult; + u32 RequestResult; SMSHOSTLIB_STATISTICS_ST Stat; /* Split the calc of the SNR in DAB */ - UINT32 Signal; /* dB */ - UINT32 Noise; /* dB */ + u32 Signal; /* dB */ + u32 Noise; /* dB */ } SmsMsgStatisticsInfo_ST; typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S { /* Per-layer information */ - UINT32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist */ - UINT32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist */ - UINT32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ - UINT32 BERErrorCount; /* Post Viterbi Error Bits Count */ - UINT32 BERBitCount; /* Post Viterbi Total Bits Count */ - UINT32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ - UINT32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ - UINT32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ - UINT32 TotalTSPackets; /* Total number of transport-stream packets */ - UINT32 TILdepthI; /* Time interleaver depth I parameter, 255 means layer does not exist */ - UINT32 NumberOfSegments; /* Number of segments in layer A, 255 means layer does not exist */ - UINT32 TMCCErrors; /* TMCC errors */ + u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist */ + u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist */ + u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ + u32 BERErrorCount; /* Post Viterbi Error Bits Count */ + u32 BERBitCount; /* Post Viterbi Total Bits Count */ + u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ + u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ + u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ + u32 TotalTSPackets; /* Total number of transport-stream packets */ + u32 TILdepthI; /* Time interleaver depth I parameter, 255 means layer does not exist */ + u32 NumberOfSegments; /* Number of segments in layer A, 255 means layer does not exist */ + u32 TMCCErrors; /* TMCC errors */ } SMSHOSTLIB_ISDBT_LAYER_STAT_ST; typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S { - UINT32 StatisticsType; /* Enumerator identifying the type of the + u32 StatisticsType; /* Enumerator identifying the type of the * structure. Values are the same as * SMSHOSTLIB_DEVICE_MODES_E * * This field MUST always be first in any * statistics structure */ - UINT32 FullSize; /* Total size of the structure returned by the modem. If the size requested by + u32 FullSize; /* Total size of the structure returned by the modem. If the size requested by * the host is smaller than FullSize, the struct will be truncated */ /* Common parameters */ - UINT32 IsRfLocked; /* 0 - not locked, 1 - locked */ - UINT32 IsDemodLocked; /* 0 - not locked, 1 - locked */ - UINT32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ + u32 IsRfLocked; /* 0 - not locked, 1 - locked */ + u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ + u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ /* Reception quality */ - INT32 SNR; /* dB */ - INT32 RSSI; /* dBm */ - INT32 InBandPwr; /* In band power in dBM */ - INT32 CarrierOffset; /* Carrier Offset in Hz */ + s32 SNR; /* dB */ + s32 RSSI; /* dBm */ + s32 InBandPwr; /* In band power in dBM */ + s32 CarrierOffset; /* Carrier Offset in Hz */ /* Transmission parameters */ - UINT32 Frequency; /* Frequency in Hz */ - UINT32 Bandwidth; /* Bandwidth in MHz */ - UINT32 TransmissionMode; /* ISDB-T transmission mode */ - UINT32 ModemState; /* 0 - Acquisition, 1 - Locked */ - UINT32 GuardInterval; /* Guard Interval, 1 divided by value */ - UINT32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ - UINT32 PartialReception; /* TRUE - partial reception, FALSE otherwise */ - UINT32 NumOfLayers; /* Number of ISDB-T layers in the network */ + u32 Frequency; /* Frequency in Hz */ + u32 Bandwidth; /* Bandwidth in MHz */ + u32 TransmissionMode; /* ISDB-T transmission mode */ + u32 ModemState; /* 0 - Acquisition, 1 - Locked */ + u32 GuardInterval; /* Guard Interval, 1 divided by value */ + u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ + u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */ + u32 NumOfLayers; /* Number of ISDB-T layers in the network */ /* Per-layer information */ /* Layers A, B and C */ SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ /* Interface information */ - UINT32 SmsToHostTxErrors; /* Total number of transmission errors. */ + u32 SmsToHostTxErrors; /* Total number of transmission errors. */ } SMSHOSTLIB_STATISTICS_ISDBT_ST; typedef struct SMSHOSTLIB_STATISTICS_DVB_S { - UINT32 StatisticsType; /* Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E + u32 StatisticsType; /* Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E * This fiels MUST always first in any statistics structure */ - UINT32 FullSize; /* Total size of the structure returned by the modem. If the size requested by + u32 FullSize; /* Total size of the structure returned by the modem. If the size requested by * the host is smaller than FullSize, the struct will be truncated */ /* Common parameters */ - UINT32 IsRfLocked; /* 0 - not locked, 1 - locked */ - UINT32 IsDemodLocked; /* 0 - not locked, 1 - locked */ - UINT32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ + u32 IsRfLocked; /* 0 - not locked, 1 - locked */ + u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ + u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ /* Reception quality */ - INT32 SNR; /* dB */ - UINT32 BER; /* Post Viterbi BER [1E-5] */ - UINT32 BERErrorCount; /* Number of errornous SYNC bits. */ - UINT32 BERBitCount; /* Total number of SYNC bits. */ - UINT32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */ - UINT32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ - INT32 RSSI; /* dBm */ - INT32 InBandPwr; /* In band power in dBM */ - INT32 CarrierOffset; /* Carrier Offset in bin/1024 */ + s32 SNR; /* dB */ + u32 BER; /* Post Viterbi BER [1E-5] */ + u32 BERErrorCount; /* Number of errornous SYNC bits. */ + u32 BERBitCount; /* Total number of SYNC bits. */ + u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */ + u32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ + s32 RSSI; /* dBm */ + s32 InBandPwr; /* In band power in dBM */ + s32 CarrierOffset; /* Carrier Offset in bin/1024 */ /* Transmission parameters */ - UINT32 Frequency; /* Frequency in Hz */ - UINT32 Bandwidth; /* Bandwidth in MHz */ - UINT32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ - UINT32 TransmissionMode; /* FFT mode carriers in Kilos */ - UINT32 GuardInterval; /* Guard Interval, 1 divided by value */ - UINT32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ - UINT32 LPCodeRate; /* Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET */ - UINT32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */ - UINT32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */ + u32 Frequency; /* Frequency in Hz */ + u32 Bandwidth; /* Bandwidth in MHz */ + u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ + u32 TransmissionMode; /* FFT mode carriers in Kilos */ + u32 GuardInterval; /* Guard Interval, 1 divided by value */ + u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ + u32 LPCodeRate; /* Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET */ + u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */ + u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */ /* Burst parameters, valid only for DVB-H */ - UINT32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ - UINT32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ - UINT32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ - UINT32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ - UINT32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ - UINT32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ - UINT32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ - UINT32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ - UINT32 TotalTSPackets; /* Total number of transport-stream packets */ - UINT32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H */ - UINT32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H */ - UINT32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H */ - UINT32 NumMPEReceived; /* DVB-H, Num MPE section received */ + u32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ + u32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ + u32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ + u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ + u32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ + u32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ + u32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ + u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ + u32 TotalTSPackets; /* Total number of transport-stream packets */ + u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H */ + u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H */ + u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H */ + u32 NumMPEReceived; /* DVB-H, Num MPE section received */ /* DVB-H TPS parameters */ - UINT32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ - UINT32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ - UINT32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ + u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ + u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ + u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ /* Interface information */ - UINT32 SmsToHostTxErrors; /* Total number of transmission errors. */ + u32 SmsToHostTxErrors; /* Total number of transmission errors. */ } SMSHOSTLIB_STATISTICS_DVB_ST; typedef struct SMSHOSTLIB_GPIO_CONFIG_S { - UINT8 Direction; /* GPIO direction: Input - 0, Output - 1 */ - UINT8 PullUpDown; /* PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 */ - UINT8 InputCharacteristics; /* Input Characteristics: Normal - 0, Schmitt trigger - 1 */ - UINT8 OutputSlewRate; /* Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 */ - UINT8 OutputDriving; /* Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */ + u8 Direction; /* GPIO direction: Input - 0, Output - 1 */ + u8 PullUpDown; /* PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 */ + u8 InputCharacteristics; /* Input Characteristics: Normal - 0, Schmitt trigger - 1 */ + u8 OutputSlewRate; /* Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 */ + u8 OutputDriving; /* Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */ } SMSHOSTLIB_GPIO_CONFIG_ST; typedef struct SMSHOSTLIB_I2C_REQ_S { - UINT32 DeviceAddress; /* I2c device address */ - UINT32 WriteCount; /* number of bytes to write */ - UINT32 ReadCount; /* number of bytes to read */ - UINT8 Data[1]; + u32 DeviceAddress; /* I2c device address */ + u32 WriteCount; /* number of bytes to write */ + u32 ReadCount; /* number of bytes to read */ + u8 Data[1]; } SMSHOSTLIB_I2C_REQ_ST; typedef struct SMSHOSTLIB_I2C_RES_S { - UINT32 Status; /* non-zero value in case of failure */ - UINT32 ReadCount; /* number of bytes read */ - UINT8 Data[1]; + u32 Status; /* non-zero value in case of failure */ + u32 ReadCount; /* number of bytes read */ + u8 Data[1]; } SMSHOSTLIB_I2C_RES_ST; typedef struct _smsdvb_client -- cgit v1.2.3 From fa830e8a014a206103d06a7600ed8c661b427db3 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 15:52:43 -0300 Subject: V4L/DVB (8282): sms1xxx: more codingstyle cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 36 +++++++++++++++++------------------- drivers/media/dvb/siano/smscoreapi.h | 4 ++-- drivers/media/dvb/siano/smsdvb.c | 36 +++++++++++++++++------------------- drivers/media/dvb/siano/smsusb.c | 18 +++++++++--------- 4 files changed, 45 insertions(+), 49 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 5e8869a747f..e8267178c52 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -386,7 +386,7 @@ int smscore_register_device(smsdevice_params_t *params, /* prepare dma buffers */ for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; - dev->num_buffers ++, buffer += params->buffer_size) { + dev->num_buffers++, buffer += params->buffer_size) { smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); if (!cb) { smscore_unregister_device(dev); @@ -499,8 +499,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, mem_address = *(u32 *) &payload[20]; } - while (size && rc >= 0) - { + while (size && rc >= 0) { SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg; int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); @@ -530,11 +529,11 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, sizeof(SmsMsgHdr_ST) + sizeof(u32) * 5); - TriggerMsg->msgData[0] = firmware->StartAddress; // Entry point - TriggerMsg->msgData[1] = 5; // Priority - TriggerMsg->msgData[2] = 0x200; // Stack size - TriggerMsg->msgData[3] = 0; // Parameter - TriggerMsg->msgData[4] = 4; // Task ID + TriggerMsg->msgData[0] = firmware->StartAddress; /* Entry point */ + TriggerMsg->msgData[1] = 5; /* Priority */ + TriggerMsg->msgData[2] = 0x200; /* Stack size */ + TriggerMsg->msgData[3] = 0; /* Parameter */ + TriggerMsg->msgData[4] = 4; /* Task ID */ if (coredev->device_flags & SMS_ROM_NO_RESPONSE) { rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength); @@ -642,7 +641,7 @@ void smscore_unregister_device(smscore_device_t *coredev) while (1) { while ((cb = smscore_getbuffer(coredev))) { kfree(cb); - num_buffers ++; + num_buffers++; } if (num_buffers == coredev->num_buffers) break; @@ -842,14 +841,14 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, for (next = first->next; (next != first) && !client; next = next->next) { - firstid = &((smscore_client_t*)next)->idlist; + firstid = &((smscore_client_t *)next)->idlist; for (nextid = firstid->next; nextid != firstid; nextid = nextid->next) { - 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; + 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; } } @@ -880,8 +879,7 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) if (!last_sample_time) last_sample_time = time_now; - if (time_now - last_sample_time > 10000) - { + if (time_now - last_sample_time > 10000) { printk("\n%s data rate %d bytes/secs\n", __func__, (int)((data_total * 1000) / (time_now - last_sample_time))); @@ -989,9 +987,9 @@ int smscore_validate_client(smscore_device_t *coredev, return -EFAULT; } registered_client = smscore_find_client(coredev, data_type, id); - if (registered_client == client) { + if (registered_client == client) return 0; - } + if (registered_client) { PERROR("The msg ID already registered to another client.\n"); return -EEXIST; @@ -1069,7 +1067,7 @@ void smscore_unregister_client(smscore_client_t *client) while (!list_empty(&client->idlist)) { smscore_idlist_t *identry = - (smscore_idlist_t*) client->idlist.next; + (smscore_idlist_t *) client->idlist.next; list_del(&identry->entry); kfree(identry); } diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index a5c4c0409a2..4860e318a5b 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -45,7 +45,7 @@ typedef struct mutex kmutex_t; #ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define min(a, b) (((a) < (b)) ? (a) : (b)) #endif #define SMS_ALLOC_ALIGNMENT 128 @@ -57,7 +57,7 @@ typedef struct mutex kmutex_t; #define SMS_DEVICE_NOT_READY 0x8000000 typedef enum { - SMS_STELLAR= 0, + SMS_STELLAR = 0, SMS_NOVA_A0, SMS_NOVA_B0, SMS_VEGA, diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 13980fb649c..e3f09646bb8 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -34,7 +34,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) smsdvb_client_t *client = (smsdvb_client_t *) context; SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); - switch(phdr->msgType) { + switch (phdr->msgType) { case MSG_SMS_DVBT_BDA_DATA: dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), cb->size - sizeof(SmsMsgHdr_ST)); @@ -49,8 +49,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) SmsMsgStatisticsInfo_ST *p = (SmsMsgStatisticsInfo_ST *)(phdr + 1); - if (p->Stat.IsDemodLocked) - { + if (p->Stat.IsDemodLocked) { client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | @@ -85,7 +84,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) void smsdvb_unregister_client(smsdvb_client_t *client) { - // must be called under clientslock + /* must be called under clientslock */ list_del(&client->entry); @@ -243,13 +242,12 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, printk("%s freq %d band %d\n", __func__, fep->frequency, fep->u.ofdm.bandwidth); - switch(fep->u.ofdm.bandwidth) - { - case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; - case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; - case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; - case BANDWIDTH_AUTO: return -EOPNOTSUPP; - default: return -EINVAL; + switch (fep->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; + case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; + case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; + case BANDWIDTH_AUTO: return -EOPNOTSUPP; + default: return -EINVAL; } return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), @@ -263,7 +261,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, printk("%s\n", __func__); - // todo: + /* todo: */ memcpy(fep, &client->fe_params, sizeof(struct dvb_frontend_parameters)); return 0; @@ -271,7 +269,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, static void smsdvb_release(struct dvb_frontend *fe) { - // do nothing + /* do nothing */ } static struct dvb_frontend_ops smsdvb_fe_ops = { @@ -310,7 +308,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, smsdvb_client_t *client; int rc; - // device removal handled by onremove callback + /* device removal handled by onremove callback */ if (!arrival) return 0; @@ -325,7 +323,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, return -ENOMEM; } - // register dvb adapter + /* register dvb adapter */ rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", THIS_MODULE, device, adapter_nr); if (rc < 0) { @@ -333,9 +331,9 @@ int smsdvb_hotplug(smscore_device_t *coredev, goto adapter_error; } - // init dvb demux + /* init dvb demux */ client->demux.dmx.capabilities = DMX_TS_FILTERING; - client->demux.filternum = 32; // todo: nova ??? + client->demux.filternum = 32; /* todo: nova ??? */ client->demux.feednum = 32; client->demux.start_feed = smsdvb_start_feed; client->demux.stop_feed = smsdvb_stop_feed; @@ -346,7 +344,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, goto dvbdmx_error; } - // init dmxdev + /* init dmxdev */ client->dmxdev.filternum = 32; client->dmxdev.demux = &client->demux.dmx; client->dmxdev.capabilities = 0; @@ -357,7 +355,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, goto dmxdev_error; } - // init and register frontend + /* init and register frontend */ memcpy(&client->frontend.ops, &smsdvb_fe_ops, sizeof(struct dvb_frontend_ops)); diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index d9ce3ba0910..2361f1a5e3c 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -149,7 +149,7 @@ void smsusb_stop_streaming(smsusb_device_t *dev) { int i; - for (i = 0; i < MAX_URBS; i ++) { + for (i = 0; i < MAX_URBS; i++) { usb_kill_urb(&dev->surbs[i].urb); if (dev->surbs[i].cb) { @@ -163,7 +163,7 @@ int smsusb_start_streaming(smsusb_device_t *dev) { int i, rc; - for (i = 0; i < MAX_URBS; i ++) { + for (i = 0; i < MAX_URBS; i++) { rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { printk(KERN_INFO "%s smsusb_submit_urb(...) " @@ -275,7 +275,7 @@ void smsusb_term_device(struct usb_interface *intf) if (dev) { smsusb_stop_streaming(dev); - // unregister from smscore + /* unregister from smscore */ if (dev->coredev) smscore_unregister_device(dev->coredev); @@ -293,7 +293,7 @@ int smsusb_init_device(struct usb_interface *intf) smsusb_device_t *dev; int i, rc; - // create device object + /* create device object */ dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); if (!dev) { printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", @@ -313,13 +313,13 @@ int smsusb_init_device(struct usb_interface *intf) params.setmode_handler = smsusb1_setmode; params.detectmode_handler = smsusb1_detectmode; params.device_type = SMS_STELLAR; - printk(KERN_INFO "%s stellar device found\n", __func__ ); + printk(KERN_INFO "%s stellar device found\n", __func__); break; default: switch (dev->udev->descriptor.idProduct) { case USB_PID_NOVA_A: params.device_type = SMS_NOVA_A0; - printk(KERN_INFO "%s nova A0 found\n", __func__ ); + printk(KERN_INFO "%s nova A0 found\n", __func__); break; default: case USB_PID_NOVA_B: @@ -357,7 +357,7 @@ int smsusb_init_device(struct usb_interface *intf) return rc; } - // initialize urbs + /* initialize urbs */ for (i = 0; i < MAX_URBS; i++) { dev->surbs[i].dev = dev; usb_init_urb(&dev->surbs[i].urb); @@ -405,7 +405,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) printk(KERN_INFO "smsusb_probe %d\n", intf->cur_altsetting->desc.bInterfaceNumber); - for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++) + for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, intf->cur_altsetting->endpoint[i].desc.bmAttributes, @@ -440,7 +440,7 @@ static struct usb_device_id smsusb_id_table [] = { { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) }, { } /* Terminating entry */ }; -MODULE_DEVICE_TABLE (usb, smsusb_id_table); +MODULE_DEVICE_TABLE(usb, smsusb_id_table); static struct usb_driver smsusb_driver = { .name = "smsusb", -- cgit v1.2.3 From 59bf6b8e85209f4b875e319b42e8f13af7797826 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 16:50:11 -0300 Subject: V4L/DVB (8283): sms1xxx: 80-column cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 123 ++++++++++++++++++--------- drivers/media/dvb/siano/smscoreapi.h | 156 ++++++++++++++++++++++------------- drivers/media/dvb/siano/smsdvb.c | 3 +- drivers/media/dvb/siano/smsusb.c | 6 +- 4 files changed, 190 insertions(+), 98 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index e8267178c52..084ddc39c98 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -309,7 +309,8 @@ int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, first = &g_smscore_notifyees; for (next = first->next; next != first; next = next->next) { - rc = ((smscore_device_notifyee_t *) next)->hotplug(coredev, device, arrival); + rc = ((smscore_device_notifyee_t *) next)-> + hotplug(coredev, device, arrival); if (rc < 0) break; } @@ -337,7 +338,8 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, * creates coredev object for a device, prepares buffers, * creates buffer mappings, notifies registered hotplugs about new device. * - * @param params device pointer to struct with device specific parameters and handlers + * @param params device pointer to struct with device specific parameters + * and handlers * @param coredev pointer to a value that receives created coredev object * * @return 0 on success, <0 on error. @@ -387,7 +389,9 @@ int smscore_register_device(smsdevice_params_t *params, for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; dev->num_buffers++, buffer += params->buffer_size) { - smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); + smscore_buffer_t *cb = + smscore_createbuffer(buffer, dev->common_buffer, + dev->common_buffer_phys); if (!cb) { smscore_unregister_device(dev); return -ENOMEM; @@ -428,15 +432,18 @@ int smscore_register_device(smsdevice_params_t *params, /** * sets initial device mode and notifies client hotplugs that device is ready * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * * @return 0 on success, <0 on error. */ int smscore_start_device(smscore_device_t *coredev) { - int rc = smscore_set_device_mode(coredev, smscore_registry_getmode(coredev->devpath)); + 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); + printk(KERN_INFO "%s set device mode faile , rc %d\n", + __func__, rc); return rc; } @@ -512,9 +519,14 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, if ((coredev->device_flags & SMS_ROM_NO_RESPONSE) && (coredev->mode == DEVICE_MODE_NONE)) - rc = coredev->sendrequest_handler(coredev->context, DataMsg, DataMsg->xMsgHeader.msgLength); + rc = coredev->sendrequest_handler( + coredev->context, DataMsg, + DataMsg->xMsgHeader.msgLength); else - rc = smscore_sendrequest_and_wait(coredev, DataMsg, DataMsg->xMsgHeader.msgLength, &coredev->data_download_done); + rc = smscore_sendrequest_and_wait( + coredev, DataMsg, + DataMsg->xMsgHeader.msgLength, + &coredev->data_download_done); payload += payload_size; size -= payload_size; @@ -529,17 +541,23 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, sizeof(SmsMsgHdr_ST) + sizeof(u32) * 5); - TriggerMsg->msgData[0] = firmware->StartAddress; /* Entry point */ + TriggerMsg->msgData[0] = firmware->StartAddress; + /* Entry point */ TriggerMsg->msgData[1] = 5; /* Priority */ TriggerMsg->msgData[2] = 0x200; /* Stack size */ TriggerMsg->msgData[3] = 0; /* Parameter */ TriggerMsg->msgData[4] = 4; /* Task ID */ if (coredev->device_flags & SMS_ROM_NO_RESPONSE) { - rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength); + rc = coredev->sendrequest_handler( + coredev->context, TriggerMsg, + TriggerMsg->xMsgHeader.msgLength); msleep(100); } else - rc = smscore_sendrequest_and_wait(coredev, TriggerMsg, TriggerMsg->xMsgHeader.msgLength, &coredev->trigger_done); + rc = smscore_sendrequest_and_wait( + coredev, TriggerMsg, + TriggerMsg->xMsgHeader.msgLength, + &coredev->trigger_done); } else { SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ, sizeof(SmsMsgHdr_ST)); @@ -563,7 +581,8 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, /** * loads specified firmware into a buffer and calls device loadfirmware_handler * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * @param filename null-terminated string specifies firmware file name * @param loadfirmware_handler device handler that loads firmware * @@ -595,8 +614,11 @@ int smscore_load_firmware_from_file(smscore_device_t *coredev, char *filename, memcpy(fw_buffer, fw->data, fw->size); rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? - smscore_load_firmware_family2(coredev, fw_buffer, fw->size) : - loadfirmware_handler(coredev->context, fw_buffer, fw->size); + smscore_load_firmware_family2(coredev, + fw_buffer, + fw->size) : + loadfirmware_handler(coredev->context, + fw_buffer, fw->size); kfree(fw_buffer); } else { @@ -618,9 +640,11 @@ int smscore_load_firmware_from_buffer(smscore_device_t *coredev, u8 *buffer, } /** - * notifies all clients registered with the device, notifies hotplugs, frees all buffers and coredev object + * notifies all clients registered with the device, notifies hotplugs, + * frees all buffers and coredev object * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * * @return 0 on success, <0 on error. */ @@ -686,13 +710,17 @@ int smscore_detect_mode(smscore_device_t *coredev) rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc == -ETIME) { - printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", __func__); + printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", + __func__); if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) { - rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); + rc = smscore_sendrequest_and_wait( + coredev, msg, msg->msgLength, + &coredev->version_ex_done); if (rc < 0) - printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d\n", __func__, rc); + printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed " + "second try, rc %d\n", __func__, rc); } else rc = -ETIME; } @@ -719,7 +747,8 @@ char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { * calls device handler to change mode of operation * NOTE: stellar/usb may disconnect when changing mode * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * @param mode requested mode of operation * * @return 0 on success, <0 on error. @@ -757,27 +786,35 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) if (!(coredev->modes_supported & (1 << mode))) { type = smscore_registry_gettype(coredev->devpath); - rc = smscore_load_firmware_from_file(coredev, smscore_fw_lkup[mode][type], NULL); + 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); + 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); + printk(KERN_INFO "%s mode %d supported by running " + "firmware\n", __func__, mode); buffer = kmalloc(sizeof(SmsMsgData_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); if (buffer) { - SmsMsgData_ST *msg = (SmsMsgData_ST *) SMS_ALIGN_ADDRESS(buffer); + SmsMsgData_ST *msg = + (SmsMsgData_ST *) SMS_ALIGN_ADDRESS(buffer); - SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ, sizeof(SmsMsgData_ST)); + SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ, + sizeof(SmsMsgData_ST)); msg->msgData[0] = mode; - rc = smscore_sendrequest_and_wait(coredev, msg, msg->xMsgHeader.msgLength, &coredev->init_device_done); + rc = smscore_sendrequest_and_wait( + coredev, msg, msg->xMsgHeader.msgLength, + &coredev->init_device_done); kfree(buffer); } else { - printk(KERN_INFO "%s Could not allocate buffer for init device message.\n", __func__); + printk(KERN_INFO "%s Could not allocate buffer for " + "init device message.\n", __func__); rc = -ENOMEM; } } else { @@ -810,7 +847,8 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) /** * calls device handler to get current mode of operation * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * * @return current mode */ @@ -823,12 +861,14 @@ int smscore_get_device_mode(smscore_device_t *coredev) * 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 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 *smscore_find_client(smscore_device_t *coredev, + int data_type, int id) { smscore_client_t *client = NULL; struct list_head *next, *first; @@ -861,15 +901,16 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, * find client by response id/type, call clients onresponse handler * return buffer to pool on error * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * @param cb pointer to response buffer descriptor * */ 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_find_client(coredev, phdr->msgType, - phdr->msgDstId); + smscore_client_t *client = + smscore_find_client(coredev, phdr->msgType, phdr->msgDstId); int rc = -EBUSY; static unsigned long last_sample_time = 0; @@ -943,7 +984,8 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) /** * return pointer to next free buffer descriptor from core pool * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * * @return pointer to descriptor on success, NULL on error. */ @@ -967,7 +1009,8 @@ smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev) /** * return buffer descriptor to a pool * - * @param coredev pointer to a coredev object returned by smscore_register_device + * @param coredev pointer to a coredev object returned by + * smscore_register_device * @param cb pointer buffer descriptor * */ @@ -1019,7 +1062,9 @@ int smscore_validate_client(smscore_device_t *coredev, * * @return 0 on success, <0 on error. */ -int smscore_register_client(smscore_device_t *coredev, smsclient_params_t *params, smscore_client_t **client) +int smscore_register_client(smscore_device_t *coredev, + smsclient_params_t *params, + smscore_client_t **client) { smscore_client_t *newclient; /* check that no other channel with same parameters exists */ @@ -1054,7 +1099,8 @@ int smscore_register_client(smscore_device_t *coredev, smsclient_params_t *param /** * frees smsclient object and all subclients associated with it * - * @param client pointer to smsclient object returned by smscore_register_client + * @param client pointer to smsclient object returned by + * smscore_register_client * */ void smscore_unregister_client(smscore_client_t *client) @@ -1084,7 +1130,8 @@ void smscore_unregister_client(smscore_client_t *client) * verifies that source id is not taken by another client, * calls device handler to send requests to the device * - * @param client pointer to smsclient object returned by smscore_register_client + * @param client pointer to smsclient object returned by + * smscore_register_client * @param buffer pointer to a request buffer * @param size size (in bytes) of request buffer * diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 4860e318a5b..2a823b37ccf 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -50,7 +50,8 @@ typedef struct mutex kmutex_t; #define SMS_ALLOC_ALIGNMENT 128 #define SMS_DMA_ALIGNMENT 16 -#define SMS_ALIGN_ADDRESS(addr) ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) +#define SMS_ALIGN_ADDRESS(addr) \ + ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) #define SMS_DEVICE_FAMILY2 1 #define SMS_ROM_NO_RESPONSE 2 @@ -68,7 +69,8 @@ typedef struct _smscore_device smscore_device_t; typedef struct _smscore_client smscore_client_t; typedef struct _smscore_buffer smscore_buffer_t; -typedef int (*hotplug_t)(smscore_device_t *coredev, struct device *device, int arrival); +typedef int (*hotplug_t)(smscore_device_t *coredev, + struct device *device, int arrival); typedef int (*setmode_t)(void *context, int mode); typedef void (*detectmode_t)(void *context, int *mode); @@ -196,7 +198,8 @@ typedef struct _smsclient_params (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \ (ptr)->msgLength = len; (ptr)->msgFlags = 0; \ } while (0) -#define SMS_INIT_MSG(ptr, type, len) SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len) +#define SMS_INIT_MSG(ptr, type, len) \ + SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len) typedef enum { @@ -243,8 +246,11 @@ typedef struct SmsVersionRes_S u8 Step; /* 0 - Step A */ u8 MetalFix; /* 0 - Metal 0 */ - u8 FirmwareId; /* 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E */ - u8 SupportedProtocols; /* Bitwise OR combination of supported protocols */ + u8 FirmwareId; /* 0xFF � ROM, otherwise the + * value indicated by + * SMSHOSTLIB_DEVICE_MODES_E */ + u8 SupportedProtocols; /* Bitwise OR combination of + * supported protocols */ u8 VersionMajor; u8 VersionMinor; @@ -280,36 +286,44 @@ typedef struct SMSHOSTLIB_STATISTICS_S s32 SNR; /* dB */ u32 BER; /* Post Viterbi BER [1E-5] */ u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */ - u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */ - u32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ + u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A, + * valid only for DVB-T/H */ + u32 MFER; /* DVB-H frame error rate in percentage, + * 0xFFFFFFFF indicate N/A, valid only for DVB-H */ s32 RSSI; /* dBm */ s32 InBandPwr; /* In band power in dBM */ s32 CarrierOffset; /* Carrier Offset in bin/1024 */ - /* Transmission parameters */ + /* Transmission parameters, valid only for DVB-T/H */ u32 Frequency; /* Frequency in Hz */ - u32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */ - u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos */ - u32 ModemState; /* from SMS_DvbModemState_ET , valid only for DVB-T/H */ - u32 GuardInterval; /* Guard Interval, 1 divided by value , valid only for DVB-T/H */ - u32 CodeRate; /* Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ - u32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H */ - u32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H */ - u32 Constellation; /* Constellation from SMS_Constellation_ET, valid only for DVB-T/H */ + u32 Bandwidth; /* Bandwidth in MHz */ + u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4, + * for DVB-T/H FFT mode carriers in Kilos */ + u32 ModemState; /* from SMS_DvbModemState_ET */ + u32 GuardInterval; /* Guard Interval, 1 divided by value */ + u32 CodeRate; /* Code Rate from SMS_DvbModemState_ET */ + u32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET */ + u32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET */ + u32 Constellation; /* Constellation from SMS_Constellation_ET */ /* Burst parameters, valid only for DVB-H */ - u32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ - u32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ - u32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ - u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ - u32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ - u32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ - u32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ + u32 BurstSize; /* Current burst size in bytes */ + u32 BurstDuration; /* Current burst duration in mSec */ + u32 BurstCycleTime; /* Current burst cycle time in mSec */ + u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, + * as calculated by demodulator */ + u32 NumOfRows; /* Number of rows in MPE table */ + u32 NumOfPaddCols; /* Number of padding columns in MPE table */ + u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */ + /* Burst parameters */ u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ u32 TotalTSPackets; /* Total number of transport-stream packets */ - u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding */ - u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding */ - u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding */ + u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include + * errors after MPE RS decoding */ + u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors + * after MPE RS decoding */ + u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected + * by MPE RS decoding */ /* Common params */ u32 BERErrorCount; /* Number of errornous SYNC bits. */ @@ -322,7 +336,8 @@ typedef struct SMSHOSTLIB_STATISTICS_S u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */ /* DVB-H TPS parameters */ - u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ + u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; + * if set to 0xFFFFFFFF cell_id not yet recovered */ } SMSHOSTLIB_STATISTICS_ST; @@ -341,8 +356,10 @@ typedef struct typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S { /* Per-layer information */ - u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist */ - u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist */ + u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, + * 255 means layer does not exist */ + u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, + * 255 means layer does not exist */ u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ u32 BERErrorCount; /* Post Viterbi Error Bits Count */ u32 BERBitCount; /* Post Viterbi Total Bits Count */ @@ -350,8 +367,10 @@ typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ u32 TotalTSPackets; /* Total number of transport-stream packets */ - u32 TILdepthI; /* Time interleaver depth I parameter, 255 means layer does not exist */ - u32 NumberOfSegments; /* Number of segments in layer A, 255 means layer does not exist */ + u32 TILdepthI; /* Time interleaver depth I parameter, + * 255 means layer does not exist */ + u32 NumberOfSegments; /* Number of segments in layer A, + * 255 means layer does not exist */ u32 TMCCErrors; /* TMCC errors */ } SMSHOSTLIB_ISDBT_LAYER_STAT_ST; @@ -364,8 +383,9 @@ typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S * This field MUST always be first in any * statistics structure */ - u32 FullSize; /* Total size of the structure returned by the modem. If the size requested by - * the host is smaller than FullSize, the struct will be truncated */ + u32 FullSize; /* Total size of the structure returned by the modem. + * If the size requested by the host is smaller than + * FullSize, the struct will be truncated */ /* Common parameters */ u32 IsRfLocked; /* 0 - not locked, 1 - locked */ @@ -390,7 +410,8 @@ typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S /* Per-layer information */ /* Layers A, B and C */ - SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ + SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; /* Per-layer statistics, + see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ /* Interface information */ u32 SmsToHostTxErrors; /* Total number of transmission errors. */ @@ -399,11 +420,15 @@ typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S typedef struct SMSHOSTLIB_STATISTICS_DVB_S { - u32 StatisticsType; /* Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E - * This fiels MUST always first in any statistics structure */ - - u32 FullSize; /* Total size of the structure returned by the modem. If the size requested by - * the host is smaller than FullSize, the struct will be truncated */ + u32 StatisticsType; /* Enumerator identifying the type of the + * structure. Values are the same as + * SMSHOSTLIB_DEVICE_MODES_E + * This field MUST always first in any + * statistics structure */ + + u32 FullSize; /* Total size of the structure returned by the modem. + * If the size requested by the host is smaller than + * FullSize, the struct will be truncated */ /* Common parameters */ u32 IsRfLocked; /* 0 - not locked, 1 - locked */ u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ @@ -415,7 +440,8 @@ typedef struct SMSHOSTLIB_STATISTICS_DVB_S u32 BERErrorCount; /* Number of errornous SYNC bits. */ u32 BERBitCount; /* Total number of SYNC bits. */ u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */ - u32 MFER; /* DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H */ + u32 MFER; /* DVB-H frame error rate in percentage, + * 0xFFFFFFFF indicate N/A, valid only for DVB-H */ s32 RSSI; /* dBm */ s32 InBandPwr; /* In band power in dBM */ s32 CarrierOffset; /* Carrier Offset in bin/1024 */ @@ -427,29 +453,41 @@ typedef struct SMSHOSTLIB_STATISTICS_DVB_S u32 TransmissionMode; /* FFT mode carriers in Kilos */ u32 GuardInterval; /* Guard Interval, 1 divided by value */ u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ - u32 LPCodeRate; /* Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET */ + u32 LPCodeRate; /* Low Priority Code Rate from + * SMSHOSTLIB_CODE_RATE_ET */ u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */ u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */ /* Burst parameters, valid only for DVB-H */ - u32 BurstSize; /* Current burst size in bytes, valid only for DVB-H */ - u32 BurstDuration; /* Current burst duration in mSec, valid only for DVB-H */ - u32 BurstCycleTime; /* Current burst cycle time in mSec, valid only for DVB-H */ - u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H */ - u32 NumOfRows; /* Number of rows in MPE table, valid only for DVB-H */ - u32 NumOfPaddCols; /* Number of padding columns in MPE table, valid only for DVB-H */ - u32 NumOfPunctCols; /* Number of puncturing columns in MPE table, valid only for DVB-H */ + u32 BurstSize; /* Current burst size in bytes */ + u32 BurstDuration; /* Current burst duration in mSec */ + u32 BurstCycleTime; /* Current burst cycle time in mSec */ + u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, + * as calculated by demodulator */ + u32 NumOfRows; /* Number of rows in MPE table */ + u32 NumOfPaddCols; /* Number of padding columns in MPE table */ + u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */ + u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ u32 TotalTSPackets; /* Total number of transport-stream packets */ - u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H */ - u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H */ - u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H */ + + u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include + * errors after MPE RS decoding */ + u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include + * errors after MPE RS decoding */ + u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were + * corrected by MPE RS decoding */ + u32 NumMPEReceived; /* DVB-H, Num MPE section received */ /* DVB-H TPS parameters */ u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ - u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ - u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator */ + u32 DvbhSrvIndHP; /* DVB-H service indication info, + * bit 1 - Time Slicing indicator, + * bit 0 - MPE-FEC indicator */ + u32 DvbhSrvIndLP; /* DVB-H service indication info, + * bit 1 - Time Slicing indicator, + * bit 0 - MPE-FEC indicator */ /* Interface information */ u32 SmsToHostTxErrors; /* Total number of transmission errors. */ @@ -459,10 +497,14 @@ typedef struct SMSHOSTLIB_STATISTICS_DVB_S typedef struct SMSHOSTLIB_GPIO_CONFIG_S { u8 Direction; /* GPIO direction: Input - 0, Output - 1 */ - u8 PullUpDown; /* PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 */ - u8 InputCharacteristics; /* Input Characteristics: Normal - 0, Schmitt trigger - 1 */ - u8 OutputSlewRate; /* Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 */ - u8 OutputDriving; /* Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */ + u8 PullUpDown; /* PullUp/PullDown: None - 0, + * PullDown - 1, PullUp - 2, Keeper - 3 */ + u8 InputCharacteristics; /* Input Characteristics: Normal - 0, + * Schmitt trigger - 1 */ + u8 OutputSlewRate; /* Output Slew Rate: + * Fast slew rate - 0, Slow slew rate - 1 */ + u8 OutputDriving; /* Output driving capability: + * 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */ } SMSHOSTLIB_GPIO_CONFIG_ST; typedef struct SMSHOSTLIB_I2C_REQ_S diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index e3f09646bb8..f46e7facdb6 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -313,7 +313,8 @@ int smsdvb_hotplug(smscore_device_t *coredev, return 0; if (smscore_get_device_mode(coredev) != 4) { - printk(KERN_ERR "%sSMS Device mode is not set for DVB operation.\n", __func__); + printk(KERN_ERR "%sSMS Device mode is not set for " + "DVB operation.\n", __func__); return 0; } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 2361f1a5e3c..102c5857a23 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -395,7 +395,8 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) 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); + rc = usb_set_interface( + udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); if (rc < 0) { printk(KERN_INFO "%s usb_set_interface failed, " "rc %d\n", __func__, rc); @@ -421,7 +422,8 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) 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 smsusb1_load_firmware( + udev, smscore_registry_getmode(devpath)); } rc = smsusb_init_device(intf); -- cgit v1.2.3 From 9f2113975a7898c913c668bb709e95c27e51617b Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 17:26:42 -0300 Subject: V4L/DVB (8284): sms1xxx: fix WARNING: printk() should include KERN_ facility level Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 26 +++++++++++++++----------- drivers/media/dvb/siano/smsdvb.c | 24 +++++++++++++++--------- drivers/media/dvb/siano/smsusb.c | 4 ++-- 3 files changed, 32 insertions(+), 22 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 084ddc39c98..3c0e64286d4 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -568,7 +568,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, msleep(500); } - printk("%s rc=%d, postload=%p \n", __func__, rc, + printk(KERN_DEBUG "%s rc=%d, postload=%p \n", __func__, rc, coredev->postload_handler); kfree(msg); @@ -710,8 +710,8 @@ int smscore_detect_mode(smscore_device_t *coredev) rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc == -ETIME) { - printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed first try\n", - __func__); + printk(KERN_ERR "%s: MSG_SMS_GET_VERSION_EX_REQ " + "failed first try\n", __func__); if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) { @@ -719,7 +719,8 @@ int smscore_detect_mode(smscore_device_t *coredev) coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc < 0) - printk("%s: MSG_SMS_GET_VERSION_EX_REQ failed " + printk(KERN_ERR "%s: " + "MSG_SMS_GET_VERSION_EX_REQ failed " "second try, rc %d\n", __func__, rc); } else rc = -ETIME; @@ -921,7 +922,7 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) last_sample_time = time_now; if (time_now - last_sample_time > 10000) { - printk("\n%s data rate %d bytes/secs\n", __func__, + printk(KERN_DEBUG "\n%s data rate %d bytes/secs\n", __func__, (int)((data_total * 1000) / (time_now - last_sample_time))); @@ -940,8 +941,8 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) case MSG_SMS_GET_VERSION_EX_RES: { SmsVersionRes_ST *ver = (SmsVersionRes_ST *) phdr; - printk("%s: MSG_SMS_GET_VERSION_EX_RES id %d " - "prots 0x%x ver %d.%d\n", __func__, + printk(KERN_DEBUG "%s: MSG_SMS_GET_VERSION_EX_RES " + "id %d prots 0x%x ver %d.%d\n", __func__, ver->FirmwareId, ver->SupportedProtocols, ver->RomVersionMajor, ver->RomVersionMinor); @@ -953,21 +954,24 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) break; } case MSG_SMS_INIT_DEVICE_RES: - printk("%s: MSG_SMS_INIT_DEVICE_RES\n", __func__); + printk(KERN_DEBUG "%s: MSG_SMS_INIT_DEVICE_RES\n", + __func__); complete(&coredev->init_device_done); break; case MSG_SW_RELOAD_START_RES: - printk("%s: MSG_SW_RELOAD_START_RES\n", __func__); + printk(KERN_DEBUG "%s: MSG_SW_RELOAD_START_RES\n", + __func__); complete(&coredev->reload_start_done); break; case MSG_SMS_DATA_DOWNLOAD_RES: complete(&coredev->data_download_done); break; case MSG_SW_RELOAD_EXEC_RES: - printk("%s: MSG_SW_RELOAD_EXEC_RES\n", __func__); + printk(KERN_DEBUG "%s: MSG_SW_RELOAD_EXEC_RES\n", + __func__); break; case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: - printk("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", + printk(KERN_DEBUG "%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", __func__); complete(&coredev->trigger_done); break; diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index f46e7facdb6..65b1db61ac1 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -111,7 +111,8 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed) container_of(feed->demux, smsdvb_client_t, demux); SmsMsgData_ST PidMsg; - printk("%s add pid %d(%x)\n", __func__, feed->pid, feed->pid); + printk(KERN_DEBUG "%s add pid %d(%x)\n", __func__, + feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; PidMsg.xMsgHeader.msgDstId = HIF_TASK; @@ -130,7 +131,8 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) container_of(feed->demux, smsdvb_client_t, demux); SmsMsgData_ST PidMsg; - printk("%s remove pid %d(%x)\n", __func__, feed->pid, feed->pid); + printk(KERN_DEBUG "%s remove pid %d(%x)\n", __func__, + feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; PidMsg.xMsgHeader.msgDstId = HIF_TASK; @@ -212,7 +214,7 @@ static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) { - printk("%s\n", __func__); + printk(KERN_DEBUG "%s\n", __func__); tune->min_delay_ms = 400; tune->step_size = 250000; @@ -239,7 +241,7 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, Msg.Data[0] = fep->frequency; Msg.Data[2] = 12000000; - printk("%s freq %d band %d\n", __func__, + printk(KERN_DEBUG "%s freq %d band %d\n", __func__, fep->frequency, fep->u.ofdm.bandwidth); switch (fep->u.ofdm.bandwidth) { @@ -259,7 +261,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, { smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); - printk("%s\n", __func__); + printk(KERN_DEBUG "%s\n", __func__); /* todo: */ memcpy(fep, &client->fe_params, @@ -328,7 +330,8 @@ int smsdvb_hotplug(smscore_device_t *coredev, rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", THIS_MODULE, device, adapter_nr); if (rc < 0) { - printk("%s dvb_register_adapter() failed %d\n", __func__, rc); + printk(KERN_ERR "%s dvb_register_adapter() failed %d\n", + __func__, rc); goto adapter_error; } @@ -341,7 +344,8 @@ int smsdvb_hotplug(smscore_device_t *coredev, rc = dvb_dmx_init(&client->demux); if (rc < 0) { - printk("%s dvb_dmx_init failed %d\n\n", __func__, rc); + printk(KERN_ERR "%s dvb_dmx_init failed %d\n\n", + __func__, rc); goto dvbdmx_error; } @@ -352,7 +356,8 @@ int smsdvb_hotplug(smscore_device_t *coredev, rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); if (rc < 0) { - printk("%s dvb_dmxdev_init failed %d\n", __func__, rc); + printk(KERN_ERR "%s dvb_dmxdev_init failed %d\n", + __func__, rc); goto dmxdev_error; } @@ -362,7 +367,8 @@ int smsdvb_hotplug(smscore_device_t *coredev, rc = dvb_register_frontend(&client->adapter, &client->frontend); if (rc < 0) { - printk("%s frontend registration failed %d\n", __func__, rc); + printk(KERN_ERR "%s frontend registration failed %d\n", + __func__, rc); goto frontend_error; } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 102c5857a23..82f2e3e4bec 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -241,7 +241,7 @@ void smsusb1_detectmode(void *context, int *mode) if (!product_string) { product_string = "none"; - printk("%s product string not found\n", __func__); + printk(KERN_ERR "%s product string not found\n", __func__); } else if (strstr(product_string, "DVBH")) *mode = 1; else if (strstr(product_string, "BDA")) @@ -251,7 +251,7 @@ void smsusb1_detectmode(void *context, int *mode) else if (strstr(product_string, "TDMB")) *mode = 2; - printk("%s: %d \"%s\"\n", __func__, *mode, product_string); + printk(KERN_INFO "%s: %d \"%s\"\n", __func__, *mode, product_string); } int smsusb1_setmode(void *context, int mode) -- cgit v1.2.3 From ca78373687bddcd436e1bf2d9b6806cfd9cad8b8 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 17:36:00 -0300 Subject: V4L/DVB (8285): sms1xxx: more 80-column cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 6 ++++-- drivers/media/dvb/siano/smscoreapi.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 3c0e64286d4..d82aafacfb1 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -971,7 +971,8 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) __func__); break; case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: - printk(KERN_DEBUG "%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", + printk(KERN_DEBUG + "%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", __func__); complete(&coredev->trigger_done); break; @@ -1059,7 +1060,8 @@ int smscore_validate_client(smscore_device_t *coredev, * @param coredev pointer to a coredev object from clients hotplug * @param initial_id all messages with this id would be sent to this client * @param data_type all messages of this type would be sent to this client - * @param onresponse_handler client handler that is called to process incoming messages + * @param onresponse_handler client handler that is called to + * process incoming messages * @param onremove_handler client handler that is called when device is removed * @param context client-specific context * @param client pointer to a value that receives created smsclient object diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 2a823b37ccf..f0675cf4cef 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -481,7 +481,8 @@ typedef struct SMSHOSTLIB_STATISTICS_DVB_S u32 NumMPEReceived; /* DVB-H, Num MPE section received */ /* DVB-H TPS parameters */ - u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered */ + u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; + * if set to 0xFFFFFFFF cell_id not yet recovered */ u32 DvbhSrvIndHP; /* DVB-H service indication info, * bit 1 - Time Slicing indicator, * bit 0 - MPE-FEC indicator */ -- cgit v1.2.3 From 18245e18eeae15e928b46c1ae0f3a19bdc50419d Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 17:52:24 -0300 Subject: V4L/DVB (8286): sms1xxx: remove typedefs Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 243 ++++++++++++++-------------- drivers/media/dvb/siano/smscoreapi.h | 299 +++++++---------------------------- drivers/media/dvb/siano/smsdvb.c | 70 ++++---- drivers/media/dvb/siano/smsusb.c | 62 ++++---- 4 files changed, 256 insertions(+), 418 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index d82aafacfb1..e3c6d9cb562 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -50,33 +50,27 @@ #define PWARNING(fmt, args...) #endif -typedef struct _smscore_device_notifyee -{ +struct smscore_device_notifyee_t { struct list_head entry; hotplug_t hotplug; -} smscore_device_notifyee_t; +}; -typedef struct _smscore_subclient -{ +struct smscore_idlist_t { struct list_head entry; int id; int data_type; -} smscore_idlist_t; +}; -typedef struct _smscore_client -{ +struct smscore_client_t { struct list_head entry; - smscore_device_t *coredev; + struct smscore_device_t *coredev; void *context; struct list_head idlist; onresponse_t onresponse_handler; onremove_t onremove_handler; -} *psmscore_client_t; - - +}; -typedef struct _smscore_device -{ +struct smscore_device_t { struct list_head entry; struct list_head clients; @@ -107,15 +101,14 @@ typedef struct _smscore_device struct completion version_ex_done, data_download_done, trigger_done; struct completion init_device_done, reload_start_done, resume_done; -} *psmscore_device_t; +}; -typedef struct _smscore_registry_entry -{ +struct smscore_registry_entry_t { struct list_head entry; char devpath[32]; int mode; - sms_device_type_st type; -} smscore_registry_entry_t; + enum sms_device_type_st type; +}; struct list_head g_smscore_notifyees; struct list_head g_smscore_devices; @@ -129,23 +122,24 @@ static int default_mode = 1; module_param(default_mode, int, 0644); MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); -static smscore_registry_entry_t *smscore_find_registry(char *devpath) +static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) { - smscore_registry_entry_t *entry; + struct 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; + entry = (struct smscore_registry_entry_t *) next; if (!strcmp(entry->devpath, devpath)) { kmutex_unlock(&g_smscore_registrylock); return entry; } } - entry = (smscore_registry_entry_t *) - kmalloc(sizeof(smscore_registry_entry_t), GFP_KERNEL); + entry = (struct smscore_registry_entry_t *) + kmalloc(sizeof(struct smscore_registry_entry_t), + GFP_KERNEL); if (entry) { entry->mode = default_mode; strcpy(entry->devpath, devpath); @@ -159,7 +153,7 @@ static smscore_registry_entry_t *smscore_find_registry(char *devpath) int smscore_registry_getmode(char *devpath) { - smscore_registry_entry_t *entry; + struct smscore_registry_entry_t *entry; entry = smscore_find_registry(devpath); if (entry) @@ -170,9 +164,9 @@ int smscore_registry_getmode(char *devpath) return default_mode; } -sms_device_type_st smscore_registry_gettype(char *devpath) +enum sms_device_type_st smscore_registry_gettype(char *devpath) { - smscore_registry_entry_t *entry; + struct smscore_registry_entry_t *entry; entry = smscore_find_registry(devpath); if (entry) @@ -185,7 +179,7 @@ sms_device_type_st smscore_registry_gettype(char *devpath) void smscore_registry_setmode(char *devpath, int mode) { - smscore_registry_entry_t *entry; + struct smscore_registry_entry_t *entry; entry = smscore_find_registry(devpath); if (entry) @@ -194,9 +188,9 @@ void smscore_registry_setmode(char *devpath, int mode) printk(KERN_ERR "%s No registry found.\n", __func__); } -void smscore_registry_settype(char *devpath, sms_device_type_st type) +void smscore_registry_settype(char *devpath, enum sms_device_type_st type) { - smscore_registry_entry_t *entry; + struct smscore_registry_entry_t *entry; entry = smscore_find_registry(devpath); if (entry) @@ -229,20 +223,22 @@ void list_add_locked(struct list_head *new, struct list_head *head, */ int smscore_register_hotplug(hotplug_t hotplug) { - smscore_device_notifyee_t *notifyee; + struct smscore_device_notifyee_t *notifyee; struct list_head *next, *first; int rc = 0; kmutex_lock(&g_smscore_deviceslock); - notifyee = kmalloc(sizeof(smscore_device_notifyee_t), GFP_KERNEL); + notifyee = kmalloc(sizeof(struct smscore_device_notifyee_t), + GFP_KERNEL); if (notifyee) { /* now notify callback about existing devices */ first = &g_smscore_devices; for (next = first->next; next != first && !rc; next = next->next) { - smscore_device_t *coredev = (smscore_device_t *) next; + struct smscore_device_t *coredev = + (struct smscore_device_t *) next; rc = hotplug(coredev, coredev->device, 1); } @@ -274,8 +270,8 @@ void smscore_unregister_hotplug(hotplug_t hotplug) first = &g_smscore_notifyees; for (next = first->next; next != first;) { - smscore_device_notifyee_t *notifyee = - (smscore_device_notifyee_t *) next; + struct smscore_device_notifyee_t *notifyee = + (struct smscore_device_notifyee_t *) next; next = next->next; if (notifyee->hotplug == hotplug) { @@ -287,19 +283,19 @@ void smscore_unregister_hotplug(hotplug_t hotplug) kmutex_unlock(&g_smscore_deviceslock); } -void smscore_notify_clients(smscore_device_t *coredev) +void smscore_notify_clients(struct smscore_device_t *coredev) { - smscore_client_t *client; + struct smscore_client_t *client; /* the client must call smscore_unregister_client from remove handler */ while (!list_empty(&coredev->clients)) { - client = (smscore_client_t *) coredev->clients.next; + client = (struct smscore_client_t *) coredev->clients.next; client->onremove_handler(client->context); } } -int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, - int arrival) +int smscore_notify_callbacks(struct smscore_device_t *coredev, + struct device *device, int arrival) { struct list_head *next, *first; int rc = 0; @@ -309,7 +305,7 @@ int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, first = &g_smscore_notifyees; for (next = first->next; next != first; next = next->next) { - rc = ((smscore_device_notifyee_t *) next)-> + rc = ((struct smscore_device_notifyee_t *) next)-> hotplug(coredev, device, arrival); if (rc < 0) break; @@ -318,10 +314,11 @@ int smscore_notify_callbacks(smscore_device_t *coredev, struct device *device, return rc; } -smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, +struct smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, dma_addr_t common_buffer_phys) { - smscore_buffer_t *cb = kmalloc(sizeof(smscore_buffer_t), GFP_KERNEL); + struct smscore_buffer_t *cb = + kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL); if (!cb) { printk(KERN_INFO "%s kmalloc(...) failed\n", __func__); return NULL; @@ -344,13 +341,13 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, * * @return 0 on success, <0 on error. */ -int smscore_register_device(smsdevice_params_t *params, - smscore_device_t **coredev) +int smscore_register_device(struct smsdevice_params_t *params, + struct smscore_device_t **coredev) { - smscore_device_t *dev; + struct smscore_device_t *dev; u8 *buffer; - dev = kzalloc(sizeof(smscore_device_t), GFP_KERNEL); + dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL); if (!dev) { printk(KERN_INFO "%s kzalloc(...) failed\n", __func__); return -ENOMEM; @@ -389,7 +386,7 @@ int smscore_register_device(smsdevice_params_t *params, for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; dev->num_buffers++, buffer += params->buffer_size) { - smscore_buffer_t *cb = + struct smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); if (!cb) { @@ -437,7 +434,7 @@ int smscore_register_device(smsdevice_params_t *params, * * @return 0 on success, <0 on error. */ -int smscore_start_device(smscore_device_t *coredev) +int smscore_start_device(struct smscore_device_t *coredev) { int rc = smscore_set_device_mode( coredev, smscore_registry_getmode(coredev->devpath)); @@ -459,7 +456,7 @@ int smscore_start_device(smscore_device_t *coredev) return rc; } -int smscore_sendrequest_and_wait(smscore_device_t *coredev, void *buffer, +int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, size_t size, struct completion *completion) { int rc = coredev->sendrequest_handler(coredev->context, buffer, size); @@ -474,11 +471,11 @@ int smscore_sendrequest_and_wait(smscore_device_t *coredev, void *buffer, 0 : -ETIME; } -int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, - size_t size) +int smscore_load_firmware_family2(struct smscore_device_t *coredev, + void *buffer, size_t size) { - SmsFirmware_ST *firmware = (SmsFirmware_ST *) buffer; - SmsMsgHdr_ST *msg; + struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer; + struct SmsMsgHdr_ST *msg; u32 mem_address = firmware->StartAddress; u8 *payload = firmware->Payload; int rc = 0; @@ -492,14 +489,14 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, } /* PAGE_SIZE buffer shall be enough and dma aligned */ - msg = (SmsMsgHdr_ST *) kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); + msg = (struct SmsMsgHdr_ST *) kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!msg) return -ENOMEM; if (coredev->mode != DEVICE_MODE_NONE) { PDEBUG("Sending reload command\n"); SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ, - sizeof(SmsMsgHdr_ST)); + sizeof(struct SmsMsgHdr_ST)); rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->reload_start_done); @@ -507,11 +504,12 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, } while (size && rc >= 0) { - SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg; + struct SmsDataDownload_ST *DataMsg = + (struct SmsDataDownload_ST *) msg; int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, - (u16)(sizeof(SmsMsgHdr_ST) + + (u16)(sizeof(struct SmsMsgHdr_ST) + sizeof(u32) + payload_size)); DataMsg->MemAddr = mem_address; @@ -535,10 +533,11 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, if (rc >= 0) { if (coredev->mode == DEVICE_MODE_NONE) { - SmsMsgData_ST *TriggerMsg = (SmsMsgData_ST *) msg; + struct SmsMsgData_ST *TriggerMsg = + (struct SmsMsgData_ST *) msg; SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, - sizeof(SmsMsgHdr_ST) + + sizeof(struct SmsMsgHdr_ST) + sizeof(u32) * 5); TriggerMsg->msgData[0] = firmware->StartAddress; @@ -560,7 +559,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, &coredev->trigger_done); } else { SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ, - sizeof(SmsMsgHdr_ST)); + sizeof(struct SmsMsgHdr_ST)); rc = coredev->sendrequest_handler(coredev->context, msg, msg->msgLength); @@ -588,7 +587,8 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, * * @return 0 on success, <0 on error. */ -int smscore_load_firmware_from_file(smscore_device_t *coredev, char *filename, +int smscore_load_firmware_from_file(struct smscore_device_t *coredev, + char *filename, loadfirmware_t loadfirmware_handler) { int rc = -ENOENT; @@ -632,8 +632,8 @@ int smscore_load_firmware_from_file(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) +int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev, + u8 *buffer, int size, int new_mode) { PERROR("Feature not implemented yet\n"); return -EFAULT; @@ -648,9 +648,9 @@ int smscore_load_firmware_from_buffer(smscore_device_t *coredev, u8 *buffer, * * @return 0 on success, <0 on error. */ -void smscore_unregister_device(smscore_device_t *coredev) +void smscore_unregister_device(struct smscore_device_t *coredev) { - smscore_buffer_t *cb; + struct smscore_buffer_t *cb; int num_buffers = 0; int retry = 0; @@ -695,17 +695,19 @@ void smscore_unregister_device(smscore_device_t *coredev) printk(KERN_INFO "%s device %p destroyed\n", __func__, coredev); } -int smscore_detect_mode(smscore_device_t *coredev) +int smscore_detect_mode(struct smscore_device_t *coredev) { - void *buffer = kmalloc(sizeof(SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, + void *buffer = kmalloc(sizeof(struct SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); - SmsMsgHdr_ST *msg = (SmsMsgHdr_ST *) SMS_ALIGN_ADDRESS(buffer); + struct SmsMsgHdr_ST *msg = + (struct SmsMsgHdr_ST *) SMS_ALIGN_ADDRESS(buffer); int rc; if (!buffer) return -ENOMEM; - SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ, sizeof(SmsMsgHdr_ST)); + SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ, + sizeof(struct SmsMsgHdr_ST)); rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); @@ -754,11 +756,11 @@ char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { * * @return 0 on success, <0 on error. */ -int smscore_set_device_mode(smscore_device_t *coredev, int mode) +int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) { void *buffer; int rc = 0; - sms_device_type_st type; + enum sms_device_type_st type; PDEBUG("set device mode to %d\n", mode); if (coredev->device_flags & SMS_DEVICE_FAMILY2) { @@ -798,14 +800,15 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) printk(KERN_INFO "%s mode %d supported by running " "firmware\n", __func__, mode); - buffer = kmalloc(sizeof(SmsMsgData_ST) + SMS_DMA_ALIGNMENT, - GFP_KERNEL | GFP_DMA); + buffer = kmalloc(sizeof(struct SmsMsgData_ST) + + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); if (buffer) { - SmsMsgData_ST *msg = - (SmsMsgData_ST *) SMS_ALIGN_ADDRESS(buffer); + struct SmsMsgData_ST *msg = + (struct SmsMsgData_ST *) + SMS_ALIGN_ADDRESS(buffer); SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ, - sizeof(SmsMsgData_ST)); + sizeof(struct SmsMsgData_ST)); msg->msgData[0] = mode; rc = smscore_sendrequest_and_wait( @@ -853,7 +856,7 @@ int smscore_set_device_mode(smscore_device_t *coredev, int mode) * * @return current mode */ -int smscore_get_device_mode(smscore_device_t *coredev) +int smscore_get_device_mode(struct smscore_device_t *coredev) { return coredev->mode; } @@ -868,10 +871,10 @@ int smscore_get_device_mode(smscore_device_t *coredev) * @param id client id (SMS_DONT_CARE for all id) * */ -smscore_client_t *smscore_find_client(smscore_device_t *coredev, +struct smscore_client_t *smscore_find_client(struct smscore_device_t *coredev, int data_type, int id) { - smscore_client_t *client = NULL; + struct smscore_client_t *client = NULL; struct list_head *next, *first; unsigned long flags; struct list_head *firstid, *nextid; @@ -882,14 +885,14 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, for (next = first->next; (next != first) && !client; next = next->next) { - firstid = &((smscore_client_t *)next)->idlist; + firstid = &((struct smscore_client_t *)next)->idlist; for (nextid = firstid->next; nextid != firstid; nextid = nextid->next) { - 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; + if ((((struct smscore_idlist_t *)nextid)->id == id) && + (((struct smscore_idlist_t *)nextid)->data_type == data_type || + (((struct smscore_idlist_t *)nextid)->data_type == 0))) { + client = (struct smscore_client_t *) next; break; } } @@ -907,10 +910,12 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, * @param cb pointer to response buffer descriptor * */ -void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) +void smscore_onresponse(struct smscore_device_t *coredev, + struct smscore_buffer_t *cb) { - SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)((u8 *) cb->p + cb->offset); - smscore_client_t *client = + struct SmsMsgHdr_ST *phdr = + (struct SmsMsgHdr_ST *)((u8 *) cb->p + cb->offset); + struct smscore_client_t *client = smscore_find_client(coredev, phdr->msgType, phdr->msgDstId); int rc = -EBUSY; @@ -940,7 +945,8 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) switch (phdr->msgType) { case MSG_SMS_GET_VERSION_EX_RES: { - SmsVersionRes_ST *ver = (SmsVersionRes_ST *) phdr; + struct SmsVersionRes_ST *ver = + (struct SmsVersionRes_ST *) phdr; printk(KERN_DEBUG "%s: MSG_SMS_GET_VERSION_EX_RES " "id %d prots 0x%x ver %d.%d\n", __func__, ver->FirmwareId, ver->SupportedProtocols, @@ -994,15 +1000,15 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) * * @return pointer to descriptor on success, NULL on error. */ -smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev) +struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) { - smscore_buffer_t *cb = NULL; + struct smscore_buffer_t *cb = NULL; unsigned long flags; spin_lock_irqsave(&coredev->bufferslock, flags); if (!list_empty(&coredev->buffers)) { - cb = (smscore_buffer_t *) coredev->buffers.next; + cb = (struct smscore_buffer_t *) coredev->buffers.next; list_del(&cb->entry); } @@ -1019,16 +1025,18 @@ smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev) * @param cb pointer buffer descriptor * */ -void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb) +void smscore_putbuffer(struct smscore_device_t *coredev, + struct 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 data_type, int id) +int smscore_validate_client(struct smscore_device_t *coredev, + struct smscore_client_t *client, + int data_type, int id) { - smscore_idlist_t *listentry; - smscore_client_t *registered_client; + struct smscore_idlist_t *listentry; + struct smscore_client_t *registered_client; if (!client) { PERROR("bad parameter.\n"); @@ -1042,7 +1050,7 @@ int smscore_validate_client(smscore_device_t *coredev, PERROR("The msg ID already registered to another client.\n"); return -EEXIST; } - listentry = kzalloc(sizeof(smscore_idlist_t), GFP_KERNEL); + listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL); if (!listentry) { PERROR("Can't allocate memory for client id.\n"); return -ENOMEM; @@ -1068,11 +1076,11 @@ int smscore_validate_client(smscore_device_t *coredev, * * @return 0 on success, <0 on error. */ -int smscore_register_client(smscore_device_t *coredev, - smsclient_params_t *params, - smscore_client_t **client) +int smscore_register_client(struct smscore_device_t *coredev, + struct smsclient_params_t *params, + struct smscore_client_t **client) { - smscore_client_t *newclient; + struct smscore_client_t *newclient; /* check that no other channel with same parameters exists */ if (smscore_find_client(coredev, params->data_type, params->initial_id)) { @@ -1080,7 +1088,7 @@ int smscore_register_client(smscore_device_t *coredev, return -EEXIST; } - newclient = kzalloc(sizeof(smscore_client_t), GFP_KERNEL); + newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL); if (!newclient) { PERROR("Failed to allocate memory for client.\n"); return -ENOMEM; @@ -1109,17 +1117,17 @@ int smscore_register_client(smscore_device_t *coredev, * smscore_register_client * */ -void smscore_unregister_client(smscore_client_t *client) +void smscore_unregister_client(struct smscore_client_t *client) { - smscore_device_t *coredev = client->coredev; + struct smscore_device_t *coredev = client->coredev; unsigned long flags; spin_lock_irqsave(&coredev->clientslock, flags); while (!list_empty(&client->idlist)) { - smscore_idlist_t *identry = - (smscore_idlist_t *) client->idlist.next; + struct smscore_idlist_t *identry = + (struct smscore_idlist_t *) client->idlist.next; list_del(&identry->entry); kfree(identry); } @@ -1143,10 +1151,11 @@ void smscore_unregister_client(smscore_client_t *client) * * @return 0 on success, <0 on error. */ -int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size) +int smsclient_sendrequest(struct smscore_client_t *client, + void *buffer, size_t size) { - smscore_device_t *coredev; - SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *) buffer; + struct smscore_device_t *coredev; + struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer; int rc; if (client == NULL) { @@ -1177,7 +1186,7 @@ int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size) * * @return size (in bytes) of the buffer */ -int smscore_get_common_buffer_size(smscore_device_t *coredev) +int smscore_get_common_buffer_size(struct smscore_device_t *coredev) { return coredev->common_buffer_size; } @@ -1190,7 +1199,7 @@ int smscore_get_common_buffer_size(smscore_device_t *coredev) * * @return 0 on success, <0 on error. */ -int smscore_map_common_buffer(smscore_device_t *coredev, +int smscore_map_common_buffer(struct smscore_device_t *coredev, struct vm_area_struct *vma) { unsigned long end = vma->vm_end, @@ -1247,8 +1256,9 @@ void smscore_module_exit(void) kmutex_lock(&g_smscore_deviceslock); while (!list_empty(&g_smscore_notifyees)) { - smscore_device_notifyee_t *notifyee = - (smscore_device_notifyee_t *) g_smscore_notifyees.next; + struct smscore_device_notifyee_t *notifyee = + (struct smscore_device_notifyee_t *) + g_smscore_notifyees.next; list_del(¬ifyee->entry); kfree(notifyee); @@ -1257,8 +1267,9 @@ void smscore_module_exit(void) kmutex_lock(&g_smscore_registrylock); while (!list_empty(&g_smscore_registry)) { - smscore_registry_entry_t *entry = - (smscore_registry_entry_t *) g_smscore_registry.next; + struct smscore_registry_entry_t *entry = + (struct smscore_registry_entry_t *) + g_smscore_registry.next; list_del(&entry->entry); kfree(entry); diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index f0675cf4cef..be98baf3085 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -57,19 +57,19 @@ typedef struct mutex kmutex_t; #define SMS_ROM_NO_RESPONSE 2 #define SMS_DEVICE_NOT_READY 0x8000000 -typedef enum { +enum sms_device_type_st { 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; +struct smscore_device_t; +struct smscore_client_t; +struct smscore_buffer_t; -typedef int (*hotplug_t)(smscore_device_t *coredev, +typedef int (*hotplug_t)(struct smscore_device_t *coredev, struct device *device, int arrival); typedef int (*setmode_t)(void *context, int mode); @@ -79,11 +79,10 @@ typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size); typedef int (*preload_t)(void *context); typedef int (*postload_t)(void *context); -typedef int (*onresponse_t)(void *context, smscore_buffer_t *cb); +typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb); typedef void (*onremove_t)(void *context); -typedef struct _smscore_buffer -{ +struct smscore_buffer_t { /* public members, once passed to clients can be changed freely */ struct list_head entry; int size; @@ -93,10 +92,9 @@ typedef struct _smscore_buffer void *p; dma_addr_t phys; unsigned long offset_in_common; -} *psmscore_buffer_t; +}; -typedef struct _smsdevice_params -{ +struct smsdevice_params_t { struct device *device; int buffer_size; @@ -112,18 +110,17 @@ typedef struct _smsdevice_params postload_t postload_handler; void *context; - sms_device_type_st device_type; -} smsdevice_params_t; + enum sms_device_type_st device_type; +}; -typedef struct _smsclient_params -{ +struct smsclient_params_t { int initial_id; int data_type; onresponse_t onresponse_handler; onremove_t onremove_handler; void *context; -} smsclient_params_t; +}; /* GPIO definitions for antenna frequency domain control (SMS8021) */ #define SMS_ANTENNA_GPIO_0 1 @@ -201,8 +198,7 @@ typedef struct _smsclient_params #define SMS_INIT_MSG(ptr, type, len) \ SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len) -typedef enum -{ +enum SMS_DEVICE_MODE { DEVICE_MODE_NONE = -1, DEVICE_MODE_DVBT = 0, DEVICE_MODE_DVBH, @@ -214,33 +210,29 @@ typedef enum DEVICE_MODE_CMMB, DEVICE_MODE_RAW_TUNER, DEVICE_MODE_MAX, -} SMS_DEVICE_MODE; +}; -typedef struct SmsMsgHdr_S -{ +struct SmsMsgHdr_ST { u16 msgType; u8 msgSrcId; u8 msgDstId; u16 msgLength; /* Length of entire message, including header */ u16 msgFlags; -} SmsMsgHdr_ST; +}; -typedef struct SmsMsgData_S -{ - SmsMsgHdr_ST xMsgHeader; +struct SmsMsgData_ST { + struct SmsMsgHdr_ST xMsgHeader; u32 msgData[1]; -} SmsMsgData_ST; +}; -typedef struct SmsDataDownload_S -{ - SmsMsgHdr_ST xMsgHeader; +struct SmsDataDownload_ST { + struct SmsMsgHdr_ST xMsgHeader; u32 MemAddr; u8 Payload[SMS_MAX_PAYLOAD_SIZE]; -} SmsDataDownload_ST; +}; -typedef struct SmsVersionRes_S -{ - SmsMsgHdr_ST xMsgHeader; +struct SmsVersionRes_ST { + struct SmsMsgHdr_ST xMsgHeader; u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */ u8 Step; /* 0 - Step A */ @@ -263,18 +255,16 @@ typedef struct SmsVersionRes_S u8 RomVersionFieldPatch; u8 TextLabel[34]; -} SmsVersionRes_ST; +}; -typedef struct SmsFirmware_S -{ +struct SmsFirmware_ST { u32 CheckSum; u32 Length; u32 StartAddress; u8 Payload[1]; -} SmsFirmware_ST; +}; -typedef struct SMSHOSTLIB_STATISTICS_S -{ +struct SMSHOSTLIB_STATISTICS_ST { u32 Reserved; /* Reserved */ /* Common parameters */ @@ -339,196 +329,25 @@ typedef struct SMSHOSTLIB_STATISTICS_S u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; * if set to 0xFFFFFFFF cell_id not yet recovered */ -} SMSHOSTLIB_STATISTICS_ST; +}; -typedef struct -{ +struct SmsMsgStatisticsInfo_ST { u32 RequestResult; - SMSHOSTLIB_STATISTICS_ST Stat; + struct SMSHOSTLIB_STATISTICS_ST Stat; /* Split the calc of the SNR in DAB */ u32 Signal; /* dB */ u32 Noise; /* dB */ -} SmsMsgStatisticsInfo_ST; - -typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S -{ - /* Per-layer information */ - u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, - * 255 means layer does not exist */ - u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, - * 255 means layer does not exist */ - u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ - u32 BERErrorCount; /* Post Viterbi Error Bits Count */ - u32 BERBitCount; /* Post Viterbi Total Bits Count */ - u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ - u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ - u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ - u32 TotalTSPackets; /* Total number of transport-stream packets */ - u32 TILdepthI; /* Time interleaver depth I parameter, - * 255 means layer does not exist */ - u32 NumberOfSegments; /* Number of segments in layer A, - * 255 means layer does not exist */ - u32 TMCCErrors; /* TMCC errors */ -} SMSHOSTLIB_ISDBT_LAYER_STAT_ST; - -typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S -{ - u32 StatisticsType; /* Enumerator identifying the type of the - * structure. Values are the same as - * SMSHOSTLIB_DEVICE_MODES_E - * - * This field MUST always be first in any - * statistics structure */ - - u32 FullSize; /* Total size of the structure returned by the modem. - * If the size requested by the host is smaller than - * FullSize, the struct will be truncated */ - - /* Common parameters */ - u32 IsRfLocked; /* 0 - not locked, 1 - locked */ - u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ - u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ - - /* Reception quality */ - s32 SNR; /* dB */ - s32 RSSI; /* dBm */ - s32 InBandPwr; /* In band power in dBM */ - s32 CarrierOffset; /* Carrier Offset in Hz */ - - /* Transmission parameters */ - u32 Frequency; /* Frequency in Hz */ - u32 Bandwidth; /* Bandwidth in MHz */ - u32 TransmissionMode; /* ISDB-T transmission mode */ - u32 ModemState; /* 0 - Acquisition, 1 - Locked */ - u32 GuardInterval; /* Guard Interval, 1 divided by value */ - u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ - u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */ - u32 NumOfLayers; /* Number of ISDB-T layers in the network */ - - /* Per-layer information */ - /* Layers A, B and C */ - SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; /* Per-layer statistics, - see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ +}; - /* Interface information */ - u32 SmsToHostTxErrors; /* Total number of transmission errors. */ - -} SMSHOSTLIB_STATISTICS_ISDBT_ST; - -typedef struct SMSHOSTLIB_STATISTICS_DVB_S -{ - u32 StatisticsType; /* Enumerator identifying the type of the - * structure. Values are the same as - * SMSHOSTLIB_DEVICE_MODES_E - * This field MUST always first in any - * statistics structure */ - - u32 FullSize; /* Total size of the structure returned by the modem. - * If the size requested by the host is smaller than - * FullSize, the struct will be truncated */ - /* Common parameters */ - u32 IsRfLocked; /* 0 - not locked, 1 - locked */ - u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ - u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ - - /* Reception quality */ - s32 SNR; /* dB */ - u32 BER; /* Post Viterbi BER [1E-5] */ - u32 BERErrorCount; /* Number of errornous SYNC bits. */ - u32 BERBitCount; /* Total number of SYNC bits. */ - u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */ - u32 MFER; /* DVB-H frame error rate in percentage, - * 0xFFFFFFFF indicate N/A, valid only for DVB-H */ - s32 RSSI; /* dBm */ - s32 InBandPwr; /* In band power in dBM */ - s32 CarrierOffset; /* Carrier Offset in bin/1024 */ - - /* Transmission parameters */ - u32 Frequency; /* Frequency in Hz */ - u32 Bandwidth; /* Bandwidth in MHz */ - u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ - u32 TransmissionMode; /* FFT mode carriers in Kilos */ - u32 GuardInterval; /* Guard Interval, 1 divided by value */ - u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ - u32 LPCodeRate; /* Low Priority Code Rate from - * SMSHOSTLIB_CODE_RATE_ET */ - u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */ - u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */ - - /* Burst parameters, valid only for DVB-H */ - u32 BurstSize; /* Current burst size in bytes */ - u32 BurstDuration; /* Current burst duration in mSec */ - u32 BurstCycleTime; /* Current burst cycle time in mSec */ - u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec, - * as calculated by demodulator */ - u32 NumOfRows; /* Number of rows in MPE table */ - u32 NumOfPaddCols; /* Number of padding columns in MPE table */ - u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */ - - u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ - u32 TotalTSPackets; /* Total number of transport-stream packets */ - - u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include - * errors after MPE RS decoding */ - u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include - * errors after MPE RS decoding */ - u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were - * corrected by MPE RS decoding */ - - u32 NumMPEReceived; /* DVB-H, Num MPE section received */ - - /* DVB-H TPS parameters */ - u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; - * if set to 0xFFFFFFFF cell_id not yet recovered */ - u32 DvbhSrvIndHP; /* DVB-H service indication info, - * bit 1 - Time Slicing indicator, - * bit 0 - MPE-FEC indicator */ - u32 DvbhSrvIndLP; /* DVB-H service indication info, - * bit 1 - Time Slicing indicator, - * bit 0 - MPE-FEC indicator */ - - /* Interface information */ - u32 SmsToHostTxErrors; /* Total number of transmission errors. */ -} SMSHOSTLIB_STATISTICS_DVB_ST; - -typedef struct SMSHOSTLIB_GPIO_CONFIG_S -{ - u8 Direction; /* GPIO direction: Input - 0, Output - 1 */ - u8 PullUpDown; /* PullUp/PullDown: None - 0, - * PullDown - 1, PullUp - 2, Keeper - 3 */ - u8 InputCharacteristics; /* Input Characteristics: Normal - 0, - * Schmitt trigger - 1 */ - u8 OutputSlewRate; /* Output Slew Rate: - * Fast slew rate - 0, Slow slew rate - 1 */ - u8 OutputDriving; /* Output driving capability: - * 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */ -} SMSHOSTLIB_GPIO_CONFIG_ST; - -typedef struct SMSHOSTLIB_I2C_REQ_S -{ - u32 DeviceAddress; /* I2c device address */ - u32 WriteCount; /* number of bytes to write */ - u32 ReadCount; /* number of bytes to read */ - u8 Data[1]; -} SMSHOSTLIB_I2C_REQ_ST; - -typedef struct SMSHOSTLIB_I2C_RES_S -{ - u32 Status; /* non-zero value in case of failure */ - u32 ReadCount; /* number of bytes read */ - u8 Data[1]; -} SMSHOSTLIB_I2C_RES_ST; - -typedef struct _smsdvb_client -{ +struct smsdvb_client_t { struct list_head entry; - smscore_device_t *coredev; - smscore_client_t *smsclient; + struct smscore_device_t *coredev; + struct smscore_client_t *smsclient; struct dvb_adapter adapter; struct dvb_demux demux; @@ -543,7 +362,7 @@ typedef struct _smsdvb_client /* todo: save freq/band instead whole struct */ struct dvb_frontend_parameters fe_params; -} smsdvb_client_t; +}; extern void smscore_registry_setmode(char *devpath, int mode); extern int smscore_registry_getmode(char *devpath); @@ -551,37 +370,39 @@ extern int smscore_registry_getmode(char *devpath); extern int smscore_register_hotplug(hotplug_t hotplug); extern void smscore_unregister_hotplug(hotplug_t hotplug); -extern int smscore_register_device(smsdevice_params_t *params, - smscore_device_t **coredev); -extern void smscore_unregister_device(smscore_device_t *coredev); +extern int smscore_register_device(struct smsdevice_params_t *params, + struct smscore_device_t **coredev); +extern void smscore_unregister_device(struct smscore_device_t *coredev); -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_start_device(struct smscore_device_t *coredev); +extern int smscore_load_firmware(struct smscore_device_t *coredev, + char *filename, + loadfirmware_t loadfirmware_handler); -extern int smscore_load_firmware_from_buffer(smscore_device_t *coredev, +extern int smscore_load_firmware_from_buffer(struct 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); +extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode); +extern int smscore_get_device_mode(struct smscore_device_t *coredev); -extern int smscore_register_client(smscore_device_t *coredev, - smsclient_params_t *params, - smscore_client_t **client); -extern void smscore_unregister_client(smscore_client_t *client); +extern int smscore_register_client(struct smscore_device_t *coredev, + struct smsclient_params_t *params, + struct smscore_client_t **client); +extern void smscore_unregister_client(struct smscore_client_t *client); -extern int smsclient_sendrequest(smscore_client_t *client, +extern int smsclient_sendrequest(struct smscore_client_t *client, void *buffer, size_t size); -extern void smscore_onresponse(smscore_device_t *coredev, - smscore_buffer_t *cb); +extern void smscore_onresponse(struct smscore_device_t *coredev, + struct smscore_buffer_t *cb); -extern int smscore_get_common_buffer_size(smscore_device_t *coredev); -extern int smscore_map_common_buffer(smscore_device_t *coredev, +extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev); +extern int smscore_map_common_buffer(struct smscore_device_t *coredev, struct vm_area_struct *vma); -extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); -extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); +extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev); +extern void smscore_putbuffer(struct smscore_device_t *coredev, + struct smscore_buffer_t *cb); /* smsdvb.c */ int smsdvb_register(void); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 65b1db61ac1..b17696fcbbc 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -29,15 +29,16 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct list_head g_smsdvb_clients; kmutex_t g_smsdvb_clientslock; -int smsdvb_onresponse(void *context, smscore_buffer_t *cb) +int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) { - smsdvb_client_t *client = (smsdvb_client_t *) context; - SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); + struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; + struct SmsMsgHdr_ST *phdr = + (struct SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); switch (phdr->msgType) { case MSG_SMS_DVBT_BDA_DATA: dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), - cb->size - sizeof(SmsMsgHdr_ST)); + cb->size - sizeof(struct SmsMsgHdr_ST)); break; case MSG_SMS_RF_TUNE_RES: @@ -46,8 +47,8 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) case MSG_SMS_GET_STATISTICS_RES: { - SmsMsgStatisticsInfo_ST *p = - (SmsMsgStatisticsInfo_ST *)(phdr + 1); + struct SmsMsgStatisticsInfo_ST *p = + (struct SmsMsgStatisticsInfo_ST *)(phdr + 1); if (p->Stat.IsDemodLocked) { client->fe_status = FE_HAS_SIGNAL | @@ -82,7 +83,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) return 0; } -void smsdvb_unregister_client(smsdvb_client_t *client) +void smsdvb_unregister_client(struct smsdvb_client_t *client) { /* must be called under clientslock */ @@ -100,16 +101,16 @@ void smsdvb_onremove(void *context) { kmutex_lock(&g_smsdvb_clientslock); - smsdvb_unregister_client((smsdvb_client_t *) context); + smsdvb_unregister_client((struct smsdvb_client_t *) context); kmutex_unlock(&g_smsdvb_clientslock); } static int smsdvb_start_feed(struct dvb_demux_feed *feed) { - smsdvb_client_t *client = - container_of(feed->demux, smsdvb_client_t, demux); - SmsMsgData_ST PidMsg; + struct smsdvb_client_t *client = + container_of(feed->demux, struct smsdvb_client_t, demux); + struct SmsMsgData_ST PidMsg; printk(KERN_DEBUG "%s add pid %d(%x)\n", __func__, feed->pid, feed->pid); @@ -127,9 +128,9 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed) static int smsdvb_stop_feed(struct dvb_demux_feed *feed) { - smsdvb_client_t *client = - container_of(feed->demux, smsdvb_client_t, demux); - SmsMsgData_ST PidMsg; + struct smsdvb_client_t *client = + container_of(feed->demux, struct smsdvb_client_t, demux); + struct SmsMsgData_ST PidMsg; printk(KERN_DEBUG "%s remove pid %d(%x)\n", __func__, feed->pid, feed->pid); @@ -145,7 +146,7 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) &PidMsg, sizeof(PidMsg)); } -static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, +static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, void *buffer, size_t size, struct completion *completion) { @@ -158,18 +159,19 @@ static int smsdvb_sendrequest_and_wait(smsdvb_client_t *client, 0 : -ETIME; } -static int smsdvb_send_statistics_request(smsdvb_client_t *client) +static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) { - SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, + struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, DVBT_BDA_CONTROL_MSG_ID, - HIF_TASK, sizeof(SmsMsgHdr_ST), 0 }; + HIF_TASK, sizeof(struct SmsMsgHdr_ST), 0 }; return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), &client->stat_done); } static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) { - smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + struct smsdvb_client_t *client = + container_of(fe, struct smsdvb_client_t, frontend); int rc = smsdvb_send_statistics_request(client); if (!rc) @@ -180,7 +182,8 @@ static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) { - smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + struct smsdvb_client_t *client = + container_of(fe, struct smsdvb_client_t, frontend); int rc = smsdvb_send_statistics_request(client); if (!rc) @@ -191,7 +194,8 @@ static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { - smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + struct smsdvb_client_t *client = + container_of(fe, struct smsdvb_client_t, frontend); int rc = smsdvb_send_statistics_request(client); if (!rc) @@ -202,7 +206,8 @@ static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) { - smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + struct smsdvb_client_t *client = + container_of(fe, struct smsdvb_client_t, frontend); int rc = smsdvb_send_statistics_request(client); if (!rc) @@ -225,11 +230,11 @@ static int smsdvb_get_tune_settings(struct dvb_frontend *fe, static int smsdvb_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) { - smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + struct smsdvb_client_t *client = + container_of(fe, struct smsdvb_client_t, frontend); - struct - { - SmsMsgHdr_ST Msg; + struct { + struct SmsMsgHdr_ST Msg; u32 Data[3]; } Msg; @@ -259,7 +264,8 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, static int smsdvb_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) { - smsdvb_client_t *client = container_of(fe, smsdvb_client_t, frontend); + struct smsdvb_client_t *client = + container_of(fe, struct smsdvb_client_t, frontend); printk(KERN_DEBUG "%s\n", __func__); @@ -303,11 +309,11 @@ static struct dvb_frontend_ops smsdvb_fe_ops = { .read_snr = smsdvb_read_snr, }; -int smsdvb_hotplug(smscore_device_t *coredev, +int smsdvb_hotplug(struct smscore_device_t *coredev, struct device *device, int arrival) { - smsclient_params_t params; - smsdvb_client_t *client; + struct smsclient_params_t params; + struct smsdvb_client_t *client; int rc; /* device removal handled by onremove callback */ @@ -320,7 +326,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, return 0; } - client = kzalloc(sizeof(smsdvb_client_t), GFP_KERNEL); + client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); if (!client) { printk(KERN_INFO "%s kmalloc() failed\n", __func__); return -ENOMEM; @@ -439,7 +445,7 @@ void smsdvb_unregister(void) while (!list_empty(&g_smsdvb_clients)) smsdvb_unregister_client( - (smsdvb_client_t *) g_smsdvb_clients.next); + (struct smsdvb_client_t *) g_smsdvb_clients.next); kmutex_unlock(&g_smsdvb_clientslock); } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 82f2e3e4bec..85172f47c73 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -40,33 +40,31 @@ #define USB_PID_NOVA_B 0x0201 #define USB_PID_VEGA 0x0300 -typedef struct _smsusb_device smsusb_device_t; +struct smsusb_device_t; -typedef struct _smsusb_urb -{ - smscore_buffer_t *cb; - smsusb_device_t *dev; +struct smsusb_urb_t { + struct smscore_buffer_t *cb; + struct smsusb_device_t *dev; - struct urb urb; -} smsusb_urb_t; + struct urb urb; +}; -typedef struct _smsusb_device -{ +struct smsusb_device_t { struct usb_device *udev; - smscore_device_t *coredev; + struct smscore_device_t *coredev; - smsusb_urb_t surbs[MAX_URBS]; + struct smsusb_urb_t surbs[MAX_URBS]; int response_alignment; int buffer_size; -} *psmsusb_device_t; +}; -int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb); +int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb); void smsusb_onresponse(struct urb *urb) { - smsusb_urb_t *surb = (smsusb_urb_t *) urb->context; - smsusb_device_t *dev = surb->dev; + struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context; + struct smsusb_device_t *dev = surb->dev; if (urb->status < 0) { printk(KERN_INFO "%s error, urb status %d, %d bytes\n", @@ -75,7 +73,7 @@ void smsusb_onresponse(struct urb *urb) } if (urb->actual_length > 0) { - SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *) surb->cb->p; + struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) surb->cb->p; if (urb->actual_length >= phdr->msgLength) { surb->cb->size = phdr->msgLength; @@ -102,7 +100,7 @@ void smsusb_onresponse(struct urb *urb) /* move buffer pointer and * copy header to its new location */ memcpy((char *) phdr + surb->cb->offset, - phdr, sizeof(SmsMsgHdr_ST)); + phdr, sizeof(struct SmsMsgHdr_ST)); } else surb->cb->offset = 0; @@ -119,7 +117,7 @@ exit_and_resubmit: smsusb_submit_urb(dev, surb); } -int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb) +int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) { if (!surb->cb) { surb->cb = smscore_getbuffer(dev->coredev); @@ -145,7 +143,7 @@ int smsusb_submit_urb(smsusb_device_t *dev, smsusb_urb_t *surb) return usb_submit_urb(&surb->urb, GFP_ATOMIC); } -void smsusb_stop_streaming(smsusb_device_t *dev) +void smsusb_stop_streaming(struct smsusb_device_t *dev) { int i; @@ -159,7 +157,7 @@ void smsusb_stop_streaming(smsusb_device_t *dev) } } -int smsusb_start_streaming(smsusb_device_t *dev) +int smsusb_start_streaming(struct smsusb_device_t *dev) { int i, rc; @@ -178,7 +176,7 @@ int smsusb_start_streaming(smsusb_device_t *dev) int smsusb_sendrequest(void *context, void *buffer, size_t size) { - smsusb_device_t *dev = (smsusb_device_t *) context; + struct smsusb_device_t *dev = (struct smsusb_device_t *) context; int dummy; return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), @@ -235,7 +233,8 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) void smsusb1_detectmode(void *context, int *mode) { - char *product_string = ((smsusb_device_t *) context)->udev->product; + char *product_string = + ((struct smsusb_device_t *) context)->udev->product; *mode = DEVICE_MODE_NONE; @@ -256,8 +255,8 @@ void smsusb1_detectmode(void *context, int *mode) int smsusb1_setmode(void *context, int mode) { - SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, - sizeof(SmsMsgHdr_ST), 0 }; + struct SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, + sizeof(struct SmsMsgHdr_ST), 0 }; if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { printk(KERN_INFO "%s invalid firmware id specified %d\n", @@ -270,7 +269,8 @@ int smsusb1_setmode(void *context, int mode) void smsusb_term_device(struct usb_interface *intf) { - smsusb_device_t *dev = (smsusb_device_t *) usb_get_intfdata(intf); + struct smsusb_device_t *dev = + (struct smsusb_device_t *) usb_get_intfdata(intf); if (dev) { smsusb_stop_streaming(dev); @@ -289,15 +289,15 @@ void smsusb_term_device(struct usb_interface *intf) int smsusb_init_device(struct usb_interface *intf) { - smsdevice_params_t params; - smsusb_device_t *dev; + struct smsdevice_params_t params; + struct smsusb_device_t *dev; int i, rc; /* create device object */ - dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); + dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); if (!dev) { - printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", - __func__); + printk(KERN_INFO "%s kzalloc(sizeof(struct smsusb_device_t) " + "failed\n", __func__); return -ENOMEM; } @@ -334,7 +334,7 @@ int smsusb_init_device(struct usb_interface *intf) dev->buffer_size = USB2_BUFFER_SIZE; dev->response_alignment = dev->udev->ep_in[1]->desc.wMaxPacketSize - - sizeof(SmsMsgHdr_ST); + sizeof(struct SmsMsgHdr_ST); params.flags |= SMS_DEVICE_FAMILY2; break; -- cgit v1.2.3 From e080842c6c31249010adb184f9efbbc5cb40bd2b Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 19:11:37 -0300 Subject: V4L/DVB (8287): sms1xxx: fix WARNING: unnecessary cast may hide bugs fix the following checkpatch.pl warning: WARNING: unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html 596: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:540: + msg = (struct SmsMsgHdr_ST *) kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index e3c6d9cb562..423ca574495 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -489,7 +489,7 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, } /* PAGE_SIZE buffer shall be enough and dma aligned */ - msg = (struct SmsMsgHdr_ST *) kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); + msg = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!msg) return -ENOMEM; -- cgit v1.2.3 From fbd05c8213e7cddca3041c280e5fca5eff0956f9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 19:27:35 -0300 Subject: V4L/DVB (8288): sms1xxx: more cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 423ca574495..89fb5a73fc6 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -734,15 +734,23 @@ int smscore_detect_mode(struct smscore_device_t *coredev) } char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { - /*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"} + /*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"} }; @@ -919,8 +927,8 @@ void smscore_onresponse(struct smscore_device_t *coredev, smscore_find_client(coredev, phdr->msgType, phdr->msgDstId); int rc = -EBUSY; - static unsigned long last_sample_time = 0; - static int data_total = 0; + static unsigned long last_sample_time; /* = 0; */ + static int data_total; /* = 0; */ unsigned long time_now = jiffies_to_msecs(jiffies); if (!last_sample_time) -- cgit v1.2.3 From df0462e77e9aa19d50dbfd540e78f1803e992c25 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 19:39:55 -0300 Subject: V4L/DVB (8289): sms1xxx: remove #if LINUX_VERSION_CODE checks Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 5 +---- drivers/media/dvb/siano/smscoreapi.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 89fb5a73fc6..6b9f512a357 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -200,7 +200,6 @@ void smscore_registry_settype(char *devpath, enum sms_device_type_st type) } - void list_add_locked(struct list_head *new, struct list_head *head, spinlock_t *lock) { @@ -592,7 +591,6 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, loadfirmware_t loadfirmware_handler) { int rc = -ENOENT; - const struct firmware *fw; u8 *fw_buffer; @@ -1228,8 +1226,7 @@ int smscore_map_common_buffer(struct smscore_device_t *coredev, if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, - size, pgprot_noncached(vma->vm_page_prot))) - { + size, pgprot_noncached(vma->vm_page_prot))) { printk(KERN_INFO "%s remap_page_range failed\n", __func__); return -EAGAIN; } diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index be98baf3085..355c22b1d15 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -43,7 +43,6 @@ typedef struct mutex kmutex_t; #define kmutex_trylock(_p_) mutex_trylock(_p_) #define kmutex_unlock(_p_) mutex_unlock(_p_) - #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b)) #endif -- cgit v1.2.3 From d3e72fe75ef7651e49e50f6a5f2c1c6453749e33 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 16 Jun 2008 12:37:05 -0300 Subject: V4L/DVB (8290): sms1xxx: small cleanup Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smsusb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 85172f47c73..29183884d7e 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -427,7 +427,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) } rc = smsusb_init_device(intf); - printk(KERN_INFO "%s rc %d\n", __func__, rc); + printk(KERN_INFO "%s rc %d\n", __func__, rc); return rc; } @@ -437,9 +437,10 @@ void smsusb_disconnect(struct usb_interface *intf) } static struct usb_device_id smsusb_id_table [] = { - { USB_DEVICE(USB_VID_SIANO, 0x0010) }, { USB_DEVICE(USB_VID_SIANO, USB_PID_STELLAR) }, { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) }, + { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_B) }, + { USB_DEVICE(USB_VID_SIANO, USB_PID_VEGA) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, smsusb_id_table); @@ -464,8 +465,8 @@ int smsusb_register(void) void smsusb_unregister(void) { + printk(KERN_DEBUG "%s\n", __func__); /* Regular USB Cleanup */ usb_deregister(&smsusb_driver); - printk(KERN_INFO "%s\n", __func__); } -- cgit v1.2.3 From dd5b2a5c2a6c793d855910864593ad26dd844154 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Wed, 18 Jun 2008 20:25:25 -0300 Subject: V4L/DVB (8291): sms1xxx: change default_mode to 4 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 6b9f512a357..32dbe246963 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -117,7 +117,7 @@ kmutex_t g_smscore_deviceslock; struct list_head g_smscore_registry; kmutex_t g_smscore_registrylock; -static int default_mode = 1; +static int default_mode = 4; module_param(default_mode, int, 0644); MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); -- cgit v1.2.3 From 1c11d546b6c31399ac60f42d3103227cc1164d80 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Wed, 18 Jun 2008 22:09:55 -0300 Subject: 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/Makefile | 2 +- drivers/media/dvb/siano/sms-cards.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/media/dvb/siano/sms-cards.h | 42 ++++++++++++++++++++++ drivers/media/dvb/siano/smscoreapi.c | 12 +++++++ drivers/media/dvb/siano/smscoreapi.h | 3 ++ drivers/media/dvb/siano/smsdvb.c | 7 ++-- drivers/media/dvb/siano/smsusb.c | 44 ++++++++++------------- 7 files changed, 150 insertions(+), 29 deletions(-) create mode 100644 drivers/media/dvb/siano/sms-cards.c create mode 100644 drivers/media/dvb/siano/sms-cards.h (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/Makefile b/drivers/media/dvb/siano/Makefile index e549c4e2bbe..ee0737af98c 100644 --- a/drivers/media/dvb/siano/Makefile +++ b/drivers/media/dvb/siano/Makefile @@ -1,4 +1,4 @@ -sms1xxx-objs := smscoreapi.o smsusb.o smsdvb.o +sms1xxx-objs := smscoreapi.o smsusb.o smsdvb.o sms-cards.o obj-$(CONFIG_DVB_SIANO_SMS1XXX) += sms1xxx.o diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c new file mode 100644 index 00000000000..88fc2a4edc1 --- /dev/null +++ b/drivers/media/dvb/siano/sms-cards.c @@ -0,0 +1,69 @@ +/* + * Card-specific functions for the Siano SMS1xxx USB dongle + * + * Copyright (c) 2008 Michael Krufky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation; + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "sms-cards.h" + +struct usb_device_id smsusb_id_table[] = { + { USB_DEVICE(0x187f, 0x0010), + .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, + { 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), + .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B }, + { USB_DEVICE(0x187f, 0x0300), + .driver_info = SMS1XXX_BOARD_SIANO_VEGA }, + { } /* Terminating entry */ +}; +MODULE_DEVICE_TABLE(usb, smsusb_id_table); + +static struct sms_board sms_boards[] = { + [SMS_BOARD_UNKNOWN] = { + .name = "Unknown board", + }, + [SMS1XXX_BOARD_SIANO_SMS1000] = { + .name = "Siano Digital Receiver", + .type = SMS_STELLAR, + }, + [SMS1XXX_BOARD_SIANO_STELLAR] = { + .name = "Siano Stellar reference board", + .type = SMS_STELLAR, + }, + [SMS1XXX_BOARD_SIANO_NOVA_A] = { + .name = "Siano Nova A reference board", + .type = SMS_NOVA_A0, + }, + [SMS1XXX_BOARD_SIANO_NOVA_B] = { + .name = "Siano Nova B reference board", + .type = SMS_NOVA_B0, + }, + [SMS1XXX_BOARD_SIANO_VEGA] = { + .name = "Siano Vega reference board", + .type = SMS_VEGA, + }, +}; + +struct sms_board *sms_get_board(int id) +{ + BUG_ON(id >= ARRAY_SIZE(sms_boards)); + + return &sms_boards[id]; +} + diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h new file mode 100644 index 00000000000..7ba3df63dff --- /dev/null +++ b/drivers/media/dvb/siano/sms-cards.h @@ -0,0 +1,42 @@ +/* + * Card-specific functions for the Siano SMS1xxx USB dongle + * + * Copyright (c) 2008 Michael Krufky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation; + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SMS_CARDS_H__ +#define __SMS_CARDS_H__ + +#include +#include "smscoreapi.h" + +#define SMS_BOARD_UNKNOWN 0 +#define SMS1XXX_BOARD_SIANO_SMS1000 1 +#define SMS1XXX_BOARD_SIANO_STELLAR 2 +#define SMS1XXX_BOARD_SIANO_NOVA_A 3 +#define SMS1XXX_BOARD_SIANO_NOVA_B 4 +#define SMS1XXX_BOARD_SIANO_VEGA 5 + +struct sms_board { + char *name; + enum sms_device_type_st type; +}; + +struct sms_board *sms_get_board(int id); + +extern struct usb_device_id smsusb_id_table[]; + +#endif /* __SMS_CARDS_H__ */ diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 32dbe246963..a5a3cbf2ffd 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -101,8 +101,20 @@ struct smscore_device_t { struct completion version_ex_done, data_download_done, trigger_done; struct completion init_device_done, reload_start_done, resume_done; + + int board_id; }; +void smscore_set_board_id(struct smscore_device_t *core, int id) +{ + core->board_id = id; +} + +int smscore_get_board_id(struct smscore_device_t *core) +{ + return core->board_id; +} + struct smscore_registry_entry_t { struct list_head entry; char devpath[32]; diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 355c22b1d15..1962f016612 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -403,6 +403,9 @@ extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *cored extern void smscore_putbuffer(struct smscore_device_t *coredev, struct smscore_buffer_t *cb); +void smscore_set_board_id(struct smscore_device_t *core, int id); +int smscore_get_board_id(struct smscore_device_t *core); + /* smsdvb.c */ int smsdvb_register(void); void smsdvb_unregister(void); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index b17696fcbbc..88b2bd2821d 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -23,6 +23,7 @@ #include #include "smscoreapi.h" +#include "sms-cards.h" DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -282,7 +283,7 @@ static void smsdvb_release(struct dvb_frontend *fe) static struct dvb_frontend_ops smsdvb_fe_ops = { .info = { - .name = "Siano Mobile Digital SMS10xx", + .name = "Siano Mobile Digital SMS1xxx", .type = FE_OFDM, .frequency_min = 44250000, .frequency_max = 867250000, @@ -333,7 +334,9 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, } /* register dvb adapter */ - rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", + rc = dvb_register_adapter(&client->adapter, + sms_get_board( + smscore_get_board_id(coredev))->name, THIS_MODULE, device, adapter_nr); if (rc < 0) { printk(KERN_ERR "%s dvb_register_adapter() failed %d\n", diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 29183884d7e..bb8a364477f 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -25,6 +25,7 @@ #include #include "smscoreapi.h" +#include "sms-cards.h" #define USB1_BUFFER_SIZE 0x1000 #define USB2_BUFFER_SIZE 0x4000 @@ -32,14 +33,6 @@ #define MAX_BUFFERS 50 #define MAX_URBS 10 -/* TO DO: move these to a header file */ -#define USB_VID_SIANO 0x187f - -#define USB_PID_STELLAR 0x0100 -#define USB_PID_NOVA_A 0x0200 -#define USB_PID_NOVA_B 0x0201 -#define USB_PID_VEGA 0x0300 - struct smsusb_device_t; struct smsusb_urb_t { @@ -287,10 +280,11 @@ void smsusb_term_device(struct usb_interface *intf) usb_set_intfdata(intf, NULL); } -int smsusb_init_device(struct usb_interface *intf) +int smsusb_init_device(struct usb_interface *intf, int board_id) { struct smsdevice_params_t params; struct smsusb_device_t *dev; + struct sms_board *board; int i, rc; /* create device object */ @@ -305,9 +299,11 @@ int smsusb_init_device(struct usb_interface *intf) usb_set_intfdata(intf, dev); dev->udev = interface_to_usbdev(intf); - switch (dev->udev->descriptor.idProduct) { + board = sms_get_board(board_id); + + switch (board->type) { - case USB_PID_STELLAR: + case SMS_STELLAR: dev->buffer_size = USB1_BUFFER_SIZE; params.setmode_handler = smsusb1_setmode; @@ -316,19 +312,22 @@ int smsusb_init_device(struct usb_interface *intf) printk(KERN_INFO "%s stellar device found\n", __func__); break; default: - switch (dev->udev->descriptor.idProduct) { - case USB_PID_NOVA_A: + switch (board->type) { + case SMS_NOVA_A0: params.device_type = SMS_NOVA_A0; printk(KERN_INFO "%s nova A0 found\n", __func__); break; - default: - case USB_PID_NOVA_B: + case SMS_NOVA_B0: params.device_type = SMS_NOVA_B0; printk(KERN_INFO "%s nova B0 found\n", __func__); break; - case USB_PID_VEGA: + case SMS_VEGA: params.device_type = SMS_VEGA; printk(KERN_INFO "%s Vega found\n", __func__); + break; + default: + printk(KERN_ERR "%s Unspecified sms device type!\n", + __func__); } dev->buffer_size = USB2_BUFFER_SIZE; @@ -357,6 +356,8 @@ int smsusb_init_device(struct usb_interface *intf) return rc; } + smscore_set_board_id(dev->coredev, board_id); + /* initialize urbs */ for (i = 0; i < MAX_URBS; i++) { dev->surbs[i].dev = dev; @@ -426,7 +427,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) udev, smscore_registry_getmode(devpath)); } - rc = smsusb_init_device(intf); + rc = smsusb_init_device(intf, id->driver_info); printk(KERN_INFO "%s rc %d\n", __func__, rc); return rc; } @@ -436,15 +437,6 @@ void smsusb_disconnect(struct usb_interface *intf) smsusb_term_device(intf); } -static struct usb_device_id smsusb_id_table [] = { - { USB_DEVICE(USB_VID_SIANO, USB_PID_STELLAR) }, - { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) }, - { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_B) }, - { USB_DEVICE(USB_VID_SIANO, USB_PID_VEGA) }, - { } /* Terminating entry */ -}; -MODULE_DEVICE_TABLE(usb, smsusb_id_table); - static struct usb_driver smsusb_driver = { .name = "smsusb", .probe = smsusb_probe, -- cgit v1.2.3 From 068d6c0f5d6c67d0e93f8e214897ddd64746be4e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 19 Jun 2008 01:15:46 -0300 Subject: V4L/DVB (8293): sms1xxx: create printk macros Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 161 +++++++++++++++++------------------ drivers/media/dvb/siano/smscoreapi.h | 5 ++ drivers/media/dvb/siano/smsdvb.c | 46 +++++----- drivers/media/dvb/siano/smsusb.c | 106 +++++++++++------------ 4 files changed, 161 insertions(+), 157 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index a5a3cbf2ffd..a35513ef74a 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -34,16 +34,16 @@ #include "smscoreapi.h" #define PERROR(fmt, args...)\ - printk(KERN_ERR "smscore error: line %d- %s(): " fmt, \ + sms_err("smscore error: line %d- %s(): " fmt, \ __LINE__, __func__, ## args) #ifdef SMSCORE_DEBUG #undef PWARNING -# define PWARNING(fmt, args...) printk(KERN_INFO "smscore warning: " \ +# define PWARNING(fmt, args...) sms_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, \ +# define PDEBUG(fmt, args...) sms_info("smscore - %s(): " fmt, \ __func__, ## args) #else /*SMSCORE_DEBUG*/ #define PDEBUG(fmt, args...) @@ -157,8 +157,8 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) strcpy(entry->devpath, devpath); list_add(&entry->entry, &g_smscore_registry); } else - printk(KERN_ERR "%s failed to create smscore_registry.\n", - __func__); + sms_err("%s failed to create smscore_registry.\n", + __func__); kmutex_unlock(&g_smscore_registrylock); return entry; } @@ -171,7 +171,7 @@ int smscore_registry_getmode(char *devpath) if (entry) return entry->mode; else - printk(KERN_ERR "%s No registry found.\n", __func__); + sms_err("%s No registry found.\n", __func__); return default_mode; } @@ -184,7 +184,7 @@ enum sms_device_type_st smscore_registry_gettype(char *devpath) if (entry) return entry->type; else - printk(KERN_ERR "%s No registry found.\n", __func__); + sms_err("%s No registry found.\n", __func__); return -1; } @@ -197,7 +197,7 @@ void smscore_registry_setmode(char *devpath, int mode) if (entry) entry->mode = mode; else - printk(KERN_ERR "%s No registry found.\n", __func__); + sms_err("%s No registry found.\n", __func__); } void smscore_registry_settype(char *devpath, enum sms_device_type_st type) @@ -208,7 +208,7 @@ void smscore_registry_settype(char *devpath, enum sms_device_type_st type) if (entry) entry->type = type; else - printk(KERN_ERR "%s No registry found.\n", __func__); + sms_err("%s No registry found.\n", __func__); } @@ -331,7 +331,7 @@ struct smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, struct smscore_buffer_t *cb = kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL); if (!cb) { - printk(KERN_INFO "%s kmalloc(...) failed\n", __func__); + sms_info("%s kmalloc(...) failed\n", __func__); return NULL; } @@ -360,7 +360,7 @@ int smscore_register_device(struct smsdevice_params_t *params, dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL); if (!dev) { - printk(KERN_INFO "%s kzalloc(...) failed\n", __func__); + sms_info("%s kzalloc(...) failed\n", __func__); return -ENOMEM; } @@ -408,8 +408,8 @@ int smscore_register_device(struct smsdevice_params_t *params, smscore_putbuffer(dev, cb); } - printk(KERN_INFO "%s allocated %d buffers\n", - __func__, dev->num_buffers); + sms_info("%s allocated %d buffers\n", + __func__, dev->num_buffers); dev->mode = DEVICE_MODE_NONE; dev->context = params->context; @@ -432,7 +432,7 @@ int smscore_register_device(struct smsdevice_params_t *params, *coredev = dev; - printk(KERN_INFO "%s device %p created\n", __func__, dev); + sms_info("%s device %p created\n", __func__, dev); return 0; } @@ -450,8 +450,8 @@ int smscore_start_device(struct 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); + sms_info("%s set device mode faile , rc %d\n", + __func__, rc); return rc; } @@ -459,8 +459,8 @@ int smscore_start_device(struct smscore_device_t *coredev) rc = smscore_notify_callbacks(coredev, coredev->device, 1); - printk(KERN_INFO "%s device %p started, rc %d\n", - __func__, coredev, rc); + sms_info("%s device %p started, rc %d\n", + __func__, coredev, rc); kmutex_unlock(&g_smscore_deviceslock); @@ -472,8 +472,8 @@ int smscore_sendrequest_and_wait(struct 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); + sms_info("%s sendrequest returned error %d\n", + __func__, rc); return rc; } @@ -491,8 +491,8 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, 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); + sms_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); if (rc < 0) @@ -578,8 +578,8 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, msleep(500); } - printk(KERN_DEBUG "%s rc=%d, postload=%p \n", __func__, rc, - coredev->postload_handler); + sms_debug("%s rc=%d, postload=%p \n", __func__, rc, + coredev->postload_handler); kfree(msg); @@ -612,12 +612,12 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, rc = request_firmware(&fw, filename, coredev->device); if (rc < 0) { - printk(KERN_INFO "%s failed to open \"%s\"\n", - __func__, filename); + sms_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); + sms_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) { @@ -632,8 +632,8 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, kfree(fw_buffer); } else { - printk(KERN_INFO "%s failed to allocate firmware buffer\n", - __func__); + sms_info("%s failed to allocate firmware buffer\n", + __func__); rc = -ENOMEM; } @@ -680,17 +680,17 @@ void smscore_unregister_device(struct smscore_device_t *coredev) if (num_buffers == coredev->num_buffers) break; if (++retry > 10) { - printk(KERN_INFO "%s exiting although " - "not all buffers released.\n", __func__); + sms_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); + sms_info("%s waiting for %d buffer(s)\n", __func__, + coredev->num_buffers - num_buffers); msleep(100); } - printk(KERN_INFO "%s freed %d buffers\n", __func__, num_buffers); + sms_info("%s freed %d buffers\n", __func__, num_buffers); if (coredev->common_buffer) dma_free_coherent(NULL, coredev->common_buffer_size, @@ -702,7 +702,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev) kmutex_unlock(&g_smscore_deviceslock); - printk(KERN_INFO "%s device %p destroyed\n", __func__, coredev); + sms_info("%s device %p destroyed\n", __func__, coredev); } int smscore_detect_mode(struct smscore_device_t *coredev) @@ -722,8 +722,8 @@ int smscore_detect_mode(struct smscore_device_t *coredev) rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc == -ETIME) { - printk(KERN_ERR "%s: MSG_SMS_GET_VERSION_EX_REQ " - "failed first try\n", __func__); + sms_err("%s: MSG_SMS_GET_VERSION_EX_REQ " + "failed first try\n", __func__); if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) { @@ -731,9 +731,9 @@ int smscore_detect_mode(struct smscore_device_t *coredev) coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc < 0) - printk(KERN_ERR "%s: " - "MSG_SMS_GET_VERSION_EX_REQ failed " - "second try, rc %d\n", __func__, rc); + sms_err("%s: " + "MSG_SMS_GET_VERSION_EX_REQ failed " + "second try, rc %d\n", __func__, rc); } else rc = -ETIME; } @@ -783,8 +783,8 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) 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) { - printk(KERN_INFO "%s invalid mode specified %d\n", - __func__, mode); + sms_info("%s invalid mode specified %d\n", + __func__, mode); return -EINVAL; } @@ -793,15 +793,15 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int 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); + sms_info("%s mode detect failed %d\n", + __func__, rc); return rc; } } if (coredev->mode == mode) { - printk(KERN_INFO "%s device mode %d already set\n", - __func__, mode); + sms_info("%s device mode %d already set\n", + __func__, mode); return 0; } @@ -810,13 +810,13 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) 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); + sms_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); + sms_info("%s mode %d supported by running " + "firmware\n", __func__, mode); buffer = kmalloc(sizeof(struct SmsMsgData_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); @@ -835,14 +835,14 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) kfree(buffer); } else { - printk(KERN_INFO "%s Could not allocate buffer for " - "init device message.\n", __func__); + sms_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); + sms_info("%s invalid mode specified %d\n", + __func__, mode); return -EINVAL; } @@ -862,7 +862,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) } if (rc != 0) - printk(KERN_INFO "%s return error code %d.\n", __func__, rc); + sms_info("%s return error code %d.\n", __func__, rc); return rc; } @@ -945,9 +945,9 @@ void smscore_onresponse(struct smscore_device_t *coredev, last_sample_time = time_now; if (time_now - last_sample_time > 10000) { - printk(KERN_DEBUG "\n%s data rate %d bytes/secs\n", __func__, - (int)((data_total * 1000) / - (time_now - last_sample_time))); + sms_debug("\n%s data rate %d bytes/secs\n", __func__, + (int)((data_total * 1000) / + (time_now - last_sample_time))); last_sample_time = time_now; data_total = 0; @@ -965,10 +965,10 @@ void smscore_onresponse(struct smscore_device_t *coredev, { struct SmsVersionRes_ST *ver = (struct SmsVersionRes_ST *) phdr; - printk(KERN_DEBUG "%s: MSG_SMS_GET_VERSION_EX_RES " - "id %d prots 0x%x ver %d.%d\n", __func__, - ver->FirmwareId, ver->SupportedProtocols, - ver->RomVersionMajor, ver->RomVersionMinor); + sms_debug("%s: MSG_SMS_GET_VERSION_EX_RES " + "id %d prots 0x%x ver %d.%d\n", __func__, + ver->FirmwareId, ver->SupportedProtocols, + ver->RomVersionMajor, ver->RomVersionMinor); coredev->mode = ver->FirmwareId == 255 ? DEVICE_MODE_NONE : ver->FirmwareId; @@ -978,26 +978,25 @@ void smscore_onresponse(struct smscore_device_t *coredev, break; } case MSG_SMS_INIT_DEVICE_RES: - printk(KERN_DEBUG "%s: MSG_SMS_INIT_DEVICE_RES\n", - __func__); + sms_debug("%s: MSG_SMS_INIT_DEVICE_RES\n", + __func__); complete(&coredev->init_device_done); break; case MSG_SW_RELOAD_START_RES: - printk(KERN_DEBUG "%s: MSG_SW_RELOAD_START_RES\n", - __func__); + sms_debug("%s: MSG_SW_RELOAD_START_RES\n", + __func__); complete(&coredev->reload_start_done); break; case MSG_SMS_DATA_DOWNLOAD_RES: complete(&coredev->data_download_done); break; case MSG_SW_RELOAD_EXEC_RES: - printk(KERN_DEBUG "%s: MSG_SW_RELOAD_EXEC_RES\n", - __func__); + sms_debug("%s: MSG_SW_RELOAD_EXEC_RES\n", + __func__); break; case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: - printk(KERN_DEBUG - "%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", - __func__); + sms_debug("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", + __func__); complete(&coredev->trigger_done); break; case MSG_SMS_SLEEP_RESUME_COMP_IND: @@ -1150,7 +1149,7 @@ void smscore_unregister_client(struct smscore_client_t *client) kfree(identry); } - printk(KERN_INFO "%s %p\n", __func__, client->context); + sms_info("%s %p\n", __func__, client->context); list_del(&client->entry); kfree(client); @@ -1177,7 +1176,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, int rc; if (client == NULL) { - printk(KERN_ERR "%s Got NULL client\n", __func__); + sms_err("%s Got NULL client\n", __func__); return -EINVAL; } @@ -1185,7 +1184,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, /* check that no other channel with same id exists */ if (coredev == NULL) { - printk(KERN_ERR "%s Got NULL coredev\n", __func__); + sms_err("%s Got NULL coredev\n", __func__); return -EINVAL; } @@ -1226,20 +1225,20 @@ int smscore_map_common_buffer(struct smscore_device_t *coredev, if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || (vma->vm_flags & VM_WRITE)) { - printk(KERN_INFO "%s invalid vm flags\n", __func__); + sms_info("%s invalid vm flags\n", __func__); return -EINVAL; } if ((end - start) != size) { - printk(KERN_INFO "%s invalid size %d expected %d\n", - __func__, (int)(end - start), (int) size); + sms_info("%s invalid size %d expected %d\n", + __func__, (int)(end - start), (int) size); return -EINVAL; } if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, size, pgprot_noncached(vma->vm_page_prot))) { - printk(KERN_INFO "%s remap_page_range failed\n", __func__); + sms_info("%s remap_page_range failed\n", __func__); return -EAGAIN; } @@ -1263,7 +1262,7 @@ int smscore_module_init(void) /* DVB Register */ rc = smsdvb_register(); - printk(KERN_INFO "%s, rc %d\n", __func__, rc); + sms_info("%s, rc %d\n", __func__, rc); return rc; } @@ -1299,7 +1298,7 @@ void smscore_module_exit(void) /* Unregister USB */ smsusb_unregister(); - printk(KERN_INFO "%s\n", __func__); + sms_info("%s\n", __func__); } module_init(smscore_module_init); diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 1962f016612..2799ea7bb41 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -414,4 +414,9 @@ void smsdvb_unregister(void); int smsusb_register(void); void smsusb_unregister(void); +#define sms_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) +#define sms_info(fmt, arg...) printk(KERN_INFO fmt, ##arg) +#define sms_debug(fmt, arg...) printk(KERN_DEBUG fmt, ##arg) + + #endif /* __smscoreapi_h__ */ diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 88b2bd2821d..57ab7db56a6 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -113,8 +113,8 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed) container_of(feed->demux, struct smsdvb_client_t, demux); struct SmsMsgData_ST PidMsg; - printk(KERN_DEBUG "%s add pid %d(%x)\n", __func__, - feed->pid, feed->pid); + sms_debug("%s add pid %d(%x)\n", __func__, + feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; PidMsg.xMsgHeader.msgDstId = HIF_TASK; @@ -133,8 +133,8 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) container_of(feed->demux, struct smsdvb_client_t, demux); struct SmsMsgData_ST PidMsg; - printk(KERN_DEBUG "%s remove pid %d(%x)\n", __func__, - feed->pid, feed->pid); + sms_debug("%s remove pid %d(%x)\n", __func__, + feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; PidMsg.xMsgHeader.msgDstId = HIF_TASK; @@ -220,7 +220,7 @@ static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) { - printk(KERN_DEBUG "%s\n", __func__); + sms_debug("%s\n", __func__); tune->min_delay_ms = 400; tune->step_size = 250000; @@ -247,8 +247,8 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, Msg.Data[0] = fep->frequency; Msg.Data[2] = 12000000; - printk(KERN_DEBUG "%s freq %d band %d\n", __func__, - fep->frequency, fep->u.ofdm.bandwidth); + sms_debug("%s freq %d band %d\n", __func__, + fep->frequency, fep->u.ofdm.bandwidth); switch (fep->u.ofdm.bandwidth) { case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; @@ -268,7 +268,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, struct smsdvb_client_t *client = container_of(fe, struct smsdvb_client_t, frontend); - printk(KERN_DEBUG "%s\n", __func__); + sms_debug("%s\n", __func__); /* todo: */ memcpy(fep, &client->fe_params, @@ -322,14 +322,14 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, return 0; if (smscore_get_device_mode(coredev) != 4) { - printk(KERN_ERR "%sSMS Device mode is not set for " - "DVB operation.\n", __func__); + sms_err("%sSMS Device mode is not set for " + "DVB operation.\n", __func__); return 0; } client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); if (!client) { - printk(KERN_INFO "%s kmalloc() failed\n", __func__); + sms_info("%s kmalloc() failed\n", __func__); return -ENOMEM; } @@ -339,8 +339,8 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, smscore_get_board_id(coredev))->name, THIS_MODULE, device, adapter_nr); if (rc < 0) { - printk(KERN_ERR "%s dvb_register_adapter() failed %d\n", - __func__, rc); + sms_err("%s dvb_register_adapter() failed %d\n", + __func__, rc); goto adapter_error; } @@ -353,8 +353,8 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = dvb_dmx_init(&client->demux); if (rc < 0) { - printk(KERN_ERR "%s dvb_dmx_init failed %d\n\n", - __func__, rc); + sms_err("%s dvb_dmx_init failed %d\n\n", + __func__, rc); goto dvbdmx_error; } @@ -365,8 +365,8 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); if (rc < 0) { - printk(KERN_ERR "%s dvb_dmxdev_init failed %d\n", - __func__, rc); + sms_err("%s dvb_dmxdev_init failed %d\n", + __func__, rc); goto dmxdev_error; } @@ -376,8 +376,8 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = dvb_register_frontend(&client->adapter, &client->frontend); if (rc < 0) { - printk(KERN_ERR "%s frontend registration failed %d\n", - __func__, rc); + sms_err("%s frontend registration failed %d\n", + __func__, rc); goto frontend_error; } @@ -389,8 +389,8 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = smscore_register_client(coredev, ¶ms, &client->smsclient); if (rc < 0) { - printk(KERN_INFO "%s smscore_register_client() failed %d\n", - __func__, rc); + sms_info("%s smscore_register_client() failed %d\n", + __func__, rc); goto client_error; } @@ -405,7 +405,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, kmutex_unlock(&g_smsdvb_clientslock); - printk(KERN_INFO "%s success\n", __func__); + sms_info("%s success\n", __func__); return 0; @@ -435,7 +435,7 @@ int smsdvb_register(void) rc = smscore_register_hotplug(smsdvb_hotplug); - printk(KERN_INFO "%s\n", __func__); + sms_info("%s\n", __func__); return rc; } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index bb8a364477f..34e60482fac 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -60,8 +60,8 @@ void smsusb_onresponse(struct urb *urb) struct smsusb_device_t *dev = surb->dev; if (urb->status < 0) { - printk(KERN_INFO "%s error, urb status %d, %d bytes\n", - __func__, urb->status, urb->actual_length); + sms_info("%s error, urb status %d, %d bytes\n", + __func__, urb->status, urb->actual_length); return; } @@ -81,12 +81,12 @@ void smsusb_onresponse(struct urb *urb) /* sanity check */ if (((int) phdr->msgLength + surb->cb->offset) > urb->actual_length) { - printk(KERN_INFO "%s: invalid " - "response msglen %d offset %d " - "size %d\n", __func__, - phdr->msgLength, - surb->cb->offset, - urb->actual_length); + sms_info("%s: invalid response " + "msglen %d offset %d " + "size %d\n", __func__, + phdr->msgLength, + surb->cb->offset, + urb->actual_length); goto exit_and_resubmit; } @@ -100,9 +100,9 @@ void smsusb_onresponse(struct urb *urb) smscore_onresponse(dev->coredev, surb->cb); surb->cb = NULL; } else { - printk(KERN_INFO "%s invalid response " - "msglen %d actual %d\n", __func__, - phdr->msgLength, urb->actual_length); + sms_info("%s invalid response " + "msglen %d actual %d\n", __func__, + phdr->msgLength, urb->actual_length); } } @@ -115,8 +115,8 @@ int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) if (!surb->cb) { surb->cb = smscore_getbuffer(dev->coredev); if (!surb->cb) { - printk(KERN_INFO "%s smscore_getbuffer(...) " - "returned NULL\n", __func__); + sms_info("%s smscore_getbuffer(...) " + "returned NULL\n", __func__); return -ENOMEM; } } @@ -157,8 +157,8 @@ int smsusb_start_streaming(struct smsusb_device_t *dev) for (i = 0; i < MAX_URBS; i++) { rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { - printk(KERN_INFO "%s smsusb_submit_urb(...) " - "failed\n", __func__); + sms_info("%s smsusb_submit_urb(...) " + "failed\n", __func__); smsusb_stop_streaming(dev); break; } @@ -191,15 +191,15 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) int rc, dummy; if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { - printk(KERN_INFO "%s invalid firmware id specified %d\n", - __func__, id); + sms_info("%s invalid firmware id specified %d\n", + __func__, id); return -EINVAL; } rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); if (rc < 0) { - printk(KERN_INFO "%s failed to open \"%s\" mode %d\n", - __func__, smsusb1_fw_lkup[id], id); + sms_info("%s failed to open \"%s\" mode %d\n", + __func__, smsusb1_fw_lkup[id], id); return rc; } @@ -210,12 +210,12 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), fw_buffer, fw->size, &dummy, 1000); - printk(KERN_INFO "%s: sent %d(%d) bytes, rc %d\n", - __func__, fw->size, dummy, rc); + sms_info("%s: sent %d(%d) bytes, rc %d\n", + __func__, fw->size, dummy, rc); kfree(fw_buffer); } else { - printk(KERN_INFO "failed to allocate firmware buffer\n"); + sms_info("failed to allocate firmware buffer\n"); rc = -ENOMEM; } @@ -233,7 +233,7 @@ void smsusb1_detectmode(void *context, int *mode) if (!product_string) { product_string = "none"; - printk(KERN_ERR "%s product string not found\n", __func__); + sms_err("%s product string not found\n", __func__); } else if (strstr(product_string, "DVBH")) *mode = 1; else if (strstr(product_string, "BDA")) @@ -243,7 +243,7 @@ void smsusb1_detectmode(void *context, int *mode) else if (strstr(product_string, "TDMB")) *mode = 2; - printk(KERN_INFO "%s: %d \"%s\"\n", __func__, *mode, product_string); + sms_info("%s: %d \"%s\"\n", __func__, *mode, product_string); } int smsusb1_setmode(void *context, int mode) @@ -252,8 +252,8 @@ int smsusb1_setmode(void *context, int mode) sizeof(struct SmsMsgHdr_ST), 0 }; if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { - printk(KERN_INFO "%s invalid firmware id specified %d\n", - __func__, mode); + sms_info("%s invalid firmware id specified %d\n", + __func__, mode); return -EINVAL; } @@ -274,7 +274,7 @@ void smsusb_term_device(struct usb_interface *intf) kfree(dev); - printk(KERN_INFO "%s device %p destroyed\n", __func__, dev); + sms_info("%s device %p destroyed\n", __func__, dev); } usb_set_intfdata(intf, NULL); @@ -290,8 +290,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) /* create device object */ dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); if (!dev) { - printk(KERN_INFO "%s kzalloc(sizeof(struct smsusb_device_t) " - "failed\n", __func__); + sms_info("%s kzalloc(sizeof(struct smsusb_device_t) " + "failed\n", __func__); return -ENOMEM; } @@ -309,25 +309,25 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) params.setmode_handler = smsusb1_setmode; params.detectmode_handler = smsusb1_detectmode; params.device_type = SMS_STELLAR; - printk(KERN_INFO "%s stellar device found\n", __func__); + sms_info("%s stellar device found\n", __func__); break; default: switch (board->type) { case SMS_NOVA_A0: params.device_type = SMS_NOVA_A0; - printk(KERN_INFO "%s nova A0 found\n", __func__); + sms_info("%s nova A0 found\n", __func__); break; case SMS_NOVA_B0: params.device_type = SMS_NOVA_B0; - printk(KERN_INFO "%s nova B0 found\n", __func__); + sms_info("%s nova B0 found\n", __func__); break; case SMS_VEGA: params.device_type = SMS_VEGA; - printk(KERN_INFO "%s Vega found\n", __func__); + sms_info("%s Vega found\n", __func__); break; default: - printk(KERN_ERR "%s Unspecified sms device type!\n", - __func__); + sms_err("%s Unspecified sms device type!\n", + __func__); } dev->buffer_size = USB2_BUFFER_SIZE; @@ -350,8 +350,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) /* register in smscore */ rc = smscore_register_device(¶ms, &dev->coredev); if (rc < 0) { - printk(KERN_INFO "%s smscore_register_device(...) failed, " - "rc %d\n", __func__, rc); + sms_info("%s smscore_register_device(...) failed, " + "rc %d\n", __func__, rc); smsusb_term_device(intf); return rc; } @@ -364,24 +364,24 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) usb_init_urb(&dev->surbs[i].urb); } - printk(KERN_INFO "%s smsusb_start_streaming(...).\n", __func__); + sms_info("%s smsusb_start_streaming(...).\n", __func__); rc = smsusb_start_streaming(dev); if (rc < 0) { - printk(KERN_INFO "%s smsusb_start_streaming(...) failed\n", - __func__); + sms_info("%s smsusb_start_streaming(...) failed\n", + __func__); smsusb_term_device(intf); return rc; } rc = smscore_start_device(dev->coredev); if (rc < 0) { - printk(KERN_INFO "%s smscore_start_device(...) failed\n", - __func__); + sms_info("%s smscore_start_device(...) failed\n", + __func__); smsusb_term_device(intf); return rc; } - printk(KERN_INFO "%s device %p created\n", __func__, dev); + sms_info("%s device %p created\n", __func__, dev); return rc; } @@ -399,36 +399,36 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) rc = usb_set_interface( udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); if (rc < 0) { - printk(KERN_INFO "%s usb_set_interface failed, " - "rc %d\n", __func__, rc); + sms_info("%s usb_set_interface failed, " + "rc %d\n", __func__, rc); return rc; } } - printk(KERN_INFO "smsusb_probe %d\n", + sms_info("smsusb_probe %d\n", intf->cur_altsetting->desc.bInterfaceNumber); for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) - printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, + sms_info("endpoint %d %02x %02x %d\n", i, intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, intf->cur_altsetting->endpoint[i].desc.bmAttributes, intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); if ((udev->actconfig->desc.bNumInterfaces == 2) && (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { - printk(KERN_INFO "rom interface 0 is not used\n"); + sms_info("rom interface 0 is not used\n"); return -ENODEV; } if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { snprintf(devpath, sizeof(devpath), "usb\\%d-%s", udev->bus->busnum, udev->devpath); - printk(KERN_INFO "stellar device was found.\n"); + sms_info("stellar device was found.\n"); return smsusb1_load_firmware( udev, smscore_registry_getmode(devpath)); } rc = smsusb_init_device(intf, id->driver_info); - printk(KERN_INFO "%s rc %d\n", __func__, rc); + sms_info("%s rc %d\n", __func__, rc); return rc; } @@ -448,16 +448,16 @@ int smsusb_register(void) { int rc = usb_register(&smsusb_driver); if (rc) - printk(KERN_INFO "usb_register failed. Error number %d\n", rc); + sms_info("usb_register failed. Error number %d\n", rc); - printk(KERN_INFO "%s\n", __func__); + sms_info("%s\n", __func__); return rc; } void smsusb_unregister(void) { - printk(KERN_DEBUG "%s\n", __func__); + sms_debug("%s\n", __func__); /* Regular USB Cleanup */ usb_deregister(&smsusb_driver); } -- cgit v1.2.3 From a0c0abcb1fdb316dee3a38cff9843d7d094c327c Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 19 Jun 2008 20:35:21 -0300 Subject: V4L/DVB (8294): sms1xxx: move message formatting into printk macros Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 142 +++++++++++++++-------------------- drivers/media/dvb/siano/smscoreapi.h | 9 ++- drivers/media/dvb/siano/smsdvb.c | 35 ++++----- drivers/media/dvb/siano/smsusb.c | 90 +++++++++++----------- 4 files changed, 125 insertions(+), 151 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index a35513ef74a..6e2cc3d5716 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -157,8 +157,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) strcpy(entry->devpath, devpath); list_add(&entry->entry, &g_smscore_registry); } else - sms_err("%s failed to create smscore_registry.\n", - __func__); + sms_err("failed to create smscore_registry."); kmutex_unlock(&g_smscore_registrylock); return entry; } @@ -171,7 +170,7 @@ int smscore_registry_getmode(char *devpath) if (entry) return entry->mode; else - sms_err("%s No registry found.\n", __func__); + sms_err("No registry found."); return default_mode; } @@ -184,7 +183,7 @@ enum sms_device_type_st smscore_registry_gettype(char *devpath) if (entry) return entry->type; else - sms_err("%s No registry found.\n", __func__); + sms_err("No registry found."); return -1; } @@ -197,7 +196,7 @@ void smscore_registry_setmode(char *devpath, int mode) if (entry) entry->mode = mode; else - sms_err("%s No registry found.\n", __func__); + sms_err("No registry found."); } void smscore_registry_settype(char *devpath, enum sms_device_type_st type) @@ -208,7 +207,7 @@ void smscore_registry_settype(char *devpath, enum sms_device_type_st type) if (entry) entry->type = type; else - sms_err("%s No registry found.\n", __func__); + sms_err("No registry found."); } @@ -331,7 +330,7 @@ struct smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, struct smscore_buffer_t *cb = kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL); if (!cb) { - sms_info("%s kmalloc(...) failed\n", __func__); + sms_info("kmalloc(...) failed"); return NULL; } @@ -360,7 +359,7 @@ int smscore_register_device(struct smsdevice_params_t *params, dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL); if (!dev) { - sms_info("%s kzalloc(...) failed\n", __func__); + sms_info("kzalloc(...) failed"); return -ENOMEM; } @@ -408,8 +407,7 @@ int smscore_register_device(struct smsdevice_params_t *params, smscore_putbuffer(dev, cb); } - sms_info("%s allocated %d buffers\n", - __func__, dev->num_buffers); + sms_info("allocated %d buffers", dev->num_buffers); dev->mode = DEVICE_MODE_NONE; dev->context = params->context; @@ -432,7 +430,7 @@ int smscore_register_device(struct smsdevice_params_t *params, *coredev = dev; - sms_info("%s device %p created\n", __func__, dev); + sms_info("device %p created", dev); return 0; } @@ -450,8 +448,7 @@ int smscore_start_device(struct smscore_device_t *coredev) int rc = smscore_set_device_mode( coredev, smscore_registry_getmode(coredev->devpath)); if (rc < 0) { - sms_info("%s set device mode faile , rc %d\n", - __func__, rc); + sms_info("set device mode faile , rc %d", rc); return rc; } @@ -459,8 +456,7 @@ int smscore_start_device(struct smscore_device_t *coredev) rc = smscore_notify_callbacks(coredev, coredev->device, 1); - sms_info("%s device %p started, rc %d\n", - __func__, coredev, rc); + sms_info("device %p started, rc %d", coredev, rc); kmutex_unlock(&g_smscore_deviceslock); @@ -472,8 +468,7 @@ int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, { int rc = coredev->sendrequest_handler(coredev->context, buffer, size); if (rc < 0) { - sms_info("%s sendrequest returned error %d\n", - __func__, rc); + sms_info("sendrequest returned error %d", rc); return rc; } @@ -491,8 +486,8 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, u8 *payload = firmware->Payload; int rc = 0; - sms_info("%s loading FW to addr 0x%x size %d\n", - __func__, mem_address, firmware->Length); + sms_info("loading FW to addr 0x%x size %d", + mem_address, firmware->Length); if (coredev->preload_handler) { rc = coredev->preload_handler(coredev->context); if (rc < 0) @@ -505,7 +500,7 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, return -ENOMEM; if (coredev->mode != DEVICE_MODE_NONE) { - PDEBUG("Sending reload command\n"); + PDEBUG("Sending reload command"); SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ, sizeof(struct SmsMsgHdr_ST)); rc = smscore_sendrequest_and_wait(coredev, msg, @@ -578,7 +573,7 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, msleep(500); } - sms_debug("%s rc=%d, postload=%p \n", __func__, rc, + sms_debug("rc=%d, postload=%p ", rc, coredev->postload_handler); kfree(msg); @@ -612,12 +607,10 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, rc = request_firmware(&fw, filename, coredev->device); if (rc < 0) { - sms_info("%s failed to open \"%s\"\n", - __func__, filename); + sms_info("failed to open \"%s\"", filename); return rc; } - sms_info("%s read FW %s, size=%d\"\n", __func__, - filename, fw->size); + sms_info("read FW %s, size=%d\"", filename, fw->size); fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), GFP_KERNEL | GFP_DMA); if (fw_buffer) { @@ -632,8 +625,7 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, kfree(fw_buffer); } else { - sms_info("%s failed to allocate firmware buffer\n", - __func__); + sms_info("failed to allocate firmware buffer"); rc = -ENOMEM; } @@ -645,7 +637,7 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev, u8 *buffer, int size, int new_mode) { - PERROR("Feature not implemented yet\n"); + PERROR("Feature not implemented yet"); return -EFAULT; } @@ -680,17 +672,17 @@ void smscore_unregister_device(struct smscore_device_t *coredev) if (num_buffers == coredev->num_buffers) break; if (++retry > 10) { - sms_info("%s exiting although " - "not all buffers released.\n", __func__); + sms_info("exiting although " + "not all buffers released."); break; } - sms_info("%s waiting for %d buffer(s)\n", __func__, + sms_info("waiting for %d buffer(s)", coredev->num_buffers - num_buffers); msleep(100); } - sms_info("%s freed %d buffers\n", __func__, num_buffers); + sms_info("freed %d buffers", num_buffers); if (coredev->common_buffer) dma_free_coherent(NULL, coredev->common_buffer_size, @@ -702,7 +694,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev) kmutex_unlock(&g_smscore_deviceslock); - sms_info("%s device %p destroyed\n", __func__, coredev); + sms_info("device %p destroyed", coredev); } int smscore_detect_mode(struct smscore_device_t *coredev) @@ -722,8 +714,7 @@ int smscore_detect_mode(struct smscore_device_t *coredev) rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc == -ETIME) { - sms_err("%s: MSG_SMS_GET_VERSION_EX_REQ " - "failed first try\n", __func__); + sms_err("MSG_SMS_GET_VERSION_EX_REQ failed first try"); if (wait_for_completion_timeout(&coredev->resume_done, msecs_to_jiffies(5000))) { @@ -731,9 +722,8 @@ int smscore_detect_mode(struct smscore_device_t *coredev) coredev, msg, msg->msgLength, &coredev->version_ex_done); if (rc < 0) - sms_err("%s: " - "MSG_SMS_GET_VERSION_EX_REQ failed " - "second try, rc %d\n", __func__, rc); + sms_err("MSG_SMS_GET_VERSION_EX_REQ failed " + "second try, rc %d", rc); } else rc = -ETIME; } @@ -780,11 +770,10 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) int rc = 0; enum sms_device_type_st type; - PDEBUG("set device mode to %d\n", mode); + PDEBUG("set device mode to %d", mode); if (coredev->device_flags & SMS_DEVICE_FAMILY2) { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) { - sms_info("%s invalid mode specified %d\n", - __func__, mode); + sms_info("invalid mode specified %d", mode); return -EINVAL; } @@ -793,15 +782,13 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) if (!(coredev->device_flags & SMS_DEVICE_NOT_READY)) { rc = smscore_detect_mode(coredev); if (rc < 0) { - sms_info("%s mode detect failed %d\n", - __func__, rc); + sms_info("mode detect failed %d", rc); return rc; } } if (coredev->mode == mode) { - sms_info("%s device mode %d already set\n", - __func__, mode); + sms_info("device mode %d already set", mode); return 0; } @@ -810,13 +797,13 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) rc = smscore_load_firmware_from_file( coredev, smscore_fw_lkup[mode][type], NULL); if (rc < 0) { - sms_info("%s load firmware " - "failed %d\n", __func__, rc); + sms_info("load firmware " + "failed %d", rc); return rc; } } else - sms_info("%s mode %d supported by running " - "firmware\n", __func__, mode); + sms_info("mode %d supported by running " + "firmware", mode); buffer = kmalloc(sizeof(struct SmsMsgData_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); @@ -835,14 +822,13 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) kfree(buffer); } else { - sms_info("%s Could not allocate buffer for " - "init device message.\n", __func__); + sms_info("Could not allocate buffer for " + "init device message."); rc = -ENOMEM; } } else { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { - sms_info("%s invalid mode specified %d\n", - __func__, mode); + sms_info("invalid mode specified %d", mode); return -EINVAL; } @@ -862,7 +848,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) } if (rc != 0) - sms_info("%s return error code %d.\n", __func__, rc); + sms_info("return error code %d.", rc); return rc; } @@ -945,7 +931,7 @@ void smscore_onresponse(struct smscore_device_t *coredev, last_sample_time = time_now; if (time_now - last_sample_time > 10000) { - sms_debug("\n%s data rate %d bytes/secs\n", __func__, + sms_debug("\ndata rate %d bytes/secs", (int)((data_total * 1000) / (time_now - last_sample_time))); @@ -965,8 +951,8 @@ void smscore_onresponse(struct smscore_device_t *coredev, { struct SmsVersionRes_ST *ver = (struct SmsVersionRes_ST *) phdr; - sms_debug("%s: MSG_SMS_GET_VERSION_EX_RES " - "id %d prots 0x%x ver %d.%d\n", __func__, + sms_debug("MSG_SMS_GET_VERSION_EX_RES " + "id %d prots 0x%x ver %d.%d", ver->FirmwareId, ver->SupportedProtocols, ver->RomVersionMajor, ver->RomVersionMinor); @@ -978,25 +964,21 @@ void smscore_onresponse(struct smscore_device_t *coredev, break; } case MSG_SMS_INIT_DEVICE_RES: - sms_debug("%s: MSG_SMS_INIT_DEVICE_RES\n", - __func__); + sms_debug("MSG_SMS_INIT_DEVICE_RES"); complete(&coredev->init_device_done); break; case MSG_SW_RELOAD_START_RES: - sms_debug("%s: MSG_SW_RELOAD_START_RES\n", - __func__); + sms_debug("MSG_SW_RELOAD_START_RES"); complete(&coredev->reload_start_done); break; case MSG_SMS_DATA_DOWNLOAD_RES: complete(&coredev->data_download_done); break; case MSG_SW_RELOAD_EXEC_RES: - sms_debug("%s: MSG_SW_RELOAD_EXEC_RES\n", - __func__); + sms_debug("MSG_SW_RELOAD_EXEC_RES"); break; case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: - sms_debug("%s: MSG_SMS_SWDOWNLOAD_TRIGGER_RES\n", - __func__); + sms_debug("MSG_SMS_SWDOWNLOAD_TRIGGER_RES"); complete(&coredev->trigger_done); break; case MSG_SMS_SLEEP_RESUME_COMP_IND: @@ -1056,7 +1038,7 @@ int smscore_validate_client(struct smscore_device_t *coredev, struct smscore_client_t *registered_client; if (!client) { - PERROR("bad parameter.\n"); + PERROR("bad parameter."); return -EFAULT; } registered_client = smscore_find_client(coredev, data_type, id); @@ -1064,12 +1046,12 @@ int smscore_validate_client(struct smscore_device_t *coredev, return 0; if (registered_client) { - PERROR("The msg ID already registered to another client.\n"); + PERROR("The msg ID already registered to another client."); return -EEXIST; } listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL); if (!listentry) { - PERROR("Can't allocate memory for client id.\n"); + PERROR("Can't allocate memory for client id."); return -ENOMEM; } listentry->id = id; @@ -1101,13 +1083,13 @@ int smscore_register_client(struct smscore_device_t *coredev, /* 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"); + PERROR("Client already exist."); return -EEXIST; } newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL); if (!newclient) { - PERROR("Failed to allocate memory for client.\n"); + PERROR("Failed to allocate memory for client."); return -ENOMEM; } @@ -1121,7 +1103,7 @@ int smscore_register_client(struct smscore_device_t *coredev, smscore_validate_client(coredev, newclient, params->data_type, params->initial_id); *client = newclient; - PDEBUG("%p %d %d\n", params->context, params->data_type, + PDEBUG("%p %d %d", params->context, params->data_type, params->initial_id); return 0; @@ -1149,7 +1131,7 @@ void smscore_unregister_client(struct smscore_client_t *client) kfree(identry); } - sms_info("%s %p\n", __func__, client->context); + sms_info("%p", client->context); list_del(&client->entry); kfree(client); @@ -1176,7 +1158,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, int rc; if (client == NULL) { - sms_err("%s Got NULL client\n", __func__); + sms_err("Got NULL client"); return -EINVAL; } @@ -1184,7 +1166,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, /* check that no other channel with same id exists */ if (coredev == NULL) { - sms_err("%s Got NULL coredev\n", __func__); + sms_err("Got NULL coredev"); return -EINVAL; } @@ -1225,20 +1207,20 @@ int smscore_map_common_buffer(struct smscore_device_t *coredev, if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || (vma->vm_flags & VM_WRITE)) { - sms_info("%s invalid vm flags\n", __func__); + sms_info("invalid vm flags"); return -EINVAL; } if ((end - start) != size) { - sms_info("%s invalid size %d expected %d\n", - __func__, (int)(end - start), (int) size); + sms_info("invalid size %d expected %d", + (int)(end - start), (int) size); return -EINVAL; } if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, size, pgprot_noncached(vma->vm_page_prot))) { - sms_info("%s remap_page_range failed\n", __func__); + sms_info("remap_page_range failed"); return -EAGAIN; } @@ -1262,7 +1244,7 @@ int smscore_module_init(void) /* DVB Register */ rc = smsdvb_register(); - sms_info("%s, rc %d\n", __func__, rc); + sms_debug("rc %d", rc); return rc; } @@ -1298,7 +1280,7 @@ void smscore_module_exit(void) /* Unregister USB */ smsusb_unregister(); - sms_info("%s\n", __func__); + sms_debug(""); } module_init(smscore_module_init); diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 2799ea7bb41..ccc7e101295 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -414,9 +414,12 @@ void smsdvb_unregister(void); int smsusb_register(void); void smsusb_unregister(void); -#define sms_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) -#define sms_info(fmt, arg...) printk(KERN_INFO fmt, ##arg) -#define sms_debug(fmt, arg...) printk(KERN_DEBUG fmt, ##arg) +#define sms_err(fmt, arg...) \ + printk(KERN_ERR "%s " fmt "\n", __func__, ##arg) +#define sms_info(fmt, arg...) \ + printk(KERN_INFO "%s " fmt "\n", __func__, ##arg) +#define sms_debug(fmt, arg...) \ + printk(KERN_DEBUG "%s " fmt "\n", __func__, ##arg) #endif /* __smscoreapi_h__ */ diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 57ab7db56a6..a54e9c77edd 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -113,7 +113,7 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed) container_of(feed->demux, struct smsdvb_client_t, demux); struct SmsMsgData_ST PidMsg; - sms_debug("%s add pid %d(%x)\n", __func__, + sms_debug("add pid %d(%x)", feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; @@ -133,7 +133,7 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed) container_of(feed->demux, struct smsdvb_client_t, demux); struct SmsMsgData_ST PidMsg; - sms_debug("%s remove pid %d(%x)\n", __func__, + sms_debug("remove pid %d(%x)", feed->pid, feed->pid); PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; @@ -220,7 +220,7 @@ static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) static int smsdvb_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) { - sms_debug("%s\n", __func__); + sms_debug(""); tune->min_delay_ms = 400; tune->step_size = 250000; @@ -247,7 +247,7 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, Msg.Data[0] = fep->frequency; Msg.Data[2] = 12000000; - sms_debug("%s freq %d band %d\n", __func__, + sms_debug("freq %d band %d", fep->frequency, fep->u.ofdm.bandwidth); switch (fep->u.ofdm.bandwidth) { @@ -268,7 +268,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, struct smsdvb_client_t *client = container_of(fe, struct smsdvb_client_t, frontend); - sms_debug("%s\n", __func__); + sms_debug(""); /* todo: */ memcpy(fep, &client->fe_params, @@ -322,14 +322,14 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, return 0; if (smscore_get_device_mode(coredev) != 4) { - sms_err("%sSMS Device mode is not set for " - "DVB operation.\n", __func__); + sms_err("SMS Device mode is not set for " + "DVB operation."); return 0; } client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); if (!client) { - sms_info("%s kmalloc() failed\n", __func__); + sms_info("kmalloc() failed"); return -ENOMEM; } @@ -339,8 +339,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, smscore_get_board_id(coredev))->name, THIS_MODULE, device, adapter_nr); if (rc < 0) { - sms_err("%s dvb_register_adapter() failed %d\n", - __func__, rc); + sms_err("dvb_register_adapter() failed %d", rc); goto adapter_error; } @@ -353,8 +352,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = dvb_dmx_init(&client->demux); if (rc < 0) { - sms_err("%s dvb_dmx_init failed %d\n\n", - __func__, rc); + sms_err("dvb_dmx_init failed %d", rc); goto dvbdmx_error; } @@ -365,8 +363,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); if (rc < 0) { - sms_err("%s dvb_dmxdev_init failed %d\n", - __func__, rc); + sms_err("dvb_dmxdev_init failed %d", rc); goto dmxdev_error; } @@ -376,8 +373,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = dvb_register_frontend(&client->adapter, &client->frontend); if (rc < 0) { - sms_err("%s frontend registration failed %d\n", - __func__, rc); + sms_err("frontend registration failed %d", rc); goto frontend_error; } @@ -389,8 +385,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = smscore_register_client(coredev, ¶ms, &client->smsclient); if (rc < 0) { - sms_info("%s smscore_register_client() failed %d\n", - __func__, rc); + sms_info("smscore_register_client() failed %d", rc); goto client_error; } @@ -405,7 +400,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, kmutex_unlock(&g_smsdvb_clientslock); - sms_info("%s success\n", __func__); + sms_info("success"); return 0; @@ -435,7 +430,7 @@ int smsdvb_register(void) rc = smscore_register_hotplug(smsdvb_hotplug); - sms_info("%s\n", __func__); + sms_debug(""); return rc; } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 34e60482fac..01f5c74c41e 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -60,8 +60,8 @@ void smsusb_onresponse(struct urb *urb) struct smsusb_device_t *dev = surb->dev; if (urb->status < 0) { - sms_info("%s error, urb status %d, %d bytes\n", - __func__, urb->status, urb->actual_length); + sms_info("error, urb status %d, %d bytes", + urb->status, urb->actual_length); return; } @@ -81,9 +81,9 @@ void smsusb_onresponse(struct urb *urb) /* sanity check */ if (((int) phdr->msgLength + surb->cb->offset) > urb->actual_length) { - sms_info("%s: invalid response " + sms_info("invalid response " "msglen %d offset %d " - "size %d\n", __func__, + "size %d", phdr->msgLength, surb->cb->offset, urb->actual_length); @@ -100,8 +100,8 @@ void smsusb_onresponse(struct urb *urb) smscore_onresponse(dev->coredev, surb->cb); surb->cb = NULL; } else { - sms_info("%s invalid response " - "msglen %d actual %d\n", __func__, + sms_info("invalid response " + "msglen %d actual %d", phdr->msgLength, urb->actual_length); } } @@ -115,8 +115,8 @@ int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) if (!surb->cb) { surb->cb = smscore_getbuffer(dev->coredev); if (!surb->cb) { - sms_info("%s smscore_getbuffer(...) " - "returned NULL\n", __func__); + sms_info("smscore_getbuffer(...) " + "returned NULL"); return -ENOMEM; } } @@ -157,8 +157,8 @@ int smsusb_start_streaming(struct smsusb_device_t *dev) for (i = 0; i < MAX_URBS; i++) { rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { - sms_info("%s smsusb_submit_urb(...) " - "failed\n", __func__); + sms_info("smsusb_submit_urb(...) " + "failed"); smsusb_stop_streaming(dev); break; } @@ -191,15 +191,14 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) int rc, dummy; if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { - sms_info("%s invalid firmware id specified %d\n", - __func__, id); + sms_info("invalid firmware id specified %d", id); return -EINVAL; } rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); if (rc < 0) { - sms_info("%s failed to open \"%s\" mode %d\n", - __func__, smsusb1_fw_lkup[id], id); + sms_info("failed to open \"%s\" mode %d", + smsusb1_fw_lkup[id], id); return rc; } @@ -210,12 +209,11 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), fw_buffer, fw->size, &dummy, 1000); - sms_info("%s: sent %d(%d) bytes, rc %d\n", - __func__, fw->size, dummy, rc); + sms_info("sent %d(%d) bytes, rc %d", fw->size, dummy, rc); kfree(fw_buffer); } else { - sms_info("failed to allocate firmware buffer\n"); + sms_info("failed to allocate firmware buffer"); rc = -ENOMEM; } @@ -233,7 +231,7 @@ void smsusb1_detectmode(void *context, int *mode) if (!product_string) { product_string = "none"; - sms_err("%s product string not found\n", __func__); + sms_err("product string not found"); } else if (strstr(product_string, "DVBH")) *mode = 1; else if (strstr(product_string, "BDA")) @@ -243,7 +241,7 @@ void smsusb1_detectmode(void *context, int *mode) else if (strstr(product_string, "TDMB")) *mode = 2; - sms_info("%s: %d \"%s\"\n", __func__, *mode, product_string); + sms_info("%d \"%s\"", *mode, product_string); } int smsusb1_setmode(void *context, int mode) @@ -252,8 +250,7 @@ int smsusb1_setmode(void *context, int mode) sizeof(struct SmsMsgHdr_ST), 0 }; if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { - sms_info("%s invalid firmware id specified %d\n", - __func__, mode); + sms_info("invalid firmware id specified %d", mode); return -EINVAL; } @@ -274,7 +271,7 @@ void smsusb_term_device(struct usb_interface *intf) kfree(dev); - sms_info("%s device %p destroyed\n", __func__, dev); + sms_info("device %p destroyed", dev); } usb_set_intfdata(intf, NULL); @@ -290,8 +287,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) /* create device object */ dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); if (!dev) { - sms_info("%s kzalloc(sizeof(struct smsusb_device_t) " - "failed\n", __func__); + sms_info("kzalloc(sizeof(struct smsusb_device_t) " + "failed"); return -ENOMEM; } @@ -309,25 +306,24 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) params.setmode_handler = smsusb1_setmode; params.detectmode_handler = smsusb1_detectmode; params.device_type = SMS_STELLAR; - sms_info("%s stellar device found\n", __func__); + sms_info("stellar device found"); break; default: switch (board->type) { case SMS_NOVA_A0: params.device_type = SMS_NOVA_A0; - sms_info("%s nova A0 found\n", __func__); + sms_info("nova A0 found"); break; case SMS_NOVA_B0: params.device_type = SMS_NOVA_B0; - sms_info("%s nova B0 found\n", __func__); + sms_info("nova B0 found"); break; case SMS_VEGA: params.device_type = SMS_VEGA; - sms_info("%s Vega found\n", __func__); + sms_info("Vega found"); break; default: - sms_err("%s Unspecified sms device type!\n", - __func__); + sms_err("Unspecified sms device type!"); } dev->buffer_size = USB2_BUFFER_SIZE; @@ -350,8 +346,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) /* register in smscore */ rc = smscore_register_device(¶ms, &dev->coredev); if (rc < 0) { - sms_info("%s smscore_register_device(...) failed, " - "rc %d\n", __func__, rc); + sms_info("smscore_register_device(...) failed, " + "rc %d", rc); smsusb_term_device(intf); return rc; } @@ -364,24 +360,22 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) usb_init_urb(&dev->surbs[i].urb); } - sms_info("%s smsusb_start_streaming(...).\n", __func__); + sms_info("smsusb_start_streaming(...)."); rc = smsusb_start_streaming(dev); if (rc < 0) { - sms_info("%s smsusb_start_streaming(...) failed\n", - __func__); + sms_info("smsusb_start_streaming(...) failed"); smsusb_term_device(intf); return rc; } rc = smscore_start_device(dev->coredev); if (rc < 0) { - sms_info("%s smscore_start_device(...) failed\n", - __func__); + sms_info("smscore_start_device(...) failed"); smsusb_term_device(intf); return rc; } - sms_info("%s device %p created\n", __func__, dev); + sms_info("device %p created", dev); return rc; } @@ -399,36 +393,36 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) rc = usb_set_interface( udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); if (rc < 0) { - sms_info("%s usb_set_interface failed, " - "rc %d\n", __func__, rc); + sms_info("usb_set_interface failed, " + "rc %d", rc); return rc; } } - sms_info("smsusb_probe %d\n", + sms_info("smsusb_probe %d", intf->cur_altsetting->desc.bInterfaceNumber); for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) - sms_info("endpoint %d %02x %02x %d\n", i, + sms_info("endpoint %d %02x %02x %d", i, intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, intf->cur_altsetting->endpoint[i].desc.bmAttributes, intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); if ((udev->actconfig->desc.bNumInterfaces == 2) && (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { - sms_info("rom interface 0 is not used\n"); + sms_info("rom interface 0 is not used"); return -ENODEV; } if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { snprintf(devpath, sizeof(devpath), "usb\\%d-%s", udev->bus->busnum, udev->devpath); - sms_info("stellar device was found.\n"); + sms_info("stellar device was found."); return smsusb1_load_firmware( udev, smscore_registry_getmode(devpath)); } rc = smsusb_init_device(intf, id->driver_info); - sms_info("%s rc %d\n", __func__, rc); + sms_info("rc %d", rc); return rc; } @@ -448,16 +442,16 @@ int smsusb_register(void) { int rc = usb_register(&smsusb_driver); if (rc) - sms_info("usb_register failed. Error number %d\n", rc); + sms_info("usb_register failed. Error number %d", rc); - sms_info("%s\n", __func__); + sms_debug(""); return rc; } void smsusb_unregister(void) { - sms_debug("%s\n", __func__); + sms_debug(""); /* Regular USB Cleanup */ usb_deregister(&smsusb_driver); } -- cgit v1.2.3 From f14d56a99bddb779f6f7ec028bcd9d142536589e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 19 Jun 2008 20:59:08 -0300 Subject: V4L/DVB (8295): sms1xxx: add debug module option, to enable debug messages All dmesg spam turned off by default, for now. Values for debug: (info=1, adv=2 (or-able) Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 4 ++++ drivers/media/dvb/siano/smscoreapi.h | 20 +++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 6e2cc3d5716..402ed03be42 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -33,6 +33,10 @@ #include "smscoreapi.h" +int sms_debug; +module_param_named(debug, sms_debug, int, 0644); +MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))"); + #define PERROR(fmt, args...)\ sms_err("smscore error: line %d- %s(): " fmt, \ __LINE__, __func__, ## args) diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index ccc7e101295..a21f01f71ba 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -414,12 +414,26 @@ void smsdvb_unregister(void); int smsusb_register(void); void smsusb_unregister(void); +/* ------------------------------------------------------------------------ */ + +extern int sms_debug; + +#define DBG_INFO 1 +#define DBG_ADV 2 + +#define sms_printk(kern, fmt, arg...) \ + printk(kern "%s: " fmt "\n", __func__, ##arg) + +#define dprintk(kern, lvl, fmt, arg...) do {\ + if (sms_debug & lvl) \ + sms_printk(kern, fmt, ##arg); } while (0) + #define sms_err(fmt, arg...) \ - printk(KERN_ERR "%s " fmt "\n", __func__, ##arg) + sms_printk(KERN_ERR, "%s " fmt "\n", __func__, ##arg) #define sms_info(fmt, arg...) \ - printk(KERN_INFO "%s " fmt "\n", __func__, ##arg) + dprintk(KERN_INFO, DBG_INFO, fmt, ##arg) #define sms_debug(fmt, arg...) \ - printk(KERN_DEBUG "%s " fmt "\n", __func__, ##arg) + dprintk(KERN_DEBUG, DBG_ADV, fmt, ##arg) #endif /* __smscoreapi_h__ */ -- cgit v1.2.3 From eb250942fe3cf2a129ab55d65161bc66b7009853 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 19 Jun 2008 22:07:23 -0300 Subject: V4L/DVB (8296): sms1xxx: always show error messages Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 21 +++++++------- drivers/media/dvb/siano/smsdvb.c | 4 +-- drivers/media/dvb/siano/smsusb.c | 55 ++++++++++++++++-------------------- 3 files changed, 37 insertions(+), 43 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 402ed03be42..6685c56ee0e 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -777,7 +777,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) PDEBUG("set device mode to %d", mode); if (coredev->device_flags & SMS_DEVICE_FAMILY2) { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) { - sms_info("invalid mode specified %d", mode); + sms_err("invalid mode specified %d", mode); return -EINVAL; } @@ -786,7 +786,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) if (!(coredev->device_flags & SMS_DEVICE_NOT_READY)) { rc = smscore_detect_mode(coredev); if (rc < 0) { - sms_info("mode detect failed %d", rc); + sms_err("mode detect failed %d", rc); return rc; } } @@ -801,8 +801,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) rc = smscore_load_firmware_from_file( coredev, smscore_fw_lkup[mode][type], NULL); if (rc < 0) { - sms_info("load firmware " - "failed %d", rc); + sms_err("load firmware failed %d", rc); return rc; } } else @@ -826,13 +825,13 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) kfree(buffer); } else { - sms_info("Could not allocate buffer for " - "init device message."); + sms_err("Could not allocate buffer for " + "init device message."); rc = -ENOMEM; } } else { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { - sms_info("invalid mode specified %d", mode); + sms_err("invalid mode specified %d", mode); return -EINVAL; } @@ -852,7 +851,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) } if (rc != 0) - sms_info("return error code %d.", rc); + sms_err("return error code %d.", rc); return rc; } @@ -1211,12 +1210,12 @@ int smscore_map_common_buffer(struct smscore_device_t *coredev, if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || (vma->vm_flags & VM_WRITE)) { - sms_info("invalid vm flags"); + sms_err("invalid vm flags"); return -EINVAL; } if ((end - start) != size) { - sms_info("invalid size %d expected %d", + sms_err("invalid size %d expected %d", (int)(end - start), (int) size); return -EINVAL; } @@ -1224,7 +1223,7 @@ int smscore_map_common_buffer(struct smscore_device_t *coredev, if (remap_pfn_range(vma, start, coredev->common_buffer_phys >> PAGE_SHIFT, size, pgprot_noncached(vma->vm_page_prot))) { - sms_info("remap_page_range failed"); + sms_err("remap_page_range failed"); return -EAGAIN; } diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index a54e9c77edd..f9a6ce0441f 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -329,7 +329,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); if (!client) { - sms_info("kmalloc() failed"); + sms_err("kmalloc() failed"); return -ENOMEM; } @@ -385,7 +385,7 @@ int smsdvb_hotplug(struct smscore_device_t *coredev, rc = smscore_register_client(coredev, ¶ms, &client->smsclient); if (rc < 0) { - sms_info("smscore_register_client() failed %d", rc); + sms_err("smscore_register_client() failed %d", rc); goto client_error; } diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 01f5c74c41e..221b024e9d8 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -60,8 +60,8 @@ void smsusb_onresponse(struct urb *urb) struct smsusb_device_t *dev = surb->dev; if (urb->status < 0) { - sms_info("error, urb status %d, %d bytes", - urb->status, urb->actual_length); + sms_err("error, urb status %d, %d bytes", + urb->status, urb->actual_length); return; } @@ -81,12 +81,12 @@ void smsusb_onresponse(struct urb *urb) /* sanity check */ if (((int) phdr->msgLength + surb->cb->offset) > urb->actual_length) { - sms_info("invalid response " - "msglen %d offset %d " - "size %d", - phdr->msgLength, - surb->cb->offset, - urb->actual_length); + sms_err("invalid response " + "msglen %d offset %d " + "size %d", + phdr->msgLength, + surb->cb->offset, + urb->actual_length); goto exit_and_resubmit; } @@ -100,9 +100,9 @@ void smsusb_onresponse(struct urb *urb) smscore_onresponse(dev->coredev, surb->cb); surb->cb = NULL; } else { - sms_info("invalid response " - "msglen %d actual %d", - phdr->msgLength, urb->actual_length); + sms_err("invalid response " + "msglen %d actual %d", + phdr->msgLength, urb->actual_length); } } @@ -115,8 +115,7 @@ int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) if (!surb->cb) { surb->cb = smscore_getbuffer(dev->coredev); if (!surb->cb) { - sms_info("smscore_getbuffer(...) " - "returned NULL"); + sms_err("smscore_getbuffer(...) returned NULL"); return -ENOMEM; } } @@ -157,8 +156,7 @@ int smsusb_start_streaming(struct smsusb_device_t *dev) for (i = 0; i < MAX_URBS; i++) { rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { - sms_info("smsusb_submit_urb(...) " - "failed"); + sms_err("smsusb_submit_urb(...) failed"); smsusb_stop_streaming(dev); break; } @@ -191,14 +189,14 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) int rc, dummy; if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { - sms_info("invalid firmware id specified %d", id); + sms_err("invalid firmware id specified %d", id); return -EINVAL; } rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); if (rc < 0) { - sms_info("failed to open \"%s\" mode %d", - smsusb1_fw_lkup[id], id); + sms_err("failed to open \"%s\" mode %d", + smsusb1_fw_lkup[id], id); return rc; } @@ -213,7 +211,7 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) kfree(fw_buffer); } else { - sms_info("failed to allocate firmware buffer"); + sms_err("failed to allocate firmware buffer"); rc = -ENOMEM; } @@ -250,7 +248,7 @@ int smsusb1_setmode(void *context, int mode) sizeof(struct SmsMsgHdr_ST), 0 }; if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { - sms_info("invalid firmware id specified %d", mode); + sms_err("invalid firmware id specified %d", mode); return -EINVAL; } @@ -287,8 +285,7 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) /* create device object */ dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); if (!dev) { - sms_info("kzalloc(sizeof(struct smsusb_device_t) " - "failed"); + sms_err("kzalloc(sizeof(struct smsusb_device_t) failed"); return -ENOMEM; } @@ -346,8 +343,7 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) /* register in smscore */ rc = smscore_register_device(¶ms, &dev->coredev); if (rc < 0) { - sms_info("smscore_register_device(...) failed, " - "rc %d", rc); + sms_err("smscore_register_device(...) failed, rc %d", rc); smsusb_term_device(intf); return rc; } @@ -363,14 +359,14 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) sms_info("smsusb_start_streaming(...)."); rc = smsusb_start_streaming(dev); if (rc < 0) { - sms_info("smsusb_start_streaming(...) failed"); + sms_err("smsusb_start_streaming(...) failed"); smsusb_term_device(intf); return rc; } rc = smscore_start_device(dev->coredev); if (rc < 0) { - sms_info("smscore_start_device(...) failed"); + sms_err("smscore_start_device(...) failed"); smsusb_term_device(intf); return rc; } @@ -393,8 +389,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) rc = usb_set_interface( udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); if (rc < 0) { - sms_info("usb_set_interface failed, " - "rc %d", rc); + sms_err("usb_set_interface failed, rc %d", rc); return rc; } } @@ -409,7 +404,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) if ((udev->actconfig->desc.bNumInterfaces == 2) && (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { - sms_info("rom interface 0 is not used"); + sms_err("rom interface 0 is not used"); return -ENODEV; } @@ -442,7 +437,7 @@ int smsusb_register(void) { int rc = usb_register(&smsusb_driver); if (rc) - sms_info("usb_register failed. Error number %d", rc); + sms_err("usb_register failed. Error number %d", rc); sms_debug(""); -- cgit v1.2.3 From 2522dc13245073f75399ada8e7f6acecde834953 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 19 Jun 2008 22:15:38 -0300 Subject: V4L/DVB (8297): sms1xxx: remove old printk macros Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 37 ++++++++++-------------------------- drivers/media/dvb/siano/smscoreapi.h | 6 +++++- 2 files changed, 15 insertions(+), 28 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 6685c56ee0e..142fe00c37f 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -37,23 +37,6 @@ int sms_debug; module_param_named(debug, sms_debug, int, 0644); MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))"); -#define PERROR(fmt, args...)\ - sms_err("smscore error: line %d- %s(): " fmt, \ - __LINE__, __func__, ## args) - -#ifdef SMSCORE_DEBUG -#undef PWARNING -# define PWARNING(fmt, args...) sms_info("smscore warning: " \ - "line %d- %s(): " fmt, \ - __LINE__, __func__, ## args) -#undef PDEBUG /* undef it, just in case */ -# define PDEBUG(fmt, args...) sms_info("smscore - %s(): " fmt, \ - __func__, ## args) -#else /*SMSCORE_DEBUG*/ -#define PDEBUG(fmt, args...) -#define PWARNING(fmt, args...) -#endif - struct smscore_device_notifyee_t { struct list_head entry; hotplug_t hotplug; @@ -504,7 +487,7 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, return -ENOMEM; if (coredev->mode != DEVICE_MODE_NONE) { - PDEBUG("Sending reload command"); + sms_debug("sending reload command."); SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ, sizeof(struct SmsMsgHdr_ST)); rc = smscore_sendrequest_and_wait(coredev, msg, @@ -641,7 +624,7 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev, u8 *buffer, int size, int new_mode) { - PERROR("Feature not implemented yet"); + sms_err("feature not yet implemented."); return -EFAULT; } @@ -774,7 +757,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) int rc = 0; enum sms_device_type_st type; - PDEBUG("set device mode to %d", mode); + sms_debug("set device mode to %d", mode); if (coredev->device_flags & SMS_DEVICE_FAMILY2) { if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) { sms_err("invalid mode specified %d", mode); @@ -1041,7 +1024,7 @@ int smscore_validate_client(struct smscore_device_t *coredev, struct smscore_client_t *registered_client; if (!client) { - PERROR("bad parameter."); + sms_err("bad parameter."); return -EFAULT; } registered_client = smscore_find_client(coredev, data_type, id); @@ -1049,12 +1032,12 @@ int smscore_validate_client(struct smscore_device_t *coredev, return 0; if (registered_client) { - PERROR("The msg ID already registered to another client."); + sms_err("The msg ID already registered to another client."); return -EEXIST; } listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL); if (!listentry) { - PERROR("Can't allocate memory for client id."); + sms_err("Can't allocate memory for client id."); return -ENOMEM; } listentry->id = id; @@ -1086,13 +1069,13 @@ int smscore_register_client(struct smscore_device_t *coredev, /* check that no other channel with same parameters exists */ if (smscore_find_client(coredev, params->data_type, params->initial_id)) { - PERROR("Client already exist."); + sms_err("Client already exist."); return -EEXIST; } newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL); if (!newclient) { - PERROR("Failed to allocate memory for client."); + sms_err("Failed to allocate memory for client."); return -ENOMEM; } @@ -1106,8 +1089,8 @@ int smscore_register_client(struct smscore_device_t *coredev, smscore_validate_client(coredev, newclient, params->data_type, params->initial_id); *client = newclient; - PDEBUG("%p %d %d", params->context, params->data_type, - params->initial_id); + sms_debug("%p %d %d", params->context, params->data_type, + params->initial_id); return 0; } diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index a21f01f71ba..b84606b30fd 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -429,7 +429,11 @@ extern int sms_debug; sms_printk(kern, fmt, ##arg); } while (0) #define sms_err(fmt, arg...) \ - sms_printk(KERN_ERR, "%s " fmt "\n", __func__, ##arg) + sms_printk(KERN_ERR, "%s() line: %d: " fmt "\n", \ + __func__, __LINE__, ##arg) +#define sms_warn(fmt, arg...) \ + sms_printk(KERN_WARNING, "%s() line: %d: " fmt "\n", \ + __func__, __LINE__, ##arg) #define sms_info(fmt, arg...) \ dprintk(KERN_INFO, DBG_INFO, fmt, ##arg) #define sms_debug(fmt, arg...) \ -- cgit v1.2.3 From c65c7a652ff10b86d33eda36f9c4200027bd8dd4 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 19 Jun 2008 22:20:49 -0300 Subject: V4L/DVB (8298): sms1xxx: remove redundant __func__ in sms_err macro Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index b84606b30fd..eb0ed6542e9 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -429,11 +429,9 @@ extern int sms_debug; sms_printk(kern, fmt, ##arg); } while (0) #define sms_err(fmt, arg...) \ - sms_printk(KERN_ERR, "%s() line: %d: " fmt "\n", \ - __func__, __LINE__, ##arg) + sms_printk(KERN_ERR, "line: %d: " fmt, __LINE__, ##arg) #define sms_warn(fmt, arg...) \ - sms_printk(KERN_WARNING, "%s() line: %d: " fmt "\n", \ - __func__, __LINE__, ##arg) + sms_printk(KERN_WARNING, "line: %d: " fmt, __LINE__, ##arg) #define sms_info(fmt, arg...) \ dprintk(KERN_INFO, DBG_INFO, fmt, ##arg) #define sms_debug(fmt, arg...) \ -- cgit v1.2.3 From 0c071f374f66f05aded3be970f683d54fd918806 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 21 Jun 2008 02:44:02 -0300 Subject: V4L/DVB (8299): sms1xxx: mark functions static Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 101 +++++++++-------------------------- drivers/media/dvb/siano/smscoreapi.h | 7 --- drivers/media/dvb/siano/smsdvb.c | 10 ++-- drivers/media/dvb/siano/smsusb.c | 31 ++++++----- 4 files changed, 47 insertions(+), 102 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 142fe00c37f..bbb3ad9c804 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -162,7 +162,7 @@ int smscore_registry_getmode(char *devpath) return default_mode; } -enum sms_device_type_st smscore_registry_gettype(char *devpath) +static enum sms_device_type_st smscore_registry_gettype(char *devpath) { struct smscore_registry_entry_t *entry; @@ -186,7 +186,8 @@ void smscore_registry_setmode(char *devpath, int mode) sms_err("No registry found."); } -void smscore_registry_settype(char *devpath, enum sms_device_type_st type) +static void smscore_registry_settype(char *devpath, + enum sms_device_type_st type) { struct smscore_registry_entry_t *entry; @@ -198,8 +199,8 @@ void smscore_registry_settype(char *devpath, enum sms_device_type_st type) } -void list_add_locked(struct list_head *new, struct list_head *head, - spinlock_t *lock) +static void list_add_locked(struct list_head *new, struct list_head *head, + spinlock_t *lock) { unsigned long flags; @@ -280,7 +281,7 @@ void smscore_unregister_hotplug(hotplug_t hotplug) kmutex_unlock(&g_smscore_deviceslock); } -void smscore_notify_clients(struct smscore_device_t *coredev) +static void smscore_notify_clients(struct smscore_device_t *coredev) { struct smscore_client_t *client; @@ -291,8 +292,8 @@ void smscore_notify_clients(struct smscore_device_t *coredev) } } -int smscore_notify_callbacks(struct smscore_device_t *coredev, - struct device *device, int arrival) +static int smscore_notify_callbacks(struct smscore_device_t *coredev, + struct device *device, int arrival) { struct list_head *next, *first; int rc = 0; @@ -311,7 +312,8 @@ int smscore_notify_callbacks(struct smscore_device_t *coredev, return rc; } -struct smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, +static struct +smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, dma_addr_t common_buffer_phys) { struct smscore_buffer_t *cb = @@ -450,8 +452,9 @@ int smscore_start_device(struct smscore_device_t *coredev) return rc; } -int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, - size_t size, struct completion *completion) +static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, + void *buffer, size_t size, + struct completion *completion) { int rc = coredev->sendrequest_handler(coredev->context, buffer, size); if (rc < 0) { @@ -464,8 +467,8 @@ int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, 0 : -ETIME; } -int smscore_load_firmware_family2(struct smscore_device_t *coredev, - void *buffer, size_t size) +static int smscore_load_firmware_family2(struct smscore_device_t *coredev, + void *buffer, size_t size) { struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer; struct SmsMsgHdr_ST *msg; @@ -580,9 +583,9 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev, * * @return 0 on success, <0 on error. */ -int smscore_load_firmware_from_file(struct smscore_device_t *coredev, - char *filename, - loadfirmware_t loadfirmware_handler) +static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, + char *filename, + loadfirmware_t loadfirmware_handler) { int rc = -ENOENT; const struct firmware *fw; @@ -621,13 +624,6 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev, return rc; } -int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev, - u8 *buffer, int size, int new_mode) -{ - sms_err("feature not yet implemented."); - return -EFAULT; -} - /** * notifies all clients registered with the device, notifies hotplugs, * frees all buffers and coredev object @@ -684,7 +680,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev) sms_info("device %p destroyed", coredev); } -int smscore_detect_mode(struct smscore_device_t *coredev) +static int smscore_detect_mode(struct smscore_device_t *coredev) { void *buffer = kmalloc(sizeof(struct SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); @@ -720,7 +716,7 @@ int smscore_detect_mode(struct smscore_device_t *coredev) return rc; } -char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { +static char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { /*Stellar NOVA A0 Nova B0 VEGA*/ /*DVBT*/ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, @@ -861,7 +857,8 @@ int smscore_get_device_mode(struct smscore_device_t *coredev) * @param id client id (SMS_DONT_CARE for all id) * */ -struct smscore_client_t *smscore_find_client(struct smscore_device_t *coredev, +static struct +smscore_client_t *smscore_find_client(struct smscore_device_t *coredev, int data_type, int id) { struct smscore_client_t *client = NULL; @@ -1016,9 +1013,9 @@ void smscore_putbuffer(struct smscore_device_t *coredev, list_add_locked(&cb->entry, &coredev->buffers, &coredev->bufferslock); } -int smscore_validate_client(struct smscore_device_t *coredev, - struct smscore_client_t *client, - int data_type, int id) +static int smscore_validate_client(struct smscore_device_t *coredev, + struct smscore_client_t *client, + int data_type, int id) { struct smscore_idlist_t *listentry; struct smscore_client_t *registered_client; @@ -1164,54 +1161,6 @@ int smsclient_sendrequest(struct smscore_client_t *client, return coredev->sendrequest_handler(coredev->context, buffer, size); } -/** - * return the size of large (common) buffer - * - * @param coredev pointer to a coredev object from clients hotplug - * - * @return size (in bytes) of the buffer - */ -int smscore_get_common_buffer_size(struct smscore_device_t *coredev) -{ - return coredev->common_buffer_size; -} - -/** - * maps common buffer (if supported by platform) - * - * @param coredev pointer to a coredev object from clients hotplug - * @param vma pointer to vma struct from mmap handler - * - * @return 0 on success, <0 on error. - */ -int smscore_map_common_buffer(struct smscore_device_t *coredev, - struct vm_area_struct *vma) -{ - unsigned long end = vma->vm_end, - start = vma->vm_start, - size = PAGE_ALIGN(coredev->common_buffer_size); - - if (!(vma->vm_flags & (VM_READ | VM_SHARED)) || - (vma->vm_flags & VM_WRITE)) { - sms_err("invalid vm flags"); - return -EINVAL; - } - - if ((end - start) != size) { - sms_err("invalid size %d expected %d", - (int)(end - start), (int) size); - return -EINVAL; - } - - if (remap_pfn_range(vma, start, - coredev->common_buffer_phys >> PAGE_SHIFT, - size, pgprot_noncached(vma->vm_page_prot))) { - sms_err("remap_page_range failed"); - return -EAGAIN; - } - - return 0; -} int smscore_module_init(void) { diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index eb0ed6542e9..3e4e7dbc54d 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -378,10 +378,6 @@ extern int smscore_load_firmware(struct smscore_device_t *coredev, char *filename, loadfirmware_t loadfirmware_handler); -extern int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev, - u8 *buffer, int size, - int new_mode); - extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode); extern int smscore_get_device_mode(struct smscore_device_t *coredev); @@ -395,9 +391,6 @@ extern int smsclient_sendrequest(struct smscore_client_t *client, extern void smscore_onresponse(struct smscore_device_t *coredev, struct smscore_buffer_t *cb); -extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev); -extern int smscore_map_common_buffer(struct smscore_device_t *coredev, - struct vm_area_struct *vma); extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev); extern void smscore_putbuffer(struct smscore_device_t *coredev, diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index f9a6ce0441f..61c06b770c6 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -30,7 +30,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct list_head g_smsdvb_clients; kmutex_t g_smsdvb_clientslock; -int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) +static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) { struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; struct SmsMsgHdr_ST *phdr = @@ -84,7 +84,7 @@ int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) return 0; } -void smsdvb_unregister_client(struct smsdvb_client_t *client) +static void smsdvb_unregister_client(struct smsdvb_client_t *client) { /* must be called under clientslock */ @@ -98,7 +98,7 @@ void smsdvb_unregister_client(struct smsdvb_client_t *client) kfree(client); } -void smsdvb_onremove(void *context) +static void smsdvb_onremove(void *context) { kmutex_lock(&g_smsdvb_clientslock); @@ -310,8 +310,8 @@ static struct dvb_frontend_ops smsdvb_fe_ops = { .read_snr = smsdvb_read_snr, }; -int smsdvb_hotplug(struct smscore_device_t *coredev, - struct device *device, int arrival) +static int smsdvb_hotplug(struct smscore_device_t *coredev, + struct device *device, int arrival) { struct smsclient_params_t params; struct smsdvb_client_t *client; diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 221b024e9d8..e6ee4434a29 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -52,9 +52,10 @@ struct smsusb_device_t { int buffer_size; }; -int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb); +static int smsusb_submit_urb(struct smsusb_device_t *dev, + struct smsusb_urb_t *surb); -void smsusb_onresponse(struct urb *urb) +static void smsusb_onresponse(struct urb *urb) { struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context; struct smsusb_device_t *dev = surb->dev; @@ -110,7 +111,8 @@ exit_and_resubmit: smsusb_submit_urb(dev, surb); } -int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) +static int smsusb_submit_urb(struct smsusb_device_t *dev, + struct smsusb_urb_t *surb) { if (!surb->cb) { surb->cb = smscore_getbuffer(dev->coredev); @@ -135,7 +137,7 @@ int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) return usb_submit_urb(&surb->urb, GFP_ATOMIC); } -void smsusb_stop_streaming(struct smsusb_device_t *dev) +static void smsusb_stop_streaming(struct smsusb_device_t *dev) { int i; @@ -149,7 +151,7 @@ void smsusb_stop_streaming(struct smsusb_device_t *dev) } } -int smsusb_start_streaming(struct smsusb_device_t *dev) +static int smsusb_start_streaming(struct smsusb_device_t *dev) { int i, rc; @@ -165,7 +167,7 @@ int smsusb_start_streaming(struct smsusb_device_t *dev) return rc; } -int smsusb_sendrequest(void *context, void *buffer, size_t size) +static int smsusb_sendrequest(void *context, void *buffer, size_t size) { struct smsusb_device_t *dev = (struct smsusb_device_t *) context; int dummy; @@ -174,7 +176,7 @@ int smsusb_sendrequest(void *context, void *buffer, size_t size) buffer, size, &dummy, 1000); } -char *smsusb1_fw_lkup[] = { +static char *smsusb1_fw_lkup[] = { "dvbt_stellar_usb.inp", "dvbh_stellar_usb.inp", "tdmb_stellar_usb.inp", @@ -182,7 +184,7 @@ char *smsusb1_fw_lkup[] = { "dvbt_bda_stellar_usb.inp", }; -int smsusb1_load_firmware(struct usb_device *udev, int id) +static int smsusb1_load_firmware(struct usb_device *udev, int id) { const struct firmware *fw; u8 *fw_buffer; @@ -220,7 +222,7 @@ int smsusb1_load_firmware(struct usb_device *udev, int id) return rc; } -void smsusb1_detectmode(void *context, int *mode) +static void smsusb1_detectmode(void *context, int *mode) { char *product_string = ((struct smsusb_device_t *) context)->udev->product; @@ -242,7 +244,7 @@ void smsusb1_detectmode(void *context, int *mode) sms_info("%d \"%s\"", *mode, product_string); } -int smsusb1_setmode(void *context, int mode) +static int smsusb1_setmode(void *context, int mode) { struct SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, sizeof(struct SmsMsgHdr_ST), 0 }; @@ -255,7 +257,7 @@ int smsusb1_setmode(void *context, int mode) return smsusb_sendrequest(context, &Msg, sizeof(Msg)); } -void smsusb_term_device(struct usb_interface *intf) +static void smsusb_term_device(struct usb_interface *intf) { struct smsusb_device_t *dev = (struct smsusb_device_t *) usb_get_intfdata(intf); @@ -275,7 +277,7 @@ void smsusb_term_device(struct usb_interface *intf) usb_set_intfdata(intf, NULL); } -int smsusb_init_device(struct usb_interface *intf, int board_id) +static int smsusb_init_device(struct usb_interface *intf, int board_id) { struct smsdevice_params_t params; struct smsusb_device_t *dev; @@ -376,7 +378,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id) return rc; } -int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) +static int smsusb_probe(struct usb_interface *intf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); char devpath[32]; @@ -421,7 +424,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) return rc; } -void smsusb_disconnect(struct usb_interface *intf) +static void smsusb_disconnect(struct usb_interface *intf) { smsusb_term_device(intf); } -- cgit v1.2.3 From 2708e888c57904f78649dcd91dcda9768d580ecf Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 21 Jun 2008 05:24:38 -0300 Subject: V4L/DVB (8300): sms1xxx: simplify smsusb_init_device switch..case block Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smsusb.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index e6ee4434a29..e7e0fe73542 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -281,7 +281,6 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) { struct smsdevice_params_t params; struct smsusb_device_t *dev; - struct sms_board *board; int i, rc; /* create device object */ @@ -295,36 +294,21 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) usb_set_intfdata(intf, dev); dev->udev = interface_to_usbdev(intf); - board = sms_get_board(board_id); - - switch (board->type) { + params.device_type = sms_get_board(board_id)->type; + switch (params.device_type) { case SMS_STELLAR: dev->buffer_size = USB1_BUFFER_SIZE; params.setmode_handler = smsusb1_setmode; params.detectmode_handler = smsusb1_detectmode; - params.device_type = SMS_STELLAR; - sms_info("stellar device found"); break; default: - switch (board->type) { - case SMS_NOVA_A0: - params.device_type = SMS_NOVA_A0; - sms_info("nova A0 found"); - break; - case SMS_NOVA_B0: - params.device_type = SMS_NOVA_B0; - sms_info("nova B0 found"); - break; - case SMS_VEGA: - params.device_type = SMS_VEGA; - sms_info("Vega found"); - break; - default: - sms_err("Unspecified sms device type!"); - } - + sms_err("Unspecified sms device type!"); + /* fall-thru */ + case SMS_NOVA_A0: + case SMS_NOVA_B0: + case SMS_VEGA: dev->buffer_size = USB2_BUFFER_SIZE; dev->response_alignment = dev->udev->ep_in[1]->desc.wMaxPacketSize - -- cgit v1.2.3 From 02aea4fb640cdc4018e0a6d34e235eb63e4482d7 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 26 Jun 2008 04:58:30 -0300 Subject: V4L/DVB (8301): sms1xxx: add capability to define device-specific firmware filenames Add the capability to define device-specific firmware filenames for the SMS1150, with a mechanism to fall back to the generic firmware if the device-specific firmware is not present. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/sms-cards.h | 2 +- drivers/media/dvb/siano/smscoreapi.c | 31 ++++++++++++++++++++++++++----- drivers/media/dvb/siano/smsusb.c | 1 + 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index 7ba3df63dff..9e93f0b5b23 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h @@ -31,8 +31,8 @@ #define SMS1XXX_BOARD_SIANO_VEGA 5 struct sms_board { - char *name; enum sms_device_type_st type; + char *name, *fw[DEVICE_MODE_MAX]; }; struct sms_board *sms_get_board(int id); diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index bbb3ad9c804..eaa7cf22715 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -32,6 +32,7 @@ #include #include "smscoreapi.h" +#include "sms-cards.h" int sms_debug; module_param_named(debug, sms_debug, int, 0644); @@ -600,7 +601,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, sms_info("failed to open \"%s\"", filename); return rc; } - sms_info("read FW %s, size=%d\"", filename, fw->size); + sms_info("read FW %s, size=%d", filename, fw->size); fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), GFP_KERNEL | GFP_DMA); if (fw_buffer) { @@ -736,6 +737,12 @@ static char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { {"none", "none", "none", "cmmb_vega_12mhz.inp"} }; +static inline char *sms_get_fw_name(struct smscore_device_t *coredev, + int mode, enum sms_device_type_st type) +{ + char **fw = sms_get_board(smscore_get_board_id(coredev))->fw; + return (fw && fw[mode]) ? fw[mode] : smscore_fw_lkup[mode][type]; +} /** * calls device handler to change mode of operation @@ -776,12 +783,26 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) } if (!(coredev->modes_supported & (1 << mode))) { + char *fw_filename; + type = smscore_registry_gettype(coredev->devpath); - rc = smscore_load_firmware_from_file( - coredev, smscore_fw_lkup[mode][type], NULL); + fw_filename = sms_get_fw_name(coredev, mode, type); + + rc = smscore_load_firmware_from_file(coredev, + fw_filename, NULL); if (rc < 0) { - sms_err("load firmware failed %d", rc); - return rc; + sms_err("error %d loading firmware: %s, " + "trying again with default firmware", + rc, fw_filename); + + /* try again with the default firmware */ + rc = smscore_load_firmware_from_file(coredev, + smscore_fw_lkup[mode][type], NULL); + + if (rc < 0) { + sms_err("load firmware failed %d", rc); + return rc; + } } } else sms_info("mode %d supported by running " diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index e7e0fe73542..f85210f2bd0 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -216,6 +216,7 @@ static int smsusb1_load_firmware(struct usb_device *udev, int id) sms_err("failed to allocate firmware buffer"); rc = -ENOMEM; } + sms_info("read FW %s, size=%d", smsusb1_fw_lkup[id], fw->size); release_firmware(fw); -- cgit v1.2.3 From cf1cfe1ba70952093a46bb0e21b58357f36f2e8f Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Jun 2008 16:45:36 -0300 Subject: V4L/DVB (8302): sms1xxx: fix Siano board names Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/sms-cards.c | 12 ++++-------- drivers/media/dvb/siano/sms-cards.h | 9 ++++----- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index 88fc2a4edc1..6a22ec10fe2 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c @@ -38,24 +38,20 @@ static struct sms_board sms_boards[] = { [SMS_BOARD_UNKNOWN] = { .name = "Unknown board", }, - [SMS1XXX_BOARD_SIANO_SMS1000] = { - .name = "Siano Digital Receiver", - .type = SMS_STELLAR, - }, [SMS1XXX_BOARD_SIANO_STELLAR] = { - .name = "Siano Stellar reference board", + .name = "Siano Stellar Digital Receiver", .type = SMS_STELLAR, }, [SMS1XXX_BOARD_SIANO_NOVA_A] = { - .name = "Siano Nova A reference board", + .name = "Siano Nova A Digital Receiver", .type = SMS_NOVA_A0, }, [SMS1XXX_BOARD_SIANO_NOVA_B] = { - .name = "Siano Nova B reference board", + .name = "Siano Nova B Digital Receiver", .type = SMS_NOVA_B0, }, [SMS1XXX_BOARD_SIANO_VEGA] = { - .name = "Siano Vega reference board", + .name = "Siano Vega Digital Receiver", .type = SMS_VEGA, }, }; diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index 9e93f0b5b23..262e3ffbc29 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h @@ -24,11 +24,10 @@ #include "smscoreapi.h" #define SMS_BOARD_UNKNOWN 0 -#define SMS1XXX_BOARD_SIANO_SMS1000 1 -#define SMS1XXX_BOARD_SIANO_STELLAR 2 -#define SMS1XXX_BOARD_SIANO_NOVA_A 3 -#define SMS1XXX_BOARD_SIANO_NOVA_B 4 -#define SMS1XXX_BOARD_SIANO_VEGA 5 +#define SMS1XXX_BOARD_SIANO_STELLAR 1 +#define SMS1XXX_BOARD_SIANO_NOVA_A 2 +#define SMS1XXX_BOARD_SIANO_NOVA_B 3 +#define SMS1XXX_BOARD_SIANO_VEGA 4 struct sms_board { enum sms_device_type_st type; -- cgit v1.2.3 From 8f37356b065206316e0b66dbee2718c82329684c Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Jun 2008 17:09:28 -0300 Subject: V4L/DVB (8303): sms1xxx: update MODULE_DESCRIPTION set MODULE_DESCRIPTION to "Driver for the Siano SMS1XXX USB dongle" Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 2 +- drivers/media/dvb/siano/smsdvb.c | 2 +- drivers/media/dvb/siano/smsusb.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index eaa7cf22715..14475c8a722 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -1242,6 +1242,6 @@ void smscore_module_exit(void) module_init(smscore_module_init); module_exit(smscore_module_exit); -MODULE_DESCRIPTION("smscore"); +MODULE_DESCRIPTION("Driver for the Siano SMS1XXX USB dongle"); MODULE_AUTHOR("Siano Mobile Silicon,,, (doronc@siano-ms.com)"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 61c06b770c6..72d1de7a6de 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -1,5 +1,5 @@ /* - * Driver for the Siano SMS10xx USB dongle + * Driver for the Siano SMS1xxx USB dongle * * author: Anatoly Greenblat * diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index f85210f2bd0..0f9f5d585e3 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -1,5 +1,5 @@ /* - * Driver for the Siano SMS10xx USB dongle + * Driver for the Siano SMS1xxx USB dongle * * author: Anatoly Greenblat * -- cgit v1.2.3 From 0f2a1ee112a4709a3b1a3c3c64b5d11752da1eef Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Jun 2008 20:53:45 -0300 Subject: V4L/DVB (8305): sms1xxx: fix warning: format '%d' expects type 'int', but argument x has type 'size_t' Fix the following 64bit build warning: make[2]: Entering directory `/usr/src/linux-headers-2.6.24-16-generic' CC [M] smscoreapi.o smscoreapi.c: In function 'smscore_load_firmware_from_file': smscoreapi.c:604: warning: format '%d' expects type 'int', but argument 4 has type 'size_t' CC [M] smsusb.o smsusb.c: In function 'smsusb1_load_firmware': smsusb.c:216: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' smsusb.c:223: warning: format '%d' expects type 'int', but argument 4 has type 'size_t' Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 2 +- drivers/media/dvb/siano/smsusb.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 14475c8a722..c54c7180e39 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -601,7 +601,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, sms_info("failed to open \"%s\"", filename); return rc; } - sms_info("read FW %s, size=%d", filename, fw->size); + sms_info("read FW %s, size=%zd", filename, fw->size); fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), GFP_KERNEL | GFP_DMA); if (fw_buffer) { diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 0f9f5d585e3..b62ca96dfbe 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -209,14 +209,14 @@ static int smsusb1_load_firmware(struct usb_device *udev, int id) rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), fw_buffer, fw->size, &dummy, 1000); - sms_info("sent %d(%d) bytes, rc %d", fw->size, dummy, rc); + sms_info("sent %zd(%d) bytes, rc %d", fw->size, dummy, rc); kfree(fw_buffer); } else { sms_err("failed to allocate firmware buffer"); rc = -ENOMEM; } - sms_info("read FW %s, size=%d", smsusb1_fw_lkup[id], fw->size); + sms_info("read FW %s, size=%zd", smsusb1_fw_lkup[id], fw->size); release_firmware(fw); -- cgit v1.2.3 From 5068b7a449293ced0ea963f3c944189d78fe1b1e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Jun 2008 23:27:19 -0300 Subject: V4L/DVB (8306): sms1xxx: log firmware download process by default Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 14 +++++++++----- drivers/media/dvb/siano/smscoreapi.h | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index c54c7180e39..1dd19660003 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -791,19 +791,23 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) rc = smscore_load_firmware_from_file(coredev, fw_filename, NULL); if (rc < 0) { - sms_err("error %d loading firmware: %s, " - "trying again with default firmware", - rc, fw_filename); + sms_warn("error %d loading firmware: %s, " + "trying again with default firmware", + rc, fw_filename); /* try again with the default firmware */ + fw_filename = smscore_fw_lkup[mode][type]; rc = smscore_load_firmware_from_file(coredev, - smscore_fw_lkup[mode][type], NULL); + fw_filename, NULL); if (rc < 0) { - sms_err("load firmware failed %d", rc); + sms_warn("error %d loading " + "firmware: %s", rc, + fw_filename); return rc; } } + sms_log("firmware download success: %s", fw_filename); } else sms_info("mode %d supported by running " "firmware", mode); diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 3e4e7dbc54d..c1f56900b3e 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -421,10 +421,10 @@ extern int sms_debug; if (sms_debug & lvl) \ sms_printk(kern, fmt, ##arg); } while (0) +#define sms_log(fmt, arg...) sms_printk(KERN_INFO, fmt, ##arg) #define sms_err(fmt, arg...) \ sms_printk(KERN_ERR, "line: %d: " fmt, __LINE__, ##arg) -#define sms_warn(fmt, arg...) \ - sms_printk(KERN_WARNING, "line: %d: " fmt, __LINE__, ##arg) +#define sms_warn(fmt, arg...) sms_printk(KERN_WARNING, fmt, ##arg) #define sms_info(fmt, arg...) \ dprintk(KERN_INFO, DBG_INFO, fmt, ##arg) #define sms_debug(fmt, arg...) \ -- cgit v1.2.3 From eb383bddc5ec52087ccfad4cccd8c6cc57c846d8 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 29 Jun 2008 01:33:23 -0300 Subject: V4L/DVB (8307): sms1xxx: change smsusb_driver.name to sms1xxx Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smsusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index b62ca96dfbe..9a2144c547a 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -415,7 +415,7 @@ static void smsusb_disconnect(struct usb_interface *intf) } static struct usb_driver smsusb_driver = { - .name = "smsusb", + .name = "sms1xxx", .probe = smsusb_probe, .disconnect = smsusb_disconnect, .id_table = smsusb_id_table, -- cgit v1.2.3 From 14a638cd3b6031c27b33560506244b9bf1913ad9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Jun 2008 23:53:51 -0300 Subject: V4L/DVB (8308): sms1xxx: Provide option to support Siano default usb ids Provide an option to enable / disable support for Siano's default usb ids. This allows the support for Siano's USB IDs to be disabled, so that Siano's external driver can be used, instead. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/Kconfig | 20 +++++++++++++++----- drivers/media/dvb/siano/sms-cards.c | 2 ++ 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/Kconfig b/drivers/media/dvb/siano/Kconfig index 878d48c1cfc..dd863f26167 100644 --- a/drivers/media/dvb/siano/Kconfig +++ b/drivers/media/dvb/siano/Kconfig @@ -3,14 +3,24 @@ # config DVB_SIANO_SMS1XXX - tristate "Siano SMS1xxx USB dongle support" + tristate "Siano SMS1XXX USB dongle support" depends on DVB_CORE && USB ---help--- - Choose Y here if you have USB dongle with SMS1xxx chipset. - - Further documentation on this driver can be found on the WWW at - . + Choose Y here if you have a USB dongle with a SMS1XXX chipset. To compile this driver as a module, choose M here: the module will be called sms1xxx. +config DVB_SIANO_SMS1XXX_SMS_IDS + bool "Enable support for Siano Mobile Silicon default USB IDs" + depends on DVB_SIANO_SMS1XXX + default y + ---help--- + Choose Y here if you have a USB dongle with a SMS1XXX chipset + that uses Siano Mobile Silicon's default usb vid:pid. + + Choose N here if you would prefer to use Siano's external driver. + + Further documentation on this driver can be found on the WWW at + . + diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index 6a22ec10fe2..c4c9ab0232e 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c @@ -20,6 +20,7 @@ #include "sms-cards.h" struct usb_device_id smsusb_id_table[] = { +#ifdef CONFIG_DVB_SIANO_SMS1XXX_SMS_IDS { USB_DEVICE(0x187f, 0x0010), .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, { USB_DEVICE(0x187f, 0x0100), @@ -30,6 +31,7 @@ struct usb_device_id smsusb_id_table[] = { .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B }, { USB_DEVICE(0x187f, 0x0300), .driver_info = SMS1XXX_BOARD_SIANO_VEGA }, +#endif { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, smsusb_id_table); -- cgit v1.2.3 From 4411d29165d83a4a73ea351ffccfdc0fd8baeb1e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 29 Jun 2008 14:45:37 -0300 Subject: V4L/DVB (8309): sms1xxx: fix OOPS on 64 bit kernels due to a bad cast Fix the following build warning: smscoreapi.c: In function 'smscore_detect_mode': smscoreapi.c:689: warning: cast from pointer to integer of different size smscoreapi.c:689: warning: cast to pointer from integer of different size smscoreapi.c: In function 'smscore_set_device_mode': smscoreapi.c:820: warning: cast from pointer to integer of different size smscoreapi.c:820: warning: cast to pointer from integer of different size ...and fix the following OOPS on 64bit kernels: [ 717.263667] usb 6-4: new high speed USB device using ehci_hcd and address 2 [ 717.396386] usb 6-4: configuration #1 chosen from 1 choice [ 717.473650] Unable to handle kernel paging request at 0000000000c02000 RIP: [ 717.473657] [] :sms1xxx:smscore_set_device_mode+0x22c/0x4a0 [ 717.473669] PGD 3c6f7067 PUD 3d484067 PMD 0 [ 717.473674] Oops: 0002 [1] SMP [ 717.473678] CPU 0 [Modules linked in snipped] [ 717.473773] Pid: 8380, comm: modprobe Tainted: P 2.6.24-16-generic #1 [ 717.473776] RIP: 0010:[] [] :sms1xxx:smscore_set_device_mode+0x22c/0x4a0 [ 717.473784] RSP: 0018:ffff81003d495ba8 EFLAGS: 00010206 [ 717.473786] RAX: ffff81003d8cd8d0 RBX: ffff81003d8cd800 RCX: ffff81003d8cd8d0 [ 717.473788] RDX: 0000000000000008 RSI: ffff81003f080070 RDI: ffff81003d8cd800 [ 717.473791] RBP: 0000000000000004 R08: ffff81003ec0104b R09: ffffffffffffffff [ 717.473793] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000c02000 [ 717.473796] R13: 00000000fffffff4 R14: ffff810000c02000 R15: ffff81003d8cd878 [ 717.473799] FS: 00007f70a680f6e0(0000) GS:ffffffff805b0000(0000) knlGS:0000000000000000 [ 717.473801] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 717.473804] CR2: 0000000000c02000 CR3: 000000003c68b000 CR4: 00000000000006e0 [ 717.473806] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 717.473809] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 717.473812] Process modprobe (pid: 8380, threadinfo ffff81003d494000, task ffff81003d2fc000) [ 717.473814] Stack: ffff81003d8cd800 ffff81003d8cd800 0000000000000000 ffff81003c6d8000 [ 717.473820] ffff81003dcac800 0000000000000008 ffffc20000787bb0 ffffffff88dba16c [ 717.473825] ffff81003dcac800 000000000000000a 0000000000000000 ffffffff88dbb2fa [ 717.473829] Call Trace: [ 717.473866] [] :sms1xxx:smscore_start_device+0x1c/0xb0 [ 717.473885] [] :sms1xxx:smsusb_probe+0x29a/0x670 [ 717.473929] [] :sms1xxx:smsusb_sendrequest+0x0/0x30 [ 717.473965] [] mutex_lock+0x9/0x20 [ 717.473998] [] :usbcore:usb_autopm_do_device+0x8e/0x130 [ 717.474040] [] :usbcore:usb_probe_interface+0xda/0x160 [ 717.474067] [] driver_probe_device+0x9c/0x1b0 [ 717.474091] [] __driver_attach+0xc9/0xd0 [ 717.474107] [] __driver_attach+0x0/0xd0 [ 717.474115] [] bus_for_each_dev+0x4d/0x80 [ 717.474156] [] bus_add_driver+0xac/0x220 [ 717.474203] [] :usbcore:usb_register_driver+0xa9/0x120 [ 717.474232] [] :sms1xxx:smsusb_register+0x1b/0x70 [ 717.474243] [] :sms1xxx:smscore_module_init+0x7c/0xb0 [ 717.474253] [] sys_init_module+0x18e/0x1a90 [ 717.474426] [] system_call+0x7e/0x83 [ 717.474490] [ 717.474491] [ 717.474492] Code: 66 41 c7 04 24 9c 02 41 c6 44 24 02 00 4c 89 e6 41 c6 44 24 [ 717.474506] RIP [] :sms1xxx:smscore_set_device_mode+0x22c/0x4a0 [ 717.474513] RSP [ 717.474515] CR2: 0000000000c02000 [ 717.474521] ---[ end trace 52d9c6f207be106a ]--- Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index c1f56900b3e..eeb5c0a7f62 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -50,7 +50,7 @@ typedef struct mutex kmutex_t; #define SMS_ALLOC_ALIGNMENT 128 #define SMS_DMA_ALIGNMENT 16 #define SMS_ALIGN_ADDRESS(addr) \ - ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) + ((((uintptr_t)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) #define SMS_DEVICE_FAMILY2 1 #define SMS_ROM_NO_RESPONSE 2 -- cgit v1.2.3 From b1d8f9f5b8036b61a7ec562dfb86361f5b18e8f2 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 29 Jun 2008 15:15:19 -0300 Subject: V4L/DVB (8310): sms1xxx: remove kmutex_t typedef remove typedef struct mutex kmutex_t fix one line > 80 columns Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 4 ++-- drivers/media/dvb/siano/smscoreapi.h | 5 ++--- drivers/media/dvb/siano/smsdvb.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 1dd19660003..9e7730a40e0 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -112,10 +112,10 @@ struct smscore_registry_entry_t { struct list_head g_smscore_notifyees; struct list_head g_smscore_devices; -kmutex_t g_smscore_deviceslock; +struct mutex g_smscore_deviceslock; struct list_head g_smscore_registry; -kmutex_t g_smscore_registrylock; +struct mutex g_smscore_registrylock; static int default_mode = 4; diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index eeb5c0a7f62..fb6acaefcbc 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -36,8 +36,6 @@ #include -typedef struct mutex kmutex_t; - #define kmutex_init(_p_) mutex_init(_p_) #define kmutex_lock(_p_) mutex_lock(_p_) #define kmutex_trylock(_p_) mutex_trylock(_p_) @@ -392,7 +390,8 @@ extern void smscore_onresponse(struct smscore_device_t *coredev, struct smscore_buffer_t *cb); -extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev); +extern +struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev); extern void smscore_putbuffer(struct smscore_device_t *coredev, struct smscore_buffer_t *cb); diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 72d1de7a6de..6f9c1856386 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c @@ -28,7 +28,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct list_head g_smsdvb_clients; -kmutex_t g_smsdvb_clientslock; +struct mutex g_smsdvb_clientslock; static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) { -- cgit v1.2.3 From 1fbc3caff47785aca67b4bd5b29c04f3f20c770e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 1 Jul 2008 04:35:26 -0300 Subject: V4L/DVB (8311): sms1xxx: support device-specific firmware filenames on stellar usb1 sticks Add the capability to define device-specific firmware filenames for the SMS1010, with a mechanism to fall back to the generic firmware if the device-specific firmware is not present. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smsusb.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 9a2144c547a..c10b1849c6a 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -184,22 +184,39 @@ static char *smsusb1_fw_lkup[] = { "dvbt_bda_stellar_usb.inp", }; -static int smsusb1_load_firmware(struct usb_device *udev, int id) +static inline char *sms_get_fw_name(int mode, int board_id) +{ + char **fw = sms_get_board(board_id)->fw; + return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode]; +} + +static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id) { const struct firmware *fw; u8 *fw_buffer; int rc, dummy; + char *fw_filename; if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { sms_err("invalid firmware id specified %d", id); return -EINVAL; } - rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); + fw_filename = sms_get_fw_name(id, board_id); + + rc = request_firmware(&fw, fw_filename, &udev->dev); if (rc < 0) { - sms_err("failed to open \"%s\" mode %d", - smsusb1_fw_lkup[id], id); - return rc; + sms_warn("failed to open \"%s\" mode %d, " + "trying again with default firmware", fw_filename, id); + + fw_filename = smsusb1_fw_lkup[id]; + rc = request_firmware(&fw, fw_filename, &udev->dev); + if (rc < 0) { + sms_warn("failed to open \"%s\" mode %d", + fw_filename, id); + + return rc; + } } fw_buffer = kmalloc(fw->size, GFP_KERNEL); @@ -216,7 +233,7 @@ static int smsusb1_load_firmware(struct usb_device *udev, int id) sms_err("failed to allocate firmware buffer"); rc = -ENOMEM; } - sms_info("read FW %s, size=%zd", smsusb1_fw_lkup[id], fw->size); + sms_info("read FW %s, size=%zd", fw_filename, fw->size); release_firmware(fw); @@ -401,7 +418,8 @@ static int smsusb_probe(struct usb_interface *intf, udev->bus->busnum, udev->devpath); sms_info("stellar device was found."); return smsusb1_load_firmware( - udev, smscore_registry_getmode(devpath)); + udev, smscore_registry_getmode(devpath), + id->driver_info); } rc = smsusb_init_device(intf, id->driver_info); -- cgit v1.2.3 From a745f0a12cab631b92f9e13b31997192c7df3823 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 1 Jul 2008 04:47:10 -0300 Subject: V4L/DVB (8312): sms1xxx: add firmware filenames to board properties for stellar and nova Assign the following firmware filenames: sms1xxx-stellar-dvbt-01.fw sms1xxx-nova-a-dvbt-01.fw sms1xxx-nova-b-dvbt-01.fw Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/sms-cards.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index c4c9ab0232e..c75c27c18b1 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c @@ -43,14 +43,17 @@ static struct sms_board sms_boards[] = { [SMS1XXX_BOARD_SIANO_STELLAR] = { .name = "Siano Stellar Digital Receiver", .type = SMS_STELLAR, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw", }, [SMS1XXX_BOARD_SIANO_NOVA_A] = { .name = "Siano Nova A Digital Receiver", .type = SMS_NOVA_A0, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw", }, [SMS1XXX_BOARD_SIANO_NOVA_B] = { .name = "Siano Nova B Digital Receiver", .type = SMS_NOVA_B0, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw", }, [SMS1XXX_BOARD_SIANO_VEGA] = { .name = "Siano Vega Digital Receiver", -- cgit v1.2.3 From 44f71c3fcefbfea3628cca52c0a177252cf83b60 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Jun 2008 23:55:36 -0300 Subject: V4L/DVB (8313): sms1xxx: add support for Hauppauge WinTV-Nova-T-MiniStick Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/sms-cards.c | 32 ++++++++++++++++++++++++++++++++ drivers/media/dvb/siano/sms-cards.h | 4 ++++ 2 files changed, 36 insertions(+) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index c75c27c18b1..e7a8ac0c404 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c @@ -32,6 +32,18 @@ struct usb_device_id smsusb_id_table[] = { { USB_DEVICE(0x187f, 0x0300), .driver_info = SMS1XXX_BOARD_SIANO_VEGA }, #endif + { USB_DEVICE(0x2040, 0x1700), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT }, + { USB_DEVICE(0x2040, 0x1800), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A }, + { USB_DEVICE(0x2040, 0x1801), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B }, + { USB_DEVICE(0x2040, 0x5500), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, + { USB_DEVICE(0x2040, 0x5580), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, + { USB_DEVICE(0x2040, 0x5590), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, smsusb_id_table); @@ -59,6 +71,26 @@ static struct sms_board sms_boards[] = { .name = "Siano Vega Digital Receiver", .type = SMS_VEGA, }, + [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = { + .name = "Hauppauge Catamount", + .type = SMS_STELLAR, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw", + }, + [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = { + .name = "Hauppauge Okemo-A", + .type = SMS_NOVA_A0, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw", + }, + [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = { + .name = "Hauppauge Okemo-B", + .type = SMS_NOVA_B0, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw", + }, + [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = { + .name = "Hauppauge WinTV-Nova-T-MiniStick", + .type = SMS_NOVA_B0, + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw", + }, }; struct sms_board *sms_get_board(int id) diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index 262e3ffbc29..83b39bc203f 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h @@ -28,6 +28,10 @@ #define SMS1XXX_BOARD_SIANO_NOVA_A 2 #define SMS1XXX_BOARD_SIANO_NOVA_B 3 #define SMS1XXX_BOARD_SIANO_VEGA 4 +#define SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT 5 +#define SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A 6 +#define SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B 7 +#define SMS1XXX_BOARD_HAUPPAUGE_WINDHAM 8 struct sms_board { enum sms_device_type_st type; -- cgit v1.2.3 From f1f74aa2cf7f109b2eaf3502b8bd13bf40bf6633 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 12 Jul 2008 00:37:08 -0300 Subject: V4L/DVB (8322): sms1xxx: fix improper usage of asm/foo.h Fix the following warnings generated by checkpatch.pl: WARNING: Use #include instead of 251: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:30: +#include WARNING: Use #include instead of 1566: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:29: +#include Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 2 +- drivers/media/dvb/siano/smscoreapi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 9e7730a40e0..b4b8ed795c9 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index fb6acaefcbc..926ec8ca47a 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "dmxdev.h" -- cgit v1.2.3 From 2c6a37bb076b9718c6362d4ffa1c7e58fdb1a0e9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 12 Jul 2008 22:58:24 -0300 Subject: V4L/DVB (8326): sms1xxx: fix missing #include Fix the build error: smscoreapi.c:689: error: 'uintptr_t' undeclared Thanks to Peter Schlaf for reporting this. Cc: Peter Schlaf Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media/dvb/siano') diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 926ec8ca47a..c1f8f1dccb1 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "dmxdev.h" -- cgit v1.2.3