Re: [PATCH v9 16/19] media: ti: j721e-csi2rx: Return the partial frame as error
From: Rishikesh Donadkar
Date: Thu Jan 08 2026 - 00:41:46 EST
On 06/01/26 16:45, Jai Luthra wrote:
Hi Rishikesh,
Hi Jai,
Thanks !
Quoting Rishikesh Donadkar (2025-12-30 14:02:17)
After draining, when a buffer is queued to the driver, ti will fill outThis should be squashed with the previous patch which changes the drain
the buffer with a partial frame as some part of the frame is drained.
Return the partial frame with VB2_BUF_STATE_ERROR.
architecture and leads to the partial frames. So for the combined patch:
Will do.
Regards,
Rishikesh
Reviewed-by: Jai Luthra <jai.luthra@xxxxxxxxxxxxxxxx>
Signed-off-by: Rishikesh Donadkar <r-donadkar@xxxxxx>
---
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
index e713293696eb1..3922bd67e78da 100644
--- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -83,6 +83,7 @@ struct ti_csi2rx_buffer {
enum ti_csi2rx_dma_state {
TI_CSI2RX_DMA_STOPPED, /* Streaming not started yet. */
TI_CSI2RX_DMA_ACTIVE, /* Streaming and pending DMA operation. */
+ TI_CSI2RX_DMA_DRAINING, /* Dumping all the data in drain buffer */
};
struct ti_csi2rx_dma {
@@ -728,12 +729,20 @@ static void ti_csi2rx_dma_callback(void *param)
spin_lock_irqsave(&dma->lock, flags);
WARN_ON(!list_is_first(&buf->list, &dma->submitted));
- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
+
+ if (dma->state == TI_CSI2RX_DMA_DRAINING) {
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
+ dma->state = TI_CSI2RX_DMA_ACTIVE;
+ } else {
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
+ }
+
list_del(&buf->list);
ti_csi2rx_dma_submit_pending(ctx);
if (list_empty(&dma->submitted)) {
+ dma->state = TI_CSI2RX_DMA_DRAINING;
if (ti_csi2rx_drain_dma(ctx))
dev_warn(ctx->csi->dev,
"DMA drain failed on one of the transactions\n");
--
2.34.1