aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/davinci/vpfe_capture.c13
-rw-r--r--include/media/davinci/vpfe_capture.h6
2 files changed, 8 insertions, 11 deletions
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 0379cb9f9a9c..ac6c8c6ac7d0 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -498,6 +498,7 @@ unlock:
498static int vpfe_open(struct file *file) 498static int vpfe_open(struct file *file)
499{ 499{
500 struct vpfe_device *vpfe_dev = video_drvdata(file); 500 struct vpfe_device *vpfe_dev = video_drvdata(file);
501 struct video_device *vdev = video_devdata(file);
501 struct vpfe_fh *fh; 502 struct vpfe_fh *fh;
502 503
503 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_open\n"); 504 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_open\n");
@@ -517,6 +518,7 @@ static int vpfe_open(struct file *file)
517 /* store pointer to fh in private_data member of file */ 518 /* store pointer to fh in private_data member of file */
518 file->private_data = fh; 519 file->private_data = fh;
519 fh->vpfe_dev = vpfe_dev; 520 fh->vpfe_dev = vpfe_dev;
521 v4l2_fh_init(&fh->fh, vdev);
520 mutex_lock(&vpfe_dev->lock); 522 mutex_lock(&vpfe_dev->lock);
521 /* If decoder is not initialized. initialize it */ 523 /* If decoder is not initialized. initialize it */
522 if (!vpfe_dev->initialized) { 524 if (!vpfe_dev->initialized) {
@@ -529,9 +531,7 @@ static int vpfe_open(struct file *file)
529 vpfe_dev->usrs++; 531 vpfe_dev->usrs++;
530 /* Set io_allowed member to false */ 532 /* Set io_allowed member to false */
531 fh->io_allowed = 0; 533 fh->io_allowed = 0;
532 /* Initialize priority of this instance to default priority */ 534 v4l2_fh_add(&fh->fh);
533 fh->prio = V4L2_PRIORITY_UNSET;
534 v4l2_prio_open(&vpfe_dev->prio, &fh->prio);
535 mutex_unlock(&vpfe_dev->lock); 535 mutex_unlock(&vpfe_dev->lock);
536 return 0; 536 return 0;
537} 537}
@@ -740,8 +740,8 @@ static int vpfe_release(struct file *file)
740 740
741 /* Decrement device usrs counter */ 741 /* Decrement device usrs counter */
742 vpfe_dev->usrs--; 742 vpfe_dev->usrs--;
743 /* Close the priority */ 743 v4l2_fh_del(&fh->fh);
744 v4l2_prio_close(&vpfe_dev->prio, fh->prio); 744 v4l2_fh_exit(&fh->fh);
745 /* If this is the last file handle */ 745 /* If this is the last file handle */
746 if (!vpfe_dev->usrs) { 746 if (!vpfe_dev->usrs) {
747 vpfe_dev->initialized = 0; 747 vpfe_dev->initialized = 0;
@@ -1910,14 +1910,13 @@ static int vpfe_probe(struct platform_device *pdev)
1910 /* Initialize field of the device objects */ 1910 /* Initialize field of the device objects */
1911 vpfe_dev->numbuffers = config_params.numbuffers; 1911 vpfe_dev->numbuffers = config_params.numbuffers;
1912 1912
1913 /* Initialize prio member of device object */
1914 v4l2_prio_init(&vpfe_dev->prio);
1915 /* register video device */ 1913 /* register video device */
1916 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, 1914 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1917 "trying to register vpfe device.\n"); 1915 "trying to register vpfe device.\n");
1918 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, 1916 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1919 "video_dev=%x\n", (int)&vpfe_dev->video_dev); 1917 "video_dev=%x\n", (int)&vpfe_dev->video_dev);
1920 vpfe_dev->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1918 vpfe_dev->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1919 set_bit(V4L2_FL_USE_FH_PRIO, &vpfe_dev->video_dev->flags);
1921 ret = video_register_device(vpfe_dev->video_dev, 1920 ret = video_register_device(vpfe_dev->video_dev,
1922 VFL_TYPE_GRABBER, -1); 1921 VFL_TYPE_GRABBER, -1);
1923 1922
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index cc973ed845a7..288772e6900a 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -26,6 +26,7 @@
26#include <linux/videodev2.h> 26#include <linux/videodev2.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <media/v4l2-fh.h>
29#include <media/v4l2-ioctl.h> 30#include <media/v4l2-ioctl.h>
30#include <media/v4l2-device.h> 31#include <media/v4l2-device.h>
31#include <media/videobuf-dma-contig.h> 32#include <media/videobuf-dma-contig.h>
@@ -110,8 +111,6 @@ struct vpfe_device {
110 struct v4l2_device v4l2_dev; 111 struct v4l2_device v4l2_dev;
111 /* parent device */ 112 /* parent device */
112 struct device *pdev; 113 struct device *pdev;
113 /* Used to keep track of state of the priority */
114 struct v4l2_prio_state prio;
115 /* number of open instances of the channel */ 114 /* number of open instances of the channel */
116 u32 usrs; 115 u32 usrs;
117 /* Indicates id of the field which is being displayed */ 116 /* Indicates id of the field which is being displayed */
@@ -174,11 +173,10 @@ struct vpfe_device {
174 173
175/* File handle structure */ 174/* File handle structure */
176struct vpfe_fh { 175struct vpfe_fh {
176 struct v4l2_fh fh;
177 struct vpfe_device *vpfe_dev; 177 struct vpfe_device *vpfe_dev;
178 /* Indicates whether this file handle is doing IO */ 178 /* Indicates whether this file handle is doing IO */
179 u8 io_allowed; 179 u8 io_allowed;
180 /* Used to keep track priority of this instance */
181 enum v4l2_priority prio;
182}; 180};
183 181
184struct vpfe_config_params { 182struct vpfe_config_params {