diff mbox series

[14/19] media: max9286: Implement .get_mbus_config()

Message ID 20240430103956.60190-15-jacopo.mondi@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [01/19] media: adv748x: Add support for active state | expand

Commit Message

Jacopo Mondi April 30, 2024, 10:39 a.m. UTC
Implement the .get_mbus_config() operation to allow the remote receiver
to retrieve the bus configuration.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 drivers/media/i2c/max9286.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Laurent Pinchart May 2, 2024, 6:37 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Tue, Apr 30, 2024 at 12:39:50PM +0200, Jacopo Mondi wrote:
> Implement the .get_mbus_config() operation to allow the remote receiver
> to retrieve the bus configuration.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

This looks good to me, but I expect changes in v2 to address the
comments on 13/19, so I won't add a R-b tag yet.

> ---
>  drivers/media/i2c/max9286.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> index 0e08a1041eed..a71f0aabd67d 100644
> --- a/drivers/media/i2c/max9286.c
> +++ b/drivers/media/i2c/max9286.c
> @@ -1072,6 +1072,20 @@ static int max9286_set_fmt(struct v4l2_subdev *sd,
>  	return ret;
>  }
>  
> +static int max9286_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
> +				   struct v4l2_mbus_config *config)
> +{
> +	struct max9286_priv *priv = sd_to_max9286(sd);
> +
> +	if (pad != MAX9286_SRC_PAD)
> +		return -EINVAL;
> +
> +	config->type = V4L2_MBUS_CSI2_DPHY;
> +	config->bus.mipi_csi2.num_data_lanes = priv->csi2_data_lanes;
> +
> +	return 0;
> +}
> +
>  static int max9286_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
>  				  struct v4l2_mbus_frame_desc *fd)
>  {
> @@ -1127,6 +1141,7 @@ static const struct v4l2_subdev_pad_ops max9286_pad_ops = {
>  	.enum_mbus_code = max9286_enum_mbus_code,
>  	.get_fmt	= v4l2_subdev_get_fmt,
>  	.set_fmt	= max9286_set_fmt,
> +	.get_mbus_config = max9286_get_mbus_config,
>  	.get_frame_interval = v4l2_subdev_get_frame_interval,
>  	.set_frame_interval = max9286_set_frame_interval,
>  	.get_frame_desc	= max9286_get_frame_desc,
diff mbox series

Patch

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 0e08a1041eed..a71f0aabd67d 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -1072,6 +1072,20 @@  static int max9286_set_fmt(struct v4l2_subdev *sd,
 	return ret;
 }
 
+static int max9286_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
+				   struct v4l2_mbus_config *config)
+{
+	struct max9286_priv *priv = sd_to_max9286(sd);
+
+	if (pad != MAX9286_SRC_PAD)
+		return -EINVAL;
+
+	config->type = V4L2_MBUS_CSI2_DPHY;
+	config->bus.mipi_csi2.num_data_lanes = priv->csi2_data_lanes;
+
+	return 0;
+}
+
 static int max9286_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
 				  struct v4l2_mbus_frame_desc *fd)
 {
@@ -1127,6 +1141,7 @@  static const struct v4l2_subdev_pad_ops max9286_pad_ops = {
 	.enum_mbus_code = max9286_enum_mbus_code,
 	.get_fmt	= v4l2_subdev_get_fmt,
 	.set_fmt	= max9286_set_fmt,
+	.get_mbus_config = max9286_get_mbus_config,
 	.get_frame_interval = v4l2_subdev_get_frame_interval,
 	.set_frame_interval = max9286_set_frame_interval,
 	.get_frame_desc	= max9286_get_frame_desc,