All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v3 01/13] soc: samsung: pmu: Provide global function to get PMU regmap
Date: Thu, 26 Jan 2017 11:22:08 +0100	[thread overview]
Message-ID: <3ba1504d-5874-b09b-1ad8-6cda4851f113@samsung.com> (raw)
In-Reply-To: <CACRpkdYyOgpAhAY=7QrXiEB2oDgs0azt_Tb80iO4vjzk1obemQ@mail.gmail.com>

Hi Linus,

On 2017-01-26 10:43, Linus Walleij wrote:
> On Thu, Jan 19, 2017 at 2:48 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>
>> PMU is something like a SoC wide service, so add a helper function to get
>> PMU regmap. This will be used by other Exynos device drivers. This way it
>> can be avoided to model this dependency in device tree (as phandles to PMU
>> node) for almost every device in the SoC.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
> But why? I could understand it as a local header in
> drivers/soc/samsung/*.h for those files.
>
> For the global kernel scope we usually look up the syscon
> regmap we need using a phandle, DT node or even
> compatible string directly from the device tree.
>
> Just
> #include <linux/mfd/syscon.h>
>
> syscon_node_to_regmap()
> syscon_regmap_lookup_by_compatible()
> syscon_regmap_lookup_by_pdevname()
> syscon_regmap_lookup_by_phandle()
>
> what is wrong with just using one of these?
>
> Introducing a special header just creates compile time problems
> with global interfaces when merging code and just litter the kernel
> for no good reason.
>
> Can you explain why this necessarily different approach is
> needed?

syscon_regmap_lookup_by_phandle() requires to have a phandle in the client
node. This has been used in v0 of this patchset and rejected as breaking
the old DT "compatibility".

syscon_regmap_lookup_by_compatible() requires to have a compatible string
hardcoded in the client driver. This might be used, but will require to have
(and maintain) a duplicated list of PMU compatibles in pin control driver.
There is a little problem with exynos4212 and exynos4412, which have same
pinctrl compatible (samsung,exynos4x12-pinctrl), but separate PMU 
compatibles
(samsung,exynos4212-pmu and samsung,exynos4412-pmu). Luckily support for
Exynos4212 has been scheduled for removal, so we can ignore this issue for
now. The problem with maintaining a duplicated list of compatibles remains.

syscon_regmap_lookup_by_pdevname() requires the provider to register regmap
first, then to hardcode the provider name in all client drivers. A bit 
similar
approach was used in v1, but the drawback was runtime probe order dependency
between PMU driver and pin control driver. I was requested to move the code
for acquiring PMU regmap to PMU driver, what in turn ended in the solution
presented in v2/v3 of this patchset, which requires least code for handling,
has no maintenance overhead, and doesn't cause any probe dependency issues.
It can be also later used for almost every driver found on the newer Exynos
SoCs, because for most of them there is a need to poke some registers in
the PMU not handled separately by any of the existing frameworks.

Various other drivers in the drivers/soc/ provide EXPORT_SYMBOL() based API,
so I don't think that this is a totally wrong approach.

> I guess I should have said this earlier, mea culpa.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/13] soc: samsung: pmu: Provide global function to get PMU regmap
Date: Thu, 26 Jan 2017 11:22:08 +0100	[thread overview]
Message-ID: <3ba1504d-5874-b09b-1ad8-6cda4851f113@samsung.com> (raw)
In-Reply-To: <CACRpkdYyOgpAhAY=7QrXiEB2oDgs0azt_Tb80iO4vjzk1obemQ@mail.gmail.com>

Hi Linus,

On 2017-01-26 10:43, Linus Walleij wrote:
> On Thu, Jan 19, 2017 at 2:48 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>
>> PMU is something like a SoC wide service, so add a helper function to get
>> PMU regmap. This will be used by other Exynos device drivers. This way it
>> can be avoided to model this dependency in device tree (as phandles to PMU
>> node) for almost every device in the SoC.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
> But why? I could understand it as a local header in
> drivers/soc/samsung/*.h for those files.
>
> For the global kernel scope we usually look up the syscon
> regmap we need using a phandle, DT node or even
> compatible string directly from the device tree.
>
> Just
> #include <linux/mfd/syscon.h>
>
> syscon_node_to_regmap()
> syscon_regmap_lookup_by_compatible()
> syscon_regmap_lookup_by_pdevname()
> syscon_regmap_lookup_by_phandle()
>
> what is wrong with just using one of these?
>
> Introducing a special header just creates compile time problems
> with global interfaces when merging code and just litter the kernel
> for no good reason.
>
> Can you explain why this necessarily different approach is
> needed?

syscon_regmap_lookup_by_phandle() requires to have a phandle in the client
node. This has been used in v0 of this patchset and rejected as breaking
the old DT "compatibility".

syscon_regmap_lookup_by_compatible() requires to have a compatible string
hardcoded in the client driver. This might be used, but will require to have
(and maintain) a duplicated list of PMU compatibles in pin control driver.
There is a little problem with exynos4212 and exynos4412, which have same
pinctrl compatible (samsung,exynos4x12-pinctrl), but separate PMU 
compatibles
(samsung,exynos4212-pmu and samsung,exynos4412-pmu). Luckily support for
Exynos4212 has been scheduled for removal, so we can ignore this issue for
now. The problem with maintaining a duplicated list of compatibles remains.

syscon_regmap_lookup_by_pdevname() requires the provider to register regmap
first, then to hardcode the provider name in all client drivers. A bit 
similar
approach was used in v1, but the drawback was runtime probe order dependency
between PMU driver and pin control driver. I was requested to move the code
for acquiring PMU regmap to PMU driver, what in turn ended in the solution
presented in v2/v3 of this patchset, which requires least code for handling,
has no maintenance overhead, and doesn't cause any probe dependency issues.
It can be also later used for almost every driver found on the newer Exynos
SoCs, because for most of them there is a need to poke some registers in
the PMU not handled separately by any of the existing frameworks.

Various other drivers in the drivers/soc/ provide EXPORT_SYMBOL() based API,
so I don't think that this is a totally wrong approach.

> I guess I should have said this earlier, mea culpa.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

  reply	other threads:[~2017-01-26 10:22 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170119134902eucas1p24c04dc33bab06bd3d564f6aec2180b3b@eucas1p2.samsung.com>
2017-01-19 13:48 ` [PATCH v3 00/13] Move pad retention control to Exynos pin controller driver Marek Szyprowski
2017-01-19 13:48   ` Marek Szyprowski
     [not found]   ` <CGME20170119134904eucas1p153a1d5b2ff9826c88293b6a8fe5140bc@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 01/13] soc: samsung: pmu: Provide global function to get PMU regmap Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-20 16:39       ` Krzysztof Kozlowski
2017-01-20 16:39         ` Krzysztof Kozlowski
2017-01-26  9:43       ` Linus Walleij
2017-01-26  9:43         ` Linus Walleij
2017-01-26 10:22         ` Marek Szyprowski [this message]
2017-01-26 10:22           ` Marek Szyprowski
2017-01-26 15:54           ` Linus Walleij
2017-01-26 15:54             ` Linus Walleij
2017-01-26 14:41         ` Krzysztof Kozlowski
2017-01-26 14:41           ` Krzysztof Kozlowski
     [not found]   ` <CGME20170119134904eucas1p1cc044892728a1716acc2f77f32180c42@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 02/13] soc: samsung: pmu: Use of_device_get_match_data helper Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-20 16:40       ` Krzysztof Kozlowski
2017-01-20 16:40         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170119134905eucas1p2ed9d6baf6283528289a36a58ee6c978e@eucas1p2.samsung.com>
2017-01-19 13:48     ` [PATCH v3 03/13] soc: samsung: pmu: Remove messages for failed memory allocation Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-20 16:40       ` Krzysztof Kozlowski
2017-01-20 16:40         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170119134906eucas1p28eaf30c782d33b5a36afe31a89613123@eucas1p2.samsung.com>
2017-01-19 13:48     ` [PATCH v3 04/13] pinctrl: samsung: Document Exynos3250 SoC support Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-26  9:04       ` Linus Walleij
2017-01-26  9:04         ` Linus Walleij
     [not found]   ` <CGME20170119134906eucas1p1561fd3b8174bfcf148d4f1f417bc6223@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 05/13] pinctrl: samsung: Remove messages for failed memory allocation Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-26  9:05       ` Linus Walleij
2017-01-26  9:05         ` Linus Walleij
     [not found]   ` <CGME20170119134907eucas1p126b668fe7e8054da6c4233d3ab345ba5@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 06/13] pinctrl: samsung: Fix samsung_pinctrl_create_functions return value Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-26  9:06       ` Linus Walleij
2017-01-26  9:06         ` Linus Walleij
     [not found]   ` <CGME20170119134907eucas1p14be6b994bddf37f8baca669a66acc1d4@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 07/13] pinctrl: samsung: Add missing initconst annotation Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-26  9:08       ` Linus Walleij
2017-01-26  9:08         ` Linus Walleij
     [not found]         ` <CGME20170126092958eucas1p283f0ac46709ec4e72ecc6fc09735aade@eucas1p2.samsung.com>
2017-01-26  9:29           ` [PATCH v3 REBASED 04/13] pinctrl: samsung: Document Exynos3250 SoC support Marek Szyprowski
2017-01-26  9:29             ` Marek Szyprowski
     [not found]             ` <CGME20170126092959eucas1p266be982a9afbc8086d69f3d24bee2b3a@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 05/13] pinctrl: samsung: Remove messages for failed memory allocation Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
     [not found]             ` <CGME20170126092959eucas1p28ac04e5c3b9c4ae882047c93a57d3a4e@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 06/13] pinctrl: samsung: Fix samsung_pinctrl_create_functions return value Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
     [not found]             ` <CGME20170126093000eucas1p249774814b7dd40bc6e90488fd2a11445@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 07/13] pinctrl: samsung: Add missing initconst annotation Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:33                 ` Linus Walleij
2017-01-26 15:33                   ` Linus Walleij
     [not found]             ` <CGME20170126093000eucas1p2090613930c07a90f42e1b7b48584e012@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 08/13] pinctrl: samsung: Remove dead code Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:35                 ` Linus Walleij
2017-01-26 15:35                   ` Linus Walleij
     [not found]             ` <CGME20170126093001eucas1p23c2d5d589a0490fc19dde1be37250a00@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 09/13] pinctrl: samsung: Use generic of_device_get_match_data helper Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:34                 ` Linus Walleij
2017-01-26 15:34                   ` Linus Walleij
     [not found]             ` <CGME20170126093001eucas1p2531400b718191fd5fadd71d9f0c83597@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 10/13] pinctrl: samsung: Add infrastructure for pin-bank retention control Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:36                 ` Linus Walleij
2017-01-26 15:36                   ` Linus Walleij
     [not found]             ` <CGME20170126093002eucas1p1d2c86542c56bd54d78852693f9ddb0b2@eucas1p1.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 11/13] pinctrl: samsung: Move retention control from mach-exynos to the pinctrl driver Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:38                 ` Linus Walleij
2017-01-26 15:38                   ` Linus Walleij
2017-01-26 15:42                   ` Linus Walleij
2017-01-26 15:42                     ` Linus Walleij
     [not found]             ` <CGME20170126093002eucas1p242ce2fc9c907f515d60e353076bf8214@eucas1p2.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 12/13] pinctrl: samsung: Move retention control from mach-s5pv210 " Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:39                 ` Linus Walleij
2017-01-26 15:39                   ` Linus Walleij
     [not found]             ` <CGME20170126093003eucas1p1e63fcbad90361f6ccf90fe07da897823@eucas1p1.samsung.com>
2017-01-26  9:29               ` [PATCH v3 REBASED 13/13] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Marek Szyprowski
2017-01-26  9:29                 ` Marek Szyprowski
2017-01-26 15:58                 ` Linus Walleij
2017-01-26 15:58                   ` Linus Walleij
     [not found]   ` <CGME20170119134908eucas1p1adfde3c9f750f3757367f9dc3abf7dbc@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 08/13] pinctrl: samsung: Remove dead code Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
     [not found]   ` <CGME20170119134908eucas1p1768743f7e2578af5ae47291a6123c3f8@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 09/13] pinctrl: samsung: Use generic of_device_get_match_data helper Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
     [not found]   ` <CGME20170119134909eucas1p234b8a56996490c82508af4e355b9b932@eucas1p2.samsung.com>
2017-01-19 13:48     ` [PATCH v3 10/13] pinctrl: samsung: Add infrastructure for pin-bank retention control Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
     [not found]   ` <CGME20170119134909eucas1p11a7638a4b9bf69b00458189ba9c1bb90@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 11/13] pinctrl: samsung: Move retention control from mach-exynos to the pinctrl driver Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-26  9:10       ` Linus Walleij
2017-01-26  9:10         ` Linus Walleij
2017-01-26  9:13         ` Marek Szyprowski
2017-01-26  9:13           ` Marek Szyprowski
2017-01-26  9:46           ` Linus Walleij
2017-01-26  9:46             ` Linus Walleij
2017-01-26 10:20             ` Arnd Bergmann
2017-01-26 10:20               ` Arnd Bergmann
2017-01-26 14:30             ` Krzysztof Kozlowski
2017-01-26 14:30               ` Krzysztof Kozlowski
     [not found]   ` <CGME20170119134910eucas1p2d401df77ccc1ef8e7b05f4cdb2ffc8d3@eucas1p2.samsung.com>
2017-01-19 13:48     ` [PATCH v3 12/13] pinctrl: samsung: Move retention control from mach-s5pv210 " Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski
2017-01-26  9:11       ` Linus Walleij
2017-01-26  9:11         ` Linus Walleij
2017-01-27 16:20         ` Arnd Bergmann
2017-01-27 16:20           ` Arnd Bergmann
     [not found]   ` <CGME20170119134910eucas1p1984006fbecb55a48c47ea72e9766cd12@eucas1p1.samsung.com>
2017-01-19 13:48     ` [PATCH v3 13/13] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Marek Szyprowski
2017-01-19 13:48       ` Marek Szyprowski

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=3ba1504d-5874-b09b-1ad8-6cda4851f113@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=tomasz.figa@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.