public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices()
@ 2026-03-25 13:53 Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Otto Pflüger @ 2026-03-25 13:53 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, Sebastian Reichel

These changes resulted from the need to decouple the the Linux device
driver hierarchy from the device tree bindings for two different series
introducing regulator [1] and poweroff [2] support for the SC2730 PMIC.

There are different PMICs in the SC27xx series, including SC2730 and
SC2731. These have a lot of similarities, but some differences too. For
instance, they contain compatible RTC blocks, but completely different
sets of regulators.

On the Linux side, each PMIC block needs its own driver. The MFD driver
currently uses devm_of_platform_populate() to load the drivers for the
components of the PMIC, which only works when each component has its own
sub-node with a "compatible" property that is used to select a driver
for the device.

When viewed from the device tree side, the parent node representing the
PMIC already contains a "compatible" property that distinguishes the
different PMICs. While the device tree bindings currently do require a
separate "compatible" property for each sub-node (ADC, fuel gauge,
regulators, ...), this is essentially redundant since the node name and
the parent compatible uniquely identify the component. Moreover, some
parts of the PMIC such as the poweroff/reboot controller do not even
need a corresponding device tree node.

Change the MFD driver to use MFD cells instead, which allows it to
instantiate sub-devices both with and without device tree nodes.
Devices that do not have a separate device tree node with its own
"compatible" property can be matched by their platform device ID.
Use this to hook up the existing SC2731 poweroff and regulator drivers,
which were previously not loaded at all due to the lack of an ID table.

In the device tree bindings, deprecate the redundant "compatible"
property for the "regulators" node. While it might make sense to do this
for the other components too, there are a few reasons to only change the
regulators at this point:
 - The regulators node is special since it is not as independent as the
   other components. For instance, it is the only child node of the PMIC
   that does not have a "reg" property. The set of regulators also
   differs much more between different PMIC models than the register
   layout of the other components.
 - We already have some other PMICs where only the regulators are
   treated specially like this, such as MediaTek MT6359 and MT6370.
 - It was suggested to remove the "compatible" property for the new
   SC2730 regulator bindings I am preparing in [2]. The bindings for
   the other components do not need any significant changes at the
   moment.
 - Unlike the poweroff and regulator components, the other parts are
   already working with the existing drivers and bindings.

For the other components that still have a "compatible" property used
for matching MFD cells, ensure that an SC2730-specific compatible is
defined in the bindings so that it can be listed in the SC2730-specific
device table in the MFD driver.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>

[1]: https://lore.kernel.org/all/20250926-sc2730-reboot-v1-0-62ebfd3d31bb@abscue.de/
[2]: https://lore.kernel.org/all/20260220-sc2730-regulators-v1-0-3f2bbc9ecf14@abscue.de/

---
Changes in v2:
- Changed PMIC type matching in MFD driver to use an identifier like
  other drivers instead of passing pointers through of_device_id.
- Rebased on next-20260324.
- Link to v1: https://lore.kernel.org/r/20260222-sc27xx-mfd-cells-v1-0-69526fe74c77@abscue.de

---
Otto Pflüger (5):
      dt-bindings: rtc: sc2731: Add compatible for SC2730
      regulator: dt-bindings: sc2731: Deprecate compatible property
      mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
      power: reset: sc27xx: Add platform_device_id table
      regulator: sc2731: Add platform_device_id table

 .../devicetree/bindings/mfd/sprd,sc2731.yaml       |  2 -
 .../bindings/regulator/sprd,sc2731-regulator.yaml  |  4 +-
 .../devicetree/bindings/rtc/sprd,sc2731-rtc.yaml   |  7 ++-
 drivers/mfd/sprd-sc27xx-spi.c                      | 62 ++++++++++++++++++----
 drivers/power/reset/sc27xx-poweroff.c              |  8 +++
 drivers/regulator/sc2731-regulator.c               | 10 +++-
 6 files changed, 77 insertions(+), 16 deletions(-)
---
base-commit: 85964cdcad0fac9a0eb7b87a0f9d88cc074b854c
change-id: 20260221-sc27xx-mfd-cells-dab7905f3aae

Best regards,
-- 
Otto Pflüger <otto.pflueger@abscue.de>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730
  2026-03-25 13:53 [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
@ 2026-03-25 13:53 ` Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 2/5] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Otto Pflüger @ 2026-03-25 13:53 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.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
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] 7+ messages in thread

* [PATCH v2 2/5] regulator: dt-bindings: sc2731: Deprecate compatible property
  2026-03-25 13:53 [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
@ 2026-03-25 13:53 ` Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Otto Pflüger @ 2026-03-25 13:53 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.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
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] 7+ messages in thread

