diff mbox series

[1/4] media: i2c: imx415: Add get_mbus_config() pad operation support

Message ID 20250219094637.607615-1-eagle.alexander923@gmail.com (mailing list archive)
State New
Headers show
Series [1/4] media: i2c: imx415: Add get_mbus_config() pad operation support | expand

Commit Message

Alexander Shiyan Feb. 19, 2025, 9:46 a.m. UTC
Allow the driver to report static media bus configuration using
pad get_mbus_config() operation.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/media/i2c/imx415.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Dave Stevenson Feb. 20, 2025, 4:09 p.m. UTC | #1
Hi Alexander

On Wed, 19 Feb 2025 at 09:57, Alexander Shiyan
<eagle.alexander923@gmail.com> wrote:
>
> Allow the driver to report static media bus configuration using
> pad get_mbus_config() operation.
>
> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> ---
>  drivers/media/i2c/imx415.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
> index 9f37779bd611..16a52900c61c 100644
> --- a/drivers/media/i2c/imx415.c
> +++ b/drivers/media/i2c/imx415.c
> @@ -1076,6 +1076,18 @@ static int imx415_init_state(struct v4l2_subdev *sd,
>         return 0;
>  }
>
> +static int imx415_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
> +                                 struct v4l2_mbus_config *config)
> +{
> +       struct imx415 *sensor = to_imx415(sd);
> +
> +       config->type = V4L2_MBUS_CSI2_DPHY;
> +       config->bus.mipi_csi2.flags = 0;
> +       config->bus.mipi_csi2.num_data_lanes = sensor->num_data_lanes;

I'll let others confirm, but I believe the expectation is that the
platform configuration would set this for both sensor and CSI2
receiver.
get_mbus_config is only used where the number of lanes can dynamically change.

I'm also trying to find confirmation in the IMX415 datasheet of
whether it drops to LP for the clock lane or not. If it does, then you
want to set V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK in the flags field.
It's not obviously mentioned, so I may resort to getting an
oscilloscope out on it.

  Dave

> +
> +       return 0;
> +}
> +
>  static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = {
>         .s_stream = imx415_s_stream,
>  };
> @@ -1086,6 +1098,7 @@ static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = {
>         .get_fmt = v4l2_subdev_get_fmt,
>         .set_fmt = imx415_set_format,
>         .get_selection = imx415_get_selection,
> +       .get_mbus_config = imx415_get_mbus_config,
>  };
>
>  static const struct v4l2_subdev_ops imx415_subdev_ops = {
> --
> 2.39.1
>
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
index 9f37779bd611..16a52900c61c 100644
--- a/drivers/media/i2c/imx415.c
+++ b/drivers/media/i2c/imx415.c
@@ -1076,6 +1076,18 @@  static int imx415_init_state(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int imx415_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
+				  struct v4l2_mbus_config *config)
+{
+	struct imx415 *sensor = to_imx415(sd);
+
+	config->type = V4L2_MBUS_CSI2_DPHY;
+	config->bus.mipi_csi2.flags = 0;
+	config->bus.mipi_csi2.num_data_lanes = sensor->num_data_lanes;
+
+	return 0;
+}
+
 static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = {
 	.s_stream = imx415_s_stream,
 };
@@ -1086,6 +1098,7 @@  static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = {
 	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = imx415_set_format,
 	.get_selection = imx415_get_selection,
+	.get_mbus_config = imx415_get_mbus_config,
 };
 
 static const struct v4l2_subdev_ops imx415_subdev_ops = {