[PATCH v3 0/2] hwmon: Add support for MPS mp2985

wenswang@yeah.net posted 2 patches 1 week, 4 days ago
Only 1 patches received!
.../devicetree/bindings/trivial-devices.yaml  |   2 +
Documentation/hwmon/index.rst                 |   1 +
Documentation/hwmon/mp2985.rst                | 147 +++++++
MAINTAINERS                                   |   7 +
drivers/hwmon/pmbus/Kconfig                   |   9 +
drivers/hwmon/pmbus/Makefile                  |   1 +
drivers/hwmon/pmbus/mp2985.c                  | 379 ++++++++++++++++++
7 files changed, 546 insertions(+)
create mode 100644 Documentation/hwmon/mp2985.rst
create mode 100644 drivers/hwmon/pmbus/mp2985.c
[PATCH v3 0/2] hwmon: Add support for MPS mp2985
Posted by wenswang@yeah.net 1 week, 4 days ago
From: Wensheng Wang <wenswang@yeah.net>

Add mp2985 driver in hwmon and add dt-bindings for it.

V2 -> V3:
    1. The shifted mantissa be clamped to the range [-1024, 1023]
       before being masked in mp2985_linear_exp_transfer() function.
    2. The PMBUS_VOUT_OV_FAULT_LIMIT and PMBUS_VOUT_UV_FAULT_LIMIT
       value are clamped to 0xFFF before being written to the mp2985.
    3. Fix the vout scale issue for vout linear11 mode.

v1 -> v2:
    1. add Krzysztof's Acked-by
    2. remove duplicate entry in mp2985.rst
    3. clamp vout value to 32767
    4. simplify the code for obtaining PMBUS_VOUT_MODE bit value
    5. add comment for explaining MP2985 supported vout mode
    6. switch back to previous page after obtaining vid scale to avoid
       confusing the PMBus core

Wensheng Wang (2):
  dt-bindings: hwmon: Add MPS mp2985
  hwmon: add MP2985 driver

 .../devicetree/bindings/trivial-devices.yaml  |   2 +
 Documentation/hwmon/index.rst                 |   1 +
 Documentation/hwmon/mp2985.rst                | 147 +++++++
 MAINTAINERS                                   |   7 +
 drivers/hwmon/pmbus/Kconfig                   |   9 +
 drivers/hwmon/pmbus/Makefile                  |   1 +
 drivers/hwmon/pmbus/mp2985.c                  | 379 ++++++++++++++++++
 7 files changed, 546 insertions(+)
 create mode 100644 Documentation/hwmon/mp2985.rst
 create mode 100644 drivers/hwmon/pmbus/mp2985.c

-- 
2.25.1
Re: [PATCH v3 0/2] hwmon: Add support for MPS mp2985
Posted by Guenter Roeck 1 week, 4 days ago
On 3/22/26 23:19, wenswang@yeah.net wrote:
> From: Wensheng Wang <wenswang@yeah.net>
> 
> Add mp2985 driver in hwmon and add dt-bindings for it.
> 

AI feedback is here:

https://sashiko.dev/#/patchset/20260323062104.827263-1-wenswang%40yeah.net

Couple of comments:

- If the mantissa overflow can not happen, please add a comment into the code
   explaining the reason.

- EINVAL returns need to be explained. They should only be used
   if the chip can not handle reading unsupported registers, and a comment
   in the code needs to explain that.

- Ignore the concern about the chip being left on page 2 after an error
   reading MFR_VR_MULTI_CONFIG_R[12] for now. It makes me wonder if
   pmbus_init_common() should explicitly select page 0 for multi-page
   chips.

- The alignment of

+		ret = i2c_smbus_read_word_data(client, page == 0 ?
+									MFR_VR_MULTI_CONFIG_R1 :
+									MFR_VR_MULTI_CONFIG_R2);

still seems odd. Why the large indentation ?

Thanks,
Guenter