[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9c878317-18d6-c483-d182-4c25200ee305@linaro.org>
Date: Mon, 7 Aug 2023 15:09:40 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Hans Verkuil <hverkuil@...all.nl>,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] media: exynos4-is: fimc-is: replace duplicate pmu
node with phandle
On 07/08/2023 15:06, Hans Verkuil wrote:
> 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@...20000 { ... }; // Real PMU
>>
>> camera@...00000 {
>> fimc-is@...00000 {
>> // FIMC IS camera node
>> pmu@...20000 {
>> 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@...aro.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 *
Thanks, indeed. I will use IOMEM_ERR_PTR()
Best regards,
Krzysztof
Powered by blists - more mailing lists