All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff
@ 2026-11-23 15:02 Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema Svyatoslav Ryhel
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-23 15:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Svyatoslav Ryhel
  Cc: linux-kernel, devicetree, mfd

Convert existing txt documentation file to DF schema. Remove
platform data use. Switch to device managed poweroff handler.
Add restsrt handler.

---
Changes in v2:
- fixed max8907_power_off return

Changes in v3:
- added idata check in max8907_regulator_probe() for BBAT/SDBY/VRTC
- added conversion to devm_ helpers commit
- switch to devm_register_power_off_handler() and
  of_device_is_system_power_controller()

Changes in v4:
- dropped in-supply type definitions in schema

Changes in v5:
- rebased to be applicable on top of devm_kzalloc_obj conversion
- added restart handler

Changes in v6:
- rebased on top of latest next
- resolved conflict with Lee commit
---

Svyatoslav Ryhel (5):
  regulator: dt-bindings: maxim,max8907: Convert to DT schema
  mfd: max8907: Remove platform_data based probing
  mfd: max8907: Switch to resource-managed versions of helpers
  mfd: max8907: Convert to use device managed poweroff handler
  mfd: max8907: Add restart handler

 .../devicetree/bindings/regulator/max8907.txt |  69 -----
 .../bindings/regulator/maxim,max8907.yaml     | 283 ++++++++++++++++++
 drivers/mfd/max8907.c                         | 168 ++++-------
 drivers/regulator/max8907-regulator.c         |   8 +-
 include/linux/mfd/max8907.h                   |   6 +-
 5 files changed, 349 insertions(+), 185 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/regulator/max8907.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max8907.yaml

-- 
2.53.0


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

