-
Notifications
You must be signed in to change notification settings - Fork 937
hwmon: pmbus: Add Analog Devices MAX20830 driver #3183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
actorreno
wants to merge
3
commits into
main
Choose a base branch
from
dev_max20830
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+194
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # 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. | ||
|
|
||
| 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>; | ||
| avdd-supply = <&avdd>; | ||
| }; | ||
| }; | ||
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,6 +147,7 @@ Hardware Monitoring Kernel Drivers | |
| max197 | ||
| max20730 | ||
| max20751 | ||
| max20830 | ||
| max31722 | ||
| max31730 | ||
| max31760 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| :doc:`/hwmon/pmbus` 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 | ||
| ================= ======================================== | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // 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; | ||
|
|
||
| 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 (!strstr(buf, "MAX20830")) | ||
| 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); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may be asked to delete this file if it does not provide significant value (e.g., explain really hard to understand parts that cannot be understood from the code or dt-binding)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it doesn't add much. should I just drop the file?