Skip to contentSkip to conversation

Add support for MPS Multi-phase mp2888 controller

PATCH In review Vadim Pasternak 3 participants 8 messages May 11, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v7 cover Add support for MPS Multi-phase mp2888 controller

Add driver and documentation for mp2888 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a digital, multi-phase, pulse-width modulation controller.

Patch set includes:
Patch #1 - increases maximum number of phases. Patch #2 - provides mp2888 driver and documentation. Patch #3 - providesy binding documentation.

Vadim Pasternak (3):
hwmon: (pmbus) Increase maximum number of phases per page
hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller
dt-bindings: Add MP2888 voltage regulator device

 .../devicetree/bindings/trivial-devices.yaml       |   2 +
 Documentation/hwmon/mp2888.rst                     | 113 ++++++
 drivers/hwmon/pmbus/Kconfig                        |   9 +
 drivers/hwmon/pmbus/Makefile                       |   1 +
 drivers/hwmon/pmbus/mp2888.c                       | 407 +++++++++++++++++++++
 drivers/hwmon/pmbus/pmbus.h                        |   2 +-
 6 files changed, 533 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/hwmon/mp2888.rst
 create mode 100644 drivers/hwmon/pmbus/mp2888.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v7 1/3 hwmon: (pmbus) Increase maximum number of phases per page

Increase maximum number of phases from 8 to 10 to support multi-phase devices allowing up to 10 phases.

---
 drivers/hwmon/pmbus/pmbus.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus.h +1 -1
index 4c30ec89f5bf..fd43873011a4 100644
@@ -375,7 +375,7 @@ enum pmbus_sensor_classes {
 };
 
 #define PMBUS_PAGES	32	/* Per PMBus specification */
-#define PMBUS_PHASES	8	/* Maximum number of phases per page */
+#define PMBUS_PHASES	10	/* Maximum number of phases per page */
 
 /* Functionality bit mask */
 #define PMBUS_HAVE_VIN		BIT(0)
Signature · 1 line
2.11.0
#2 lore raw

PATCH v7 2/3 hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller

In reply to Vadim Pasternak

Add support for mp2888 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a digital, multi-phase, pulse-width modulation controller.

This device supports:
- One power rail.
- Programmable Multi-Phase up to 10 Phases.
- PWM-VID Interface
- One pages 0 for telemetry.
- Programmable pins for PMBus Address.
- Built-In EEPROM to Store Custom Configurations.
- Can configured VOUT readout in direct or VID format and allows setting of different formats on rails 1 and 2. For VID the following protocols are available: VR13 mode with 5-mV DAC; VR13 mode with 10-mV DAC, IMVP9 mode with 5-mV DAC.

---
v6->v7
Comments pointed out by Guenter:
- Remove unnecessary typecasts from mp2888_write_word_data().
- Remove disabling of non-configured phases from

    mp2888_identify_multiphase().

v5->v6
Comments pointed out by Guenter:
- Fix comments for limits in mp2888_read_word_data().
- Remove unnecessary typecasts from mp2888_write_word_data().

v4->v5
Comments pointed out by Guenter:
- Fix calculation of PMBUS_READ_VIN.
- Add mp2888_write_word_data() for limits setting.
- Treat PMBUS_POUT_OP_WARN_LIMIT in separate case.
- Drop tuning of "m[PSC_POWER]" and "m[PSC_CURRENT_OUT]" from probing routine.
Fixes from Vadim:
- Treat PMBUS_IOUT_OC_WARN_LIMIT in separate case.

v3->v4
Comments pointed out by Guenter:
- Fix PMBUS_READ_VIN and limits calculations.
- Add comment for PMBUS_OT_WARN_LIMIT scaling.
- Fix PMBUS_READ_IOUT, PMBUS_READ_POUT, PMBUS_READ_PIN calculations.
- Enable PMBUS_IOUT_OC_WARN_LIMIT and PMBUS_POUT_OP_WARN_LIMIT.
Fixes from Vadim:
- Disable PMBUS_POUT_MAX. Device uses this register for different purpose.
- Disable PMBUS_MFR_VOU_MIN. Device doe not implement this register.
- Update documentation file.

