Skip to content

Commit 629cf8f

Browse files
actorrenogroeck
authored andcommitted
hwmon: (pmbus/max34440) Add support for ADPM12160
ADPM12160 is a quarter brick DC/DC Power Module. It is a high power non-isolated converter capable of delivering a fully regulated 12V, with continuous power level of 1600W with peak power at 2400W for a limited time. Uses PMBus Configuration. Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> Link: https://lore.kernel.org/r/20250407-dev_adpm12160-v3-2-9cd3095445c8@analog.com [groeck: The chip is "ADPM12160"] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 19932f8 commit 629cf8f

2 files changed

Lines changed: 74 additions & 11 deletions

File tree

Documentation/hwmon/max34440.rst

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ Kernel driver max34440
33

44
Supported chips:
55

6+
* ADI ADPM12160
7+
8+
Prefixes: 'adpm12160'
9+
10+
Addresses scanned: -
11+
12+
Datasheet: -
13+
614
* Maxim MAX34440
715

816
Prefixes: 'max34440'
@@ -67,13 +75,14 @@ Author: Guenter Roeck <linux@roeck-us.net>
6775
Description
6876
-----------
6977

70-
This driver supports hardware monitoring for Maxim MAX34440 PMBus 6-Channel
71-
Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply Manager
72-
and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data Logger.
73-
It also supports the MAX34451, MAX34460, and MAX34461 PMBus Voltage Monitor &
74-
Sequencers. The MAX34451 supports monitoring voltage or current of 12 channels
75-
based on GIN pins. The MAX34460 supports 12 voltage channels, and the MAX34461
76-
supports 16 voltage channels.
78+
This driver supports multiple devices: hardware monitoring for Maxim MAX34440
79+
PMBus 6-Channel Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply
80+
Manager and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data
81+
Logger; PMBus Voltage Monitor and Sequencers for MAX34451, MAX34460, and
82+
MAX34461; PMBus DC/DC Power Module ADPM12160. The MAX34451 supports monitoring
83+
voltage or current of 12 channels based on GIN pins. The MAX34460 supports 12
84+
voltage channels, and the MAX34461 supports 16 voltage channels. The ADPM1260
85+
also monitors both input and output of voltage and current.
7786

7887
The driver is a client driver to the core PMBus driver. Please see
7988
Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
@@ -128,7 +137,10 @@ in[1-6]_highest Historical maximum voltage.
128137
in[1-6]_reset_history Write any value to reset history.
129138
======================= =======================================================
130139

131-
.. note:: MAX34446 only supports in[1-4].
140+
.. note::
141+
142+
- MAX34446 only supports in[1-4].
143+
- ADPM12160 only supports in[1-2]. Label is "vin1" and "vout1" respectively.
132144

133145
Curr
134146
~~~~
@@ -150,6 +162,7 @@ curr[1-6]_reset_history Write any value to reset history.
150162

151163
- in6 and curr6 attributes only exist for MAX34440.
152164
- MAX34446 only supports curr[1-4].
165+
- For ADPM12160, curr[1] is "iin1" and curr[2-6] are "iout[1-5].
153166

154167
Power
155168
~~~~~
@@ -185,6 +198,7 @@ temp[1-8]_reset_history Write any value to reset history.
185198
.. note::
186199
- temp7 and temp8 attributes only exist for MAX34440.
187200
- MAX34446 only supports temp[1-3].
201+
- ADPM12160 only supports temp[1].
188202

189203

190204
.. note::

drivers/hwmon/pmbus/max34440.c

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414
#include <linux/i2c.h>
1515
#include "pmbus.h"
1616

17-
enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };
17+
enum chips {
18+
adpm12160,
19+
max34440,
20+
max34441,
21+
max34446,
22+
max34451,
23+
max34460,
24+
max34461,
25+
};
1826

