public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v13 3/5] media: renesas: vsp1: Add support for VSP software version
Date: Sat, 27 Aug 2022 03:48:42 +0300	[thread overview]
Message-ID: <Ywlp6i8xYg7rAIt1@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220825132144.2619239-4-biju.das.jz@bp.renesas.com>

Hi Biju,

Thank you for the patch.

On Thu, Aug 25, 2022 at 02:21:42PM +0100, Biju Das wrote:
> The VSPD block on RZ/G2L SoCs does not have a version register.
> 
> This patch adds support for adding VSP software version based on
> device match.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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

> ---
> v12->v13:
>  * No change
> v11->v12:
>  * No change
> v10->v11:
>  * No change
> v9->v10:
>  * No change
> v8->v9:
>  * Added Rb tag from Geert
>  * Updated commit description RZ/G2L -> RZ/G2L SoCs.
>  * Replaced break with return info in case a Model match is found and
>    removed additional check for non-match case.
> v8:
>  * New patch
> ---
>  drivers/media/platform/renesas/vsp1/vsp1.h    |  1 +
>  .../media/platform/renesas/vsp1/vsp1_drv.c    | 43 +++++++++++++------
>  .../media/platform/renesas/vsp1/vsp1_regs.h   |  2 +
>  3 files changed, 33 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1.h b/drivers/media/platform/renesas/vsp1/vsp1.h
> index baf898d577ec..ff4435705abb 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1.h
> +++ b/drivers/media/platform/renesas/vsp1/vsp1.h
> @@ -67,6 +67,7 @@ struct vsp1_device_info {
>  	unsigned int uif_count;
>  	unsigned int wpf_count;
>  	unsigned int num_bru_inputs;
> +	u8 soc;
>  	bool uapi;
>  };
>  
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media/platform/renesas/vsp1/vsp1_drv.c
> index 975e6851735e..223dd5f557ba 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c
> @@ -817,11 +817,39 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
>  	},
>  };
>  
> +static const struct vsp1_device_info *vsp1_lookup_info(struct vsp1_device *vsp1)
> +{
> +	const struct vsp1_device_info *info;
> +	unsigned int i;
> +
> +	/*
> +	 * Try the info stored in match data first for devices that don't have
> +	 * a version register.
> +	 */
> +	info = of_device_get_match_data(vsp1->dev);
> +	if (info) {
> +		vsp1->version = VI6_IP_VERSION_VSP_SW | info->version | info->soc;
> +		return info;
> +	}
> +
> +	vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION);
> +
> +	for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) {
> +		info = &vsp1_device_infos[i];
> +
> +		if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == info->version)
> +			return info;
> +	}
> +
> +	dev_err(vsp1->dev, "unsupported IP version 0x%08x\n", vsp1->version);
> +
> +	return NULL;
> +}
> +
>  static int vsp1_probe(struct platform_device *pdev)
>  {
>  	struct vsp1_device *vsp1;
>  	struct device_node *fcp_node;
> -	unsigned int i;
>  	int ret;
>  	int irq;
>  
> @@ -877,19 +905,8 @@ static int vsp1_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		goto done;
>  
> -	vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION);
> -
> -	for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) {
> -		if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) ==
> -		    vsp1_device_infos[i].version) {
> -			vsp1->info = &vsp1_device_infos[i];
> -			break;
> -		}
> -	}
> -
> +	vsp1->info = vsp1_lookup_info(vsp1);
>  	if (!vsp1->info) {
> -		dev_err(&pdev->dev, "unsupported IP version 0x%08x\n",
> -			vsp1->version);
>  		vsp1_device_put(vsp1);
>  		ret = -ENXIO;
>  		goto done;
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_regs.h b/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> index fae7286eb01e..4286d13eca32 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> @@ -781,6 +781,8 @@
>  #define VI6_IP_VERSION_SOC_E3		(0x04 << 0)
>  #define VI6_IP_VERSION_SOC_V3U		(0x05 << 0)
>  
> +#define VI6_IP_VERSION_VSP_SW		(0xfffe << 16) /* SW VSP version */
> +
>  /* -----------------------------------------------------------------------------
>   * RPF CLUT Registers
>   */

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-08-27  0:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 13:21 [PATCH v13 0/5] Add support for RZ/G2L VSPD Biju Das
2022-08-25 13:21 ` [PATCH v13 1/5] media: dt-bindings: media: renesas,vsp1: Document RZ/G2L VSPD bindings Biju Das
2022-08-25 13:58   ` Krzysztof Kozlowski
2022-08-25 13:21 ` [PATCH v13 2/5] media: renesas: vsp1: Add support to deassert/assert reset line Biju Das
2022-08-25 13:30   ` Philipp Zabel
2022-08-27  0:45   ` Laurent Pinchart
2022-08-27 16:07     ` Biju Das
2022-08-27 18:26       ` Laurent Pinchart
2022-08-25 13:21 ` [PATCH v13 3/5] media: renesas: vsp1: Add support for VSP software version Biju Das
2022-08-27  0:48   ` Laurent Pinchart [this message]
2022-08-25 13:21 ` [PATCH v13 4/5] media: renesas: vsp1: Add VSP1_HAS_NON_ZERO_LBA feature bit Biju Das
2022-08-27  0:55   ` Laurent Pinchart
2022-08-27 16:10     ` Biju Das
2022-08-25 13:21 ` [PATCH v13 5/5] media: renesas: vsp1: Add support for RZ/G2L VSPD Biju Das
2022-08-27  0:56   ` Laurent Pinchart

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=Ywlp6i8xYg7rAIt1@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    /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