public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Cc: "Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 4/6] media: vsp1: rwpf: Break out format handling
Date: Thu, 23 Jan 2025 23:50:19 +0200	[thread overview]
Message-ID: <20250123215019.GD10642@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250123-v4h-iif-v1-4-7b4e5299939f@ideasonboard.com>

Hi Jacopo,

Thank you for the patch.

On Thu, Jan 23, 2025 at 06:04:05PM +0100, Jacopo Mondi wrote:
> The current implementation of the r/wpf format handling assumes
> three formats to be supported in the RGB/YUV space.
> 
> With the forthcoming support for VSPX the r/wpf units will be
> used to fetch from exteranal memory images in RAW Bayer format

s/exteranal/external/

> and buffers of ISP configuration parameters.
> 
> Prepare for adding support for these new formats by breaking
> out the list of supported media bus codes in the vsp1_rwpf.c
> file.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  drivers/media/platform/renesas/vsp1/vsp1_rwpf.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
> index 9d38203e73d00b82a1a7db0353e2f0b5a94084f6..93b0ed5fd0da0c6a182dbbfe1e54eb8cfd66c493 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
> @@ -16,6 +16,12 @@
>  #define RWPF_MIN_WIDTH				1
>  #define RWPF_MIN_HEIGHT				1
>  
> +static const u32 rwpf_mbus_codes[] = {
> +	MEDIA_BUS_FMT_ARGB8888_1X32,
> +	MEDIA_BUS_FMT_AHSV8888_1X32,
> +	MEDIA_BUS_FMT_AYUV8_1X32,
> +};
> +
>  /* -----------------------------------------------------------------------------
>   * V4L2 Subdevice Operations
>   */
> @@ -24,16 +30,10 @@ static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev,
>  				    struct v4l2_subdev_state *sd_state,
>  				    struct v4l2_subdev_mbus_code_enum *code)
>  {
> -	static const unsigned int codes[] = {
> -		MEDIA_BUS_FMT_ARGB8888_1X32,
> -		MEDIA_BUS_FMT_AHSV8888_1X32,
> -		MEDIA_BUS_FMT_AYUV8_1X32,
> -	};
> -
> -	if (code->index >= ARRAY_SIZE(codes))
> +	if (code->index >= ARRAY_SIZE(rwpf_mbus_codes))
>  		return -EINVAL;
>  
> -	code->code = codes[code->index];
> +	code->code = rwpf_mbus_codes[code->index];
>  
>  	return 0;
>  }
> @@ -57,6 +57,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
>  	struct vsp1_rwpf *rwpf = to_rwpf(subdev);
>  	struct v4l2_subdev_state *state;
>  	struct v4l2_mbus_framefmt *format;
> +	unsigned int i;
>  	int ret = 0;
>  
>  	mutex_lock(&rwpf->entity.lock);
> @@ -68,9 +69,11 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
>  	}
>  
>  	/* Default to YUV if the requested format is not supported. */
> -	if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 &&
> -	    fmt->format.code != MEDIA_BUS_FMT_AHSV8888_1X32 &&
> -	    fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32)
> +	for (i = 0; i < ARRAY_SIZE(rwpf_mbus_codes); ++i) {
> +		if (fmt->format.code == rwpf_mbus_codes[i])
> +			break;
> +	}
> +	if (i == ARRAY_SIZE(rwpf_mbus_codes))
>  		fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32;
>  
>  	format = v4l2_subdev_state_get_format(state, fmt->pad);
> 

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-01-23 21:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 17:04 [PATCH 0/6] media: renesas: vsp1: Add support for IIF Jacopo Mondi
2025-01-23 17:04 ` [PATCH 1/6] media: vsp1: Add support IIF ISP Interface Jacopo Mondi
2025-01-23 21:18   ` Laurent Pinchart
2025-01-23 17:04 ` [PATCH 2/6] media: vsp1: Enable FREE interrupt Jacopo Mondi
2025-01-23 21:33   ` Laurent Pinchart
2025-01-24  8:53     ` Jacopo Mondi
2025-01-23 17:04 ` [PATCH 3/6] media: vsp1: dl: Use singleshot DL for VSPX Jacopo Mondi
2025-01-23 21:44   ` Laurent Pinchart
2025-01-24  8:44     ` Jacopo Mondi
2025-01-24  9:21       ` Laurent Pinchart
2025-01-23 17:04 ` [PATCH 4/6] media: vsp1: rwpf: Break out format handling Jacopo Mondi
2025-01-23 21:50   ` Laurent Pinchart [this message]
2025-01-23 17:04 ` [PATCH 5/6] media: vsp1: rwpf: Support RAW Bayer and ISP config Jacopo Mondi
2025-01-23 21:54   ` Laurent Pinchart
2025-01-23 17:04 ` [PATCH 6/6] media: vsp1: rwpf: Support operations with IIF Jacopo Mondi
2025-01-23 22:49   ` Laurent Pinchart
2025-01-23 19:03 ` [PATCH 0/6] media: renesas: vsp1: Add support for IIF Niklas Söderlund

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=20250123215019.GD10642@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=jacopo.mondi+renesas@ideasonboard.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox