* [PATCH 0/2] Add support for MAX20830 PMBUS
@ 2026-04-14 4:28 Alexis Czezar Torreno
2026-04-14 4:28 ` [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 Alexis Czezar Torreno
2026-04-14 4:28 ` [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 Alexis Czezar Torreno
0 siblings, 2 replies; 15+ messages in thread
From: Alexis Czezar Torreno @ 2026-04-14 4:28 UTC (permalink / raw)
To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jonathan Corbet, Shuah Khan
Cc: linux-hwmon, devicetree, linux-kernel, linux-doc,
Alexis Czezar Torreno
This series adds support for the Analog Devices MAX20830 step-down
switching regulator with PMBus interface.
The MAX20830 provides 2.7V to 16V input, 0.4V to 5.8V output, and up
to 30A output current. It supports monitoring of input/output voltage,
output current, and temperature via PMBus.
Datasheet: https://www.analog.com/en/products/max20830.html
Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
---
Alexis Czezar Torreno (2):
dt-bindings: hwmon: pmbus: add max20830
hwmon: (pmbus/max20830) add driver for max20830
.../bindings/hwmon/pmbus/adi,max20830.yaml | 58 +++++++++++++++++
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/max20830.rst | 48 ++++++++++++++
MAINTAINERS | 9 +++
drivers/hwmon/pmbus/Kconfig | 9 +++
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/max20830.c | 74 ++++++++++++++++++++++
7 files changed, 200 insertions(+)
---
base-commit: fb447217c59a13b2fff22d94de2498c185cd9032
change-id: 20260414-dev_max20830-9460b92cf6aa
Best regards,
--
Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 2026-04-14 4:28 [PATCH 0/2] Add support for MAX20830 PMBUS Alexis Czezar Torreno @ 2026-04-14 4:28 ` Alexis Czezar Torreno 2026-04-14 4:38 ` sashiko-bot 2026-04-14 4:28 ` [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 Alexis Czezar Torreno 1 sibling, 1 reply; 15+ messages in thread From: Alexis Czezar Torreno @ 2026-04-14 4:28 UTC (permalink / raw) To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan Cc: linux-hwmon, devicetree, linux-kernel, linux-doc, Alexis Czezar Torreno Add device tree documentation for MAX20830 step-down DC-DC switching regulator with PMBus interface. Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> --- .../bindings/hwmon/pmbus/adi,max20830.yaml | 58 ++++++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 65 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b20f3be176615895e70e74bfb2a534d82d124a15 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/pmbus/adi,max20830.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices MAX20830 Step-Down Switching Regulator with PMBus + +maintainers: + - Alexis Czezar Torreno <alexisczezar.torreno@analog.com> + +description: | + The MAX20830 is a fully integrated step-down DC-DC switching regulator with + PMBus interface. It provides 2.7V to 16V input, 0.4V to 5.8V adjustable + output, and up to 30A output current. It allows monitoring of input/output + voltage, output current and temperature through the PMBus serial interface. + Datasheet: + https://www.analog.com/en/products/max20830.html + +properties: + compatible: + const: adi,max20830 + + reg: + maxItems: 1 + + vddh-supply: + description: + Phandle to the regulator that provides the VDDH power supply. + + avdd-supply: + description: + Phandle to the regulator that provides the AVDD power supply. + + ldoin-supply: + description: + Optional 2.5V to 5.5V LDO input supply. + +required: + - compatible + - reg + - vddh-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + hwmon@30 { + compatible = "adi,max20830"; + reg = <0x30>; + vddh-supply = <&vddh>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index 0a3991c10ade20dd79cc7d1bf2a1d307ba6bd19d..031c743e979521a92ed9ac67915c178ce31727bd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15579,6 +15579,13 @@ F: Documentation/devicetree/bindings/hwmon/pmbus/adi,max17616.yaml F: Documentation/hwmon/max17616.rst F: drivers/hwmon/pmbus/max17616.c +MAX20830 HARDWARE MONITOR DRIVER +M: Alexis Czezar Torreno <alexisczezar.torreno@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,max20830.yaml + MAX2175 SDR TUNER DRIVER M: Ramesh Shanmugasundaram <rashanmu@gmail.com> L: linux-media@vger.kernel.org -- 2.34.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 2026-04-14 4:28 ` [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 Alexis Czezar Torreno @ 2026-04-14 4:38 ` sashiko-bot 2026-04-16 9:25 ` Krzysztof Kozlowski 0 siblings, 1 reply; 15+ messages in thread From: sashiko-bot @ 2026-04-14 4:38 UTC (permalink / raw) To: Alexis Czezar Torreno; +Cc: linux-hwmon Sashiko AI review found 3 potential issue(s): - [Medium] Incomplete Regulator Schema - [Medium] Missing Hardware Capability (Interrupts) - [Low] Devicetree Best Practices Violation (Node Name) -- commit 20a4d8dcd2f3344ac22d7d2e974bae1ef57874ed Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> dt-bindings: hwmon: pmbus: add max20830 This commit adds device tree documentation for the MAX20830 step-down DC-DC switching regulator with PMBus interface. It allows monitoring of voltage, current, and temperature. > diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml > new file mode 100644 > index 0000000000000..b20f3be176615 > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml [ ... ] > +properties: > + compatible: > + const: adi,max20830 > + > + reg: > + maxItems: 1 > + Since this is a PMBus device that typically signals hardware faults to the host via the standard SMBALERT# pin, should the schema define the optional interrupts property? > + vddh-supply: > + description: > + Phandle to the regulator that provides the VDDH power supply. [ ... ] > +required: > + - compatible > + - reg > + - vddh-supply > + > +additionalProperties: false The commit message explicitly states the MAX20830 is a step-down DC-DC switching regulator with an adjustable output, but the schema omits any reference to the core regulator schema or a regulators child node. Because additionalProperties is set to false, does this prevent board designers from describing the hardware's standard output constraints, such as regulator-min-microvolt or regulator-max-microvolt, without causing a schema validation error? > + > +examples: > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + hwmon@30 { This isn't a bug, but the device node name in the example uses a Linux subsystem name. Should it use a generic functional name representing the hardware, such as regulator@30 or power-sensor@30? > + compatible = "adi,max20830"; > + reg = <0x30>; > + vddh-supply = <&vddh>; > + }; > + }; > +... -- Sashiko AI review · https://sashiko.dev/#/patchset/20260414-dev_max20830-v1-0-210d3f82c571@analog.com?part=1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 2026-04-14 4:38 ` sashiko-bot @ 2026-04-16 9:25 ` Krzysztof Kozlowski 2026-04-16 17:45 ` Roman Gushchin 0 siblings, 1 reply; 15+ messages in thread From: Krzysztof Kozlowski @ 2026-04-16 9:25 UTC (permalink / raw) To: sashiko; +Cc: Alexis Czezar Torreno, linux-hwmon On Tue, Apr 14, 2026 at 04:38:40AM +0000, sashiko-bot@kernel.org wrote: > Sashiko AI review found 3 potential issue(s): > - [Medium] Incomplete Regulator Schema > - [Medium] Missing Hardware Capability (Interrupts) > - [Low] Devicetree Best Practices Violation (Node Name) > -- > > commit 20a4d8dcd2f3344ac22d7d2e974bae1ef57874ed > Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> > > dt-bindings: hwmon: pmbus: add max20830 > > This commit adds device tree documentation for the MAX20830 step-down DC-DC > switching regulator with PMBus interface. It allows monitoring of voltage, > current, and temperature. Sashiko devs, Can we drop such comments? They are useless - we know what the commit is doing, no point for reviewing tool to say it again. Please send only useful feedback to mailing list, otherwise this will be just noise and going to be ignored. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 2026-04-16 9:25 ` Krzysztof Kozlowski @ 2026-04-16 17:45 ` Roman Gushchin 2026-04-16 18:09 ` Guenter Roeck 0 siblings, 1 reply; 15+ messages in thread From: Roman Gushchin @ 2026-04-16 17:45 UTC (permalink / raw) To: Krzysztof Kozlowski; +Cc: sashiko, Alexis Czezar Torreno, linux-hwmon Krzysztof Kozlowski <krzk@kernel.org> writes: > On Tue, Apr 14, 2026 at 04:38:40AM +0000, sashiko-bot@kernel.org wrote: >> Sashiko AI review found 3 potential issue(s): >> - [Medium] Incomplete Regulator Schema >> - [Medium] Missing Hardware Capability (Interrupts) >> - [Low] Devicetree Best Practices Violation (Node Name) >> -- >> >> commit 20a4d8dcd2f3344ac22d7d2e974bae1ef57874ed >> Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> >> >> dt-bindings: hwmon: pmbus: add max20830 >> >> This commit adds device tree documentation for the MAX20830 step-down DC-DC >> switching regulator with PMBus interface. It allows monitoring of voltage, >> current, and temperature. > > Sashiko devs, > Can we drop such comments? They are useless - we know what the commit is > doing, no point for reviewing tool to say it again. It's the format which originated from initial Chris Mason's prompts and as *I understand* it's purpose was to make sure the llm is reviewing the right patch and more or less understands it. Idk if we still need this, but at least some find it useful: e.g. https://github.com/sashiko-dev/sashiko/issues/90 . I'm planning to do it configurable in UI, but for emails I can only make it configurable on per-subsystem basis. If there is a consensus amongst hwmon maintainers, I'm happy to remove it for hwmon (in several days). > > Please send only useful feedback to mailing list, otherwise this will be > just noise and going to be ignored. Agree, but there are many sometimes conflicting opinions on what's useful and what's not. So I'm trying to make it as flexible and configurable as possible. Thanks ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 2026-04-16 17:45 ` Roman Gushchin @ 2026-04-16 18:09 ` Guenter Roeck 2026-04-20 11:20 ` Krzysztof Kozlowski 0 siblings, 1 reply; 15+ messages in thread From: Guenter Roeck @ 2026-04-16 18:09 UTC (permalink / raw) To: Roman Gushchin Cc: Krzysztof Kozlowski, sashiko, Alexis Czezar Torreno, linux-hwmon On Thu, Apr 16, 2026 at 05:45:52PM +0000, Roman Gushchin wrote: > Krzysztof Kozlowski <krzk@kernel.org> writes: > > > On Tue, Apr 14, 2026 at 04:38:40AM +0000, sashiko-bot@kernel.org wrote: > >> Sashiko AI review found 3 potential issue(s): > >> - [Medium] Incomplete Regulator Schema > >> - [Medium] Missing Hardware Capability (Interrupts) > >> - [Low] Devicetree Best Practices Violation (Node Name) > >> -- > >> > >> commit 20a4d8dcd2f3344ac22d7d2e974bae1ef57874ed > >> Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> > >> > >> dt-bindings: hwmon: pmbus: add max20830 > >> > >> This commit adds device tree documentation for the MAX20830 step-down DC-DC > >> switching regulator with PMBus interface. It allows monitoring of voltage, > >> current, and temperature. > > > > Sashiko devs, > > Can we drop such comments? They are useless - we know what the commit is > > doing, no point for reviewing tool to say it again. > > It's the format which originated from initial Chris Mason's prompts > and as *I understand* it's purpose was to make sure the llm is reviewing > the right patch and more or less understands it. Idk if we still need > this, but at least some find it useful: e.g. > https://github.com/sashiko-dev/sashiko/issues/90 . > > I'm planning to do it configurable in UI, but for emails I can > only make it configurable on per-subsystem basis. > If there is a consensus amongst hwmon maintainers, I'm happy to remove > it for hwmon (in several days). I find it useful. Please don't take it out. Maybe there is a means to drop it from devicetree patches if that is what devicetree maintainers want. Fine with me to drop it for those, or to drop devicetree feedback entirely if that is what devicetree maintainers want and if it is possible to separate devicetree patches submitted as part of a hwmon series from the actual code patches. Thanks, Guenter > > > > > Please send only useful feedback to mailing list, otherwise this will be > > just noise and going to be ignored. > > Agree, but there are many sometimes conflicting opinions on what's > useful and what's not. So I'm trying to make it as flexible and > configurable as possible. > > Thanks > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 2026-04-16 18:09 ` Guenter Roeck @ 2026-04-20 11:20 ` Krzysztof Kozlowski 0 siblings, 0 replies; 15+ messages in thread From: Krzysztof Kozlowski @ 2026-04-20 11:20 UTC (permalink / raw) To: Guenter Roeck, Roman Gushchin; +Cc: sashiko, Alexis Czezar Torreno, linux-hwmon On 16/04/2026 20:09, Guenter Roeck wrote: > On Thu, Apr 16, 2026 at 05:45:52PM +0000, Roman Gushchin wrote: >> Krzysztof Kozlowski <krzk@kernel.org> writes: >> >>> On Tue, Apr 14, 2026 at 04:38:40AM +0000, sashiko-bot@kernel.org wrote: >>>> Sashiko AI review found 3 potential issue(s): >>>> - [Medium] Incomplete Regulator Schema >>>> - [Medium] Missing Hardware Capability (Interrupts) >>>> - [Low] Devicetree Best Practices Violation (Node Name) >>>> -- >>>> >>>> commit 20a4d8dcd2f3344ac22d7d2e974bae1ef57874ed >>>> Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> >>>> >>>> dt-bindings: hwmon: pmbus: add max20830 >>>> >>>> This commit adds device tree documentation for the MAX20830 step-down DC-DC >>>> switching regulator with PMBus interface. It allows monitoring of voltage, >>>> current, and temperature. >>> >>> Sashiko devs, >>> Can we drop such comments? They are useless - we know what the commit is >>> doing, no point for reviewing tool to say it again. >> >> It's the format which originated from initial Chris Mason's prompts >> and as *I understand* it's purpose was to make sure the llm is reviewing >> the right patch and more or less understands it. Idk if we still need >> this, but at least some find it useful: e.g. >> https://github.com/sashiko-dev/sashiko/issues/90 . >> >> I'm planning to do it configurable in UI, but for emails I can >> only make it configurable on per-subsystem basis. >> If there is a consensus amongst hwmon maintainers, I'm happy to remove >> it for hwmon (in several days). > > I find it useful. Please don't take it out. Maybe there is a means to drop > it from devicetree patches if that is what devicetree maintainers want. Fine > with me to drop it for those, or to drop devicetree feedback entirely if > that is what devicetree maintainers want and if it is possible to separate > devicetree patches submitted as part of a hwmon series from the actual code > patches. > If there are folks who want them, then it's fine, don't make exception just for me. I can skip first paragraphs by default :) Best regards, Krzysztof ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-14 4:28 [PATCH 0/2] Add support for MAX20830 PMBUS Alexis Czezar Torreno 2026-04-14 4:28 ` [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 Alexis Czezar Torreno @ 2026-04-14 4:28 ` Alexis Czezar Torreno 2026-04-14 4:56 ` sashiko-bot 1 sibling, 1 reply; 15+ messages in thread From: Alexis Czezar Torreno @ 2026-04-14 4:28 UTC (permalink / raw) To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan Cc: linux-hwmon, devicetree, linux-kernel, linux-doc, Alexis Czezar Torreno Add support for MAX20830 step-down DC-DC switching regulator with PMBus interface. It allows monitoring of input/output voltage, output current and temperature through the PMBus serial interface. Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> --- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/max20830.rst | 48 ++++++++++++++++++++++++++ MAINTAINERS | 2 ++ drivers/hwmon/pmbus/Kconfig | 9 +++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/max20830.c | 74 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 135 insertions(+) diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index 8b655e5d6b68b90c697a52c7bf526e81d370caf7..56f7eb761be76dd627a2f34135abad05203b0582 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -158,6 +158,7 @@ Hardware Monitoring Kernel Drivers max197 max20730 max20751 + max20830 max31722 max31730 max31760 diff --git a/Documentation/hwmon/max20830.rst b/Documentation/hwmon/max20830.rst new file mode 100644 index 0000000000000000000000000000000000000000..b9dffb76059781932d383ed798cecff69e738873 --- /dev/null +++ b/Documentation/hwmon/max20830.rst @@ -0,0 +1,48 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver max20830 +====================== + +Supported chips: + + * Analog Devices MAX20830 + + Prefix: 'max20830' + + Addresses scanned: - + + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max20830.pdf + +Author: + + - Alexis Czezar Torreno <alexisczezar.torreno@analog.com> + + +Description +----------- + +This driver supports hardware monitoring for Analog Devices MAX20830 +Step-Down Switching Regulator with PMBus Interface. + +The MAX20830 is a 2.7V to 16V, 30A fully integrated step-down DC-DC switching +regulator. Through the PMBus interface, the device can monitor input/output +voltages, output current and temperature. + +The driver is a client driver to the core PMBus driver. Please see +Documentation/hwmon/pmbus.rst for details on PMBus client drivers. + +Sysfs entries +------------- + +================= ======================================== +in1_label "vin" +in1_input Measured input voltage +in1_alarm Input voltage alarm +in2_label "vout1" +in2_input Measured output voltage +curr1_label "iout1" +curr1_input Measured output current +curr1_alarm Output current alarm +temp1_input Measured temperature +temp1_alarm Chip temperature alarm +================= ======================================== diff --git a/MAINTAINERS b/MAINTAINERS index 031c743e979521a92ed9ac67915c178ce31727bd..d6a6745e2dae29c3b8f80bbe61c54a2f5ecd9f47 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15585,6 +15585,8 @@ L: linux-hwmon@vger.kernel.org S: Supported W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml +F: Documentation/hwmon/max20830.rst +F: drivers/hwmon/pmbus/max20830.c MAX2175 SDR TUNER DRIVER M: Ramesh Shanmugasundaram <rashanmu@gmail.com> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 8f4bff375ecbc355f5ed3400855c2852ec2aa5ef..987705bf45b75b7b91ccc469247909f3c3f53d77 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -365,6 +365,15 @@ config SENSORS_MAX20751 This driver can also be built as a module. If so, the module will be called max20751. +config SENSORS_MAX20830 + tristate "Analog Devices MAX20830" + help + If you say yes here you get hardware monitoring support for Analog + Devices MAX20830. + + This driver can also be built as a module. If so, the module will + be called max20830. + config SENSORS_MAX31785 tristate "Maxim MAX31785 and compatibles" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 7129b62bc00f8a2e98de14004997752a856dfda2..bc52f930e0825a902a0dd1c9e2b44f2e8d577c35 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -36,6 +36,7 @@ obj-$(CONFIG_SENSORS_MAX16601) += max16601.o obj-$(CONFIG_SENSORS_MAX17616) += max17616.o obj-$(CONFIG_SENSORS_MAX20730) += max20730.o obj-$(CONFIG_SENSORS_MAX20751) += max20751.o +obj-$(CONFIG_SENSORS_MAX20830) += max20830.o obj-$(CONFIG_SENSORS_MAX31785) += max31785.o obj-$(CONFIG_SENSORS_MAX34440) += max34440.o obj-$(CONFIG_SENSORS_MAX8688) += max8688.o diff --git a/drivers/hwmon/pmbus/max20830.c b/drivers/hwmon/pmbus/max20830.c new file mode 100644 index 0000000000000000000000000000000000000000..bcf60fd948e3437f47267747547142704ae96378 --- /dev/null +++ b/drivers/hwmon/pmbus/max20830.c @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Hardware monitoring driver for Analog Devices MAX20830 + * + * Copyright (C) 2026 Analog Devices, Inc. + */ + +#include <linux/i2c.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include "pmbus.h" + +static struct pmbus_driver_info max20830_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_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT | + PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP, +}; + +static int max20830_probe(struct i2c_client *client) +{ + u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; + int ret; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) + return -ENODEV; + + ret = i2c_smbus_read_i2c_block_data(client, PMBUS_IC_DEVICE_ID, + I2C_SMBUS_BLOCK_MAX, buf); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to read IC_DEVICE_ID\n"); + + buf[ret] = '\0'; + if (ret < 9 || strncmp(buf + 1, "MAX20830", 8)) + return dev_err_probe(&client->dev, -ENODEV, + "Unsupported device: '%s'\n", buf); + + return pmbus_do_probe(client, &max20830_info); +} + +static const struct i2c_device_id max20830_id[] = { + {"max20830"}, + { } +}; +MODULE_DEVICE_TABLE(i2c, max20830_id); + +static const struct of_device_id max20830_of_match[] = { + { .compatible = "adi,max20830" }, + { } +}; +MODULE_DEVICE_TABLE(of, max20830_of_match); + +static struct i2c_driver max20830_driver = { + .driver = { + .name = "max20830", + .of_match_table = max20830_of_match, + }, + .probe = max20830_probe, + .id_table = max20830_id, +}; + +module_i2c_driver(max20830_driver); + +MODULE_AUTHOR("Alexis Czezar Torreno <alexisczezar.torreno@analog.com>"); +MODULE_DESCRIPTION("PMBus driver for Analog Devices MAX20830"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(PMBUS); -- 2.34.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-14 4:28 ` [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 Alexis Czezar Torreno @ 2026-04-14 4:56 ` sashiko-bot 2026-04-14 14:54 ` Guenter Roeck 0 siblings, 1 reply; 15+ messages in thread From: sashiko-bot @ 2026-04-14 4:56 UTC (permalink / raw) To: Alexis Czezar Torreno; +Cc: linux-hwmon Sashiko AI review found 3 potential issue(s): - [Medium] The driver incorrectly uses `i2c_smbus_read_i2c_block_data` instead of `i2c_smbus_read_block_data`, violating the protocol and logging an untrusted binary buffer. - [Low] The MODULE_IMPORT_NS macro uses an unquoted identifier, resulting in a build failure. - [Low] The sysfs attribute `in2_alarm` is created but not documented. -- commit 62ed9b8ac37c74adac303a0ebaea8df41fde6a85 Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> hwmon: (pmbus/max20830) add driver for max20830 This commit adds support for the Analog Devices MAX20830 step-down DC-DC switching regulator. It provides a PMBus client driver to monitor input and output voltages, output current, and temperature. > diff --git a/Documentation/hwmon/max20830.rst b/Documentation/hwmon/max20830.rst > new file mode 100644 > index 0000000000000..b9dffb7605978 > --- /dev/null > +++ b/Documentation/hwmon/max20830.rst [ ... ] > +================= ======================================== > +in1_label "vin" > +in1_input Measured input voltage > +in1_alarm Input voltage alarm > +in2_label "vout1" > +in2_input Measured output voltage This isn't a bug, but since the driver configuration enables PMBUS_HAVE_STATUS_VOUT, it will expose the in2_alarm attribute. Should in2_alarm be documented here alongside the other alarms? > +curr1_label "iout1" > +curr1_input Measured output current > +curr1_alarm Output current alarm > +temp1_input Measured temperature > +temp1_alarm Chip temperature alarm > +================= ======================================== > diff --git a/drivers/hwmon/pmbus/max20830.c b/drivers/hwmon/pmbus/max20830.c > new file mode 100644 > index 0000000000000..bcf60fd948e34 > --- /dev/null > +++ b/drivers/hwmon/pmbus/max20830.c [ ... ] > +static int max20830_probe(struct i2c_client *client) > +{ > + u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; > + int ret; > + > + if (!i2c_check_functionality(client->adapter, > + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) > + return -ENODEV; > + > + ret = i2c_smbus_read_i2c_block_data(client, PMBUS_IC_DEVICE_ID, > + I2C_SMBUS_BLOCK_MAX, buf); Should this use i2c_smbus_read_block_data() instead? PMBus IC_DEVICE_ID is an SMBus Block Read command, which natively returns a length byte followed by the data. Using the I2C block read API with a hardcoded length of 32 forces an over-read and captures the raw SMBus length byte in buf[0]. > + if (ret < 0) > + return dev_err_probe(&client->dev, ret, > + "Failed to read IC_DEVICE_ID\n"); > + > + buf[ret] = '\0'; > + if (ret < 9 || strncmp(buf + 1, "MAX20830", 8)) > + return dev_err_probe(&client->dev, -ENODEV, > + "Unsupported device: '%s'\n", buf); If the device is unsupported, will logging the buffer via %s print unprintable characters? Since buf[0] contains the raw length byte from the block read, this could inject control characters and trailing binary padding into the kernel log. [ ... ] > +MODULE_AUTHOR("Alexis Czezar Torreno <alexisczezar.torreno@analog.com>"); > +MODULE_DESCRIPTION("PMBus driver for Analog Devices MAX20830"); > +MODULE_LICENSE("GPL"); > +MODULE_IMPORT_NS(PMBUS); Will this cause a build failure? The MODULE_IMPORT_NS macro expects a string literal. Should PMBUS be enclosed in quotes, like MODULE_IMPORT_NS("PMBUS")? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260414-dev_max20830-v1-0-210d3f82c571@analog.com?part=2 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-14 4:56 ` sashiko-bot @ 2026-04-14 14:54 ` Guenter Roeck 2026-04-15 2:21 ` Torreno, Alexis Czezar 0 siblings, 1 reply; 15+ messages in thread From: Guenter Roeck @ 2026-04-14 14:54 UTC (permalink / raw) To: sashiko, Alexis Czezar Torreno; +Cc: linux-hwmon On 4/13/26 21:56, sashiko-bot@kernel.org wrote: > Sashiko AI review found 3 potential issue(s): > - [Medium] The driver incorrectly uses `i2c_smbus_read_i2c_block_data` instead of `i2c_smbus_read_block_data`, violating the protocol and logging an untrusted binary buffer. > - [Low] The MODULE_IMPORT_NS macro uses an unquoted identifier, resulting in a build failure. > - [Low] The sysfs attribute `in2_alarm` is created but not documented. > -- > The reported issues seem real. Please address. Thanks, Guenter > commit 62ed9b8ac37c74adac303a0ebaea8df41fde6a85 > Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> > > hwmon: (pmbus/max20830) add driver for max20830 > > This commit adds support for the Analog Devices MAX20830 step-down DC-DC > switching regulator. It provides a PMBus client driver to monitor input and > output voltages, output current, and temperature. > >> diff --git a/Documentation/hwmon/max20830.rst b/Documentation/hwmon/max20830.rst >> new file mode 100644 >> index 0000000000000..b9dffb7605978 >> --- /dev/null >> +++ b/Documentation/hwmon/max20830.rst > [ ... ] >> +================= ======================================== >> +in1_label "vin" >> +in1_input Measured input voltage >> +in1_alarm Input voltage alarm >> +in2_label "vout1" >> +in2_input Measured output voltage > > This isn't a bug, but since the driver configuration enables > PMBUS_HAVE_STATUS_VOUT, it will expose the in2_alarm attribute. Should > in2_alarm be documented here alongside the other alarms? > >> +curr1_label "iout1" >> +curr1_input Measured output current >> +curr1_alarm Output current alarm >> +temp1_input Measured temperature >> +temp1_alarm Chip temperature alarm >> +================= ======================================== > >> diff --git a/drivers/hwmon/pmbus/max20830.c b/drivers/hwmon/pmbus/max20830.c >> new file mode 100644 >> index 0000000000000..bcf60fd948e34 >> --- /dev/null >> +++ b/drivers/hwmon/pmbus/max20830.c > [ ... ] >> +static int max20830_probe(struct i2c_client *client) >> +{ >> + u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; >> + int ret; >> + >> + if (!i2c_check_functionality(client->adapter, >> + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) >> + return -ENODEV; >> + >> + ret = i2c_smbus_read_i2c_block_data(client, PMBUS_IC_DEVICE_ID, >> + I2C_SMBUS_BLOCK_MAX, buf); > > Should this use i2c_smbus_read_block_data() instead? > > PMBus IC_DEVICE_ID is an SMBus Block Read command, which natively returns a > length byte followed by the data. Using the I2C block read API with a > hardcoded length of 32 forces an over-read and captures the raw SMBus length > byte in buf[0]. > >> + if (ret < 0) >> + return dev_err_probe(&client->dev, ret, >> + "Failed to read IC_DEVICE_ID\n"); >> + >> + buf[ret] = '\0'; >> + if (ret < 9 || strncmp(buf + 1, "MAX20830", 8)) >> + return dev_err_probe(&client->dev, -ENODEV, >> + "Unsupported device: '%s'\n", buf); > > If the device is unsupported, will logging the buffer via %s print unprintable > characters? > > Since buf[0] contains the raw length byte from the block read, this could > inject control characters and trailing binary padding into the kernel log. > > [ ... ] >> +MODULE_AUTHOR("Alexis Czezar Torreno <alexisczezar.torreno@analog.com>"); >> +MODULE_DESCRIPTION("PMBus driver for Analog Devices MAX20830"); >> +MODULE_LICENSE("GPL"); >> +MODULE_IMPORT_NS(PMBUS); > > Will this cause a build failure? > > The MODULE_IMPORT_NS macro expects a string literal. Should PMBUS be enclosed > in quotes, like MODULE_IMPORT_NS("PMBUS")? > ^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-14 14:54 ` Guenter Roeck @ 2026-04-15 2:21 ` Torreno, Alexis Czezar 2026-04-15 3:02 ` Guenter Roeck 0 siblings, 1 reply; 15+ messages in thread From: Torreno, Alexis Czezar @ 2026-04-15 2:21 UTC (permalink / raw) To: Guenter Roeck, sashiko@lists.linux.dev; +Cc: linux-hwmon@vger.kernel.org > On 4/13/26 21:56, sashiko-bot@kernel.org wrote: > > Sashiko AI review found 3 potential issue(s): > > - [Medium] The driver incorrectly uses `i2c_smbus_read_i2c_block_data` > instead of `i2c_smbus_read_block_data`, violating the protocol and logging an > untrusted binary buffer. > > - [Low] The MODULE_IMPORT_NS macro uses an unquoted identifier, > resulting in a build failure. > > - [Low] The sysfs attribute `in2_alarm` is created but not documented. > > -- > > > > The reported issues seem real. Please address. > Will fix the missing in2_alarm and lacking quotes in MODULE_IMPORT_NS macro I may need to keep i2c_smbus_read_i2c_block_data. I'm testing this on an rpi4 and it seems i2c_smbus_read_block_data isn't supported by the adapter. Regards, Alexis ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-15 2:21 ` Torreno, Alexis Czezar @ 2026-04-15 3:02 ` Guenter Roeck 2026-04-15 4:27 ` Torreno, Alexis Czezar 2026-04-16 3:04 ` Torreno, Alexis Czezar 0 siblings, 2 replies; 15+ messages in thread From: Guenter Roeck @ 2026-04-15 3:02 UTC (permalink / raw) To: Torreno, Alexis Czezar, sashiko@lists.linux.dev Cc: linux-hwmon@vger.kernel.org Hi, On 4/14/26 19:21, Torreno, Alexis Czezar wrote: >> On 4/13/26 21:56, sashiko-bot@kernel.org wrote: >>> Sashiko AI review found 3 potential issue(s): >>> - [Medium] The driver incorrectly uses `i2c_smbus_read_i2c_block_data` >> instead of `i2c_smbus_read_block_data`, violating the protocol and logging an >> untrusted binary buffer. >>> - [Low] The MODULE_IMPORT_NS macro uses an unquoted identifier, >> resulting in a build failure. >>> - [Low] The sysfs attribute `in2_alarm` is created but not documented. >>> -- >>> >> >> The reported issues seem real. Please address. >> > > Will fix the missing in2_alarm and lacking quotes in MODULE_IMPORT_NS macro > > I may need to keep i2c_smbus_read_i2c_block_data. I'm testing this on an rpi4 and > it seems i2c_smbus_read_block_data isn't supported by the adapter. > Odd. I can see that the bcm2835 controller driver sets I2C_FUNC_SMBUS_EMUL but not I2C_FUNC_SMBUS_BLOCK_DATA. That makes me wonder if the controller really does not support block reads. Any chance you can try setting that flag in ./drivers/i2c/busses/i2c-bcm2835.c and see what happens ? Thanks, Guenter ^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-15 3:02 ` Guenter Roeck @ 2026-04-15 4:27 ` Torreno, Alexis Czezar 2026-04-16 3:04 ` Torreno, Alexis Czezar 1 sibling, 0 replies; 15+ messages in thread From: Torreno, Alexis Czezar @ 2026-04-15 4:27 UTC (permalink / raw) To: Guenter Roeck, sashiko@lists.linux.dev; +Cc: linux-hwmon@vger.kernel.org > >>> Sashiko AI review found 3 potential issue(s): > >>> - [Medium] The driver incorrectly uses > >>> `i2c_smbus_read_i2c_block_data` > >> instead of `i2c_smbus_read_block_data`, violating the protocol and > >> logging an untrusted binary buffer. > >>> - [Low] The MODULE_IMPORT_NS macro uses an unquoted identifier, > >> resulting in a build failure. > >>> - [Low] The sysfs attribute `in2_alarm` is created but not documented. > >>> -- > >>> > >> > >> The reported issues seem real. Please address. > >> > > > > Will fix the missing in2_alarm and lacking quotes in MODULE_IMPORT_NS > > macro > > > > I may need to keep i2c_smbus_read_i2c_block_data. I'm testing this on > > an rpi4 and it seems i2c_smbus_read_block_data isn't supported by the > adapter. > > > > Odd. I can see that the bcm2835 controller driver sets > I2C_FUNC_SMBUS_EMUL but not I2C_FUNC_SMBUS_BLOCK_DATA. That > makes me wonder if the controller really does not support block reads. Any > chance you can try setting that flag in ./drivers/i2c/busses/i2c-bcm2835.c and > see what happens ? > Sure, let me try this soon and get back to you on the results. ^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-15 3:02 ` Guenter Roeck 2026-04-15 4:27 ` Torreno, Alexis Czezar @ 2026-04-16 3:04 ` Torreno, Alexis Czezar 2026-04-16 4:49 ` Guenter Roeck 1 sibling, 1 reply; 15+ messages in thread From: Torreno, Alexis Czezar @ 2026-04-16 3:04 UTC (permalink / raw) To: Guenter Roeck, sashiko@lists.linux.dev; +Cc: linux-hwmon@vger.kernel.org > > > > I may need to keep i2c_smbus_read_i2c_block_data. I'm testing this on > > an rpi4 and it seems i2c_smbus_read_block_data isn't supported by the > adapter. > > > > Odd. I can see that the bcm2835 controller driver sets > I2C_FUNC_SMBUS_EMUL but not I2C_FUNC_SMBUS_BLOCK_DATA. That > makes me wonder if the controller really does not support block reads. Any > chance you can try setting that flag in ./drivers/i2c/busses/i2c-bcm2835.c and > see what happens ? > I tried using i2c_smbus_read_block_data, and here's some log messages [ 6857.261998] max20830: adapter does NOT support I2C_FUNC_SMBUS_BLOCK_DATA [ 6857.262006] max20830: adapter supports I2C_FUNC_SMBUS_READ_I2C_BLOCK [ 6857.265228] max20830: i2c_block_data read 32 bytes: ' MAX20830' [ 6857.265648] max20830: smbus_block_data read 9 bytes: '' i2c_smbus_read_i2c_block_data returns 32 for 32 bytes read and the buffer content is expected "MAX20830" i2c_smbus_read_block_data returned 9 so I think it read the payload length of 1byte but no data beyond it, hence buffer = '' ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 2026-04-16 3:04 ` Torreno, Alexis Czezar @ 2026-04-16 4:49 ` Guenter Roeck 0 siblings, 0 replies; 15+ messages in thread From: Guenter Roeck @ 2026-04-16 4:49 UTC (permalink / raw) To: Torreno, Alexis Czezar, sashiko@lists.linux.dev Cc: linux-hwmon@vger.kernel.org On 4/15/26 20:04, Torreno, Alexis Czezar wrote: >>> >>> I may need to keep i2c_smbus_read_i2c_block_data. I'm testing this on >>> an rpi4 and it seems i2c_smbus_read_block_data isn't supported by the >> adapter. >>> >> >> Odd. I can see that the bcm2835 controller driver sets >> I2C_FUNC_SMBUS_EMUL but not I2C_FUNC_SMBUS_BLOCK_DATA. That >> makes me wonder if the controller really does not support block reads. Any >> chance you can try setting that flag in ./drivers/i2c/busses/i2c-bcm2835.c and >> see what happens ? >> > > I tried using i2c_smbus_read_block_data, and here's some log messages > > [ 6857.261998] max20830: adapter does NOT support I2C_FUNC_SMBUS_BLOCK_DATA > [ 6857.262006] max20830: adapter supports I2C_FUNC_SMBUS_READ_I2C_BLOCK > [ 6857.265228] max20830: i2c_block_data read 32 bytes: ' MAX20830' > [ 6857.265648] max20830: smbus_block_data read 9 bytes: '' > > i2c_smbus_read_i2c_block_data returns 32 for 32 bytes read > and the buffer content is expected "MAX20830" > > i2c_smbus_read_block_data returned 9 so I think it read the payload length of 1byte > but no data beyond it, hence buffer = '' > Ok, worth a try. The "correct" fix would be to implement support for the command in the I2C controller driver, but that would be too much to ask for. Ok to use i2c_smbus_read_i2c_block_data, but please add a comment describing the reason, i.e., that this is to support drivers/controllers which don't support i2c_smbus_read_block_data(). Also, please implement code to address the differences: The first returned byte is the real length, so please check that. Also, please fix the "Unsupported device" log to not print the first byte. Thanks, Guenter ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-04-20 11:20 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-14 4:28 [PATCH 0/2] Add support for MAX20830 PMBUS Alexis Czezar Torreno 2026-04-14 4:28 ` [PATCH 1/2] dt-bindings: hwmon: pmbus: add max20830 Alexis Czezar Torreno 2026-04-14 4:38 ` sashiko-bot 2026-04-16 9:25 ` Krzysztof Kozlowski 2026-04-16 17:45 ` Roman Gushchin 2026-04-16 18:09 ` Guenter Roeck 2026-04-20 11:20 ` Krzysztof Kozlowski 2026-04-14 4:28 ` [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830 Alexis Czezar Torreno 2026-04-14 4:56 ` sashiko-bot 2026-04-14 14:54 ` Guenter Roeck 2026-04-15 2:21 ` Torreno, Alexis Czezar 2026-04-15 3:02 ` Guenter Roeck 2026-04-15 4:27 ` Torreno, Alexis Czezar 2026-04-16 3:04 ` Torreno, Alexis Czezar 2026-04-16 4:49 ` Guenter Roeck
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox