]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rzg2l-cru: csi2: Skip system clock for RZ/V2H(P) SoC
authorTommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Fri, 11 Apr 2025 17:05:37 +0000 (19:05 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Wed, 23 Apr 2025 08:55:53 +0000 (10:55 +0200)
The RZ/V2H(P) SoC does not require a `system` clock for the CSI-2
interface. To accommodate this, introduce a `has_system_clk` bool flag
in the `rzg2l_csi2_info` structure and update the rzg2l_csi2_probe() to
conditionally request the clock only when needed.

This patch is in preparation for adding support for RZ/V2H(P) SoC.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://lore.kernel.org/r/20250411170624.472257-10-tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c

index 4aa5d58dde5bdae498e987a3c78590fe9fe3a306..e4781105eadc083592bcb3be6c293b1507219303 100644 (file)
@@ -127,6 +127,7 @@ struct rzg2l_csi2 {
 struct rzg2l_csi2_info {
        int (*dphy_enable)(struct rzg2l_csi2 *csi2);
        int (*dphy_disable)(struct rzg2l_csi2 *csi2);
+       bool has_system_clk;
 };
 
 struct rzg2l_csi2_timings {
@@ -364,6 +365,7 @@ static int rzg2l_csi2_dphy_enable(struct rzg2l_csi2 *csi2)
 static const struct rzg2l_csi2_info rzg2l_csi2_info = {
        .dphy_enable = rzg2l_csi2_dphy_enable,
        .dphy_disable = rzg2l_csi2_dphy_disable,
+       .has_system_clk = true,
 };
 
 static int rzg2l_csi2_dphy_setting(struct v4l2_subdev *sd, bool on)
@@ -801,10 +803,12 @@ static int rzg2l_csi2_probe(struct platform_device *pdev)
                return dev_err_probe(dev, PTR_ERR(csi2->presetn),
                                     "Failed to get cpg presetn\n");
 
-       csi2->sysclk = devm_clk_get(dev, "system");
-       if (IS_ERR(csi2->sysclk))
-               return dev_err_probe(dev, PTR_ERR(csi2->sysclk),
-                                    "Failed to get system clk\n");
+       if (csi2->info->has_system_clk) {
+               csi2->sysclk = devm_clk_get(dev, "system");
+               if (IS_ERR(csi2->sysclk))
+                       return dev_err_probe(dev, PTR_ERR(csi2->sysclk),
+                                            "Failed to get system clk\n");
+       }
 
        csi2->vclk = devm_clk_get(dev, "video");
        if (IS_ERR(csi2->vclk))