[PATCH v9 0/3] Add of_regulator_get_optional() and Fix MTK Power Domain Driver

Chen-Yu Tsai posted 3 patches 1 month, 4 weeks ago
drivers/pmdomain/mediatek/mtk-pm-domains.c | 12 +--
drivers/regulator/core.c                   |  4 +-
drivers/regulator/devres.c                 |  2 +-
drivers/regulator/internal.h               |  4 +
drivers/regulator/of_regulator.c           | 88 ++++++++++++++++++++--
include/linux/regulator/consumer.h         | 31 ++++++++
6 files changed, 121 insertions(+), 20 deletions(-)
[PATCH v9 0/3] Add of_regulator_get_optional() and Fix MTK Power Domain Driver
Posted by Chen-Yu Tsai 1 month, 4 weeks ago
Hi folks,

This is v9 of my of_regulator_get_optional() series. This series was
split off from my "DT hardware prober" series [1].

Changes since v8:
- Reformated stub versions with `clang-format`
- Collected Andy's Reviewed-by for the first patch
- Moved OF-specific devres version to of_regulator.c
- Made _of_regulator_get() static again
- Made devm_regulator_release non-static

Changes since v7:
- Added stub versions for of_regulator_get_optional() for !CONFIG_OF
  and !CONFIG_REGULATOR
- Added new patches for devres version and converting MTK pmdomain
  driver

At ELCE, Sebastian told me about his recent work on adding regulator
supply support to the Rockchip power domain driver [2], how the MediaTek
driver has been using the existing devm_regulator_get() API and
reassigning different device nodes to the device doing the lookup, and
how the new of_regulator_get_optional() is the proper fit for this.

Patch 1 adds a new of_regulator_get_optional() function to look up
regulator supplies using device tree nodes.

Patch 2 adds a devres version of the aforementioned function at
Sebastian's request for the two power domain drivers.

Patch 3 converts the MediaTek power domain driver to use function.


Each of the latter two patches depend on the previous one at build time.
Ulf would like the regulator patches on an immutable topic branch so
that he can merge it and the pmdomain patch. Mark, if you could oblige?


Thanks
ChenYu


[1] https://lore.kernel.org/all/20240911072751.365361-1-wenst@chromium.org/
[2] https://lore.kernel.org/all/20240919091834.83572-1-sebastian.reichel@collabora.com/

Chen-Yu Tsai (3):
  regulator: Add of_regulator_get_optional() for pure DT regulator
    lookup
  regulator: Add devres version of of_regulator_get_optional()
  pmdomain: mediatek: Use OF-specific regulator API to get power domain
    supply

 drivers/pmdomain/mediatek/mtk-pm-domains.c | 12 +--
 drivers/regulator/core.c                   |  4 +-
 drivers/regulator/devres.c                 |  2 +-
 drivers/regulator/internal.h               |  4 +
 drivers/regulator/of_regulator.c           | 88 ++++++++++++++++++++--
 include/linux/regulator/consumer.h         | 31 ++++++++
 6 files changed, 121 insertions(+), 20 deletions(-)


base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
-- 
2.46.1.824.gd892dcdcdd-goog
Re: [PATCH v9 0/3] Add of_regulator_get_optional() and Fix MTK Power Domain Driver
Posted by Mark Brown 1 month, 4 weeks ago
On Mon, Sep 30, 2024 at 12:45:20PM +0800, Chen-Yu Tsai wrote:

> Patch 1 adds a new of_regulator_get_optional() function to look up
> regulator supplies using device tree nodes.

> Patch 2 adds a devres version of the aforementioned function at
> Sebastian's request for the two power domain drivers.

The following changes since commit 9852d85ec9d492ebef56dc5f229416c925758edc:

  Linux 6.12-rc1 (2024-09-29 15:06:19 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git tags/regulator-of-get-optional

for you to fetch changes up to 36ec3f437227470568e5f460997f367f5446a34d:

  regulator: Add devres version of of_regulator_get_optional() (2024-09-30 01:11:41 +0200)

----------------------------------------------------------------
regulator: Add of_regulator_get_optional() APIs

Add of_regulator_get_optional() APIs, which can be used by generic code
to improve integration of regulator management helpers for their users.

----------------------------------------------------------------
Chen-Yu Tsai (2):
      regulator: Add of_regulator_get_optional() for pure DT regulator lookup
      regulator: Add devres version of of_regulator_get_optional()

 drivers/regulator/core.c           |  4 +--
 drivers/regulator/devres.c         | 39 +++++++++++++++++++++++++++++
 drivers/regulator/internal.h       | 18 +++++++++-----
 drivers/regulator/of_regulator.c   | 51 +++++++++++++++++++++++++++++++++-----
 include/linux/regulator/consumer.h | 37 +++++++++++++++++++++++++++
 5 files changed, 135 insertions(+), 14 deletions(-)
Re: [PATCH v9 0/3] Add of_regulator_get_optional() and Fix MTK Power Domain Driver
Posted by Ulf Hansson 1 month, 3 weeks ago
On Mon, 30 Sept 2024 at 23:17, Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Sep 30, 2024 at 12:45:20PM +0800, Chen-Yu Tsai wrote:
>
> > Patch 1 adds a new of_regulator_get_optional() function to look up
> > regulator supplies using device tree nodes.
>
> > Patch 2 adds a devres version of the aforementioned function at
> > Sebastian's request for the two power domain drivers.
>
> The following changes since commit 9852d85ec9d492ebef56dc5f229416c925758edc:
>
>   Linux 6.12-rc1 (2024-09-29 15:06:19 -0700)
>
> are available in the Git repository at:
>
>   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git tags/regulator-of-get-optional
>
> for you to fetch changes up to 36ec3f437227470568e5f460997f367f5446a34d:
>
>   regulator: Add devres version of of_regulator_get_optional() (2024-09-30 01:11:41 +0200)
>
> ----------------------------------------------------------------
> regulator: Add of_regulator_get_optional() APIs
>
> Add of_regulator_get_optional() APIs, which can be used by generic code
> to improve integration of regulator management helpers for their users.
>
> ----------------------------------------------------------------
> Chen-Yu Tsai (2):
>       regulator: Add of_regulator_get_optional() for pure DT regulator lookup
>       regulator: Add devres version of of_regulator_get_optional()
>
>  drivers/regulator/core.c           |  4 +--
>  drivers/regulator/devres.c         | 39 +++++++++++++++++++++++++++++
>  drivers/regulator/internal.h       | 18 +++++++++-----
>  drivers/regulator/of_regulator.c   | 51 +++++++++++++++++++++++++++++++++-----
>  include/linux/regulator/consumer.h | 37 +++++++++++++++++++++++++++
>  5 files changed, 135 insertions(+), 14 deletions(-)

I have pulled in the regulator tag from Mark's git tree and applied
patch3 for next, thanks!

Kind regards
Uffe