hwmon: Add support for MPS mp2985
[email protected]
maintainerv3 cover hwmon: Add support for MPS mp2985
From: Wensheng Wang <[email protected]>
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
Signature · 1 line
2.25.1
[email protected]
maintainerPATCH v3 1/2 dt-bindings: hwmon: Add MPS mp2985
From: Wensheng Wang <[email protected]>
Add support for MPS mp2985 controller.
---
v1 -> v2:
1. add Krzysztof's Acked-by
Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -325,6 +325,8 @@ properties: - mps,mp29612 # Monolithic Power Systems Inc. multi-phase controller mp29816 - mps,mp29816 + # Monolithic Power Systems Inc. multi-phase controller mp2985 + - mps,mp2985 # Monolithic Power Systems Inc. multi-phase controller mp2993 - mps,mp2993 # Monolithic Power Systems Inc. hot-swap protection device
Signature · 1 line
2.25.1
[email protected]
maintainerPATCH v3 2/2 hwmon: add MP2985 driver
From: Wensheng Wang <[email protected]>
Add support for MPS mp2985 controller. This driver exposes telemetry and limit value readings and writtings.
---
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. remove duplicate entry in mp2985.rst
2. clamp vout value to 32767
3. simplify the code for obtaining PMBUS_VOUT_MODE bit value
4. add comment for explaining MP2985 supported vout mode
5. switch back to previous page after obtaining vid scale to avoid confusing the PMBus core
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 +++++++++++++++++++++++++++++++++ 6 files changed, 544 insertions(+) create mode 100644 Documentation/hwmon/mp2985.rst create mode 100644 drivers/hwmon/pmbus/mp2985.c
Documentation/hwmon/index.rst +1 -0
@@ -183,6 +183,7 @@ Hardware Monitoring Kernel Drivers mp2925 mp29502 mp2975 + mp2985 mp2993 mp5023 mp5920
Documentation/hwmon/mp2985.rst new file +147 -0
147 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -17922,6 +17922,13 @@ S: Maintained F: Documentation/hwmon/mp29502.rst F: drivers/hwmon/pmbus/mp29502.c +MPS MP2985 DRIVER +M: Wensheng Wang <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/hwmon/mp2985.rst +F: drivers/hwmon/pmbus/mp2985.c + MPS MP2993 DRIVER M: Noah Wang <[email protected]> L: [email protected]
drivers/hwmon/pmbus/Kconfig +9 -0
@@ -447,6 +447,15 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975. +config SENSORS_MP2985 + tristate "MPS MP2985" + help + If you say yes here you get hardware monitoring support for MPS + MP2985 Dual Loop Digital Multi-Phase Controller. + + This driver can also be built as a module. If so, the module will + be called mp2985. + config SENSORS_MP2993 tristate "MPS MP2993" help
drivers/hwmon/pmbus/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-$(CONFIG_SENSORS_MP2891) += mp2891.o obj-$(CONFIG_SENSORS_MP2925) += mp2925.o obj-$(CONFIG_SENSORS_MP29502) += mp29502.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o +obj-$(CONFIG_SENSORS_MP2985) += mp2985.o obj-$(CONFIG_SENSORS_MP2993) += mp2993.o obj-$(CONFIG_SENSORS_MP5023) += mp5023.o obj-$(CONFIG_SENSORS_MP5920) += mp5920.o
drivers/hwmon/pmbus/mp2985.c new file +379 -0
379 lines not on this page · raw message
Signature · 1 line
2.25.1
Guenter Roeck
maintainerQuoted 4 lines · On 3/22/26 23:19, [email protected] wrote:
From: Wensheng Wang <[email protected]>
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