diff options
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r-- | drivers/media/video/cx18/cx18-driver.c | 28 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-driver.h | 9 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-mailbox.c | 40 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-mailbox.h | 2 |
4 files changed, 41 insertions, 38 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 49b1c3d7b1a8..79750208e042 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -562,16 +562,18 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) | |||
562 | mutex_init(&cx->epu2apu_mb_lock); | 562 | mutex_init(&cx->epu2apu_mb_lock); |
563 | mutex_init(&cx->epu2cpu_mb_lock); | 563 | mutex_init(&cx->epu2cpu_mb_lock); |
564 | 564 | ||
565 | cx->work_queue = create_singlethread_workqueue(cx->v4l2_dev.name); | 565 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", |
566 | if (cx->work_queue == NULL) { | 566 | cx->v4l2_dev.name); |
567 | CX18_ERR("Unable to create work hander thread\n"); | 567 | cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name); |
568 | if (cx->in_work_queue == NULL) { | ||
569 | CX18_ERR("Unable to create incoming mailbox handler thread\n"); | ||
568 | return -ENOMEM; | 570 | return -ENOMEM; |
569 | } | 571 | } |
570 | 572 | ||
571 | for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) { | 573 | for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) { |
572 | cx->epu_work_order[i].cx = cx; | 574 | cx->in_work_order[i].cx = cx; |
573 | cx->epu_work_order[i].str = cx->epu_debug_str; | 575 | cx->in_work_order[i].str = cx->epu_debug_str; |
574 | INIT_WORK(&cx->epu_work_order[i].work, cx18_epu_work_handler); | 576 | INIT_WORK(&cx->in_work_order[i].work, cx18_in_work_handler); |
575 | } | 577 | } |
576 | 578 | ||
577 | /* start counting open_id at 1 */ | 579 | /* start counting open_id at 1 */ |
@@ -944,7 +946,7 @@ free_map: | |||
944 | free_mem: | 946 | free_mem: |
945 | release_mem_region(cx->base_addr, CX18_MEM_SIZE); | 947 | release_mem_region(cx->base_addr, CX18_MEM_SIZE); |
946 | free_workqueue: | 948 | free_workqueue: |
947 | destroy_workqueue(cx->work_queue); | 949 | destroy_workqueue(cx->in_work_queue); |
948 | err: | 950 | err: |
949 | if (retval == 0) | 951 | if (retval == 0) |
950 | retval = -ENODEV; | 952 | retval = -ENODEV; |
@@ -1053,11 +1055,11 @@ int cx18_init_on_first_open(struct cx18 *cx) | |||
1053 | return 0; | 1055 | return 0; |
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | static void cx18_cancel_epu_work_orders(struct cx18 *cx) | 1058 | static void cx18_cancel_in_work_orders(struct cx18 *cx) |
1057 | { | 1059 | { |
1058 | int i; | 1060 | int i; |
1059 | for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) | 1061 | for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) |
1060 | cancel_work_sync(&cx->epu_work_order[i].work); | 1062 | cancel_work_sync(&cx->in_work_order[i].work); |
1061 | } | 1063 | } |
1062 | 1064 | ||
1063 | static void cx18_remove(struct pci_dev *pci_dev) | 1065 | static void cx18_remove(struct pci_dev *pci_dev) |
@@ -1079,9 +1081,9 @@ static void cx18_remove(struct pci_dev *pci_dev) | |||
1079 | 1081 | ||
1080 | cx18_halt_firmware(cx); | 1082 | cx18_halt_firmware(cx); |
1081 | 1083 | ||
1082 | cx18_cancel_epu_work_orders(cx); | 1084 | cx18_cancel_in_work_orders(cx); |
1083 | 1085 | ||
1084 | destroy_workqueue(cx->work_queue); | 1086 | destroy_workqueue(cx->in_work_queue); |
1085 | 1087 | ||
1086 | cx18_streams_cleanup(cx, 1); | 1088 | cx18_streams_cleanup(cx, 1); |
1087 | 1089 | ||
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index ece4f281ef42..e6f42d0cb2b3 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -305,7 +305,7 @@ struct cx18_scb; /* forward reference */ | |||
305 | 305 | ||
306 | 306 | ||
307 | #define CX18_MAX_MDL_ACKS 2 | 307 | #define CX18_MAX_MDL_ACKS 2 |
308 | #define CX18_MAX_EPU_WORK_ORDERS (CX18_MAX_FW_MDLS_PER_STREAM + 7) | 308 | #define CX18_MAX_IN_WORK_ORDERS (CX18_MAX_FW_MDLS_PER_STREAM + 7) |
309 | /* CPU_DE_RELEASE_MDL can burst CX18_MAX_FW_MDLS_PER_STREAM orders in a group */ | 309 | /* CPU_DE_RELEASE_MDL can burst CX18_MAX_FW_MDLS_PER_STREAM orders in a group */ |
310 | 310 | ||
311 | #define CX18_F_EWO_MB_STALE_UPON_RECEIPT 0x1 | 311 | #define CX18_F_EWO_MB_STALE_UPON_RECEIPT 0x1 |
@@ -313,7 +313,7 @@ struct cx18_scb; /* forward reference */ | |||
313 | #define CX18_F_EWO_MB_STALE \ | 313 | #define CX18_F_EWO_MB_STALE \ |
314 | (CX18_F_EWO_MB_STALE_UPON_RECEIPT | CX18_F_EWO_MB_STALE_WHILE_PROC) | 314 | (CX18_F_EWO_MB_STALE_UPON_RECEIPT | CX18_F_EWO_MB_STALE_WHILE_PROC) |
315 | 315 | ||
316 | struct cx18_epu_work_order { | 316 | struct cx18_in_work_order { |
317 | struct work_struct work; | 317 | struct work_struct work; |
318 | atomic_t pending; | 318 | atomic_t pending; |
319 | struct cx18 *cx; | 319 | struct cx18 *cx; |
@@ -568,8 +568,9 @@ struct cx18 { | |||
568 | u32 sw2_irq_mask; | 568 | u32 sw2_irq_mask; |
569 | u32 hw2_irq_mask; | 569 | u32 hw2_irq_mask; |
570 | 570 | ||
571 | struct workqueue_struct *work_queue; | 571 | struct workqueue_struct *in_work_queue; |
572 | struct cx18_epu_work_order epu_work_order[CX18_MAX_EPU_WORK_ORDERS]; | 572 | char in_workq_name[11]; /* "cx18-NN-in" */ |
573 | struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS]; | ||
573 | char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ | 574 | char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ |
574 | 575 | ||
575 | /* i2c */ | 576 | /* i2c */ |
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index 2226e5791e99..2a4d4356d1bc 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c | |||
@@ -131,7 +131,7 @@ static void dump_mb(struct cx18 *cx, struct cx18_mailbox *mb, char *name) | |||
131 | * Functions that run in a work_queue work handling context | 131 | * Functions that run in a work_queue work handling context |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static void epu_dma_done(struct cx18 *cx, struct cx18_epu_work_order *order) | 134 | static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order) |
135 | { | 135 | { |
136 | u32 handle, mdl_ack_count, id; | 136 | u32 handle, mdl_ack_count, id; |
137 | struct cx18_mailbox *mb; | 137 | struct cx18_mailbox *mb; |
@@ -213,7 +213,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
213 | wake_up(&s->waitq); | 213 | wake_up(&s->waitq); |
214 | } | 214 | } |
215 | 215 | ||
216 | static void epu_debug(struct cx18 *cx, struct cx18_epu_work_order *order) | 216 | static void epu_debug(struct cx18 *cx, struct cx18_in_work_order *order) |
217 | { | 217 | { |
218 | char *p; | 218 | char *p; |
219 | char *str = order->str; | 219 | char *str = order->str; |
@@ -224,7 +224,7 @@ static void epu_debug(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
224 | CX18_INFO("FW version: %s\n", p - 1); | 224 | CX18_INFO("FW version: %s\n", p - 1); |
225 | } | 225 | } |
226 | 226 | ||
227 | static void epu_cmd(struct cx18 *cx, struct cx18_epu_work_order *order) | 227 | static void epu_cmd(struct cx18 *cx, struct cx18_in_work_order *order) |
228 | { | 228 | { |
229 | switch (order->rpu) { | 229 | switch (order->rpu) { |
230 | case CPU: | 230 | case CPU: |
@@ -253,18 +253,18 @@ static void epu_cmd(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
253 | } | 253 | } |
254 | 254 | ||
255 | static | 255 | static |
256 | void free_epu_work_order(struct cx18 *cx, struct cx18_epu_work_order *order) | 256 | void free_in_work_order(struct cx18 *cx, struct cx18_in_work_order *order) |
257 | { | 257 | { |
258 | atomic_set(&order->pending, 0); | 258 | atomic_set(&order->pending, 0); |
259 | } | 259 | } |
260 | 260 | ||
261 | void cx18_epu_work_handler(struct work_struct *work) | 261 | void cx18_in_work_handler(struct work_struct *work) |
262 | { | 262 | { |
263 | struct cx18_epu_work_order *order = | 263 | struct cx18_in_work_order *order = |
264 | container_of(work, struct cx18_epu_work_order, work); | 264 | container_of(work, struct cx18_in_work_order, work); |
265 | struct cx18 *cx = order->cx; | 265 | struct cx18 *cx = order->cx; |
266 | epu_cmd(cx, order); | 266 | epu_cmd(cx, order); |
267 | free_epu_work_order(cx, order); | 267 | free_in_work_order(cx, order); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
@@ -272,7 +272,7 @@ void cx18_epu_work_handler(struct work_struct *work) | |||
272 | * Functions that run in an interrupt handling context | 272 | * Functions that run in an interrupt handling context |
273 | */ | 273 | */ |
274 | 274 | ||
275 | static void mb_ack_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | 275 | static void mb_ack_irq(struct cx18 *cx, struct cx18_in_work_order *order) |
276 | { | 276 | { |
277 | struct cx18_mailbox __iomem *ack_mb; | 277 | struct cx18_mailbox __iomem *ack_mb; |
278 | u32 ack_irq, req; | 278 | u32 ack_irq, req; |
@@ -308,7 +308,7 @@ static void mb_ack_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
308 | return; | 308 | return; |
309 | } | 309 | } |
310 | 310 | ||
311 | static int epu_dma_done_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | 311 | static int epu_dma_done_irq(struct cx18 *cx, struct cx18_in_work_order *order) |
312 | { | 312 | { |
313 | u32 handle, mdl_ack_offset, mdl_ack_count; | 313 | u32 handle, mdl_ack_offset, mdl_ack_count; |
314 | struct cx18_mailbox *mb; | 314 | struct cx18_mailbox *mb; |
@@ -334,7 +334,7 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
334 | } | 334 | } |
335 | 335 | ||
336 | static | 336 | static |
337 | int epu_debug_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | 337 | int epu_debug_irq(struct cx18 *cx, struct cx18_in_work_order *order) |
338 | { | 338 | { |
339 | u32 str_offset; | 339 | u32 str_offset; |
340 | char *str = order->str; | 340 | char *str = order->str; |
@@ -355,7 +355,7 @@ int epu_debug_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
355 | } | 355 | } |
356 | 356 | ||
357 | static inline | 357 | static inline |
358 | int epu_cmd_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | 358 | int epu_cmd_irq(struct cx18 *cx, struct cx18_in_work_order *order) |
359 | { | 359 | { |
360 | int ret = -1; | 360 | int ret = -1; |
361 | 361 | ||
@@ -387,12 +387,12 @@ int epu_cmd_irq(struct cx18 *cx, struct cx18_epu_work_order *order) | |||
387 | } | 387 | } |
388 | 388 | ||
389 | static inline | 389 | static inline |
390 | struct cx18_epu_work_order *alloc_epu_work_order_irq(struct cx18 *cx) | 390 | struct cx18_in_work_order *alloc_in_work_order_irq(struct cx18 *cx) |
391 | { | 391 | { |
392 | int i; | 392 | int i; |
393 | struct cx18_epu_work_order *order = NULL; | 393 | struct cx18_in_work_order *order = NULL; |
394 | 394 | ||
395 | for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) { | 395 | for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) { |
396 | /* | 396 | /* |
397 | * We only need "pending" atomic to inspect its contents, | 397 | * We only need "pending" atomic to inspect its contents, |
398 | * and need not do a check and set because: | 398 | * and need not do a check and set because: |
@@ -401,8 +401,8 @@ struct cx18_epu_work_order *alloc_epu_work_order_irq(struct cx18 *cx) | |||
401 | * 2. "pending" is only set here, and we're serialized because | 401 | * 2. "pending" is only set here, and we're serialized because |
402 | * we're called in an IRQ handler context. | 402 | * we're called in an IRQ handler context. |
403 | */ | 403 | */ |
404 | if (atomic_read(&cx->epu_work_order[i].pending) == 0) { | 404 | if (atomic_read(&cx->in_work_order[i].pending) == 0) { |
405 | order = &cx->epu_work_order[i]; | 405 | order = &cx->in_work_order[i]; |
406 | atomic_set(&order->pending, 1); | 406 | atomic_set(&order->pending, 1); |
407 | break; | 407 | break; |
408 | } | 408 | } |
@@ -414,7 +414,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) | |||
414 | { | 414 | { |
415 | struct cx18_mailbox __iomem *mb; | 415 | struct cx18_mailbox __iomem *mb; |
416 | struct cx18_mailbox *order_mb; | 416 | struct cx18_mailbox *order_mb; |
417 | struct cx18_epu_work_order *order; | 417 | struct cx18_in_work_order *order; |
418 | int submit; | 418 | int submit; |
419 | 419 | ||
420 | switch (rpu) { | 420 | switch (rpu) { |
@@ -428,7 +428,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) | |||
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | 430 | ||
431 | order = alloc_epu_work_order_irq(cx); | 431 | order = alloc_in_work_order_irq(cx); |
432 | if (order == NULL) { | 432 | if (order == NULL) { |
433 | CX18_WARN("Unable to find blank work order form to schedule " | 433 | CX18_WARN("Unable to find blank work order form to schedule " |
434 | "incoming mailbox command processing\n"); | 434 | "incoming mailbox command processing\n"); |
@@ -461,7 +461,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) | |||
461 | */ | 461 | */ |
462 | submit = epu_cmd_irq(cx, order); | 462 | submit = epu_cmd_irq(cx, order); |
463 | if (submit > 0) { | 463 | if (submit > 0) { |
464 | queue_work(cx->work_queue, &order->work); | 464 | queue_work(cx->in_work_queue, &order->work); |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
diff --git a/drivers/media/video/cx18/cx18-mailbox.h b/drivers/media/video/cx18/cx18-mailbox.h index ce2b6686aa00..e23aaac5b280 100644 --- a/drivers/media/video/cx18/cx18-mailbox.h +++ b/drivers/media/video/cx18/cx18-mailbox.h | |||
@@ -95,6 +95,6 @@ int cx18_api_func(void *priv, u32 cmd, int in, int out, | |||
95 | 95 | ||
96 | void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu); | 96 | void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu); |
97 | 97 | ||
98 | void cx18_epu_work_handler(struct work_struct *work); | 98 | void cx18_in_work_handler(struct work_struct *work); |
99 | 99 | ||
100 | #endif | 100 | #endif |