* [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
  2026-03-25 13:53 [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 2/5] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
@ 2026-03-25 13:53 ` Otto Pflüger
  2026-03-29  2:43   ` kernel test robot
  2026-03-25 13:53 ` [PATCH v2 4/5] power: reset: sc27xx: Add platform_device_id table Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 5/5] regulator: sc2731: " Otto Pflüger
  4 siblings, 1 reply; 7+ messages in thread
From: Otto Pflüger @ 2026-03-25 13:53 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 | 62 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 53 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index d6b4350779e6..eb57023fdc3c 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -14,6 +14,11 @@
 #include <linux/spi/spi.h>
 #include <uapi/linux/usb/charger.h>
 
+enum sprd_pmic_type {
+	PMIC_TYPE_SC2730,
+	PMIC_TYPE_SC2731,
+};
+
 #define SPRD_PMIC_INT_MASK_STATUS	0x0
 #define SPRD_PMIC_INT_RAW_STATUS	0x4
 #define SPRD_PMIC_INT_EN		0x8
@@ -50,6 +55,29 @@ struct sprd_pmic_data {
 	u32 charger_det;
 };
 
+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"),
+};
+
 /*
  * Since different PMICs of SC27xx series can have different interrupt
  * base address and irq number, we should save irq number and irq base
@@ -152,12 +180,26 @@ static const struct regmap_config sprd_pmic_config = {
 static int sprd_pmic_probe(struct spi_device *spi)
 {
 	struct sprd_pmic *ddata;
+	enum sprd_pmic_type pmic_type;
 	const struct sprd_pmic_data *pdata;
-	int ret, i;
+	const struct mfd_cell *cells;
+	int ret, i, num_cells;
+
+	pmic_type = (enum sprd_pmic_type)of_device_get_match_data(&spi->dev);
 
-	pdata = of_device_get_match_data(&spi->dev);
-	if (!pdata) {
-		dev_err(&spi->dev, "No matching driver data found\n");
+	switch (pmic_type) {
+	case PMIC_TYPE_SC2730:
+		pdata = &sc2730_data;
+		cells = sc2730_devices;
+		num_cells = ARRAY_SIZE(sc2730_devices);
+		break;
+	case PMIC_TYPE_SC2731:
+		pdata = &sc2731_data;
+		cells = sc2731_devices;
+		num_cells = ARRAY_SIZE(sc2731_devices);
+		break;
+	default:
+		dev_err(&spi->dev, "Invalid device ID\n");
 		return -EINVAL;
 	}
 
@@ -204,7 +246,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,
+				   cells, 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;
@@ -241,15 +285,15 @@ static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops,
 				sprd_pmic_suspend, sprd_pmic_resume);
 
 static const struct of_device_id sprd_pmic_match[] = {
-	{ .compatible = "sprd,sc2730", .data = &sc2730_data },
-	{ .compatible = "sprd,sc2731", .data = &sc2731_data },
+	{ .compatible = "sprd,sc2730", .data = (void *)PMIC_TYPE_SC2730 },
+	{ .compatible = "sprd,sc2731", .data = (void *)PMIC_TYPE_SC2731 },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sprd_pmic_match);
 
 static const struct spi_device_id sprd_pmic_spi_ids[] = {
-	{ .name = "sc2730", .driver_data = (unsigned long)&sc2730_data },
-	{ .name = "sc2731", .driver_data = (unsigned long)&sc2731_data },
+	{ .name = "sc2730", .driver_data = PMIC_TYPE_SC2730 },
+	{ .name = "sc2731", .driver_data = PMIC_TYPE_SC2731 },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, sprd_pmic_spi_ids);

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/5] power: reset: sc27xx: Add platform_device_id table
  2026-03-25 13:53 [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
                   ` (2 preceding siblings ...)
  2026-03-25 13:53 ` [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
@ 2026-03-25 13:53 ` Otto Pflüger
  2026-03-25 13:53 ` [PATCH v2 5/5] regulator: sc2731: " Otto Pflüger
  4 siblings, 0 replies; 7+ messages in thread
From: Otto Pflüger @ 2026-03-25 13:53 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, Sebastian Reichel

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>
---
 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] 7+ messages in thread

* [PATCH v2 5/5] regulator: sc2731: Add platform_device_id table
  2026-03-25 13:53 [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
                   ` (3 preceding siblings ...)
  2026-03-25 13:53 ` [PATCH v2 4/5] power: reset: sc27xx: Add platform_device_id table Otto Pflüger
@ 2026-03-25 13:53 ` Otto Pflüger
  4 siblings, 0 replies; 7+ messages in thread
From: Otto Pflüger @ 2026-03-25 13:53 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.

Acked-by: Mark Brown <broonie@kernel.org>
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] 7+ messages in thread

