]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: ccs: Track streaming state
authorSakari Ailus <sakari.ailus@linux.intel.com>
Tue, 3 Oct 2023 09:46:19 +0000 (12:46 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 14 Jan 2026 22:33:04 +0000 (23:33 +0100)
With enable_streams and disable_streams, the driver for a device where
streams are not independently started and stopped needs to maintain state
information on streams that have been requested to be started. Do that
now.

In the future, a helper function in the framework is a desirable way to do
this instead.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/ccs/ccs-core.c
drivers/media/i2c/ccs/ccs.h

index 623fc97702058c1af6b9b5e3438107130b7eea45..a04763adad9189eba81698a56423f9d2900c9f94 100644 (file)
@@ -1761,6 +1761,11 @@ static int ccs_enable_streams(struct v4l2_subdev *subdev,
        if (pad != CCS_PAD_SRC)
                return -EINVAL;
 
+       if (sensor->streaming) {
+               sensor->streaming |= streams_mask;
+               return 0;
+       }
+
        rval = ccs_pm_get_init(sensor);
        if (rval)
                return rval;
@@ -1882,7 +1887,7 @@ static int ccs_enable_streams(struct v4l2_subdev *subdev,
 
        rval = ccs_write(sensor, MODE_SELECT, CCS_MODE_SELECT_STREAMING);
 
-       sensor->streaming = true;
+       sensor->streaming |= streams_mask;
 
        return 0;
 
@@ -1903,6 +1908,10 @@ static int ccs_disable_streams(struct v4l2_subdev *subdev,
        if (pad != CCS_PAD_SRC)
                return -EINVAL;
 
+       sensor->streaming &= ~streams_mask;
+       if (sensor->streaming)
+               return 0;
+
        rval = ccs_write(sensor, MODE_SELECT, CCS_MODE_SELECT_SOFTWARE_STANDBY);
        if (rval)
                return rval;
@@ -1911,7 +1920,6 @@ static int ccs_disable_streams(struct v4l2_subdev *subdev,
        if (rval)
                dev_err(&client->dev, "post_streamoff quirks failed\n");
 
-       sensor->streaming = false;
        pm_runtime_put_autosuspend(&client->dev);
 
        return 0;
@@ -3522,7 +3530,6 @@ static int ccs_probe(struct i2c_client *client)
                goto out_cleanup;
        }
 
-       sensor->streaming = false;
        sensor->dev_init_done = true;
        sensor->handler_setup_needed = true;
 
index 0726c4687f0f4680fc35017d418005a7f531276a..518482758da63ecccd88a3900b9babf8a335e7e8 100644 (file)
@@ -238,7 +238,7 @@ struct ccs_sensor {
        u16 image_start; /* image data start line */
        u16 visible_pixel_start; /* start pixel of the visible image */
 
-       bool streaming;
+       u8 streaming;
        bool dev_init_done;
        bool handler_setup_needed;
        u8 compressed_min_bpp;