From: Hans Verkuil <hverkuil@xs4all.nl>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] media: exynos4-is: fimc-is: replace duplicate pmu node with phandle
Date: Mon, 7 Aug 2023 15:06:21 +0200 [thread overview]
Message-ID: <0b361e6c-d141-4758-edc2-c75b6f0efbe3@xs4all.nl> (raw)
In-Reply-To: <20230722115441.139628-3-krzysztof.kozlowski@linaro.org>
Hi Krzysztof,
On 22/07/2023 13:54, Krzysztof Kozlowski wrote:
> Devicetree for the FIMC IS camera included duplicated PMU node as its
> child like:
>
> soc@0 {
> system-controller@10020000 { ... }; // Real PMU
>
> camera@11800000 {
> fimc-is@12000000 {
> // FIMC IS camera node
> pmu@10020000 {
> reg = <0x10020000 0x3000>; // Fake PMU node
> };
> };
> };
> };
>
> This is not a correct representation of the hardware. Mapping the PMU
> (Power Management Unit) IO memory should be via syscon-like phandle
> (samsung,pmu-syscon, already used for other drivers), not by duplicating
> "pmu" Devicetree node inside the FIMC IS. Backward compatibility is
> preserved.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> .../platform/samsung/exynos4-is/fimc-is.c | 33 ++++++++++++++-----
> 1 file changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c
> index 530a148fe4d3..c4c191771093 100644
> --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c
> +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c
> @@ -767,12 +767,32 @@ static void fimc_is_debugfs_create(struct fimc_is *is)
> static int fimc_is_runtime_resume(struct device *dev);
> static int fimc_is_runtime_suspend(struct device *dev);
>
> +static void __iomem *fimc_is_get_pmu_regs(struct device *dev)
> +{
> + struct device_node *node;
> + void __iomem *regs;
> +
> + node = of_parse_phandle(dev->of_node, "samsung,pmu-syscon", 0);
> + if (!node) {
> + dev_warn(dev, "Finding PMU node via deprecated method, update your DTB\n");
> + node = of_get_child_by_name(dev->of_node, "pmu");
> + if (!node)
> + return ERR_PTR(-ENODEV);
> + }
> +
> + regs = of_iomap(node, 0);
> + of_node_put(node);
> + if (!regs)
> + return ERR_PTR(-ENOMEM);
sparse gives me these warnings for these ERR_PTR returns:
drivers/media/platform/samsung/exynos4-is/fimc-is.c:780:39: warning: incorrect type in return expression (different address spaces)
drivers/media/platform/samsung/exynos4-is/fimc-is.c:780:39: expected void [noderef] __iomem *
drivers/media/platform/samsung/exynos4-is/fimc-is.c:780:39: got void *
drivers/media/platform/samsung/exynos4-is/fimc-is.c:786:31: warning: incorrect type in return expression (different address spaces)
drivers/media/platform/samsung/exynos4-is/fimc-is.c:786:31: expected void [noderef] __iomem *
drivers/media/platform/samsung/exynos4-is/fimc-is.c:786:31: got void *
Regards,
Hans
> +
> + return regs;
> +}
> +
> static int fimc_is_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct fimc_is *is;
> struct resource res;
> - struct device_node *node;
> int ret;
>
> is = devm_kzalloc(&pdev->dev, sizeof(*is), GFP_KERNEL);
> @@ -794,14 +814,9 @@ static int fimc_is_probe(struct platform_device *pdev)
> if (IS_ERR(is->regs))
> return PTR_ERR(is->regs);
>
> - node = of_get_child_by_name(dev->of_node, "pmu");
> - if (!node)
> - return -ENODEV;
> -
> - is->pmu_regs = of_iomap(node, 0);
> - of_node_put(node);
> - if (!is->pmu_regs)
> - return -ENOMEM;
> + is->pmu_regs = fimc_is_get_pmu_regs(dev);
> + if (IS_ERR(is->pmu_regs))
> + return PTR_ERR(is->pmu_regs);
>
> is->irq = irq_of_parse_and_map(dev->of_node, 0);
> if (!is->irq) {
next prev parent reply other threads:[~2023-08-07 13:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 11:54 [PATCH 1/3] media: dt-bindings: samsung,exynos4212-fimc-is: " Krzysztof Kozlowski
2023-07-22 11:54 ` [PATCH 2/3] media: dt-bindings: samsung,fimc: correct unit addresses in DTS example Krzysztof Kozlowski
2023-07-22 12:00 ` Conor Dooley
2023-07-22 11:54 ` [PATCH 3/3] media: exynos4-is: fimc-is: replace duplicate pmu node with phandle Krzysztof Kozlowski
2023-08-07 13:06 ` Hans Verkuil [this message]
2023-08-07 13:09 ` Krzysztof Kozlowski
2023-07-24 16:24 ` [PATCH 1/3] media: dt-bindings: samsung,exynos4212-fimc-is: " Rob Herring
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=0b361e6c-d141-4758-edc2-c75b6f0efbe3@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=alim.akhtar@samsung.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh+dt@kernel.org \
--cc=s.nawrocki@samsung.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
all inboxes | Powered by JetHome®