From: Cosmin Tanislav <demonsingur@gmail.com>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Cosmin Tanislav <demonsingur@gmail.com>
Subject: [PATCH v2 6/6] media: i2c: imx219: implement configurable VC ID
Date: Fri, 21 Feb 2025 01:08:14 +0200 [thread overview]
Message-ID: <20250220230818.275262-7-demonsingur@gmail.com> (raw)
In-Reply-To: <20250220230818.275262-1-demonsingur@gmail.com>
IMX219 supports configuring the Virtual Channel ID used for image and
embedded data streams.
Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
---
drivers/media/i2c/imx219.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 4c4ebe54f191b..ae93ac2bbe367 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -38,6 +38,8 @@
#define IMX219_MODE_STANDBY 0x00
#define IMX219_MODE_STREAMING 0x01
+#define IMX219_REG_CSI_CH_ID CCI_REG8(0x0110)
+
#define IMX219_REG_CSI_LANE_MODE CCI_REG8(0x0114)
#define IMX219_CSI_2_LANE_MODE 0x01
#define IMX219_CSI_4_LANE_MODE 0x03
@@ -363,6 +365,9 @@ struct imx219 {
/* Two or Four lanes */
u8 lanes;
+
+ /* Virtual channel ID */
+ u8 vc_id;
};
static inline struct imx219 *to_imx219(struct v4l2_subdev *_sd)
@@ -724,6 +729,12 @@ static int imx219_configure_lanes(struct imx219 *imx219)
ARRAY_SIZE(imx219_4lane_regs), NULL);
};
+static int imx219_configure_vc(struct imx219 *imx219)
+{
+ return cci_write(imx219->regmap, IMX219_REG_CSI_CH_ID,
+ imx219->vc_id, NULL);
+}
+
static int imx219_start_streaming(struct imx219 *imx219,
struct v4l2_subdev_state *state)
{
@@ -749,6 +760,13 @@ static int imx219_start_streaming(struct imx219 *imx219,
goto err_rpm_put;
}
+ /* Configure Virtual Channel ID */
+ ret = imx219_configure_vc(imx219);
+ if (ret) {
+ dev_err(&client->dev, "%s failed to configure vc\n", __func__);
+ goto err_rpm_put;
+ }
+
/* Apply format and crop settings. */
ret = imx219_set_framefmt(imx219, state);
if (ret) {
@@ -994,6 +1012,7 @@ static int imx219_init_state(struct v4l2_subdev *sd,
static int imx219_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
struct v4l2_mbus_frame_desc *fd)
{
+ struct imx219 *imx219 = to_imx219(sd);
struct v4l2_subdev_state *state;
u32 code;
@@ -1006,7 +1025,7 @@ static int imx219_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
fd->entry[0].pixelcode = code;
fd->entry[0].stream = 0;
- fd->entry[0].bus.csi2.vc = 0;
+ fd->entry[0].bus.csi2.vc = imx219->vc_id;
fd->entry[0].bus.csi2.dt = imx219_get_format_bpp(code) == 8
? MIPI_CSI2_DT_RAW8 : MIPI_CSI2_DT_RAW10;
@@ -1149,6 +1168,13 @@ static int imx219_check_hwcfg(struct device *dev, struct imx219 *imx219)
}
imx219->lanes = ep_cfg.bus.mipi_csi2.num_data_lanes;
+ if (ep_cfg.bus.mipi_csi2.num_vc_ids > 1) {
+ dev_err_probe(dev, -EINVAL,
+ "only 1 virtual channel id is supported\n");
+ goto error_out;
+ }
+ imx219->vc_id = ep_cfg.bus.mipi_csi2.vc_ids[0];
+
/* Check the link frequency set in device tree */
switch (imx219->lanes) {
case 2:
--
2.48.1
prev parent reply other threads:[~2025-02-20 23:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 23:08 [PATCH v2 0/6] media: v4l: add support for Virtual Channel IDs Cosmin Tanislav
2025-02-20 23:08 ` [PATCH v2 1/6] dt-bindings: media: video-interfaces: " Cosmin Tanislav
2025-02-21 8:38 ` Sakari Ailus
2025-02-21 8:55 ` Cosmin Tanislav
2025-02-21 14:27 ` Cosmin Tanislav
2025-02-24 21:40 ` Laurent Pinchart
2025-02-20 23:08 ` [PATCH v2 2/6] media: v4l: fwnode: parse Virtual Channel IDs for CSI2 buses Cosmin Tanislav
2025-02-20 23:08 ` [PATCH v2 3/6] dt-bindings: media: imx219: add support for Virtual Channel IDs Cosmin Tanislav
2025-02-20 23:08 ` [PATCH v2 4/6] media: i2c: imx219: pass format's code to imx219_get_format_bpp() Cosmin Tanislav
2025-02-21 7:03 ` Jai Luthra
2025-02-20 23:08 ` [PATCH v2 5/6] media: i2c: imx219: Report streams using frame descriptors Cosmin Tanislav
2025-02-26 8:52 ` Sakari Ailus
2025-02-20 23:08 ` Cosmin Tanislav [this message]
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=20250220230818.275262-7-demonsingur@gmail.com \
--to=demonsingur@gmail.com \
--cc=conor+dt@kernel.org \
--cc=dave.stevenson@raspberrypi.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sakari.ailus@linux.intel.com \
--cc=shawnguo@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.