Re: [PATCH 04/19] media: adv748x: Propagate format to opposite stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jacopo,

Thank you for the patch.

On Tue, Apr 30, 2024 at 12:39:40PM +0200, Jacopo Mondi wrote:
> Now that the adv748x-csi2 driver supports streams and routing, when a
> format is set on the sink pad, it gets propagated to the connected stream
> on the source pad.

As commented in the review of 01/19, this change belongs to that patch.

> Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
> ---
>  drivers/media/i2c/adv748x/adv748x-csi2.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
> index d929db7e8ef2..ace4e1d904d9 100644
> --- a/drivers/media/i2c/adv748x/adv748x-csi2.c
> +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
> @@ -167,20 +167,21 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
>  				   struct v4l2_subdev_state *sd_state,
>  				   struct v4l2_subdev_format *sdformat)
>  {
> -	struct v4l2_mbus_framefmt *mbusformat;
> +	struct v4l2_mbus_framefmt *fmt;
>  
> -	mbusformat = v4l2_subdev_state_get_format(sd_state, sdformat->pad);
> -
> -	/* Format on the source pad is always copied from the sink one. */
> -	if (sdformat->pad == ADV748X_CSI2_SOURCE) {
> -		const struct v4l2_mbus_framefmt *sink_fmt;
> +	/*
> +	 * The format set on the sink pad is propagated to the other end
> +	 * of the active route.
> +	 */
> +	if (sdformat->pad == ADV748X_CSI2_SOURCE)
> +		return -EINVAL;
>  
> -		sink_fmt = v4l2_subdev_state_get_format(sd_state,
> -							ADV748X_CSI2_SINK);
> -		sdformat->format = *sink_fmt;
> -	}
> +	fmt = v4l2_subdev_state_get_format(sd_state, sdformat->pad);
> +	*fmt = sdformat->format;
>  
> -	*mbusformat = sdformat->format;
> +	fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state,
> +							   sdformat->pad, 0);
> +	*fmt = sdformat->format;
>  
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux