aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c101
-rw-r--r--drivers/media/dvb/siano/smscoreapi.h7
-rw-r--r--drivers/media/dvb/siano/smsdvb.c10
-rw-r--r--drivers/media/dvb/siano/smsusb.c31
4 files changed, 47 insertions, 102 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index 142fe00c37fc..bbb3ad9c804a 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)
162 return default_mode; 162 return default_mode;
163} 163}
164 164
165enum sms_device_type_st smscore_registry_gettype(char *devpath) 165static enum sms_device_type_st smscore_registry_gettype(char *devpath)
166{ 166{
167 struct smscore_registry_entry_t *entry; 167 struct smscore_registry_entry_t *entry;
168 168
@@ -186,7 +186,8 @@ void smscore_registry_setmode(char *devpath, int mode)
186 sms_err("No registry found."); 186 sms_err("No registry found.");
187} 187}
188 188
189void smscore_registry_settype(char *devpath, enum sms_device_type_st type) 189static void smscore_registry_settype(char *devpath,
190 enum sms_device_type_st type)
190{ 191{
191 struct smscore_registry_entry_t *entry; 192 struct smscore_registry_entry_t *entry;
192 193
@@ -198,8 +199,8 @@ void smscore_registry_settype(char *devpath, enum sms_device_type_st type)
198} 199}
199 200
200 201
201void list_add_locked(struct list_head *new, struct list_head *head, 202static void list_add_locked(struct list_head *new, struct list_head *head,
202 spinlock_t *lock) 203 spinlock_t *lock)
203{ 204{
204 unsigned long flags; 205 unsigned long flags;
205 206
@@ -280,7 +281,7 @@ void smscore_unregister_hotplug(hotplug_t hotplug)
280 kmutex_unlock(&g_smscore_deviceslock); 281 kmutex_unlock(&g_smscore_deviceslock);
281} 282}
282 283
283void smscore_notify_clients(struct smscore_device_t *coredev) 284static void smscore_notify_clients(struct smscore_device_t *coredev)
284{ 285{
285 struct smscore_client_t *client; 286 struct smscore_client_t *client;
286 287
@@ -291,8 +292,8 @@ void smscore_notify_clients(struct smscore_device_t *coredev)
291 } 292 }
292} 293}
293 294
294int smscore_notify_callbacks(struct smscore_device_t *coredev, 295static int smscore_notify_callbacks(struct smscore_device_t *coredev,
295 struct device *device, int arrival) 296 struct device *device, int arrival)
296{ 297{
297 struct list_head *next, *first; 298 struct list_head *next, *first;
298 int rc = 0; 299 int rc = 0;
@@ -311,7 +312,8 @@ int smscore_notify_callbacks(struct smscore_device_t *coredev,
311 return rc; 312 return rc;
312} 313}
313 314
314struct smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, 315static struct
316smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
315 dma_addr_t common_buffer_phys) 317 dma_addr_t common_buffer_phys)
316{ 318{
317 struct smscore_buffer_t *cb = 319 struct smscore_buffer_t *cb =
@@ -450,8 +452,9 @@ int smscore_start_device(struct smscore_device_t *coredev)
450 return rc; 452 return rc;
451} 453}
452 454
453int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, 455static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev,
454 size_t size, struct completion *completion) 456 void *buffer, size_t size,
457 struct completion *completion)
455{ 458{
456 int rc = coredev->sendrequest_handler(coredev->context, buffer, size); 459 int rc = coredev->sendrequest_handler(coredev->context, buffer, size);
457 if (rc < 0) { 460 if (rc < 0) {
@@ -464,8 +467,8 @@ int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer,
464 0 : -ETIME; 467 0 : -ETIME;
465} 468}
466 469
467int smscore_load_firmware_family2(struct smscore_device_t *coredev, 470static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
468 void *buffer, size_t size) 471 void *buffer, size_t size)
469{ 472{
470 struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer; 473 struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer;
471 struct SmsMsgHdr_ST *msg; 474 struct SmsMsgHdr_ST *msg;
@@ -580,9 +583,9 @@ int smscore_load_firmware_family2(struct smscore_device_t *coredev,
580 * 583 *
581 * @return 0 on success, <0 on error. 584 * @return 0 on success, <0 on error.
582 */ 585 */
583int smscore_load_firmware_from_file(struct smscore_device_t *coredev, 586static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
584 char *filename, 587 char *filename,
585 loadfirmware_t loadfirmware_handler) 588 loadfirmware_t loadfirmware_handler)
586{ 589{
587 int rc = -ENOENT; 590 int rc = -ENOENT;
588 const struct firmware *fw; 591 const struct firmware *fw;
@@ -621,13 +624,6 @@ int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
621 return rc; 624 return rc;
622} 625}
623 626
624int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev,
625 u8 *buffer, int size, int new_mode)
626{
627 sms_err("feature not yet implemented.");
628 return -EFAULT;
629}
630
631/** 627/**
632 * notifies all clients registered with the device, notifies hotplugs, 628 * notifies all clients registered with the device, notifies hotplugs,
633 * frees all buffers and coredev object 629 * frees all buffers and coredev object
@@ -684,7 +680,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev)
684 sms_info("device %p destroyed", coredev); 680 sms_info("device %p destroyed", coredev);
685} 681}
686 682
687int smscore_detect_mode(struct smscore_device_t *coredev) 683static int smscore_detect_mode(struct smscore_device_t *coredev)
688{ 684{
689 void *buffer = kmalloc(sizeof(struct SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, 685 void *buffer = kmalloc(sizeof(struct SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT,
690 GFP_KERNEL | GFP_DMA); 686 GFP_KERNEL | GFP_DMA);
@@ -720,7 +716,7 @@ int smscore_detect_mode(struct smscore_device_t *coredev)
720 return rc; 716 return rc;
721} 717}
722 718
723char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { 719static char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = {
724 /*Stellar NOVA A0 Nova B0 VEGA*/ 720 /*Stellar NOVA A0 Nova B0 VEGA*/
725 /*DVBT*/ 721 /*DVBT*/
726 {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, 722 {"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)
861 * @param id client id (SMS_DONT_CARE for all id) 857 * @param id client id (SMS_DONT_CARE for all id)
862 * 858 *
863 */ 859 */
864struct smscore_client_t *smscore_find_client(struct smscore_device_t *coredev, 860static struct
861smscore_client_t *smscore_find_client(struct smscore_device_t *coredev,
865 int data_type, int id) 862 int data_type, int id)
866{ 863{
867 struct smscore_client_t *client = NULL; 864 struct smscore_client_t *client = NULL;
@@ -1016,9 +1013,9 @@ void smscore_putbuffer(struct smscore_device_t *coredev,
1016 list_add_locked(&cb->entry, &coredev->buffers, &coredev->bufferslock); 1013 list_add_locked(&cb->entry, &coredev->buffers, &coredev->bufferslock);
1017} 1014}
1018 1015
1019int smscore_validate_client(struct smscore_device_t *coredev, 1016static int smscore_validate_client(struct smscore_device_t *coredev,
1020 struct smscore_client_t *client, 1017 struct smscore_client_t *client,
1021 int data_type, int id) 1018 int data_type, int id)
1022{ 1019{
1023 struct smscore_idlist_t *listentry; 1020 struct smscore_idlist_t *listentry;
1024 struct smscore_client_t *registered_client; 1021 struct smscore_client_t *registered_client;
@@ -1164,54 +1161,6 @@ int smsclient_sendrequest(struct smscore_client_t *client,
1164 return coredev->sendrequest_handler(coredev->context, buffer, size); 1161 return coredev->sendrequest_handler(coredev->context, buffer, size);
1165} 1162}
1166 1163
1167/**
1168 * return the size of large (common) buffer
1169 *
1170 * @param coredev pointer to a coredev object from clients hotplug
1171 *
1172 * @return size (in bytes) of the buffer
1173 */
1174int smscore_get_common_buffer_size(struct smscore_device_t *coredev)
1175{
1176 return coredev->common_buffer_size;
1177}
1178
1179/**
1180 * maps common buffer (if supported by platform)
1181 *
1182 * @param coredev pointer to a coredev object from clients hotplug
1183 * @param vma pointer to vma struct from mmap handler
1184 *
1185 * @return 0 on success, <0 on error.
1186 */
1187int smscore_map_common_buffer(struct smscore_device_t *coredev,
1188 struct vm_area_struct *vma)
1189{
1190 unsigned long end = vma->vm_end,
1191 start = vma->vm_start,
1192 size = PAGE_ALIGN(coredev->common_buffer_size);
1193
1194 if (!(vma->vm_flags & (VM_READ | VM_SHARED)) ||
1195 (vma->vm_flags & VM_WRITE)) {
1196 sms_err("invalid vm flags");
1197 return -EINVAL;
1198 }
1199
1200 if ((end - start) != size) {
1201 sms_err("invalid size %d expected %d",
1202 (int)(end - start), (int) size);
1203 return -EINVAL;
1204 }
1205
1206 if (remap_pfn_range(vma, start,
1207 coredev->common_buffer_phys >> PAGE_SHIFT,
1208 size, pgprot_noncached(vma->vm_page_prot))) {
1209 sms_err("remap_page_range failed");
1210 return -EAGAIN;
1211 }
1212
1213 return 0;
1214}
1215 1164
1216int smscore_module_init(void) 1165int smscore_module_init(void)
1217{ 1166{
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h
index eb0ed6542e94..3e4e7dbc54da 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,
378 char *filename, 378 char *filename,
379 loadfirmware_t loadfirmware_handler); 379 loadfirmware_t loadfirmware_handler);
380 380
381extern int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev,
382 u8 *buffer, int size,
383 int new_mode);
384
385extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode); 381extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
386extern int smscore_get_device_mode(struct smscore_device_t *coredev); 382extern int smscore_get_device_mode(struct smscore_device_t *coredev);
387 383
@@ -395,9 +391,6 @@ extern int smsclient_sendrequest(struct smscore_client_t *client,
395extern void smscore_onresponse(struct smscore_device_t *coredev, 391extern void smscore_onresponse(struct smscore_device_t *coredev,
396 struct smscore_buffer_t *cb); 392 struct smscore_buffer_t *cb);
397 393
398extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
399extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
400 struct vm_area_struct *vma);
401 394
402extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev); 395extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
403extern void smscore_putbuffer(struct smscore_device_t *coredev, 396extern 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 f9a6ce0441f7..61c06b770c6c 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);
30struct list_head g_smsdvb_clients; 30struct list_head g_smsdvb_clients;
31kmutex_t g_smsdvb_clientslock; 31kmutex_t g_smsdvb_clientslock;
32 32
33int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) 33static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
34{ 34{
35 struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; 35 struct smsdvb_client_t *client = (struct smsdvb_client_t *) context;
36 struct SmsMsgHdr_ST *phdr = 36 struct SmsMsgHdr_ST *phdr =
@@ -84,7 +84,7 @@ int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
84 return 0; 84 return 0;
85} 85}
86 86
87void smsdvb_unregister_client(struct smsdvb_client_t *client) 87static void smsdvb_unregister_client(struct smsdvb_client_t *client)
88{ 88{
89 /* must be called under clientslock */ 89 /* must be called under clientslock */
90 90
@@ -98,7 +98,7 @@ void smsdvb_unregister_client(struct smsdvb_client_t *client)
98 kfree(client); 98 kfree(client);
99} 99}
100 100
101void smsdvb_onremove(void *context) 101static void smsdvb_onremove(void *context)
102{ 102{
103 kmutex_lock(&g_smsdvb_clientslock); 103 kmutex_lock(&g_smsdvb_clientslock);
104 104
@@ -310,8 +310,8 @@ static struct dvb_frontend_ops smsdvb_fe_ops = {
310 .read_snr = smsdvb_read_snr, 310 .read_snr = smsdvb_read_snr,
311}; 311};
312 312
313int smsdvb_hotplug(struct smscore_device_t *coredev, 313static int smsdvb_hotplug(struct smscore_device_t *coredev,
314 struct device *device, int arrival) 314 struct device *device, int arrival)
315{ 315{
316 struct smsclient_params_t params; 316 struct smsclient_params_t params;
317 struct smsdvb_client_t *client; 317 struct smsdvb_client_t *client;
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index 221b024e9d83..e6ee4434a294 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -52,9 +52,10 @@ struct smsusb_device_t {
52 int buffer_size; 52 int buffer_size;
53}; 53};
54 54
55int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb); 55static int smsusb_submit_urb(struct smsusb_device_t *dev,
56 struct smsusb_urb_t *surb);
56 57
57void smsusb_onresponse(struct urb *urb) 58static void smsusb_onresponse(struct urb *urb)
58{ 59{
59 struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context; 60 struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context;
60 struct smsusb_device_t *dev = surb->dev; 61 struct smsusb_device_t *dev = surb->dev;
@@ -110,7 +111,8 @@ exit_and_resubmit:
110 smsusb_submit_urb(dev, surb); 111 smsusb_submit_urb(dev, surb);
111} 112}
112 113
113int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb) 114static int smsusb_submit_urb(struct smsusb_device_t *dev,
115 struct smsusb_urb_t *surb)
114{ 116{
115 if (!surb->cb) { 117 if (!surb->cb) {
116 surb->cb = smscore_getbuffer(dev->coredev); 118 surb->cb = smscore_getbuffer(dev->coredev);
@@ -135,7 +137,7 @@ int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb)
135 return usb_submit_urb(&surb->urb, GFP_ATOMIC); 137 return usb_submit_urb(&surb->urb, GFP_ATOMIC);
136} 138}
137 139
138void smsusb_stop_streaming(struct smsusb_device_t *dev) 140static void smsusb_stop_streaming(struct smsusb_device_t *dev)
139{ 141{
140 int i; 142 int i;
141 143
@@ -149,7 +151,7 @@ void smsusb_stop_streaming(struct smsusb_device_t *dev)
149 } 151 }
150} 152}
151 153
152int smsusb_start_streaming(struct smsusb_device_t *dev) 154static int smsusb_start_streaming(struct smsusb_device_t *dev)
153{ 155{
154 int i, rc; 156 int i, rc;
155 157
@@ -165,7 +167,7 @@ int smsusb_start_streaming(struct smsusb_device_t *dev)
165 return rc; 167 return rc;
166} 168}
167 169
168int smsusb_sendrequest(void *context, void *buffer, size_t size) 170static int smsusb_sendrequest(void *context, void *buffer, size_t size)
169{ 171{
170 struct smsusb_device_t *dev = (struct smsusb_device_t *) context; 172 struct smsusb_device_t *dev = (struct smsusb_device_t *) context;
171 int dummy; 173 int dummy;
@@ -174,7 +176,7 @@ int smsusb_sendrequest(void *context, void *buffer, size_t size)
174 buffer, size, &dummy, 1000); 176 buffer, size, &dummy, 1000);
175} 177}
176 178
177char *smsusb1_fw_lkup[] = { 179static char *smsusb1_fw_lkup[] = {
178 "dvbt_stellar_usb.inp", 180 "dvbt_stellar_usb.inp",
179 "dvbh_stellar_usb.inp", 181 "dvbh_stellar_usb.inp",
180 "tdmb_stellar_usb.inp", 182 "tdmb_stellar_usb.inp",
@@ -182,7 +184,7 @@ char *smsusb1_fw_lkup[] = {
182 "dvbt_bda_stellar_usb.inp", 184 "dvbt_bda_stellar_usb.inp",
183}; 185};
184 186
185int smsusb1_load_firmware(struct usb_device *udev, int id) 187static int smsusb1_load_firmware(struct usb_device *udev, int id)
186{ 188{
187 const struct firmware *fw; 189 const struct firmware *fw;
188 u8 *fw_buffer; 190 u8 *fw_buffer;
@@ -220,7 +222,7 @@ int smsusb1_load_firmware(struct usb_device *udev, int id)
220 return rc; 222 return rc;
221} 223}
222 224
223void smsusb1_detectmode(void *context, int *mode) 225static void smsusb1_detectmode(void *context, int *mode)
224{ 226{
225 char *product_string = 227 char *product_string =
226 ((struct smsusb_device_t *) context)->udev->product; 228 ((struct smsusb_device_t *) context)->udev->product;
@@ -242,7 +244,7 @@ void smsusb1_detectmode(void *context, int *mode)
242 sms_info("%d \"%s\"", *mode, product_string); 244 sms_info("%d \"%s\"", *mode, product_string);
243} 245}
244 246
245int smsusb1_setmode(void *context, int mode) 247static int smsusb1_setmode(void *context, int mode)
246{ 248{
247 struct SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, 249 struct SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK,
248 sizeof(struct SmsMsgHdr_ST), 0 }; 250 sizeof(struct SmsMsgHdr_ST), 0 };
@@ -255,7 +257,7 @@ int smsusb1_setmode(void *context, int mode)
255 return smsusb_sendrequest(context, &Msg, sizeof(Msg)); 257 return smsusb_sendrequest(context, &Msg, sizeof(Msg));
256} 258}
257 259
258void smsusb_term_device(struct usb_interface *intf) 260static void smsusb_term_device(struct usb_interface *intf)
259{ 261{
260 struct smsusb_device_t *dev = 262 struct smsusb_device_t *dev =
261 (struct smsusb_device_t *) usb_get_intfdata(intf); 263 (struct smsusb_device_t *) usb_get_intfdata(intf);
@@ -275,7 +277,7 @@ void smsusb_term_device(struct usb_interface *intf)
275 usb_set_intfdata(intf, NULL); 277 usb_set_intfdata(intf, NULL);
276} 278}
277 279
278int smsusb_init_device(struct usb_interface *intf, int board_id) 280static int smsusb_init_device(struct usb_interface *intf, int board_id)
279{ 281{
280 struct smsdevice_params_t params; 282 struct smsdevice_params_t params;
281 struct smsusb_device_t *dev; 283 struct smsusb_device_t *dev;
@@ -376,7 +378,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id)
376 return rc; 378 return rc;
377} 379}
378 380
379int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) 381static int smsusb_probe(struct usb_interface *intf,
382 const struct usb_device_id *id)
380{ 383{
381 struct usb_device *udev = interface_to_usbdev(intf); 384 struct usb_device *udev = interface_to_usbdev(intf);
382 char devpath[32]; 385 char devpath[32];
@@ -421,7 +424,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
421 return rc; 424 return rc;
422} 425}
423 426
424void smsusb_disconnect(struct usb_interface *intf) 427static void smsusb_disconnect(struct usb_interface *intf)
425{ 428{
426 smsusb_term_device(intf); 429 smsusb_term_device(intf);
427} 430}