v2->v3
Comments pointed out by Guenter:
- Fix precision for PMBUS_READ_VIN (it requires adding scale for PMBUS_VIN_OV_FAULT_LIMIT and PMBUS_VIN_UV_WARN_LIMIT.
- Fix precision for PMBUS_READ_TEMPERATURE_1 (it requires adding scale for PMBUS_OT_WARN_LIMIT).
- Use DIV_ROUND_CLOSEST_ULL for scaling PMBUS_READ_POUT, PMBUS_READ_PIN readouts.
Notes and fixes from Vadim:
- READ_IOUT in linear11 does not give write calculation (tested with external load), while in direct format readouts are correct.
- Disable non-configured phases in mp2888_identify_multiphase().

v1->v2:
Comments pointed out by Guenter:
- Use standard access for getting PMBUS_OT_WARN_LIMIT, PMBUS_VIN_OV_FAULT_LIMIT, PMBUS_VIN_UV_WARN_LIMIT.
- Use linear11 conversion for PMBUS_READ_VIN, PMBUS_READ_POUT, PMBUS_READ_PIN, PMBUS_READ_TEMPERATURE_1 and adjust coefficients.
- Add reading phases current from the dedicated registers.
- Add comment for not implemented or implemented not according to the spec registers, for which "ENXIO" code is returned.
- Set PMBUS_HAVE_IOUT" statically.
Notes from Vadim:
- READ_IOUT uses direct format, so I did not adjust it like the below registers.

---
 Documentation/hwmon/mp2888.rst | 113 ++++++++++++
 drivers/hwmon/pmbus/Kconfig    |   9 +
 drivers/hwmon/pmbus/Makefile   |   1 +
 drivers/hwmon/pmbus/mp2888.c   | 407 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 530 insertions(+)
 create mode 100644 Documentation/hwmon/mp2888.rst
 create mode 100644 drivers/hwmon/pmbus/mp2888.c
Documentation/hwmon/mp2888.rst new file +113 -0
new file mode 100644
index 000000000000..5e578fd7b147
@@ -0,0 +1,113 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver mp2888
+====================
+
+Supported chips:
+
+  * MPS MP12254
+
+    Prefix: 'mp2888'
+
+Author:
+
+	Vadim Pasternak <[email protected]>
+
+Description
+-----------
+
+This driver implements support for Monolithic Power Systems, Inc. (MPS)
+vendor dual-loop, digital, multi-phase controller MP2888.
+
+This device: supports:
+
+- One power rail.
+- Programmable Multi-Phase up to 10 Phases.
+- PWM-VID Interface
+- One pages 0 for telemetry.
+- Programmable pins for PMBus Address.
+- Built-In EEPROM to Store Custom Configurations.
+
+Device complaint with:
+
+- PMBus rev 1.3 interface.
+
+Device supports direct format for reading output current, output voltage,
+input and output power and temperature.
+Device supports linear format for reading input voltage and input power.
+
+The driver provides the next attributes for the current:
+
+- for current out input and maximum alarm;
+- for phase current: input and label.
+
+The driver exports the following attributes via the 'sysfs' files, where:
+
+- 'n' is number of configured phases (from 1 to 10);
+- index 1 for "iout";
+- indexes 2 ... 1 + n for phases.
+
+**curr[1-{1+n}]_input**
+
+**curr[1-{1+n}]_label**
+
+**curr1_max**
+
+**curr1_max_alarm**
+
+The driver provides the next attributes for the voltage:
+
+- for voltage in: input, low and high critical thresholds, low and high
+  critical alarms;
+- for voltage out: input and high alarm;
+
+The driver exports the following attributes via the 'sysfs' files, where
+
+**in1_crit**
+
+**in1_crit_alarm**
+
+**in1_input**
+
+**in1_label**
+
+**in1_min**
+
+**in1_min_alarm**
+
+**in2_alarm**
+
+**in2_input**
+
+**in2_label**
+
+The driver provides the next attributes for the power:
+
+- for power in alarm and input.
+- for power out: cap, cap alarm an input.
+
+The driver exports the following attributes via the 'sysfs' files, where
+- indexes 1 for "pin";
+- indexes 2 for "pout";
+
+**power1_alarm**
+
+**power1_input**
+
+**power1_label**
+
+**power2_input**
+
+**power2_label**
+
+**power2_max**
+
+**power2_max_alarm**
+
+The driver provides the next attributes for the temperature:
+
+**temp1_input**
+
+**temp1_max**
+
+**temp1_max_alarm**
drivers/hwmon/pmbus/Kconfig +9 -0
index 32d2fc850621..a57571928b31 100644
@@ -211,6 +211,15 @@ config SENSORS_MAX8688
 	  This driver can also be built as a module. If so, the module will
 	  be called max8688.
 
+config SENSORS_MP2888
+	tristate "MPS MP2888"
+	help
+	  If you say yes here you get hardware monitoring support for MPS
+	  MP2888 Digital, Multi-Phase, Pulse-Width Modulation Controller.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called mp2888.
+
 config SENSORS_MP2975
 	tristate "MPS MP2975"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 6a4ba0fdc1db..a6d7352621ca 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_SENSORS_MAX20751)	+= max20751.o
 obj-$(CONFIG_SENSORS_MAX31785)	+= max31785.o
 obj-$(CONFIG_SENSORS_MAX34440)	+= max34440.o
 obj-$(CONFIG_SENSORS_MAX8688)	+= max8688.o
+obj-$(CONFIG_SENSORS_MP2888)	+= mp2888.o
 obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
 obj-$(CONFIG_SENSORS_PM6764TR)	+= pm6764tr.o
 obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
drivers/hwmon/pmbus/mp2888.c new file +407 -0

407 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

Re: [PATCH hwmon-next v7 2/3] hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller

I love your patch! Yet something to improve:

Hi Vadim,

