Skip to content

hwmon: (pmbus/max20830): add enable-gpio property and add support for max20830c/max20840c#3357

Open
actorreno wants to merge 4 commits into
dev_max20830from
dev/max20830c
Open

hwmon: (pmbus/max20830): add enable-gpio property and add support for max20830c/max20840c#3357
actorreno wants to merge 4 commits into
dev_max20830from
dev/max20830c

Conversation

@actorreno
Copy link
Copy Markdown
Contributor

@actorreno actorreno commented Jun 5, 2026

PR Description

Adds a missing entry for enable pin in the driver.

This PR adds support for the Analog Devices MAX20830C and MAX20840C
step-down DC-DC switching regulator with PMBus interface.

This PR is based on top of this: #3183

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

actorreno added 4 commits June 8, 2026 10:59
Adding a missing entry for the MAX20830 EN (enable) pin. Without this pin
device can still be enabled using PMBUS commands

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Add support for the GPIO controlled EN pin. The EN pin is asserted high
for device to operate. If not specified, EN pin can be tied high for
device controlled software enable.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
…port

Add compatible strings for variants of MAX20830 which are MAX20830C
and MAX20840C. These devices have the same register functionality with
MAX20830 but with a longer IC_DEVICE_ID.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Add support for MAX20830C and MAX20840 step-down DC-DC switching
regulator with PMBus interface. MAX20830C is a different packaging
for MAX20830, and MAX20840C supports 40A regulation compared to
MAX20830 of only 30A.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
@actorreno actorreno changed the title hwmon: (pmbus/max20830): add support for max20830c and max20840c hwmon: (pmbus/max20830): add enable-gpio property and add support for max20830c/max20840c Jun 8, 2026
enum:
- adi,max20830
- adi,max20830c
- adi,max20840c
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the new devices somehow fallback to the adi,max20830 so that we can use fallback compatible? If not, you might be asked to justify it and typically DT maintainers want that in the commit message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, they're so similar that falling back wouldn't change behavior

{"max20830"},
{"max20830", max20830},
{"max20830c", max20830c},
{"max20840c", max20840c},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is something common in pmbus but I would try it as in IIO? per device struct with a const char * identifier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill try it out, i think it could reduce a lot of the code complexity

/* MAX20840C variant detected */
} else if (!strncmp(buf, "MAX20830", 8)) {
/* MAX20830 variant detected */
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then no need for the above. Just one comparison

*/
ret = i2c_smbus_read_i2c_block_data(client, PMBUS_IC_DEVICE_ID,
MAX20830_IC_DEVICE_ID_LENGTH + 1,
MAX20830_IC_DEVICE_ID_MAX_LENGTH + 1,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work for the devices that only have MAX20830_IC_DEVICE_ID_MIN_LENGTH? Anyways, with a per chip struct this becomes again trivial to just use the amount of bytes any device is really needs to be read.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to answer so far yes, the i2c read here just returns FF beyond what the chip replies,
but yeah if edited as suggested above, this should be trivial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants