lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250223181754.GC8330@pendragon.ideasonboard.com>
Date: Sun, 23 Feb 2025 20:17:54 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
Cc: tomm.merciai@...il.com, linux-renesas-soc@...r.kernel.org,
	linux-media@...r.kernel.org, biju.das.jz@...renesas.com,
	prabhakar.mahadev-lad.rj@...renesas.com,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Magnus Damm <magnus.damm@...il.com>,
	Hans Verkuil <hverkuil@...all.nl>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 08/18] media: rzg2l-cru: csi2: Introduce SoC-specific
 D-PHY handling

Hi Tommaso,

Thank you for the patch.

On Fri, Feb 21, 2025 at 04:55:22PM +0100, Tommaso Merciai wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
> 
> In preparation for adding support for the RZ/V2H(P) SoC, where the D-PHY
> differs from the existing RZ/G2L implementation, introduce a new
> rzg2l_csi2_info structure. This structure provides function pointers for
> SoC-specific D-PHY enable and disable operations.
> 
> Modify rzg2l_csi2_dphy_setting() to use these function pointers instead of
> calling rzg2l_csi2_dphy_enable() and rzg2l_csi2_dphy_disable() directly.
> Update the device match table to store the appropriate function pointers
> for each compatible SoC.
> 
> This change prepares the driver for future extensions without affecting
> the current functionality for RZ/G2L.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
> ---
>  .../platform/renesas/rzg2l-cru/rzg2l-csi2.c   | 24 ++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> index 4ccf7c5ea58b..3a4e720ba732 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> @@ -107,6 +107,7 @@ struct rzg2l_csi2 {
>  	void __iomem *base;
>  	struct reset_control *presetn;
>  	struct reset_control *cmn_rstb;
> +	const struct rzg2l_csi2_info *info;
>  	struct clk *sysclk;
>  	struct clk *vclk;
>  	unsigned long vclk_rate;
> @@ -123,6 +124,11 @@ struct rzg2l_csi2 {
>  	bool dphy_enabled;
>  };
>  
> +struct rzg2l_csi2_info {
> +	int (*dphy_enable)(struct rzg2l_csi2 *csi2);
> +	int (*dphy_disable)(struct rzg2l_csi2 *csi2);
> +};

Unless you'll need to add non-function fields later, I'd name the
structure rzg2l_csi2_phy_ops.

> +
>  struct rzg2l_csi2_timings {
>  	u32 t_init;
>  	u32 tclk_miss;
> @@ -360,9 +366,9 @@ static int rzg2l_csi2_dphy_setting(struct v4l2_subdev *sd, bool on)
>  	struct rzg2l_csi2 *csi2 = sd_to_csi2(sd);
>  
>  	if (on)
> -		return rzg2l_csi2_dphy_enable(csi2);
> +		return csi2->info->dphy_enable(csi2);
>  
> -	return rzg2l_csi2_dphy_disable(csi2);
> +	return csi2->info->dphy_disable(csi2);
>  }
>  
>  static int rzg2l_csi2_mipi_link_enable(struct rzg2l_csi2 *csi2)
> @@ -772,6 +778,10 @@ static int rzg2l_csi2_probe(struct platform_device *pdev)
>  	if (!csi2)
>  		return -ENOMEM;
>  
> +	csi2->info = of_device_get_match_data(dev);
> +	if (!csi2->info)
> +		return dev_err_probe(dev, -EINVAL, "Failed to get OF match data\n");
> +
>  	csi2->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(csi2->base))
>  		return PTR_ERR(csi2->base);
> @@ -890,8 +900,16 @@ static const struct dev_pm_ops rzg2l_csi2_pm_ops = {
>  		       rzg2l_csi2_pm_runtime_resume, NULL)
>  };
>  
> +static const struct rzg2l_csi2_info rzg2l_csi2_info = {
> +	.dphy_enable = rzg2l_csi2_dphy_enable,
> +	.dphy_disable = rzg2l_csi2_dphy_disable,
> +};

I'd recommend moving this just below the definition of the
rzg2l_csi2_dphy_enable() function.

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

> +
>  static const struct of_device_id rzg2l_csi2_of_table[] = {
> -	{ .compatible = "renesas,rzg2l-csi2", },
> +	{
> +		.compatible = "renesas,rzg2l-csi2",
> +		.data = &rzg2l_csi2_info,
> +	},
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, rzg2l_csi2_of_table);

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