media: ccs: Track streaming state

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>
This commit is contained in:
Sakari Ailus 2023-10-03 12:46:19 +03:00 committed by Hans Verkuil
parent 7d2909830e
commit 24b2208053
2 changed files with 11 additions and 4 deletions

View 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;

View 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;