Re: [RFCv4 PATCH 7/8] vb2: return ENODATA in start_streaming in case of too few buffers.
As Guennadi mentioned in his review, ENODATA will be replaced by ENOBUFS, which is more appropriate. Prabhakar, Kamil, Tomasz, are you OK with this patch provided s/ENODATA/ENOBUFS/ ? Regards, Hans On 12/09/2013 02:43 PM, Hans Verkuil wrote: > From: Hans Verkuil > > This works together with the retry_start_streaming mechanism to allow > userspace > to start streaming even if not all required buffers have been queued. > > Signed-off-by: Hans Verkuil > Cc: Lad, Prabhakar > Cc: Tomasz Stanislawski > Cc: Kyungmin Park > Cc: Kamil Debski > Cc: Guennadi Liakhovetski > --- > drivers/media/platform/davinci/vpbe_display.c | 2 +- > drivers/media/platform/davinci/vpif_capture.c | 2 +- > drivers/media/platform/davinci/vpif_display.c | 2 +- > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 2 +- > drivers/media/platform/s5p-tv/mixer_video.c | 2 +- > drivers/media/platform/soc_camera/mx2_camera.c | 2 +- > drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 ++ > 7 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/davinci/vpbe_display.c > b/drivers/media/platform/davinci/vpbe_display.c > index eac472b..53be7fc 100644 > --- a/drivers/media/platform/davinci/vpbe_display.c > +++ b/drivers/media/platform/davinci/vpbe_display.c > @@ -347,7 +347,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, > unsigned int count) > /* If buffer queue is empty, return error */ > if (list_empty(&layer->dma_queue)) { > v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n"); > - return -EINVAL; > + return -ENODATA; > } > /* Get the next frame from the buffer queue */ > layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next, > diff --git a/drivers/media/platform/davinci/vpif_capture.c > b/drivers/media/platform/davinci/vpif_capture.c > index 52ac5e6..4b04a27 100644 > --- a/drivers/media/platform/davinci/vpif_capture.c > +++ b/drivers/media/platform/davinci/vpif_capture.c > @@ -277,7 +277,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, > unsigned int count) > if (list_empty(&common->dma_queue)) { > spin_unlock_irqrestore(&common->irqlock, flags); > vpif_dbg(1, debug, "buffer queue is empty\n"); > - return -EIO; > + return -ENODATA; > } > > /* Get the next frame from the buffer queue */ > diff --git a/drivers/media/platform/davinci/vpif_display.c > b/drivers/media/platform/davinci/vpif_display.c > index c31bcf1..c5070dc 100644 > --- a/drivers/media/platform/davinci/vpif_display.c > +++ b/drivers/media/platform/davinci/vpif_display.c > @@ -239,7 +239,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, > unsigned int count) > if (list_empty(&common->dma_queue)) { > spin_unlock_irqrestore(&common->irqlock, flags); > vpif_err("buffer queue is empty\n"); > - return -EIO; > + return -ENODATA; > } > > /* Get the next frame from the buffer queue */ > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > index 4ff3b6c..3bdfe85 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > @@ -1863,7 +1863,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, > unsigned int count) > if (ctx->src_bufs_cnt < ctx->pb_count) { > mfc_err("Need minimum %d OUTPUT buffers\n", > ctx->pb_count); > - return -EINVAL; > + return -ENODATA; > } > } > > diff --git a/drivers/media/platform/s5p-tv/mixer_video.c > b/drivers/media/platform/s5p-tv/mixer_video.c > index 81b97db..220ec31 100644 > --- a/drivers/media/platform/s5p-tv/mixer_video.c > +++ b/drivers/media/platform/s5p-tv/mixer_video.c > @@ -948,7 +948,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned > int count) > > if (count == 0) { > mxr_dbg(mdev, "no output buffers queued\n"); > - return -EINVAL; > + return -ENODATA; > } > > /* block any changes in output configuration */ > diff --git a/drivers/media/platform/soc_camera/mx2_camera.c > b/drivers/media/platform/soc_camera/mx2_camera.c > index 45a0276..587e3d1 100644 > --- a/drivers/media/platform/soc_camera/mx2_camera.c > +++ b/drivers/media/platform/soc_camera/mx2_camera.c > @@ -659,7 +659,7 @@ static int mx2_start_streaming(struct vb2_queue *q, > unsigned int count) > unsigned long flags; > > if (count < 2) > - return -EINVAL; > + return -ENODATA; > > spin_lock_irqsave(&pcdev->lock, flags); > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c > b/drivers/staging/media/davinci_vpfe/vpfe_video.c > index 24d98a6..a81b0ab 100644 > --- a/drivers/stagin
Re: [RFCv4 PATCH 7/8] vb2: return ENODATA in start_streaming in case of too few buffers.
On Mon, 9 Dec 2013, Hans Verkuil wrote: > From: Hans Verkuil > > This works together with the retry_start_streaming mechanism to allow > userspace > to start streaming even if not all required buffers have been queued. > > Signed-off-by: Hans Verkuil > Cc: Lad, Prabhakar > Cc: Tomasz Stanislawski > Cc: Kyungmin Park > Cc: Kamil Debski > Cc: Guennadi Liakhovetski > --- [snip] > drivers/media/platform/soc_camera/mx2_camera.c | 2 +- Provided ENOBUFS is used instead of ENODATA: Acked-by: Guennadi Liakhovetski Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFCv4 PATCH 5/8] vb2: retry start_streaming in case of insufficient buffers.
On 12/10/2013 07:38 AM, Guennadi Liakhovetski wrote: > Hi Hans > > On Mon, 9 Dec 2013, Hans Verkuil wrote: > >> From: Hans Verkuil >> >> If start_streaming returns -ENODATA, then it will be retried the next time >> a buffer is queued. > > Wouldn't ENOBUFS be a better error code? Actually, it would. I wasn't aware that error code existed. Good idea, I'll change it. But with that change made, can you ack patch 7/8? Regards, Hans > > Thanks > Guennadi > >> This means applications no longer need to know how many >> buffers need to be queued before STREAMON can be called. This is particularly >> useful for output stream I/O. >> >> If a DMA engine needs at least X buffers before it can start streaming, then >> for applications to get a buffer out as soon as possible they need to know >> the minimum number of buffers to queue before STREAMON can be called. You >> can't >> just try STREAMON after every buffer since on failure STREAMON will dequeue >> all your buffers. (Is that a bug or a feature? Frankly, I'm not sure). >> >> This patch simplifies applications substantially: they can just call STREAMON >> at the beginning and then start queuing buffers and the DMA engine will >> kick in automagically once enough buffers are available. >> >> This also fixes using write() to stream video: the fileio implementation >> calls streamon without having any queued buffers, which will fail today for >> any driver that requires a minimum number of buffers. >> >> Signed-off-by: Hans Verkuil >> Acked-by: Marek Szyprowski >> Acked-by: Laurent Pinchart >> --- >> drivers/media/v4l2-core/videobuf2-core.c | 68 >> ++-- >> include/media/videobuf2-core.h | 15 +-- >> 2 files changed, 66 insertions(+), 17 deletions(-) >> >> diff --git a/drivers/media/v4l2-core/videobuf2-core.c >> b/drivers/media/v4l2-core/videobuf2-core.c >> index f0b3683..00a3f98 100644 >> --- a/drivers/media/v4l2-core/videobuf2-core.c >> +++ b/drivers/media/v4l2-core/videobuf2-core.c >> @@ -1356,6 +1356,39 @@ int vb2_prepare_buf(struct vb2_queue *q, struct >> v4l2_buffer *b) >> } >> EXPORT_SYMBOL_GPL(vb2_prepare_buf); >> >> +/** >> + * vb2_start_streaming() - Attempt to start streaming. >> + * @q: videobuf2 queue >> + * >> + * If there are not enough buffers, then retry_start_streaming is set to >> + * 1 and 0 is returned. The next time a buffer is queued and >> + * retry_start_streaming is 1, this function will be called again to >> + * retry starting the DMA engine. >> + */ >> +static int vb2_start_streaming(struct vb2_queue *q) >> +{ >> +int ret; >> + >> +/* Tell the driver to start streaming */ >> +ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); >> + >> +/* >> + * If there are not enough buffers queued to start streaming, then >> + * the start_streaming operation will return -ENODATA and you have to >> + * retry when the next buffer is queued. >> + */ >> +if (ret == -ENODATA) { >> +dprintk(1, "qbuf: not enough buffers, retry when more buffers >> are queued.\n"); >> +q->retry_start_streaming = 1; >> +return 0; >> +} >> +if (ret) >> +dprintk(1, "qbuf: driver refused to start streaming\n"); >> +else >> +q->retry_start_streaming = 0; >> +return ret; >> +} >> + >> static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) >> { >> int ret = vb2_queue_or_prepare_buf(q, b, "qbuf"); >> @@ -1404,6 +1437,12 @@ static int vb2_internal_qbuf(struct vb2_queue *q, >> struct v4l2_buffer *b) >> /* Fill buffer information for the userspace */ >> __fill_v4l2_buffer(vb, b); >> >> +if (q->retry_start_streaming) { >> +ret = vb2_start_streaming(q); >> +if (ret) >> +return ret; >> +} >> + >> dprintk(1, "%s() of buffer %d succeeded\n", __func__, >> vb->v4l2_buf.index); >> return 0; >> } >> @@ -1553,7 +1592,8 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q) >> return -EINVAL; >> } >> >> -wait_event(q->done_wq, !atomic_read(&q->queued_count)); >> +if (!q->retry_start_streaming) >> +wait_event(q->done_wq, !atomic_read(&q->queued_count)); >> return 0; >> } >> EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers); >> @@ -1667,6 +1707,11 @@ static void __vb2_queue_cancel(struct vb2_queue *q) >> { >> unsigned int i; >> >> +if (q->retry_start_streaming) { >> +q->retry_start_streaming = 0; >> +q->streaming = 0; >> +} >> + >> /* >> * Tell driver to stop all transactions and release all queued >> * buffers. >> @@ -1716,12 +1761,9 @@ static int vb2_internal_streamon(struct vb2_queue *q, >> enum v4l2_buf_type type) >> list_for_each_entry(vb, &q->queued_list, queued_entry) >> __enqueue_in_driver(vb); >> >> -/* >> - * Let driver notice that streaming state has bee
Re: [RFCv4 PATCH 5/8] vb2: retry start_streaming in case of insufficient buffers.
Hi Hans On Mon, 9 Dec 2013, Hans Verkuil wrote: > From: Hans Verkuil > > If start_streaming returns -ENODATA, then it will be retried the next time > a buffer is queued. Wouldn't ENOBUFS be a better error code? Thanks Guennadi > This means applications no longer need to know how many > buffers need to be queued before STREAMON can be called. This is particularly > useful for output stream I/O. > > If a DMA engine needs at least X buffers before it can start streaming, then > for applications to get a buffer out as soon as possible they need to know > the minimum number of buffers to queue before STREAMON can be called. You > can't > just try STREAMON after every buffer since on failure STREAMON will dequeue > all your buffers. (Is that a bug or a feature? Frankly, I'm not sure). > > This patch simplifies applications substantially: they can just call STREAMON > at the beginning and then start queuing buffers and the DMA engine will > kick in automagically once enough buffers are available. > > This also fixes using write() to stream video: the fileio implementation > calls streamon without having any queued buffers, which will fail today for > any driver that requires a minimum number of buffers. > > Signed-off-by: Hans Verkuil > Acked-by: Marek Szyprowski > Acked-by: Laurent Pinchart > --- > drivers/media/v4l2-core/videobuf2-core.c | 68 > ++-- > include/media/videobuf2-core.h | 15 +-- > 2 files changed, 66 insertions(+), 17 deletions(-) > > diff --git a/drivers/media/v4l2-core/videobuf2-core.c > b/drivers/media/v4l2-core/videobuf2-core.c > index f0b3683..00a3f98 100644 > --- a/drivers/media/v4l2-core/videobuf2-core.c > +++ b/drivers/media/v4l2-core/videobuf2-core.c > @@ -1356,6 +1356,39 @@ int vb2_prepare_buf(struct vb2_queue *q, struct > v4l2_buffer *b) > } > EXPORT_SYMBOL_GPL(vb2_prepare_buf); > > +/** > + * vb2_start_streaming() - Attempt to start streaming. > + * @q: videobuf2 queue > + * > + * If there are not enough buffers, then retry_start_streaming is set to > + * 1 and 0 is returned. The next time a buffer is queued and > + * retry_start_streaming is 1, this function will be called again to > + * retry starting the DMA engine. > + */ > +static int vb2_start_streaming(struct vb2_queue *q) > +{ > + int ret; > + > + /* Tell the driver to start streaming */ > + ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); > + > + /* > + * If there are not enough buffers queued to start streaming, then > + * the start_streaming operation will return -ENODATA and you have to > + * retry when the next buffer is queued. > + */ > + if (ret == -ENODATA) { > + dprintk(1, "qbuf: not enough buffers, retry when more buffers > are queued.\n"); > + q->retry_start_streaming = 1; > + return 0; > + } > + if (ret) > + dprintk(1, "qbuf: driver refused to start streaming\n"); > + else > + q->retry_start_streaming = 0; > + return ret; > +} > + > static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) > { > int ret = vb2_queue_or_prepare_buf(q, b, "qbuf"); > @@ -1404,6 +1437,12 @@ static int vb2_internal_qbuf(struct vb2_queue *q, > struct v4l2_buffer *b) > /* Fill buffer information for the userspace */ > __fill_v4l2_buffer(vb, b); > > + if (q->retry_start_streaming) { > + ret = vb2_start_streaming(q); > + if (ret) > + return ret; > + } > + > dprintk(1, "%s() of buffer %d succeeded\n", __func__, > vb->v4l2_buf.index); > return 0; > } > @@ -1553,7 +1592,8 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q) > return -EINVAL; > } > > - wait_event(q->done_wq, !atomic_read(&q->queued_count)); > + if (!q->retry_start_streaming) > + wait_event(q->done_wq, !atomic_read(&q->queued_count)); > return 0; > } > EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers); > @@ -1667,6 +1707,11 @@ static void __vb2_queue_cancel(struct vb2_queue *q) > { > unsigned int i; > > + if (q->retry_start_streaming) { > + q->retry_start_streaming = 0; > + q->streaming = 0; > + } > + > /* >* Tell driver to stop all transactions and release all queued >* buffers. > @@ -1716,12 +1761,9 @@ static int vb2_internal_streamon(struct vb2_queue *q, > enum v4l2_buf_type type) > list_for_each_entry(vb, &q->queued_list, queued_entry) > __enqueue_in_driver(vb); > > - /* > - * Let driver notice that streaming state has been enabled. > - */ > - ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); > + /* Tell driver to start streaming. */ > + ret = vb2_start_streaming(q); > if (ret) { > - dprintk(1, "streamon: driver refused to start streaming\n"); > __vb2_queue
ATTENTION:
ATTENTION: Monday 9th of December 2013 08:16:22 MYT from 41.206.151.183, your account was recently accessed with this details, please if you recognize this details,ignore this message, or use this web link to reconfirm your account details to prevent spammers and unauthorized users to gain access to your account; http://www.emailmeform.com/builder/form/z7KbBhGaf0YV9X4 @2013 all right reserve Security Alert! Webmaster Administration. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Hi Sachin, On Tue, Dec 10, 2013 at 10:38 AM, Sachin Kamat wrote: > Hi Arun, > > On 10 December 2013 10:15, Arun Kumar K wrote: >> Hi Pawel, >> >> On Tue, Dec 10, 2013 at 6:21 AM, Pawel Osciak wrote: >>> Hi Arun, >>> > >> >> Ok will make the change in next version. >> > > While at it also update the patch subject appropriately. > Oh I totally missed that. Thanks for pointing out. Regards Arun -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Hi Arun, On 10 December 2013 10:15, Arun Kumar K wrote: > Hi Pawel, > > On Tue, Dec 10, 2013 at 6:21 AM, Pawel Osciak wrote: >> Hi Arun, >> > > Ok will make the change in next version. > While at it also update the patch subject appropriately. -- With warm regards, Sachin -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Hi Pawel, On Tue, Dec 10, 2013 at 6:21 AM, Pawel Osciak wrote: > Hi Arun, > > On Mon, Dec 9, 2013 at 10:16 PM, Arun Kumar K wrote: >> Add v4l2 controls to set desired profile for VP8 encoder. >> Acceptable levels for VP8 encoder are >> 0: Version 0 >> 1: Version 1 >> 2: Version 2 >> 3: Version 3 >> >> Signed-off-by: Pawel Osciak > > Sorry, but I'm not the author of this patch, Kiran is. I think the > confusion comes from the fact that I committed it to Chromium tree. I > think Kiran's sign-off should go first and the patch should contain: > "From: Kiran AVND " > Ok will make the change in next version. Thanks & Regards Arun -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Hi Hans, Thanks for the review. On Mon, Dec 9, 2013 at 6:52 PM, Hans Verkuil wrote: > Hi Arun, > > Some comments below... > > On 12/09/2013 02:16 PM, Arun Kumar K wrote: >> Add v4l2 controls to set desired profile for VP8 encoder. >> Acceptable levels for VP8 encoder are >> 0: Version 0 >> 1: Version 1 >> 2: Version 2 >> 3: Version 3 >> >> Signed-off-by: Pawel Osciak >> Signed-off-by: Kiran AVND >> Signed-off-by: Arun Kumar K >> --- >> This patch is rebased over another VP8 control patch from me: >> https://linuxtv.org/patch/20733/ >> --- >> Documentation/DocBook/media/v4l/controls.xml|9 + >> drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 + >> drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 11 +++ >> drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |6 ++ >> drivers/media/v4l2-core/v4l2-ctrls.c|8 >> include/uapi/linux/v4l2-controls.h |1 + >> 6 files changed, 32 insertions(+), 4 deletions(-) >> >> diff --git a/Documentation/DocBook/media/v4l/controls.xml >> b/Documentation/DocBook/media/v4l/controls.xml >> index e4db4ac..c1f7544 100644 >> --- a/Documentation/DocBook/media/v4l/controls.xml >> +++ b/Documentation/DocBook/media/v4l/controls.xml >> @@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a >> golden frame. >> Quantization parameter for a P >> frame for VP8. >> >> >> + >> + >> + > spanname="id">V4L2_CID_MPEG_VIDEO_VPX_PROFILE >> + integer > > This says 'integer' whereas the control is actually an integer menu. > > Why did you choose 'integer menu' for this? Would a regular integer or > perhaps a standard > menu be better? > I chose integer menu as it is standard set of values with only 4 options (integers). Same thing is done in the controls - V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS and V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES. I felt this new controls is also in-line with the requirement of a integer-menu type. What do you think? >> + >> + Select the desired profile for VP8 >> encoder. >> +Acceptable values are 0, 1, 2 and 3 corresponding to encoder versions 0, 1, >> 2 and 3. > > Is it a 'profile' or a 'version'? It looks a bit confusing. I don't have the > VP8 standard, > so I can't really tell what the correct terminology is. > Ok will make it more clear. > Also, does this control apply just to VP8 or also to other VP versions? The > control name > says 'VPX' while the description says 'VP8' explicitly. > As of now its applicable to VP8, but I am not sure if the same thing will apply to VP9 also. Regards Arun -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: ERRORS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Tue Dec 10 04:00:29 CET 2013 git branch: test git hash: 356ba0213dca4dd68906bb315f8c7a46e81510ea gcc version:i686-linux-gcc (GCC) 4.8.1 sparse version: 0.4.5-rc1 host hardware: x86_64 host os:3.12-0.slh.2-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: ERRORS linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: ERRORS linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.31.14-i686: WARNINGS linux-2.6.32.27-i686: WARNINGS linux-2.6.33.7-i686: WARNINGS linux-2.6.34.7-i686: WARNINGS linux-2.6.35.9-i686: WARNINGS linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS linux-2.6.39.4-i686: WARNINGS linux-3.0.60-i686: WARNINGS linux-3.1.10-i686: WARNINGS linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: WARNINGS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: WARNINGS linux-3.9.2-i686: WARNINGS linux-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12-i686: OK linux-3.13-rc1-i686: OK linux-2.6.31.14-x86_64: WARNINGS linux-2.6.32.27-x86_64: WARNINGS linux-2.6.33.7-x86_64: WARNINGS linux-2.6.34.7-x86_64: WARNINGS linux-2.6.35.9-x86_64: WARNINGS linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: WARNINGS linux-3.1.10-x86_64: WARNINGS linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: WARNINGS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9.2-x86_64: WARNINGS linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12-x86_64: OK linux-3.13-rc1-x86_64: OK apps: WARNINGS spec-git: OK sparse version: 0.4.5-rc1 sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] omap3isp: Fix buffer flags handling when querying buffer
A missing break resulted in all done buffers being flagged with V4L2_BUF_FLAG_QUEUED. Fix it. Signed-off-by: Laurent Pinchart --- drivers/media/platform/omap3isp/ispqueue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/omap3isp/ispqueue.c b/drivers/media/platform/omap3isp/ispqueue.c index e15f013..5f0f8fa 100644 --- a/drivers/media/platform/omap3isp/ispqueue.c +++ b/drivers/media/platform/omap3isp/ispqueue.c @@ -553,8 +553,10 @@ static void isp_video_buffer_query(struct isp_video_buffer *buf, switch (buf->state) { case ISP_BUF_STATE_ERROR: vbuf->flags |= V4L2_BUF_FLAG_ERROR; + /* Fallthrough */ case ISP_BUF_STATE_DONE: vbuf->flags |= V4L2_BUF_FLAG_DONE; + break; case ISP_BUF_STATE_QUEUED: case ISP_BUF_STATE_ACTIVE: vbuf->flags |= V4L2_BUF_FLAG_QUEUED; -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
ATTENTION:
ATTENTION: Monday 9th of December 2013 08:16:22 MYT from 41.206.151.183, your account was recently accessed with this details, please if you recognize this details,ignore this message, or use this web link to reconfirm your account details to prevent spammers and unauthorized users to gain access to your account; http://www.emailmeform.com/builder/form/z7KbBhGaf0YV9X4 @2013 all right reserve Security Alert! Webmaster Administration. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Hi Arun, On Mon, Dec 9, 2013 at 10:16 PM, Arun Kumar K wrote: > Add v4l2 controls to set desired profile for VP8 encoder. > Acceptable levels for VP8 encoder are > 0: Version 0 > 1: Version 1 > 2: Version 2 > 3: Version 3 > > Signed-off-by: Pawel Osciak Sorry, but I'm not the author of this patch, Kiran is. I think the confusion comes from the fact that I committed it to Chromium tree. I think Kiran's sign-off should go first and the patch should contain: "From: Kiran AVND " Thanks, Pawel > Signed-off-by: Kiran AVND > Signed-off-by: Arun Kumar K > --- > This patch is rebased over another VP8 control patch from me: > https://linuxtv.org/patch/20733/ > --- > Documentation/DocBook/media/v4l/controls.xml|9 + > drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 + > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 11 +++ > drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |6 ++ > drivers/media/v4l2-core/v4l2-ctrls.c|8 > include/uapi/linux/v4l2-controls.h |1 + > 6 files changed, 32 insertions(+), 4 deletions(-) > > diff --git a/Documentation/DocBook/media/v4l/controls.xml > b/Documentation/DocBook/media/v4l/controls.xml > index e4db4ac..c1f7544 100644 > --- a/Documentation/DocBook/media/v4l/controls.xml > +++ b/Documentation/DocBook/media/v4l/controls.xml > @@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a > golden frame. > Quantization parameter for a P > frame for VP8. > > > + > + > +spanname="id">V4L2_CID_MPEG_VIDEO_VPX_PROFILE > + integer > + > + Select the desired profile for VP8 > encoder. > +Acceptable values are 0, 1, 2 and 3 corresponding to encoder versions 0, 1, > 2 and 3. > + > + > > > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > index d91f757..797e61d 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > @@ -426,6 +426,7 @@ struct s5p_mfc_vp8_enc_params { > u8 rc_max_qp; > u8 rc_frame_qp; > u8 rc_p_frame_qp; > + u8 profile; > }; > > /** > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > index 33e8ae3..ec0581c 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > @@ -650,6 +650,14 @@ static struct mfc_control controls[] = { > .step = 1, > .default_value = 10, > }, > + { > + .id = V4L2_CID_MPEG_VIDEO_VPX_PROFILE, > + .type = V4L2_CTRL_TYPE_INTEGER_MENU, > + .minimum = 0, > + .maximum = 3, > + .step = 1, > + .default_value = 0, > + }, > }; > > #define NUM_CTRLS ARRAY_SIZE(controls) > @@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) > case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: > p->codec.vp8.rc_p_frame_qp = ctrl->val; > break; > + case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: > + p->codec.vp8.profile = ctrl->val; > + break; > default: > v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n", > ctrl->id, ctrl->val); > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > index b4886d6..f6ff2db 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > @@ -1197,10 +1197,8 @@ static int s5p_mfc_set_enc_params_vp8(struct > s5p_mfc_ctx *ctx) > reg |= ((p->num_b_frame & 0x3) << 16); > WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6); > > - /* profile & level */ > - reg = 0; > - /** profile */ > - reg |= (0x1 << 4); > + /* profile - 0 ~ 3 */ > + reg = p_vp8->profile & 0x3; > WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6); > > /* rate control config. */ > diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c > b/drivers/media/v4l2-core/v4l2-ctrls.c > index 20840df..5069dd2 100644 > --- a/drivers/media/v4l2-core/v4l2-ctrls.c > +++ b/drivers/media/v4l2-core/v4l2-ctrls.c > @@ -575,11 +575,17 @@ const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len) > 1, 2, 3, > }; > > + static const s64 qmenu_int_vpx_profile[] = { > + 0, 1, 2, 3, > + }; > + > switch (id) { > case V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS: > return __v4l2_qmenu_int_len(qmenu_int_vpx_num_partitions, > len); > case V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES: > return __v4l2_qmenu_int_len(qmenu_int_vpx_num_ref_frame
Re: SDR sampling rate - control or IOCTL?
On 21.11.2013 23:19, Antti Palosaari wrote: On 21.11.2013 22:54, Mauro Carvalho Chehab wrote: Em Thu, 21 Nov 2013 22:22:49 +0200 Antti Palosaari escreveu: On 21.11.2013 21:12, Mauro Carvalho Chehab wrote: Em Thu, 21 Nov 2013 20:33:15 +0200 Antti Palosaari escreveu: On 21.11.2013 20:22, Hans Verkuil wrote: BTW, can the sample rate change while streaming? Typically things you set through S_FMT can not be changed while streaming. Yes, but in practice it is uncommon. When I reverse-engineered Mirics MSi2500 USB ADC I did it hundred of times. Just started streaming and injected numbers to ADC control registers, then calculated sampling rate from the stream. That's not an use case. It is just a developer's procedure. Anyway, you could still measure the bit rate like that, if you do a stream start and stop. That is only use case I know currently, there still could be some others. Seriously? Since the Shannon theorem, all theory used on DSP assumes that the samples are spaced at the very same bit rate. Nothing prevents do to it, the key issue is that sampling rate is needed to known by app. No, it is harder than that: if the bit rate changes, then you need to pack the sampling rate changes when they occur inside the stream, as otherwise userspace will have no means to detect such changes. Heh, I cannot understood you. Could you explain why it works for me? Here is video I recorded just for you: http://palosaari.fi/linux/v4l-dvb/mirics_msi3101_sdrsharp_sampling_rate.mp4 It is Mirics MSi3101 streaming FM radio with sampling rate 2.048 Msps, then I switch to 1.024 Msps and back few times - on the fly. IMHO results are just as expected. Sound start cracking when DSP application sampling rate does not match, but when you change it back to correct it recovers. In other words, changing the sampling rate while streaming breaks decoding. Of course, in a case DSP does not know what it is. I have found that changing frequency during streaming breaks my audio as well. If I will add button to tell app DSP that sampling rate is changed, it will work for both cases. I haven't yet implemented that settings button, it is hard coded to SDRSharp plugin. Could you explain why it works if it is impossible as you said? I can't imagine any "magic" button that will be able to discover on what exact sample the sampling rate changed. The hardware may have buffers; the DMA engines and the USB stack for sure have, and also V4L. Knowing on what exact sample the sampling rate changed would require hardware support, to properly tag the sample where the change started to apply. "Magic button". It is just DSP application which sends request to hardware. And if hardware says OK, that magic SDR application says for own DSP hey change sampling rate to mach stream. There is huge amount of bits streaming, no need to tag. You could just throw away second or two - does not matter. Imagine it similarly like a UDP VoIP call - when you lose data, so what, it is 20ms of audio and none cares. It is similarly here, if you lose some data due to sampling rate mismatch, so what. It is only few ms of audio (or some other). One way radio channel is something it should be robust for such issues - you cannot request retry. If the hardware supports it, I don't see an reason why blocking calling VIDIOC_S_FMT in the middle of a stream. However, on all other hardwares, samples will be lost or will be badly decoded, with would cause audio/video artifacts or even break the decoding code if not properly written. Anyway, if samples will be lost anyway, the right thing to do is to just stop streaming, change the sampling rate and start streaming again. This way, you'll know that all buffers received before the changes will have the old sampling rate, and all new buffers, the new one. I cannot agree. It is too slow, without real benefits, for many use cases. Also, I am pretty sure many of the hw DSP implementations will not restart streaming when they hunt for demodulation lock. There is likely just a long shift-register or FIFO where bits are running even different sampling rates etc. are tested. I did some study of runtime sampling rate changes and I am very sure it is *required*, especially for digital receivers, like DTV dedulators, where timing is important. The main reason is synchronization - not only for when channel is acquired but for run time synchronization too in order to maintain receiver sync (lock). Here is one document which explains some reasons and solutions for digital receiver synchronization: http://www.cs.tut.fi/kurssit/TLT-5806/Synch.pdf You can find a lot of more information when search "Synchronization Techniques for Digital Receivers" What goes to Mirics MSi2500 ADC, it has even flag to signal when sampling rate is changed. Due to that you will not even lose many samples and it is possible to make demodulator design simpler. It is byte 5 in USB packet header which changes between 10/9
[PATCH] radio-bcm2048: fix signal of value
As value can be initialized with a value lower than zero, change it to int, to avoid those warnings: drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_rds_pi_read': drivers/staging/media/bcm2048/radio-bcm2048.c:1989:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] struct bcm2048_device *bdev = dev_get_drvdata(dev); \ ^ drivers/staging/media/bcm2048/radio-bcm2048.c:2070:1: note: in expansion of macro 'property_read' property_read(rds_pi, unsigned int, "%x") ^ drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_fm_rds_flags_read': drivers/staging/media/bcm2048/radio-bcm2048.c:1989:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] struct bcm2048_device *bdev = dev_get_drvdata(dev); \ ^ drivers/staging/media/bcm2048/radio-bcm2048.c:2074:1: note: in expansion of macro 'property_read' property_read(fm_rds_flags, unsigned int, "%u") ^ drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_region_bottom_frequency_read': drivers/staging/media/bcm2048/radio-bcm2048.c:1989:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] struct bcm2048_device *bdev = dev_get_drvdata(dev); \ ^ drivers/staging/media/bcm2048/radio-bcm2048.c:2077:1: note: in expansion of macro 'property_read' property_read(region_bottom_frequency, unsigned int, "%u") ^ drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_region_top_frequency_read': drivers/staging/media/bcm2048/radio-bcm2048.c:1989:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] struct bcm2048_device *bdev = dev_get_drvdata(dev); \ ^ drivers/staging/media/bcm2048/radio-bcm2048.c:2078:1: note: in expansion of macro 'property_read' property_read(region_top_frequency, unsigned int, "%u") Cc: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 782cc11fd037..494ec3916ef5 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -1987,7 +1987,7 @@ static ssize_t bcm2048_##prop##_read(struct device *dev, \ char *buf) \ { \ struct bcm2048_device *bdev = dev_get_drvdata(dev); \ - size value; \ + int value; \ \ if (!bdev) \ return -ENODEV; \ -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv2 11/11] si4713: coding style cleanups
Em Mon, 09 Dec 2013 17:17:41 +0100 Hans Verkuil escreveu: > On 12/09/2013 04:51 PM, Mauro Carvalho Chehab wrote: > > Em Fri, 6 Dec 2013 11:17:14 +0100 > > Hans Verkuil escreveu: > > > >> From: Hans Verkuil > >> > >> Fix most checkpatch errors/warnings. > >> > >> It's mostly whitespace changes, except for replacing msleep with > >> usleep_range and the jiffies comparison with time_is_after_jiffies(). > >> > >> Signed-off-by: Hans Verkuil > >> --- > >> drivers/media/radio/si4713/radio-usb-si4713.c | 4 +- > >> drivers/media/radio/si4713/si4713.c | 104 > >> +- > >> 2 files changed, 55 insertions(+), 53 deletions(-) > >> > >> diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c > >> b/drivers/media/radio/si4713/radio-usb-si4713.c > >> index d978844..691e487 100644 > >> --- a/drivers/media/radio/si4713/radio-usb-si4713.c > >> +++ b/drivers/media/radio/si4713/radio-usb-si4713.c > >> @@ -207,7 +207,7 @@ static int si4713_send_startup_command(struct > >> si4713_usb_device *radio) > >>} > >>if (time_is_before_jiffies(until_jiffies)) > >>return -EIO; > >> - msleep(3); > >> + usleep_range(3000, 5000); > >>} > >> > >>return retval; > >> @@ -354,7 +354,7 @@ static int si4713_i2c_read(struct si4713_usb_device > >> *radio, char *data, int len) > >>data[0] = 0; > >>return 0; > >>} > >> - msleep(3); > >> + usleep_range(3000, 5000); > >>} > >> } > >> > >> diff --git a/drivers/media/radio/si4713/si4713.c > >> b/drivers/media/radio/si4713/si4713.c > >> index 6f28a2b..451b9c0 100644 > >> --- a/drivers/media/radio/si4713/si4713.c > >> +++ b/drivers/media/radio/si4713/si4713.c > >> @@ -50,12 +50,12 @@ MODULE_VERSION("0.0.1"); > >> #define DEFAULT_RDS_PS_REPEAT_COUNT 0x0003 > >> #define DEFAULT_LIMITER_RTIME 0x1392 > >> #define DEFAULT_LIMITER_DEV 0x102CA > >> -#define DEFAULT_PILOT_FREQUENCY 0x4A38 > >> +#define DEFAULT_PILOT_FREQUENCY 0x4A38 > >> #define DEFAULT_PILOT_DEVIATION 0x1A5E > >> #define DEFAULT_ACOMP_ATIME 0x > >> #define DEFAULT_ACOMP_RTIME 0xF4240L > >> #define DEFAULT_ACOMP_GAIN0x0F > >> -#define DEFAULT_ACOMP_THRESHOLD (-0x28) > >> +#define DEFAULT_ACOMP_THRESHOLD (-0x28) > >> #define DEFAULT_MUTE 0x01 > >> #define DEFAULT_POWER_LEVEL 88 > >> #define DEFAULT_FREQUENCY 8800 > >> @@ -252,8 +252,8 @@ static int si4713_send_command(struct si4713_device > >> *sdev, const u8 command, > >> > >>if (client->irq) > >>return -EBUSY; > >> - msleep(1); > >> - } while (jiffies <= until_jiffies); > >> + usleep_range(1000, 2000); > >> + } while (time_is_after_jiffies(until_jiffies)); > > > > Condition seems to be wrong here: it should be time_is_before_jiffies(). > > No, the condition is good. 'time_is_after_jiffies(until_jiffies)' means > 'until_jiffies > jiffies' which is 'jiffies <= until_jiffies'. Ah, yeah, this one is correct. Those macro names sound a little confusing :) > > > Also, the better is to put this on a separate patch. > > OK. > > Regards, > > Hans -- Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv2 11/11] si4713: coding style cleanups
On 12/09/2013 04:51 PM, Mauro Carvalho Chehab wrote: > Em Fri, 6 Dec 2013 11:17:14 +0100 > Hans Verkuil escreveu: > >> From: Hans Verkuil >> >> Fix most checkpatch errors/warnings. >> >> It's mostly whitespace changes, except for replacing msleep with >> usleep_range and the jiffies comparison with time_is_after_jiffies(). >> >> Signed-off-by: Hans Verkuil >> --- >> drivers/media/radio/si4713/radio-usb-si4713.c | 4 +- >> drivers/media/radio/si4713/si4713.c | 104 >> +- >> 2 files changed, 55 insertions(+), 53 deletions(-) >> >> diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c >> b/drivers/media/radio/si4713/radio-usb-si4713.c >> index d978844..691e487 100644 >> --- a/drivers/media/radio/si4713/radio-usb-si4713.c >> +++ b/drivers/media/radio/si4713/radio-usb-si4713.c >> @@ -207,7 +207,7 @@ static int si4713_send_startup_command(struct >> si4713_usb_device *radio) >> } >> if (time_is_before_jiffies(until_jiffies)) >> return -EIO; >> -msleep(3); >> +usleep_range(3000, 5000); >> } >> >> return retval; >> @@ -354,7 +354,7 @@ static int si4713_i2c_read(struct si4713_usb_device >> *radio, char *data, int len) >> data[0] = 0; >> return 0; >> } >> -msleep(3); >> +usleep_range(3000, 5000); >> } >> } >> >> diff --git a/drivers/media/radio/si4713/si4713.c >> b/drivers/media/radio/si4713/si4713.c >> index 6f28a2b..451b9c0 100644 >> --- a/drivers/media/radio/si4713/si4713.c >> +++ b/drivers/media/radio/si4713/si4713.c >> @@ -50,12 +50,12 @@ MODULE_VERSION("0.0.1"); >> #define DEFAULT_RDS_PS_REPEAT_COUNT 0x0003 >> #define DEFAULT_LIMITER_RTIME 0x1392 >> #define DEFAULT_LIMITER_DEV 0x102CA >> -#define DEFAULT_PILOT_FREQUENCY 0x4A38 >> +#define DEFAULT_PILOT_FREQUENCY 0x4A38 >> #define DEFAULT_PILOT_DEVIATION 0x1A5E >> #define DEFAULT_ACOMP_ATIME 0x >> #define DEFAULT_ACOMP_RTIME 0xF4240L >> #define DEFAULT_ACOMP_GAIN 0x0F >> -#define DEFAULT_ACOMP_THRESHOLD (-0x28) >> +#define DEFAULT_ACOMP_THRESHOLD (-0x28) >> #define DEFAULT_MUTE0x01 >> #define DEFAULT_POWER_LEVEL 88 >> #define DEFAULT_FREQUENCY 8800 >> @@ -252,8 +252,8 @@ static int si4713_send_command(struct si4713_device >> *sdev, const u8 command, >> >> if (client->irq) >> return -EBUSY; >> -msleep(1); >> -} while (jiffies <= until_jiffies); >> +usleep_range(1000, 2000); >> +} while (time_is_after_jiffies(until_jiffies)); > > Condition seems to be wrong here: it should be time_is_before_jiffies(). No, the condition is good. 'time_is_after_jiffies(until_jiffies)' means 'until_jiffies > jiffies' which is 'jiffies <= until_jiffies'. > Also, the better is to put this on a separate patch. OK. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv2 06/11] si4713: Added the USB driver for Si4713
On 12/09/2013 04:47 PM, Mauro Carvalho Chehab wrote: > Em Fri, 6 Dec 2013 11:17:09 +0100 > Hans Verkuil escreveu: > >> From: Dinesh Ram >> >> This is the USB driver for the Silicon Labs development board. >> It contains the Si4713 FM transmitter chip. >> >> Signed-off-by: Dinesh Ram >> Signed-off-by: Hans Verkuil >> Tested-by: Eduardo Valentin >> Acked-by: Eduardo Valentin >> --- >> drivers/media/radio/si4713/Kconfig| 15 + >> drivers/media/radio/si4713/Makefile | 1 + >> drivers/media/radio/si4713/radio-usb-si4713.c | 540 >> ++ >> 3 files changed, 556 insertions(+) >> create mode 100644 drivers/media/radio/si4713/radio-usb-si4713.c >> >> diff --git a/drivers/media/radio/si4713/Kconfig >> b/drivers/media/radio/si4713/Kconfig >> index ec640b8..a7c3ba8 100644 >> --- a/drivers/media/radio/si4713/Kconfig >> +++ b/drivers/media/radio/si4713/Kconfig >> @@ -1,3 +1,18 @@ >> +config USB_SI4713 >> +tristate "Silicon Labs Si4713 FM Radio Transmitter support with USB" >> +depends on USB && RADIO_SI4713 >> +select SI4713 >> +---help--- >> + This is a driver for USB devices with the Silicon Labs SI4713 >> + chip. Currently these devices are known to work. >> + - 10c4:8244: Silicon Labs FM Transmitter USB device. >> + >> + Say Y here if you want to connect this type of radio to your >> + computer's USB port. >> + >> + To compile this driver as a module, choose M here: the >> + module will be called radio-usb-si4713. >> + >> config PLATFORM_SI4713 >> tristate "Silicon Labs Si4713 FM Radio Transmitter support with I2C" >> depends on I2C && RADIO_SI4713 >> diff --git a/drivers/media/radio/si4713/Makefile >> b/drivers/media/radio/si4713/Makefile >> index a8c1194..ddaaf92 100644 >> --- a/drivers/media/radio/si4713/Makefile >> +++ b/drivers/media/radio/si4713/Makefile >> @@ -3,4 +3,5 @@ >> # >> >> obj-$(CONFIG_I2C_SI4713) += si4713.o >> +obj-$(CONFIG_USB_SI4713) += radio-usb-si4713.o >> obj-$(CONFIG_PLATFORM_SI4713) += radio-platform-si4713.o >> diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c >> b/drivers/media/radio/si4713/radio-usb-si4713.c >> new file mode 100644 >> index 000..d978844 >> --- /dev/null >> +++ b/drivers/media/radio/si4713/radio-usb-si4713.c >> @@ -0,0 +1,540 @@ >> +/* >> + * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. >> + * All rights reserved. >> + * >> + * This program is free software; you may redistribute it and/or modify >> + * it under the terms of the GNU General Public License as published by >> + * the Free Software Foundation; version 2 of the License. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, >> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF >> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND >> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS >> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN >> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN >> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE >> + * SOFTWARE. >> + */ >> + >> +/* kernel includes */ >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +/* V4l includes */ >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "si4713.h" >> + >> +/* driver and module definitions */ >> +MODULE_AUTHOR("Dinesh Ram "); >> +MODULE_DESCRIPTION("Si4713 FM Transmitter USB driver"); >> +MODULE_LICENSE("GPL v2"); >> + >> +/* The Device announces itself as Cygnal Integrated Products, Inc. */ >> +#define USB_SI4713_VENDOR 0x10c4 >> +#define USB_SI4713_PRODUCT 0x8244 >> + >> +#define BUFFER_LENGTH 64 >> +#define USB_TIMEOUT 1000 >> +#define USB_RESP_TIMEOUT5 >> + >> +/* USB Device ID List */ >> +static struct usb_device_id usb_si4713_usb_device_table[] = { >> +{USB_DEVICE_AND_INTERFACE_INFO(USB_SI4713_VENDOR, USB_SI4713_PRODUCT, >> +USB_CLASS_HID, 0, 0) }, >> +{ } /* Terminating entry */ >> +}; >> + >> +MODULE_DEVICE_TABLE(usb, usb_si4713_usb_device_table); >> + >> +struct si4713_usb_device { >> +struct usb_device *usbdev; >> +struct usb_interface*intf; >> +struct video_device vdev; >> +struct v4l2_device v4l2_dev; >> +struct v4l2_subdev *v4l2_subdev; >> +struct mutexlock; >> +struct i2c_adapter i2c_adapter; >> + >> +u8 *buffer; >> +}; >> + >> +static inline struct si4713_usb_device *to_si4713_dev(struct v4l2_device >> *v4l2_dev) >> +{ >> +return container_of(v4l2_dev, struct si4713_usb_device, v4l2_dev); >> +} >> + >> +static int vidioc_querycap(struct file *file, void *pr
Re: [PATCHv2 00/11] si4713: add si4713 usb driver
Em Fri, 6 Dec 2013 11:17:03 +0100 Hans Verkuil escreveu: > This is the second version of this patch series from Dinesh: > > http://www.spinics.net/lists/linux-media/msg68927.html > > It's identical to the first version except for two new patches: patch 10/11 > prints the product number of the chip on the board and patch 11/11 fixes > checkpatch warnings/errors in si4713.c and radio-usb-si4713.c. It is better, but there are still a few fixes related to jiffies, as I pointed on the previous emails. Except for that, the patchset looks OK on my eyes. > > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv2 02/11] si4713: Modified i2c driver to handle cases where interrupts are not used
Em Fri, 6 Dec 2013 11:17:05 +0100 Hans Verkuil escreveu: > From: Dinesh Ram > > Checks have been introduced at several places in the code to test if an > interrupt is set or not. For devices which do not use the interrupt, to > get a valid response, within a specified timeout, the device is polled > instead. > > Signed-off-by: Dinesh Ram > Signed-off-by: Hans Verkuil > Tested-by: Eduardo Valentin > Acked-by: Eduardo Valentin > --- > drivers/media/radio/si4713/si4713.c | 108 > +--- > 1 file changed, 64 insertions(+), 44 deletions(-) > > diff --git a/drivers/media/radio/si4713/si4713.c > b/drivers/media/radio/si4713/si4713.c > index 4f3308f..5d26b9a 100644 > --- a/drivers/media/radio/si4713/si4713.c > +++ b/drivers/media/radio/si4713/si4713.c > @@ -27,11 +27,11 @@ > #include > #include > #include > -#include > #include > #include > #include > #include > +#include > > #include "si4713.h" > > @@ -213,6 +213,7 @@ static int si4713_send_command(struct si4713_device > *sdev, const u8 command, > u8 response[], const int respn, const int usecs) > { > struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); > + unsigned long until_jiffies; > u8 data1[MAX_ARGS + 1]; > int err; > > @@ -228,30 +229,39 @@ static int si4713_send_command(struct si4713_device > *sdev, const u8 command, > if (err != argn + 1) { > v4l2_err(&sdev->sd, "Error while sending command 0x%02x\n", > command); > - return (err > 0) ? -EIO : err; > + return err < 0 ? err : -EIO; > } > > + until_jiffies = jiffies + usecs_to_jiffies(usecs) + 1; > + > /* Wait response from interrupt */ > - if (!wait_for_completion_timeout(&sdev->work, > + if (client->irq) { > + if (!wait_for_completion_timeout(&sdev->work, > usecs_to_jiffies(usecs) + 1)) > - v4l2_warn(&sdev->sd, > + v4l2_warn(&sdev->sd, > "(%s) Device took too much time to answer.\n", > __func__); > - > - /* Then get the response */ > - err = i2c_master_recv(client, response, respn); > - if (err != respn) { > - v4l2_err(&sdev->sd, > - "Error while reading response for command 0x%02x\n", > - command); > - return (err > 0) ? -EIO : err; > } > > - DBG_BUFFER(&sdev->sd, "Response", response, respn); > - if (check_command_failed(response[0])) > - return -EBUSY; > + do { > + err = i2c_master_recv(client, response, respn); > + if (err != respn) { > + v4l2_err(&sdev->sd, > + "Error %d while reading response for command > 0x%02x\n", > + err, command); > + return err < 0 ? err : -EIO; > + } > + > + DBG_BUFFER(&sdev->sd, "Response", response, respn); > + if (!check_command_failed(response[0])) > + return 0; > > - return 0; > + if (client->irq) > + return -EBUSY; > + msleep(1); > + } while (jiffies <= until_jiffies); > + > + return -EBUSY; > } > > /* > @@ -344,14 +354,15 @@ static int si4713_write_property(struct si4713_device > *sdev, u16 prop, u16 val) > */ > static int si4713_powerup(struct si4713_device *sdev) > { > + struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); > int err; > u8 resp[SI4713_PWUP_NRESP]; > /* >* .First byte = Enabled interrupts and boot function >* .Second byte = Input operation mode >*/ > - const u8 args[SI4713_PWUP_NARGS] = { > - SI4713_PWUP_CTSIEN | SI4713_PWUP_GPO2OEN | SI4713_PWUP_FUNC_TX, > + u8 args[SI4713_PWUP_NARGS] = { > + SI4713_PWUP_GPO2OEN | SI4713_PWUP_FUNC_TX, > SI4713_PWUP_OPMOD_ANALOG, > }; > > @@ -369,6 +380,9 @@ static int si4713_powerup(struct si4713_device *sdev) > gpio_set_value(sdev->gpio_reset, 1); > } > > + if (client->irq) > + args[0] |= SI4713_PWUP_CTSIEN; > + > err = si4713_send_command(sdev, SI4713_CMD_POWER_UP, > args, ARRAY_SIZE(args), > resp, ARRAY_SIZE(resp), > @@ -380,7 +394,8 @@ static int si4713_powerup(struct si4713_device *sdev) > v4l2_dbg(1, debug, &sdev->sd, "Device in power up mode\n"); > sdev->power_state = POWER_ON; > > - err = si4713_write_property(sdev, SI4713_GPO_IEN, > + if (client->irq) > + err = si4713_write_property(sdev, SI4713_GPO_IEN, > SI4713_STC_INT | SI4713_CTS); > } else { >
Re: [PATCHv2 11/11] si4713: coding style cleanups
Em Fri, 6 Dec 2013 11:17:14 +0100 Hans Verkuil escreveu: > From: Hans Verkuil > > Fix most checkpatch errors/warnings. > > It's mostly whitespace changes, except for replacing msleep with > usleep_range and the jiffies comparison with time_is_after_jiffies(). > > Signed-off-by: Hans Verkuil > --- > drivers/media/radio/si4713/radio-usb-si4713.c | 4 +- > drivers/media/radio/si4713/si4713.c | 104 > +- > 2 files changed, 55 insertions(+), 53 deletions(-) > > diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c > b/drivers/media/radio/si4713/radio-usb-si4713.c > index d978844..691e487 100644 > --- a/drivers/media/radio/si4713/radio-usb-si4713.c > +++ b/drivers/media/radio/si4713/radio-usb-si4713.c > @@ -207,7 +207,7 @@ static int si4713_send_startup_command(struct > si4713_usb_device *radio) > } > if (time_is_before_jiffies(until_jiffies)) > return -EIO; > - msleep(3); > + usleep_range(3000, 5000); > } > > return retval; > @@ -354,7 +354,7 @@ static int si4713_i2c_read(struct si4713_usb_device > *radio, char *data, int len) > data[0] = 0; > return 0; > } > - msleep(3); > + usleep_range(3000, 5000); > } > } > > diff --git a/drivers/media/radio/si4713/si4713.c > b/drivers/media/radio/si4713/si4713.c > index 6f28a2b..451b9c0 100644 > --- a/drivers/media/radio/si4713/si4713.c > +++ b/drivers/media/radio/si4713/si4713.c > @@ -50,12 +50,12 @@ MODULE_VERSION("0.0.1"); > #define DEFAULT_RDS_PS_REPEAT_COUNT 0x0003 > #define DEFAULT_LIMITER_RTIME0x1392 > #define DEFAULT_LIMITER_DEV 0x102CA > -#define DEFAULT_PILOT_FREQUENCY 0x4A38 > +#define DEFAULT_PILOT_FREQUENCY 0x4A38 > #define DEFAULT_PILOT_DEVIATION 0x1A5E > #define DEFAULT_ACOMP_ATIME 0x > #define DEFAULT_ACOMP_RTIME 0xF4240L > #define DEFAULT_ACOMP_GAIN 0x0F > -#define DEFAULT_ACOMP_THRESHOLD (-0x28) > +#define DEFAULT_ACOMP_THRESHOLD (-0x28) > #define DEFAULT_MUTE 0x01 > #define DEFAULT_POWER_LEVEL 88 > #define DEFAULT_FREQUENCY8800 > @@ -252,8 +252,8 @@ static int si4713_send_command(struct si4713_device > *sdev, const u8 command, > > if (client->irq) > return -EBUSY; > - msleep(1); > - } while (jiffies <= until_jiffies); > + usleep_range(1000, 2000); > + } while (time_is_after_jiffies(until_jiffies)); Condition seems to be wrong here: it should be time_is_before_jiffies(). Also, the better is to put this on a separate patch. > > return -EBUSY; > } > @@ -269,9 +269,9 @@ static int si4713_read_property(struct si4713_device > *sdev, u16 prop, u32 *pv) > int err; > u8 val[SI4713_GET_PROP_NRESP]; > /* > - * .First byte = 0 > - * .Second byte = property's MSB > - * .Third byte = property's LSB > + * .First byte = 0 > + * .Second byte = property's MSB > + * .Third byte = property's LSB >*/ > const u8 args[SI4713_GET_PROP_NARGS] = { > 0x00, > @@ -306,11 +306,11 @@ static int si4713_write_property(struct si4713_device > *sdev, u16 prop, u16 val) > int rval; > u8 resp[SI4713_SET_PROP_NRESP]; > /* > - * .First byte = 0 > - * .Second byte = property's MSB > - * .Third byte = property's LSB > - * .Fourth byte = value's MSB > - * .Fifth byte = value's LSB > + * .First byte = 0 > + * .Second byte = property's MSB > + * .Third byte = property's LSB > + * .Fourth byte = value's MSB > + * .Fifth byte = value's LSB >*/ > const u8 args[SI4713_SET_PROP_NARGS] = { > 0x00, > @@ -352,8 +352,8 @@ static int si4713_powerup(struct si4713_device *sdev) > int err; > u8 resp[SI4713_PWUP_NRESP]; > /* > - * .First byte = Enabled interrupts and boot function > - * .Second byte = Input operation mode > + * .First byte = Enabled interrupts and boot function > + * .Second byte = Input operation mode >*/ > u8 args[SI4713_PWUP_NARGS] = { > SI4713_PWUP_GPO2OEN | SI4713_PWUP_FUNC_TX, > @@ -505,18 +505,18 @@ static int si4713_wait_stc(struct si4713_device *sdev, > const int usecs) > } > if (jiffies_to_usecs(jiffies - start_jiffies) > usecs) > return err < 0 ? err : -EIO; > - /* We sleep here for 3 ms in order to avoid flooding the device > + /* We sleep here for 3-4 ms in order to avoid flooding the > device >* with USB requests. The si4713 USB driver was developed >* by reverse engineering the
Re: [PATCHv2 06/11] si4713: Added the USB driver for Si4713
Em Fri, 6 Dec 2013 11:17:09 +0100 Hans Verkuil escreveu: > From: Dinesh Ram > > This is the USB driver for the Silicon Labs development board. > It contains the Si4713 FM transmitter chip. > > Signed-off-by: Dinesh Ram > Signed-off-by: Hans Verkuil > Tested-by: Eduardo Valentin > Acked-by: Eduardo Valentin > --- > drivers/media/radio/si4713/Kconfig| 15 + > drivers/media/radio/si4713/Makefile | 1 + > drivers/media/radio/si4713/radio-usb-si4713.c | 540 > ++ > 3 files changed, 556 insertions(+) > create mode 100644 drivers/media/radio/si4713/radio-usb-si4713.c > > diff --git a/drivers/media/radio/si4713/Kconfig > b/drivers/media/radio/si4713/Kconfig > index ec640b8..a7c3ba8 100644 > --- a/drivers/media/radio/si4713/Kconfig > +++ b/drivers/media/radio/si4713/Kconfig > @@ -1,3 +1,18 @@ > +config USB_SI4713 > + tristate "Silicon Labs Si4713 FM Radio Transmitter support with USB" > + depends on USB && RADIO_SI4713 > + select SI4713 > + ---help--- > + This is a driver for USB devices with the Silicon Labs SI4713 > + chip. Currently these devices are known to work. > + - 10c4:8244: Silicon Labs FM Transmitter USB device. > + > + Say Y here if you want to connect this type of radio to your > + computer's USB port. > + > + To compile this driver as a module, choose M here: the > + module will be called radio-usb-si4713. > + > config PLATFORM_SI4713 > tristate "Silicon Labs Si4713 FM Radio Transmitter support with I2C" > depends on I2C && RADIO_SI4713 > diff --git a/drivers/media/radio/si4713/Makefile > b/drivers/media/radio/si4713/Makefile > index a8c1194..ddaaf92 100644 > --- a/drivers/media/radio/si4713/Makefile > +++ b/drivers/media/radio/si4713/Makefile > @@ -3,4 +3,5 @@ > # > > obj-$(CONFIG_I2C_SI4713) += si4713.o > +obj-$(CONFIG_USB_SI4713) += radio-usb-si4713.o > obj-$(CONFIG_PLATFORM_SI4713) += radio-platform-si4713.o > diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c > b/drivers/media/radio/si4713/radio-usb-si4713.c > new file mode 100644 > index 000..d978844 > --- /dev/null > +++ b/drivers/media/radio/si4713/radio-usb-si4713.c > @@ -0,0 +1,540 @@ > +/* > + * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. > + * All rights reserved. > + * > + * This program is free software; you may redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; version 2 of the License. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS > + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN > + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN > + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > + * SOFTWARE. > + */ > + > +/* kernel includes */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +/* V4l includes */ > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "si4713.h" > + > +/* driver and module definitions */ > +MODULE_AUTHOR("Dinesh Ram "); > +MODULE_DESCRIPTION("Si4713 FM Transmitter USB driver"); > +MODULE_LICENSE("GPL v2"); > + > +/* The Device announces itself as Cygnal Integrated Products, Inc. */ > +#define USB_SI4713_VENDOR0x10c4 > +#define USB_SI4713_PRODUCT 0x8244 > + > +#define BUFFER_LENGTH64 > +#define USB_TIMEOUT 1000 > +#define USB_RESP_TIMEOUT 5 > + > +/* USB Device ID List */ > +static struct usb_device_id usb_si4713_usb_device_table[] = { > + {USB_DEVICE_AND_INTERFACE_INFO(USB_SI4713_VENDOR, USB_SI4713_PRODUCT, > + USB_CLASS_HID, 0, 0) }, > + { } /* Terminating entry */ > +}; > + > +MODULE_DEVICE_TABLE(usb, usb_si4713_usb_device_table); > + > +struct si4713_usb_device { > + struct usb_device *usbdev; > + struct usb_interface*intf; > + struct video_device vdev; > + struct v4l2_device v4l2_dev; > + struct v4l2_subdev *v4l2_subdev; > + struct mutexlock; > + struct i2c_adapter i2c_adapter; > + > + u8 *buffer; > +}; > + > +static inline struct si4713_usb_device *to_si4713_dev(struct v4l2_device > *v4l2_dev) > +{ > + return container_of(v4l2_dev, struct si4713_usb_device, v4l2_dev); > +} > + > +static int vidioc_querycap(struct file *file, void *priv, > + struct v4l2_capability *v) > +{ > + struct si4713_usb_device *radio = video_drvdata(file); > + > + strlcpy(v->d
Re: [GIT PULL] git://linuxtv.org/mkrufky/dvb cx24117
Em Sun, 8 Dec 2013 20:18:04 -0500 Michael Krufky escreveu: > Mauro, > > What is the status of this pull request? Patchwork says "changes > requested" but I have no record of any changes requested > > https://patchwork.linuxtv.org/patch/20728/ Thanks for pinging about that. I can't remember about reviewing those patches. Perhaps someone with write access to patchwork might have changed the status of this one by mistake. I'll re-tag this as new and review those patches. Regards, Mauro > > Thanks, > > Mike > > On Wed, Nov 13, 2013 at 6:01 PM, Michael Krufky wrote: > > The following changes since commit > > 80f93c7b0f4599ffbdac8d964ecd1162b8b618b9: > > > > [media] media: st-rc: Add ST remote control driver (2013-10-31 > > 08:20:08 -0200) > > > > are available in the git repository at: > > > > git://linuxtv.org/mkrufky/dvb cx24117 > > > > for you to fetch changes up to 1c468cec3701eb6e26c4911f8a9e8e35cbdebc01: > > > > cx24117: Fix LNB set_voltage function (2013-11-13 13:06:44 -0500) > > > > > > Luis Alves (2): > > cx24117: Add complete demod command list > > cx24117: Fix LNB set_voltage function > > > > drivers/media/dvb-frontends/cx24117.c | 121 > > -- 1 file changed, 71 insertions(+), > > 50 deletions(-) > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv4 PATCH 6/8] vb2: don't set index, don't start streaming for write()
From: Hans Verkuil Two fixes: - there is no need to set the index when calling dqbuf: dqbuf will overwrite it. - __vb2_init_fileio already starts streaming for write(), so there is no need to do it again in __vb2_perform_fileio. It can never have worked anyway: either __vb2_init_fileio succeeds in starting streaming or it is never going to happen. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/videobuf2-core.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 00a3f98..a0b931e 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2423,7 +2423,6 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ memset(&fileio->b, 0, sizeof(fileio->b)); fileio->b.type = q->type; fileio->b.memory = q->memory; - fileio->b.index = index; ret = vb2_internal_dqbuf(q, &fileio->b, nonblock); dprintk(5, "file io: vb2_dqbuf result: %d\n", ret); if (ret) @@ -2505,15 +2504,6 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ * Switch to the next buffer */ fileio->index = (index + 1) % q->num_buffers; - - /* -* Start streaming if required. -*/ - if (!read && !q->streaming) { - ret = vb2_internal_streamon(q, q->type); - if (ret) - return ret; - } } /* -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv4 PATCH 5/8] vb2: retry start_streaming in case of insufficient buffers.
From: Hans Verkuil If start_streaming returns -ENODATA, then it will be retried the next time a buffer is queued. This means applications no longer need to know how many buffers need to be queued before STREAMON can be called. This is particularly useful for output stream I/O. If a DMA engine needs at least X buffers before it can start streaming, then for applications to get a buffer out as soon as possible they need to know the minimum number of buffers to queue before STREAMON can be called. You can't just try STREAMON after every buffer since on failure STREAMON will dequeue all your buffers. (Is that a bug or a feature? Frankly, I'm not sure). This patch simplifies applications substantially: they can just call STREAMON at the beginning and then start queuing buffers and the DMA engine will kick in automagically once enough buffers are available. This also fixes using write() to stream video: the fileio implementation calls streamon without having any queued buffers, which will fail today for any driver that requires a minimum number of buffers. Signed-off-by: Hans Verkuil Acked-by: Marek Szyprowski Acked-by: Laurent Pinchart --- drivers/media/v4l2-core/videobuf2-core.c | 68 ++-- include/media/videobuf2-core.h | 15 +-- 2 files changed, 66 insertions(+), 17 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index f0b3683..00a3f98 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1356,6 +1356,39 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b) } EXPORT_SYMBOL_GPL(vb2_prepare_buf); +/** + * vb2_start_streaming() - Attempt to start streaming. + * @q: videobuf2 queue + * + * If there are not enough buffers, then retry_start_streaming is set to + * 1 and 0 is returned. The next time a buffer is queued and + * retry_start_streaming is 1, this function will be called again to + * retry starting the DMA engine. + */ +static int vb2_start_streaming(struct vb2_queue *q) +{ + int ret; + + /* Tell the driver to start streaming */ + ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); + + /* +* If there are not enough buffers queued to start streaming, then +* the start_streaming operation will return -ENODATA and you have to +* retry when the next buffer is queued. +*/ + if (ret == -ENODATA) { + dprintk(1, "qbuf: not enough buffers, retry when more buffers are queued.\n"); + q->retry_start_streaming = 1; + return 0; + } + if (ret) + dprintk(1, "qbuf: driver refused to start streaming\n"); + else + q->retry_start_streaming = 0; + return ret; +} + static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) { int ret = vb2_queue_or_prepare_buf(q, b, "qbuf"); @@ -1404,6 +1437,12 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) /* Fill buffer information for the userspace */ __fill_v4l2_buffer(vb, b); + if (q->retry_start_streaming) { + ret = vb2_start_streaming(q); + if (ret) + return ret; + } + dprintk(1, "%s() of buffer %d succeeded\n", __func__, vb->v4l2_buf.index); return 0; } @@ -1553,7 +1592,8 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q) return -EINVAL; } - wait_event(q->done_wq, !atomic_read(&q->queued_count)); + if (!q->retry_start_streaming) + wait_event(q->done_wq, !atomic_read(&q->queued_count)); return 0; } EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers); @@ -1667,6 +1707,11 @@ static void __vb2_queue_cancel(struct vb2_queue *q) { unsigned int i; + if (q->retry_start_streaming) { + q->retry_start_streaming = 0; + q->streaming = 0; + } + /* * Tell driver to stop all transactions and release all queued * buffers. @@ -1716,12 +1761,9 @@ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type) list_for_each_entry(vb, &q->queued_list, queued_entry) __enqueue_in_driver(vb); - /* -* Let driver notice that streaming state has been enabled. -*/ - ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); + /* Tell driver to start streaming. */ + ret = vb2_start_streaming(q); if (ret) { - dprintk(1, "streamon: driver refused to start streaming\n"); __vb2_queue_cancel(q); return ret; } @@ -2291,15 +2333,15 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read) goto err_reqbufs; fileio->bufs[i].queued = 1; } - -
[RFCv4 PATCH 4/8] vb2: remove the 'fileio = NULL' hack.
From: Hans Verkuil The read/write implementation in vb2 reuses existing vb2 functions, but it sets q->fileio to NULL before calling them in order to skip the 'q->fileio != NULL' check. This works today due to the synchronous nature of read/write, but it 1) is ugly, and 2) will fail in an asynchronous use-case such as a thread queuing and dequeuing buffers. This last example will be necessary in order to implement vb2 DVB support. This patch removes the hack by splitting up the dqbuf/qbuf/streamon/streamoff functions into an external and an internal version. The external version checks q->fileio and then calls the internal version. The read/write implementation now just uses the internal version, removing the need to set q->fileio to NULL. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/videobuf2-core.c | 223 --- 1 file changed, 112 insertions(+), 111 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 4236ed9..f0b3683 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1285,11 +1285,6 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, const char *opname) { - if (q->fileio) { - dprintk(1, "%s(): file io in progress\n", opname); - return -EBUSY; - } - if (b->type != q->type) { dprintk(1, "%s(): invalid buffer type\n", opname); return -EINVAL; @@ -1331,9 +1326,15 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, */ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b) { - int ret = vb2_queue_or_prepare_buf(q, b, "prepare_buf"); struct vb2_buffer *vb; + int ret; + + if (q->fileio) { + dprintk(1, "%s(): file io in progress\n", __func__); + return -EBUSY; + } + ret = vb2_queue_or_prepare_buf(q, b, "prepare_buf"); if (ret) return ret; @@ -1355,24 +1356,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b) } EXPORT_SYMBOL_GPL(vb2_prepare_buf); -/** - * vb2_qbuf() - Queue a buffer from userspace - * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_qbuf handler - * in driver - * - * Should be called from vidioc_qbuf ioctl handler of a driver. - * This function: - * 1) verifies the passed buffer, - * 2) if necessary, calls buf_prepare callback in the driver (if provided), in - *which driver-specific buffer initialization can be performed, - * 3) if streaming is on, queues the buffer in driver by the means of buf_queue - *callback for processing. - * - * The return values from this function are intended to be directly returned - * from vidioc_qbuf handler in driver. - */ -int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) +static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) { int ret = vb2_queue_or_prepare_buf(q, b, "qbuf"); struct vb2_buffer *vb; @@ -1423,6 +1407,33 @@ int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) dprintk(1, "%s() of buffer %d succeeded\n", __func__, vb->v4l2_buf.index); return 0; } + +/** + * vb2_qbuf() - Queue a buffer from userspace + * @q: videobuf2 queue + * @b: buffer structure passed from userspace to vidioc_qbuf handler + * in driver + * + * Should be called from vidioc_qbuf ioctl handler of a driver. + * This function: + * 1) verifies the passed buffer, + * 2) if necessary, calls buf_prepare callback in the driver (if provided), in + *which driver-specific buffer initialization can be performed, + * 3) if streaming is on, queues the buffer in driver by the means of buf_queue + *callback for processing. + * + * The return values from this function are intended to be directly returned + * from vidioc_qbuf handler in driver. + */ +int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) +{ + if (q->fileio) { + dprintk(1, "%s(): file io in progress\n", __func__); + return -EBUSY; + } + + return vb2_internal_qbuf(q, b); +} EXPORT_SYMBOL_GPL(vb2_qbuf); /** @@ -1571,37 +1582,11 @@ static void __vb2_dqbuf(struct vb2_buffer *vb) } } -/** - * vb2_dqbuf() - Dequeue a buffer to the userspace - * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_dqbuf handler - * in driver - * @nonblocking: if true, this call will not sleep waiting for a buffer if no - * buffers ready for dequeuing are present. Normally the driver - * would be passing (file->f_flags & O_NONBLOCK) here - * - * Should be called from vidioc_dqbuf ioctl handler of a driver. - * This
[RFCv4 PATCH 7/8] vb2: return ENODATA in start_streaming in case of too few buffers.
From: Hans Verkuil This works together with the retry_start_streaming mechanism to allow userspace to start streaming even if not all required buffers have been queued. Signed-off-by: Hans Verkuil Cc: Lad, Prabhakar Cc: Tomasz Stanislawski Cc: Kyungmin Park Cc: Kamil Debski Cc: Guennadi Liakhovetski --- drivers/media/platform/davinci/vpbe_display.c | 2 +- drivers/media/platform/davinci/vpif_capture.c | 2 +- drivers/media/platform/davinci/vpif_display.c | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 2 +- drivers/media/platform/s5p-tv/mixer_video.c | 2 +- drivers/media/platform/soc_camera/mx2_camera.c | 2 +- drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 ++ 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index eac472b..53be7fc 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -347,7 +347,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count) /* If buffer queue is empty, return error */ if (list_empty(&layer->dma_queue)) { v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n"); - return -EINVAL; + return -ENODATA; } /* Get the next frame from the buffer queue */ layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next, diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 52ac5e6..4b04a27 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -277,7 +277,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) if (list_empty(&common->dma_queue)) { spin_unlock_irqrestore(&common->irqlock, flags); vpif_dbg(1, debug, "buffer queue is empty\n"); - return -EIO; + return -ENODATA; } /* Get the next frame from the buffer queue */ diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index c31bcf1..c5070dc 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -239,7 +239,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) if (list_empty(&common->dma_queue)) { spin_unlock_irqrestore(&common->irqlock, flags); vpif_err("buffer queue is empty\n"); - return -EIO; + return -ENODATA; } /* Get the next frame from the buffer queue */ diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 4ff3b6c..3bdfe85 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1863,7 +1863,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) if (ctx->src_bufs_cnt < ctx->pb_count) { mfc_err("Need minimum %d OUTPUT buffers\n", ctx->pb_count); - return -EINVAL; + return -ENODATA; } } diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c index 81b97db..220ec31 100644 --- a/drivers/media/platform/s5p-tv/mixer_video.c +++ b/drivers/media/platform/s5p-tv/mixer_video.c @@ -948,7 +948,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) if (count == 0) { mxr_dbg(mdev, "no output buffers queued\n"); - return -EINVAL; + return -ENODATA; } /* block any changes in output configuration */ diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index 45a0276..587e3d1 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c @@ -659,7 +659,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) unsigned long flags; if (count < 2) - return -EINVAL; + return -ENODATA; spin_lock_irqsave(&pcdev->lock, flags); diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 24d98a6..a81b0ab 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -1201,6 +1201,8 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count) unsigned long addr; int ret; + if (count == 0) + return -ENODATA; ret = mutex_lock_interruptible(&video->lock); if (ret) goto streamoff; -- 1.8.4.3 -- T
[RFCv4 PATCH 1/8] vb2: push the mmap semaphore down to __buf_prepare()
From: Hans Verkuil Rather than taking the mmap semaphore at a relatively high-level function, push it down to the place where it is really needed. It was placed in vb2_queue_or_prepare_buf() to prevent racing with other vb2 calls. The only way I can see that a race can happen is when two threads queue the same buffer. The solution for that it to introduce a PREPARING state. Moving it down offers opportunities to simplify the code. Signed-off-by: Hans Verkuil Acked-by: Laurent Pinchart --- drivers/media/v4l2-core/videobuf2-core.c | 82 ++-- include/media/videobuf2-core.h | 2 + 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 57ba131..634dc95 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -462,6 +462,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) case VB2_BUF_STATE_PREPARED: b->flags |= V4L2_BUF_FLAG_PREPARED; break; + case VB2_BUF_STATE_PREPARING: case VB2_BUF_STATE_DEQUEUED: /* nothing */ break; @@ -1207,6 +1208,7 @@ static void __enqueue_in_driver(struct vb2_buffer *vb) static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) { struct vb2_queue *q = vb->vb2_queue; + struct rw_semaphore *mmap_sem; int ret; ret = __verify_length(vb, b); @@ -1216,12 +1218,31 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) return ret; } + vb->state = VB2_BUF_STATE_PREPARING; switch (q->memory) { case V4L2_MEMORY_MMAP: ret = __qbuf_mmap(vb, b); break; case V4L2_MEMORY_USERPTR: + /* +* In case of user pointer buffers vb2 allocators need to get direct +* access to userspace pages. This requires getting the mmap semaphore +* for read access in the current process structure. The same semaphore +* is taken before calling mmap operation, while both qbuf/prepare_buf +* and mmap are called by the driver or v4l2 core with the driver's lock +* held. To avoid an AB-BA deadlock (mmap_sem then driver's lock in mmap +* and driver's lock then mmap_sem in qbuf/prepare_buf) the videobuf2 +* core releases the driver's lock, takes mmap_sem and then takes the +* driver's lock again. +*/ + mmap_sem = ¤t->mm->mmap_sem; + call_qop(q, wait_prepare, q); + down_read(mmap_sem); + call_qop(q, wait_finish, q); + ret = __qbuf_userptr(vb, b); + + up_read(mmap_sem); break; case V4L2_MEMORY_DMABUF: ret = __qbuf_dmabuf(vb, b); @@ -1235,8 +1256,7 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) ret = call_qop(q, buf_prepare, vb); if (ret) dprintk(1, "qbuf: buffer preparation failed: %d\n", ret); - else - vb->state = VB2_BUF_STATE_PREPARED; + vb->state = ret ? VB2_BUF_STATE_DEQUEUED : VB2_BUF_STATE_PREPARED; return ret; } @@ -1247,80 +1267,47 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, struct v4l2_buffer *, struct vb2_buffer *)) { - struct rw_semaphore *mmap_sem = NULL; struct vb2_buffer *vb; int ret; - /* -* In case of user pointer buffers vb2 allocators need to get direct -* access to userspace pages. This requires getting the mmap semaphore -* for read access in the current process structure. The same semaphore -* is taken before calling mmap operation, while both qbuf/prepare_buf -* and mmap are called by the driver or v4l2 core with the driver's lock -* held. To avoid an AB-BA deadlock (mmap_sem then driver's lock in mmap -* and driver's lock then mmap_sem in qbuf/prepare_buf) the videobuf2 -* core releases the driver's lock, takes mmap_sem and then takes the -* driver's lock again. -* -* To avoid racing with other vb2 calls, which might be called after -* releasing the driver's lock, this operation is performed at the -* beginning of qbuf/prepare_buf processing. This way the queue status -* is consistent after getting the driver's lock back. -*/ - if (q->memory == V4L2_MEMORY_USERPTR) { - mmap_sem = ¤t->mm->mmap_sem; - call_qop(q, wait_prepare, q); - down_read(mmap_sem); - call_qop(q, wait_finish, q)
[RFCv4 PATCH 8/8] vb2: Improve file I/O emulation to handle buffers in any order
From: Hans Verkuil videobuf2 file I/O emulation assumed that buffers dequeued from the driver would return in the order they were enqueued in the driver. Improve the file I/O emulator's book-keeping to remove this assumption. Also set the buf->size properly if a write() dequeues a buffer and the VB2_FILEIO_WRITE_IMMEDIATELY flag is set. Based on an initial patch by Andy Walls. Signed-off-by: Hans Verkuil Reviewed-by: Andy Walls --- drivers/media/v4l2-core/videobuf2-core.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index a0b931e..af89721 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2333,6 +2333,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read) goto err_reqbufs; fileio->bufs[i].queued = 1; } + fileio->index = q->num_buffers; } /* @@ -2408,15 +2409,11 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ } fileio = q->fileio; - index = fileio->index; - buf = &fileio->bufs[index]; - /* * Check if we need to dequeue the buffer. */ - if (buf->queued) { - struct vb2_buffer *vb; - + index = fileio->index; + if (index >= q->num_buffers) { /* * Call vb2_dqbuf to get buffer back. */ @@ -2429,12 +2426,18 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ return ret; fileio->dq_count += 1; + index = fileio->b.index; + buf = &fileio->bufs[index]; + /* * Get number of bytes filled by the driver */ - vb = q->bufs[index]; - buf->size = vb2_get_plane_payload(vb, 0); + buf->pos = 0; buf->queued = 0; + buf->size = read ? vb2_get_plane_payload(q->bufs[index], 0) +: vb2_plane_size(q->bufs[index], 0); + } else { + buf = &fileio->bufs[index]; } /* @@ -2497,13 +2500,10 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ */ buf->pos = 0; buf->queued = 1; - buf->size = q->bufs[0]->v4l2_planes[0].length; + buf->size = vb2_plane_size(q->bufs[index], 0); fileio->q_count += 1; - - /* -* Switch to the next buffer -*/ - fileio->index = (index + 1) % q->num_buffers; + if (fileio->index < q->num_buffers) + fileio->index++; } /* -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv4 PATCH 2/8] vb2: simplify qbuf/prepare_buf by removing callback.
From: Hans Verkuil The callback used to merge the common code of the qbuf/prepare_buf code can be removed now that the mmap_sem handling is pushed down to __buf_prepare(). This makes the code more readable. Signed-off-by: Hans Verkuil Acked-by: Laurent Pinchart --- drivers/media/v4l2-core/videobuf2-core.c | 118 +++ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 634dc95..1754d3f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1262,14 +1262,8 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) } static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, - const char *opname, - int (*handler)(struct vb2_queue *, - struct v4l2_buffer *, - struct vb2_buffer *)) + const char *opname) { - struct vb2_buffer *vb; - int ret; - if (q->fileio) { dprintk(1, "%s(): file io in progress\n", opname); return -EBUSY; @@ -1285,8 +1279,7 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, return -EINVAL; } - vb = q->bufs[b->index]; - if (NULL == vb) { + if (q->bufs[b->index] == NULL) { /* Should never happen */ dprintk(1, "%s(): buffer is NULL\n", opname); return -EINVAL; @@ -1297,30 +1290,7 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, return -EINVAL; } - ret = __verify_planes_array(vb, b); - if (ret) - return ret; - - ret = handler(q, b, vb); - if (!ret) { - /* Fill buffer information for the userspace */ - __fill_v4l2_buffer(vb, b); - - dprintk(1, "%s() of buffer %d succeeded\n", opname, vb->v4l2_buf.index); - } - return ret; -} - -static int __vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, -struct vb2_buffer *vb) -{ - if (vb->state != VB2_BUF_STATE_DEQUEUED) { - dprintk(1, "%s(): invalid buffer state %d\n", __func__, - vb->state); - return -EINVAL; - } - - return __buf_prepare(vb, b); + return __verify_planes_array(q->bufs[b->index], b); } /** @@ -1340,20 +1310,68 @@ static int __vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b, */ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b) { - return vb2_queue_or_prepare_buf(q, b, "prepare_buf", __vb2_prepare_buf); + int ret = vb2_queue_or_prepare_buf(q, b, "prepare_buf"); + struct vb2_buffer *vb; + + if (ret) + return ret; + + vb = q->bufs[b->index]; + if (vb->state != VB2_BUF_STATE_DEQUEUED) { + dprintk(1, "%s(): invalid buffer state %d\n", __func__, + vb->state); + return -EINVAL; + } + + ret = __buf_prepare(vb, b); + if (!ret) { + /* Fill buffer information for the userspace */ + __fill_v4l2_buffer(vb, b); + + dprintk(1, "%s() of buffer %d succeeded\n", __func__, vb->v4l2_buf.index); + } + return ret; } EXPORT_SYMBOL_GPL(vb2_prepare_buf); -static int __vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b, - struct vb2_buffer *vb) +/** + * vb2_qbuf() - Queue a buffer from userspace + * @q: videobuf2 queue + * @b: buffer structure passed from userspace to vidioc_qbuf handler + * in driver + * + * Should be called from vidioc_qbuf ioctl handler of a driver. + * This function: + * 1) verifies the passed buffer, + * 2) if necessary, calls buf_prepare callback in the driver (if provided), in + *which driver-specific buffer initialization can be performed, + * 3) if streaming is on, queues the buffer in driver by the means of buf_queue + *callback for processing. + * + * The return values from this function are intended to be directly returned + * from vidioc_qbuf handler in driver. + */ +int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) { - int ret; + int ret = vb2_queue_or_prepare_buf(q, b, "qbuf"); + struct vb2_buffer *vb; + + if (ret) + return ret; + + vb = q->bufs[b->index]; + if (vb->state != VB2_BUF_STATE_DEQUEUED) { + dprintk(1, "%s(): invalid buffer state %d\n", __func__, + vb->state); + return -EINVAL; + } switch (vb->state) { case VB2_BUF_STATE_DEQUEUED: ret = __buf_prepare(vb, b);
[RFCv4 PATCH 3/8] vb2: fix race condition between REQBUFS and QBUF/PREPARE_BUF.
From: Hans Verkuil When preparing a buffer the queue lock is released for a short while if the memory mode is USERPTR (see __buf_prepare for the details), which would allow a race with a REQBUFS which can free the buffers. Removing the buffers from underneath __buf_prepare is obviously a bad idea, so we check if any of the buffers is in the state PREPARING, and if so we just return -EAGAIN. If this happens, then the application does something really strange. The REQBUFS call can be retried safely, since this situation is transient. Signed-off-by: Hans Verkuil Acked-by: Laurent Pinchart --- drivers/media/v4l2-core/videobuf2-core.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 1754d3f..4236ed9 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -279,10 +279,28 @@ static void __vb2_free_mem(struct vb2_queue *q, unsigned int buffers) * related information, if no buffers are left return the queue to an * uninitialized state. Might be called even if the queue has already been freed. */ -static void __vb2_queue_free(struct vb2_queue *q, unsigned int buffers) +static int __vb2_queue_free(struct vb2_queue *q, unsigned int buffers) { unsigned int buffer; + /* +* Sanity check: when preparing a buffer the queue lock is released for +* a short while (see __buf_prepare for the details), which would allow +* a race with a reqbufs which can call this function. Removing the +* buffers from underneath __buf_prepare is obviously a bad idea, so we +* check if any of the buffers is in the state PREPARING, and if so we +* just return -EAGAIN. +*/ + for (buffer = q->num_buffers - buffers; buffer < q->num_buffers; +++buffer) { + if (q->bufs[buffer] == NULL) + continue; + if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) { + dprintk(1, "reqbufs: preparing buffers, cannot free\n"); + return -EAGAIN; + } + } + /* Call driver-provided cleanup function for each buffer, if provided */ if (q->ops->buf_cleanup) { for (buffer = q->num_buffers - buffers; buffer < q->num_buffers; @@ -307,6 +325,7 @@ static void __vb2_queue_free(struct vb2_queue *q, unsigned int buffers) if (!q->num_buffers) q->memory = 0; INIT_LIST_HEAD(&q->queued_list); + return 0; } /** @@ -639,7 +658,9 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) return -EBUSY; } - __vb2_queue_free(q, q->num_buffers); + ret = __vb2_queue_free(q, q->num_buffers); + if (ret) + return ret; /* * In case of REQBUFS(0) return immediately without calling -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv4 PATCH 0/8] vb2: various cleanups and improvements
This patch series does some cleanups in the qbuf/prepare_buf handling (the first three patches). The fourth patch removes the 'fileio = NULL' hack. That hack no longer works when dealing with asynchronous calls from a kernel thread so it had to be fixed. The next three patches implement retrying start_streaming() if there are not enough buffers queued for the DMA engine to start. I know that there are more drivers that can be simplified with this feature available in the core. Those drivers do the retry of start_streaming in the buf_queue op which frankly defeats the purpose of having a central start_streaming op. But I leave it to the driver developers to decide whether or not to cleanup their drivers. The big advantage is that apps can just call STREAMON first, then start queuing buffers without having to know the minimum number of buffers that have to be queued before the DMA engine will kick in. It always annoyed me that vb2 didn't take care of that for me as it is easy enough to do. The final patch adds a fix based on a patch from Andy that removes the file I/O emulation assumption that buffers are dequeued in the same order that they were enqueued. With regards to patch 7/8 I would appreciate some Acks. See patch 5 how ENODATA is used to implement retrying start_streaming in vb2. Regards, Hans New in v4: - Reorder the patches - Drop the thread/DVB support: postpone until at least one driver will need this. New in v3: - Added a comment to the thread_start function making it explicit that it is for use with videobuf2-dvb only. - Added patch 10/10 to address yet another race condition. New in v2: - Added a PREPARING state in patch 1 to prevent a race condition that Laurent mentioned (two QBUF calls with the same index number at the same time). - Changed some minor issues in patch 4 that Laurent mentioned in his review. - Added the reworked version of Andy's original patch to remove the order assumption in the file I/O emulation. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Hi Arun, Some comments below... On 12/09/2013 02:16 PM, Arun Kumar K wrote: > Add v4l2 controls to set desired profile for VP8 encoder. > Acceptable levels for VP8 encoder are > 0: Version 0 > 1: Version 1 > 2: Version 2 > 3: Version 3 > > Signed-off-by: Pawel Osciak > Signed-off-by: Kiran AVND > Signed-off-by: Arun Kumar K > --- > This patch is rebased over another VP8 control patch from me: > https://linuxtv.org/patch/20733/ > --- > Documentation/DocBook/media/v4l/controls.xml|9 + > drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 + > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 11 +++ > drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |6 ++ > drivers/media/v4l2-core/v4l2-ctrls.c|8 > include/uapi/linux/v4l2-controls.h |1 + > 6 files changed, 32 insertions(+), 4 deletions(-) > > diff --git a/Documentation/DocBook/media/v4l/controls.xml > b/Documentation/DocBook/media/v4l/controls.xml > index e4db4ac..c1f7544 100644 > --- a/Documentation/DocBook/media/v4l/controls.xml > +++ b/Documentation/DocBook/media/v4l/controls.xml > @@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a > golden frame. > Quantization parameter for a P frame > for VP8. > > > + > + > + spanname="id">V4L2_CID_MPEG_VIDEO_VPX_PROFILE > + integer This says 'integer' whereas the control is actually an integer menu. Why did you choose 'integer menu' for this? Would a regular integer or perhaps a standard menu be better? > + > + Select the desired profile for VP8 > encoder. > +Acceptable values are 0, 1, 2 and 3 corresponding to encoder versions 0, 1, > 2 and 3. Is it a 'profile' or a 'version'? It looks a bit confusing. I don't have the VP8 standard, so I can't really tell what the correct terminology is. Also, does this control apply just to VP8 or also to other VP versions? The control name says 'VPX' while the description says 'VP8' explicitly. > + > + > > > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > index d91f757..797e61d 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h > @@ -426,6 +426,7 @@ struct s5p_mfc_vp8_enc_params { > u8 rc_max_qp; > u8 rc_frame_qp; > u8 rc_p_frame_qp; > + u8 profile; > }; > > /** > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > index 33e8ae3..ec0581c 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c > @@ -650,6 +650,14 @@ static struct mfc_control controls[] = { > .step = 1, > .default_value = 10, > }, > + { > + .id = V4L2_CID_MPEG_VIDEO_VPX_PROFILE, > + .type = V4L2_CTRL_TYPE_INTEGER_MENU, > + .minimum = 0, > + .maximum = 3, > + .step = 1, > + .default_value = 0, > + }, > }; > > #define NUM_CTRLS ARRAY_SIZE(controls) > @@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) > case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: > p->codec.vp8.rc_p_frame_qp = ctrl->val; > break; > + case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: > + p->codec.vp8.profile = ctrl->val; > + break; > default: > v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n", > ctrl->id, ctrl->val); > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > index b4886d6..f6ff2db 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > @@ -1197,10 +1197,8 @@ static int s5p_mfc_set_enc_params_vp8(struct > s5p_mfc_ctx *ctx) > reg |= ((p->num_b_frame & 0x3) << 16); > WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6); > > - /* profile & level */ > - reg = 0; > - /** profile */ > - reg |= (0x1 << 4); > + /* profile - 0 ~ 3 */ > + reg = p_vp8->profile & 0x3; > WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6); > > /* rate control config. */ > diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c > b/drivers/media/v4l2-core/v4l2-ctrls.c > index 20840df..5069dd2 100644 > --- a/drivers/media/v4l2-core/v4l2-ctrls.c > +++ b/drivers/media/v4l2-core/v4l2-ctrls.c > @@ -575,11 +575,17 @@ const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len) > 1, 2, 3, > }; > > + static const s64 qmenu_int_vpx_profile[] = { > + 0, 1, 2, 3, > + }; > + > switch (id) { > case V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS: > return __v4l2_qmenu_int_len(qmenu_in
[PATCH] CHROMIUM: s5p-mfc: add controls to set vp8 enc profile
Add v4l2 controls to set desired profile for VP8 encoder. Acceptable levels for VP8 encoder are 0: Version 0 1: Version 1 2: Version 2 3: Version 3 Signed-off-by: Pawel Osciak Signed-off-by: Kiran AVND Signed-off-by: Arun Kumar K --- This patch is rebased over another VP8 control patch from me: https://linuxtv.org/patch/20733/ --- Documentation/DocBook/media/v4l/controls.xml|9 + drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 + drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 11 +++ drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |6 ++ drivers/media/v4l2-core/v4l2-ctrls.c|8 include/uapi/linux/v4l2-controls.h |1 + 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index e4db4ac..c1f7544 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a golden frame. Quantization parameter for a P frame for VP8. + + + V4L2_CID_MPEG_VIDEO_VPX_PROFILE + integer + + Select the desired profile for VP8 encoder. +Acceptable values are 0, 1, 2 and 3 corresponding to encoder versions 0, 1, 2 and 3. + + diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index d91f757..797e61d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -426,6 +426,7 @@ struct s5p_mfc_vp8_enc_params { u8 rc_max_qp; u8 rc_frame_qp; u8 rc_p_frame_qp; + u8 profile; }; /** diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 33e8ae3..ec0581c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -650,6 +650,14 @@ static struct mfc_control controls[] = { .step = 1, .default_value = 10, }, + { + .id = V4L2_CID_MPEG_VIDEO_VPX_PROFILE, + .type = V4L2_CTRL_TYPE_INTEGER_MENU, + .minimum = 0, + .maximum = 3, + .step = 1, + .default_value = 0, + }, }; #define NUM_CTRLS ARRAY_SIZE(controls) @@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: p->codec.vp8.rc_p_frame_qp = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: + p->codec.vp8.profile = ctrl->val; + break; default: v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n", ctrl->id, ctrl->val); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index b4886d6..f6ff2db 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -1197,10 +1197,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx *ctx) reg |= ((p->num_b_frame & 0x3) << 16); WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6); - /* profile & level */ - reg = 0; - /** profile */ - reg |= (0x1 << 4); + /* profile - 0 ~ 3 */ + reg = p_vp8->profile & 0x3; WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6); /* rate control config. */ diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 20840df..5069dd2 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -575,11 +575,17 @@ const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len) 1, 2, 3, }; + static const s64 qmenu_int_vpx_profile[] = { + 0, 1, 2, 3, + }; + switch (id) { case V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS: return __v4l2_qmenu_int_len(qmenu_int_vpx_num_partitions, len); case V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES: return __v4l2_qmenu_int_len(qmenu_int_vpx_num_ref_frames, len); + case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: + return __v4l2_qmenu_int_len(qmenu_int_vpx_profile, len); default: *len = 0; return NULL; @@ -749,6 +755,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_VPX_MAX_QP:return "VPX Maximum QP Value"; case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP:return "VPX I-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX P-Frame QP Value"; + case V4L2_
Re: omap3isp device tree support
Hi Enrico, On Friday 06 December 2013 11:13:50 Enrico wrote: > Hi, > > i know there is some work going on for omap3isp device tree support, > but right now is it possible to enable it in some other way in a DT > kernel? > > I've tried enabling it in board-generic.c (omap3_init_camera(...) with > proper platform data) but it hangs early at boot, do someone know if > it's possible and how to do it? Here's what I currently use to test the mt9v032 driver on my Beagleboard-xM with a mainline kernel. If you need proper regulators support it will get more complex. commit 9184392db932be81ea9d33080c1740c3a20f5132 Author: Laurent Pinchart Date: Mon Jun 20 13:21:17 2011 +0200 board-omap3beagle: Add support for the MT9V034 sensor module Signed-off-by: Laurent Pinchart diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 1f25f3e..8bc8695 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -239,7 +239,8 @@ obj-$(CONFIG_SOC_OMAP2420) += msdi.o obj-$(CONFIG_MACH_OMAP_GENERIC)+= board-generic.o pdata-quirks.o obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o obj-$(CONFIG_MACH_OMAP_2430SDP)+= board-2430sdp.o -obj-$(CONFIG_MACH_OMAP3_BEAGLE)+= board-omap3beagle.o +obj-$(CONFIG_MACH_OMAP3_BEAGLE)+= board-omap3beagle.o \ + board-omap3beagle-camera.o obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o obj-$(CONFIG_MACH_OMAP_LDP)+= board-ldp.o obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c new file mode 100644 index 000..c927c23 --- /dev/null +++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c @@ -0,0 +1,93 @@ +/* + * arch/arm/mach-omap2/board-omap3beagle-camera.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "devices.h" + +#define MT9V034_RESET_GPIO 98 + +static struct regulator_consumer_supply mt9v034_dummy_supplies[] = { + REGULATOR_SUPPLY("vaa", "3-0048"), + REGULATOR_SUPPLY("vdd", "3-0048"), + REGULATOR_SUPPLY("vdd_io", "3-0048"), +}; + +static const s64 mt9v034_link_freqs[] = { + 1300, + 2660, + 2700, + 0, +}; + +static struct mt9v032_platform_data beagle_mt9v034_platform_data = { + .clk_pol= 0, + .link_freqs = mt9v034_link_freqs, + .link_def_freq = 2660, +}; + +static struct i2c_board_info mt9v034_camera_i2c_device = { + I2C_BOARD_INFO("mt9v034", 0x48), + .platform_data = &beagle_mt9v034_platform_data, +}; + +static struct isp_subdev_i2c_board_info mt9v034_camera_subdevs[] = { + { + .board_info = &mt9v034_camera_i2c_device, + .i2c_adapter_id = 3, + }, + { NULL, 0, }, +}; + +static struct isp_v4l2_subdevs_group beagle_camera_subdevs[] = { + { + .subdevs = mt9v034_camera_subdevs, + .interface = ISP_INTERFACE_PARALLEL, + .bus = { + .parallel = { + .data_lane_shift = ISP_LANE_SHIFT_2, + .clk_pol = 0, + } + }, + }, + { }, +}; + +static struct isp_platform_data beagle_isp_platform_data = { + .xclks = { + [0] = { + .dev_id = "3-0048", + }, + }, + .subdevs = beagle_camera_subdevs, +}; + +static int __init beagle_camera_init(void) +{ + if (!of_machine_is_compatible("ti,omap3-beagle-xm")) + return 0; + + clk_add_alias(NULL, "3-0048", "cam_xclka", NULL); + + regulator_register_fixed(0, mt9v034_dummy_supplies, +ARRAY_SIZE(mt9v034_dummy_supplies)); + + omap3_init_camera(&beagle_isp_platform_data); + + return 0; +} +late_initcall(beagle_camera_init); -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Any development for Hauppauge HVR 5500-HD started?
Hi! Is there anyone, who has started driver development for this card? I would like to help testing. Best wishes. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: vb2: various cleanups and improvements
Hi Hans, Thank you for the patches. For patches 1, 2, 4, 7 and 10, Acked-by: Laurent Pinchart On Thursday 05 December 2013 09:21:39 Hans Verkuil wrote: > This patch series does some cleanups in the qbuf/prepare_buf handling > (the first two patches). The third patch removes the 'fileio = NULL' > hack. That hack no longer works when dealing with asynchronous calls > from a kernel thread so it had to be fixed. > > The next three patches implement retrying start_streaming() if there are > not enough buffers queued for the DMA engine to start. I know that there > are more drivers that can be simplified with this feature available in > the core. Those drivers do the retry of start_streaming in the buf_queue > op which frankly defeats the purpose of having a central start_streaming > op. But I leave it to the driver developers to decide whether or not to > cleanup their drivers. > > The big advantage is that apps can just call STREAMON first, then start > queuing buffers without having to know the minimum number of buffers that > have to be queued before the DMA engine will kick in. It always annoyed > me that vb2 didn't take care of that for me as it is easy enough to do. > > The next two patches add vb2 thread support which is necessary > for both videobuf2-dvb (the vb2 replacement of videobuf-dvb) and for e.g. > alsa drivers where you use the same trick as with dvb. > > The thread implementation has been tested with both alsa recording and > playback for an internal driver (sorry, I can't share the source yet). > > The next patch adds a fix based on a patch from Andy that removes the > file I/O emulation assumption that buffers are dequeued in the same > order that they were enqueued. > > The final patch fixes another race condition between QBUF/PREPARE_BUF > and REQBUFS in the USERPTR case, also caused by the fact that __prepare_buf > temporarily unlocks the queue lock. The race was found by Laurent. > > Regards, > > Hans > > New in v3: > > - Added a comment to the thread_start function making it explicit that > it is for use with videobuf2-dvb only. > - Added patch 10/10 to address yet another race condition. > > New in v2: > > - Added a PREPARING state in patch 1 to prevent a race condition that > Laurent mentioned (two QBUF calls with the same index number at the same > time). - Changed some minor issues in patch 4 that Laurent mentioned in his > review. - Added the reworked version of Andy's original patch to remove the > order assumption in the file I/O emulation. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.14] vb2 fixes
Various vb2 fixes. I've asked Marek if I could take care of these since I have more vb2 patches pending. Regards, Hans The following changes since commit 3f823e094b935c1882605f8720336ee23433a16d: [media] exynos4-is: Simplify fimc-is hardware polling helpers (2013-12-04 15:54:19 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git vb2 for you to fetch changes up to 46b150a09ec3c12053a334e5f545cc84f3c959e3: videobuf2-dma-sg: Support io userptr operations on io memory (2013-12-09 13:25:18 +0100) Ricardo Ribalda (4): videobuf2-dma-sg: Fix typo on debug message vb2: Return 0 when streamon and streamoff are already on/off videobuf2: Add missing lock held on vb2_fop_release videobuf2-dma-sg: Support io userptr operations on io memory Seung-Woo Kim (1): videobuf2: Add log for size checking error in __qbuf_dmabuf drivers/media/platform/exynos4-is/fimc-capture.c | 2 +- drivers/media/platform/exynos4-is/fimc-lite.c| 2 +- drivers/media/v4l2-core/videobuf2-core.c | 25 - drivers/media/v4l2-core/videobuf2-dma-sg.c | 53 - include/media/videobuf2-core.h | 1 + 5 files changed, 71 insertions(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.13] vb2: regression fixes
Mauro, Please queue these regression fixes for 3.13. This supersedes my previous earlier 3.13 pull request of today, since I realized that the 'fix possible memory leak' patch should also go to 3.13. Regards, Hans The following changes since commit 3f823e094b935c1882605f8720336ee23433a16d: [media] exynos4-is: Simplify fimc-is hardware polling helpers (2013-12-04 15:54:19 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git vb2fix for you to fetch changes up to 891e9e548afe4aea0152f958ff468798a4b76735: videobuf2-dma-sg: fix possible memory leak (2013-12-09 12:40:02 +0100) Geyslan G. Bem (1): videobuf2-dma-sg: fix possible memory leak Hans Verkuil (1): vb2: regression fix: always set length field. drivers/media/v4l2-core/videobuf2-core.c | 21 - drivers/media/v4l2-core/videobuf2-dma-sg.c | 3 ++- 2 files changed, 22 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Can't open mfc v5 encode but decode can
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 ? 2013?12?05? 17:36, Kamil Debski ??: > Hi Randy, > >> -Original Message- From: randy >> [mailto:lxr1...@hotmail.com] Sent: Thursday, December 05, 2013 >> 1:27 AM To: linux-media@vger.kernel.org Cc: Kamil Debski; >> m.szyprow...@samsung.com; kyungmin.p...@samsung.com; >> m.che...@samsung.com; jtp.p...@samsung.com Subject: Re: Can't >> open mfc v5 encode but decode can >> >> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> >> ? 2013?12?03? 18:44, Kamil Debski ??: >>> Hi Randy, >>> >>> We also experienced this issue. One of the changes in the v4l2 >>> core affected the MFC driver. A fix for MFC has been prepared >>> by Marek Szyprowski and should be sent out soon. >>> >> When it is sending, may you CC me, I will test it. >>> Also another tip - in 3.13 a check on bytesused and length >>> fields in planes array has been implemented. So make sure to >>> set them appropriately. >>> >>> Best wishes, >> >> Could you give me some example code of using samsung mfc v5 >> encode? I only get some sample from samsung BSP's android-4.2.2, >> in hardware/samsung_slsi/exynos4/multimedia/ , has >> codecs/video/exynos4/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c achived >> this? Thanks > > You can find the example applications here: > http://git.infradead.org/users/kmpark/public-apps > > Best wishes, Thank you. Well, mem2mem device seems hard to use for me, I never use streaming before(I always use libv4l to do a read/write wrapper). I will some time to make it work in my program :) Thank you again for your help and work. Ayaka -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJSpZ2mAAoJEPb4VsMIzTzioU0IAMWLh0keqK5z0C/FVPS8nJRA yoaeMRwU0TTMe0gqsWkys+rg4o4Aec0aSQAhstolQuj80Btc511WKueq0e+l6R3/ wVsBiGaPNzsG5bgbcLwk5grY8R1I1ID534rMiKIBiz/2uW1D+OMYTq6mvnAExJMG OdeGalb/KWm4SFMSHXj8iGr6f+8x7YzrrHaBfJB16KUEKDLcH0VdKWgDxmAgRrUY fTzBtum2tvld/EYZhOt7QrPkVq1z0/s9xiZoPE2eIDEC42XGbmAwOZClUzFMD6cV KAfRAWI3uWp4QetZMXh4X/rynYc8ppL0otjDnCUcWhdtmN/+QR2NDeyqO3EQfNY= =YL7b -END PGP SIGNATURE- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH][RESEND] [media] davinci: vpfe: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag It's a NOOP since 2.6.35 and it will be removed one day. Signed-off-by: Michael Opdenacker Acked-by: Lad, Prabhakar --- drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c index d8ce20d2fbda..cda8388cbb89 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c @@ -298,7 +298,7 @@ static int vpfe_attach_irq(struct vpfe_device *vpfe_dev) { int ret = 0; - ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, IRQF_DISABLED, + ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, 0, "vpfe_capture0", vpfe_dev); if (ret < 0) { v4l2_err(&vpfe_dev->v4l2_dev, @@ -306,7 +306,7 @@ static int vpfe_attach_irq(struct vpfe_device *vpfe_dev) return ret; } - ret = request_irq(vpfe_dev->ccdc_irq1, vpfe_vdint1_isr, IRQF_DISABLED, + ret = request_irq(vpfe_dev->ccdc_irq1, vpfe_vdint1_isr, 0, "vpfe_capture1", vpfe_dev); if (ret < 0) { v4l2_err(&vpfe_dev->v4l2_dev, @@ -316,7 +316,7 @@ static int vpfe_attach_irq(struct vpfe_device *vpfe_dev) } ret = request_irq(vpfe_dev->imp_dma_irq, vpfe_imp_dma_isr, - IRQF_DISABLED, "Imp_Sdram_Irq", vpfe_dev); + 0, "Imp_Sdram_Irq", vpfe_dev); if (ret < 0) { v4l2_err(&vpfe_dev->v4l2_dev, "Error: requesting IMP IRQ interrupt\n"); -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.14] New si4713-usb driver
Hi Mauro, I'm trying again to get this driver merged. The comments you made have all been addressed, so hopefully this will now be OK. Regards, Hans The following changes since commit 3f823e094b935c1882605f8720336ee23433a16d: [media] exynos4-is: Simplify fimc-is hardware polling helpers (2013-12-04 15:54:19 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git si4713 for you to fetch changes up to 8789394c0a0261ac35770212ab19172a2bd76ac1: si4713: coding style cleanups (2013-12-09 10:01:58 +0100) Dinesh Ram (8): si4713: Reorganized drivers/media/radio directory si4713: Modified i2c driver to handle cases where interrupts are not used si4713: Reorganized includes in si4713.c/h si4713: Bug fix for si4713_tx_tune_power() method in the i2c driver si4713: HID blacklist Si4713 USB development board si4713: Added the USB driver for Si4713 si4713: Added MAINTAINERS entry for radio-usb-si4713 driver si4713: move supply list to si4713_platform_data Eduardo Valentin (1): si4713: print product number Hans Verkuil (2): si4713: si4713_set_rds_radio_text overwrites terminating \0 si4713: coding style cleanups MAINTAINERS| 12 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 7 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 2 + drivers/media/radio/Kconfig| 29 +-- drivers/media/radio/Makefile | 3 +- drivers/media/radio/si4713/Kconfig | 40 drivers/media/radio/si4713/Makefile| 7 + drivers/media/radio/{radio-si4713.c => si4713/radio-platform-si4713.c} | 0 drivers/media/radio/si4713/radio-usb-si4713.c | 540 + drivers/media/radio/{si4713-i2c.c => si4713/si4713.c} | 279 ++- drivers/media/radio/{si4713-i2c.h => si4713/si4713.h} | 4 +- include/media/si4713.h | 2 + 13 files changed, 771 insertions(+), 155 deletions(-) create mode 100644 drivers/media/radio/si4713/Kconfig create mode 100644 drivers/media/radio/si4713/Makefile rename drivers/media/radio/{radio-si4713.c => si4713/radio-platform-si4713.c} (100%) create mode 100644 drivers/media/radio/si4713/radio-usb-si4713.c rename drivers/media/radio/{si4713-i2c.c => si4713/si4713.c} (86%) rename drivers/media/radio/{si4713-i2c.h => si4713/si4713.h} (98%) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.13] vb2: regression fix: always set length field.
Mauro, Please queue this regression fix for 3.13. Regards, Hans The following changes since commit 3f823e094b935c1882605f8720336ee23433a16d: [media] exynos4-is: Simplify fimc-is hardware polling helpers (2013-12-04 15:54:19 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git vb2fix for you to fetch changes up to acc386d22c031646e3c8678c5a6c31f468ff5ea7: vb2: regression fix: always set length field. (2013-12-09 09:53:21 +0100) Hans Verkuil (1): vb2: regression fix: always set length field. drivers/media/v4l2-core/videobuf2-core.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][RESEND 5/8] uio: uio_pruss: use gen_pool_dma_alloc() to allocate sram memory
On Fri, Nov 01, 2013 at 07:48:18PM +0800, Nicolin Chen wrote: > Since gen_pool_dma_alloc() is introduced, we implement it to simplify code. > > Signed-off-by: Nicolin Chen > --- Acked-by: Greg Kroah-Hartman -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html