* [PATCH] V4L: soc_camera: allow reading from video device if supported @ 2012-08-18 11:45 Anatolij Gustschin 2012-08-24 9:13 ` [PATCH v2] " Anatolij Gustschin 0 siblings, 1 reply; 5+ messages in thread From: Anatolij Gustschin @ 2012-08-18 11:45 UTC (permalink / raw) To: linux-media; +Cc: Guennadi Liakhovetski, Mauro Carvalho Chehab Try reading on video device. If the camera bus driver supports reading we can try it and return the result. Also add a debug line. Signed-off-by: Anatolij Gustschin <agust@denx.de> --- drivers/media/platform/soc_camera.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/media/platform/soc_camera.c b/drivers/media/platform/soc_camera.c index 10b57f8..d591a42 100644 --- a/drivers/media/platform/soc_camera.c +++ b/drivers/media/platform/soc_camera.c @@ -645,9 +645,16 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct soc_camera_device *icd = file->private_data; + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); int err = -EINVAL; - dev_err(icd->pdev, "camera device read not implemented\n"); + dev_dbg(icd->pdev, "read called, buf %p\n", buf); + + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) + err = vb2_read(&icd->vb2_vidq, buf, count, ppos, + file->f_flags & O_NONBLOCK); + else + dev_err(icd->pdev, "camera device read not implemented\n"); return err; } -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2] V4L: soc_camera: allow reading from video device if supported 2012-08-18 11:45 [PATCH] V4L: soc_camera: allow reading from video device if supported Anatolij Gustschin @ 2012-08-24 9:13 ` Anatolij Gustschin 2012-08-24 11:37 ` Guennadi Liakhovetski 2012-08-24 14:36 ` [PATCH v3] " Anatolij Gustschin 0 siblings, 2 replies; 5+ messages in thread From: Anatolij Gustschin @ 2012-08-24 9:13 UTC (permalink / raw) To: linux-media; +Cc: Guennadi Liakhovetski, Mauro Carvalho Chehab, dzu Try reading on video device. If the camera bus driver supports reading we can try it and return the result. Also add a debug line. Signed-off-by: Anatolij Gustschin <agust@denx.de> --- v2: - rebased on current staging/for_v3.7 branch drivers/media/platform/soc_camera/soc_camera.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 10b57f8..d591a42 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -645,9 +645,16 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct soc_camera_device *icd = file->private_data; + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); int err = -EINVAL; - dev_err(icd->pdev, "camera device read not implemented\n"); + dev_dbg(icd->pdev, "read called, buf %p\n", buf); + + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) + err = vb2_read(&icd->vb2_vidq, buf, count, ppos, + file->f_flags & O_NONBLOCK); + else + dev_err(icd->pdev, "camera device read not implemented\n"); return err; } -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] V4L: soc_camera: allow reading from video device if supported 2012-08-24 9:13 ` [PATCH v2] " Anatolij Gustschin @ 2012-08-24 11:37 ` Guennadi Liakhovetski 2012-08-24 11:48 ` Anatolij Gustschin 2012-08-24 14:36 ` [PATCH v3] " Anatolij Gustschin 1 sibling, 1 reply; 5+ messages in thread From: Guennadi Liakhovetski @ 2012-08-24 11:37 UTC (permalink / raw) To: Anatolij Gustschin; +Cc: linux-media, Mauro Carvalho Chehab, dzu On Fri, 24 Aug 2012, Anatolij Gustschin wrote: > Try reading on video device. If the camera bus driver supports reading > we can try it and return the result. Also add a debug line. > > Signed-off-by: Anatolij Gustschin <agust@denx.de> > --- > v2: - rebased on current staging/for_v3.7 branch > > drivers/media/platform/soc_camera/soc_camera.c | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c > index 10b57f8..d591a42 100644 > --- a/drivers/media/platform/soc_camera/soc_camera.c > +++ b/drivers/media/platform/soc_camera/soc_camera.c > @@ -645,9 +645,16 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, > size_t count, loff_t *ppos) > { > struct soc_camera_device *icd = file->private_data; > + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); > int err = -EINVAL; > > - dev_err(icd->pdev, "camera device read not implemented\n"); > + dev_dbg(icd->pdev, "read called, buf %p\n", buf); > + > + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) > + err = vb2_read(&icd->vb2_vidq, buf, count, ppos, > + file->f_flags & O_NONBLOCK); > + else > + dev_err(icd->pdev, "camera device read not implemented\n"); > > return err; How about a slightly simpler > + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); > - int err = -EINVAL; > > - dev_err(icd->pdev, "camera device read not implemented\n"); > + dev_dbg(icd->pdev, "read called, buf %p\n", buf); > > - return err; > + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) > + return vb2_read(&icd->vb2_vidq, buf, count, ppos, > + file->f_flags & O_NONBLOCK); > + > + dev_err(icd->pdev, "camera device read not implemented\n"); > + return -EINVAL; Thanks Guennadi > } > -- > 1.7.1 > --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] V4L: soc_camera: allow reading from video device if supported 2012-08-24 11:37 ` Guennadi Liakhovetski @ 2012-08-24 11:48 ` Anatolij Gustschin 0 siblings, 0 replies; 5+ messages in thread From: Anatolij Gustschin @ 2012-08-24 11:48 UTC (permalink / raw) To: Guennadi Liakhovetski; +Cc: linux-media, Mauro Carvalho Chehab, dzu Hi Guennadi, On Fri, 24 Aug 2012 13:37:20 +0200 (CEST) Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote: ... > How about a slightly simpler > > > + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); > > - int err = -EINVAL; > > > > - dev_err(icd->pdev, "camera device read not implemented\n"); > > + dev_dbg(icd->pdev, "read called, buf %p\n", buf); > > > > - return err; > > + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) > > + return vb2_read(&icd->vb2_vidq, buf, count, ppos, > > + file->f_flags & O_NONBLOCK); > > + > > + dev_err(icd->pdev, "camera device read not implemented\n"); > > + return -EINVAL; Ok, I'll simplify as suggested and resubmit. Thanks, Anatolij ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3] V4L: soc_camera: allow reading from video device if supported 2012-08-24 9:13 ` [PATCH v2] " Anatolij Gustschin 2012-08-24 11:37 ` Guennadi Liakhovetski @ 2012-08-24 14:36 ` Anatolij Gustschin 1 sibling, 0 replies; 5+ messages in thread From: Anatolij Gustschin @ 2012-08-24 14:36 UTC (permalink / raw) To: linux-media; +Cc: Guennadi Liakhovetski, Mauro Carvalho Chehab, dzu Try reading on video device. If the camera bus driver supports reading we can try it and return the result. Also add a debug line. Signed-off-by: Anatolij Gustschin <agust@denx.de> --- v3: - simplified as suggested by Guennadi v2: - rebased on current staging/for_v3.7 branch drivers/media/platform/soc_camera/soc_camera.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 10b57f8..1dd3997 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -645,11 +645,17 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct soc_camera_device *icd = file->private_data; - int err = -EINVAL; + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); + + dev_dbg(icd->pdev, "read called, buf %p\n", buf); + + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) + return vb2_read(&icd->vb2_vidq, buf, count, ppos, + file->f_flags & O_NONBLOCK); dev_err(icd->pdev, "camera device read not implemented\n"); - return err; + return -EINVAL; } static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-24 14:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-08-18 11:45 [PATCH] V4L: soc_camera: allow reading from video device if supported Anatolij Gustschin 2012-08-24 9:13 ` [PATCH v2] " Anatolij Gustschin 2012-08-24 11:37 ` Guennadi Liakhovetski 2012-08-24 11:48 ` Anatolij Gustschin 2012-08-24 14:36 ` [PATCH v3] " Anatolij Gustschin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).