media: davinci: vpif fixes
Subsystems (2)
cover media: davinci: vpif fixes
this patch series fixes several small issues in VPIF driver.
Lad, Prabhakar (5):
media: davinci: vpif_display: drop setting of vb2 buffer state to
ACTIVE
media: davinci: vpif_capture: drop setting of vb2 buffer state to
ACTIVE
media: videobuf2-core.h: add a helper to get status of
start_streaming()
media: davinci: vpif_display: fix the check on suspend/resume
callbacks
media: davinci: vpif_capture: fix the check on suspend/resume
callbacks
drivers/media/platform/davinci/vpif_capture.c | 7 ++----- drivers/media/platform/davinci/vpif_display.c | 8 ++------ include/media/videobuf2-core.h | 9 +++++++++ 3 files changed, 13 insertions(+), 11 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/5 media: davinci: vpif_display: drop setting of vb2 buffer state to ACTIVE
this patch drops setting of vb2 buffer state to VB2_BUF_STATE_ACTIVE, as any buffer queued to the driver is marked ACTIVE by the vb2 core.
--- drivers/media/platform/davinci/vpif_display.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/media/platform/davinci/vpif_display.c +0 -4
@@ -196,8 +196,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)list_del (&common->cur_frm->list);spin_unlock_irqrestore (&common->irqlock, flags); -/* Mark state of the current frame to active */ - common->cur_frm->vb.state =VB2_BUF_STATE_ACTIVE ; addr =vb2_dma_contig_plane_dma_addr (&common->cur_frm->vb,0 ); common->set_addr((addr + common->ytop_off),
@@ -306,8 +304,6 @@ static void process_progressive_mode(struct common_obj *common)/* Remove that buffer from the buffer queue */ list_del (&common->next_frm->list);spin_unlock (&common->irqlock); -/* Mark status of the buffer as active */ - common->next_frm->vb.state =VB2_BUF_STATE_ACTIVE ;/* Set top and bottom field addrs in VPIF registers */ addr =vb2_dma_contig_plane_dma_addr (&common->next_frm->vb,0 );
Signature · 1 line
1.9.1
PATCH 2/5 media: davinci: vpif_capture: drop setting of vb2 buffer state to ACTIVE
In reply to Lad, Prabhakarthis patch drops setting of vb2 buffer state to VB2_BUF_STATE_ACTIVE, as any buffer queued to the driver is marked ACTIVE by the vb2 core.
--- drivers/media/platform/davinci/vpif_capture.c | 3 --- 1 file changed, 3 deletions(-)
drivers/media/platform/davinci/vpif_capture.c +0 -3
@@ -213,8 +213,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)/* Remove buffer from the buffer queue */ list_del (&common->cur_frm->list);spin_unlock_irqrestore (&common->irqlock, flags); -/* Mark state of the current frame to active */ - common->cur_frm->vb.state =VB2_BUF_STATE_ACTIVE ; addr =vb2_dma_contig_plane_dma_addr (&common->cur_frm->vb,0 );
@@ -350,7 +348,6 @@ static void vpif_schedule_next_buffer(struct common_obj *common)/* Remove that buffer from the buffer queue */ list_del (&common->next_frm->list);spin_unlock (&common->irqlock); - common->next_frm->vb.state =VB2_BUF_STATE_ACTIVE ; addr =vb2_dma_contig_plane_dma_addr (&common->next_frm->vb,0 );/* Set top and bottom field addresses in VPIF registers */
Signature · 1 line
1.9.1
PATCH 3/5 media: videobuf2-core.h: add a helper to get status of start_streaming()
In reply to Lad, Prabhakarthis patch adds a helper to get the status if start_streaming() was called successfully.
--- include/media/videobuf2-core.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/media/videobuf2-core.h +9 -0
@@ -590,6 +590,15 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)return 0 ; } +/** +* vb2_start_streaming_called() - return streaming status of driver +* @q: videobuf queue +*/ +static inline bool vb2_start_streaming_called (struct vb2_queue *q) +{ +return q->start_streaming_called; +} +/* * The following functions are not part of the vb2 core API, but are simple * helper functions that you can use in your struct v4l2_file_operations,
Signature · 1 line
1.9.1
PATCH 4/5 media: davinci: vpif_display: fix the check on suspend/resume callbacks
In reply to Lad, PrabhakarIt is possible to call STREAMON without having any buffers queued. So vb2_is_streaming() can return true without start_streaming() having been called. Only after at least one buffer has been queued will start_streaming be called.
The check vb2_is_streaming() is incorrect as this would start the DMA without having proper DMA pointers set up. this patch uses vb2_start_streaming_called() instead to check is streaming was called.
--- drivers/media/platform/davinci/vpif_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpif_display.c +2 -2
@@ -1400,7 +1400,7 @@ static int vpif_suspend(struct device *dev) ch = vpif_obj.dev[i]; common = &ch->common[VPIF_VIDEO_INDEX ]; -if (!vb2_is_streaming (&common->buffer_queue)) +if (!vb2_start_streaming_called (&common->buffer_queue))continue ;mutex_lock (&common->lock);
@@ -1432,7 +1432,7 @@ static int vpif_resume(struct device *dev) ch = vpif_obj.dev[i]; common = &ch->common[VPIF_VIDEO_INDEX ]; -if (!vb2_is_streaming (&common->buffer_queue)) +if (!vb2_start_streaming_called (&common->buffer_queue))continue ;mutex_lock (&common->lock);
Signature · 1 line
1.9.1
PATCH 5/5 media: davinci: vpif_capture: fix the check on suspend/resume callbacks
In reply to Lad, PrabhakarIt is possible to call STREAMON without having any buffers queued. So vb2_is_streaming() can return true without start_streaming() having been called. Only after at least one buffer has been queued will start_streaming be called.
The check vb2_is_streaming() is incorrect as this would start the DMA without having proper DMA pointers set up. this patch uses vb2_start_streaming_called() instead to check is streaming was called.
--- drivers/media/platform/davinci/vpif_capture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpif_capture.c +2 -2
@@ -1596,7 +1596,7 @@ static int vpif_suspend(struct device *dev) ch = vpif_obj.dev[i]; common = &ch->common[VPIF_VIDEO_INDEX ]; -if (!vb2_is_streaming (&common->buffer_queue)) +if (!vb2_start_streaming_called (&common->buffer_queue))continue ;mutex_lock (&common->lock);
@@ -1630,7 +1630,7 @@ static int vpif_resume(struct device *dev) ch = vpif_obj.dev[i]; common = &ch->common[VPIF_VIDEO_INDEX ]; -if (!vb2_is_streaming (&common->buffer_queue)) +if (!vb2_start_streaming_called (&common->buffer_queue))continue ;mutex_lock (&common->lock);
Signature · 1 line
1.9.1
Re: [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming()
In reply to Lad, PrabhakarQuoted 2 lines · Prabhakar
this patch adds a helper to get the status if
start_streaming()was called successfully.
Nice! I've had the same idea for quite some time now, but for some reason I never got around to actually adding it.
Hans
Quoted 31 lines
Signed-off-by Lad, Prabhakar <[email protected]>Cc Pawel Osciak <[email protected]>Cc Marek Szyprowski <[email protected]>Cc Kyungmin Park <[email protected]>Cc Hans Verkuil <[email protected]>--- include/media/videobuf2-core.h | 9 +++++++++ 1 file changed, 9 insertions(+)include/media/videobuf2-core.h +9
-0@@ -590,6 +590,15 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)return 0 ; } +/** +* vb2_start_streaming_called() - return streaming status of driver +* @q: videobuf queue +*/ +static inline bool vb2_start_streaming_called (struct vb2_queue *q) +{ +return q->start_streaming_called; +} +/* * The following functions are not part of the vb2 core API, but are simple * helper functions that you can use in your struct v4l2_file_operations,