Devicetree
 help / color / mirror / Atom feed
* [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support
@ 2026-07-28  3:07 Luiz Angelo Daros de Luca
  2026-07-28  3:07 ` [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470 Luiz Angelo Daros de Luca
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-07-28  3:07 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, Luiz Angelo Daros de Luca,
	linux-pwm

The ADT7470 is a temperature monitor and PWM fan controller capable of
monitoring up to ten external temperature sensors and controlling up to
four PWM outputs.

Currently, the driver exposes these sensors and PWM controls only
through the hwmon sysfs interface. This patch series integrates the
ADT7470 driver with the kernel's thermal and PWM subsystems. This allows
temperature sensors to participate in Device Tree thermal zones while
exposing the PWM outputs as generic PWM providers for consumers such as
pwm-fan.

Patch 1 adds the YAML device tree binding documentation.
Patch 2 introduces the ADT7470_PWM_MAX macro.
Patch 3 registers the four PWM channels as a generic PWM provider.
Patch 4 registers the external temperature sensors with the thermal
framework.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>

---
Changes in v3:
- Migrated from the `.apply` callback to the PWM Waveform API.
- Moved fixes to another patch series:
  20260727-adt7470_thermalzone-v3-0-21424d550c3d@gmail.com
- Use guard(mutex) for simpler locking.
- Link to v2: https://patch.msgid.link/20260717-adt7470_thermalzone-v2-0-a55147958fad@gmail.com

Changes in v2:
- Fixed 2 previous bugs uncovered by Sashiko-bot during review.
- Dropped the thermal cooling device registration for the PWM channels.
- Implemented generic PWM provider support using the PWM subsystem.
- Updated Kconfig to safely handle the PWM subsystem dependency (depends on PWM || PWM=n).
- Updated Device Tree bindings to require #pwm-cells instead of #cooling-cells.
- Link to v1: https://patch.msgid.link/20260716-adt7470_thermalzone-v1-0-cc55ef35edde@gmail.com

To: Guenter Roeck <linux@roeck-us.net>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>
To: Andrew Morton <akpm@linux-foundation.org>
To: "Darrick J. Wong" <djwong@us.ibm.com>
To: Uwe Kleine-König <ukleinek@kernel.org>
Cc: linux-hwmon@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-pwm@vger.kernel.org

---
Luiz Angelo Daros de Luca (4):
      dt-bindings: hwmon: adi,adt7470
      hwmon: (adt7470) Add ADT7470_PWM_MAX macro
      hwmon: (adt7470) Expose fan control via PWM framework
      hwmon: (adt7470) Add thermal zone sensor support

 .../devicetree/bindings/hwmon/adi,adt7470.yaml     |  55 ++++++++
 drivers/hwmon/Kconfig                              |   1 +
 drivers/hwmon/adt7470.c                            | 146 ++++++++++++++++++++-
 3 files changed, 199 insertions(+), 3 deletions(-)
---
base-commit: 858071a1ca5f9a3330b4559dab41565086ab4862
change-id: 20260716-adt7470_thermalzone-59a102278d72
prerequisite-message-id: <20260727-adt7470_fixes-v2-0-598e38a46ba6@gmail.com>
prerequisite-patch-id: c9bcf1ff38418e47f71472b71dfde900d8d930ec
prerequisite-patch-id: 13a1e87608fe9df25880aa4d1a415aa2dc0b6ffd
prerequisite-patch-id: 01857ee7a1f867a6d415a72f471db5cfef294235
prerequisite-patch-id: 4472685c2096d7d07e580b5d07c37328e0a13ad5
prerequisite-patch-id: 7a40cf8dfb0282f8b7341a1277d4169d8573cb13
prerequisite-patch-id: c8f47ab359354fcc2a7c742adb4b26e3a761bd07
prerequisite-patch-id: 1b37470872d5d5d7795370ceec16e2695894bb44
prerequisite-patch-id: 5ba552f8997854e2f24c3ef005490b5eedcf083f

Best regards,
--  
Luiz Angelo Daros de Luca <luizluca@gmail.com>


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

* [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470
  2026-07-28  3:07 [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
@ 2026-07-28  3:07 ` Luiz Angelo Daros de Luca
  2026-07-28  8:14   ` Krzysztof Kozlowski
  2026-07-28  3:07 ` [hwmon-next PATCH v3 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-07-28  3:07 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, Luiz Angelo Daros de Luca,
	linux-pwm

The Analog Devices ADT7470 is a multichannel temperature sensor and
PWM fan controller. It supports monitoring up to 10 external
temperature sensors and controlling up to 4 fans.

Add the device tree binding documentation for it. This includes
support for the thermal framework by defining the "#thermal-sensor-cells"
property, and models the fan control lines as PWM channels by
defining the "#pwm-cells" property.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 .../devicetree/bindings/hwmon/adi,adt7470.yaml     | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml b/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml
new file mode 100644
index 000000000000..bb2375a4a490
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/adi,adt7470.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADT7470 hwmon sensor
+
+maintainers:
+  - Luiz Angelo Daros de Luca <luizluca@gmail.com>
+
+description:
+  Multi-channel temperature monitor and PWM fan controller.
+  It supports monitoring up to 10 external temperature sensors and
+  controlling up to four fans. The fan control lines are modeled
+  as standard PWM channels.
+
+properties:
+  compatible:
+    const: adi,adt7470
+
+  reg:
+    maxItems: 1
+
+  "#pwm-cells":
+    const: 3
+    description:
+      See Documentation/devicetree/bindings/pwm/pwm.yaml for the
+      generic PWM binding description.
+
+  "#thermal-sensor-cells":
+    const: 1
+    description:
+      Number of cells required to uniquely identify the temperature sensors.
+      Valid index values are 0 to 9, corresponding to temp1 through temp10.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        hwmon@2f {
+            compatible = "adi,adt7470";
+            reg = <0x2f>;
+            #pwm-cells = <3>;
+            #thermal-sensor-cells = <1>;
+        };
+    };

-- 
2.55.0


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

* [hwmon-next PATCH v3 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro
  2026-07-28  3:07 [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
  2026-07-28  3:07 ` [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470 Luiz Angelo Daros de Luca
@ 2026-07-28  3:07 ` Luiz Angelo Daros de Luca
  2026-07-28  3:07 ` [hwmon-next PATCH v3 3/4] hwmon: (adt7470) Expose fan control via PWM framework Luiz Angelo Daros de Luca
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-07-28  3:07 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, Luiz Angelo Daros de Luca,
	linux-pwm

Instead of a magic 255, use a macro to refer to it.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 drivers/hwmon/adt7470.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index c45b984c02e6..87ddd7b8ddae 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -100,6 +100,7 @@ static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
 #define ADT7470_REG_FAN_MAX(x)	(ADT7470_REG_FAN_MAX_BASE_ADDR + ((x) * 2))
 
 #define ADT7470_PWM_COUNT	4
+#define ADT7470_PWM_MAX		255
 #define ADT7470_REG_PWM(x)	(ADT7470_REG_PWM_BASE_ADDR + (x))
 #define ADT7470_REG_PWM_MAX(x)	(ADT7470_REG_PWM_MAX_BASE_ADDR + (x))
 #define ADT7470_REG_PWM_MIN(x)	(ADT7470_REG_PWM_MIN_BASE_ADDR + (x))
@@ -850,7 +851,7 @@ static int adt7470_pwm_write(struct device *dev, u32 attr, int channel, long val
 
 	switch (attr) {
 	case hwmon_pwm_input:
-		val = clamp_val(val, 0, 255);
+		val = clamp_val(val, 0, ADT7470_PWM_MAX);
 		mutex_lock(&data->lock);
 		err = regmap_write(data->regmap, ADT7470_REG_PWM(channel),
 				   val);
@@ -910,7 +911,7 @@ static ssize_t pwm_max_store(struct device *dev,
 	if (kstrtol(buf, 10, &temp))
 		return -EINVAL;
 
-	temp = clamp_val(temp, 0, 255);
+	temp = clamp_val(temp, 0, ADT7470_PWM_MAX);
 
 	mutex_lock(&data->lock);
 	data->pwm_max[attr->index] = temp;
@@ -945,7 +946,7 @@ static ssize_t pwm_min_store(struct device *dev,
 	if (kstrtol(buf, 10, &temp))
 		return -EINVAL;
 
-	temp = clamp_val(temp, 0, 255);
+	temp = clamp_val(temp, 0, ADT7470_PWM_MAX);
 
 	mutex_lock(&data->lock);
 	data->pwm_min[attr->index] = temp;

-- 
2.55.0


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

* [hwmon-next PATCH v3 3/4] hwmon: (adt7470) Expose fan control via PWM framework
  2026-07-28  3:07 [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
  2026-07-28  3:07 ` [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470 Luiz Angelo Daros de Luca
  2026-07-28  3:07 ` [hwmon-next PATCH v3 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
@ 2026-07-28  3:07 ` Luiz Angelo Daros de Luca
  2026-07-28  3:07 ` [hwmon-next PATCH v3 4/4] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
  2026-07-28  3:21 ` [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal " Luiz Angelo Daros de Luca
  4 siblings, 0 replies; 9+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-07-28  3:07 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, Luiz Angelo Daros de Luca,
	linux-pwm

The ADT7470 features four PWM outputs designed to control fans.
Previously, these were only accessible through the legacy hwmon
sysfs interface.

Expose the ADT7470 fan control lines through the generic PWM framework.
This allows generic PWM consumers described in Device Tree, such as
"pwm-fan", to use the device through the "#pwm-cells" property.  This is
particularly necessary for boards where the ADT7470 external temperature
sensors are not populated and the chip is used strictly as a fan
controller (e.g., Edgecore ECS-2100-52T switches). In such setups,
delegating control to the generic PWM subsystem allows the kernel's
thermal framework to manage the fans based on unrelated temperature
zones, such as internal SoC sensors.

When a PWM consumer applies a new PWM state, the driver automatically
switches the corresponding PWM channel to manual mode so that the
requested duty cycle takes effect. The duty cycle specified by the PWM
framework is internally converted to the 0-255 scale expected by the
hardware registers.

The legacy sysfs interface remains unaffected and operates in parallel.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 drivers/hwmon/Kconfig   |   1 +
 drivers/hwmon/adt7470.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 138 insertions(+)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 6b71e3304b4f..0d6bd117d14d 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -224,6 +224,7 @@ config SENSORS_ADT7462
 config SENSORS_ADT7470
 	tristate "Analog Devices ADT7470"
 	depends on I2C
+	depends on PWM || PWM=n
 	select REGMAP_I2C
 	help
 	  If you say yes here you get support for the Analog Devices
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 87ddd7b8ddae..883838fdcd7d 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -22,6 +22,9 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/util_macros.h>
+#include <linux/pwm.h>
+#include <linux/cleanup.h>
+#include <linux/math64.h>
 
 /* Addresses to scan */
 static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
@@ -887,6 +890,125 @@ static int adt7470_pwm_write(struct device *dev, u32 attr, int channel, long val
 	return err;
 }
 
+struct adt7470_pwm_wfhw {
+	u8 val;
+};
+
+static int adt7470_pwm_round_waveform_tohw(struct pwm_chip *chip,
+					   struct pwm_device *pwm,
+					   const struct pwm_waveform *wf,
+					   void *_wfhw)
+{
+	struct adt7470_data *data = pwmchip_get_drvdata(chip);
+	struct adt7470_pwm_wfhw *wfhw = _wfhw;
+	u64 period_ns;
+
+	if (wf->duty_length_ns == 0) {
+		wfhw->val = 0;
+		return 0;
+	}
+
+	/*
+	 * The PWM frequency (period) is a single chip-wide setting shared by
+	 * all 4 channels, so it cannot be changed on a per-pwm_device basis
+	 * through this API. The duty cycle is rounded against the currently
+	 * configured hardware period rather than the period requested in
+	 * @wf; round_waveform_fromhw() reports the actual resulting
+	 * waveform back so the core/consumer can detect a mismatch.
+	 */
+	period_ns = DIV_ROUND_CLOSEST(NSEC_PER_SEC, data->pwm_freq);
+	wfhw->val = min_t(u64,
+			  mul_u64_u64_div_u64(wf->duty_length_ns, ADT7470_PWM_MAX, period_ns),
+			  ADT7470_PWM_MAX);
+	return 0;
+}
+
+static int adt7470_pwm_round_waveform_fromhw(struct pwm_chip *chip,
+					     struct pwm_device *pwm,
+					     const void *_wfhw,
+					     struct pwm_waveform *wf)
+{
+	struct adt7470_data *data = pwmchip_get_drvdata(chip);
+	const struct adt7470_pwm_wfhw *wfhw = _wfhw;
+
+	wf->period_length_ns = DIV_ROUND_CLOSEST(NSEC_PER_SEC, data->pwm_freq);
+	wf->duty_offset_ns = 0;
+	wf->duty_length_ns = mul_u64_u64_div_u64(wfhw->val,
+						 wf->period_length_ns,
+						 ADT7470_PWM_MAX);
+
+	return 0;
+}
+
+static int adt7470_pwm_read_waveform(struct pwm_chip *chip,
+				     struct pwm_device *pwm,
+				     void *_wfhw)
+{
+	struct adt7470_data *data = pwmchip_get_drvdata(chip);
+	struct device *dev = regmap_get_device(data->regmap);
+	struct adt7470_pwm_wfhw *wfhw = _wfhw;
+
+	data = adt7470_update_device(dev);
+	if (IS_ERR(data))
+		return PTR_ERR(data);
+
+	/*
+	 * No lock needed: like the other hwmon_ops read callbacks in this
+	 * driver (e.g. adt7470_pwm_read()), this only does a single byte
+	 * read from the cache populated by adt7470_update_device().
+	 */
+	wfhw->val = data->pwm[pwm->hwpwm];
+
+	return 0;
+}
+
+static int adt7470_pwm_write_waveform(struct pwm_chip *chip,
+				      struct pwm_device *pwm,
+				      const void *_wfhw)
+{
+	struct adt7470_data *data = pwmchip_get_drvdata(chip);
+	const struct adt7470_pwm_wfhw *wfhw = _wfhw;
+	unsigned int pwm_auto_reg_mask;
+	int err;
+
+	if (pwm->hwpwm % 2)
+		pwm_auto_reg_mask = ADT7470_PWM2_AUTO_MASK;
+	else
+		pwm_auto_reg_mask = ADT7470_PWM1_AUTO_MASK;
+
+	guard(mutex)(&data->lock);
+
+	if (data->pwm[pwm->hwpwm] == wfhw->val &&
+	    data->pwm_automatic[pwm->hwpwm] == 0)
+		return 0;
+
+	/* Put the PWM channel in manual mode before updating it. */
+	err = regmap_update_bits(data->regmap,
+				 ADT7470_REG_PWM_CFG(pwm->hwpwm),
+				 pwm_auto_reg_mask, 0);
+	if (err < 0)
+		return err;
+
+	data->pwm_automatic[pwm->hwpwm] = 0;
+
+	err = regmap_write(data->regmap,
+			   ADT7470_REG_PWM(pwm->hwpwm), wfhw->val);
+	if (err < 0)
+		return err;
+
+	data->pwm[pwm->hwpwm] = wfhw->val;
+
+	return 0;
+}
+
+static const struct pwm_ops adt7470_pwm_ops = {
+	.sizeof_wfhw = sizeof(struct adt7470_pwm_wfhw),
+	.round_waveform_tohw = adt7470_pwm_round_waveform_tohw,
+	.round_waveform_fromhw = adt7470_pwm_round_waveform_fromhw,
+	.read_waveform = adt7470_pwm_read_waveform,
+	.write_waveform = adt7470_pwm_write_waveform,
+};
+
 static ssize_t pwm_max_show(struct device *dev,
 			    struct device_attribute *devattr, char *buf)
 {
@@ -1336,6 +1458,21 @@ static int adt7470_probe(struct i2c_client *client)
 	if (IS_ERR(hwmon_dev))
 		return PTR_ERR(hwmon_dev);
 
+	if (IS_REACHABLE(CONFIG_PWM)) {
+		struct pwm_chip *chip;
+
+		chip = devm_pwmchip_alloc(dev, ADT7470_PWM_COUNT, 0);
+		if (IS_ERR(chip))
+			return PTR_ERR(chip);
+
+		chip->ops = &adt7470_pwm_ops;
+		pwmchip_set_drvdata(chip, data);
+
+		err = devm_pwmchip_add(dev, chip);
+		if (err)
+			return dev_err_probe(dev, err, "failed to register PWM chip\n");
+	}
+
 	data->auto_update = kthread_run(adt7470_update_thread, client, "%s",
 					dev_name(hwmon_dev));
 	if (IS_ERR(data->auto_update))

-- 
2.55.0


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

* [hwmon-next PATCH v3 4/4] hwmon: (adt7470) Add thermal zone sensor support
  2026-07-28  3:07 [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
                   ` (2 preceding siblings ...)
  2026-07-28  3:07 ` [hwmon-next PATCH v3 3/4] hwmon: (adt7470) Expose fan control via PWM framework Luiz Angelo Daros de Luca
@ 2026-07-28  3:07 ` Luiz Angelo Daros de Luca
  2026-07-28  3:21 ` [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal " Luiz Angelo Daros de Luca
  4 siblings, 0 replies; 9+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-07-28  3:07 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, Luiz Angelo Daros de Luca,
	linux-pwm

Register the ADT7470 temperature channels as thermal zone sensors.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 drivers/hwmon/adt7470.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 883838fdcd7d..6cc246aa1285 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -1349,6 +1349,8 @@ static const struct hwmon_ops adt7470_hwmon_ops = {
 };
 
 static const struct hwmon_channel_info * const adt7470_info[] = {
+	HWMON_CHANNEL_INFO(chip,
+			   HWMON_C_REGISTER_TZ),
 	HWMON_CHANNEL_INFO(temp,
 			   HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | HWMON_T_ALARM,
 			   HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | HWMON_T_ALARM,

-- 
2.55.0


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

* Re: [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support
  2026-07-28  3:07 [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
                   ` (3 preceding siblings ...)
  2026-07-28  3:07 ` [hwmon-next PATCH v3 4/4] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
@ 2026-07-28  3:21 ` Luiz Angelo Daros de Luca
  2026-07-28  3:52   ` Guenter Roeck
  4 siblings, 1 reply; 9+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-07-28  3:21 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, linux-pwm

It looks like Sashiko had trouble applying the patchset on top of
hwmon-next. I likely should have used a base commit that's available
across other trees, such as linux-next. I'll double-check whether I
misconfigured the prerequisites (it was my first time using them),
though b4 validated everything fine locally.

In any case, I can resend the series without prerequisites once the
necessary hwmon patches sync to hwmon-next.

Regards,

Luiz

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

* Re: [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support
  2026-07-28  3:21 ` [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal " Luiz Angelo Daros de Luca
@ 2026-07-28  3:52   ` Guenter Roeck
  0 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2026-07-28  3:52 UTC (permalink / raw)
  To: Luiz Angelo Daros de Luca, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König
  Cc: linux-hwmon, devicetree, linux-kernel, linux-pwm

On 7/27/26 20:21, Luiz Angelo Daros de Luca wrote:
> It looks like Sashiko had trouble applying the patchset on top of
> hwmon-next. I likely should have used a base commit that's available
> across other trees, such as linux-next. I'll double-check whether I
> misconfigured the prerequisites (it was my first time using them),
> though b4 validated everything fine locally.
> 
I pushed the patch series only into the hwmon branch. I guess Sashiko
doesn't know about that branch. I now rebased hwmon-next on top of hwmon
and pushed it out, so Sashiko should now be able to see the previous
patches.

Guenter


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

* Re: [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470
  2026-07-28  3:07 ` [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470 Luiz Angelo Daros de Luca
@ 2026-07-28  8:14   ` Krzysztof Kozlowski
  2026-07-28  8:19     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-28  8:14 UTC (permalink / raw)
  To: Luiz Angelo Daros de Luca
  Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König, linux-hwmon, devicetree, linux-kernel,
	linux-pwm

On Tue, Jul 28, 2026 at 12:07:09AM -0300, Luiz Angelo Daros de Luca wrote:
> The Analog Devices ADT7470 is a multichannel temperature sensor and
> PWM fan controller. It supports monitoring up to 10 external
> temperature sensors and controlling up to 4 fans.
> 
> Add the device tree binding documentation for it. This includes
> support for the thermal framework by defining the "#thermal-sensor-cells"
> property, and models the fan control lines as PWM channels by
> defining the "#pwm-cells" property.
> 
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
> ---
>  .../devicetree/bindings/hwmon/adi,adt7470.yaml     | 55 ++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml b/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml
> new file mode 100644
> index 000000000000..bb2375a4a490
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwmon/adi,adt7470.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices ADT7470 hwmon sensor
> +
> +maintainers:
> +  - Luiz Angelo Daros de Luca <luizluca@gmail.com>
> +
> +description:
> +  Multi-channel temperature monitor and PWM fan controller.
> +  It supports monitoring up to 10 external temperature sensors and
> +  controlling up to four fans. The fan control lines are modeled
> +  as standard PWM channels.
> +
> +properties:
> +  compatible:
> +    const: adi,adt7470
> +
> +  reg:
> +    maxItems: 1
> +
> +  "#pwm-cells":
> +    const: 3
> +    description:
> +      See Documentation/devicetree/bindings/pwm/pwm.yaml for the
> +      generic PWM binding description.

Drop description.

You OTOH, miss ref to pwm schema. Referencing here in description should
raise you questions... And then use unevaluatedProperties.

> +
> +  "#thermal-sensor-cells":
> +    const: 1
> +    description:
> +      Number of cells required to uniquely identify the temperature sensors.

Drop sentence, you never need to explain standard properties. It only
adds bloat and more places to fix/change if we do any refactoring.

> +      Valid index values are 0 to 9, corresponding to temp1 through temp10.

Only this is needed.

Best regards,
Krzysztof


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

* Re: [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470
  2026-07-28  8:14   ` Krzysztof Kozlowski
@ 2026-07-28  8:19     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-28  8:19 UTC (permalink / raw)
  To: Luiz Angelo Daros de Luca
  Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chris Packham, Andrew Morton, Darrick J. Wong,
	Uwe Kleine-König, linux-hwmon, devicetree, linux-kernel,
	linux-pwm

On 28/07/2026 10:14, Krzysztof Kozlowski wrote:
> On Tue, Jul 28, 2026 at 12:07:09AM -0300, Luiz Angelo Daros de Luca wrote:
>> The Analog Devices ADT7470 is a multichannel temperature sensor and
>> PWM fan controller. It supports monitoring up to 10 external
>> temperature sensors and controlling up to 4 fans.
>>
>> Add the device tree binding documentation for it. This includes
>> support for the thermal framework by defining the "#thermal-sensor-cells"
>> property, and models the fan control lines as PWM channels by
>> defining the "#pwm-cells" property.
>>
>> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
>> ---
>>  .../devicetree/bindings/hwmon/adi,adt7470.yaml     | 55 ++++++++++++++++++++++
>>  1 file changed, 55 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml b/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml
>> new file mode 100644
>> index 000000000000..bb2375a4a490
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/hwmon/adi,adt7470.yaml
>> @@ -0,0 +1,55 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/hwmon/adi,adt7470.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Analog Devices ADT7470 hwmon sensor
>> +
>> +maintainers:
>> +  - Luiz Angelo Daros de Luca <luizluca@gmail.com>
>> +
>> +description:
>> +  Multi-channel temperature monitor and PWM fan controller.
>> +  It supports monitoring up to 10 external temperature sensors and
>> +  controlling up to four fans. The fan control lines are modeled
>> +  as standard PWM channels.
>> +
>> +properties:
>> +  compatible:
>> +    const: adi,adt7470
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  "#pwm-cells":
>> +    const: 3
>> +    description:
>> +      See Documentation/devicetree/bindings/pwm/pwm.yaml for the
>> +      generic PWM binding description.
> 
> Drop description.
> 
> You OTOH, miss ref to pwm schema. Referencing here in description should
> raise you questions... And then use unevaluatedProperties.
> 

You most likely miss ref to thermal-sensor.yaml as well, but that would
change the ABI since hwmon would fail on missing cells, right?

Best regards,
Krzysztof

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

end of thread, other threads:[~2026-07-28  8:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  3:07 [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
2026-07-28  3:07 ` [hwmon-next PATCH v3 1/4] dt-bindings: hwmon: adi,adt7470 Luiz Angelo Daros de Luca
2026-07-28  8:14   ` Krzysztof Kozlowski
2026-07-28  8:19     ` Krzysztof Kozlowski
2026-07-28  3:07 ` [hwmon-next PATCH v3 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
2026-07-28  3:07 ` [hwmon-next PATCH v3 3/4] hwmon: (adt7470) Expose fan control via PWM framework Luiz Angelo Daros de Luca
2026-07-28  3:07 ` [hwmon-next PATCH v3 4/4] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
2026-07-28  3:21 ` [hwmon-next PATCH v3 0/4] hwmon: (adt7470) Add PWM provider and thermal " Luiz Angelo Daros de Luca
2026-07-28  3:52   ` Guenter Roeck

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