devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add support for LT3074 low voltage linear regulator
@ 2025-02-25 13:01 Cedric Encarnacion
  2025-02-25 13:01 ` [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074 Cedric Encarnacion
  2025-02-25 13:01 ` [PATCH v2 2/2] hwmon: (pmbus/lt3074): add support for lt3074 Cedric Encarnacion
  0 siblings, 2 replies; 19+ messages in thread
From: Cedric Encarnacion @ 2025-02-25 13:01 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, Delphine CC Chiu
  Cc: devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c,
	Cedric Encarnacion

Introduce hardware monitoring and regulator support for LT3074. The
component is an ultrafast, ultralow noise 3A, 5.5V dropout linear
regulator with a PMBus serial interface that allows telemetry for
input/output voltage, output current, and die temperature. It has a
single channel and requires a bias voltage which can be monitored via
manufacturer-specific registers.

Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
---
Changes in v2:
 * Separated dt-binding for LT3074.
 * Added __maybe_unused attribute to of_device_id. This addresses kernel
   test robot warning.
 * Added entry to MAINTAINERS.

- Link to v1: https://lore.kernel.org/r/20250124-upstream-lt3074-v1-0-7603f346433e@analog.com

---
Cedric Encarnacion (2):
      dt-bindings: hwmon: pmbus: add lt3074
      hwmon: (pmbus/lt3074): add support for lt3074

 .../bindings/hwmon/pmbus/adi,lt3074.yaml           |  64 +++++++++++
 Documentation/hwmon/index.rst                      |   1 +
 Documentation/hwmon/lt3074.rst                     |  72 ++++++++++++
 MAINTAINERS                                        |   9 ++
 drivers/hwmon/pmbus/Kconfig                        |  18 +++
 drivers/hwmon/pmbus/Makefile                       |   1 +
 drivers/hwmon/pmbus/lt3074.c                       | 122 +++++++++++++++++++++
 7 files changed, 287 insertions(+)
---
base-commit: 8df0f002827e18632dcd986f7546c1abf1953a6f
change-id: 20250124-upstream-lt3074-123384246e0b

Best regards,
-- 
Cedric Encarnacion <cedricjustine.encarnacion@analog.com>


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

