Hi,
On 30/12/2025 10:32, Rishikesh Donadkar wrote:
> After draining, when a buffer is queued to the driver, ti will fill out
s/ti/it/
> the buffer with a partial frame as some part of the frame is drained.
> Return the partial frame with VB2_BUF_STATE_ERROR.
Makes sense, if we have to return a partial frame. It would be nicer to
be able to skip that frame altogether (draining it fully).
In any case, as Jai said, please squash.
Tomi
> Signed-off-by: Rishikesh Donadkar <r-donadkar@ti.com>
> ---
> 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");