aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2014-03-22 06:57:59 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-04-16 17:23:45 -0400
commit3d7543b9196cb0de8e65750f1da9ad155c22e12f (patch)
tree36455d618d2c47ad628f5737092ed6af2efce043
parentc8204930b21ea4d0a5504b40a73479ae318958dd (diff)
[media] media: davinci: vpbe: use v4l2_fh for priority handling
This patch migrates the vpbe driver to use v4l2_fh for priority handling. This also fixes v4l2-compliance test. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/davinci/vpbe_display.c39
-rw-r--r--include/media/davinci/vpbe_display.h6
2 files changed, 9 insertions, 36 deletions
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index 656708252962..a9ad949d0c19 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -680,29 +680,6 @@ static int vpbe_try_format(struct vpbe_display *disp_dev,
680 return 0; 680 return 0;
681} 681}
682 682
683static int vpbe_display_g_priority(struct file *file, void *priv,
684 enum v4l2_priority *p)
685{
686 struct vpbe_fh *fh = file->private_data;
687 struct vpbe_layer *layer = fh->layer;
688
689 *p = v4l2_prio_max(&layer->prio);
690
691 return 0;
692}
693
694static int vpbe_display_s_priority(struct file *file, void *priv,
695 enum v4l2_priority p)
696{
697 struct vpbe_fh *fh = file->private_data;
698 struct vpbe_layer *layer = fh->layer;
699 int ret;
700
701 ret = v4l2_prio_change(&layer->prio, &fh->prio, p);
702
703 return ret;
704}
705
706static int vpbe_display_querycap(struct file *file, void *priv, 683static int vpbe_display_querycap(struct file *file, void *priv,
707 struct v4l2_capability *cap) 684 struct v4l2_capability *cap)
708{ 685{
@@ -1492,6 +1469,7 @@ static int vpbe_display_open(struct file *file)
1492{ 1469{
1493 struct vpbe_fh *fh = NULL; 1470 struct vpbe_fh *fh = NULL;
1494 struct vpbe_layer *layer = video_drvdata(file); 1471 struct vpbe_layer *layer = video_drvdata(file);
1472 struct video_device *vdev = video_devdata(file);
1495 struct vpbe_display *disp_dev = layer->disp_dev; 1473 struct vpbe_display *disp_dev = layer->disp_dev;
1496 struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; 1474 struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev;
1497 struct osd_state *osd_device = disp_dev->osd_device; 1475 struct osd_state *osd_device = disp_dev->osd_device;
@@ -1504,6 +1482,7 @@ static int vpbe_display_open(struct file *file)
1504 "unable to allocate memory for file handle object\n"); 1482 "unable to allocate memory for file handle object\n");
1505 return -ENOMEM; 1483 return -ENOMEM;
1506 } 1484 }
1485 v4l2_fh_init(&fh->fh, vdev);
1507 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, 1486 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev,
1508 "vpbe display open plane = %d\n", 1487 "vpbe display open plane = %d\n",
1509 layer->device_id); 1488 layer->device_id);
@@ -1532,9 +1511,7 @@ static int vpbe_display_open(struct file *file)
1532 layer->usrs++; 1511 layer->usrs++;
1533 /* Set io_allowed member to false */ 1512 /* Set io_allowed member to false */
1534 fh->io_allowed = 0; 1513 fh->io_allowed = 0;
1535 /* Initialize priority of this instance to default priority */ 1514 v4l2_fh_add(&fh->fh);
1536 fh->prio = V4L2_PRIORITY_UNSET;
1537 v4l2_prio_open(&layer->prio, &fh->prio);
1538 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, 1515 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev,
1539 "vpbe display device opened successfully\n"); 1516 "vpbe display device opened successfully\n");
1540 return 0; 1517 return 0;
@@ -1589,8 +1566,9 @@ static int vpbe_display_release(struct file *file)
1589 osd_device->ops.release_layer(osd_device, 1566 osd_device->ops.release_layer(osd_device,
1590 layer->layer_info.id); 1567 layer->layer_info.id);
1591 } 1568 }
1592 /* Close the priority */ 1569
1593 v4l2_prio_close(&layer->prio, fh->prio); 1570 v4l2_fh_del(&fh->fh);
1571 v4l2_fh_exit(&fh->fh);
1594 file->private_data = NULL; 1572 file->private_data = NULL;
1595 mutex_unlock(&layer->opslock); 1573 mutex_unlock(&layer->opslock);
1596 1574
@@ -1618,8 +1596,6 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
1618 .vidioc_cropcap = vpbe_display_cropcap, 1596 .vidioc_cropcap = vpbe_display_cropcap,
1619 .vidioc_g_crop = vpbe_display_g_crop, 1597 .vidioc_g_crop = vpbe_display_g_crop,
1620 .vidioc_s_crop = vpbe_display_s_crop, 1598 .vidioc_s_crop = vpbe_display_s_crop,
1621 .vidioc_g_priority = vpbe_display_g_priority,
1622 .vidioc_s_priority = vpbe_display_s_priority,
1623 .vidioc_s_std = vpbe_display_s_std, 1599 .vidioc_s_std = vpbe_display_s_std,
1624 .vidioc_g_std = vpbe_display_g_std, 1600 .vidioc_g_std = vpbe_display_g_std,
1625 .vidioc_enum_output = vpbe_display_enum_output, 1601 .vidioc_enum_output = vpbe_display_enum_output,
@@ -1699,8 +1675,6 @@ static int init_vpbe_layer(int i, struct vpbe_display *disp_dev,
1699 vpbe_display_layer->layer_info.id = 1675 vpbe_display_layer->layer_info.id =
1700 ((i == VPBE_DISPLAY_DEVICE_0) ? WIN_VID0 : WIN_VID1); 1676 ((i == VPBE_DISPLAY_DEVICE_0) ? WIN_VID0 : WIN_VID1);
1701 1677
1702 /* Initialize prio member of layer object */
1703 v4l2_prio_init(&vpbe_display_layer->prio);
1704 1678
1705 return 0; 1679 return 0;
1706} 1680}
@@ -1727,6 +1701,7 @@ static int register_device(struct vpbe_layer *vpbe_display_layer,
1727 vpbe_display_layer->disp_dev = disp_dev; 1701 vpbe_display_layer->disp_dev = disp_dev;
1728 /* set the driver data in platform device */ 1702 /* set the driver data in platform device */
1729 platform_set_drvdata(pdev, disp_dev); 1703 platform_set_drvdata(pdev, disp_dev);
1704 set_bit(V4L2_FL_USE_FH_PRIO, &vpbe_display_layer->video_dev.flags);
1730 video_set_drvdata(&vpbe_display_layer->video_dev, 1705 video_set_drvdata(&vpbe_display_layer->video_dev,
1731 vpbe_display_layer); 1706 vpbe_display_layer);
1732 1707
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h
index 8dffffedbb59..637749a91432 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -16,6 +16,7 @@
16/* Header files */ 16/* Header files */
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/v4l2-common.h> 18#include <media/v4l2-common.h>
19#include <media/v4l2-fh.h>
19#include <media/videobuf2-dma-contig.h> 20#include <media/videobuf2-dma-contig.h>
20#include <media/davinci/vpbe_types.h> 21#include <media/davinci/vpbe_types.h>
21#include <media/davinci/vpbe_osd.h> 22#include <media/davinci/vpbe_osd.h>
@@ -94,8 +95,6 @@ struct vpbe_layer {
94 * has selected 95 * has selected
95 */ 96 */
96 enum v4l2_memory memory; 97 enum v4l2_memory memory;
97 /* Used to keep track of state of the priority */
98 struct v4l2_prio_state prio;
99 /* Used to store pixel format */ 98 /* Used to store pixel format */
100 struct v4l2_pix_format pix_fmt; 99 struct v4l2_pix_format pix_fmt;
101 enum v4l2_field buf_field; 100 enum v4l2_field buf_field;
@@ -134,14 +133,13 @@ struct vpbe_display {
134 133
135/* File handle structure */ 134/* File handle structure */
136struct vpbe_fh { 135struct vpbe_fh {
136 struct v4l2_fh fh;
137 /* vpbe device structure */ 137 /* vpbe device structure */
138 struct vpbe_display *disp_dev; 138 struct vpbe_display *disp_dev;
139 /* pointer to layer object for opened device */ 139 /* pointer to layer object for opened device */
140 struct vpbe_layer *layer; 140 struct vpbe_layer *layer;
141 /* Indicates whether this file handle is doing IO */ 141 /* Indicates whether this file handle is doing IO */
142 unsigned char io_allowed; 142 unsigned char io_allowed;
143 /* Used to keep track priority of this instance */
144 enum v4l2_priority prio;
145}; 143};
146 144
147struct buf_config_params { 145struct buf_config_params {