From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: hans@jjverkuil.nl, laurent.pinchart@ideasonboard.com,
Prabhakar <prabhakar.csengg@gmail.com>,
"Kate Hsuan" <hpa@redhat.com>,
"Alexander Shiyan" <eagle.alexander923@gmail.com>,
"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
"Tommaso Merciai" <tomm.merciai@gmail.com>,
"Umang Jain" <umang.jain@ideasonboard.com>,
"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
"Julien Massot" <julien.massot@collabora.com>,
"Naushir Patuck" <naush@raspberrypi.com>,
"Yan, Dongcheng" <dongcheng.yan@intel.com>,
"Cao, Bingbu" <bingbu.cao@intel.com>,
"Qiu, Tian Shu" <tian.shu.qiu@intel.com>,
"Wang, Hongju" <hongju.wang@intel.com>,
"Stefan Klug" <stefan.klug@ideasonboard.com>,
"Mirela Rabulea" <mirela.rabulea@nxp.com>,
"André Apitzsch" <git@apitzsch.eu>,
"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
"Stanislaw Gruszka" <stanislaw.gruszka@linux.intel.com>,
"Mehdi Djait" <mehdi.djait@linux.intel.com>,
"Ricardo Ribalda Delgado" <ribalda@kernel.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"Jacopo Mondi" <jacopo.mondi@ideasonboard.com>,
"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>
Subject: [PATCH v11 10/66] media: ccs: Use {enable,disable}_streams operations
Date: Mon, 25 Aug 2025 12:50:11 +0300 [thread overview]
Message-ID: <20250825095107.1332313-11-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20250825095107.1332313-1-sakari.ailus@linux.intel.com>
Switch from s_stream() video op to enable_streams() and disable_streams()
pad operations. They are preferred and required for streams support.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/i2c/ccs/ccs-core.c | 83 ++++++++++++++------------------
1 file changed, 36 insertions(+), 47 deletions(-)
diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index 6cf60e1758b4..56c9f7124b2a 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -1711,7 +1711,7 @@ static int ccs_power_off(struct device *dev)
}
/* -----------------------------------------------------------------------------
- * Video stream management
+ * V4L2 subdev video operations
*/
static int ccs_pm_get_init(struct ccs_sensor *sensor)
@@ -1735,11 +1735,11 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor)
sensor->handler_setup_needed = false;
/* Restore V4L2 controls to the previously suspended device */
- rval = v4l2_ctrl_handler_setup(&sensor->pixel_array->ctrl_handler);
+ rval = __v4l2_ctrl_handler_setup(&sensor->pixel_array->ctrl_handler);
if (rval)
goto error;
- rval = v4l2_ctrl_handler_setup(&sensor->src->ctrl_handler);
+ rval = __v4l2_ctrl_handler_setup(&sensor->src->ctrl_handler);
if (rval)
goto error;
@@ -1751,13 +1751,21 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor)
return rval;
}
-static int ccs_start_streaming(struct ccs_sensor *sensor)
+static int ccs_enable_streams(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_state *state, u32 pad,
+ u64 streams_mask)
{
+ struct ccs_sensor *sensor = to_ccs_sensor(subdev);
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
unsigned int binning_mode;
int rval;
- mutex_lock(&sensor->mutex);
+ if (pad != CCS_PAD_SRC)
+ return -EINVAL;
+
+ rval = ccs_pm_get_init(sensor);
+ if (rval)
+ return rval;
rval = ccs_write(sensor, CSI_DATA_FORMAT,
(sensor->csi_format->width << 8) |
@@ -1876,64 +1884,41 @@ static int ccs_start_streaming(struct ccs_sensor *sensor)
rval = ccs_write(sensor, MODE_SELECT, CCS_MODE_SELECT_STREAMING);
-err_pm_put:
- mutex_unlock(&sensor->mutex);
-
- return rval;
-}
-
-static int ccs_stop_streaming(struct ccs_sensor *sensor)
-{
- struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
- int rval;
+ sensor->streaming = true;
- mutex_lock(&sensor->mutex);
- rval = ccs_write(sensor, MODE_SELECT, CCS_MODE_SELECT_SOFTWARE_STANDBY);
- if (rval)
- goto out;
+ return 0;
- rval = ccs_call_quirk(sensor, post_streamoff);
- if (rval)
- dev_err(&client->dev, "post_streamoff quirks failed\n");
+err_pm_put:
+ pm_runtime_mark_last_busy(&client->dev);
+ pm_runtime_put_autosuspend(&client->dev);
-out:
- mutex_unlock(&sensor->mutex);
return rval;
}
-/* -----------------------------------------------------------------------------
- * V4L2 subdev video operations
- */
-
-static int ccs_set_stream(struct v4l2_subdev *subdev, int enable)
+static int ccs_disable_streams(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_state *state, u32 pad,
+ u64 streams_mask)
{
struct ccs_sensor *sensor = to_ccs_sensor(subdev);
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
int rval;
- if (!enable) {
- ccs_stop_streaming(sensor);
- sensor->streaming = false;
- pm_runtime_mark_last_busy(&client->dev);
- pm_runtime_put_autosuspend(&client->dev);
-
- return 0;
- }
+ if (pad != CCS_PAD_SRC)
+ return -EINVAL;
- rval = ccs_pm_get_init(sensor);
+ rval = ccs_write(sensor, MODE_SELECT, CCS_MODE_SELECT_SOFTWARE_STANDBY);
if (rval)
return rval;
- sensor->streaming = true;
+ rval = ccs_call_quirk(sensor, post_streamoff);
+ if (rval)
+ dev_err(&client->dev, "post_streamoff quirks failed\n");
- rval = ccs_start_streaming(sensor);
- if (rval < 0) {
- sensor->streaming = false;
- pm_runtime_mark_last_busy(&client->dev);
- pm_runtime_put_autosuspend(&client->dev);
- }
+ sensor->streaming = false;
+ pm_runtime_mark_last_busy(&client->dev);
+ pm_runtime_put_autosuspend(&client->dev);
- return rval;
+ return 0;
}
static int ccs_pre_streamon(struct v4l2_subdev *subdev, u32 flags)
@@ -1959,7 +1944,9 @@ static int ccs_pre_streamon(struct v4l2_subdev *subdev, u32 flags)
}
}
+ mutex_lock(&sensor->mutex);
rval = ccs_pm_get_init(sensor);
+ mutex_unlock(&sensor->mutex);
if (rval)
return rval;
@@ -3039,7 +3026,7 @@ static int ccs_init_state(struct v4l2_subdev *sd,
}
static const struct v4l2_subdev_video_ops ccs_video_ops = {
- .s_stream = ccs_set_stream,
+ .s_stream = v4l2_subdev_s_stream_helper,
.pre_streamon = ccs_pre_streamon,
.post_streamoff = ccs_post_streamoff,
};
@@ -3050,6 +3037,8 @@ static const struct v4l2_subdev_pad_ops ccs_pad_ops = {
.set_fmt = ccs_set_format,
.get_selection = ccs_get_selection,
.set_selection = ccs_set_selection,
+ .enable_streams = ccs_enable_streams,
+ .disable_streams = ccs_disable_streams,
};
static const struct v4l2_subdev_sensor_ops ccs_sensor_ops = {
--
2.47.2
next prev parent reply other threads:[~2025-08-25 9:51 UTC|newest]
Thread overview: 147+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 9:50 [PATCH v11 00/66] Generic line based metadata support, internal pads Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 01/66] media: Documentation: Clean up figure titles Sakari Ailus
2025-09-01 11:11 ` Jacopo Mondi
2025-09-03 13:00 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 02/66] media: Documentation: Fix routing documentation flag references Sakari Ailus
2025-09-01 11:14 ` Jacopo Mondi
2025-09-03 13:01 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 03/66] media: Documentation: There are either immutable or mutable routes Sakari Ailus
2025-09-01 11:18 ` Jacopo Mondi
2025-09-02 9:38 ` Sakari Ailus
2025-09-03 13:22 ` Laurent Pinchart
2025-09-03 14:09 ` Sakari Ailus
2025-09-03 14:12 ` Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 04/66] media: Documentation: Document -ENXIO for VIDIOC_SUBDEV_S_ROUTING Sakari Ailus
2025-09-01 11:33 ` Jacopo Mondi
2025-09-02 10:00 ` Sakari Ailus
2025-09-03 13:47 ` Laurent Pinchart
2025-09-03 14:15 ` Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 05/66] media: v4l2-subdev: Extend VIDIOC_SUBDEV_S_ROUTING error codes Sakari Ailus
2025-09-01 11:35 ` Jacopo Mondi
2025-09-03 13:53 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 06/66] media: ccs: No need to set streaming to false in power off Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 07/66] media: ccs: Move ccs_pm_get_init function up Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 08/66] media: ccs: Rename out label of ccs_start_streaming Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 09/66] media: ccs: Move ccs_validate_csi_data_format up Sakari Ailus
2025-08-25 9:50 ` Sakari Ailus [this message]
2025-08-25 9:50 ` [PATCH v11 11/66] media: ccs: Track streaming state Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 12/66] media: ccs: Support frame descriptors Sakari Ailus
2025-09-01 12:06 ` Jacopo Mondi
2025-09-02 12:26 ` Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 13/66] media: mc: Add INTERNAL pad flag Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 14/66] media: Documentation: Refer to internal pads in metadata documentation Sakari Ailus
2025-09-01 12:08 ` Jacopo Mondi
2025-09-02 12:58 ` Sakari Ailus
2025-09-03 14:01 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 15/66] media: uapi: Add generic CSI-2 raw pixelformats Sakari Ailus
2025-09-01 13:25 ` Jacopo Mondi
2025-09-02 13:16 ` Sakari Ailus
2025-09-03 14:20 ` Laurent Pinchart
2025-09-03 14:30 ` Sakari Ailus
2025-09-02 13:16 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 16/66] media: Documentation: Reference color pattern control in format docs Sakari Ailus
2025-09-01 13:51 ` Jacopo Mondi
2025-09-03 14:25 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 17/66] media: uapi: Add new media bus codes for generic raw formats Sakari Ailus
2025-09-01 14:12 ` Jacopo Mondi
2025-09-03 9:27 ` Sakari Ailus
2025-09-03 14:32 ` Laurent Pinchart
2025-09-03 14:35 ` Sakari Ailus
2025-09-03 14:39 ` Laurent Pinchart
2025-09-03 14:38 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 18/66] media: uapi: Add V4L2_CID_CONFIG_MODEL control Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 19/66] media: uapi: Add V4L2_CID_COLOR_PATTERN for describing color patterns Sakari Ailus
2025-09-03 15:05 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 20/66] media: Documentation: Reference COLOR_PATTERN control in raw format docs Sakari Ailus
2025-09-01 14:21 ` Jacopo Mondi
2025-09-03 10:03 ` Sakari Ailus
2025-09-03 12:03 ` Jacopo Mondi
2025-09-03 15:10 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 21/66] media: v4l: uapi: Add a control for color pattern flipping effect Sakari Ailus
2025-09-01 14:34 ` Jacopo Mondi
2025-09-03 10:25 ` Sakari Ailus
2025-09-03 10:40 ` Sakari Ailus
2025-09-03 12:18 ` Jacopo Mondi
2025-09-03 12:38 ` Sakari Ailus
2025-09-03 12:37 ` Jacopo Mondi
2025-09-03 13:25 ` Sakari Ailus
2025-09-03 15:28 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 22/66] media: Documentation: Reference flipping controls in raw format docs Sakari Ailus
2025-09-02 13:06 ` Jacopo Mondi
2025-09-03 15:31 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 23/66] media: Documentation: Document raw mbus codes and CFA for cameras Sakari Ailus
2025-09-01 14:59 ` Jacopo Mondi
2025-09-03 11:00 ` Sakari Ailus
2025-09-03 15:35 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 24/66] media: uapi: Add V4L2_CID_METADATA_LAYOUT control Sakari Ailus
2025-09-01 15:07 ` Jacopo Mondi
2025-09-03 11:13 ` Sakari Ailus
2025-09-03 19:52 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 25/66] media: Documentation: v4l: Document internal sink pads Sakari Ailus
2025-09-01 16:39 ` Jacopo Mondi
2025-09-03 12:17 ` Sakari Ailus
2025-09-03 12:29 ` Jacopo Mondi
2025-09-03 13:27 ` Sakari Ailus
2025-09-03 20:24 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 26/66] media: Documentation: Document embedded data guidelines for camera sensors Sakari Ailus
2025-09-01 16:42 ` Jacopo Mondi
2025-09-03 13:37 ` Sakari Ailus
2025-09-03 20:40 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 27/66] media: uapi: ccs: Add metadata layout for MIPI CCS embedded data Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 28/66] media: Documentation: Document non-CCS use of CCS embedded data layout Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 29/66] media: ccs: Add support for embedded data stream Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 30/66] media: Documentation: ccs: Document routing Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 31/66] media: ccs: Remove ccs_get_crop_compose helper Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 32/66] media: ccs: Rely on sub-device state locking Sakari Ailus
2025-09-03 20:56 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 33/66] media: ccs: Compute binning configuration from sub-device state Sakari Ailus
2025-09-03 21:00 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 34/66] media: ccs: Compute scaling " Sakari Ailus
2025-09-03 21:02 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 35/66] media: ccs: Remove which parameter from ccs_propagate Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 36/66] media: ccs: Detemine emb_data_ctrl register from sub-device state Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 37/66] media: uapi: Correct generic CSI-2 metadata format 4cc Sakari Ailus
2025-09-01 16:45 ` Jacopo Mondi
2025-09-03 21:35 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 38/66] Revert "media: uapi: v4l: Don't expose generic metadata formats to userspace" Sakari Ailus
2025-09-01 16:46 ` Jacopo Mondi
2025-09-03 21:36 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 39/66] media: Documentation: Add subdev configuration models, raw sensor model Sakari Ailus
2025-09-01 17:09 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 40/66] media: Document enable_streams and disable_streams behaviour Sakari Ailus
2025-09-01 17:11 ` Jacopo Mondi
2025-09-03 21:29 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 41/66] media: Documentation: Add scaling and post-scaler crop for common raw Sakari Ailus
2025-09-01 17:12 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 42/66] media: uapi: Add MIPI CCS configuration model Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 43/66] media: uapi: Add V4L2_CID_BINNING control for binning configuration Sakari Ailus
2025-09-01 17:27 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 44/66] media: uapi: Add controls for sub-sampling configuration Sakari Ailus
2025-09-01 17:29 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 45/66] media: Documentation: Add binning and sub-sampling controls Sakari Ailus
2025-09-01 17:30 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 46/66] media: uapi: Add metadata layout for ov2740 embedded data Sakari Ailus
2025-09-03 21:43 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 47/66] media: ov2740: Add support for " Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 48/66] media: ov2740: Add support for generic raw formats Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 49/66] media: ov2740: Add metadata layout control Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 50/66] media: ov2740: Add support for G_SELECTION IOCTL Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 51/66] media: v4l: Add V4L2_SUBDEV_ROUTE_FL_IMMUTABLE sub-device routing flag Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 52/66] media: v4l: Add V4L2_SUBDEV_ROUTE_FL_STATIC " Sakari Ailus
2025-09-01 17:32 ` Jacopo Mondi
2025-09-03 21:52 ` Laurent Pinchart
2025-08-25 9:50 ` [PATCH v11 53/66] media: Documentation: Document IMMUTABLE and STATIC route flags Sakari Ailus
2025-09-01 17:35 ` Jacopo Mondi
2025-08-25 9:50 ` [PATCH v11 54/66] media: uapi: v4l: subdev: Enable streams API Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 55/66] media: ccs: Add IMMUTABLE and STATIC route flags Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 56/66] media: ov2740: " Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 57/66] media: i2c: imx219: Inline imx219_update_pad_format() in its caller Sakari Ailus
2025-08-25 9:50 ` [PATCH v11 58/66] media: i2c: imx219: Add internal image sink pad Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 59/66] media: i2c: imx219: Add image stream Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 60/66] media: i2c: imx219: Report internal routes to userspace Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 61/66] media: i2c: imx219: Report streams using frame descriptors Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 62/66] media: i2c: imx219: Add embedded data support Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 63/66] media: imx219: Add support for generic raw formats Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 64/66] media: ccs: Add frame descriptor quirk Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 65/66] media: ipu6: Add support for luma-only formats Sakari Ailus
2025-08-25 9:51 ` [PATCH v11 66/66] media: ipu6: Add support for raw CFA-agnostic formats Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250825095107.1332313-11-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=benjamin.mugnier@foss.st.com \
--cc=bingbu.cao@intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dave.stevenson@raspberrypi.com \
--cc=dongcheng.yan@intel.com \
--cc=eagle.alexander923@gmail.com \
--cc=git@apitzsch.eu \
--cc=hans@jjverkuil.nl \
--cc=hdegoede@redhat.com \
--cc=heimir.sverrisson@gmail.com \
--cc=hongju.wang@intel.com \
--cc=hpa@redhat.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=julien.massot@collabora.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mehdi.djait@linux.intel.com \
--cc=mirela.rabulea@nxp.com \
--cc=naush@raspberrypi.com \
--cc=prabhakar.csengg@gmail.com \
--cc=ribalda@kernel.org \
--cc=stanislaw.gruszka@linux.intel.com \
--cc=stefan.klug@ideasonboard.com \
--cc=sylvain.petinot@foss.st.com \
--cc=tian.shu.qiu@intel.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tomm.merciai@gmail.com \
--cc=umang.jain@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).