diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-03-10 15:59:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:44:28 -0400 |
commit | d46c17d7aa12e30b612acae35535fcd64f2db3d6 (patch) | |
tree | bf26772f7ae285baa938f77eae98d0b337f9af5f /drivers/media | |
parent | a542fe47fe3f758e47d71640e7ca328c032a13e1 (diff) |
V4L/DVB (5410): Add VIDIOC_G/S_PRIORITY support to ivtv.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.h | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fileops.c | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 37 |
3 files changed, 42 insertions, 0 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 1b2f7a6d311e..ce28923a5c9c 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -502,6 +502,7 @@ struct ivtv_stream { | |||
502 | struct ivtv_open_id { | 502 | struct ivtv_open_id { |
503 | u32 open_id; | 503 | u32 open_id; |
504 | int type; | 504 | int type; |
505 | enum v4l2_priority prio; | ||
505 | struct ivtv *itv; | 506 | struct ivtv *itv; |
506 | }; | 507 | }; |
507 | 508 | ||
@@ -732,6 +733,7 @@ struct ivtv { | |||
732 | u32 base_addr; | 733 | u32 base_addr; |
733 | u32 irqmask; | 734 | u32 irqmask; |
734 | 735 | ||
736 | struct v4l2_prio_state prio; | ||
735 | struct workqueue_struct *irq_work_queues; | 737 | struct workqueue_struct *irq_work_queues; |
736 | struct work_struct irq_work_queue; | 738 | struct work_struct irq_work_queue; |
737 | struct timer_list dma_timer; /* Timer used to catch unfinished DMAs */ | 739 | struct timer_list dma_timer; /* Timer used to catch unfinished DMAs */ |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 2f38bb14ace9..1637097ddec7 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -766,6 +766,8 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) | |||
766 | 766 | ||
767 | IVTV_DEBUG_IOCTL("close() of %s\n", s->name); | 767 | IVTV_DEBUG_IOCTL("close() of %s\n", s->name); |
768 | 768 | ||
769 | v4l2_prio_close(&itv->prio, &id->prio); | ||
770 | |||
769 | /* Easy case first: this stream was never claimed by us */ | 771 | /* Easy case first: this stream was never claimed by us */ |
770 | if (s->id != id->open_id) { | 772 | if (s->id != id->open_id) { |
771 | kfree(id); | 773 | kfree(id); |
@@ -849,6 +851,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) | |||
849 | } | 851 | } |
850 | item->itv = itv; | 852 | item->itv = itv; |
851 | item->type = y; | 853 | item->type = y; |
854 | v4l2_prio_open(&itv->prio, &item->prio); | ||
852 | 855 | ||
853 | item->open_id = itv->open_id++; | 856 | item->open_id = itv->open_id++; |
854 | filp->private_data = item; | 857 | filp->private_data = item; |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 0e8b639de179..6f80941e49ec 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -703,6 +703,21 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
703 | if (filp) id = (struct ivtv_open_id *)filp->private_data; | 703 | if (filp) id = (struct ivtv_open_id *)filp->private_data; |
704 | 704 | ||
705 | switch (cmd) { | 705 | switch (cmd) { |
706 | case VIDIOC_G_PRIORITY: | ||
707 | { | ||
708 | enum v4l2_priority *p = arg; | ||
709 | |||
710 | *p = v4l2_prio_max(&itv->prio); | ||
711 | break; | ||
712 | } | ||
713 | |||
714 | case VIDIOC_S_PRIORITY: | ||
715 | { | ||
716 | enum v4l2_priority *prio = arg; | ||
717 | |||
718 | return v4l2_prio_change(&itv->prio, &id->prio, *prio); | ||
719 | } | ||
720 | |||
706 | case VIDIOC_QUERYCAP:{ | 721 | case VIDIOC_QUERYCAP:{ |
707 | struct v4l2_capability *vcap = arg; | 722 | struct v4l2_capability *vcap = arg; |
708 | 723 | ||
@@ -1441,9 +1456,29 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp, | |||
1441 | { | 1456 | { |
1442 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | 1457 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; |
1443 | struct ivtv *itv = id->itv; | 1458 | struct ivtv *itv = id->itv; |
1459 | int ret; | ||
1444 | 1460 | ||
1445 | IVTV_DEBUG_IOCTL("v4l2 ioctl 0x%08x\n", cmd); | 1461 | IVTV_DEBUG_IOCTL("v4l2 ioctl 0x%08x\n", cmd); |
1446 | 1462 | ||
1463 | /* check priority */ | ||
1464 | switch (cmd) { | ||
1465 | case VIDIOC_S_CTRL: | ||
1466 | case VIDIOC_S_STD: | ||
1467 | case VIDIOC_S_INPUT: | ||
1468 | case VIDIOC_S_OUTPUT: | ||
1469 | case VIDIOC_S_TUNER: | ||
1470 | case VIDIOC_S_FREQUENCY: | ||
1471 | case VIDIOC_S_FMT: | ||
1472 | case VIDIOC_S_CROP: | ||
1473 | case VIDIOC_S_AUDIO: | ||
1474 | case VIDIOC_S_AUDOUT: | ||
1475 | case VIDIOC_S_EXT_CTRLS: | ||
1476 | case VIDIOC_S_FBUF: | ||
1477 | ret = v4l2_prio_check(&itv->prio, &id->prio); | ||
1478 | if (ret) | ||
1479 | return ret; | ||
1480 | } | ||
1481 | |||
1447 | switch (cmd) { | 1482 | switch (cmd) { |
1448 | case VIDIOC_DBG_G_REGISTER: | 1483 | case VIDIOC_DBG_G_REGISTER: |
1449 | case VIDIOC_DBG_S_REGISTER: | 1484 | case VIDIOC_DBG_S_REGISTER: |
@@ -1452,6 +1487,8 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp, | |||
1452 | case VIDIOC_INT_RESET: | 1487 | case VIDIOC_INT_RESET: |
1453 | return ivtv_internal_ioctls(filp, cmd, arg); | 1488 | return ivtv_internal_ioctls(filp, cmd, arg); |
1454 | 1489 | ||
1490 | case VIDIOC_G_PRIORITY: | ||
1491 | case VIDIOC_S_PRIORITY: | ||
1455 | case VIDIOC_QUERYCAP: | 1492 | case VIDIOC_QUERYCAP: |
1456 | case VIDIOC_ENUMINPUT: | 1493 | case VIDIOC_ENUMINPUT: |
1457 | case VIDIOC_G_INPUT: | 1494 | case VIDIOC_G_INPUT: |