Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] hwmon: (adt7462) Support probing via device tree
@ 2026-06-03 11:10 Romain Gantois
  2026-06-03 11:10 ` [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462 Romain Gantois
  2026-06-03 11:10 ` [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree Romain Gantois
  0 siblings, 2 replies; 6+ messages in thread
From: Romain Gantois @ 2026-06-03 11:10 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Kory Maincent
  Cc: Thomas Petazzoni, linux-hwmon, devicetree, linux-kernel,
	Romain Gantois

Hello everyone,

These two patches from my colleague Köry add support for device tree
probing of ADT7462 fan controllers.

Best Regards,

Romain

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
Kory Maincent (2):
      dt-binding: hwmon: Add binding for ADT7462
      hwmon: (adt7462) Add of_match_table to support devicetree

 .../devicetree/bindings/hwmon/adt7462.yaml         | 53 ++++++++++++++++++++++
 drivers/hwmon/adt7462.c                            |  7 +++
 2 files changed, 60 insertions(+)
---
base-commit: ba3e43a9e601636f5edb54e259a74f96ca3b8fd8
change-id: 20260603-adt7462-bindings-5ecf3037040f

Best regards,
--  
Romain Gantois <romain.gantois@bootlin.com>


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

* [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462
  2026-06-03 11:10 [PATCH 0/2] hwmon: (adt7462) Support probing via device tree Romain Gantois
@ 2026-06-03 11:10 ` Romain Gantois
  2026-06-03 11:35   ` sashiko-bot
  2026-06-03 11:10 ` [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree Romain Gantois
  1 sibling, 1 reply; 6+ messages in thread
From: Romain Gantois @ 2026-06-03 11:10 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Kory Maincent
  Cc: Thomas Petazzoni, linux-hwmon, devicetree, linux-kernel,
	Romain Gantois

From: Kory Maincent <kory.maincent@bootlin.com>

Add the ADT7462 hwmon Controller device tree bindings documentation.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
[rgantois: modified SPDX license header]
[rgantois: minor corrections in device description]
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 .../devicetree/bindings/hwmon/adt7462.yaml         | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adt7462.yaml b/Documentation/devicetree/bindings/hwmon/adt7462.yaml
new file mode 100644
index 0000000000000..745a371affd65
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adt7462.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/adt7462.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADT7462 hwmon sensor
+
+maintainers:
+  - Kory Maincent <kory.maincent@bootlin.com>
+
+description: |
+  The ADT7462 is a temperature and voltage monitor and a PWM fan controller.
+
+  It can monitor temperature in up to three remote locations, as well as
+  its ambient temperature.
+  There are up to four PWM outputs to control fans.
+  The ADT7462 supports high frequency PWM for 4-wire fans and low frequency
+  PWM for 2-wire and 3-wire fans. Up to eight TACH inputs can be used to
+  measure the speed of 3-wire and 4-wire fans. There are up to 13 voltage
+  monitoring inputs, ranging from 12 V to 0.9 V.
+
+  Datasheet:
+  https://www.onsemi.com/pdf/datasheet/adt7462-d.pdf
+
+  Description taken from onsemiconductors specification sheets, with minor
+  rephrasing.
+
+properties:
+  compatible:
+    enum:
+      - adi,adt7462
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      hwmon@5c {
+        compatible = "adi,adt7462";
+        reg = <0x5c>;
+      };
+    };

-- 
2.54.0


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

* [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree
  2026-06-03 11:10 [PATCH 0/2] hwmon: (adt7462) Support probing via device tree Romain Gantois
  2026-06-03 11:10 ` [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462 Romain Gantois
@ 2026-06-03 11:10 ` Romain Gantois
  2026-06-03 11:40   ` sashiko-bot
  1 sibling, 1 reply; 6+ messages in thread
From: Romain Gantois @ 2026-06-03 11:10 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Kory Maincent
  Cc: Thomas Petazzoni, linux-hwmon, devicetree, linux-kernel,
	Romain Gantois

From: Kory Maincent <kory.maincent@bootlin.com>

Add of_match_table to add support of devicetree probing.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/hwmon/adt7462.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index 174dfee47f7a7..ef6e5252dc0a4 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -1814,10 +1814,17 @@ static const struct i2c_device_id adt7462_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adt7462_id);
 
+static const struct of_device_id __maybe_unused adt7462_of_match[] = {
+	{ .compatible = "adi,adt7462" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adt7462_of_match);
+
 static struct i2c_driver adt7462_driver = {
 	.class		= I2C_CLASS_HWMON,
 	.driver = {
 		.name	= "adt7462",
+		.of_match_table = of_match_ptr(adt7462_of_match),
 	},
 	.probe		= adt7462_probe,
 	.id_table	= adt7462_id,

-- 
2.54.0


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

* Re: [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462
  2026-06-03 11:10 ` [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462 Romain Gantois
@ 2026-06-03 11:35   ` sashiko-bot
  2026-06-03 12:02     ` Romain Gantois
  0 siblings, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-06-03 11:35 UTC (permalink / raw)
  To: Romain Gantois; +Cc: linux-hwmon, conor+dt, robh, devicetree

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete binding migration: `onnn,adt7462` is not migrated to the new schema and remains in `trivial-devices.yaml`.
--

commit 8e3b73cf675c7a9534a713ae61c15469f85f0d06
Author: Kory Maincent <kory.maincent@bootlin.com>

dt-binding: hwmon: Add binding for ADT7462

This commit adds the ADT7462 hwmon Controller device tree bindings
documentation.

> diff --git a/Documentation/devicetree/bindings/hwmon/adt7462.yaml b/Documentation/devicetree/bindings/hwmon/adt7462.yaml
> new file mode 100644
> index 0000000000000..745a371affd65
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/adt7462.yaml
[ ... ]
> +properties:
> +  compatible:
> +    enum:
> +      - adi,adt7462

[Severity: Medium]
Should the existing onnn,adt7462 compatible string be migrated into this
new schema?

The ADT7462 device is already documented in trivial-devices.yaml under
the compatible string onnn,adt7462, which is actively used in existing
device trees.

By introducing this new schema without including onnn,adt7462 and without
removing it from trivial-devices.yaml, existing device trees will not
benefit from the detailed schema validation. This also leaves the subsystem
with two conflicting, fragmented representations of the same hardware.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-adt7462-bindings-v1-0-301304bcf774@bootlin.com?part=1

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

* Re: [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree
  2026-06-03 11:10 ` [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree Romain Gantois
@ 2026-06-03 11:40   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-06-03 11:40 UTC (permalink / raw)
  To: Romain Gantois; +Cc: robh, conor+dt, linux-hwmon, devicetree

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Using `of_match_ptr()` prevents the driver from being matched via ACPI PRP0001 when `CONFIG_OF` is disabled.
--

commit c2691e00dcd763957c6a2291880ea9079be2bbda
Author: Kory Maincent <kory.maincent@bootlin.com>

hwmon: (adt7462) Add of_match_table to support devicetree

This commit adds an of_match_table to the adt7462 driver to enable
devicetree probing.

> diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
> index 174dfee47f7a7..ef6e5252dc0a4 100644
> --- a/drivers/hwmon/adt7462.c
> +++ b/drivers/hwmon/adt7462.c
[ ... ]
> @@ -1814,10 +1814,17 @@ static const struct i2c_device_id adt7462_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, adt7462_id);
>  
> +static const struct of_device_id __maybe_unused adt7462_of_match[] = {
> +	{ .compatible = "adi,adt7462" },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, adt7462_of_match);
> +
>  static struct i2c_driver adt7462_driver = {
>  	.class		= I2C_CLASS_HWMON,
>  	.driver = {
>  		.name	= "adt7462",
> +		.of_match_table = of_match_ptr(adt7462_of_match),

[Severity: Low]
Does using of_match_ptr() here prevent the driver from being matched via
ACPI PRP0001 when CONFIG_OF is disabled?

When CONFIG_OF is disabled, of_match_ptr() evaluates to NULL, hiding the
of_match_table from the driver core. This prevents the driver from being
matched using ACPI PRP0001, which relies on OF compatible strings even on
systems without Device Tree.

Would it be better to drop of_match_ptr() and assign the table directly,
along with removing the __maybe_unused attribute from adt7462_of_match?

>  	},
>  	.probe		= adt7462_probe,
>  	.id_table	= adt7462_id,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-adt7462-bindings-v1-0-301304bcf774@bootlin.com?part=2

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

* Re: [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462
  2026-06-03 11:35   ` sashiko-bot
@ 2026-06-03 12:02     ` Romain Gantois
  0 siblings, 0 replies; 6+ messages in thread
From: Romain Gantois @ 2026-06-03 12:02 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: linux-hwmon, conor+dt, robh, devicetree

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

On Wednesday, 3 June 2026 13:35:25 CEST sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider: - [Medium] Incomplete binding migration:
> `onnn,adt7462` is not migrated to the new schema and remains in
> `trivial-devices.yaml`. --
> 
> commit 8e3b73cf675c7a9534a713ae61c15469f85f0d06
> Author: Kory Maincent <kory.maincent@bootlin.com>
> 
> dt-binding: hwmon: Add binding for ADT7462
> 
> This commit adds the ADT7462 hwmon Controller device tree bindings
> documentation.
> 
> > diff --git a/Documentation/devicetree/bindings/hwmon/adt7462.yaml
> > b/Documentation/devicetree/bindings/hwmon/adt7462.yaml new file mode
> > 100644
> > index 0000000000000..745a371affd65
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/adt7462.yaml
> 
> [ ... ]
> 
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,adt7462
> 
> [Severity: Medium]
> Should the existing onnn,adt7462 compatible string be migrated into this
> new schema?
> 
> The ADT7462 device is already documented in trivial-devices.yaml under
> the compatible string onnn,adt7462, which is actively used in existing
> device trees.
> 
> By introducing this new schema without including onnn,adt7462 and without
> removing it from trivial-devices.yaml, existing device trees will not
> benefit from the detailed schema validation. This also leaves the subsystem
> with two conflicting, fragmented representations of the same hardware.

I've just done a bit of research and it looks like this component is now 
commercialized by Onsemi, so the existing compatible would be the correct one.

Furthermore, the suggested binding only has a "reg" property and a 
"compatible" property, so it seems like the trivial-devices binding is enough 
to describe it for now.

I'll drop patch 1/2 in version 2.

Thanks,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 11:10 [PATCH 0/2] hwmon: (adt7462) Support probing via device tree Romain Gantois
2026-06-03 11:10 ` [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462 Romain Gantois
2026-06-03 11:35   ` sashiko-bot
2026-06-03 12:02     ` Romain Gantois
2026-06-03 11:10 ` [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree Romain Gantois
2026-06-03 11:40   ` sashiko-bot

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