* [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-25 13:01 [PATCH v2 0/2] Add support for LT3074 low voltage linear regulator Cedric Encarnacion
@ 2025-02-25 13:01 ` Cedric Encarnacion
  2025-02-26  8:20   ` Krzysztof Kozlowski
  2025-02-25 13:01 ` [PATCH v2 2/2] hwmon: (pmbus/lt3074): add support for lt3074 Cedric Encarnacion
  1 sibling, 1 reply; 19+ messages in thread
From: Cedric Encarnacion @ 2025-02-25 13:01 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, Delphine CC Chiu
  Cc: devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c,
	Cedric Encarnacion

Add Analog Devices LT3074 Ultralow Noise, High PSRR Dropout Linear
Regulator.

Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
---
 .../bindings/hwmon/pmbus/adi,lt3074.yaml           | 64 ++++++++++++++++++++++
 MAINTAINERS                                        |  7 +++
 2 files changed, 71 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..714426fd655a8daa96e15e1f789743f36001ac7a
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LT3074 voltage regulator
+
+maintainers:
+  - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
+
+description: |
+  The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
+  response linear regulator. It allows telemetry for input/output voltage,
+  output current and temperature through the PMBus serial interface.
+
+  Datasheet:
+    https://www.analog.com/en/products/lt3074.html
+
+properties:
+  compatible:
+    enum:
+      - adi,lt3074
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description: |
+      list of regulators provided by this controller.
+
+    properties:
+      vout:
+        $ref: /schemas/regulator/regulator.yaml#
+        type: object
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        regulator@6d {
+            compatible = "adi,lt3074";
+            reg = <0x6d>;
+
+            regulators {
+                vcc_1v2: vout {
+                    regulator-name = "VCC_1V2";
+                };
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 896a307fa06545e2861abe46ea7029f9b4d3628e..4a59ee6a03919af6a48717a0ddddabc7241a9e63 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13687,6 +13687,13 @@ L:	linux-scsi@vger.kernel.org
 S:	Maintained
 F:	drivers/scsi/sym53c8xx_2/
 
+LT3074 HARDWARE MONITOR DRIVER
+M:	Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
+L:	linux-hwmon@vger.kernel.org
+S:	Supported
+W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
+
 LTC1660 DAC DRIVER
 M:	Marcus Folkesson <marcus.folkesson@gmail.com>
 L:	linux-iio@vger.kernel.org

-- 
2.39.5


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

* [PATCH v2 2/2] hwmon: (pmbus/lt3074): add support for lt3074
  2025-02-25 13:01 [PATCH v2 0/2] Add support for LT3074 low voltage linear regulator Cedric Encarnacion
  2025-02-25 13:01 ` [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074 Cedric Encarnacion
@ 2025-02-25 13:01 ` Cedric Encarnacion
  2025-02-26 13:03   ` Guenter Roeck
  1 sibling, 1 reply; 19+ messages in thread
From: Cedric Encarnacion @ 2025-02-25 13:01 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, Delphine CC Chiu
  Cc: devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c,
	Cedric Encarnacion

Add hardware monitoring and regulator support for LT3074. The LT3074 is an
ultrafast, ultralow noise 3A, 5.5V dropout linear regulator. The PMBus
serial interface allows telemetry for input/output voltage, bias voltage,
output current, and die temperature.

Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
---
 Documentation/hwmon/index.rst  |   1 +
 Documentation/hwmon/lt3074.rst |  72 ++++++++++++++++++++++++
 MAINTAINERS                    |   2 +
 drivers/hwmon/pmbus/Kconfig    |  18 ++++++
 drivers/hwmon/pmbus/Makefile   |   1 +
 drivers/hwmon/pmbus/lt3074.c   | 122 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 216 insertions(+)

diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index 874f8fd2632520d3be489154ddd0eb7ca24fc405..54b14f571db4d3b3e0b74a12b41cf8cf0d6fe8a7 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -122,6 +122,7 @@ Hardware Monitoring Kernel Drivers
    lm95234
    lm95245
    lochnagar
+   lt3074
    lt7182s
    ltc2992
    ltc2945
diff --git a/Documentation/hwmon/lt3074.rst b/Documentation/hwmon/lt3074.rst
new file mode 100644
index 0000000000000000000000000000000000000000..234f369153cf1374b8c7eaa2ed93358ac141fdf9
--- /dev/null
+++ b/Documentation/hwmon/lt3074.rst
@@ -0,0 +1,72 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver lt3074
+====================
+
+Supported chips:
+
+  * Analog Devices LT3074
+
+    Prefix: 'lt3074'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.analog.com/en/products/lt3074.html
+
+Authors: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
+
+
+Description
+-----------
+
+This driver supports hardware monitoring for Analog Devices LT3074 Linear
+Regulator with PMBus interface.
+
+The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
+response linear regulator with PMBus serial interface. PMBus telemetry
+feature provides information regarding the output voltage and current,
+input voltage, bias voltage and die temperature.
+
+The driver is a client driver to the core PMBus driver. Please see
+Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
+
+Usage Notes
+-----------
+
+This driver does not auto-detect devices. You will have to instantiate
+the devices explicitly. Please see Documentation/i2c/instantiating-devices.rst
+for details.
+
+Platform data support
+---------------------
+
+The driver supports standard PMBus driver platform data.
+
+Sysfs entries
+-------------
+
+======================= =======================================================
+in1_label		"vin"
+in1_input		Measured input voltage
+in1_max			Input overvoltage warning limit
+in1_max_alarm		Input overvoltage warning status
+in1_min			Input undervoltage warning limit
+in1_min_alarm		Input undervoltage warning status
+in2_label		"vmon"
+in2_input		Measured bias voltage
+in2_max			Bias overvoltage warning limit
+in2_min			Bias undervoltage warning limit
+in3_label		"vout1"
+in3_input		Measured output voltage
+in3_max			Output overvoltage warning limit
+in3_max_alarm		Output overvoltage warning status
+in3_min			Output undervoltage warning limit
+in3_min_alarm		Output undervoltage warning status
+curr1_label		"iout1"
+curr1_input		Measured output current.
+curr1_crit		Output overcurrent fault limit
+curr1_crit_alarm	Output overcurrent fault status
+temp1_input		Measured temperature
+temp1_max		Maximum temperature limit
+temp1_max_alarm		Overtemperature warning status
+======================= =======================================================
diff --git a/MAINTAINERS b/MAINTAINERS
index 4a59ee6a03919af6a48717a0ddddabc7241a9e63..be9372cf020c246586646ad240a0c0c7880800f1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13693,6 +13693,8 @@ L:	linux-hwmon@vger.kernel.org
 S:	Supported
 W:	https://ez.analog.com/linux-software-drivers
 F:	Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
+F:	Documentation/hwmon/lt3074.rst
+F:	drivers/hwmon/pmbus/lt3074.c
 
 LTC1660 DAC DRIVER
 M:	Marcus Folkesson <marcus.folkesson@gmail.com>
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 675b0d4703d87c9d5654489d0d770661ff0dba11..3edad8d7476cf78f4c2dfc94294013b33f2d8cae 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -209,6 +209,24 @@ config SENSORS_LM25066_REGULATOR
 	  If you say yes here you get regulator support for National
 	  Semiconductor LM25066, LM5064, and LM5066.
 
+config SENSORS_LT3074
+	tristate "Analog Devices LT3074"
+	help
+	  If you say yes here you get hardware monitoring support for Analog
+	  Devices LT3074.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called lt3074.
+
+config SENSORS_LT3074_REGULATOR
+	tristate "Regulator support for LT3074"
+	depends on SENSORS_LT3074 && REGULATOR
+	help
+	  If you say yes here you get regulator support for Analog Devices
+	  LT3074. The LT3074 is a low voltage, ultralow noise, high PSRR,
+	  dropout linear regulator. The device supplies up to 3A with a
+	  typical dropout voltage of 45mV.
+
 config SENSORS_LT7182S
 	tristate "Analog Devices LT7182S"
 	help
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index c7eb7739b7f861c5c105582b57ad16937649d4cf..5ef388c105811e73d5ea943648fb2f7a7ca59010 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_SENSORS_IR38064)	+= ir38064.o
 obj-$(CONFIG_SENSORS_IRPS5401)	+= irps5401.o
 obj-$(CONFIG_SENSORS_ISL68137)	+= isl68137.o
 obj-$(CONFIG_SENSORS_LM25066)	+= lm25066.o
+obj-$(CONFIG_SENSORS_LT3074)	+= lt3074.o
 obj-$(CONFIG_SENSORS_LT7182S)	+= lt7182s.o
 obj-$(CONFIG_SENSORS_LTC2978)	+= ltc2978.o
 obj-$(CONFIG_SENSORS_LTC3815)	+= ltc3815.o
diff --git a/drivers/hwmon/pmbus/lt3074.c b/drivers/hwmon/pmbus/lt3074.c
new file mode 100644
index 0000000000000000000000000000000000000000..a84bc5bddee7c4ae646b4fc7c5a57ed1eb233ab8
--- /dev/null
+++ b/drivers/hwmon/pmbus/lt3074.c
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Hardware monitoring driver for Analog Devices LT3074
+ *
+ * Copyright (C) 2025 Analog Devices, Inc.
+ */
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+
+#include "pmbus.h"
+
+#define LT3074_MFR_READ_VBIAS			0xc6
+#define LT3074_MFR_BIAS_OV_WARN_LIMIT		0xc7
+#define LT3074_MFR_BIAS_UV_WARN_LIMIT		0xc8
+#define LT3074_MFR_SPECIAL_ID			0xe7
+
+#define LT3074_SPECIAL_ID_VALUE			0x1c1d
+
+static const struct regulator_desc __maybe_unused lt3074_reg_desc[] = {
+	PMBUS_REGULATOR_ONE("vout"),
+};
+
+static int lt3074_read_word_data(struct i2c_client *client, int page,
+				 int phase, int reg)
+{
+	switch (reg) {
+	case PMBUS_VIRT_READ_VMON:
+		return pmbus_read_word_data(client, page, phase,
+					   LT3074_MFR_READ_VBIAS);
+	case PMBUS_VIRT_VMON_UV_WARN_LIMIT:
+		return pmbus_read_word_data(client, page, phase,
+					   LT3074_MFR_BIAS_UV_WARN_LIMIT);
+	case PMBUS_VIRT_VMON_OV_WARN_LIMIT:
+		return pmbus_read_word_data(client, page, phase,
+					   LT3074_MFR_BIAS_OV_WARN_LIMIT);
+	default:
+		return -ENODATA;
+	}
+}
+
+static int lt3074_write_word_data(struct i2c_client *client, int page,
+				  int reg, u16 word)
+{
+	switch (reg) {
+	case PMBUS_VIRT_VMON_UV_WARN_LIMIT:
+		return pmbus_write_word_data(client, 0,
+					    LT3074_MFR_BIAS_UV_WARN_LIMIT,
+					    word);
+	case PMBUS_VIRT_VMON_OV_WARN_LIMIT:
+		return pmbus_write_word_data(client, 0,
+					    LT3074_MFR_BIAS_OV_WARN_LIMIT,
+					    word);
+	default:
+		return -ENODATA;
+	}
+}
+
+static struct pmbus_driver_info lt3074_info = {
+	.pages = 1,
+	.format[PSC_VOLTAGE_IN] = linear,
+	.format[PSC_VOLTAGE_OUT] = linear,
+	.format[PSC_CURRENT_OUT] = linear,
+	.format[PSC_TEMPERATURE] = linear,
+	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
+		   PMBUS_HAVE_TEMP | PMBUS_HAVE_VMON |
+		   PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT |
+		   PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP,
+	.read_word_data = lt3074_read_word_data,
+	.write_word_data = lt3074_write_word_data,
+#if IS_ENABLED(CONFIG_SENSORS_LT3074_REGULATOR)
+	.num_regulators = 1,
+	.reg_desc = lt3074_reg_desc,
+#endif
+};
+
+static int lt3074_probe(struct i2c_client *client)
+{
+	int ret;
+	struct device *dev = &client->dev;
+
+	if (!i2c_check_functionality(client->adapter,
+				     I2C_FUNC_SMBUS_READ_WORD_DATA))
+		return -ENODEV;
+
+	ret = i2c_smbus_read_word_data(client, LT3074_MFR_SPECIAL_ID);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Failed to read ID\n");
+
+	if (ret != LT3074_SPECIAL_ID_VALUE)
+		return dev_err_probe(dev, -ENODEV, "ID mismatch\n");
+
+	return pmbus_do_probe(client, &lt3074_info);
+}
+
+static const struct i2c_device_id lt3074_id[] = {
+	{ "lt3074", 0 },
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, lt3074_id);
+
+static const struct of_device_id __maybe_unused lt3074_of_match[] = {
+	{ .compatible = "adi,lt3074" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, lt3074_of_match);
+
+static struct i2c_driver lt3074_driver = {
+	.driver = {
+		.name = "lt3074",
+		.of_match_table = of_match_ptr(lt3074_of_match),
+	},
+	.probe = lt3074_probe,
+	.id_table = lt3074_id,
+};
+module_i2c_driver(lt3074_driver);
+
+MODULE_AUTHOR("Cedric Encarnacion <cedricjustine.encarnacion@analog.com>");
+MODULE_DESCRIPTION("PMBus driver for Analog Devices LT3074");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("PMBUS");

-- 
2.39.5


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-25 13:01 ` [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074 Cedric Encarnacion
@ 2025-02-26  8:20   ` Krzysztof Kozlowski
  2025-02-26 14:59     ` Rob Herring
  2025-04-07 22:59     ` Guenter Roeck
  0 siblings, 2 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-26  8:20 UTC (permalink / raw)
  To: Cedric Encarnacion
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, Delphine CC Chiu, devicetree,
	linux-kernel, linux-hwmon, linux-doc, linux-i2c

On Tue, Feb 25, 2025 at 09:01:13PM +0800, Cedric Encarnacion wrote:
> Add Analog Devices LT3074 Ultralow Noise, High PSRR Dropout Linear
> Regulator.
> 
> Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> ---
>  .../bindings/hwmon/pmbus/adi,lt3074.yaml           | 64 ++++++++++++++++++++++
>  MAINTAINERS                                        |  7 +++
>  2 files changed, 71 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..714426fd655a8daa96e15e1f789743f36001ac7a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
> @@ -0,0 +1,64 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices LT3074 voltage regulator
> +
> +maintainers:
> +  - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> +
> +description: |
> +  The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
> +  response linear regulator. It allows telemetry for input/output voltage,
> +  output current and temperature through the PMBus serial interface.
> +
> +  Datasheet:
> +    https://www.analog.com/en/products/lt3074.html
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,lt3074
> +
> +  reg:
> +    maxItems: 1
> +
> +  regulators:
> +    type: object
> +    description: |
> +      list of regulators provided by this controller.

You have only one regulator, so drop the "regulators". vout could be
here, but since you do not have any other resources, I doubt it stands
on its own either. This is even visible in your DTS - you named the
device as regulator, so logically this is the regulator. Regulator does
not have regulators (otherwise they could also have regulators... so
triple regulator).

hwmon code might need some changes, but that's not really relevant for
proper hardware description.

Best regards,
Krzysztof


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

* Re: [PATCH v2 2/2] hwmon: (pmbus/lt3074): add support for lt3074
  2025-02-25 13:01 ` [PATCH v2 2/2] hwmon: (pmbus/lt3074): add support for lt3074 Cedric Encarnacion
@ 2025-02-26 13:03   ` Guenter Roeck
  0 siblings, 0 replies; 19+ messages in thread
From: Guenter Roeck @ 2025-02-26 13:03 UTC (permalink / raw)
  To: Cedric Encarnacion, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jean Delvare, Jonathan Corbet, Delphine CC Chiu
  Cc: devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c

On 2/25/25 05:01, Cedric Encarnacion wrote:
> Add hardware monitoring and regulator support for LT3074. The LT3074 is an
> ultrafast, ultralow noise 3A, 5.5V dropout linear regulator. The PMBus
> serial interface allows telemetry for input/output voltage, bias voltage,
> output current, and die temperature.
> 
> Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>

For my reference:

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

The core looks good to me. I don't know what Krzysztof means with "hwmon
code might need some changes" in the feedback to the dt patch, or what those
changes might be. I'll wait for that to be sorted out.

Guenter


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-26  8:20   ` Krzysztof Kozlowski
@ 2025-02-26 14:59     ` Rob Herring
  2025-02-26 19:17       ` Guenter Roeck
  2025-04-07 22:59     ` Guenter Roeck
  1 sibling, 1 reply; 19+ messages in thread
From: Rob Herring @ 2025-02-26 14:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Cedric Encarnacion, Krzysztof Kozlowski, Conor Dooley,
	Jean Delvare, Guenter Roeck, Jonathan Corbet, Delphine CC Chiu,
	devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c

On Wed, Feb 26, 2025 at 09:20:40AM +0100, Krzysztof Kozlowski wrote:
> On Tue, Feb 25, 2025 at 09:01:13PM +0800, Cedric Encarnacion wrote:
> > Add Analog Devices LT3074 Ultralow Noise, High PSRR Dropout Linear
> > Regulator.
> > 
> > Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> > ---
> >  .../bindings/hwmon/pmbus/adi,lt3074.yaml           | 64 ++++++++++++++++++++++
> >  MAINTAINERS                                        |  7 +++
> >  2 files changed, 71 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..714426fd655a8daa96e15e1f789743f36001ac7a
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
> > @@ -0,0 +1,64 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Analog Devices LT3074 voltage regulator
> > +
> > +maintainers:
> > +  - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> > +
> > +description: |
> > +  The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
> > +  response linear regulator. It allows telemetry for input/output voltage,
> > +  output current and temperature through the PMBus serial interface.
> > +
> > +  Datasheet:
> > +    https://www.analog.com/en/products/lt3074.html
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,lt3074
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  regulators:
> > +    type: object
> > +    description: |
> > +      list of regulators provided by this controller.
> 
> You have only one regulator, so drop the "regulators". vout could be
> here, but since you do not have any other resources, I doubt it stands
> on its own either. This is even visible in your DTS - you named the
> device as regulator, so logically this is the regulator. Regulator does
> not have regulators (otherwise they could also have regulators... so
> triple regulator).
> 
> hwmon code might need some changes, but that's not really relevant for
> proper hardware description.

Normally, I would agree, but it seems generic pmbus code expects this 
structure. This just came up with changing another binding maintained by 
'Not Me' to follow this structure. We're stuck with the existing way, so 
I don't know that it is worth supporting 2 ways forever. OTOH, is it 
guaranteed that these devices will only ever be pmbus devices or that 
other regulator devices which are not handled as pmbus devices currently 
will be in the future. If so, more flexibility in the bindings will be 
needed.

Rob

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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-26 14:59     ` Rob Herring
@ 2025-02-26 19:17       ` Guenter Roeck
  2025-02-27  8:50         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 19+ messages in thread
From: Guenter Roeck @ 2025-02-26 19:17 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Cedric Encarnacion, Krzysztof Kozlowski, Conor Dooley,
	Jean Delvare, Jonathan Corbet, Delphine CC Chiu, devicetree,
	linux-kernel, linux-hwmon, linux-doc, linux-i2c

On 2/26/25 06:59, Rob Herring wrote:
> On Wed, Feb 26, 2025 at 09:20:40AM +0100, Krzysztof Kozlowski wrote:
>> On Tue, Feb 25, 2025 at 09:01:13PM +0800, Cedric Encarnacion wrote:
>>> Add Analog Devices LT3074 Ultralow Noise, High PSRR Dropout Linear
>>> Regulator.
>>>
>>> Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
>>> ---
>>>   .../bindings/hwmon/pmbus/adi,lt3074.yaml           | 64 ++++++++++++++++++++++
>>>   MAINTAINERS                                        |  7 +++
>>>   2 files changed, 71 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
>>> new file mode 100644
>>> index 0000000000000000000000000000000000000000..714426fd655a8daa96e15e1f789743f36001ac7a
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
>>> @@ -0,0 +1,64 @@
>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Analog Devices LT3074 voltage regulator
>>> +
>>> +maintainers:
>>> +  - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
>>> +
>>> +description: |
>>> +  The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
>>> +  response linear regulator. It allows telemetry for input/output voltage,
>>> +  output current and temperature through the PMBus serial interface.
>>> +
>>> +  Datasheet:
>>> +    https://www.analog.com/en/products/lt3074.html
>>> +
>>> +properties:
>>> +  compatible:
>>> +    enum:
>>> +      - adi,lt3074
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +
>>> +  regulators:
>>> +    type: object
>>> +    description: |
>>> +      list of regulators provided by this controller.
>>
>> You have only one regulator, so drop the "regulators". vout could be
>> here, but since you do not have any other resources, I doubt it stands
>> on its own either. This is even visible in your DTS - you named the
>> device as regulator, so logically this is the regulator. Regulator does
>> not have regulators (otherwise they could also have regulators... so
>> triple regulator).
>>
>> hwmon code might need some changes, but that's not really relevant for
>> proper hardware description.
> 
> Normally, I would agree, but it seems generic pmbus code expects this
> structure. This just came up with changing another binding maintained by
> 'Not Me' to follow this structure. We're stuck with the existing way, so
> I don't know that it is worth supporting 2 ways forever. OTOH, is it
> guaranteed that these devices will only ever be pmbus devices or that
> other regulator devices which are not handled as pmbus devices currently
> will be in the future. If so, more flexibility in the bindings will be
> needed.
> 

I would appreciate if someone would explain to me what the problems with
the current PMBus code actually are. I have seen several comments claiming
that the code should be changed, but I have no idea what the expected changes
actually are or, in other words, what the PMBus code should be doing
differently.

Thanks,
Guenter


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-26 19:17       ` Guenter Roeck
@ 2025-02-27  8:50         ` Krzysztof Kozlowski
  2025-02-27 16:32           ` Guenter Roeck
  0 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-27  8:50 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Rob Herring, Cedric Encarnacion, Krzysztof Kozlowski,
	Conor Dooley, Jean Delvare, Jonathan Corbet, Delphine CC Chiu,
	devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c

On Wed, Feb 26, 2025 at 11:17:48AM -0800, Guenter Roeck wrote:
> On 2/26/25 06:59, Rob Herring wrote:
> > On Wed, Feb 26, 2025 at 09:20:40AM +0100, Krzysztof Kozlowski wrote:
> > > On Tue, Feb 25, 2025 at 09:01:13PM +0800, Cedric Encarnacion wrote:
> > > > Add Analog Devices LT3074 Ultralow Noise, High PSRR Dropout Linear
> > > > Regulator.
> > > > 
> > > > Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> > > > ---
> > > >   .../bindings/hwmon/pmbus/adi,lt3074.yaml           | 64 ++++++++++++++++++++++
> > > >   MAINTAINERS                                        |  7 +++
> > > >   2 files changed, 71 insertions(+)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
> > > > new file mode 100644
> > > > index 0000000000000000000000000000000000000000..714426fd655a8daa96e15e1f789743f36001ac7a
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
> > > > @@ -0,0 +1,64 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Analog Devices LT3074 voltage regulator
> > > > +
> > > > +maintainers:
> > > > +  - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> > > > +
> > > > +description: |
> > > > +  The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
> > > > +  response linear regulator. It allows telemetry for input/output voltage,
> > > > +  output current and temperature through the PMBus serial interface.
> > > > +
> > > > +  Datasheet:
> > > > +    https://www.analog.com/en/products/lt3074.html
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    enum:
> > > > +      - adi,lt3074
> > > > +
> > > > +  reg:
> > > > +    maxItems: 1
> > > > +
> > > > +  regulators:
> > > > +    type: object
> > > > +    description: |
> > > > +      list of regulators provided by this controller.
> > > 
> > > You have only one regulator, so drop the "regulators". vout could be
> > > here, but since you do not have any other resources, I doubt it stands
> > > on its own either. This is even visible in your DTS - you named the
> > > device as regulator, so logically this is the regulator. Regulator does
> > > not have regulators (otherwise they could also have regulators... so
> > > triple regulator).
> > > 
> > > hwmon code might need some changes, but that's not really relevant for
> > > proper hardware description.
> > 
> > Normally, I would agree, but it seems generic pmbus code expects this
> > structure. This just came up with changing another binding maintained by
> > 'Not Me' to follow this structure. We're stuck with the existing way, so
> > I don't know that it is worth supporting 2 ways forever. OTOH, is it
> > guaranteed that these devices will only ever be pmbus devices or that
> > other regulator devices which are not handled as pmbus devices currently
> > will be in the future. If so, more flexibility in the bindings will be
> > needed.
> > 
> 
> I would appreciate if someone would explain to me what the problems with
> the current PMBus code actually are. I have seen several comments claiming

Not exactly a problem but missing feature. pmbus code (at least one of
macros I looked at) expects regulator node and some sort of child of it
(vout), while such simple devices should be:

regulator {
	compatible = "adi,lt3074";
	regulator-name = "vout";
	regulator-min-microvolt = "100000";
	regulator-max-microvolt = "100000";
};

so without any of regulators and regulators/vout subnodes.

> that the code should be changed, but I have no idea what the expected changes
> actually are or, in other words, what the PMBus code should be doing
> differently.

I did not investigate much into pmbus code, but this might be as simple
as accepting arguments for .of_match and .regulators_node and then
accepting NULLs as them as well. Or a new macro which assigns NULLs
there.

Regulator core handles .regulators_node=NULL already.

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-27  8:50         ` Krzysztof Kozlowski
@ 2025-02-27 16:32           ` Guenter Roeck
  2025-03-18 10:03             ` Encarnacion, Cedric justine
  0 siblings, 1 reply; 19+ messages in thread
From: Guenter Roeck @ 2025-02-27 16:32 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Cedric Encarnacion, Krzysztof Kozlowski,
	Conor Dooley, Jean Delvare, Jonathan Corbet, Delphine CC Chiu,
	devicetree, linux-kernel, linux-hwmon, linux-doc, linux-i2c

On Thu, Feb 27, 2025 at 09:50:23AM +0100, Krzysztof Kozlowski wrote:
> > > > 
> > > > hwmon code might need some changes, but that's not really relevant for
> > > > proper hardware description.
> > > 
> > > Normally, I would agree, but it seems generic pmbus code expects this
> > > structure. This just came up with changing another binding maintained by
> > > 'Not Me' to follow this structure. We're stuck with the existing way, so
> > > I don't know that it is worth supporting 2 ways forever. OTOH, is it
> > > guaranteed that these devices will only ever be pmbus devices or that
> > > other regulator devices which are not handled as pmbus devices currently
> > > will be in the future. If so, more flexibility in the bindings will be
> > > needed.
> > > 
> > 
> > I would appreciate if someone would explain to me what the problems with
> > the current PMBus code actually are. I have seen several comments claiming
> 
> Not exactly a problem but missing feature. pmbus code (at least one of
> macros I looked at) expects regulator node and some sort of child of it
> (vout), while such simple devices should be:
> 
> regulator {
> 	compatible = "adi,lt3074";
> 	regulator-name = "vout";
> 	regulator-min-microvolt = "100000";
> 	regulator-max-microvolt = "100000";
> };
> 
> so without any of regulators and regulators/vout subnodes.
> 
> > that the code should be changed, but I have no idea what the expected changes
> > actually are or, in other words, what the PMBus code should be doing
> > differently.
> 
> I did not investigate much into pmbus code, but this might be as simple
> as accepting arguments for .of_match and .regulators_node and then
> accepting NULLs as them as well. Or a new macro which assigns NULLs
> there.
> 

Unless I am missing something, the following should do the trick.

diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index ddb19c9726d6..289767e5d599 100644
--- a/drivers/hwmon/pmbus/pmbus.h
+++ b/drivers/hwmon/pmbus/pmbus.h
@@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct regulator_dev *rdev,
 	{							\
 		.name = (_name),				\
 		.of_match = of_match_ptr(_name),		\
-		.regulators_node = of_match_ptr("regulators"),	\
 		.ops = &pmbus_regulator_ops,			\
 		.type = REGULATOR_VOLTAGE,			\
 		.owner = THIS_MODULE,				\

Maybe someone can check if that works.

Thanks,
Guenter

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

* RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-27 16:32           ` Guenter Roeck
@ 2025-03-18 10:03             ` Encarnacion, Cedric justine
  2025-03-18 15:17               ` Guenter Roeck
  0 siblings, 1 reply; 19+ messages in thread
From: Encarnacion, Cedric justine @ 2025-03-18 10:03 UTC (permalink / raw)
  To: Guenter Roeck, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Friday, February 28, 2025 12:33 AM
> To: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
> <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
> doc@vger.kernel.org; linux-i2c@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
> 
> [External]
> 
> On Thu, Feb 27, 2025 at 09:50:23AM +0100, Krzysztof Kozlowski wrote:
> > > > >
> > > > > hwmon code might need some changes, but that's not really
> > > > > relevant for proper hardware description.
> > > >
> > > > Normally, I would agree, but it seems generic pmbus code expects
> > > > this structure. This just came up with changing another binding
> > > > maintained by 'Not Me' to follow this structure. We're stuck with
> > > > the existing way, so I don't know that it is worth supporting 2
> > > > ways forever. OTOH, is it guaranteed that these devices will only
> > > > ever be pmbus devices or that other regulator devices which are
> > > > not handled as pmbus devices currently will be in the future. If
> > > > so, more flexibility in the bindings will be needed.
> > > >
> > >
> > > I would appreciate if someone would explain to me what the problems
> > > with the current PMBus code actually are. I have seen several
> > > comments claiming
> >
> > Not exactly a problem but missing feature. pmbus code (at least one of
> > macros I looked at) expects regulator node and some sort of child of
> > it (vout), while such simple devices should be:
> >
> > regulator {
> > 	compatible = "adi,lt3074";
> > 	regulator-name = "vout";
> > 	regulator-min-microvolt = "100000";
> > 	regulator-max-microvolt = "100000";
> > };
> >
> > so without any of regulators and regulators/vout subnodes.
> >
> > > that the code should be changed, but I have no idea what the
> > > expected changes actually are or, in other words, what the PMBus
> > > code should be doing differently.
> >
> > I did not investigate much into pmbus code, but this might be as
> > simple as accepting arguments for .of_match and .regulators_node and
> > then accepting NULLs as them as well. Or a new macro which assigns
> > NULLs there.
> >
> 
> Unless I am missing something, the following should do the trick.
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> index ddb19c9726d6..289767e5d599 100644
> --- a/drivers/hwmon/pmbus/pmbus.h
> +++ b/drivers/hwmon/pmbus/pmbus.h
> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct regulator_dev *rdev,
>  	{							\
>  		.name = (_name),				\
>  		.of_match = of_match_ptr(_name),		\
> -		.regulators_node = of_match_ptr("regulators"),	\
>  		.ops = &pmbus_regulator_ops,			\
>  		.type = REGULATOR_VOLTAGE,			\
>  		.owner = THIS_MODULE,				\
> 
> Maybe someone can check if that works.
> 
> Thanks,
> Guenter

I'd like to follow up on this one. As of this writing, my understanding
is that the dt-binding should not expect regulators subnodes for
simple devices like this. There is already a similar binding as
mentioned in this thread particularly
"dt-bindings/regulator/infineon,ir38060". I think a binding without
the subnodes should still work with or without the change above.
With this, I'd like to know what the specific next steps are to continue
this patch series.

Thanks,
Cedric

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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-18 10:03             ` Encarnacion, Cedric justine
@ 2025-03-18 15:17               ` Guenter Roeck
  2025-03-19  4:10                 ` Encarnacion, Cedric justine
  0 siblings, 1 reply; 19+ messages in thread
From: Guenter Roeck @ 2025-03-18 15:17 UTC (permalink / raw)
  To: Encarnacion, Cedric justine, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

On 3/18/25 03:03, Encarnacion, Cedric justine wrote:
>> -----Original Message-----
>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>> Sent: Friday, February 28, 2025 12:33 AM
>> To: Krzysztof Kozlowski <krzk@kernel.org>
>> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
>> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
>> <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
>> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>
>> [External]
>>
>> On Thu, Feb 27, 2025 at 09:50:23AM +0100, Krzysztof Kozlowski wrote:
>>>>>>
>>>>>> hwmon code might need some changes, but that's not really
>>>>>> relevant for proper hardware description.
>>>>>
>>>>> Normally, I would agree, but it seems generic pmbus code expects
>>>>> this structure. This just came up with changing another binding
>>>>> maintained by 'Not Me' to follow this structure. We're stuck with
>>>>> the existing way, so I don't know that it is worth supporting 2
>>>>> ways forever. OTOH, is it guaranteed that these devices will only
>>>>> ever be pmbus devices or that other regulator devices which are
>>>>> not handled as pmbus devices currently will be in the future. If
>>>>> so, more flexibility in the bindings will be needed.
>>>>>
>>>>
>>>> I would appreciate if someone would explain to me what the problems
>>>> with the current PMBus code actually are. I have seen several
>>>> comments claiming
>>>
>>> Not exactly a problem but missing feature. pmbus code (at least one of
>>> macros I looked at) expects regulator node and some sort of child of
>>> it (vout), while such simple devices should be:
>>>
>>> regulator {
>>> 	compatible = "adi,lt3074";
>>> 	regulator-name = "vout";
>>> 	regulator-min-microvolt = "100000";
>>> 	regulator-max-microvolt = "100000";
>>> };
>>>
>>> so without any of regulators and regulators/vout subnodes.
>>>
>>>> that the code should be changed, but I have no idea what the
>>>> expected changes actually are or, in other words, what the PMBus
>>>> code should be doing differently.
>>>
>>> I did not investigate much into pmbus code, but this might be as
>>> simple as accepting arguments for .of_match and .regulators_node and
>>> then accepting NULLs as them as well. Or a new macro which assigns
>>> NULLs there.
>>>
>>
>> Unless I am missing something, the following should do the trick.
>>
>> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
>> index ddb19c9726d6..289767e5d599 100644
>> --- a/drivers/hwmon/pmbus/pmbus.h
>> +++ b/drivers/hwmon/pmbus/pmbus.h
>> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct regulator_dev *rdev,
>>   	{							\
>>   		.name = (_name),				\
>>   		.of_match = of_match_ptr(_name),		\
>> -		.regulators_node = of_match_ptr("regulators"),	\
>>   		.ops = &pmbus_regulator_ops,			\
>>   		.type = REGULATOR_VOLTAGE,			\
>>   		.owner = THIS_MODULE,				\
>>
>> Maybe someone can check if that works.
>>
>> Thanks,
>> Guenter
> 
> I'd like to follow up on this one. As of this writing, my understanding
> is that the dt-binding should not expect regulators subnodes for
> simple devices like this. There is already a similar binding as
> mentioned in this thread particularly
> "dt-bindings/regulator/infineon,ir38060". I think a binding without
> the subnodes should still work with or without the change above.

Interesting. I am not sure if it really works, though. I looked into
the regulator code, and I don't immediately see the code path it would
take.

> With this, I'd like to know what the specific next steps are to continue
> this patch series.

Can you try on hardware using a devicetree file which doesn't have the
regulators node ? If the current code works, just submit an updated
(simplified) .yaml file and we should be good. If not, I have an
untested patch series introducing another macro which doesn't set
the regulators node.

Thanks,
Guenter


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

* RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-18 15:17               ` Guenter Roeck
@ 2025-03-19  4:10                 ` Encarnacion, Cedric justine
  2025-03-21 16:53                   ` Encarnacion, Cedric justine
  0 siblings, 1 reply; 19+ messages in thread
From: Encarnacion, Cedric justine @ 2025-03-19  4:10 UTC (permalink / raw)
  To: Guenter Roeck, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Tuesday, March 18, 2025 11:17 PM
> To: Encarnacion, Cedric justine <Cedricjustine.Encarnacion@analog.com>;
> Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>;
> Conor Dooley <conor+dt@kernel.org>; Jean Delvare <jdelvare@suse.com>;
> Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
> doc@vger.kernel.org; linux-i2c@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
> 
> [External]
> 
> On 3/18/25 03:03, Encarnacion, Cedric justine wrote:
> >> -----Original Message-----
> >> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> >> Sent: Friday, February 28, 2025 12:33 AM
> >> To: Krzysztof Kozlowski <krzk@kernel.org>
> >> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
> >> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
> >> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
> >> <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
> >> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
> >> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
> >> doc@vger.kernel.org; linux-i2c@vger.kernel.org
> >> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
> >>
> >> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> >> index ddb19c9726d6..289767e5d599 100644
> >> --- a/drivers/hwmon/pmbus/pmbus.h
> >> +++ b/drivers/hwmon/pmbus/pmbus.h
> >> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct regulator_dev
> *rdev,
> >>   	{							\
> >>   		.name = (_name),				\
> >>   		.of_match = of_match_ptr(_name),		\
> >> -		.regulators_node = of_match_ptr("regulators"),	\
> >>   		.ops = &pmbus_regulator_ops,			\
> >>   		.type = REGULATOR_VOLTAGE,			\
> >>   		.owner = THIS_MODULE,				\
> >>
> >> Maybe someone can check if that works.
> >>
> >> Thanks,
> >> Guenter
> >
> > I'd like to follow up on this one. As of this writing, my understanding
> > is that the dt-binding should not expect regulators subnodes for
> > simple devices like this. There is already a similar binding as
> > mentioned in this thread particularly
> > "dt-bindings/regulator/infineon,ir38060". I think a binding without
> > the subnodes should still work with or without the change above.
> 
> Interesting. I am not sure if it really works, though. I looked into
> the regulator code, and I don't immediately see the code path it would
> take.
> 
> > With this, I'd like to know what the specific next steps are to continue
> > this patch series.
> 
> Can you try on hardware using a devicetree file which doesn't have the
> regulators node ? If the current code works, just submit an updated
> (simplified) .yaml file and we should be good. If not, I have an
> untested patch series introducing another macro which doesn't set
> the regulators node.

Okay. I'll test this and get back to you.

Best Regards,
Cedric

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

* RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-19  4:10                 ` Encarnacion, Cedric justine
@ 2025-03-21 16:53                   ` Encarnacion, Cedric justine
  2025-03-21 17:09                     ` Guenter Roeck
  2025-03-21 20:23                     ` Guenter Roeck
  0 siblings, 2 replies; 19+ messages in thread
From: Encarnacion, Cedric justine @ 2025-03-21 16:53 UTC (permalink / raw)
  To: Guenter Roeck, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

> -----Original Message-----
> From: Encarnacion, Cedric justine
> Sent: Wednesday, March 19, 2025 12:10 PM
> To: Guenter Roeck <linux@roeck-us.net>; Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>;
> Conor Dooley <conor+dt@kernel.org>; Jean Delvare <jdelvare@suse.com>;
> Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
> doc@vger.kernel.org; linux-i2c@vger.kernel.org
> Subject: RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
> 
> > -----Original Message-----
> > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> > Sent: Tuesday, March 18, 2025 11:17 PM
> > To: Encarnacion, Cedric justine
> > <Cedricjustine.Encarnacion@analog.com>;
> > Krzysztof Kozlowski <krzk@kernel.org>
> > Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
> > <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
> > <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC
> > Chiu <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
> > kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
> > doc@vger.kernel.org; linux-i2c@vger.kernel.org
> > Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
> >
> > [External]
> >
> > On 3/18/25 03:03, Encarnacion, Cedric justine wrote:
> > >> -----Original Message-----
> > >> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> > >> Sent: Friday, February 28, 2025 12:33 AM
> > >> To: Krzysztof Kozlowski <krzk@kernel.org>
> > >> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
> > >> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
> > >> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean
> > >> Delvare <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>;
> > >> Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>;
> > >> devicetree@vger.kernel.org; linux- kernel@vger.kernel.org;
> > >> linux-hwmon@vger.kernel.org; linux- doc@vger.kernel.org;
> > >> linux-i2c@vger.kernel.org
> > >> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
> > >>
> > >> diff --git a/drivers/hwmon/pmbus/pmbus.h
> > >> b/drivers/hwmon/pmbus/pmbus.h index ddb19c9726d6..289767e5d599
> > >> 100644
> > >> --- a/drivers/hwmon/pmbus/pmbus.h
> > >> +++ b/drivers/hwmon/pmbus/pmbus.h
> > >> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct
> > >> regulator_dev
> > *rdev,
> > >>   	{							\
> > >>   		.name = (_name),				\
> > >>   		.of_match = of_match_ptr(_name),		\
> > >> -		.regulators_node = of_match_ptr("regulators"),	\
> > >>   		.ops = &pmbus_regulator_ops,			\
> > >>   		.type = REGULATOR_VOLTAGE,			\
> > >>   		.owner = THIS_MODULE,				\
> > >>
> > >> Maybe someone can check if that works.
> > >>
> > >> Thanks,
> > >> Guenter
> > >
> > > I'd like to follow up on this one. As of this writing, my
> > > understanding is that the dt-binding should not expect regulators
> > > subnodes for simple devices like this. There is already a similar
> > > binding as mentioned in this thread particularly
> > > "dt-bindings/regulator/infineon,ir38060". I think a binding without
> > > the subnodes should still work with or without the change above.
> >
> > Interesting. I am not sure if it really works, though. I looked into
> > the regulator code, and I don't immediately see the code path it would
> > take.
> >
> > > With this, I'd like to know what the specific next steps are to
> > > continue this patch series.
> >
> > Can you try on hardware using a devicetree file which doesn't have the
> > regulators node ? If the current code works, just submit an updated
> > (simplified) .yaml file and we should be good. If not, I have an
> > untested patch series introducing another macro which doesn't set the
> > regulators node.
> 
> Okay. I'll test this and get back to you.

The "simplified" dt file (without the regulators node) does not work with
the current regulator_desc macro. I have also tried simply removing the
regulators_node setting from the regulator_desc macro, and it does not
work too. of_match looks for a certain regulator name in dt, and it seems
like it must handle NULL cases as well as suggested previously. I would
appreciate if this would be also verified on other ends. For now, I think I'll
wait for another macro to be introduced in pmbus to support this kind of
bindings.

Best regards,
Cedric

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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-21 16:53                   ` Encarnacion, Cedric justine
@ 2025-03-21 17:09                     ` Guenter Roeck
  2025-03-21 17:24                       ` Guenter Roeck
  2025-03-21 20:23                     ` Guenter Roeck
  1 sibling, 1 reply; 19+ messages in thread
From: Guenter Roeck @ 2025-03-21 17:09 UTC (permalink / raw)
  To: Encarnacion, Cedric justine, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

On 3/21/25 09:53, Encarnacion, Cedric justine wrote:
>> -----Original Message-----
>> From: Encarnacion, Cedric justine
>> Sent: Wednesday, March 19, 2025 12:10 PM
>> To: Guenter Roeck <linux@roeck-us.net>; Krzysztof Kozlowski <krzk@kernel.org>
>> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>;
>> Conor Dooley <conor+dt@kernel.org>; Jean Delvare <jdelvare@suse.com>;
>> Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
>> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>> Subject: RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>
>>> -----Original Message-----
>>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>>> Sent: Tuesday, March 18, 2025 11:17 PM
>>> To: Encarnacion, Cedric justine
>>> <Cedricjustine.Encarnacion@analog.com>;
>>> Krzysztof Kozlowski <krzk@kernel.org>
>>> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
>>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
>>> <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC
>>> Chiu <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>
>>> [External]
>>>
>>> On 3/18/25 03:03, Encarnacion, Cedric justine wrote:
>>>>> -----Original Message-----
>>>>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>>>>> Sent: Friday, February 28, 2025 12:33 AM
>>>>> To: Krzysztof Kozlowski <krzk@kernel.org>
>>>>> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
>>>>> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
>>>>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean
>>>>> Delvare <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>;
>>>>> Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>;
>>>>> devicetree@vger.kernel.org; linux- kernel@vger.kernel.org;
>>>>> linux-hwmon@vger.kernel.org; linux- doc@vger.kernel.org;
>>>>> linux-i2c@vger.kernel.org
>>>>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>>>
>>>>> diff --git a/drivers/hwmon/pmbus/pmbus.h
>>>>> b/drivers/hwmon/pmbus/pmbus.h index ddb19c9726d6..289767e5d599
>>>>> 100644
>>>>> --- a/drivers/hwmon/pmbus/pmbus.h
>>>>> +++ b/drivers/hwmon/pmbus/pmbus.h
>>>>> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct
>>>>> regulator_dev
>>> *rdev,
>>>>>    	{							\
>>>>>    		.name = (_name),				\
>>>>>    		.of_match = of_match_ptr(_name),		\
>>>>> -		.regulators_node = of_match_ptr("regulators"),	\
>>>>>    		.ops = &pmbus_regulator_ops,			\
>>>>>    		.type = REGULATOR_VOLTAGE,			\
>>>>>    		.owner = THIS_MODULE,				\
>>>>>
>>>>> Maybe someone can check if that works.
>>>>>
>>>>> Thanks,
>>>>> Guenter
>>>>
>>>> I'd like to follow up on this one. As of this writing, my
>>>> understanding is that the dt-binding should not expect regulators
>>>> subnodes for simple devices like this. There is already a similar
>>>> binding as mentioned in this thread particularly
>>>> "dt-bindings/regulator/infineon,ir38060". I think a binding without
>>>> the subnodes should still work with or without the change above.
>>>
>>> Interesting. I am not sure if it really works, though. I looked into
>>> the regulator code, and I don't immediately see the code path it would
>>> take.
>>>
>>>> With this, I'd like to know what the specific next steps are to
>>>> continue this patch series.
>>>
>>> Can you try on hardware using a devicetree file which doesn't have the
>>> regulators node ? If the current code works, just submit an updated
>>> (simplified) .yaml file and we should be good. If not, I have an
>>> untested patch series introducing another macro which doesn't set the
>>> regulators node.
>>
>> Okay. I'll test this and get back to you.
> 
> The "simplified" dt file (without the regulators node) does not work with
> the current regulator_desc macro. I have also tried simply removing the
> regulators_node setting from the regulator_desc macro, and it does not
> work too. of_match looks for a certain regulator name in dt, and it seems
> like it must handle NULL cases as well as suggested previously. I would
> appreciate if this would be also verified on other ends. For now, I think I'll
> wait for another macro to be introduced in pmbus to support this kind of
> bindings.
> 

Figured. As it turns out, there is also a patch series pending which tries
to fix the problem for ir38060 by changing its bindings.

I'll dig up my patch series to add a new macro and send it out as RFT.

Thanks,
Guenter


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-21 17:09                     ` Guenter Roeck
@ 2025-03-21 17:24                       ` Guenter Roeck
  2025-03-24  7:16                         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 19+ messages in thread
From: Guenter Roeck @ 2025-03-21 17:24 UTC (permalink / raw)
  To: Encarnacion, Cedric justine, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

On 3/21/25 10:09, Guenter Roeck wrote:
> On 3/21/25 09:53, Encarnacion, Cedric justine wrote:
>>> -----Original Message-----
>>> From: Encarnacion, Cedric justine
>>> Sent: Wednesday, March 19, 2025 12:10 PM
>>> To: Guenter Roeck <linux@roeck-us.net>; Krzysztof Kozlowski <krzk@kernel.org>
>>> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>;
>>> Conor Dooley <conor+dt@kernel.org>; Jean Delvare <jdelvare@suse.com>;
>>> Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
>>> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>>> Subject: RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>
>>>> -----Original Message-----
>>>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>>>> Sent: Tuesday, March 18, 2025 11:17 PM
>>>> To: Encarnacion, Cedric justine
>>>> <Cedricjustine.Encarnacion@analog.com>;
>>>> Krzysztof Kozlowski <krzk@kernel.org>
>>>> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
>>>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
>>>> <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC
>>>> Chiu <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>>>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>>>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>>>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>>
>>>> [External]
>>>>
>>>> On 3/18/25 03:03, Encarnacion, Cedric justine wrote:
>>>>>> -----Original Message-----
>>>>>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>>>>>> Sent: Friday, February 28, 2025 12:33 AM
>>>>>> To: Krzysztof Kozlowski <krzk@kernel.org>
>>>>>> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
>>>>>> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
>>>>>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean
>>>>>> Delvare <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>;
>>>>>> Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>;
>>>>>> devicetree@vger.kernel.org; linux- kernel@vger.kernel.org;
>>>>>> linux-hwmon@vger.kernel.org; linux- doc@vger.kernel.org;
>>>>>> linux-i2c@vger.kernel.org
>>>>>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>>>>
>>>>>> diff --git a/drivers/hwmon/pmbus/pmbus.h
>>>>>> b/drivers/hwmon/pmbus/pmbus.h index ddb19c9726d6..289767e5d599
>>>>>> 100644
>>>>>> --- a/drivers/hwmon/pmbus/pmbus.h
>>>>>> +++ b/drivers/hwmon/pmbus/pmbus.h
>>>>>> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct
>>>>>> regulator_dev
>>>> *rdev,
>>>>>>        {                            \
>>>>>>            .name = (_name),                \
>>>>>>            .of_match = of_match_ptr(_name),        \
>>>>>> -        .regulators_node = of_match_ptr("regulators"),    \
>>>>>>            .ops = &pmbus_regulator_ops,            \
>>>>>>            .type = REGULATOR_VOLTAGE,            \
>>>>>>            .owner = THIS_MODULE,                \
>>>>>>
>>>>>> Maybe someone can check if that works.
>>>>>>
>>>>>> Thanks,
>>>>>> Guenter
>>>>>
>>>>> I'd like to follow up on this one. As of this writing, my
>>>>> understanding is that the dt-binding should not expect regulators
>>>>> subnodes for simple devices like this. There is already a similar
>>>>> binding as mentioned in this thread particularly
>>>>> "dt-bindings/regulator/infineon,ir38060". I think a binding without
>>>>> the subnodes should still work with or without the change above.
>>>>
>>>> Interesting. I am not sure if it really works, though. I looked into
>>>> the regulator code, and I don't immediately see the code path it would
>>>> take.
>>>>
>>>>> With this, I'd like to know what the specific next steps are to
>>>>> continue this patch series.
>>>>
>>>> Can you try on hardware using a devicetree file which doesn't have the
>>>> regulators node ? If the current code works, just submit an updated
>>>> (simplified) .yaml file and we should be good. If not, I have an
>>>> untested patch series introducing another macro which doesn't set the
>>>> regulators node.
>>>
>>> Okay. I'll test this and get back to you.
>>
>> The "simplified" dt file (without the regulators node) does not work with
>> the current regulator_desc macro. I have also tried simply removing the
>> regulators_node setting from the regulator_desc macro, and it does not
>> work too. of_match looks for a certain regulator name in dt, and it seems
>> like it must handle NULL cases as well as suggested previously. I would
>> appreciate if this would be also verified on other ends. For now, I think I'll
>> wait for another macro to be introduced in pmbus to support this kind of
>> bindings.
>>
> 
> Figured. As it turns out, there is also a patch series pending which tries
> to fix the problem for ir38060 by changing its bindings.
> 
> I'll dig up my patch series to add a new macro and send it out as RFT.
> 

Question for DT maintainers:

Existing bindings, such as
	Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
expect a nested regulators node even though there is only a single
regulator. What is the correct approach: Keep the nesting requirement
for those regulators as is (even if there are no in-tree bindings
using them), or update the code and the bindings to drop the nesting ?

Thanks,
Guenter


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-21 16:53                   ` Encarnacion, Cedric justine
  2025-03-21 17:09                     ` Guenter Roeck
@ 2025-03-21 20:23                     ` Guenter Roeck
  1 sibling, 0 replies; 19+ messages in thread
From: Guenter Roeck @ 2025-03-21 20:23 UTC (permalink / raw)
  To: Encarnacion, Cedric justine, Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

On 3/21/25 09:53, Encarnacion, Cedric justine wrote:
>> -----Original Message-----
>> From: Encarnacion, Cedric justine
>> Sent: Wednesday, March 19, 2025 12:10 PM
>> To: Guenter Roeck <linux@roeck-us.net>; Krzysztof Kozlowski <krzk@kernel.org>
>> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>;
>> Conor Dooley <conor+dt@kernel.org>; Jean Delvare <jdelvare@suse.com>;
>> Jonathan Corbet <corbet@lwn.net>; Delphine CC Chiu
>> <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>> Subject: RE: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>
>>> -----Original Message-----
>>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>>> Sent: Tuesday, March 18, 2025 11:17 PM
>>> To: Encarnacion, Cedric justine
>>> <Cedricjustine.Encarnacion@analog.com>;
>>> Krzysztof Kozlowski <krzk@kernel.org>
>>> Cc: Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
>>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean Delvare
>>> <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>; Delphine CC
>>> Chiu <Delphine_CC_Chiu@wiwynn.com>; devicetree@vger.kernel.org; linux-
>>> kernel@vger.kernel.org; linux-hwmon@vger.kernel.org; linux-
>>> doc@vger.kernel.org; linux-i2c@vger.kernel.org
>>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>
>>> [External]
>>>
>>> On 3/18/25 03:03, Encarnacion, Cedric justine wrote:
>>>>> -----Original Message-----
>>>>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>>>>> Sent: Friday, February 28, 2025 12:33 AM
>>>>> To: Krzysztof Kozlowski <krzk@kernel.org>
>>>>> Cc: Rob Herring <robh@kernel.org>; Encarnacion, Cedric justine
>>>>> <Cedricjustine.Encarnacion@analog.com>; Krzysztof Kozlowski
>>>>> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Jean
>>>>> Delvare <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>;
>>>>> Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>;
>>>>> devicetree@vger.kernel.org; linux- kernel@vger.kernel.org;
>>>>> linux-hwmon@vger.kernel.org; linux- doc@vger.kernel.org;
>>>>> linux-i2c@vger.kernel.org
>>>>> Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
>>>>>
>>>>> diff --git a/drivers/hwmon/pmbus/pmbus.h
>>>>> b/drivers/hwmon/pmbus/pmbus.h index ddb19c9726d6..289767e5d599
>>>>> 100644
>>>>> --- a/drivers/hwmon/pmbus/pmbus.h
>>>>> +++ b/drivers/hwmon/pmbus/pmbus.h
>>>>> @@ -512,7 +512,6 @@ int pmbus_regulator_init_cb(struct
>>>>> regulator_dev
>>> *rdev,
>>>>>    	{							\
>>>>>    		.name = (_name),				\
>>>>>    		.of_match = of_match_ptr(_name),		\
>>>>> -		.regulators_node = of_match_ptr("regulators"),	\
>>>>>    		.ops = &pmbus_regulator_ops,			\
>>>>>    		.type = REGULATOR_VOLTAGE,			\
>>>>>    		.owner = THIS_MODULE,				\
>>>>>
>>>>> Maybe someone can check if that works.
>>>>>
>>>>> Thanks,
>>>>> Guenter
>>>>
>>>> I'd like to follow up on this one. As of this writing, my
>>>> understanding is that the dt-binding should not expect regulators
>>>> subnodes for simple devices like this. There is already a similar
>>>> binding as mentioned in this thread particularly
>>>> "dt-bindings/regulator/infineon,ir38060". I think a binding without
>>>> the subnodes should still work with or without the change above.
>>>
>>> Interesting. I am not sure if it really works, though. I looked into
>>> the regulator code, and I don't immediately see the code path it would
>>> take.
>>>
>>>> With this, I'd like to know what the specific next steps are to
>>>> continue this patch series.
>>>
>>> Can you try on hardware using a devicetree file which doesn't have the
>>> regulators node ? If the current code works, just submit an updated
>>> (simplified) .yaml file and we should be good. If not, I have an
>>> untested patch series introducing another macro which doesn't set the
>>> regulators node.
>>
>> Okay. I'll test this and get back to you.
> 
> The "simplified" dt file (without the regulators node) does not work with
> the current regulator_desc macro. I have also tried simply removing the
> regulators_node setting from the regulator_desc macro, and it does not
> work too. of_match looks for a certain regulator name in dt, and it seems

I just noticed the above. A NULL regulators_node should actually work. From
drivers/regulator/of_regulator.c:regulator_of_get_init_node():

         if (desc->regulators_node) {
                 search = of_get_child_by_name(dev->of_node,
                                               desc->regulators_node);
         } else {
                 search = of_node_get(dev->of_node);

                 if (!strcmp(desc->of_match, search->name))
                         return search;
         }

So, yes, there has to be a name match, but that is on the node describing
the chip. That is how all single-regulator chips are supposed to work.

Guenter


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-21 17:24                       ` Guenter Roeck
@ 2025-03-24  7:16                         ` Krzysztof Kozlowski
  2025-03-24 13:58                           ` Guenter Roeck
  0 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-24  7:16 UTC (permalink / raw)
  To: Guenter Roeck, Encarnacion, Cedric justine
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

On 21/03/2025 18:24, Guenter Roeck wrote:
>>
>> Figured. As it turns out, there is also a patch series pending which tries
>> to fix the problem for ir38060 by changing its bindings.
>>
>> I'll dig up my patch series to add a new macro and send it out as RFT.
>>
> 
> Question for DT maintainers:
> 
> Existing bindings, such as
> 	Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> expect a nested regulators node even though there is only a single
> regulator. What is the correct approach: Keep the nesting requirement
> for those regulators as is (even if there are no in-tree bindings
> using them), or update the code and the bindings to drop the nesting ?
> 
I would recommend keep the nesting, so don't touch it. There might be
external users, other projects relying on this. You can however
deprecate old node (nesting), if the driver can support both. Not sure
if it is worth the effort.

Best regards,
Krzysztof

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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-03-24  7:16                         ` Krzysztof Kozlowski
@ 2025-03-24 13:58                           ` Guenter Roeck
  0 siblings, 0 replies; 19+ messages in thread
From: Guenter Roeck @ 2025-03-24 13:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Encarnacion, Cedric justine
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org

On 3/24/25 00:16, Krzysztof Kozlowski wrote:
> On 21/03/2025 18:24, Guenter Roeck wrote:
>>>
>>> Figured. As it turns out, there is also a patch series pending which tries
>>> to fix the problem for ir38060 by changing its bindings.
>>>
>>> I'll dig up my patch series to add a new macro and send it out as RFT.
>>>
>>
>> Question for DT maintainers:
>>
>> Existing bindings, such as
>> 	Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
>> expect a nested regulators node even though there is only a single
>> regulator. What is the correct approach: Keep the nesting requirement
>> for those regulators as is (even if there are no in-tree bindings
>> using them), or update the code and the bindings to drop the nesting ?
>>
> I would recommend keep the nesting, so don't touch it. There might be
> external users, other projects relying on this. You can however
> deprecate old node (nesting), if the driver can support both. Not sure
> if it is worth the effort.
> 
That is not in driver control: If regulators_node is set by the driver,
the regulator subsystem mandates the sub-node.

Thanks,
Guenter


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

* Re: [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074
  2025-02-26  8:20   ` Krzysztof Kozlowski
  2025-02-26 14:59     ` Rob Herring
@ 2025-04-07 22:59     ` Guenter Roeck
  1 sibling, 0 replies; 19+ messages in thread
From: Guenter Roeck @ 2025-04-07 22:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Cedric Encarnacion
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jean Delvare,
	Jonathan Corbet, Delphine CC Chiu, devicetree, linux-kernel,
	linux-hwmon, linux-doc, linux-i2c

On 2/26/25 00:20, Krzysztof Kozlowski wrote:
> On Tue, Feb 25, 2025 at 09:01:13PM +0800, Cedric Encarnacion wrote:
>> Add Analog Devices LT3074 Ultralow Noise, High PSRR Dropout Linear
>> Regulator.
>>
>> Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
>> ---
>>   .../bindings/hwmon/pmbus/adi,lt3074.yaml           | 64 ++++++++++++++++++++++
>>   MAINTAINERS                                        |  7 +++
>>   2 files changed, 71 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..714426fd655a8daa96e15e1f789743f36001ac7a
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
>> @@ -0,0 +1,64 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/hwmon/pmbus/adi,lt3074.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Analog Devices LT3074 voltage regulator
>> +
>> +maintainers:
>> +  - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
>> +
>> +description: |
>> +  The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
>> +  response linear regulator. It allows telemetry for input/output voltage,
>> +  output current and temperature through the PMBus serial interface.
>> +
>> +  Datasheet:
>> +    https://www.analog.com/en/products/lt3074.html
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - adi,lt3074
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  regulators:
>> +    type: object
>> +    description: |
>> +      list of regulators provided by this controller.
> 
> You have only one regulator, so drop the "regulators". vout could be
> here, but since you do not have any other resources, I doubt it stands
> on its own either. This is even visible in your DTS - you named the
> device as regulator, so logically this is the regulator. Regulator does
> not have regulators (otherwise they could also have regulators... so
> triple regulator).
> 
> hwmon code might need some changes, but that's not really relevant for
> proper hardware description.
> 

With the changes in the hwmon pmbus code now in linux-next, this should
be ready for another revision with non-nested regulator support.

Thanks,
Guenter


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

end of thread, other threads:[~2025-04-07 22:59 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 13:01 [PATCH v2 0/2] Add support for LT3074 low voltage linear regulator Cedric Encarnacion
2025-02-25 13:01 ` [PATCH v2 1/2] dt-bindings: hwmon: pmbus: add lt3074 Cedric Encarnacion
2025-02-26  8:20   ` Krzysztof Kozlowski
2025-02-26 14:59     ` Rob Herring
2025-02-26 19:17       ` Guenter Roeck
2025-02-27  8:50         ` Krzysztof Kozlowski
2025-02-27 16:32           ` Guenter Roeck
2025-03-18 10:03             ` Encarnacion, Cedric justine
2025-03-18 15:17               ` Guenter Roeck
2025-03-19  4:10                 ` Encarnacion, Cedric justine
2025-03-21 16:53                   ` Encarnacion, Cedric justine
2025-03-21 17:09                     ` Guenter Roeck
2025-03-21 17:24                       ` Guenter Roeck
2025-03-24  7:16                         ` Krzysztof Kozlowski
2025-03-24 13:58                           ` Guenter Roeck
2025-03-21 20:23                     ` Guenter Roeck
2025-04-07 22:59     ` Guenter Roeck
2025-02-25 13:01 ` [PATCH v2 2/2] hwmon: (pmbus/lt3074): add support for lt3074 Cedric Encarnacion
2025-02-26 13:03   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).