Add support for ADPM12160 a DC/DC Power Module
Subsystems (3)
cover Add support for ADPM12160 a DC/DC Power Module
Before adding the support for ADPM12160, this series includes a commit to fix the issue with max34451. The family of max344** contains switched PMBUS addresses 0x46 and 0x4A. For max34451, the version MAX34451ETNA6+ and later fixed this issue and this first commit supports this.
The second commit adds the actual driver for adpm12160. ASPM12160 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.
---
Alexis Czezar Torreno (2):
hwmon: (pmbus/max34440): Fix support for max34451
hwmon: (pmbus/max3440): add support adpm12160Documentation/hwmon/max34440.rst | 37 ++++++++--- drivers/hwmon/pmbus/Kconfig | 1 + drivers/hwmon/pmbus/max34440.c | 139 +++++++++++++++++++++++++++++---------- 3 files changed, 133 insertions(+), 44 deletions(-)
---
base-commit: c812cc42f92d3d0b17c01b5db9a1dee5793a1491
change-id: 20250320-dev_adpm12160-5960e77a79be
Best regards,
Signature · 1 line
Alexis Czezar Torreno <[email protected]>
PATCH 2/2 hwmon: (pmbus/max3440): add support adpm12160
ASPM12160 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.
--- Documentation/hwmon/max34440.rst | 31 +++++++++++++++++-------- drivers/hwmon/pmbus/Kconfig | 1 + drivers/hwmon/pmbus/max34440.c | 49 +++++++++++++++++++++++++++++++++++----- 3 files changed, 66 insertions(+), 15 deletions(-)
Documentation/hwmon/max34440.rst +22 -9
@@ -3,6 +3,14 @@ Kernel driver max34440 Supported chips: + * ADI ADPM12160 + + Prefixes: 'adpm12160' + + Addresses scanned: - + + Datasheet: - + * Maxim MAX34440 Prefixes: 'max34440'
@@ -67,13 +75,14 @@ Author: Guenter Roeck <[email protected]> Description ----------- -This driver supports hardware monitoring for Maxim MAX34440 PMBus 6-Channel -Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply Manager -and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data Logger. -It also supports the MAX34451, MAX34460, and MAX34461 PMBus Voltage Monitor & -Sequencers. The MAX34451 supports monitoring voltage or current of 12 channels -based on GIN pins. The MAX34460 supports 12 voltage channels, and the MAX34461 -supports 16 voltage channels. +This driver supports multiple devices: hardware monitoring for Maxim MAX34440 +PMBus 6-Channel Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply +Manager and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data +Logger; PMBus Voltage Monitor and Sequencers for MAX34451, MAX34460, and +MAX34461; PMBus DC/DC Power Module ADPM12160. The MAX34451 supports monitoring +voltage or current of 12 channels based on GIN pins. The MAX34460 supports 12 +voltage channels, and the MAX34461 supports 16 voltage channels. The ADPM1260 +also monitors both input and output of voltage and current. The driver is a client driver to the core PMBus driver. Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
@@ -97,7 +106,6 @@ For MAX34451, version MAX34451ETNA6+ and later are denoted with prefix 'max34451_na6'. The previous versions contains some errors on the PMBUS addresses and these are fixed on the later versions. - Platform data support ---------------------
@@ -132,7 +140,10 @@ in[1-6]_highest Historical maximum voltage. in[1-6]_reset_history Write any value to reset history. ======================= ======================================================= -.. note:: MAX34446 only supports in[1-4]. +.. note:: + + - MAX34446 only supports in[1-4]. + - ADPM12160 only supports in[1-2]. Label is "vin1" and "vout1" respectively. Curr ~~~~
@@ -154,6 +165,7 @@ curr[1-6]_reset_history Write any value to reset history. - in6 and curr6 attributes only exist for MAX34440. - MAX34446 only supports curr[1-4]. + - For ADPM12160, curr[1] is "iin1" and curr[2-6] are "iout[1-5]. Power ~~~~~
@@ -189,6 +201,7 @@ temp[1-8]_reset_history Write any value to reset history. .. note:: - temp7 and temp8 attributes only exist for MAX34440. - MAX34446 only supports temp[1-3]. + - ADPM12160 only supports temp[1]. .. note::
drivers/hwmon/pmbus/Kconfig +1 -0
@@ -324,6 +324,7 @@ config SENSORS_MAX34440 help If you say yes here you get hardware monitoring support for Maxim MAX34440, MAX34441, MAX34446, MAX34451, MAX34460, and MAX34461. + Other compatible includes ADPM12160. This driver can also be built as a module. If so, the module will be called max34440.
drivers/hwmon/pmbus/max34440.c +43 -6
103 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 1/2 hwmon: (pmbus/max34440): Fix support for max34451
In reply to Alexis Czezar TorrenoThe max344** family has an issue with some PMBUS address being switched. This includes max34451 however version MAX34451-NA6 and later has this issue fixed and this commit supports that update.
--- Documentation/hwmon/max34440.rst | 8 ++- drivers/hwmon/pmbus/max34440.c | 102 ++++++++++++++++++++++++++------------- 2 files changed, 74 insertions(+), 36 deletions(-)
Documentation/hwmon/max34440.rst +6 -2
@@ -35,7 +35,7 @@ Supported chips: PMBus 16-Channel V/I Monitor and 12-Channel Sequencer/Marginer - Prefixes: 'max34451' + Prefixes: 'max34451', 'max34451_na6' Addresses scanned: -
@@ -93,6 +93,10 @@ attribute is set to a positive value. Power measurement is only enabled if channel 1 (3) is configured for voltage measurement, and channel 2 (4) is configured for current measurement. +For MAX34451, version MAX34451ETNA6+ and later are denoted with prefix +'max34451_na6'. The previous versions contains some errors on the PMBUS +addresses and these are fixed on the later versions. + Platform data support ---------------------
@@ -192,4 +196,4 @@ temp[1-8]_reset_history Write any value to reset history. - MAX34451 supports attribute groups in[1-16] (or curr[1-16] based on input pins) and temp[1-5]. - MAX34460 supports attribute groups in[1-12] and temp[1-5]. - - MAX34461 supports attribute groups in[1-16] and temp[1-5]. + - MAX34461 supports attribute groups in[1-16] and temp[1-5].
drivers/hwmon/pmbus/max34440.c +68 -34
169 lines not on this page · raw message
Signature · 1 line
2.34.1
Guenter Roeck
maintainerRe: [PATCH 1/2] hwmon: (pmbus/max34440): Fix support for max34451
Quoted 71 lines · Alexis Czezar Torreno
The max344** family has an issue with some PMBUS address being switched. This includes max34451 however version MAX34451-NA6 and later has this issue fixed and this commit supports that update.
Signed-off-by Alexis Czezar Torreno <[email protected]>--- Documentation/hwmon/max34440.rst | 8 ++- drivers/hwmon/pmbus/max34440.c | 102 ++++++++++++++++++++++++++------------- 2 files changed, 74 insertions(+), 36 deletions(-)Documentation/hwmon/max34440.rst +6
-2@@ -35,7 +35,7 @@ Supported chips: PMBus 16-Channel V/I Monitor and 12-Channel Sequencer/Marginer - Prefixes: 'max34451' + Prefixes: 'max34451', 'max34451_na6' Addresses scanned: -@@ -93,6 +93,10 @@ attribute is set to a positive value. Power measurement is only enabled if channel 1 (3) is configured for voltage measurement, and channel 2 (4) is configured for current measurement. +For MAX34451, version MAX34451ETNA6+ and later are denoted with prefix +'max34451_na6'. The previous versions contains some errors on the PMBUS +addresses and these are fixed on the later versions. + Platform data support ---------------------@@ -192,4 +196,4 @@ temp[1-8]_reset_history Write any value to reset history. - MAX34451 supports attribute groups in[1-16] (or curr[1-16] based on input pins) and temp[1-5]. - MAX34460 supports attribute groups in[1-12] and temp[1-5]. - - MAX34461 supports attribute groups in[1-16] and temp[1-5]. + - MAX34461 supports attribute groups in[1-16] and temp[1-5].drivers/hwmon/pmbus/max34440.c +10
-1@@ -14,7 +14,15 @@#include <linux/i2c.h> #include "pmbus.h" -enum chips { max34440, max34441, max34446, max34451, max34460, max34461 }; +enum chips { + max34440, + max34441, + max34446, + max34451, + max34451_na6, + max34460, + max34461, +};#define MAX34440_MFR_VOUT_PEAK 0xd4#define MAX34440_MFR_IOUT_PEAK 0xd5@@ -34,6 +42,7 @@ enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };/* * The whole max344* family have IOUT_OC_WARN_LIMIT and IOUT_OC_FAULT_LIMIT * swapped from the standard pmbus spec addresses. +* For max34451, version MAX34451ETNA6+ and later has this issue fixed. */ #define MAX34440_IOUT_OC_WARN_LIMIT 0x46#define MAX34440_IOUT_OC_FAULT_LIMIT 0x4A
drivers/hwmon/pmbus/max34440.c static int max34440_read_word_data(struct i2c_client *client, int page, · line 71
Quoted 6 lines
drivers/hwmon/pmbus/max34440.c +1
-2@@ -59,12 +68,20 @@ static int max34440_read_word_data(struct i2c_client *client, int page,switch (reg) {case PMBUS_IOUT_OC_FAULT_LIMIT : - ret =pmbus_read_word_data (client, page, phase, -MAX34440_IOUT_OC_FAULT_LIMIT ); +if (data->id == max34451_na6)
Use a flag instead of a chip ID, or even better store the register addresses in max34440_data to avoid the runtime checks.
Quoted 113 lines
drivers/hwmon/pmbus/max34440.c +50
-24+ ret =pmbus_read_word_data (client, page, phase, +PMBUS_IOUT_OC_FAULT_LIMIT ); + else + ret =pmbus_read_word_data (client, page, phase, +MAX34440_IOUT_OC_FAULT_LIMIT );break ;case PMBUS_IOUT_OC_WARN_LIMIT : - ret =pmbus_read_word_data (client, page, phase, -MAX34440_IOUT_OC_WARN_LIMIT ); +if (data->id == max34451_na6) + ret =pmbus_read_word_data (client, page, phase, +PMBUS_IOUT_OC_WARN_LIMIT ); +else + ret =pmbus_read_word_data (client, page, phase, +MAX34440_IOUT_OC_WARN_LIMIT );break ;case PMBUS_VIRT_READ_VOUT_MIN : ret = pmbus_read_word_data(client, page, phase,@@ -75,7 +92,8 @@ static int max34440_read_word_data(struct i2c_client *client, int page, MAX34440_MFR_VOUT_PEAK);break ;case PMBUS_VIRT_READ_IOUT_AVG : -if (data->id != max34446 && data->id != max34451) +if (data->id != max34446 && data->id != max34451 && + data->id != max34451_na6)return -ENXIO ; ret =pmbus_read_word_data (client, page, phase,MAX34446_MFR_IOUT_AVG );@@ -133,12 +151,20 @@ static int max34440_write_word_data(struct i2c_client *client, int page,switch (reg) {case PMBUS_IOUT_OC_FAULT_LIMIT : - ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_FAULT_LIMIT , - word); +if (data->id == max34451_na6) + ret =pmbus_write_word_data (client, page,PMBUS_IOUT_OC_FAULT_LIMIT , + word); +else + ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_FAULT_LIMIT , + word);break ;case PMBUS_IOUT_OC_WARN_LIMIT : - ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_WARN_LIMIT , - word); +if (data->id == max34451_na6) + ret =pmbus_write_word_data (client, page,PMBUS_IOUT_OC_WARN_LIMIT , + word); +else + ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_WARN_LIMIT , + word);break ;case PMBUS_VIRT_RESET_POUT_HISTORY : ret = pmbus_write_word_data(client, page,@@ -159,7 +185,8 @@ static int max34440_write_word_data(struct i2c_client *client, int page,case PMBUS_VIRT_RESET_IOUT_HISTORY : ret =pmbus_write_word_data (client, page,MAX34440_MFR_IOUT_PEAK ,0 ); -if (!ret && (data->id == max34446 || data->id == max34451)) +if (!ret && (data->id == max34446 || data->id == max34451 || + data->id == max34451_na6)) ret =pmbus_write_word_data (client, page,MAX34446_MFR_IOUT_AVG ,0 );@@ -270,6 +297,29 @@ static int max34451_set_supported_funcs(struct i2c_client *client,return 0 ; } +#define MAX34451_COMMON_INFO \ + .pages = 21, \ + .format[PSC_VOLTAGE_OUT] = direct, \ + .format[PSC_TEMPERATURE] = direct, \ + .format[PSC_CURRENT_OUT] = direct, \ + .m[PSC_VOLTAGE_OUT] = 1, \ + .b[PSC_VOLTAGE_OUT] = 0, \ + .R[PSC_VOLTAGE_OUT] = 3, \ + .m[PSC_CURRENT_OUT] = 1, \ + .b[PSC_CURRENT_OUT] = 0, \ + .R[PSC_CURRENT_OUT] = 2, \ + .m[PSC_TEMPERATURE] = 1, \ + .b[PSC_TEMPERATURE] = 0, \ + .R[PSC_TEMPERATURE] = 2, \ + /* func 0-15 is set dynamically before probing */ \ + .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .read_word_data = max34440_read_word_data, \ + .write_word_data = max34440_write_word_data, +static struct pmbus_driver_info max34440_info[] = { [max34440] = { .pages =14 ,@@ -394,27 +444,10 @@ static struct pmbus_driver_info max34440_info[] = { .write_word_data = max34440_write_word_data, }, [max34451] = { - .pages = 21, - .format[PSC_VOLTAGE_OUT] = direct, - .format[PSC_TEMPERATURE] = direct, - .format[PSC_CURRENT_OUT] = direct, - .m[PSC_VOLTAGE_OUT] = 1, - .b[PSC_VOLTAGE_OUT] = 0, - .R[PSC_VOLTAGE_OUT] = 3, - .m[PSC_CURRENT_OUT] = 1, - .b[PSC_CURRENT_OUT] = 0, - .R[PSC_CURRENT_OUT] = 2, - .m[PSC_TEMPERATURE] = 1, - .b[PSC_TEMPERATURE] = 0, - .R[PSC_TEMPERATURE] = 2, -/* func 0-15 is set dynamically before probing */ - .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
drivers/hwmon/pmbus/max34440.c static struct pmbus_driver_info max34440_info[] = { · line 451
Quoted 10 lines
drivers/hwmon/pmbus/max34440.c +4
-5- .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .read_word_data = max34440_read_word_data, - .write_word_data = max34440_write_word_data, + MAX34451_COMMON_INFO, + }, + [max34451_na6] = { + MAX34451_COMMON_INFO, },
This is way too complicated. Use a flag or set the register addresses in struct max34440_data instead.
Quoted 12 lines
drivers/hwmon/pmbus/max34440.c +1
-1[max34460] = { .pages = 18,@@ -495,7 +528,7 @@ static int max34440_probe(struct i2c_client *client) data->id =i2c_match_id (max34440_id, client)->driver_data; data->info = max34440_info[data->id]; -if (data->id == max34451) { +if (data->id == max34451 || data->id == max34451_na6) { rv =max34451_set_supported_funcs (client, data);if (rv)return rv;
drivers/hwmon/pmbus/max34440.c static const struct i2c_device_id max34440_id[] = { · line 545
Quoted 4 lines
drivers/hwmon/pmbus/max34440.c +1
-0@@ -509,6 +542,7 @@ static const struct i2c_device_id max34440_id[] = { {"max34441", max34441}, {"max34446", max34446}, {"max34451", max34451}, + {"max34451_na6", max34451_na6},
Relying on this is way too fragile. This must be detectable from the chip; maybe using MFR_REVISION.
drivers/hwmon/pmbus/max34440.c module_i2c_driver(max34440_driver); · line 566
Quoted 9 lines
drivers/hwmon/pmbus/max34440.c +1
-1{"max34460", max34460}, {"max34461", max34461}, {}@@ -529,4 +563,4 @@ module_i2c_driver(max34440_driver);MODULE_AUTHOR ("Guenter Roeck" );MODULE_DESCRIPTION ("PMBus driver for Maxim MAX34440/MAX34441" );MODULE_LICENSE ("GPL" ); -MODULE_IMPORT_NS ("PMBUS" ); +MODULE_IMPORT_NS (PMBUS );
Looks like your code is based on an older kernel branch. Please rebase on top of mainline.
Guenter
Quoted 1 line
Guenter Roeck
maintainerRe: [PATCH 2/2] hwmon: (pmbus/max3440): add support adpm12160
In reply to Alexis Czezar TorrenoQuoted 1 line · Alexis Czezar Torreno
ASPM12160 is a quarter brick DC/DC Power Module. It is a high
ASPM12160 or ADPM12160 ?
Quoted 5 lines
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 <[email protected]>
I am not convinced that this chip should be supported as part of this driver. Unfortunately the datasheet is not public ... or, rather, the chip does not officially exist. Sorry, this driver will have to wait until I can have a look into the datasheet.
Guenter
RE: [PATCH 2/2] hwmon: (pmbus/max3440): add support adpm12160
Quoted 11 lines
[External]
Quoted 1 line · Alexis Czezar Torreno
ASPM12160 is a quarter brick DC/DC Power Module. It is a high
ASPM12160 or ADPM12160 ?
Quoted 4 lines
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.
Quoted 8 lines
Quoted 1 line
Signed-off-by Alexis Czezar Torreno <[email protected]>I am not convinced that this chip should be supported as part of this driver. Unfortunately the datasheet is not public ... or, rather, the chip does not officially exist. Sorry, this driver will have to wait until I can have a look into the datasheet.
Guenter
Apology on the typo, it is ADPM12160.
They wanted to upstream this same time as the chip release. But it makes sense, this upstream should at least be after it releases.
Will attend to the feedback on the other commit (Patch 1/2) for the meantime.
Thank you,
Alexis
kernel test robot
build botRe: [PATCH 1/2] hwmon: (pmbus/max34440): Fix support for max34451
In reply to Alexis Czezar Torrenokernel test robot noticed the following build errors:
Hi Alexis,
kernel test robot noticed the following build errors:
[auto build test ERROR on c812cc42f92d3d0b17c01b5db9a1dee5793a1491]
url: https://github.com/intel-lab-lkp/linux/commits/Alexis-Czezar-Torreno/hwmon-pmbus-max34440-Fix-support-for-max34451/20250320-115905 base: c812cc42f92d3d0b17c01b5db9a1dee5793a1491 patch link: https://lore.kernel.org/r/20250320-dev_adpm12160-v1-1-8f7b975eac75%40analog.com patch subject: [PATCH 1/2] hwmon: (pmbus/max34440): Fix support for max34451 config: i386-buildonly-randconfig-005-20250320 (https://download.01.org/0day-ci/archive/20250320/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/hwmon/pmbus/max34440.c:447:37: error: expected expression before ',' token
447 | MAX34451_COMMON_INFO,
| ^
drivers/hwmon/pmbus/max34440.c:450:37: error: expected expression before ',' token
450 | MAX34451_COMMON_INFO,
| ^
In file included from include/linux/module.h:22,
from drivers/hwmon/pmbus/max34440.c:11:
>> drivers/hwmon/pmbus/max34440.c:566:18: error: expected ',' or ';' before 'PMBUS'
566 | MODULE_IMPORT_NS(PMBUS);
| ^~~~~
include/linux/moduleparam.h:26:61: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
include/linux/module.h:299:33: note: in expansion of macro 'MODULE_INFO'
299 | #define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, ns)
| ^~~~~~~~~~~
drivers/hwmon/pmbus/max34440.c:566:1: note: in expansion of macro 'MODULE_IMPORT_NS'
566 | MODULE_IMPORT_NS(PMBUS);
| ^~~~~~~~~~~~~~~~vim +447 drivers/hwmon/pmbus/max34440.c
299
300 #define MAX34451_COMMON_INFO \
301 .pages = 21, \
302 .format[PSC_VOLTAGE_OUT] = direct, \
303 .format[PSC_TEMPERATURE] = direct, \
304 .format[PSC_CURRENT_OUT] = direct, \
305 .m[PSC_VOLTAGE_OUT] = 1, \
306 .b[PSC_VOLTAGE_OUT] = 0, \
307 .R[PSC_VOLTAGE_OUT] = 3, \
308 .m[PSC_CURRENT_OUT] = 1, \
309 .b[PSC_CURRENT_OUT] = 0, \
310 .R[PSC_CURRENT_OUT] = 2, \
311 .m[PSC_TEMPERATURE] = 1, \
312 .b[PSC_TEMPERATURE] = 0, \
313 .R[PSC_TEMPERATURE] = 2, \
314 /* func 0-15 is set dynamically before probing */ \
315 .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
316 .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
317 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
318 .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
319 .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
320 .read_word_data = max34440_read_word_data, \
321 .write_word_data = max34440_write_word_data,
322
323 static struct pmbus_driver_info max34440_info[] = {
324 [max34440] = {
325 .pages = 14,
326 .format[PSC_VOLTAGE_IN] = direct,
327 .format[PSC_VOLTAGE_OUT] = direct,
328 .format[PSC_TEMPERATURE] = direct,
329 .format[PSC_CURRENT_OUT] = direct,
330 .m[PSC_VOLTAGE_IN] = 1,
331 .b[PSC_VOLTAGE_IN] = 0,
332 .R[PSC_VOLTAGE_IN] = 3, /* R = 0 in datasheet reflects mV */
333 .m[PSC_VOLTAGE_OUT] = 1,
334 .b[PSC_VOLTAGE_OUT] = 0,
335 .R[PSC_VOLTAGE_OUT] = 3, /* R = 0 in datasheet reflects mV */
336 .m[PSC_CURRENT_OUT] = 1,
337 .b[PSC_CURRENT_OUT] = 0,
338 .R[PSC_CURRENT_OUT] = 3, /* R = 0 in datasheet reflects mA */
339 .m[PSC_TEMPERATURE] = 1,
340 .b[PSC_TEMPERATURE] = 0,
341 .R[PSC_TEMPERATURE] = 2,
342 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
343 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
344 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
345 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
346 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
347 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
348 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
349 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
350 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
351 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
352 .func[5] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
353 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
354 .func[6] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
355 .func[7] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
356 .func[8] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
357 .func[9] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
358 .func[10] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
359 .func[11] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
360 .func[12] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
361 .func[13] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
362 .read_byte_data = max34440_read_byte_data,
363 .read_word_data = max34440_read_word_data,
364 .write_word_data = max34440_write_word_data,
365 },
366 [max34441] = {
367 .pages = 12,
368 .format[PSC_VOLTAGE_IN] = direct,
369 .format[PSC_VOLTAGE_OUT] = direct,
370 .format[PSC_TEMPERATURE] = direct,
371 .format[PSC_CURRENT_OUT] = direct,
372 .format[PSC_FAN] = direct,
373 .m[PSC_VOLTAGE_IN] = 1,
374 .b[PSC_VOLTAGE_IN] = 0,
375 .R[PSC_VOLTAGE_IN] = 3,
376 .m[PSC_VOLTAGE_OUT] = 1,
377 .b[PSC_VOLTAGE_OUT] = 0,
378 .R[PSC_VOLTAGE_OUT] = 3,
379 .m[PSC_CURRENT_OUT] = 1,
380 .b[PSC_CURRENT_OUT] = 0,
381 .R[PSC_CURRENT_OUT] = 3,
382 .m[PSC_TEMPERATURE] = 1,
383 .b[PSC_TEMPERATURE] = 0,
384 .R[PSC_TEMPERATURE] = 2,
385 .m[PSC_FAN] = 1,
386 .b[PSC_FAN] = 0,
387 .R[PSC_FAN] = 0,
388 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
389 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
390 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
391 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
392 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
393 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
394 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
395 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
396 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
397 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
398 .func[5] = PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12,
399 .func[6] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
400 .func[7] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
401 .func[8] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
402 .func[9] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
403 .func[10] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
404 .func[11] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
405 .read_byte_data = max34440_read_byte_data,
406 .read_word_data = max34440_read_word_data,
407 .write_word_data = max34440_write_word_data,
408 },
409 [max34446] = {
410 .pages = 7,
411 .format[PSC_VOLTAGE_IN] = direct,
412 .format[PSC_VOLTAGE_OUT] = direct,
413 .format[PSC_TEMPERATURE] = direct,
414 .format[PSC_CURRENT_OUT] = direct,
415 .format[PSC_POWER] = direct,
416 .m[PSC_VOLTAGE_IN] = 1,
417 .b[PSC_VOLTAGE_IN] = 0,
418 .R[PSC_VOLTAGE_IN] = 3,
419 .m[PSC_VOLTAGE_OUT] = 1,
420 .b[PSC_VOLTAGE_OUT] = 0,
421 .R[PSC_VOLTAGE_OUT] = 3,
422 .m[PSC_CURRENT_OUT] = 1,
423 .b[PSC_CURRENT_OUT] = 0,
424 .R[PSC_CURRENT_OUT] = 3,
425 .m[PSC_POWER] = 1,
426 .b[PSC_POWER] = 0,
427 .R[PSC_POWER] = 3,
428 .m[PSC_TEMPERATURE] = 1,
429 .b[PSC_TEMPERATURE] = 0,
430 .R[PSC_TEMPERATURE] = 2,
431 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
432 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT,
433 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
434 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
435 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
436 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT,
437 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
438 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
439 .func[4] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
440 .func[5] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
441 .func[6] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
442 .read_byte_data = max34440_read_byte_data,
443 .read_word_data = max34440_read_word_data,
444 .write_word_data = max34440_write_word_data,
445 },
446 [max34451] = {
> 447 MAX34451_COMMON_INFO,
448 },
449 [max34451_na6] = {
450 MAX34451_COMMON_INFO,
451 },
452 [max34460] = {
453 .pages = 18,
454 .format[PSC_VOLTAGE_OUT] = direct,
455 .format[PSC_TEMPERATURE] = direct,
456 .m[PSC_VOLTAGE_OUT] = 1,
457 .b[PSC_VOLTAGE_OUT] = 0,
458 .R[PSC_VOLTAGE_OUT] = 3,
459 .m[PSC_TEMPERATURE] = 1,
460 .b[PSC_TEMPERATURE] = 0,
461 .R[PSC_TEMPERATURE] = 2,
462 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
463 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
464 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
465 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
466 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
467 .func[5] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
468 .func[6] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
469 .func[7] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
470 .func[8] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
471 .func[9] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
472 .func[10] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
473 .func[11] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
474 .func[13] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
475 .func[14] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
476 .func[15] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
477 .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
478 .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
479 .read_word_data = max34440_read_word_data,
480 .write_word_data = max34440_write_word_data,
481 },
482 [max34461] = {
483 .pages = 23,
484 .format[PSC_VOLTAGE_OUT] = direct,
485 .format[PSC_TEMPERATURE] = direct,
486 .m[PSC_VOLTAGE_OUT] = 1,
487 .b[PSC_VOLTAGE_OUT] = 0,
488 .R[PSC_VOLTAGE_OUT] = 3,
489 .m[PSC_TEMPERATURE] = 1,
490 .b[PSC_TEMPERATURE] = 0,
491 .R[PSC_TEMPERATURE] = 2,
492 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
493 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
494 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
495 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
496 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
497 .func[5] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
498 .func[6] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
499 .func[7] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
500 .func[8] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
501 .func[9] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
502 .func[10] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
503 .func[11] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
504 .func[12] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
505 .func[13] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
506 .func[14] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
507 .func[15] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
508 /* page 16 is reserved */
509 .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
510 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
511 .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
512 .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
513 .func[21] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
514 .read_word_data = max34440_read_word_data,
515 .write_word_data = max34440_write_word_data,
516 },
517 };
518
519 static int max34440_probe(struct i2c_client *client)
520 {
521 struct max34440_data *data;
522 int rv;
523
524 data = devm_kzalloc(&client->dev, sizeof(struct max34440_data),
525 GFP_KERNEL);
526 if (!data)
527 return -ENOMEM;
528 data->id = i2c_match_id(max34440_id, client)->driver_data;
529 data->info = max34440_info[data->id];
530
531 if (data->id == max34451 || data->id == max34451_na6) {
532 rv = max34451_set_supported_funcs(client, data);
533 if (rv)
534 return rv;
535 }
536
537 return pmbus_do_probe(client, &data->info);
538 }
539
540 static const struct i2c_device_id max34440_id[] = {
541 {"max34440", max34440},
542 {"max34441", max34441},
543 {"max34446", max34446},
544 {"max34451", max34451},
545 {"max34451_na6", max34451_na6},
546 {"max34460", max34460},
547 {"max34461", max34461},
548 {}
549 };
550 MODULE_DEVICE_TABLE(i2c, max34440_id);
551
552 /* This is the driver that will be inserted */
553 static struct i2c_driver max34440_driver = {
554 .driver = {
555 .name = "max34440",
556 },
557 .probe = max34440_probe,
558 .id_table = max34440_id,
559 };
560
561 module_i2c_driver(max34440_driver);
562
563 MODULE_AUTHOR("Guenter Roeck");
564 MODULE_DESCRIPTION("PMBus driver for Maxim MAX34440/MAX34441");
565 MODULE_LICENSE("GPL");
> 566 MODULE_IMPORT_NS(PMBUS);Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 2/2] hwmon: (pmbus/max3440): add support adpm12160
In reply to Alexis Czezar Torrenokernel test robot noticed the following build errors:
Hi Alexis,
kernel test robot noticed the following build errors:
[auto build test ERROR on c812cc42f92d3d0b17c01b5db9a1dee5793a1491]
url: https://github.com/intel-lab-lkp/linux/commits/Alexis-Czezar-Torreno/hwmon-pmbus-max34440-Fix-support-for-max34451/20250320-115905 base: c812cc42f92d3d0b17c01b5db9a1dee5793a1491 patch link: https://lore.kernel.org/r/20250320-dev_adpm12160-v1-2-8f7b975eac75%40analog.com patch subject: [PATCH 2/2] hwmon: (pmbus/max3440): add support adpm12160 config: i386-buildonly-randconfig-005-20250320 (https://download.01.org/0day-ci/archive/20250320/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/hwmon/pmbus/max34440.c: In function 'max34440_read_word_data':
>> drivers/hwmon/pmbus/max34440.c:97:71: error: expected statement before ')' token
97 | data->id != max34451_na6 && data->id != adpm12160))
| ^
drivers/hwmon/pmbus/max34440.c: At top level:
drivers/hwmon/pmbus/max34440.c:483:37: error: expected expression before ',' token
483 | MAX34451_COMMON_INFO,
| ^
drivers/hwmon/pmbus/max34440.c:486:37: error: expected expression before ',' token
486 | MAX34451_COMMON_INFO,
| ^
In file included from include/linux/module.h:22,
from drivers/hwmon/pmbus/max34440.c:11:
drivers/hwmon/pmbus/max34440.c:603:18: error: expected ',' or ';' before 'PMBUS'
603 | MODULE_IMPORT_NS(PMBUS);
| ^~~~~
include/linux/moduleparam.h:26:61: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
include/linux/module.h:299:33: note: in expansion of macro 'MODULE_INFO'
299 | #define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, ns)
| ^~~~~~~~~~~
drivers/hwmon/pmbus/max34440.c:603:1: note: in expansion of macro 'MODULE_IMPORT_NS'
603 | MODULE_IMPORT_NS(PMBUS);
| ^~~~~~~~~~~~~~~~vim +97 drivers/hwmon/pmbus/max34440.c
62
63 static int max34440_read_word_data(struct i2c_client *client, int page,
64 int phase, int reg)
65 {
66 int ret;
67 const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
68 const struct max34440_data *data = to_max34440_data(info);
69
70 switch (reg) {
71 case PMBUS_IOUT_OC_FAULT_LIMIT:
72 if (data->id == max34451_na6 || data->id == adpm12160)
73 ret = pmbus_read_word_data(client, page, phase,
74 PMBUS_IOUT_OC_FAULT_LIMIT);
75 else
76 ret = pmbus_read_word_data(client, page, phase,
77 MAX34440_IOUT_OC_FAULT_LIMIT);
78 break;
79 case PMBUS_IOUT_OC_WARN_LIMIT:
80 if (data->id == max34451_na6 || data->id == adpm12160)
81 ret = pmbus_read_word_data(client, page, phase,
82 PMBUS_IOUT_OC_WARN_LIMIT);
83 else
84 ret = pmbus_read_word_data(client, page, phase,
85 MAX34440_IOUT_OC_WARN_LIMIT);
86 break;
87 case PMBUS_VIRT_READ_VOUT_MIN:
88 ret = pmbus_read_word_data(client, page, phase,
89 MAX34440_MFR_VOUT_MIN);
90 break;
91 case PMBUS_VIRT_READ_VOUT_MAX:
92 ret = pmbus_read_word_data(client, page, phase,
93 MAX34440_MFR_VOUT_PEAK);
94 break;
95 case PMBUS_VIRT_READ_IOUT_AVG:
96 if (data->id != max34446 && data->id != max34451 &&
> 97 data->id != max34451_na6 && data->id != adpm12160)) 98 return -ENXIO;
99 ret = pmbus_read_word_data(client, page, phase,
100 MAX34446_MFR_IOUT_AVG);
101 break;
102 case PMBUS_VIRT_READ_IOUT_MAX:
103 ret = pmbus_read_word_data(client, page, phase,
104 MAX34440_MFR_IOUT_PEAK);
105 break;
106 case PMBUS_VIRT_READ_POUT_AVG:
107 if (data->id != max34446)
108 return -ENXIO;
109 ret = pmbus_read_word_data(client, page, phase,
110 MAX34446_MFR_POUT_AVG);
111 break;
112 case PMBUS_VIRT_READ_POUT_MAX:
113 if (data->id != max34446)
114 return -ENXIO;
115 ret = pmbus_read_word_data(client, page, phase,
116 MAX34446_MFR_POUT_PEAK);
117 break;
118 case PMBUS_VIRT_READ_TEMP_AVG:
119 if (data->id != max34446 && data->id != max34460 &&
120 data->id != max34461)
121 return -ENXIO;
122 ret = pmbus_read_word_data(client, page, phase,
123 MAX34446_MFR_TEMPERATURE_AVG);
124 break;
125 case PMBUS_VIRT_READ_TEMP_MAX:
126 ret = pmbus_read_word_data(client, page, phase,
127 MAX34440_MFR_TEMPERATURE_PEAK);
128 break;
129 case PMBUS_VIRT_RESET_POUT_HISTORY:
130 if (data->id != max34446)
131 return -ENXIO;
132 ret = 0;
133 break;
134 case PMBUS_VIRT_RESET_VOUT_HISTORY:
135 case PMBUS_VIRT_RESET_IOUT_HISTORY:
136 case PMBUS_VIRT_RESET_TEMP_HISTORY:
137 ret = 0;
138 break;
139 default:
140 ret = -ENODATA;
141 break;
142 }
143 return ret;
144 }
145
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 1/2] hwmon: (pmbus/max34440): Fix support for max34451
In reply to Alexis Czezar Torrenokernel test robot noticed the following build errors:
Hi Alexis,
kernel test robot noticed the following build errors:
[auto build test ERROR on c812cc42f92d3d0b17c01b5db9a1dee5793a1491]
url: https://github.com/intel-lab-lkp/linux/commits/Alexis-Czezar-Torreno/hwmon-pmbus-max34440-Fix-support-for-max34451/20250320-115905 base: c812cc42f92d3d0b17c01b5db9a1dee5793a1491 patch link: https://lore.kernel.org/r/20250320-dev_adpm12160-v1-1-8f7b975eac75%40analog.com patch subject: [PATCH 1/2] hwmon: (pmbus/max34440): Fix support for max34451 config: x86_64-randconfig-074-20250321 (https://download.01.org/0day-ci/archive/20250321/[email protected]/config) compiler: clang version 20.1.1 (https://github.com/llvm/llvm-project 424c2d9b7e4de40d0804dd374721e6411c27d1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250321/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/hwmon/pmbus/max34440.c:447:23: error: expected expression
447 | MAX34451_COMMON_INFO,
| ^
drivers/hwmon/pmbus/max34440.c:450:23: error: expected expression
450 | MAX34451_COMMON_INFO,
| ^
>> drivers/hwmon/pmbus/max34440.c:566:18: error: expected ';' after top level declarator
566 | MODULE_IMPORT_NS(PMBUS);
| ^3 errors generated.
vim +447 drivers/hwmon/pmbus/max34440.c
299
300 #define MAX34451_COMMON_INFO \
301 .pages = 21, \
302 .format[PSC_VOLTAGE_OUT] = direct, \
303 .format[PSC_TEMPERATURE] = direct, \
304 .format[PSC_CURRENT_OUT] = direct, \
305 .m[PSC_VOLTAGE_OUT] = 1, \
306 .b[PSC_VOLTAGE_OUT] = 0, \
307 .R[PSC_VOLTAGE_OUT] = 3, \
308 .m[PSC_CURRENT_OUT] = 1, \
309 .b[PSC_CURRENT_OUT] = 0, \
310 .R[PSC_CURRENT_OUT] = 2, \
311 .m[PSC_TEMPERATURE] = 1, \
312 .b[PSC_TEMPERATURE] = 0, \
313 .R[PSC_TEMPERATURE] = 2, \
314 /* func 0-15 is set dynamically before probing */ \
315 .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
316 .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
317 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
318 .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
319 .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \
320 .read_word_data = max34440_read_word_data, \
321 .write_word_data = max34440_write_word_data,
322
323 static struct pmbus_driver_info max34440_info[] = {
324 [max34440] = {
325 .pages = 14,
326 .format[PSC_VOLTAGE_IN] = direct,
327 .format[PSC_VOLTAGE_OUT] = direct,
328 .format[PSC_TEMPERATURE] = direct,
329 .format[PSC_CURRENT_OUT] = direct,
330 .m[PSC_VOLTAGE_IN] = 1,
331 .b[PSC_VOLTAGE_IN] = 0,
332 .R[PSC_VOLTAGE_IN] = 3, /* R = 0 in datasheet reflects mV */
333 .m[PSC_VOLTAGE_OUT] = 1,
334 .b[PSC_VOLTAGE_OUT] = 0,
335 .R[PSC_VOLTAGE_OUT] = 3, /* R = 0 in datasheet reflects mV */
336 .m[PSC_CURRENT_OUT] = 1,
337 .b[PSC_CURRENT_OUT] = 0,
338 .R[PSC_CURRENT_OUT] = 3, /* R = 0 in datasheet reflects mA */
339 .m[PSC_TEMPERATURE] = 1,
340 .b[PSC_TEMPERATURE] = 0,
341 .R[PSC_TEMPERATURE] = 2,
342 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
343 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
344 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
345 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
346 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
347 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
348 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
349 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
350 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
351 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
352 .func[5] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
353 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
354 .func[6] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
355 .func[7] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
356 .func[8] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
357 .func[9] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
358 .func[10] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
359 .func[11] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
360 .func[12] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
361 .func[13] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
362 .read_byte_data = max34440_read_byte_data,
363 .read_word_data = max34440_read_word_data,
364 .write_word_data = max34440_write_word_data,
365 },
366 [max34441] = {
367 .pages = 12,
368 .format[PSC_VOLTAGE_IN] = direct,
369 .format[PSC_VOLTAGE_OUT] = direct,
370 .format[PSC_TEMPERATURE] = direct,
371 .format[PSC_CURRENT_OUT] = direct,
372 .format[PSC_FAN] = direct,
373 .m[PSC_VOLTAGE_IN] = 1,
374 .b[PSC_VOLTAGE_IN] = 0,
375 .R[PSC_VOLTAGE_IN] = 3,
376 .m[PSC_VOLTAGE_OUT] = 1,
377 .b[PSC_VOLTAGE_OUT] = 0,
378 .R[PSC_VOLTAGE_OUT] = 3,
379 .m[PSC_CURRENT_OUT] = 1,
380 .b[PSC_CURRENT_OUT] = 0,
381 .R[PSC_CURRENT_OUT] = 3,
382 .m[PSC_TEMPERATURE] = 1,
383 .b[PSC_TEMPERATURE] = 0,
384 .R[PSC_TEMPERATURE] = 2,
385 .m[PSC_FAN] = 1,
386 .b[PSC_FAN] = 0,
387 .R[PSC_FAN] = 0,
388 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
389 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
390 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
391 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
392 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
393 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
394 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
395 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
396 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
397 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
398 .func[5] = PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12,
399 .func[6] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
400 .func[7] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
401 .func[8] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
402 .func[9] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
403 .func[10] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
404 .func[11] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
405 .read_byte_data = max34440_read_byte_data,
406 .read_word_data = max34440_read_word_data,
407 .write_word_data = max34440_write_word_data,
408 },
409 [max34446] = {
410 .pages = 7,
411 .format[PSC_VOLTAGE_IN] = direct,
412 .format[PSC_VOLTAGE_OUT] = direct,
413 .format[PSC_TEMPERATURE] = direct,
414 .format[PSC_CURRENT_OUT] = direct,
415 .format[PSC_POWER] = direct,
416 .m[PSC_VOLTAGE_IN] = 1,
417 .b[PSC_VOLTAGE_IN] = 0,
418 .R[PSC_VOLTAGE_IN] = 3,
419 .m[PSC_VOLTAGE_OUT] = 1,
420 .b[PSC_VOLTAGE_OUT] = 0,
421 .R[PSC_VOLTAGE_OUT] = 3,
422 .m[PSC_CURRENT_OUT] = 1,
423 .b[PSC_CURRENT_OUT] = 0,
424 .R[PSC_CURRENT_OUT] = 3,
425 .m[PSC_POWER] = 1,
426 .b[PSC_POWER] = 0,
427 .R[PSC_POWER] = 3,
428 .m[PSC_TEMPERATURE] = 1,
429 .b[PSC_TEMPERATURE] = 0,
430 .R[PSC_TEMPERATURE] = 2,
431 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
432 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT,
433 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
434 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
435 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
436 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT,
437 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
438 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
439 .func[4] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
440 .func[5] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
441 .func[6] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
442 .read_byte_data = max34440_read_byte_data,
443 .read_word_data = max34440_read_word_data,
444 .write_word_data = max34440_write_word_data,
445 },
446 [max34451] = {
> 447 MAX34451_COMMON_INFO,
448 },
449 [max34451_na6] = {
450 MAX34451_COMMON_INFO,
451 },
452 [max34460] = {
453 .pages = 18,
454 .format[PSC_VOLTAGE_OUT] = direct,
455 .format[PSC_TEMPERATURE] = direct,
456 .m[PSC_VOLTAGE_OUT] = 1,
457 .b[PSC_VOLTAGE_OUT] = 0,
458 .R[PSC_VOLTAGE_OUT] = 3,
459 .m[PSC_TEMPERATURE] = 1,
460 .b[PSC_TEMPERATURE] = 0,
461 .R[PSC_TEMPERATURE] = 2,
462 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
463 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
464 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
465 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
466 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
467 .func[5] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
468 .func[6] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
469 .func[7] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
470 .func[8] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
471 .func[9] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
472 .func[10] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
473 .func[11] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
474 .func[13] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
475 .func[14] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
476 .func[15] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
477 .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
478 .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
479 .read_word_data = max34440_read_word_data,
480 .write_word_data = max34440_write_word_data,
481 },
482 [max34461] = {
483 .pages = 23,
484 .format[PSC_VOLTAGE_OUT] = direct,
485 .format[PSC_TEMPERATURE] = direct,
486 .m[PSC_VOLTAGE_OUT] = 1,
487 .b[PSC_VOLTAGE_OUT] = 0,
488 .R[PSC_VOLTAGE_OUT] = 3,
489 .m[PSC_TEMPERATURE] = 1,
490 .b[PSC_TEMPERATURE] = 0,
491 .R[PSC_TEMPERATURE] = 2,
492 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
493 .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
494 .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
495 .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
496 .func[4] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
497 .func[5] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
498 .func[6] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
499 .func[7] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
500 .func[8] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
501 .func[9] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
502 .func[10] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
503 .func[11] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
504 .func[12] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
505 .func[13] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
506 .func[14] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
507 .func[15] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
508 /* page 16 is reserved */
509 .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
510 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
511 .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
512 .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
513 .func[21] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
514 .read_word_data = max34440_read_word_data,
515 .write_word_data = max34440_write_word_data,
516 },
517 };
518
519 static int max34440_probe(struct i2c_client *client)
520 {
521 struct max34440_data *data;
522 int rv;
523
524 data = devm_kzalloc(&client->dev, sizeof(struct max34440_data),
525 GFP_KERNEL);
526 if (!data)
527 return -ENOMEM;
528 data->id = i2c_match_id(max34440_id, client)->driver_data;
529 data->info = max34440_info[data->id];
530
531 if (data->id == max34451 || data->id == max34451_na6) {
532 rv = max34451_set_supported_funcs(client, data);
533 if (rv)
534 return rv;
535 }
536
537 return pmbus_do_probe(client, &data->info);
538 }
539
540 static const struct i2c_device_id max34440_id[] = {
541 {"max34440", max34440},
542 {"max34441", max34441},
543 {"max34446", max34446},
544 {"max34451", max34451},
545 {"max34451_na6", max34451_na6},
546 {"max34460", max34460},
547 {"max34461", max34461},
548 {}
549 };
550 MODULE_DEVICE_TABLE(i2c, max34440_id);
551
552 /* This is the driver that will be inserted */
553 static struct i2c_driver max34440_driver = {
554 .driver = {
555 .name = "max34440",
556 },
557 .probe = max34440_probe,
558 .id_table = max34440_id,
559 };
560
561 module_i2c_driver(max34440_driver);
562
563 MODULE_AUTHOR("Guenter Roeck");
564 MODULE_DESCRIPTION("PMBus driver for Maxim MAX34440/MAX34441");
565 MODULE_LICENSE("GPL");
> 566 MODULE_IMPORT_NS(PMBUS);Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki