diff mbox series

[2/5] media/i2c: max96717: implement the .get_frame_desc() operation

Message ID 20250207112958.2571600-3-laurentiu.palcu@oss.nxp.com (mailing list archive)
State New
Headers show
Series media/i2c: max96717: a few changes | expand

Commit Message

Laurentiu Palcu Feb. 7, 2025, 11:29 a.m. UTC
Since the max96717 serializer can work with various sensors, we need to
implement the .get_frame_desc() callback to get the VCs and DTs for the
incoming stream(s).

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
---
 drivers/media/i2c/max96717.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Julien Massot Feb. 18, 2025, 1:29 p.m. UTC | #1
Hi,

On Fri, 2025-02-07 at 13:29 +0200, Laurentiu Palcu wrote:
> Since the max96717 serializer can work with various sensors, we need to
> implement the .get_frame_desc() callback to get the VCs and DTs for the
> incoming stream(s).
> 
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
> ---
>  drivers/media/i2c/max96717.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/media/i2c/max96717.c b/drivers/media/i2c/max96717.c
> index b1116aade0687..6a668a004c717 100644
> --- a/drivers/media/i2c/max96717.c
> +++ b/drivers/media/i2c/max96717.c
> @@ -575,12 +575,33 @@ static int max96717_disable_streams(struct v4l2_subdev *sd,
>  	return 0;
>  }
>  
> +static int max96717_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> +				   struct v4l2_mbus_frame_desc *fd)
> +{
> +	struct max96717_priv *priv = sd_to_max96717(sd);
> +	int ret;
> +	struct v4l2_mbus_frame_desc source_fd;
> +
> +	if (pad != MAX96717_PAD_SOURCE)
> +		return -EINVAL;
> +
Please check priv->source_sd first, we support the case where we only have a test pattern from
the serializer. Then we can simply return the result of v4l2_subdev_call.

        return v4l2_subdev_call(priv->source_sd, pad, get_frame_desc,
			       priv->source_sd_pad, fd);

> +	ret = v4l2_subdev_call(priv->source_sd, pad, get_frame_desc,
> +			       priv->source_sd_pad, &source_fd);
> +	if (ret)
> +		return ret;
> +
> +	*fd = source_fd;
> +
> +	return 0;
> +}
> +
>  static const struct v4l2_subdev_pad_ops max96717_pad_ops = {
>  	.enable_streams = max96717_enable_streams,
>  	.disable_streams = max96717_disable_streams,
>  	.set_routing = max96717_set_routing,
>  	.get_fmt = v4l2_subdev_get_fmt,
>  	.set_fmt = max96717_set_fmt,
> +	.get_frame_desc = max96717_get_frame_desc,
>  };
>  
>  static const struct v4l2_subdev_core_ops max96717_subdev_core_ops = {

Regards,
diff mbox series

Patch

diff --git a/drivers/media/i2c/max96717.c b/drivers/media/i2c/max96717.c
index b1116aade0687..6a668a004c717 100644
--- a/drivers/media/i2c/max96717.c
+++ b/drivers/media/i2c/max96717.c
@@ -575,12 +575,33 @@  static int max96717_disable_streams(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int max96717_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
+				   struct v4l2_mbus_frame_desc *fd)
+{
+	struct max96717_priv *priv = sd_to_max96717(sd);
+	int ret;
+	struct v4l2_mbus_frame_desc source_fd;
+
+	if (pad != MAX96717_PAD_SOURCE)
+		return -EINVAL;
+
+	ret = v4l2_subdev_call(priv->source_sd, pad, get_frame_desc,
+			       priv->source_sd_pad, &source_fd);
+	if (ret)
+		return ret;
+
+	*fd = source_fd;
+
+	return 0;
+}
+
 static const struct v4l2_subdev_pad_ops max96717_pad_ops = {
 	.enable_streams = max96717_enable_streams,
 	.disable_streams = max96717_disable_streams,
 	.set_routing = max96717_set_routing,
 	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = max96717_set_fmt,
+	.get_frame_desc = max96717_get_frame_desc,
 };
 
 static const struct v4l2_subdev_core_ops max96717_subdev_core_ops = {