Re: [PATCH 6/7] hwmon: adm1275: Support ROHM BD12790
From: Guenter Roeck
Date: Wed Jun 17 2026 - 09:56:09 EST
On 6/16/26 22:56, Matti Vaittinen wrote:
On 16/06/2026 17:08, Guenter Roeck wrote:
On 6/15/26 23:44, Matti Vaittinen wrote:
From: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
Add support for ROHM BD12790 hot-swap controller which is largely
similar to Analog Devices adm1272.
The BD12790 uses the same selectable 60V/100V voltage ranges and
15mV/30mV current-sense ranges as the ADM1272, and the same VRANGE
(bit 5) and IRANGE (bit 0) layout in PMON_CONFIG. It therefore uses
a dedicated coefficient table that mirrors adm1272_coefficients, with
the following differences derived from BD12790 datasheet Table 1 (p.18):
- power 60V/30mV: m=17560 (vs. 17561)
- power 100V/30mV: m=10536 (vs. 10535)
- temperature: b=31880 (vs. 31871, reflecting T[11:0] = 4.2*T + 3188)
Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
Assisted-by: GitHub Copilot:claude-sonnet-4.6
---
Originally this patch was AI-generated. I did pretty much re-write the
probe changes by hand, and also fixed some of the coefficient math
afterwards :/ But yeah, this one was AI "assisted". :)
drivers/hwmon/pmbus/Kconfig | 4 +--
drivers/hwmon/pmbus/adm1275.c | 53 +++++++++++++++++++++++++++++------
2 files changed, 47 insertions(+), 10 deletions(-)
// snip
@@ -655,12 +681,23 @@ static int adm1275_probe(struct i2c_client *client)
break;
case adm1272:
case adm1273:
+ case bd12790:
Please don't overload the existing case statements.
Just add separate case statements for the new chips.
Hmm. Ok, although, here, same as with the BD12780, I would like the code to clearly show that the BD12790 is very very similar to another IC (adm1272). When we have own case for it, this information gets kind of lost as these cases are a tad too long to easily spot the differences. If there are any ideas how to ease spotting this while having own cases - I am keen to hear.
You could add a comment into the case statement.
Guenter