I love your patch! Yet something to improve:

[auto build test ERROR on hwmon/hwmon-next]
[also build test ERROR on robh/for-next v5.13-rc1 next-20210511] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vadim-Pasternak/Add-support-for-MPS-Multi-phase-mp2888-controller/20210511-135732
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: parisc-randconfig-p002-20210511 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/723c7109e7434586cc3eb429c230f778f761646b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vadim-Pasternak/Add-support-for-MPS-Multi-phase-mp2888-controller/20210511-135732 git checkout 723c7109e7434586cc3eb429c230f778f761646b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=parisc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: module mp2888 uses symbol pmbus_do_probe from namespace PMBUS, but does not import it.
>> ERROR: modpost: module mp2888 uses symbol pmbus_read_word_data from namespace PMBUS, but does not import it.
>> ERROR: modpost: module mp2888 uses symbol pmbus_write_word_data from namespace PMBUS, but does not import it.
>> ERROR: modpost: module mp2888 uses symbol pmbus_get_driver_info from namespace PMBUS, but does not import it.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#4 lore raw

PATCH v7 3/3 dt-bindings: Add MP2888 voltage regulator device

In reply to Vadim Pasternak

Monolithic Power Systems, Inc. (MPS) dual-loop, digital, multi-phase controller.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index a327130d1faa..4f6d149bfb3f 100644
@@ -98,6 +98,8 @@ properties:
           - fsl,mpl3115
             # MPR121: Proximity Capacitive Touch Sensor Controller
           - fsl,mpr121
+            # Monolithic Power Systems Inc. multi-phase controller mp2888
+          - mps,mp2888
             # Monolithic Power Systems Inc. multi-phase controller mp2975
           - mps,mp2975
             # G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
Signature · 1 line
2.11.0
maintainer
#5 lore raw
In reply to Vadim Pasternak
Quoted 9 lines · Vadim Pasternak

Add driver and documentation for mp2888 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a digital, multi-phase, pulse-width modulation controller.

Patch set includes:
Patch #1 - increases maximum number of phases. Patch #2 - provides mp2888 driver and documentation. Patch #3 - providesy binding documentation.

Series applied.

Thanks,
Guenter

#6 lore raw
Quoted 15 lines

-----Original Message-----
From: Guenter Roeck <[email protected]> On Behalf Of Guenter Roeck
Sent: Tuesday, May 11, 2021 4:32 PM
To: Vadim Pasternak <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH hwmon-next v7 0/3] Add support for MPS Multi-phase mp2888 controller

Quoted 4 lines · Vadim Pasternak

Add driver and documentation for mp2888 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a digital, multi-phase, pulse-width modulation controller.

Quoted 7 lines
Quoted 5 lines

Patch set includes:
Patch #1 - increases maximum number of phases. Patch #2 - provides mp2888 driver and documentation. Patch #3 - providesy binding documentation.

Series applied.

Thank you, Guenter.

I see from the following errors from robot:

Quoted 4 lines
Quoted 4 lines

ERROR: modpost: module mp2888 uses symbol pmbus_do_probe from namespace PMBUS, but does not import it.
ERROR: modpost: module mp2888 uses symbol pmbus_read_word_data from namespace PMBUS, but does not import it.
ERROR: modpost: module mp2888 uses symbol pmbus_write_word_data from namespace PMBUS, but does not import it.
ERROR: modpost: module mp2888 uses symbol pmbus_get_driver_info from namespace PMBUS, but does not import it.

What does it mean?

Quoted 3 lines

Thanks,
Guenter

maintainer
#7 lore raw
Quoted 25 lines · Vadim Pasternak
Quoted 15 lines

-----Original Message-----
From: Guenter Roeck <[email protected]> On Behalf Of Guenter Roeck
Sent: Tuesday, May 11, 2021 4:32 PM
To: Vadim Pasternak <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH hwmon-next v7 0/3] Add support for MPS Multi-phase mp2888 controller

Quoted 4 lines · Vadim Pasternak

Add driver and documentation for mp2888 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a digital, multi-phase, pulse-width modulation controller.

Quoted 7 lines
Quoted 5 lines

Patch set includes:
Patch #1 - increases maximum number of phases. Patch #2 - provides mp2888 driver and documentation. Patch #3 - providesy binding documentation.

Series applied.

Thank you, Guenter.

Quoted 8 lines

I see from the following errors from robot:

Quoted 4 lines
Quoted 4 lines

ERROR: modpost: module mp2888 uses symbol pmbus_do_probe from namespace PMBUS, but does not import it.
ERROR: modpost: module mp2888 uses symbol pmbus_read_word_data from namespace PMBUS, but does not import it.
ERROR: modpost: module mp2888 uses symbol pmbus_write_word_data from namespace PMBUS, but does not import it.
ERROR: modpost: module mp2888 uses symbol pmbus_get_driver_info from namespace PMBUS, but does not import it.

What does it mean?

It needs

MODULE_IMPORT_NS(PMBUS);

No worries, I'll fix it up.

Guenter