]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rcar-vin: Remove superfluous starting state
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Mon, 10 Feb 2025 17:56:13 +0000 (18:56 +0100)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 25 Apr 2025 08:15:27 +0000 (10:15 +0200)
The STARTING state is superfluous and can be replaced with a check of
the sequence counter. The design idea is that the first buffer returned
from the driver have to come from the first hardware buffer slot.
Failing this the first 3 buffers queued to the device can be returned
out-of-order.

But it's much clearer to check the sequence counter to only return the
first buffer if it comes from hardware slot 0 then it is to carry around
an extra state just for this. Remove the unneeded state and replace it
with a simpler check.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/renesas/rcar-vin/rcar-dma.c
drivers/media/platform/renesas/rcar-vin/rcar-vin.h

index fc64f013ec050c9a8c3a97d69d2bcffcdf401719..125af7ae9fbf13b3130a8e1a00a6e9dc38c5f308 100644 (file)
@@ -1048,7 +1048,7 @@ static int rvin_capture_start(struct rvin_dev *vin)
        /* Continuous Frame Capture Mode */
        rvin_write(vin, VNFC_C_FRAME, VNFC_REG);
 
-       vin->state = STARTING;
+       vin->state = RUNNING;
 
        return 0;
 }
@@ -1104,14 +1104,13 @@ static irqreturn_t rvin_irq(int irq, void *data)
         * To hand buffers back in a known order to userspace start
         * to capture first from slot 0.
         */
-       if (vin->state == STARTING) {
+       if (!vin->sequence) {
                if (slot != 0) {
                        vin_dbg(vin, "Starting sync slot: %d\n", slot);
                        goto done;
                }
 
                vin_dbg(vin, "Capture start synced!\n");
-               vin->state = RUNNING;
        }
 
        /* Capture frame */
index 4cb25d8bbf327c94e1a48fc74225c4c072a4768f..f13ef379d095fd14cd6647788685987ac7149d07 100644 (file)
@@ -64,13 +64,11 @@ enum rvin_isp_id {
 /**
  * enum rvin_dma_state - DMA states
  * @STOPPED:   No operation in progress
- * @STARTING:  Capture starting up
  * @RUNNING:   Operation in progress have buffers
  * @STOPPING:  Stopping operation
  */
 enum rvin_dma_state {
        STOPPED = 0,
-       STARTING,
        RUNNING,
        STOPPING,
 };