* [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema
  2026-11-23 15:02 [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
@ 2026-11-23 15:02 ` Svyatoslav Ryhel
  2026-11-26 15:52   ` Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing Svyatoslav Ryhel
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-23 15:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Svyatoslav Ryhel
  Cc: linux-kernel, devicetree, mfd

Convert Maxim MAX8907 regulator binding from text to DT schema. Reference
to nvidia,tegra-regulators-coupling in child regulator nodes.

Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 .../devicetree/bindings/regulator/max8907.txt |  69 -----
 .../bindings/regulator/maxim,max8907.yaml     | 283 ++++++++++++++++++
 2 files changed, 283 insertions(+), 69 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/regulator/max8907.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max8907.yaml

diff --git a/Documentation/devicetree/bindings/regulator/max8907.txt b/Documentation/devicetree/bindings/regulator/max8907.txt
deleted file mode 100644
index 371eccd1cd689..0000000000000
--- a/Documentation/devicetree/bindings/regulator/max8907.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-MAX8907 regulator
-
-Required properties:
-- compatible: "maxim,max8907"
-- reg: I2C slave address
-- interrupts: The interrupt output of the controller
-- mbatt-supply: The input supply for MBATT, BBAT, SDBY, VRTC.
-- in-v1-supply: The input supply for SD1.
-- in-v2-supply: The input supply for SD2.
-- in-v3-supply: The input supply for SD3.
-- in1-supply: The input supply for LDO1.
-...
-- in20-supply: The input supply for LDO20.
-- regulators: A node that houses a sub-node for each regulator within the
-  device. Each sub-node is identified using the node's name (or the deprecated
-  regulator-compatible property if present), with valid values listed below.
-  The content of each sub-node is defined by the standard binding for
-  regulators; see regulator.txt.
-
-Optional properties:
-- maxim,system-power-controller: Boolean property indicating that the PMIC
-  controls the overall system power.
-
-The valid names for regulators are:
-
-  sd1, sd2, sd3, ldo1, ldo2, ldo3, ldo4, ldo5, ldo6, ldo7, ldo8, ldo9, ldo10,
-  ldo11, ldo12, ldo13, ldo14, ldo15, ldo16, ldo17, ldo18, ldo19, ldo20, out5v,
-  out33v, bbat, sdby, vrtc.
-
-Example:
-
-		max8907@3c {
-			compatible = "maxim,max8907";
-			reg = <0x3c>;
-			interrupts = <0 86 0x4>;
-
-			maxim,system-power-controller;
-
-			mbatt-supply = <&some_reg>;
-			in-v1-supply = <&mbatt_reg>;
-			...
-			in1-supply = <&mbatt_reg>;
-			...
-
-			regulators {
-				mbatt_reg: mbatt {
-					regulator-name = "vbat_pmu";
-					regulator-min-microvolt = <5000000>;
-					regulator-max-microvolt = <5000000>;
-					regulator-always-on;
-				};
-
-				sd1 {
-					regulator-name = "nvvdd_sv1,vdd_cpu_pmu";
-					regulator-min-microvolt = <1000000>;
-					regulator-max-microvolt = <1000000>;
-					regulator-always-on;
-				};
-
-				sd2 {
-					regulator-name = "nvvdd_sv2,vdd_core";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <1200000>;
-					regulator-always-on;
-				};
-...
-			};
-		};
-	};
diff --git a/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml b/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml
new file mode 100644
index 0000000000000..6cf8e93867e1a
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml
@@ -0,0 +1,283 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/maxim,max8907.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX8907 PMIC
+
+maintainers:
+  - Svyatoslav Ryhel <clamor95@gmail.com>
+
+properties:
+  compatible:
+    const: maxim,max8907
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  maxim,system-power-controller:
+    type: boolean
+    deprecated: true
+    description:
+      Telling whether or not this PMIC is controlling the system power.
+
+  system-power-controller: true
+
+  mbatt-supply:
+    description:
+      The input supply for MBATT, BBAT, SDBY, VRTC.
+
+  regulators:
+    type: object
+    additionalProperties: false
+
+    patternProperties:
+      "^(sd[1-3]|ldo([1-9]|1[0-9]|20)|bbat|mbatt|out(5v|33v)|sdby|vrtc)$":
+        allOf:
+          - $ref: /schemas/regulator/regulator.yaml#
+          - $ref: /schemas/regulator/nvidia,tegra-regulators-coupling.yaml#
+        unevaluatedProperties: false
+
+patternProperties:
+  "^in-v[1-3]-supply$":
+    description:
+      The input supply for SD1, SD2 and SD3.
+
+  "^in([1-9]|1[0-9]|20)-supply$":
+    description:
+      The input supply for LDO1 - LDO20.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@3c {
+            compatible = "maxim,max8907";
+            reg = <0x3c>;
+            interrupts = <0 86 0x4>;
+
+            system-power-controller;
+
+            mbatt-supply = <&vdd_5v0_sys>;
+            in-v1-supply = <&vdd_3v3_vbat>;
+            in-v2-supply = <&vdd_3v3_vbat>;
+            in-v3-supply = <&vdd_3v3_vbat>;
+            in1-supply = <&vdd_3v3_vbat>;
+            in2-supply = <&vdd_1v8_vio>;
+            in3-supply = <&vdd_3v3_vbat>;
+            in4-supply = <&vdd_3v3_vbat>;
+            in5-supply = <&vdd_3v3_vbat>;
+            in6-supply = <&vdd_3v3_vbat>;
+            in7-supply = <&vdd_3v3_vbat>;
+            in8-supply = <&vdd_3v3_vbat>;
+            in9-supply = <&vdd_3v3_vbat>;
+            in10-supply = <&vdd_3v3_vbat>;
+            in11-supply = <&vdd_3v3_vbat>;
+            in12-supply = <&vdd_3v3_vbat>;
+            in13-supply = <&vdd_3v3_vbat>;
+            in14-supply = <&vdd_3v3_vbat>;
+            in15-supply = <&vdd_3v3_vbat>;
+            in16-supply = <&vdd_3v3_vbat>;
+            in17-supply = <&vdd_1v8_vio>;
+            in18-supply = <&vdd_3v3_vbat>;
+            in19-supply = <&vdd_3v3_vbat>;
+            in20-supply = <&vdd_3v3_vbat>;
+
+            regulators {
+                vdd_3v3_vbat: mbatt {
+                    regulator-name = "v_powerrail";
+                    regulator-always-on;
+                };
+
+                sd1 {
+                    regulator-name = "vcc_1v2_ddrio";
+                    regulator-min-microvolt = <1200000>;
+                    regulator-max-microvolt = <1200000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                vdd_core: sd2 {
+                    regulator-name = "vdd_core";
+                    regulator-min-microvolt = <950000>;
+                    regulator-max-microvolt = <1300000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                vdd_1v8_vio: sd3 {
+                    regulator-name = "vcc_1v8_io";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                ldo1 {
+                    regulator-name = "vcc_3v3_ddr";
+                    regulator-min-microvolt = <3300000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                ldo2 {
+                    regulator-name = "vcc_1v1_pll";
+                    regulator-min-microvolt = <1100000>;
+                    regulator-max-microvolt = <1100000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                iovcc_1v8_lcd: ldo3 {
+                    regulator-name = "vcc_1v8_lcd";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-boot-on;
+                };
+
+                avdd_3v3_usb: ldo4 {
+                    regulator-name = "avdd_3v3_usb";
+                    regulator-min-microvolt = <3300000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                vcore_emmc: ldo5 {
+                    regulator-name = "vcc_2v8_emmc";
+                    regulator-min-microvolt = <2800000>;
+                    regulator-max-microvolt = <2800000>;
+                    regulator-boot-on;
+                };
+
+                vcc_hdmi_pll: ldo6 {
+                    regulator-name = "vcc_hdmi_pll";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                };
+
+                vcc_3v0_sensor: ldo7 {
+                    regulator-name = "vcc_3v0_sensor";
+                    regulator-min-microvolt = <3000000>;
+                    regulator-max-microvolt = <3000000>;
+                    regulator-boot-on;
+                };
+
+                vcc_1v8_sensor: ldo8 {
+                    regulator-name = "vcc_1v8_sensor";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-boot-on;
+                };
+
+                ldo9 {
+                    regulator-name = "vcc_3v3_fuse";
+                    regulator-min-microvolt = <3300000>;
+                    regulator-max-microvolt = <3300000>;
+                };
+
+                vcc_3v1_touch: ldo10 {
+                    regulator-name = "vcc_3v1_touch";
+                    regulator-min-microvolt = <3100000>;
+                    regulator-max-microvolt = <3100000>;
+                    regulator-boot-on;
+                };
+
+                vdd_3v3_hdmi: ldo11 {
+                    regulator-name = "vdd_3v3_hdmi";
+                    regulator-min-microvolt = <3300000>;
+                    regulator-max-microvolt = <3300000>;
+                };
+
+                vdd_usd: ldo12 {
+                    regulator-name = "vcc_2v8_sdio";
+                    regulator-min-microvolt = <2800000>;
+                    regulator-max-microvolt = <2800000>;
+                    regulator-boot-on;
+                };
+
+                vcc_3v0_motor: ldo13 {
+                    regulator-name = "vcc_3v0_motor";
+                    regulator-min-microvolt = <3000000>;
+                    regulator-max-microvolt = <3000000>;
+                };
+
+                vcc_2v8_lcd: ldo14 {
+                    regulator-name = "vcc_2v8_lcd";
+                    regulator-min-microvolt = <2800000>;
+                    regulator-max-microvolt = <2800000>;
+                    regulator-boot-on;
+                };
+
+                vcc_3v3_temp: ldo15 {
+                    regulator-name = "vcc_3v3_temp";
+                    regulator-min-microvolt = <3300000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-boot-on;
+                };
+
+                /* LDO16 is not used */
+
+                avdd_dsi_csi: ldo17 {
+                    regulator-name = "vcc_1v2_mipi";
+                    regulator-min-microvolt = <1200000>;
+                    regulator-max-microvolt = <1200000>;
+                };
+
+                ldo18 {
+                    regulator-name = "vcc_1v8_vi";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                };
+
+                vcc_1v8_touch: ldo19 {
+                    regulator-name = "vcc_1v8_touch";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-boot-on;
+                };
+
+                /* LDO20 is not used */
+
+                out5v {
+                    regulator-name = "usb0_vbus_reg";
+                    regulator-min-microvolt = <5000000>;
+                    regulator-max-microvolt = <5000000>;
+                };
+
+                /* OUT33V is not used */
+
+                bbat {
+                    regulator-name = "vcc_bbat";
+                };
+
+                vdd_rtc: sdby {
+                    regulator-name = "vcc_rtc";
+                    regulator-min-microvolt = <950000>;
+                    regulator-max-microvolt = <1300000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+
+                vrtc {
+                    regulator-name = "vrtc";
+                };
+            };
+        };
+    };
+...
-- 
2.53.0


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

* [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing
  2026-11-23 15:02 [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema Svyatoslav Ryhel
@ 2026-11-23 15:02 ` Svyatoslav Ryhel
  2026-12-02 16:44   ` Lee Jones
  2026-11-23 15:02 ` [PATCH v6 3/5] mfd: max8907: Switch to resource-managed versions of helpers Svyatoslav Ryhel
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-23 15:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Svyatoslav Ryhel
  Cc: linux-kernel, devicetree, mfd

There are no in-tree users of this driver, but it supports devicetree
based probing, which means external dtb files may exist that work with
this.

Remove the unused legacy code and make this a DT-only driver.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/mfd/max8907.c                 | 8 +-------
 drivers/regulator/max8907-regulator.c | 8 +++-----
 include/linux/mfd/max8907.h           | 5 -----
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
index 2f91791410538..a0e0c480ff43e 100644
--- a/drivers/mfd/max8907.c
+++ b/drivers/mfd/max8907.c
@@ -188,13 +188,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
 {
 	struct max8907 *max8907;
 	int ret;
-	struct max8907_platform_data *pdata = dev_get_platdata(&i2c->dev);
-	bool pm_off = false;
-
-	if (pdata)
-		pm_off = pdata->pm_off;
-	else if (i2c->dev.of_node)
-		pm_off = of_property_read_bool(i2c->dev.of_node,
+	bool pm_off = of_property_read_bool(i2c->dev.of_node,
 					"maxim,system-power-controller");
 
 	max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
index fd227fd136121..84de0c443c945 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -274,7 +274,6 @@ static inline struct device_node *match_of_node(int index)
 static int max8907_regulator_probe(struct platform_device *pdev)
 {
 	struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
-	struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev);
 	int ret;
 	struct max8907_regulator *pmic;
 	unsigned int val;
@@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)
 		struct regulator_dev *rdev;
 
 		config.dev = pdev->dev.parent;
-		if (pdata)
-			idata = pdata->init_data[i];
-		else
-			idata = match_init_data(i);
+
+		idata = match_init_data(i);
+
 		config.init_data = idata;
 		config.driver_data = pmic;
 		config.regmap = max8907->regmap_gen;
diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
index 4be3c2370e2a4..e222250f0cc1e 100644
--- a/include/linux/mfd/max8907.h
+++ b/include/linux/mfd/max8907.h
@@ -227,11 +227,6 @@ enum {
 	MAX8907_IRQ_RTC_ALARM0,
 };
 
-struct max8907_platform_data {
-	struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS];
-	bool pm_off;
-};
-
 struct regmap_irq_chips_data;
 
 struct max8907 {
-- 
2.53.0


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

* [PATCH v6 3/5] mfd: max8907: Switch to resource-managed versions of helpers
  2026-11-23 15:02 [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing Svyatoslav Ryhel
@ 2026-11-23 15:02 ` Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler Svyatoslav Ryhel
  2026-11-23 15:02 ` [PATCH v6 5/5] mfd: max8907: Add restart handler Svyatoslav Ryhel
  4 siblings, 0 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-23 15:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Svyatoslav Ryhel
  Cc: linux-kernel, devicetree, mfd

Switch to resource-managed versions of regmap_add_irq_chip() and
i2c_new_dummy_device(). This involves probe refactoring in order to
remove jumps and allows to drop the .remove callback.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/mfd/max8907.c | 140 ++++++++++++++----------------------------
 1 file changed, 46 insertions(+), 94 deletions(-)

diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
index a0e0c480ff43e..f1cabb666d8ed 100644
--- a/drivers/mfd/max8907.c
+++ b/drivers/mfd/max8907.c
@@ -186,117 +186,70 @@ static int max8907_power_off(struct sys_off_data *data)
 
 static int max8907_i2c_probe(struct i2c_client *i2c)
 {
+	struct device *dev = &i2c->dev;
 	struct max8907 *max8907;
 	int ret;
-	bool pm_off = of_property_read_bool(i2c->dev.of_node,
+	bool pm_off = of_property_read_bool(dev->of_node,
 					"maxim,system-power-controller");
 
-	max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
-	if (!max8907) {
-		ret = -ENOMEM;
-		goto err_alloc_drvdata;
-	}
+	max8907 = devm_kzalloc_obj(dev, struct max8907);
+	if (!max8907)
+		return -ENOMEM;
 
-	max8907->dev = &i2c->dev;
+	max8907->dev = dev;
 	max8907->i2c_gen = i2c;
 	i2c_set_clientdata(i2c, max8907);
+
 	max8907->regmap_gen = devm_regmap_init_i2c(i2c,
-						&max8907_regmap_gen_config);
-	if (IS_ERR(max8907->regmap_gen)) {
-		ret = PTR_ERR(max8907->regmap_gen);
-		dev_err(&i2c->dev, "gen regmap init failed: %d\n", ret);
-		goto err_regmap_gen;
-	}
+						   &max8907_regmap_gen_config);
+	if (IS_ERR(max8907->regmap_gen))
+		return dev_err_probe(dev, PTR_ERR(max8907->regmap_gen),
+				     "GEN regmap init failed\n");
 
-	max8907->i2c_rtc = i2c_new_dummy_device(i2c->adapter, MAX8907_RTC_I2C_ADDR);
-	if (IS_ERR(max8907->i2c_rtc)) {
-		ret = PTR_ERR(max8907->i2c_rtc);
-		goto err_dummy_rtc;
-	}
-	i2c_set_clientdata(max8907->i2c_rtc, max8907);
-	max8907->regmap_rtc = devm_regmap_init_i2c(max8907->i2c_rtc,
-						&max8907_regmap_rtc_config);
-	if (IS_ERR(max8907->regmap_rtc)) {
-		ret = PTR_ERR(max8907->regmap_rtc);
-		dev_err(&i2c->dev, "rtc regmap init failed: %d\n", ret);
-		goto err_regmap_rtc;
-	}
+	max8907->i2c_rtc = devm_i2c_new_dummy_device(dev, i2c->adapter, MAX8907_RTC_I2C_ADDR);
+	if (IS_ERR(max8907->i2c_rtc))
+		return PTR_ERR(max8907->i2c_rtc);
 
-	ret = regmap_add_irq_chip(max8907->regmap_gen, max8907->i2c_gen->irq,
-				  IRQF_ONESHOT | IRQF_SHARED,
-				  -1, &max8907_chg_irq_chip,
-				  &max8907->irqc_chg);
-	if (ret != 0) {
-		dev_err(&i2c->dev, "failed to add chg irq chip: %d\n", ret);
-		goto err_irqc_chg;
-	}
-	ret = regmap_add_irq_chip(max8907->regmap_gen, max8907->i2c_gen->irq,
-				  IRQF_ONESHOT | IRQF_SHARED, -1,
-				  &max8907_on_off_irq_chip,
-				  &max8907->irqc_on_off);
-	if (ret != 0) {
-		dev_err(&i2c->dev, "failed to add on off irq chip: %d\n", ret);
-		goto err_irqc_on_off;
-	}
-	ret = regmap_add_irq_chip(max8907->regmap_rtc, max8907->i2c_gen->irq,
-				  IRQF_ONESHOT | IRQF_SHARED, -1,
-				  &max8907_rtc_irq_chip,
-				  &max8907->irqc_rtc);
-	if (ret != 0) {
-		dev_err(&i2c->dev, "failed to add rtc irq chip: %d\n", ret);
-		goto err_irqc_rtc;
-	}
+	i2c_set_clientdata(max8907->i2c_rtc, max8907);
 
-	ret = mfd_add_devices(max8907->dev, -1, max8907_cells,
-			      ARRAY_SIZE(max8907_cells), NULL, 0, NULL);
-	if (ret != 0) {
-		dev_err(&i2c->dev, "failed to add MFD devices %d\n", ret);
-		goto err_add_devices;
-	}
+	max8907->regmap_rtc = devm_regmap_init_i2c(max8907->i2c_rtc,
+						   &max8907_regmap_rtc_config);
+	if (IS_ERR(max8907->regmap_rtc))
+		return dev_err_probe(dev, PTR_ERR(max8907->regmap_rtc),
+				     "RTC regmap init failed\n");
+
+	ret = devm_regmap_add_irq_chip(dev, max8907->regmap_gen, max8907->i2c_gen->irq,
+				       IRQF_ONESHOT | IRQF_SHARED, -1, &max8907_chg_irq_chip,
+				       &max8907->irqc_chg);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add chg irq chip\n");
+
+	ret = devm_regmap_add_irq_chip(dev, max8907->regmap_gen, max8907->i2c_gen->irq,
+				       IRQF_ONESHOT | IRQF_SHARED, -1, &max8907_on_off_irq_chip,
+				       &max8907->irqc_on_off);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add on off irq chip\n");
+
+	ret = devm_regmap_add_irq_chip(dev, max8907->regmap_rtc, max8907->i2c_gen->irq,
+				       IRQF_ONESHOT | IRQF_SHARED, -1, &max8907_rtc_irq_chip,
+				       &max8907->irqc_rtc);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add rtc irq chip\n");
+
+	ret = devm_mfd_add_devices(dev, -1, max8907_cells, ARRAY_SIZE(max8907_cells),
+				   NULL, 0, NULL);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add MFD devices\n");
 
 	if (pm_off) {
-		ret = devm_register_sys_off_handler(&i2c->dev,
-						    SYS_OFF_MODE_POWER_OFF,
+		ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
 						    SYS_OFF_PRIO_DEFAULT,
 						    max8907_power_off, max8907);
-		if (ret) {
-			dev_err(&i2c->dev,
-				"failed to register sys-off handler: %d\n",
-				ret);
-			goto err_sys_off;
-		}
+		if (ret)
+			return dev_err_probe(dev, ret, "failed to register sys-off handler\n");
 	}
 
 	return 0;
-
-err_sys_off:
-	mfd_remove_devices(max8907->dev);
-err_add_devices:
-	regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_rtc);
-err_irqc_rtc:
-	regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_on_off);
-err_irqc_on_off:
-	regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_chg);
-err_irqc_chg:
-err_regmap_rtc:
-	i2c_unregister_device(max8907->i2c_rtc);
-err_dummy_rtc:
-err_regmap_gen:
-err_alloc_drvdata:
-	return ret;
-}
-
-static void max8907_i2c_remove(struct i2c_client *i2c)
-{
-	struct max8907 *max8907 = i2c_get_clientdata(i2c);
-
-	mfd_remove_devices(max8907->dev);
-
-	regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_rtc);
-	regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_on_off);
-	regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_chg);
-
-	i2c_unregister_device(max8907->i2c_rtc);
 }
 
 #ifdef CONFIG_OF
@@ -319,7 +272,6 @@ static struct i2c_driver max8907_i2c_driver = {
 		.of_match_table = of_match_ptr(max8907_of_match),
 	},
 	.probe = max8907_i2c_probe,
-	.remove = max8907_i2c_remove,
 	.id_table = max8907_i2c_id,
 };
 
-- 
2.53.0


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

* [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler
  2026-11-23 15:02 [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
                   ` (2 preceding siblings ...)
  2026-11-23 15:02 ` [PATCH v6 3/5] mfd: max8907: Switch to resource-managed versions of helpers Svyatoslav Ryhel
@ 2026-11-23 15:02 ` Svyatoslav Ryhel
  2026-11-23 15:10   ` sashiko-bot
  2026-11-23 15:02 ` [PATCH v6 5/5] mfd: max8907: Add restart handler Svyatoslav Ryhel
  4 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-23 15:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Svyatoslav Ryhel
  Cc: linux-kernel, devicetree, mfd

Replace devm_register_sys_off_handler() function with the dedicated
devm_register_power_off_handler() helper.

There are no in-kernel users of maxim,system-power-controller property and
all new users will use generic system-power-controller so check for the
legacy property can be removed.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/mfd/max8907.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
index f1cabb666d8ed..5d17971a8e9ab 100644
--- a/drivers/mfd/max8907.c
+++ b/drivers/mfd/max8907.c
@@ -189,8 +189,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
 	struct device *dev = &i2c->dev;
 	struct max8907 *max8907;
 	int ret;
-	bool pm_off = of_property_read_bool(dev->of_node,
-					"maxim,system-power-controller");
 
 	max8907 = devm_kzalloc_obj(dev, struct max8907);
 	if (!max8907)
@@ -241,12 +239,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to add MFD devices\n");
 
-	if (pm_off) {
-		ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
-						    SYS_OFF_PRIO_DEFAULT,
-						    max8907_power_off, max8907);
+	if (of_device_is_system_power_controller(dev->of_node)) {
+		ret = devm_register_power_off_handler(dev, max8907_power_off, max8907);
 		if (ret)
-			return dev_err_probe(dev, ret, "failed to register sys-off handler\n");
+			return dev_err_probe(dev, ret, "failed to register power-off handler\n");
 	}
 
 	return 0;
-- 
2.53.0


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

* [PATCH v6 5/5] mfd: max8907: Add restart handler
  2026-11-23 15:02 [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
                   ` (3 preceding siblings ...)
  2026-11-23 15:02 ` [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler Svyatoslav Ryhel
@ 2026-11-23 15:02 ` Svyatoslav Ryhel
  4 siblings, 0 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-23 15:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Svyatoslav Ryhel
  Cc: linux-kernel, devicetree, mfd

Add restart handler to reset hardware properly on system reboot.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/mfd/max8907.c       | 14 ++++++++++++++
 include/linux/mfd/max8907.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
index 5d17971a8e9ab..fe71ada77696b 100644
--- a/drivers/mfd/max8907.c
+++ b/drivers/mfd/max8907.c
@@ -184,6 +184,16 @@ static int max8907_power_off(struct sys_off_data *data)
 	return NOTIFY_DONE;
 }
 
+static int max8907_restart(struct sys_off_data *data)
+{
+	struct max8907 *max8907 = data->cb_data;
+
+	regmap_update_bits(max8907->regmap_gen, MAX8907_REG_RESET_CNFG,
+			   MAX8907_MASK_SOFT_RESET, MAX8907_MASK_SOFT_RESET);
+
+	return NOTIFY_DONE;
+}
+
 static int max8907_i2c_probe(struct i2c_client *i2c)
 {
 	struct device *dev = &i2c->dev;
@@ -243,6 +253,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
 		ret = devm_register_power_off_handler(dev, max8907_power_off, max8907);
 		if (ret)
 			return dev_err_probe(dev, ret, "failed to register power-off handler\n");
+
+		ret = devm_register_restart_handler(dev, max8907_restart, max8907);
+		if (ret)
+			return dev_err_probe(dev, ret, "failed to register restart handler\n");
 	}
 
 	return 0;
diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
index e222250f0cc1e..025874e5f8808 100644
--- a/include/linux/mfd/max8907.h
+++ b/include/linux/mfd/max8907.h
@@ -164,6 +164,7 @@
 #define MAX8907_MASK_OUT5V_VINEN	0x10
 #define MAX8907_MASK_OUT5V_ENSRC	0x0E
 #define MAX8907_MASK_OUT5V_EN		0x01
+#define MAX8907_MASK_SOFT_RESET		0x20
 #define MAX8907_MASK_POWER_OFF		0x40
 
 /* Regulator IDs */
-- 
2.53.0


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

* Re: [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler
  2026-11-23 15:02 ` [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler Svyatoslav Ryhel
@ 2026-11-23 15:10   ` sashiko-bot
  2026-12-02 16:42     ` Lee Jones
  0 siblings, 1 reply; 19+ messages in thread
From: sashiko-bot @ 2026-11-23 15:10 UTC (permalink / raw)
  To: Svyatoslav Ryhel; +Cc: devicetree, mfd, robh, conor+dt, lee

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mfd: max8907: max8907_i2c_probe() drops
  maxim,system-power-controller check
--

commit b8bc64d186feb8ec318721e193d4a0bf70c6eebf
Author: Svyatoslav Ryhel <clamor95@gmail.com>

mfd: max8907: Convert to use device managed poweroff handler

This commit replaces devm_register_sys_off_handler() with
devm_register_power_off_handler() and switches the DT check from
maxim,system-power-controller to of_device_is_system_power_controller().

> diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> index f1cabb666d8ed..5d17971a8e9ab 100644
> --- a/drivers/mfd/max8907.c
> +++ b/drivers/mfd/max8907.c
> @@ -189,8 +189,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
>  	struct device *dev = &i2c->dev;
>  	struct max8907 *max8907;
>  	int ret;
> -	bool pm_off = of_property_read_bool(dev->of_node,
> -					"maxim,system-power-controller");
>  
>  	max8907 = devm_kzalloc_obj(dev, struct max8907);
>  	if (!max8907)
> @@ -241,12 +239,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
>  	if (ret)
>  		return dev_err_probe(dev, ret, "Failed to add MFD devices\n");
>  
> -	if (pm_off) {
> -		ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
> -						    SYS_OFF_PRIO_DEFAULT,
> -						    max8907_power_off, max8907);
> +	if (of_device_is_system_power_controller(dev->of_node)) {
> +		ret = devm_register_power_off_handler(dev, max8907_power_off, max8907);
>  		if (ret)
> -			return dev_err_probe(dev, ret, "failed to register sys-off handler\n");
> +			return dev_err_probe(dev, ret, "failed to register power-off handler\n");
>  	}
>  
>  	return 0;

[Severity: Medium]
Should max8907_i2c_probe() continue checking the legacy
maxim,system-power-controller property as a fallback alongside
of_device_is_system_power_controller()?

of_device_is_system_power_controller() only checks the standard
system-power-controller property.  In commit "regulator: dt-bindings:
maxim,max8907: Convert to DT schema" earlier in this series,
Documentation/devicetree/bindings/regulator/maxim,max8907.yaml keeps
maxim,system-power-controller as a deprecated property rather than
removing it, and commit "mfd: max8907: Remove platform_data based probing"
notes that external DTBs may exist.  On a board booting with an existing
DTB that uses maxim,system-power-controller, max8907_i2c_probe() will now
skip registering the power-off handler, leaving the system unable to power
off via the PMIC.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123150224.199601-1-clamor95@gmail.com?part=4

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

* Re: [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema
  2026-11-23 15:02 ` [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema Svyatoslav Ryhel
@ 2026-11-26 15:52   ` Svyatoslav Ryhel
  2026-11-26 16:03     ` Mark Brown
  0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-26 15:52 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: Liam Girdwood, Rob Herring, Svyatoslav Ryhel, Krzysztof Kozlowski,
	linux-kernel, devicetree, mfd, Conor Dooley

пн, 23 лист. 2026 р. о 17:02 Svyatoslav Ryhel <clamor95@gmail.com> пише:
>
> Convert Maxim MAX8907 regulator binding from text to DT schema. Reference
> to nvidia,tegra-regulators-coupling in child regulator nodes.
>
> Acked-by: Mark Brown <broonie@kernel.org>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  .../devicetree/bindings/regulator/max8907.txt |  69 -----
>  .../bindings/regulator/maxim,max8907.yaml     | 283 ++++++++++++++++++
>  2 files changed, 283 insertions(+), 69 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/regulator/max8907.txt
>  create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max8907.yaml
>

Hello Mark!

This patch is prerequisite for MAX8907 LED patch. Since Lee is quite
strict to what he picks maybe you can pick this, LED and ADC[1] device
tree patches?

[1] https://lore.kernel.org/lkml/20261123150725.212836-2-clamor95@gmail.com/

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

* Re: [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema
  2026-11-26 15:52   ` Svyatoslav Ryhel
@ 2026-11-26 16:03     ` Mark Brown
  2026-11-26 16:05       ` Svyatoslav Ryhel
  2026-12-02 16:41       ` Lee Jones
  0 siblings, 2 replies; 19+ messages in thread
From: Mark Brown @ 2026-11-26 16:03 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Krzysztof Kozlowski,
	linux-kernel, devicetree, mfd, Conor Dooley

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

On Thu, Nov 26, 2026 at 05:52:22PM +0200, Svyatoslav Ryhel wrote:

> This patch is prerequisite for MAX8907 LED patch. Since Lee is quite
> strict to what he picks maybe you can pick this, LED and ADC[1] device
> tree patches?

Please send a coherent series that can actually be applied, it's too
much work to pick random patches out of independent serieses.  In
general you should try to avoid dependencies on in flight serieses, it
makes everything much harder to manage.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema
  2026-11-26 16:03     ` Mark Brown
@ 2026-11-26 16:05       ` Svyatoslav Ryhel
  2026-12-02 16:41       ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-26 16:05 UTC (permalink / raw)
  To: Mark Brown
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Krzysztof Kozlowski,
	linux-kernel, devicetree, mfd, Conor Dooley

чт, 26 лист. 2026 р. о 18:03 Mark Brown <broonie@kernel.org> пише:
>
> On Thu, Nov 26, 2026 at 05:52:22PM +0200, Svyatoslav Ryhel wrote:
>
> > This patch is prerequisite for MAX8907 LED patch. Since Lee is quite
> > strict to what he picks maybe you can pick this, LED and ADC[1] device
> > tree patches?
>
> Please send a coherent series that can actually be applied, it's too
> much work to pick random patches out of independent serieses.  In
> general you should try to avoid dependencies on in flight serieses, it
> makes everything much harder to manage.

Ok. This is how work with Lee and mfd usually looks like :(

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

* Re: [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema
  2026-11-26 16:03     ` Mark Brown
  2026-11-26 16:05       ` Svyatoslav Ryhel
@ 2026-12-02 16:41       ` Lee Jones
  2026-12-02 16:43         ` Svyatoslav Ryhel
  1 sibling, 1 reply; 19+ messages in thread
From: Lee Jones @ 2026-12-02 16:41 UTC (permalink / raw)
  To: Mark Brown
  Cc: Svyatoslav Ryhel, Liam Girdwood, Rob Herring, Krzysztof Kozlowski,
	linux-kernel, devicetree, mfd, Conor Dooley

On Thu, 26 Nov 2026, Mark Brown wrote:

> On Thu, Nov 26, 2026 at 05:52:22PM +0200, Svyatoslav Ryhel wrote:
> 
> > This patch is prerequisite for MAX8907 LED patch. Since Lee is quite
> > strict to what he picks maybe you can pick this, LED and ADC[1] device
> > tree patches?
> 
> Please send a coherent series that can actually be applied, it's too
> much work to pick random patches out of independent serieses.  In
> general you should try to avoid dependencies on in flight serieses, it
> makes everything much harder to manage.

This set looks entangled with Regulator one way or the other.

Would you like to take this patch and:

  regulator: dt-bindings: maxim,max8907: Document LED support

Or shall I take all of them and send out a PR?

-- 
Lee Jones

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

* Re: [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler
  2026-11-23 15:10   ` sashiko-bot
@ 2026-12-02 16:42     ` Lee Jones
  2026-12-02 16:44       ` Svyatoslav Ryhel
  0 siblings, 1 reply; 19+ messages in thread
From: Lee Jones @ 2026-12-02 16:42 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: Svyatoslav Ryhel, devicetree, mfd, robh, conor+dt

On Mon, 23 Nov 2026, sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] mfd: max8907: max8907_i2c_probe() drops
>   maxim,system-power-controller check
> --
> 
> commit b8bc64d186feb8ec318721e193d4a0bf70c6eebf
> Author: Svyatoslav Ryhel <clamor95@gmail.com>
> 
> mfd: max8907: Convert to use device managed poweroff handler
> 
> This commit replaces devm_register_sys_off_handler() with
> devm_register_power_off_handler() and switches the DT check from
> maxim,system-power-controller to of_device_is_system_power_controller().
> 
> > diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> > index f1cabb666d8ed..5d17971a8e9ab 100644
> > --- a/drivers/mfd/max8907.c
> > +++ b/drivers/mfd/max8907.c
> > @@ -189,8 +189,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> >  	struct device *dev = &i2c->dev;
> >  	struct max8907 *max8907;
> >  	int ret;
> > -	bool pm_off = of_property_read_bool(dev->of_node,
> > -					"maxim,system-power-controller");
> >  
> >  	max8907 = devm_kzalloc_obj(dev, struct max8907);
> >  	if (!max8907)
> > @@ -241,12 +239,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> >  	if (ret)
> >  		return dev_err_probe(dev, ret, "Failed to add MFD devices\n");
> >  
> > -	if (pm_off) {
> > -		ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
> > -						    SYS_OFF_PRIO_DEFAULT,
> > -						    max8907_power_off, max8907);
> > +	if (of_device_is_system_power_controller(dev->of_node)) {
> > +		ret = devm_register_power_off_handler(dev, max8907_power_off, max8907);
> >  		if (ret)
> > -			return dev_err_probe(dev, ret, "failed to register sys-off handler\n");
> > +			return dev_err_probe(dev, ret, "failed to register power-off handler\n");
> >  	}
> >  
> >  	return 0;
> 
> [Severity: Medium]
> Should max8907_i2c_probe() continue checking the legacy
> maxim,system-power-controller property as a fallback alongside
> of_device_is_system_power_controller()?
> 
> of_device_is_system_power_controller() only checks the standard
> system-power-controller property.  In commit "regulator: dt-bindings:
> maxim,max8907: Convert to DT schema" earlier in this series,
> Documentation/devicetree/bindings/regulator/maxim,max8907.yaml keeps
> maxim,system-power-controller as a deprecated property rather than
> removing it, and commit "mfd: max8907: Remove platform_data based probing"
> notes that external DTBs may exist.  On a board booting with an existing
> DTB that uses maxim,system-power-controller, max8907_i2c_probe() will now
> skip registering the power-off handler, leaving the system unable to power
> off via the PMIC.

Do I assume that your silence means that you do not agree?

I usually like submitters to at least acknowledge the warning.

-- 
Lee Jones

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

* Re: [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema
  2026-12-02 16:41       ` Lee Jones
@ 2026-12-02 16:43         ` Svyatoslav Ryhel
  0 siblings, 0 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-02 16:43 UTC (permalink / raw)
  To: Lee Jones
  Cc: Mark Brown, Liam Girdwood, Rob Herring, Krzysztof Kozlowski,
	linux-kernel, devicetree, mfd, Conor Dooley

ср, 2 груд. 2026 р. о 18:41 Lee Jones <lee@kernel.org> пише:
>
> On Thu, 26 Nov 2026, Mark Brown wrote:
>
> > On Thu, Nov 26, 2026 at 05:52:22PM +0200, Svyatoslav Ryhel wrote:
> >
> > > This patch is prerequisite for MAX8907 LED patch. Since Lee is quite
> > > strict to what he picks maybe you can pick this, LED and ADC[1] device
> > > tree patches?
> >
> > Please send a coherent series that can actually be applied, it's too
> > much work to pick random patches out of independent serieses.  In
> > general you should try to avoid dependencies on in flight serieses, it
> > makes everything much harder to manage.
>
> This set looks entangled with Regulator one way or the other.
>
> Would you like to take this patch and:
>
>   regulator: dt-bindings: maxim,max8907: Document LED support
>
> Or shall I take all of them and send out a PR?
>

FOR MARK: https://lore.kernel.org/lkml/20261127163612.280186-1-clamor95@gmail.com/

FOR LEE: https://lore.kernel.org/lkml/20261127164044.285910-1-clamor95@gmail.com/

> --
> Lee Jones

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

* Re: [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler
  2026-12-02 16:42     ` Lee Jones
@ 2026-12-02 16:44       ` Svyatoslav Ryhel
  2026-12-02 20:14         ` Lee Jones
  0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-02 16:44 UTC (permalink / raw)
  To: Lee Jones; +Cc: sashiko-reviews, devicetree, mfd, robh, conor+dt

ср, 2 груд. 2026 р. о 18:42 Lee Jones <lee@kernel.org> пише:
>
> On Mon, 23 Nov 2026, sashiko-bot@kernel.org wrote:
>
> > Thank you for your contribution! Sashiko AI review found 1 potential
> > issue to consider:
> > - [Medium] mfd: max8907: max8907_i2c_probe() drops
> >   maxim,system-power-controller check
> > --
> >
> > commit b8bc64d186feb8ec318721e193d4a0bf70c6eebf
> > Author: Svyatoslav Ryhel <clamor95@gmail.com>
> >
> > mfd: max8907: Convert to use device managed poweroff handler
> >
> > This commit replaces devm_register_sys_off_handler() with
> > devm_register_power_off_handler() and switches the DT check from
> > maxim,system-power-controller to of_device_is_system_power_controller().
> >
> > > diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> > > index f1cabb666d8ed..5d17971a8e9ab 100644
> > > --- a/drivers/mfd/max8907.c
> > > +++ b/drivers/mfd/max8907.c
> > > @@ -189,8 +189,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> > >     struct device *dev = &i2c->dev;
> > >     struct max8907 *max8907;
> > >     int ret;
> > > -   bool pm_off = of_property_read_bool(dev->of_node,
> > > -                                   "maxim,system-power-controller");
> > >
> > >     max8907 = devm_kzalloc_obj(dev, struct max8907);
> > >     if (!max8907)
> > > @@ -241,12 +239,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> > >     if (ret)
> > >             return dev_err_probe(dev, ret, "Failed to add MFD devices\n");
> > >
> > > -   if (pm_off) {
> > > -           ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
> > > -                                               SYS_OFF_PRIO_DEFAULT,
> > > -                                               max8907_power_off, max8907);
> > > +   if (of_device_is_system_power_controller(dev->of_node)) {
> > > +           ret = devm_register_power_off_handler(dev, max8907_power_off, max8907);
> > >             if (ret)
> > > -                   return dev_err_probe(dev, ret, "failed to register sys-off handler\n");
> > > +                   return dev_err_probe(dev, ret, "failed to register power-off handler\n");
> > >     }
> > >
> > >     return 0;
> >
> > [Severity: Medium]
> > Should max8907_i2c_probe() continue checking the legacy
> > maxim,system-power-controller property as a fallback alongside
> > of_device_is_system_power_controller()?
> >
> > of_device_is_system_power_controller() only checks the standard
> > system-power-controller property.  In commit "regulator: dt-bindings:
> > maxim,max8907: Convert to DT schema" earlier in this series,
> > Documentation/devicetree/bindings/regulator/maxim,max8907.yaml keeps
> > maxim,system-power-controller as a deprecated property rather than
> > removing it, and commit "mfd: max8907: Remove platform_data based probing"
> > notes that external DTBs may exist.  On a board booting with an existing
> > DTB that uses maxim,system-power-controller, max8907_i2c_probe() will now
> > skip registering the power-off handler, leaving the system unable to power
> > off via the PMIC.
>
> Do I assume that your silence means that you do not agree?
>
> I usually like submitters to at least acknowledge the warning.
>

Literally in the commit message:

"There are no in-kernel users of maxim,system-power-controller property and
all new users will use generic system-power-controller so check for the
legacy property can be removed."

> --
> Lee Jones

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

* Re: [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing
  2026-11-23 15:02 ` [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing Svyatoslav Ryhel
@ 2026-12-02 16:44   ` Lee Jones
  2026-12-02 16:48     ` Svyatoslav Ryhel
  0 siblings, 1 reply; 19+ messages in thread
From: Lee Jones @ 2026-12-02 16:44 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-kernel, devicetree, mfd

On Mon, 23 Nov 2026, Svyatoslav Ryhel wrote:
> There are no in-tree users of this driver, but it supports devicetree
> based probing, which means external dtb files may exist that work with
> this.
>
> Remove the unused legacy code and make this a DT-only driver.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  drivers/mfd/max8907.c                 | 8 +-------
>  drivers/regulator/max8907-regulator.c | 8 +++-----
>  include/linux/mfd/max8907.h           | 5 -----
>  3 files changed, 4 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> index 2f91791410538..a0e0c480ff43e 100644
> --- a/drivers/mfd/max8907.c
> +++ b/drivers/mfd/max8907.c
> @@ -188,13 +188,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
>  {
>  	struct max8907 *max8907;
>  	int ret;
> -	struct max8907_platform_data *pdata = dev_get_platdata(&i2c->dev);
> -	bool pm_off = false;
> -
> -	if (pdata)
> -		pm_off = pdata->pm_off;
> -	else if (i2c->dev.of_node)
> -		pm_off = of_property_read_bool(i2c->dev.of_node,
> +	bool pm_off = of_property_read_bool(i2c->dev.of_node,
>  					"maxim,system-power-controller");
>
>  	max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
> diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
> index fd227fd136121..84de0c443c945 100644
> --- a/drivers/regulator/max8907-regulator.c
> +++ b/drivers/regulator/max8907-regulator.c
> @@ -274,7 +274,6 @@ static inline struct device_node *match_of_node(int index)
>  static int max8907_regulator_probe(struct platform_device *pdev)
>  {
>  	struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
> -	struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev);
>  	int ret;
>  	struct max8907_regulator *pmic;
>  	unsigned int val;
> @@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)
>  		struct regulator_dev *rdev;
>
>  		config.dev = pdev->dev.parent;
> -		if (pdata)
> -			idata = pdata->init_data[i];
> -		else
> -			idata = match_init_data(i);
> +
> +		idata = match_init_data(i);

In v3's changelog you noted:

"added idata check in max8907_regulator_probe() for BBAT/SDBY/VRTC"

... but that NULL guard around 'idata->supply_regulator' seems to have
been dropped here?  When a DT omits the 'bbat', 'sdby', or 'vrtc' child
node, match_init_data() returns NULL and it will dereference a NULL
pointer, no?

>  		config.init_data = idata;
>  		config.driver_data = pmic;
>  		config.regmap = max8907->regmap_gen;
> diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
> index 4be3c2370e2a4..e222250f0cc1e 100644
> --- a/include/linux/mfd/max8907.h
> +++ b/include/linux/mfd/max8907.h
> @@ -227,11 +227,6 @@ enum {
>  	MAX8907_IRQ_RTC_ALARM0,
>  };
>
> -struct max8907_platform_data {
> -	struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS];
> -	bool pm_off;
> -};
> -
>  struct regmap_irq_chips_data;
>
>  struct max8907 {
> -- 
> 2.53.0
>

-- 
Lee Jones

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

* Re: [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing
  2026-12-02 16:44   ` Lee Jones
@ 2026-12-02 16:48     ` Svyatoslav Ryhel
  2026-12-02 17:16       ` Svyatoslav Ryhel
  0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-02 16:48 UTC (permalink / raw)
  To: Lee Jones
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-kernel, devicetree, mfd

ср, 2 груд. 2026 р. о 18:44 Lee Jones <lee@kernel.org> пише:
>
> On Mon, 23 Nov 2026, Svyatoslav Ryhel wrote:
> > There are no in-tree users of this driver, but it supports devicetree
> > based probing, which means external dtb files may exist that work with
> > this.
> >
> > Remove the unused legacy code and make this a DT-only driver.
> >
> > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > ---
> >  drivers/mfd/max8907.c                 | 8 +-------
> >  drivers/regulator/max8907-regulator.c | 8 +++-----
> >  include/linux/mfd/max8907.h           | 5 -----
> >  3 files changed, 4 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> > index 2f91791410538..a0e0c480ff43e 100644
> > --- a/drivers/mfd/max8907.c
> > +++ b/drivers/mfd/max8907.c
> > @@ -188,13 +188,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> >  {
> >       struct max8907 *max8907;
> >       int ret;
> > -     struct max8907_platform_data *pdata = dev_get_platdata(&i2c->dev);
> > -     bool pm_off = false;
> > -
> > -     if (pdata)
> > -             pm_off = pdata->pm_off;
> > -     else if (i2c->dev.of_node)
> > -             pm_off = of_property_read_bool(i2c->dev.of_node,
> > +     bool pm_off = of_property_read_bool(i2c->dev.of_node,
> >                                       "maxim,system-power-controller");
> >
> >       max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
> > diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
> > index fd227fd136121..84de0c443c945 100644
> > --- a/drivers/regulator/max8907-regulator.c
> > +++ b/drivers/regulator/max8907-regulator.c
> > @@ -274,7 +274,6 @@ static inline struct device_node *match_of_node(int index)
> >  static int max8907_regulator_probe(struct platform_device *pdev)
> >  {
> >       struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
> > -     struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev);
> >       int ret;
> >       struct max8907_regulator *pmic;
> >       unsigned int val;
> > @@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)
> >               struct regulator_dev *rdev;
> >
> >               config.dev = pdev->dev.parent;
> > -             if (pdata)
> > -                     idata = pdata->init_data[i];
> > -             else
> > -                     idata = match_init_data(i);
> > +
> > +             idata = match_init_data(i);
>
> In v3's changelog you noted:
>
> "added idata check in max8907_regulator_probe() for BBAT/SDBY/VRTC"
>
> ... but that NULL guard around 'idata->supply_regulator' seems to have
> been dropped here?  When a DT omits the 'bbat', 'sdby', or 'vrtc' child
> node, match_init_data() returns NULL and it will dereference a NULL
> pointer, no?
>

It was accidentally removed between v5 and v6.

> >               config.init_data = idata;
> >               config.driver_data = pmic;
> >               config.regmap = max8907->regmap_gen;
> > diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
> > index 4be3c2370e2a4..e222250f0cc1e 100644
> > --- a/include/linux/mfd/max8907.h
> > +++ b/include/linux/mfd/max8907.h
> > @@ -227,11 +227,6 @@ enum {
> >       MAX8907_IRQ_RTC_ALARM0,
> >  };
> >
> > -struct max8907_platform_data {
> > -     struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS];
> > -     bool pm_off;
> > -};
> > -
> >  struct regmap_irq_chips_data;
> >
> >  struct max8907 {
> > --
> > 2.53.0
> >
>
> --
> Lee Jones

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

* Re: [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing
  2026-12-02 16:48     ` Svyatoslav Ryhel
@ 2026-12-02 17:16       ` Svyatoslav Ryhel
  2026-12-02 20:13         ` Lee Jones
  0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-02 17:16 UTC (permalink / raw)
  To: Lee Jones
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-kernel, devicetree, mfd

ср, 2 груд. 2026 р. о 18:48 Svyatoslav Ryhel <clamor95@gmail.com> пише:
>
> ср, 2 груд. 2026 р. о 18:44 Lee Jones <lee@kernel.org> пише:
> >
> > On Mon, 23 Nov 2026, Svyatoslav Ryhel wrote:
> > > There are no in-tree users of this driver, but it supports devicetree
> > > based probing, which means external dtb files may exist that work with
> > > this.
> > >
> > > Remove the unused legacy code and make this a DT-only driver.
> > >
> > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > ---
> > >  drivers/mfd/max8907.c                 | 8 +-------
> > >  drivers/regulator/max8907-regulator.c | 8 +++-----
> > >  include/linux/mfd/max8907.h           | 5 -----
> > >  3 files changed, 4 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> > > index 2f91791410538..a0e0c480ff43e 100644
> > > --- a/drivers/mfd/max8907.c
> > > +++ b/drivers/mfd/max8907.c
> > > @@ -188,13 +188,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> > >  {
> > >       struct max8907 *max8907;
> > >       int ret;
> > > -     struct max8907_platform_data *pdata = dev_get_platdata(&i2c->dev);
> > > -     bool pm_off = false;
> > > -
> > > -     if (pdata)
> > > -             pm_off = pdata->pm_off;
> > > -     else if (i2c->dev.of_node)
> > > -             pm_off = of_property_read_bool(i2c->dev.of_node,
> > > +     bool pm_off = of_property_read_bool(i2c->dev.of_node,
> > >                                       "maxim,system-power-controller");
> > >
> > >       max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
> > > diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
> > > index fd227fd136121..84de0c443c945 100644
> > > --- a/drivers/regulator/max8907-regulator.c
> > > +++ b/drivers/regulator/max8907-regulator.c
> > > @@ -274,7 +274,6 @@ static inline struct device_node *match_of_node(int index)
> > >  static int max8907_regulator_probe(struct platform_device *pdev)
> > >  {
> > >       struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
> > > -     struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev);
> > >       int ret;
> > >       struct max8907_regulator *pmic;
> > >       unsigned int val;
> > > @@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)
> > >               struct regulator_dev *rdev;
> > >
> > >               config.dev = pdev->dev.parent;
> > > -             if (pdata)
> > > -                     idata = pdata->init_data[i];
> > > -             else
> > > -                     idata = match_init_data(i);
> > > +
> > > +             idata = match_init_data(i);
> >
> > In v3's changelog you noted:
> >
> > "added idata check in max8907_regulator_probe() for BBAT/SDBY/VRTC"
> >
> > ... but that NULL guard around 'idata->supply_regulator' seems to have
> > been dropped here?  When a DT omits the 'bbat', 'sdby', or 'vrtc' child
> > node, match_init_data() returns NULL and it will dereference a NULL
> > pointer, no?
> >
>
> It was accidentally removed between v5 and v6.
>

LOOL, it was fixed BY YOU!

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/regulator/max8907-regulator.c?id=8c7542439d56f734fb6598b141c14e69b705e2fc

> > >               config.init_data = idata;
> > >               config.driver_data = pmic;
> > >               config.regmap = max8907->regmap_gen;
> > > diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
> > > index 4be3c2370e2a4..e222250f0cc1e 100644
> > > --- a/include/linux/mfd/max8907.h
> > > +++ b/include/linux/mfd/max8907.h
> > > @@ -227,11 +227,6 @@ enum {
> > >       MAX8907_IRQ_RTC_ALARM0,
> > >  };
> > >
> > > -struct max8907_platform_data {
> > > -     struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS];
> > > -     bool pm_off;
> > > -};
> > > -
> > >  struct regmap_irq_chips_data;
> > >
> > >  struct max8907 {
> > > --
> > > 2.53.0
> > >
> >
> > --
> > Lee Jones

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

* Re: [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing
  2026-12-02 17:16       ` Svyatoslav Ryhel
@ 2026-12-02 20:13         ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2026-12-02 20:13 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-kernel, devicetree, mfd

On Wed, 02 Dec 2026, Svyatoslav Ryhel wrote:

> ср, 2 груд. 2026 р. о 18:48 Svyatoslav Ryhel <clamor95@gmail.com> пише:
> >
> > ср, 2 груд. 2026 р. о 18:44 Lee Jones <lee@kernel.org> пише:
> > >
> > > On Mon, 23 Nov 2026, Svyatoslav Ryhel wrote:
> > > > There are no in-tree users of this driver, but it supports devicetree
> > > > based probing, which means external dtb files may exist that work with
> > > > this.
> > > >
> > > > Remove the unused legacy code and make this a DT-only driver.
> > > >
> > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > > ---
> > > >  drivers/mfd/max8907.c                 | 8 +-------
> > > >  drivers/regulator/max8907-regulator.c | 8 +++-----
> > > >  include/linux/mfd/max8907.h           | 5 -----
> > > >  3 files changed, 4 insertions(+), 17 deletions(-)
> > > >
> > > > diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> > > > index 2f91791410538..a0e0c480ff43e 100644
> > > > --- a/drivers/mfd/max8907.c
> > > > +++ b/drivers/mfd/max8907.c
> > > > @@ -188,13 +188,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> > > >  {
> > > >       struct max8907 *max8907;
> > > >       int ret;
> > > > -     struct max8907_platform_data *pdata = dev_get_platdata(&i2c->dev);
> > > > -     bool pm_off = false;
> > > > -
> > > > -     if (pdata)
> > > > -             pm_off = pdata->pm_off;
> > > > -     else if (i2c->dev.of_node)
> > > > -             pm_off = of_property_read_bool(i2c->dev.of_node,
> > > > +     bool pm_off = of_property_read_bool(i2c->dev.of_node,
> > > >                                       "maxim,system-power-controller");
> > > >
> > > >       max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
> > > > diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
> > > > index fd227fd136121..84de0c443c945 100644
> > > > --- a/drivers/regulator/max8907-regulator.c
> > > > +++ b/drivers/regulator/max8907-regulator.c
> > > > @@ -274,7 +274,6 @@ static inline struct device_node *match_of_node(int index)
> > > >  static int max8907_regulator_probe(struct platform_device *pdev)
> > > >  {
> > > >       struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
> > > > -     struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev);
> > > >       int ret;
> > > >       struct max8907_regulator *pmic;
> > > >       unsigned int val;
> > > > @@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)
> > > >               struct regulator_dev *rdev;
> > > >
> > > >               config.dev = pdev->dev.parent;
> > > > -             if (pdata)
> > > > -                     idata = pdata->init_data[i];
> > > > -             else
> > > > -                     idata = match_init_data(i);
> > > > +
> > > > +             idata = match_init_data(i);
> > >
> > > In v3's changelog you noted:
> > >
> > > "added idata check in max8907_regulator_probe() for BBAT/SDBY/VRTC"
> > >
> > > ... but that NULL guard around 'idata->supply_regulator' seems to have
> > > been dropped here?  When a DT omits the 'bbat', 'sdby', or 'vrtc' child
> > > node, match_init_data() returns NULL and it will dereference a NULL
> > > pointer, no?
> > >
> >
> > It was accidentally removed between v5 and v6.
> >
> 
> LOOL, it was fixed BY YOU!
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/regulator/max8907-regulator.c?id=8c7542439d56f734fb6598b141c14e69b705e2fc

Ha ha!  That _is_ funny!  =:-D

I won't be able to apply this without an immutable pull from Mark.

-- 
Lee Jones

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

* Re: [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler
  2026-12-02 16:44       ` Svyatoslav Ryhel
@ 2026-12-02 20:14         ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2026-12-02 20:14 UTC (permalink / raw)
  To: Svyatoslav Ryhel; +Cc: sashiko-reviews, devicetree, mfd, robh, conor+dt

On Wed, 02 Dec 2026, Svyatoslav Ryhel wrote:

> ср, 2 груд. 2026 р. о 18:42 Lee Jones <lee@kernel.org> пише:
> >
> > On Mon, 23 Nov 2026, sashiko-bot@kernel.org wrote:
> >
> > > Thank you for your contribution! Sashiko AI review found 1 potential
> > > issue to consider:
> > > - [Medium] mfd: max8907: max8907_i2c_probe() drops
> > >   maxim,system-power-controller check
> > > --
> > >
> > > commit b8bc64d186feb8ec318721e193d4a0bf70c6eebf
> > > Author: Svyatoslav Ryhel <clamor95@gmail.com>
> > >
> > > mfd: max8907: Convert to use device managed poweroff handler
> > >
> > > This commit replaces devm_register_sys_off_handler() with
> > > devm_register_power_off_handler() and switches the DT check from
> > > maxim,system-power-controller to of_device_is_system_power_controller().
> > >
> > > > diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> > > > index f1cabb666d8ed..5d17971a8e9ab 100644
> > > > --- a/drivers/mfd/max8907.c
> > > > +++ b/drivers/mfd/max8907.c
> > > > @@ -189,8 +189,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> > > >     struct device *dev = &i2c->dev;
> > > >     struct max8907 *max8907;
> > > >     int ret;
> > > > -   bool pm_off = of_property_read_bool(dev->of_node,
> > > > -                                   "maxim,system-power-controller");
> > > >
> > > >     max8907 = devm_kzalloc_obj(dev, struct max8907);
> > > >     if (!max8907)
> > > > @@ -241,12 +239,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
> > > >     if (ret)
> > > >             return dev_err_probe(dev, ret, "Failed to add MFD devices\n");
> > > >
> > > > -   if (pm_off) {
> > > > -           ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
> > > > -                                               SYS_OFF_PRIO_DEFAULT,
> > > > -                                               max8907_power_off, max8907);
> > > > +   if (of_device_is_system_power_controller(dev->of_node)) {
> > > > +           ret = devm_register_power_off_handler(dev, max8907_power_off, max8907);
> > > >             if (ret)
> > > > -                   return dev_err_probe(dev, ret, "failed to register sys-off handler\n");
> > > > +                   return dev_err_probe(dev, ret, "failed to register power-off handler\n");
> > > >     }
> > > >
> > > >     return 0;
> > >
> > > [Severity: Medium]
> > > Should max8907_i2c_probe() continue checking the legacy
> > > maxim,system-power-controller property as a fallback alongside
> > > of_device_is_system_power_controller()?
> > >
> > > of_device_is_system_power_controller() only checks the standard
> > > system-power-controller property.  In commit "regulator: dt-bindings:
> > > maxim,max8907: Convert to DT schema" earlier in this series,
> > > Documentation/devicetree/bindings/regulator/maxim,max8907.yaml keeps
> > > maxim,system-power-controller as a deprecated property rather than
> > > removing it, and commit "mfd: max8907: Remove platform_data based probing"
> > > notes that external DTBs may exist.  On a board booting with an existing
> > > DTB that uses maxim,system-power-controller, max8907_i2c_probe() will now
> > > skip registering the power-off handler, leaving the system unable to power
> > > off via the PMIC.
> >
> > Do I assume that your silence means that you do not agree?
> >
> > I usually like submitters to at least acknowledge the warning.
> >
> 
> Literally in the commit message:
> 
> "There are no in-kernel users of maxim,system-power-controller property and
> all new users will use generic system-power-controller so check for the
> legacy property can be removed."

Interesting that Sashiko didn't pick that up.

-- 
Lee Jones

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

end of thread, other threads:[~2026-12-02 20:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 15:02 [PATCH v6 0/5] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
2026-11-23 15:02 ` [PATCH v6 1/5] regulator: dt-bindings: maxim,max8907: Convert to DT schema Svyatoslav Ryhel
2026-11-26 15:52   ` Svyatoslav Ryhel
2026-11-26 16:03     ` Mark Brown
2026-11-26 16:05       ` Svyatoslav Ryhel
2026-12-02 16:41       ` Lee Jones
2026-12-02 16:43         ` Svyatoslav Ryhel
2026-11-23 15:02 ` [PATCH v6 2/5] mfd: max8907: Remove platform_data based probing Svyatoslav Ryhel
2026-12-02 16:44   ` Lee Jones
2026-12-02 16:48     ` Svyatoslav Ryhel
2026-12-02 17:16       ` Svyatoslav Ryhel
2026-12-02 20:13         ` Lee Jones
2026-11-23 15:02 ` [PATCH v6 3/5] mfd: max8907: Switch to resource-managed versions of helpers Svyatoslav Ryhel
2026-11-23 15:02 ` [PATCH v6 4/5] mfd: max8907: Convert to use device managed poweroff handler Svyatoslav Ryhel
2026-11-23 15:10   ` sashiko-bot
2026-12-02 16:42     ` Lee Jones
2026-12-02 16:44       ` Svyatoslav Ryhel
2026-12-02 20:14         ` Lee Jones
2026-11-23 15:02 ` [PATCH v6 5/5] mfd: max8907: Add restart handler Svyatoslav Ryhel

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.