* [PATCH v2 0/2] Add support for ADPM12160 a DC/DC Power Module
@ 2025-04-03 5:16 Alexis Czezar Torreno
2025-04-03 5:16 ` [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451 Alexis Czezar Torreno
2025-04-03 5:16 ` [PATCH v2 2/2] hwmon: (pmbus/max3440): add support adpm12160 Alexis Czezar Torreno
0 siblings, 2 replies; 5+ messages in thread
From: Alexis Czezar Torreno @ 2025-04-03 5:16 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Delphine CC Chiu
Cc: linux-hwmon, linux-doc, linux-kernel, linux-i2c,
Alexis Czezar Torreno
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
MFR_REVISION is used to differentiate the different max34451 chips.
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.
Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
---
Changes in v2:
- Commit 1: MAX34451 Fix
- Added a flag to denote if the device has correct pmbus address
- Stored the pmbus address of concern inside max34440_data
- Removed separate chip ID for max344451etna6+, detects this version
via MFR_REVISION
- Reverted max34440.rst to original. No edit deemed necessary
- Supported READ_VIN, READ_IIN, and STATUS_INPUT for max34451etna6+
- Commit 2: Add ADPM12160
- Adjusted code to base it on the new max34440.c
- Link to v1: https://lore.kernel.org/r/20250320-dev_adpm12160-v1-0-8f7b975eac75@analog.com
---
Alexis Czezar Torreno (2):
hwmon: (pmbus/max34440): Fix support for max34451
hwmon: (pmbus/max3440): add support adpm12160
Documentation/hwmon/max34440.rst | 30 ++++++++---
drivers/hwmon/pmbus/max34440.c | 109 ++++++++++++++++++++++++++++++++++++---
2 files changed, 124 insertions(+), 15 deletions(-)
---
base-commit: c812cc42f92d3d0b17c01b5db9a1dee5793a1491
change-id: 20250320-dev_adpm12160-5960e77a79be
Best regards,
--
Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451
2025-04-03 5:16 [PATCH v2 0/2] Add support for ADPM12160 a DC/DC Power Module Alexis Czezar Torreno
@ 2025-04-03 5:16 ` Alexis Czezar Torreno
2025-04-03 16:32 ` Guenter Roeck
2025-04-03 5:16 ` [PATCH v2 2/2] hwmon: (pmbus/max3440): add support adpm12160 Alexis Czezar Torreno
1 sibling, 1 reply; 5+ messages in thread
From: Alexis Czezar Torreno @ 2025-04-03 5:16 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Delphine CC Chiu
Cc: linux-hwmon, linux-doc, linux-kernel, linux-i2c,
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 <alexisczezar.torreno@analog.com>
---
drivers/hwmon/pmbus/max34440.c | 55 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index c9dda33831ff24e7b5e2fd1956a65e6bd2bfcbb9..585746806663409bc97042647f6c0aba4c6f520a 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -34,16 +34,22 @@ 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
+#define MAX34451ETNA6_MFR_REV 0x0012
+
#define MAX34451_MFR_CHANNEL_CONFIG 0xe4
#define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3f
struct max34440_data {
int id;
struct pmbus_driver_info info;
+ bool pmbus_addr_fixed;
+ u32 iout_oc_warn_limit;
+ u32 iout_oc_fault_limit;
};
#define to_max34440_data(x) container_of(x, struct max34440_data, info)
@@ -60,11 +66,11 @@ 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);
+ data->iout_oc_fault_limit);
break;
case PMBUS_IOUT_OC_WARN_LIMIT:
ret = pmbus_read_word_data(client, page, phase,
- MAX34440_IOUT_OC_WARN_LIMIT);
+ data->iout_oc_warn_limit);
break;
case PMBUS_VIRT_READ_VOUT_MIN:
ret = pmbus_read_word_data(client, page, phase,
@@ -133,11 +139,11 @@ 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,
+ ret = pmbus_write_word_data(client, page, data->iout_oc_fault_limit,
word);
break;
case PMBUS_IOUT_OC_WARN_LIMIT:
- ret = pmbus_write_word_data(client, page, MAX34440_IOUT_OC_WARN_LIMIT,
+ ret = pmbus_write_word_data(client, page, data->iout_oc_warn_limit,
word);
break;
case PMBUS_VIRT_RESET_POUT_HISTORY:
@@ -235,6 +241,24 @@ static int max34451_set_supported_funcs(struct i2c_client *client,
*/
int page, rv;
+ bool max34451_na6 = false;
+
+ rv = i2c_smbus_read_word_data(client, PMBUS_MFR_REVISION);
+ if (rv < 0)
+ return rv;
+
+ if (rv == MAX34451ETNA6_MFR_REV) {
+ max34451_na6 = true;
+ data->pmbus_addr_fixed = true;
+ data->info.format[PSC_VOLTAGE_IN] = direct;
+ data->info.format[PSC_CURRENT_IN] = direct;
+ data->info.m[PSC_VOLTAGE_IN] = 1;
+ data->info.b[PSC_VOLTAGE_IN] = 0;
+ data->info.R[PSC_VOLTAGE_IN] = 3;
+ data->info.m[PSC_CURRENT_IN] = 1;
+ data->info.b[PSC_CURRENT_IN] = 0;
+ data->info.R[PSC_CURRENT_IN] = 2;
+ }
for (page = 0; page < 16; page++) {
rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
@@ -251,16 +275,30 @@ static int max34451_set_supported_funcs(struct i2c_client *client,
case 0x20:
data->info.func[page] = PMBUS_HAVE_VOUT |
PMBUS_HAVE_STATUS_VOUT;
+
+ if (max34451_na6)
+ data->info.func[page] |= PMBUS_HAVE_VIN |
+ PMBUS_HAVE_STATUS_INPUT;
break;
case 0x21:
data->info.func[page] = PMBUS_HAVE_VOUT;
+
+ if (max34451_na6)
+ data->info.func[page] |= PMBUS_HAVE_VIN;
break;
case 0x22:
data->info.func[page] = PMBUS_HAVE_IOUT |
PMBUS_HAVE_STATUS_IOUT;
+
+ if (max34451_na6)
+ data->info.func[page] |= PMBUS_HAVE_IIN |
+ PMBUS_HAVE_STATUS_INPUT;
break;
case 0x23:
data->info.func[page] = PMBUS_HAVE_IOUT;
+
+ if (max34451_na6)
+ data->info.func[page] |= PMBUS_HAVE_IIN;
break;
default:
break;
@@ -494,6 +532,7 @@ static int max34440_probe(struct i2c_client *client)
return -ENOMEM;
data->id = i2c_match_id(max34440_id, client)->driver_data;
data->info = max34440_info[data->id];
+ data->pmbus_addr_fixed = false;
if (data->id == max34451) {
rv = max34451_set_supported_funcs(client, data);
@@ -501,6 +540,14 @@ static int max34440_probe(struct i2c_client *client)
return rv;
}
+ if (data->pmbus_addr_fixed) {
+ data->iout_oc_fault_limit = PMBUS_IOUT_OC_FAULT_LIMIT;
+ data->iout_oc_warn_limit = PMBUS_IOUT_OC_WARN_LIMIT;
+ } else {
+ data->iout_oc_fault_limit = MAX34440_IOUT_OC_FAULT_LIMIT;
+ data->iout_oc_warn_limit = MAX34440_IOUT_OC_WARN_LIMIT;
+ }
+
return pmbus_do_probe(client, &data->info);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] hwmon: (pmbus/max3440): add support adpm12160
2025-04-03 5:16 [PATCH v2 0/2] Add support for ADPM12160 a DC/DC Power Module Alexis Czezar Torreno
2025-04-03 5:16 ` [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451 Alexis Czezar Torreno
@ 2025-04-03 5:16 ` Alexis Czezar Torreno
1 sibling, 0 replies; 5+ messages in thread
From: Alexis Czezar Torreno @ 2025-04-03 5:16 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Delphine CC Chiu
Cc: linux-hwmon, linux-doc, linux-kernel, linux-i2c,
Alexis Czezar Torreno
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.
Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
---
Documentation/hwmon/max34440.rst | 30 ++++++++++++++++------
drivers/hwmon/pmbus/max34440.c | 54 +++++++++++++++++++++++++++++++++++++---
2 files changed, 73 insertions(+), 11 deletions(-)
diff --git a/Documentation/hwmon/max34440.rst b/Documentation/hwmon/max34440.rst
index 162d289f08140341e8e76ab7033834ba07a8b935..8591a7152ce580a04b6965301f9bacd9b0a1a661 100644
--- a/Documentation/hwmon/max34440.rst
+++ b/Documentation/hwmon/max34440.rst
@@ -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 <linux@roeck-us.net>
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.
@@ -128,7 +137,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
~~~~
@@ -150,6 +162,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
~~~~~
@@ -185,6 +198,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::
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index 585746806663409bc97042647f6c0aba4c6f520a..2e9c5756fbf3b79f16fe038e8ccf15cfba90d08d 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -14,7 +14,15 @@
#include <linux/i2c.h>
#include "pmbus.h"
-enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };
+enum chips {
+ adpm12160,
+ max34440,
+ max34441,
+ max34446,
+ max34451,
+ max34460,
+ max34461,
+};
#define MAX34440_MFR_VOUT_PEAK 0xd4
#define MAX34440_MFR_IOUT_PEAK 0xd5
@@ -81,7 +89,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 != adpm12160)
return -ENXIO;
ret = pmbus_read_word_data(client, page, phase,
MAX34446_MFR_IOUT_AVG);
@@ -165,7 +174,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 == adpm12160))
ret = pmbus_write_word_data(client, page,
MAX34446_MFR_IOUT_AVG, 0);
@@ -309,6 +319,41 @@ static int max34451_set_supported_funcs(struct i2c_client *client,
}
static struct pmbus_driver_info max34440_info[] = {
+ [adpm12160] = {
+ .pages = 19,
+ .format[PSC_VOLTAGE_IN] = direct,
+ .format[PSC_VOLTAGE_OUT] = direct,
+ .format[PSC_CURRENT_IN] = direct,
+ .format[PSC_CURRENT_OUT] = direct,
+ .format[PSC_TEMPERATURE] = direct,
+ .m[PSC_VOLTAGE_IN] = 1,
+ .b[PSC_VOLTAGE_IN] = 0,
+ .R[PSC_VOLTAGE_IN] = 0,
+ .m[PSC_VOLTAGE_OUT] = 1,
+ .b[PSC_VOLTAGE_OUT] = 0,
+ .R[PSC_VOLTAGE_OUT] = 0,
+ .m[PSC_CURRENT_IN] = 1,
+ .b[PSC_CURRENT_IN] = 0,
+ .R[PSC_CURRENT_IN] = 2,
+ .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,
+ /* absent func below [18] are not for monitoring */
+ .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
+ .func[4] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
+ .func[5] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
+ .func[6] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
+ .func[7] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
+ .func[8] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
+ .func[9] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT,
+ .func[10] = PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT,
+ .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
+ .read_word_data = max34440_read_word_data,
+ .write_word_data = max34440_write_word_data,
+ },
[max34440] = {
.pages = 14,
.format[PSC_VOLTAGE_IN] = direct,
@@ -538,6 +583,8 @@ static int max34440_probe(struct i2c_client *client)
rv = max34451_set_supported_funcs(client, data);
if (rv)
return rv;
+ } else if (data->id == adpm12160) {
+ data->pmbus_addr_fixed = true;
}
if (data->pmbus_addr_fixed) {
@@ -552,6 +599,7 @@ static int max34440_probe(struct i2c_client *client)
}
static const struct i2c_device_id max34440_id[] = {
+ {"adpm12160", adpm12160},
{"max34440", max34440},
{"max34441", max34441},
{"max34446", max34446},
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451
2025-04-03 5:16 ` [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451 Alexis Czezar Torreno
@ 2025-04-03 16:32 ` Guenter Roeck
2025-04-04 0:28 ` Torreno, Alexis Czezar
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2025-04-03 16:32 UTC (permalink / raw)
To: Alexis Czezar Torreno
Cc: Jean Delvare, Jonathan Corbet, Delphine CC Chiu, linux-hwmon,
linux-doc, linux-kernel, linux-i2c
On Thu, Apr 03, 2025 at 01:16:18PM +0800, Alexis Czezar Torreno wrote:
> 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 <alexisczezar.torreno@analog.com>
> ---
> drivers/hwmon/pmbus/max34440.c | 55 +++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 51 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
> index c9dda33831ff24e7b5e2fd1956a65e6bd2bfcbb9..585746806663409bc97042647f6c0aba4c6f520a 100644
> --- a/drivers/hwmon/pmbus/max34440.c
> +++ b/drivers/hwmon/pmbus/max34440.c
> @@ -34,16 +34,22 @@ 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
>
> +#define MAX34451ETNA6_MFR_REV 0x0012
> +
> #define MAX34451_MFR_CHANNEL_CONFIG 0xe4
> #define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3f
>
> struct max34440_data {
> int id;
> struct pmbus_driver_info info;
> + bool pmbus_addr_fixed;
Unnecessary. See below.
> + u32 iout_oc_warn_limit;
> + u32 iout_oc_fault_limit;
u8 would be sufficient.
> };
>
> #define to_max34440_data(x) container_of(x, struct max34440_data, info)
> @@ -60,11 +66,11 @@ 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);
> + data->iout_oc_fault_limit);
> break;
> case PMBUS_IOUT_OC_WARN_LIMIT:
> ret = pmbus_read_word_data(client, page, phase,
> - MAX34440_IOUT_OC_WARN_LIMIT);
> + data->iout_oc_warn_limit);
> break;
> case PMBUS_VIRT_READ_VOUT_MIN:
> ret = pmbus_read_word_data(client, page, phase,
> @@ -133,11 +139,11 @@ 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,
> + ret = pmbus_write_word_data(client, page, data->iout_oc_fault_limit,
> word);
> break;
> case PMBUS_IOUT_OC_WARN_LIMIT:
> - ret = pmbus_write_word_data(client, page, MAX34440_IOUT_OC_WARN_LIMIT,
> + ret = pmbus_write_word_data(client, page, data->iout_oc_warn_limit,
> word);
> break;
> case PMBUS_VIRT_RESET_POUT_HISTORY:
> @@ -235,6 +241,24 @@ static int max34451_set_supported_funcs(struct i2c_client *client,
> */
>
> int page, rv;
> + bool max34451_na6 = false;
> +
> + rv = i2c_smbus_read_word_data(client, PMBUS_MFR_REVISION);
> + if (rv < 0)
> + return rv;
> +
> + if (rv == MAX34451ETNA6_MFR_REV) {
Sure that this is only one revision ?
Would it be better to use ">=" instead of "==" ?
> + max34451_na6 = true;
> + data->pmbus_addr_fixed = true;
> + data->info.format[PSC_VOLTAGE_IN] = direct;
> + data->info.format[PSC_CURRENT_IN] = direct;
> + data->info.m[PSC_VOLTAGE_IN] = 1;
> + data->info.b[PSC_VOLTAGE_IN] = 0;
> + data->info.R[PSC_VOLTAGE_IN] = 3;
> + data->info.m[PSC_CURRENT_IN] = 1;
> + data->info.b[PSC_CURRENT_IN] = 0;
> + data->info.R[PSC_CURRENT_IN] = 2;
Assign register addresses directly here.
data->iout_oc_fault_limit = PMBUS_IOUT_OC_FAULT_LIMIT;
data->iout_oc_warn_limit = PMBUS_IOUT_OC_WARN_LIMIT;
} else {
data->iout_oc_fault_limit = MAX34440_IOUT_OC_FAULT_LIMIT;
data->iout_oc_warn_limit = MAX34440_IOUT_OC_WARN_LIMIT;
> + }
Thanks,
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451
2025-04-03 16:32 ` Guenter Roeck
@ 2025-04-04 0:28 ` Torreno, Alexis Czezar
0 siblings, 0 replies; 5+ messages in thread
From: Torreno, Alexis Czezar @ 2025-04-04 0:28 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jean Delvare, Jonathan Corbet, Delphine CC Chiu,
linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Friday, April 4, 2025 12:33 AM
> To: Torreno, Alexis Czezar <AlexisCzezar.Torreno@analog.com>
> Cc: Jean Delvare <jdelvare@suse.com>; Jonathan Corbet <corbet@lwn.net>;
> Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>; linux-
> hwmon@vger.kernel.org; linux-doc@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-i2c@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for
> max34451
>
> [External]
>
> On Thu, Apr 03, 2025 at 01:16:18PM +0800, Alexis Czezar Torreno wrote:
> > 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 <alexisczezar.torreno@analog.com>
> > ---
> > drivers/hwmon/pmbus/max34440.c | 55
> > +++++++++++++++++++++++++++++++++++++++---
> > 1 file changed, 51 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/hwmon/pmbus/max34440.c
> > b/drivers/hwmon/pmbus/max34440.c index
> >
> c9dda33831ff24e7b5e2fd1956a65e6bd2bfcbb9..585746806663409bc970426
> 47f6c
> > 0aba4c6f520a 100644
> > --- a/drivers/hwmon/pmbus/max34440.c
> > +++ b/drivers/hwmon/pmbus/max34440.c
> > @@ -34,16 +34,22 @@ 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
> >
> > +#define MAX34451ETNA6_MFR_REV 0x0012
> > +
> > #define MAX34451_MFR_CHANNEL_CONFIG 0xe4
> > #define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3f
> >
> > struct max34440_data {
> > int id;
> > struct pmbus_driver_info info;
> > + bool pmbus_addr_fixed;
>
> Unnecessary. See below.
>
> > + u32 iout_oc_warn_limit;
> > + u32 iout_oc_fault_limit;
>
> u8 would be sufficient.
Will change
>
> > };
> >
> > #define to_max34440_data(x) container_of(x, struct max34440_data,
> > info) @@ -60,11 +66,11 @@ 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);
> > + data->iout_oc_fault_limit);
> > break;
> > case PMBUS_IOUT_OC_WARN_LIMIT:
> > ret = pmbus_read_word_data(client, page, phase,
> > -
> MAX34440_IOUT_OC_WARN_LIMIT);
> > + data->iout_oc_warn_limit);
> > break;
> > case PMBUS_VIRT_READ_VOUT_MIN:
> > ret = pmbus_read_word_data(client, page, phase, @@ -133,11
> +139,11
> > @@ 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,
> > + ret = pmbus_write_word_data(client, page,
> > +data->iout_oc_fault_limit,
> > word);
> > break;
> > case PMBUS_IOUT_OC_WARN_LIMIT:
> > - ret = pmbus_write_word_data(client, page,
> MAX34440_IOUT_OC_WARN_LIMIT,
> > + ret = pmbus_write_word_data(client, page, data-
> >iout_oc_warn_limit,
> > word);
> > break;
> > case PMBUS_VIRT_RESET_POUT_HISTORY:
> > @@ -235,6 +241,24 @@ static int max34451_set_supported_funcs(struct
> i2c_client *client,
> > */
> >
> > int page, rv;
> > + bool max34451_na6 = false;
> > +
> > + rv = i2c_smbus_read_word_data(client, PMBUS_MFR_REVISION);
> > + if (rv < 0)
> > + return rv;
> > +
> > + if (rv == MAX34451ETNA6_MFR_REV) {
>
> Sure that this is only one revision ?
> Would it be better to use ">=" instead of "==" ?
Currently yes this is the only revision and the latest
It is nice to future proof this just in case so will change to >=
>
> > + max34451_na6 = true;
> > + data->pmbus_addr_fixed = true;
> > + data->info.format[PSC_VOLTAGE_IN] = direct;
> > + data->info.format[PSC_CURRENT_IN] = direct;
> > + data->info.m[PSC_VOLTAGE_IN] = 1;
> > + data->info.b[PSC_VOLTAGE_IN] = 0;
> > + data->info.R[PSC_VOLTAGE_IN] = 3;
> > + data->info.m[PSC_CURRENT_IN] = 1;
> > + data->info.b[PSC_CURRENT_IN] = 0;
> > + data->info.R[PSC_CURRENT_IN] = 2;
>
> Assign register addresses directly here.
Ah I see, will move.
Thanks!
>
> data->iout_oc_fault_limit = PMBUS_IOUT_OC_FAULT_LIMIT;
> data->iout_oc_warn_limit = PMBUS_IOUT_OC_WARN_LIMIT;
> } else {
> data->iout_oc_fault_limit =
> MAX34440_IOUT_OC_FAULT_LIMIT;
> data->iout_oc_warn_limit =
> MAX34440_IOUT_OC_WARN_LIMIT;
>
> > + }
>
> Thanks,
> Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-04 0:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 5:16 [PATCH v2 0/2] Add support for ADPM12160 a DC/DC Power Module Alexis Czezar Torreno
2025-04-03 5:16 ` [PATCH v2 1/2] hwmon: (pmbus/max34440): Fix support for max34451 Alexis Czezar Torreno
2025-04-03 16:32 ` Guenter Roeck
2025-04-04 0:28 ` Torreno, Alexis Czezar
2025-04-03 5:16 ` [PATCH v2 2/2] hwmon: (pmbus/max3440): add support adpm12160 Alexis Czezar Torreno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).