]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rcar-isp: Parse named cs memory region
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 23 Apr 2025 16:31:13 +0000 (18:31 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 2 May 2025 08:16:43 +0000 (10:16 +0200)
Extend the device tree parsing to optionally parse the cs memory region
by name. The change is backward compatible with the device tree model
where a single unnamed region describes only the ISP channel select
function.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250423163113.2961049-8-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/renesas/rcar-isp/csisp.c

index f36d43c2e0a28607a8fcfaf576067eed42be8eac..1eb29a0b774a98538d0a4da11a0df6259417ef5e 100644 (file)
@@ -465,7 +465,18 @@ static const struct media_entity_operations risp_entity_ops = {
 static int risp_probe_resources(struct rcar_isp *isp,
                                struct platform_device *pdev)
 {
-       isp->csbase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
+       struct resource *res;
+
+       /*
+        * For backward compatibility allow cs base to be the only reg if no
+        * reg-names are set in DT.
+        */
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs");
+       if (!res)
+               isp->csbase = devm_platform_ioremap_resource(pdev, 0);
+       else
+               isp->csbase = devm_ioremap_resource(&pdev->dev, res);
+
        if (IS_ERR(isp->csbase))
                return PTR_ERR(isp->csbase);