1927
#define MAX34440_MFR_VOUT_PEAK 0xd4
2028
#define MAX34440_MFR_IOUT_PEAK 0xd5
@@ -80,7 +88,8 @@ static int max34440_read_word_data(struct i2c_client *client, int page,
8088
MAX34440_MFR_VOUT_PEAK);
8189
break;
8290
case PMBUS_VIRT_READ_IOUT_AVG:
83-
if (data->id != max34446 && data->id != max34451)
91+
if (data->id != max34446 && data->id != max34451 &&
92+
data->id != adpm12160)
8493
return -ENXIO;
8594
ret = pmbus_read_word_data(client, page, phase,
8695
MAX34446_MFR_IOUT_AVG);
@@ -164,7 +173,8 @@ static int max34440_write_word_data(struct i2c_client *client, int page,
164173
case PMBUS_VIRT_RESET_IOUT_HISTORY:
165174
ret = pmbus_write_word_data(client, page,
166175
MAX34440_MFR_IOUT_PEAK, 0);
167-
if (!ret && (data->id == max34446 || data->id == max34451))
176+
if (!ret && (data->id == max34446 || data->id == max34451 ||
177+
data->id == adpm12160))
168178
ret = pmbus_write_word_data(client, page,
169179
MAX34446_MFR_IOUT_AVG, 0);
170180

@@ -309,6 +319,41 @@ static int max34451_set_supported_funcs(struct i2c_client *client,
309319
}
310320

311321
static struct pmbus_driver_info max34440_info[] = {
322+
[adpm12160] = {
323+
.pages = 19,
324+
.format[PSC_VOLTAGE_IN] = direct,
325+
.format[PSC_VOLTAGE_OUT] = direct,
326+
.format[PSC_CURRENT_IN] = direct,
327+
.format[PSC_CURRENT_OUT] = direct,
328+
.format[PSC_TEMPERATURE] = direct,
329+
.m[PSC_VOLTAGE_IN] = 1,
330+
.b[PSC_VOLTAGE_IN] = 0,
331+
.R[PSC_VOLTAGE_IN] = 0,
332+
.m[PSC_VOLTAGE_OUT] = 1,
333+
.b[PSC_VOLTAGE_OUT] = 0,
334+
.R[PSC_VOLTAGE_OUT] = 0,
335+
.m[PSC_CURRENT_IN] = 1,
336+
.b[PSC_CURRENT_IN] = 0,
337+
.R[PSC_CURRENT_IN] = 2,
338+
.m[PSC_CURRENT_OUT] = 1,
339+
.b[PSC_CURRENT_OUT] = 0,
340+
.R[PSC_CURRENT_OUT] = 2,
341+
.m[PSC_TEMPERATURE] = 1,
342+
.b[PSC_TEMPERATURE] = 0,
343+
.R[PSC_TEMPERATURE] = 2,
344+
/* absent func below [18] are not for monitoring */
345+
.func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
346+
.func[4] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
347+
.func[5] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
348+
.func[6] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
349+
.func[7] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
350+
.func[8] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
351+
.func[9] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT,
352+
.func[10] = PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT,
353+
.func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
354+
.read_word_data = max34440_read_word_data,
355+
.write_word_data = max34440_write_word_data,
356+
},
312357
[max34440] = {
313358
.pages = 14,
314359
.format[PSC_VOLTAGE_IN] = direct,
@@ -539,12 +584,16 @@ static int max34440_probe(struct i2c_client *client)
539584
rv = max34451_set_supported_funcs(client, data);
540585
if (rv)
541586
return rv;
587+
} else if (data->id == adpm12160) {
588+
data->iout_oc_fault_limit = PMBUS_IOUT_OC_FAULT_LIMIT;
589+
data->iout_oc_warn_limit = PMBUS_IOUT_OC_WARN_LIMIT;
542590
}
543591

544592
return pmbus_do_probe(client, &data->info);
545593
}
546594

547595
static const struct i2c_device_id max34440_id[] = {
596+
{"adpm12160", adpm12160},
548597
{"max34440", max34440},
549598
{"max34441", max34441},
550599
{"max34446", max34446},

0 commit comments

Comments
 (0)