* Re: [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
  2026-03-25 13:53 ` [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
@ 2026-03-29  2:43   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-03-29  2:43 UTC (permalink / raw)
  To: Otto Pflüger, 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: llvm, oe-kbuild-all, linux-rtc, devicetree, linux-kernel,
	linux-leds, linux-pm, Otto Pflüger

Hi Otto,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 85964cdcad0fac9a0eb7b87a0f9d88cc074b854c]

url:    https://github.com/intel-lab-lkp/linux/commits/Otto-Pfl-ger/dt-bindings-rtc-sc2731-Add-compatible-for-SC2730/20260327-162827
base:   85964cdcad0fac9a0eb7b87a0f9d88cc074b854c
patch link:    https://lore.kernel.org/r/20260325-sc27xx-mfd-cells-v2-3-d0ebb60aa4a7%40abscue.de
patch subject: [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260329/202603291013.6DnmGjG3-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 054e11d1a17e5ba88bb1a8ef32fad3346e80b186)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260329/202603291013.6DnmGjG3-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603291013.6DnmGjG3-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mfd/sprd-sc27xx-spi.c:188:14: warning: cast to smaller integer type 'enum sprd_pmic_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
     188 |         pmic_type = (enum sprd_pmic_type)of_device_get_match_data(&spi->dev);
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +188 drivers/mfd/sprd-sc27xx-spi.c

   179	
   180	static int sprd_pmic_probe(struct spi_device *spi)
   181	{
   182		struct sprd_pmic *ddata;
   183		enum sprd_pmic_type pmic_type;
   184		const struct sprd_pmic_data *pdata;
   185		const struct mfd_cell *cells;
   186		int ret, i, num_cells;
   187	
 > 188		pmic_type = (enum sprd_pmic_type)of_device_get_match_data(&spi->dev);
   189	
   190		switch (pmic_type) {
   191		case PMIC_TYPE_SC2730:
   192			pdata = &sc2730_data;
   193			cells = sc2730_devices;
   194			num_cells = ARRAY_SIZE(sc2730_devices);
   195			break;
   196		case PMIC_TYPE_SC2731:
   197			pdata = &sc2731_data;
   198			cells = sc2731_devices;
   199			num_cells = ARRAY_SIZE(sc2731_devices);
   200			break;
   201		default:
   202			dev_err(&spi->dev, "Invalid device ID\n");
   203			return -EINVAL;
   204		}
   205	
   206		ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL);
   207		if (!ddata)
   208			return -ENOMEM;
   209	
   210		ddata->regmap = devm_regmap_init(&spi->dev, &sprd_pmic_regmap,
   211						 &spi->dev, &sprd_pmic_config);
   212		if (IS_ERR(ddata->regmap)) {
   213			ret = PTR_ERR(ddata->regmap);
   214			dev_err(&spi->dev, "Failed to allocate register map %d\n", ret);
   215			return ret;
   216		}
   217	
   218		spi_set_drvdata(spi, ddata);
   219		ddata->dev = &spi->dev;
   220		ddata->irq = spi->irq;
   221		ddata->pdata = pdata;
   222	
   223		ddata->irq_chip.name = dev_name(&spi->dev);
   224		ddata->irq_chip.status_base =
   225			pdata->irq_base + SPRD_PMIC_INT_MASK_STATUS;
   226		ddata->irq_chip.unmask_base = pdata->irq_base + SPRD_PMIC_INT_EN;
   227		ddata->irq_chip.ack_base = 0;
   228		ddata->irq_chip.num_regs = 1;
   229		ddata->irq_chip.num_irqs = pdata->num_irqs;
   230	
   231		ddata->irqs = devm_kcalloc(&spi->dev,
   232					   pdata->num_irqs, sizeof(struct regmap_irq),
   233					   GFP_KERNEL);
   234		if (!ddata->irqs)
   235			return -ENOMEM;
   236	
   237		ddata->irq_chip.irqs = ddata->irqs;
   238		for (i = 0; i < pdata->num_irqs; i++)
   239			ddata->irqs[i].mask = BIT(i);
   240	
   241		ret = devm_regmap_add_irq_chip(&spi->dev, ddata->regmap, ddata->irq,
   242					       IRQF_ONESHOT, 0,
   243					       &ddata->irq_chip, &ddata->irq_data);
   244		if (ret) {
   245			dev_err(&spi->dev, "Failed to add PMIC irq chip %d\n", ret);
   246			return ret;
   247		}
   248	
   249		ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO,
   250					   cells, num_cells, NULL, 0,
   251					   regmap_irq_get_domain(ddata->irq_data));
   252		if (ret) {
   253			dev_err(&spi->dev, "Failed to populate sub-devices %d\n", ret);
   254			return ret;
   255		}
   256	
   257		ret = devm_device_init_wakeup(&spi->dev);
   258		if (ret)
   259			return dev_err_probe(&spi->dev, ret, "Failed to init wakeup\n");
   260	
   261		return 0;
   262	}
   263	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-29  2:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 13:53 [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices() Otto Pflüger
2026-03-25 13:53 ` [PATCH v2 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730 Otto Pflüger
2026-03-25 13:53 ` [PATCH v2 2/5] regulator: dt-bindings: sc2731: Deprecate compatible property Otto Pflüger
2026-03-25 13:53 ` [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices() Otto Pflüger
2026-03-29  2:43   ` kernel test robot
2026-03-25 13:53 ` [PATCH v2 4/5] power: reset: sc27xx: Add platform_device_id table Otto Pflüger
2026-03-25 13:53 ` [PATCH v2 5/5] regulator: sc2731: " Otto Pflüger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox