* [PATCH 1/6] dt-bindings: rtc: sc2731: Add compatible for SC2730
2026-02-22 13:16 [PATCH 0/6] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
@ 2026-02-22 13:16 ` Otto Pflüger
2026-03-05 23:51 ` Rob Herring (Arm)
2026-02-22 13:16 ` [PATCH 2/6] dt-bindings: leds: " Otto Pflüger
` (4 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: Otto Pflüger @ 2026-02-22 13:16 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
Otto Pflüger
The RTC block found in the SC2730 PMIC is compatible with the one found
in the SC2731 PMIC.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml b/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
index 5756f617df36..1deae2f4f09d 100644
--- a/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
@@ -13,7 +13,12 @@ maintainers:
properties:
compatible:
- const: sprd,sc2731-rtc
+ oneOf:
+ - items:
+ - enum:
+ - sprd,sc2730-rtc
+ - const: sprd,sc2731-rtc
+ - const: sprd,sc2731-rtc
reg:
maxItems: 1
--
2.51.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 1/6] dt-bindings: rtc: sc2731: Add compatible for SC2730
2026-02-22 13:16 ` [PATCH 1/6] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
@ 2026-03-05 23:51 ` Rob Herring (Arm)
0 siblings, 0 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2026-03-05 23:51 UTC (permalink / raw)
To: Otto Pflüger
Cc: Chunyan Zhang, devicetree, Krzysztof Kozlowski, Sebastian Reichel,
linux-leds, Lee Jones, Conor Dooley, Liam Girdwood, linux-rtc,
Mark Brown, Alexandre Belloni, Pavel Machek, linux-pm,
Baolin Wang, linux-kernel, Orson Zhai
On Sun, 22 Feb 2026 14:16:45 +0100, Otto Pflüger wrote:
> The RTC block found in the SC2730 PMIC is compatible with the one found
> in the SC2731 PMIC.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/6] dt-bindings: leds: sc2731: Add compatible for SC2730
2026-02-22 13:16 [PATCH 0/6] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
2026-02-22 13:16 ` [PATCH 1/6] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
@ 2026-02-22 13:16 ` Otto Pflüger
2026-03-05 23:51 ` Rob Herring (Arm)
2026-03-09 18:54 ` (subset) " Lee Jones
2026-02-22 13:16 ` [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
` (3 subsequent siblings)
5 siblings, 2 replies; 17+ messages in thread
From: Otto Pflüger @ 2026-02-22 13:16 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
Otto Pflüger
The LED controller found in the SC2730 PMIC is compatible with the one
found in the SC2731 PMIC.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml b/Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml
index 97535d6dc47a..2ae5cc31e623 100644
--- a/Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml
+++ b/Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml
@@ -18,7 +18,12 @@ description: |
properties:
compatible:
- const: sprd,sc2731-bltc
+ oneOf:
+ - items:
+ - enum:
+ - sprd,sc2730-bltc
+ - const: sprd,sc2731-bltc
+ - const: sprd,sc2731-bltc
reg:
maxItems: 1
--
2.51.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 2/6] dt-bindings: leds: sc2731: Add compatible for SC2730
2026-02-22 13:16 ` [PATCH 2/6] dt-bindings: leds: " Otto Pflüger
@ 2026-03-05 23:51 ` Rob Herring (Arm)
2026-03-09 18:54 ` (subset) " Lee Jones
1 sibling, 0 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2026-03-05 23:51 UTC (permalink / raw)
To: Otto Pflüger
Cc: Krzysztof Kozlowski, Chunyan Zhang, Sebastian Reichel, devicetree,
Alexandre Belloni, Orson Zhai, linux-kernel, Liam Girdwood,
Pavel Machek, Mark Brown, linux-rtc, linux-leds, Lee Jones,
Conor Dooley, linux-pm, Baolin Wang
On Sun, 22 Feb 2026 14:16:46 +0100, Otto Pflüger wrote:
> The LED controller found in the SC2730 PMIC is compatible with the one
> found in the SC2731 PMIC.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: (subset) [PATCH 2/6] dt-bindings: leds: sc2731: Add compatible for SC2730
2026-02-22 13:16 ` [PATCH 2/6] dt-bindings: leds: " Otto Pflüger
2026-03-05 23:51 ` Rob Herring (Arm)
@ 2026-03-09 18:54 ` Lee Jones
1 sibling, 0 replies; 17+ messages in thread
From: Lee Jones @ 2026-03-09 18:54 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel, Otto Pflüger
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm
On Sun, 22 Feb 2026 14:16:46 +0100, Otto Pflüger wrote:
> The LED controller found in the SC2730 PMIC is compatible with the one
> found in the SC2731 PMIC.
>
>
Applied, thanks!
[2/6] dt-bindings: leds: sc2731: Add compatible for SC2730
commit: fc2dfc3392ec52f12d8d6f16a8b13cca838d8bee
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property
2026-02-22 13:16 [PATCH 0/6] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
2026-02-22 13:16 ` [PATCH 1/6] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
2026-02-22 13:16 ` [PATCH 2/6] dt-bindings: leds: " Otto Pflüger
@ 2026-02-22 13:16 ` Otto Pflüger
2026-03-02 16:28 ` Mark Brown
2026-03-05 23:53 ` Rob Herring (Arm)
2026-02-22 13:16 ` [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
` (2 subsequent siblings)
5 siblings, 2 replies; 17+ messages in thread
From: Otto Pflüger @ 2026-02-22 13:16 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
Otto Pflüger
The node containing the regulators is always a child of the main PMIC
node, which already has a compatible property identifying the type of
PMIC. This makes the compatible in the child node redundant. Mark it
as deprecated and remove it from the required property list and the
examples.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml | 2 --
.../devicetree/bindings/regulator/sprd,sc2731-regulator.yaml | 4 +---
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml b/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml
index b023e1ef8d3c..12b3258daef5 100644
--- a/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml
+++ b/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml
@@ -222,8 +222,6 @@ examples:
};
regulators {
- compatible = "sprd,sc2731-regulator";
-
BUCK_CPU0 {
regulator-name = "vddarm0";
regulator-min-microvolt = <400000>;
diff --git a/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml b/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml
index 9bd752bab68e..7af20a4781b7 100644
--- a/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml
@@ -26,6 +26,7 @@ description: |
properties:
compatible:
+ deprecated: true
const: sprd,sc2731-regulator
patternProperties:
@@ -39,8 +40,5 @@ patternProperties:
$ref: regulator.yaml#
unevaluatedProperties: false
-required:
- - compatible
-
additionalProperties: false
...
--
2.51.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property
2026-02-22 13:16 ` [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
@ 2026-03-02 16:28 ` Mark Brown
2026-03-05 23:53 ` Rob Herring (Arm)
1 sibling, 0 replies; 17+ messages in thread
From: Mark Brown @ 2026-03-02 16:28 UTC (permalink / raw)
To: Otto Pflüger
Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Sebastian Reichel, linux-rtc, devicetree,
linux-kernel, linux-leds, linux-pm
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
On Sun, Feb 22, 2026 at 02:16:47PM +0100, Otto Pflüger wrote:
> The node containing the regulators is always a child of the main PMIC
> node, which already has a compatible property identifying the type of
> PMIC. This makes the compatible in the child node redundant. Mark it
> as deprecated and remove it from the required property list and the
> examples.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property
2026-02-22 13:16 ` [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
2026-03-02 16:28 ` Mark Brown
@ 2026-03-05 23:53 ` Rob Herring (Arm)
1 sibling, 0 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2026-03-05 23:53 UTC (permalink / raw)
To: Otto Pflüger
Cc: linux-pm, Lee Jones, Liam Girdwood, Chunyan Zhang,
Krzysztof Kozlowski, Mark Brown, Conor Dooley, linux-kernel,
linux-rtc, Alexandre Belloni, Pavel Machek, Sebastian Reichel,
devicetree, Orson Zhai, Baolin Wang, linux-leds
On Sun, 22 Feb 2026 14:16:47 +0100, Otto Pflüger wrote:
> The node containing the regulators is always a child of the main PMIC
> node, which already has a compatible property identifying the type of
> PMIC. This makes the compatible in the child node redundant. Mark it
> as deprecated and remove it from the required property list and the
> examples.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml | 2 --
> .../devicetree/bindings/regulator/sprd,sc2731-regulator.yaml | 4 +---
> 2 files changed, 1 insertion(+), 5 deletions(-)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
2026-02-22 13:16 [PATCH 0/6] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
` (2 preceding siblings ...)
2026-02-22 13:16 ` [PATCH 3/6] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
@ 2026-02-22 13:16 ` Otto Pflüger
2026-03-09 18:58 ` Lee Jones
2026-02-22 13:16 ` [PATCH 5/6] power: reset: sc27xx: Add platform_device_id table Otto Pflüger
2026-02-22 13:16 ` [PATCH 6/6] regulator: sc2731: " Otto Pflüger
5 siblings, 1 reply; 17+ messages in thread
From: Otto Pflüger @ 2026-02-22 13:16 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
Otto Pflüger
To allow instantiating subdevices such as the regulator and poweroff
devices that do not have corresponding device tree nodes with a
"compatible" property, use devm_mfd_add_devices() with MFD cells instead
of devm_of_platform_populate(). Since different PMICs in the SC27xx
series contain different components, use separate MFD cell tables for
each PMIC model. Define cells for all components that have upstream
drivers at this point.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/mfd/sprd-sc27xx-spi.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index d6b4350779e6..57941bec4c2e 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -48,6 +48,31 @@ struct sprd_pmic_data {
u32 irq_base;
u32 num_irqs;
u32 charger_det;
+ const struct mfd_cell *cells;
+ int num_cells;
+};
+
+static const struct mfd_cell sc2730_devices[] = {
+ MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
+ MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
+ MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
+ MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
+ MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
+ MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
+ MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
+};
+
+static const struct mfd_cell sc2731_devices[] = {
+ MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
+ MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
+ MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
+ MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
+ MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
+ MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
+ MFD_CELL_NAME("sc2731-poweroff"),
+ MFD_CELL_NAME("sc2731-regulator"),
+ MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
+ MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
};
/*
@@ -59,12 +84,16 @@ static const struct sprd_pmic_data sc2730_data = {
.irq_base = SPRD_SC2730_IRQ_BASE,
.num_irqs = SPRD_SC2730_IRQ_NUMS,
.charger_det = SPRD_SC2730_CHG_DET,
+ .cells = sc2730_devices,
+ .num_cells = ARRAY_SIZE(sc2730_devices),
};
static const struct sprd_pmic_data sc2731_data = {
.irq_base = SPRD_SC2731_IRQ_BASE,
.num_irqs = SPRD_SC2731_IRQ_NUMS,
.charger_det = SPRD_SC2731_CHG_DET,
+ .cells = sc2731_devices,
+ .num_cells = ARRAY_SIZE(sc2731_devices),
};
enum usb_charger_type sprd_pmic_detect_charger_type(struct device *dev)
@@ -204,7 +233,9 @@ static int sprd_pmic_probe(struct spi_device *spi)
return ret;
}
- ret = devm_of_platform_populate(&spi->dev);
+ ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO,
+ pdata->cells, pdata->num_cells, NULL, 0,
+ regmap_irq_get_domain(ddata->irq_data));
if (ret) {
dev_err(&spi->dev, "Failed to populate sub-devices %d\n", ret);
return ret;
--
2.51.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
2026-02-22 13:16 ` [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
@ 2026-03-09 18:58 ` Lee Jones
2026-03-20 19:41 ` Otto Pflüger
0 siblings, 1 reply; 17+ messages in thread
From: Lee Jones @ 2026-03-09 18:58 UTC (permalink / raw)
To: Otto Pflüger
Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel, linux-rtc,
devicetree, linux-kernel, linux-leds, linux-pm
On Sun, 22 Feb 2026, Otto Pflüger wrote:
> To allow instantiating subdevices such as the regulator and poweroff
> devices that do not have corresponding device tree nodes with a
> "compatible" property, use devm_mfd_add_devices() with MFD cells instead
> of devm_of_platform_populate(). Since different PMICs in the SC27xx
> series contain different components, use separate MFD cell tables for
> each PMIC model. Define cells for all components that have upstream
> drivers at this point.
We're not passing one device registration API's data (MFD)
through another (Device Tree).
Pass an identifier through and match on that instead.
Look at how all of the other drivers in MFD do it.
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> drivers/mfd/sprd-sc27xx-spi.c | 33 ++++++++++++++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
> index d6b4350779e6..57941bec4c2e 100644
> --- a/drivers/mfd/sprd-sc27xx-spi.c
> +++ b/drivers/mfd/sprd-sc27xx-spi.c
> @@ -48,6 +48,31 @@ struct sprd_pmic_data {
> u32 irq_base;
> u32 num_irqs;
> u32 charger_det;
> + const struct mfd_cell *cells;
> + int num_cells;
> +};
> +
> +static const struct mfd_cell sc2730_devices[] = {
> + MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
> + MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
> + MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
> + MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
> + MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
> + MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
> + MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
> +};
> +
> +static const struct mfd_cell sc2731_devices[] = {
> + MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
> + MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
> + MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
> + MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
> + MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
> + MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
> + MFD_CELL_NAME("sc2731-poweroff"),
> + MFD_CELL_NAME("sc2731-regulator"),
> + MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
> + MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
> };
>
> /*
> @@ -59,12 +84,16 @@ static const struct sprd_pmic_data sc2730_data = {
> .irq_base = SPRD_SC2730_IRQ_BASE,
> .num_irqs = SPRD_SC2730_IRQ_NUMS,
> .charger_det = SPRD_SC2730_CHG_DET,
> + .cells = sc2730_devices,
> + .num_cells = ARRAY_SIZE(sc2730_devices),
> };
>
> static const struct sprd_pmic_data sc2731_data = {
> .irq_base = SPRD_SC2731_IRQ_BASE,
> .num_irqs = SPRD_SC2731_IRQ_NUMS,
> .charger_det = SPRD_SC2731_CHG_DET,
> + .cells = sc2731_devices,
> + .num_cells = ARRAY_SIZE(sc2731_devices),
> };
>
> enum usb_charger_type sprd_pmic_detect_charger_type(struct device *dev)
> @@ -204,7 +233,9 @@ static int sprd_pmic_probe(struct spi_device *spi)
> return ret;
> }
>
> - ret = devm_of_platform_populate(&spi->dev);
> + ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO,
> + pdata->cells, pdata->num_cells, NULL, 0,
> + regmap_irq_get_domain(ddata->irq_data));
> if (ret) {
> dev_err(&spi->dev, "Failed to populate sub-devices %d\n", ret);
> return ret;
>
> --
> 2.51.0
>
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
2026-03-09 18:58 ` Lee Jones
@ 2026-03-20 19:41 ` Otto Pflüger
2026-03-25 11:22 ` Lee Jones
0 siblings, 1 reply; 17+ messages in thread
From: Otto Pflüger @ 2026-03-20 19:41 UTC (permalink / raw)
To: Lee Jones
Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel, linux-rtc,
devicetree, linux-kernel, linux-leds, linux-pm
On Mon, Mar 09, 2026 at 06:58:56PM +0000, Lee Jones wrote:
> On Sun, 22 Feb 2026, Otto Pflüger wrote:
>
> > To allow instantiating subdevices such as the regulator and poweroff
> > devices that do not have corresponding device tree nodes with a
> > "compatible" property, use devm_mfd_add_devices() with MFD cells instead
> > of devm_of_platform_populate(). Since different PMICs in the SC27xx
> > series contain different components, use separate MFD cell tables for
> > each PMIC model. Define cells for all components that have upstream
> > drivers at this point.
>
> We're not passing one device registration API's data (MFD)
> through another (Device Tree).
>
> Pass an identifier through and match on that instead.
>
> Look at how all of the other drivers in MFD do it.
>
> [...]
> > +static const struct mfd_cell sc2730_devices[] = {
> > + MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
> > + MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
> > + MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
> > + MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
> > + MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
> > + MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
> > + MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
> > +};
> > +
> > +static const struct mfd_cell sc2731_devices[] = {
> > + MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
> > + MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
> > + MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
> > + MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
> > + MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
> > + MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
> > + MFD_CELL_NAME("sc2731-poweroff"),
> > + MFD_CELL_NAME("sc2731-regulator"),
> > + MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
> > + MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
> > };
Assuming that these tables are the "registration API's data", I don't
see where it is being passed through the device tree. The device tree
contains nodes for some of these MFD components, and I've listed their
compatibles here so that the MFD core finds these nodes and registers
them with the corresponding devices (which was previously done
automatically by devm_of_platform_populate).
> >
> > /*
> > @@ -59,12 +84,16 @@ static const struct sprd_pmic_data sc2730_data = {
> > .irq_base = SPRD_SC2730_IRQ_BASE,
> > .num_irqs = SPRD_SC2730_IRQ_NUMS,
> > .charger_det = SPRD_SC2730_CHG_DET,
> > + .cells = sc2730_devices,
> > + .num_cells = ARRAY_SIZE(sc2730_devices),
> > };
> >
> > static const struct sprd_pmic_data sc2731_data = {
> > .irq_base = SPRD_SC2731_IRQ_BASE,
> > .num_irqs = SPRD_SC2731_IRQ_NUMS,
> > .charger_det = SPRD_SC2731_CHG_DET,
> > + .cells = sc2731_devices,
> > + .num_cells = ARRAY_SIZE(sc2731_devices),
> > };
Here I am simply referencing the tables above in the device-specific
MFD data. These structs containing device-specific data already exist,
they are private to the MFD driver, and I wouldn't consider them part
of the device tree.
I've looked at mt6397-core.c and it seems to be doing the exact same
thing with its "struct chip_data". Some other drivers use a numeric ID
for this purpose, but how would that be different from a pointer as long
as it identifies the same data within the MFD driver?
Could you clarify what should be changed?
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
2026-03-20 19:41 ` Otto Pflüger
@ 2026-03-25 11:22 ` Lee Jones
0 siblings, 0 replies; 17+ messages in thread
From: Lee Jones @ 2026-03-25 11:22 UTC (permalink / raw)
To: Otto Pflüger
Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel, linux-rtc,
devicetree, linux-kernel, linux-leds, linux-pm
> Could you clarify what should be changed?
Sure.
> On Mon, Mar 09, 2026 at 06:58:56PM +0000, Lee Jones wrote:
> > On Sun, 22 Feb 2026, Otto Pflüger wrote:
> >
> > > To allow instantiating subdevices such as the regulator and poweroff
> > > devices that do not have corresponding device tree nodes with a
> > > "compatible" property, use devm_mfd_add_devices() with MFD cells instead
> > > of devm_of_platform_populate(). Since different PMICs in the SC27xx
> > > series contain different components, use separate MFD cell tables for
> > > each PMIC model. Define cells for all components that have upstream
> > > drivers at this point.
> >
> > We're not passing one device registration API's data (MFD)
> > through another (Device Tree).
> >
> > Pass an identifier through and match on that instead.
> >
> > Look at how all of the other drivers in MFD do it.
> >
> > [...]
> > > +static const struct mfd_cell sc2730_devices[] = {
> > > + MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
> > > + MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
> > > + MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
> > > + MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
> > > + MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
> > > + MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
> > > + MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
> > > +};
> > > +
> > > +static const struct mfd_cell sc2731_devices[] = {
> > > + MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
> > > + MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
> > > + MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
> > > + MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
> > > + MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
> > > + MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
> > > + MFD_CELL_NAME("sc2731-poweroff"),
> > > + MFD_CELL_NAME("sc2731-regulator"),
> > > + MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
> > > + MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
> > > };
>
> Assuming that these tables are the "registration API's data", I don't
> see where it is being passed through the device tree. The device tree
> contains nodes for some of these MFD components, and I've listed their
> compatibles here so that the MFD core finds these nodes and registers
> them with the corresponding devices (which was previously done
> automatically by devm_of_platform_populate).
>
> > >
> > > /*
> > > @@ -59,12 +84,16 @@ static const struct sprd_pmic_data sc2730_data = {
> > > .irq_base = SPRD_SC2730_IRQ_BASE,
> > > .num_irqs = SPRD_SC2730_IRQ_NUMS,
> > > .charger_det = SPRD_SC2730_CHG_DET,
> > > + .cells = sc2730_devices,
> > > + .num_cells = ARRAY_SIZE(sc2730_devices),
Remove these from here.
Either replace them with an ID that you can match on or stop passing
'sc2730_data' through .data and pass an ID through there instead. Then
choose 'sc2730_data' and 'sc2730_devices' in an switch() statement
instead, just like the vast majority of existing MFD drivers do.
> > > };
> > >
> > > static const struct sprd_pmic_data sc2731_data = {
> > > .irq_base = SPRD_SC2731_IRQ_BASE,
> > > .num_irqs = SPRD_SC2731_IRQ_NUMS,
> > > .charger_det = SPRD_SC2731_CHG_DET,
> > > + .cells = sc2731_devices,
> > > + .num_cells = ARRAY_SIZE(sc2731_devices),
> > > };
>
> Here I am simply referencing the tables above in the device-specific
> MFD data. These structs containing device-specific data already exist,
> they are private to the MFD driver, and I wouldn't consider them part
> of the device tree.
>
> I've looked at mt6397-core.c and it seems to be doing the exact same
> thing with its "struct chip_data".
That was a momentary oversight. It's also passing a driver-level
call-back which I despise. However, past mistakes are not good
justifications for new ones.
> Some other drivers use a numeric ID
> for this purpose, but how would that be different from a pointer as long
> as it identifies the same data within the MFD driver?
The point is that sc2731_data->cells would be passed through the Device
Tree's .data attribute, which is not allowed.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/6] power: reset: sc27xx: Add platform_device_id table
2026-02-22 13:16 [PATCH 0/6] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
` (3 preceding siblings ...)
2026-02-22 13:16 ` [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
@ 2026-02-22 13:16 ` Otto Pflüger
2026-03-03 0:00 ` Sebastian Reichel
2026-02-22 13:16 ` [PATCH 6/6] regulator: sc2731: " Otto Pflüger
5 siblings, 1 reply; 17+ messages in thread
From: Otto Pflüger @ 2026-02-22 13:16 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
Otto Pflüger
Make the poweroff driver for SC27xx-series PMICs probe automatically.
Since the device representing the poweroff functionality of the SC27xx
PMIC is not supposed to have a dedicated device tree node without any
corresponding DT resources [1], an of_device_id table cannot be used
here. Instead, use a platform_device_id table to match the poweroff
sub-device instantiated by the parent MFD driver.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
[1]: https://lore.kernel.org/all/20251002025344.GA2958334-robh@kernel.org/
---
drivers/power/reset/sc27xx-poweroff.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/power/reset/sc27xx-poweroff.c b/drivers/power/reset/sc27xx-poweroff.c
index 393bd1c33b73..6376706bf561 100644
--- a/drivers/power/reset/sc27xx-poweroff.c
+++ b/drivers/power/reset/sc27xx-poweroff.c
@@ -6,6 +6,7 @@
#include <linux/cpu.h>
#include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
@@ -70,11 +71,18 @@ static int sc27xx_poweroff_probe(struct platform_device *pdev)
return 0;
}
+static const struct platform_device_id sc27xx_poweroff_id_table[] = {
+ { "sc2731-poweroff" },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, sc27xx_poweroff_id_table);
+
static struct platform_driver sc27xx_poweroff_driver = {
.probe = sc27xx_poweroff_probe,
.driver = {
.name = "sc27xx-poweroff",
},
+ .id_table = sc27xx_poweroff_id_table,
};
module_platform_driver(sc27xx_poweroff_driver);
--
2.51.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 5/6] power: reset: sc27xx: Add platform_device_id table
2026-02-22 13:16 ` [PATCH 5/6] power: reset: sc27xx: Add platform_device_id table Otto Pflüger
@ 2026-03-03 0:00 ` Sebastian Reichel
0 siblings, 0 replies; 17+ messages in thread
From: Sebastian Reichel @ 2026-03-03 0:00 UTC (permalink / raw)
To: Otto Pflüger
Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, linux-rtc, devicetree, linux-kernel,
linux-leds, linux-pm
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
Hi,
On Sun, Feb 22, 2026 at 02:16:49PM +0100, Otto Pflüger wrote:
> Make the poweroff driver for SC27xx-series PMICs probe automatically.
> Since the device representing the poweroff functionality of the SC27xx
> PMIC is not supposed to have a dedicated device tree node without any
> corresponding DT resources [1], an of_device_id table cannot be used
> here. Instead, use a platform_device_id table to match the poweroff
> sub-device instantiated by the parent MFD driver.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
>
> [1]: https://lore.kernel.org/all/20251002025344.GA2958334-robh@kernel.org/
> ---
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> drivers/power/reset/sc27xx-poweroff.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/power/reset/sc27xx-poweroff.c b/drivers/power/reset/sc27xx-poweroff.c
> index 393bd1c33b73..6376706bf561 100644
> --- a/drivers/power/reset/sc27xx-poweroff.c
> +++ b/drivers/power/reset/sc27xx-poweroff.c
> @@ -6,6 +6,7 @@
>
> #include <linux/cpu.h>
> #include <linux/kernel.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/pm.h>
> @@ -70,11 +71,18 @@ static int sc27xx_poweroff_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static const struct platform_device_id sc27xx_poweroff_id_table[] = {
> + { "sc2731-poweroff" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(platform, sc27xx_poweroff_id_table);
> +
> static struct platform_driver sc27xx_poweroff_driver = {
> .probe = sc27xx_poweroff_probe,
> .driver = {
> .name = "sc27xx-poweroff",
> },
> + .id_table = sc27xx_poweroff_id_table,
> };
> module_platform_driver(sc27xx_poweroff_driver);
>
>
> --
> 2.51.0
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/6] regulator: sc2731: Add platform_device_id table
2026-02-22 13:16 [PATCH 0/6] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
` (4 preceding siblings ...)
2026-02-22 13:16 ` [PATCH 5/6] power: reset: sc27xx: Add platform_device_id table Otto Pflüger
@ 2026-02-22 13:16 ` Otto Pflüger
2026-03-02 16:06 ` Mark Brown
5 siblings, 1 reply; 17+ messages in thread
From: Otto Pflüger @ 2026-02-22 13:16 UTC (permalink / raw)
To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Mark Brown, Sebastian Reichel
Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
Otto Pflüger
Make the regulator driver for the SC2731 PMIC probe automatically. Using
a platform_device_id table instead of DT compatible matching avoids the
need for a separate compatible property in the "regulators" node, which
simplifies the DT bindings and makes the parent MFD device responsible
for selecting the correct regulator driver for the PMIC.
However, this means that the regulator device is not automatically
associated with the "regulators" node. Tell the regulator core to
perform device tree lookups using the parent MFD device instead of
the regulator sub-device and set the .regulators_node member in all
regulator definitions so that the "regulators" sub-node is used.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/regulator/sc2731-regulator.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/sc2731-regulator.c b/drivers/regulator/sc2731-regulator.c
index 5447e1a47d15..93c8156c5110 100644
--- a/drivers/regulator/sc2731-regulator.c
+++ b/drivers/regulator/sc2731-regulator.c
@@ -131,6 +131,7 @@ static const struct regulator_ops sc2731_regu_linear_ops = {
vstep, vmin, vmax) { \
.name = #_id, \
.of_match = of_match_ptr(#_id), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &sc2731_regu_linear_ops, \
.type = REGULATOR_VOLTAGE, \
.id = SC2731_##_id, \
@@ -226,7 +227,7 @@ static int sc2731_regulator_probe(struct platform_device *pdev)
return ret;
}
- config.dev = &pdev->dev;
+ config.dev = pdev->dev.parent;
config.regmap = regmap;
for (i = 0; i < ARRAY_SIZE(regulators); i++) {
@@ -242,12 +243,19 @@ static int sc2731_regulator_probe(struct platform_device *pdev)
return 0;
}
+static const struct platform_device_id sc2731_regulator_id_table[] = {
+ { "sc2731-regulator" },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, sc2731_regulator_id_table);
+
static struct platform_driver sc2731_regulator_driver = {
.driver = {
.name = "sc27xx-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = sc2731_regulator_probe,
+ .id_table = sc2731_regulator_id_table,
};
module_platform_driver(sc2731_regulator_driver);
--
2.51.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 6/6] regulator: sc2731: Add platform_device_id table
2026-02-22 13:16 ` [PATCH 6/6] regulator: sc2731: " Otto Pflüger
@ 2026-03-02 16:06 ` Mark Brown
0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2026-03-02 16:06 UTC (permalink / raw)
To: Otto Pflüger
Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
Liam Girdwood, Sebastian Reichel, linux-rtc, devicetree,
linux-kernel, linux-leds, linux-pm
[-- Attachment #1: Type: text/plain, Size: 468 bytes --]
On Sun, Feb 22, 2026 at 02:16:50PM +0100, Otto Pflüger wrote:
> Make the regulator driver for the SC2731 PMIC probe automatically. Using
> a platform_device_id table instead of DT compatible matching avoids the
> need for a separate compatible property in the "regulators" node, which
> simplifies the DT bindings and makes the parent MFD device responsible
> for selecting the correct regulator driver for the PMIC.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread