Skip to contentSkip to conversation

Add MPS MP5920 Host-Swap controller

PATCH Applied Alex Vdovydchenko 6 participants 11 messages Jul 2, 2024 – Jul 3, 2024 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

v4 cover Add MPS MP5920 Host-Swap controller

This series of patches adds the MP5920 Host-swap controller, which is used as a protection and control IC for devices that are being inserted into a live backplane. MP5920 acts as a voltage regulator (MP5911 etc) supervisor. IC utilizes pmbus and provides monitoring, statistics and limits to electrical and thermal characteristics such as:
- input and output voltage
- output current
- output power
- IC temperature

One must take into account the nonlinear character of readings, so there will be a statistical error in the range 5–10 percents, depending on current passing through. In order to use the IC, make sure to specify a valid I2C address (consult to datasheet and dts-bindings)
MP5920 datasheet: https://www.monolithicpower.com/en/mp5920.html

Changes in v2:
- fixed typos
Changes in v3:

  -  removed unnecessary license blob
  -  removed unnecessary headers
  -  edited device tables style
  -  added chip name checking in probing
  -  fixed typos in pmbus_driver_info struct initialization
Changes in v4:
  -  added i2c_check_functionality in probing
  -  refactored usage of dev_err_probe insted of dev_err
  -  edited chip name string handling while printing
  -  restored .driver.of_match_table, keeping i2c_driver "old" style

Alex Vdovydchenko (2):
dt-bindings: hwmon: Add MPS mp5920
hwmon: add MP5920 driver

 .../devicetree/bindings/trivial-devices.yaml  |  2 +
 Documentation/hwmon/index.rst                 |  1 +
 Documentation/hwmon/mp5920.rst                | 91 ++++++++++++++++++
 drivers/hwmon/pmbus/Kconfig                   |  9 ++
 drivers/hwmon/pmbus/Makefile                  |  1 +
 drivers/hwmon/pmbus/mp5920.c                  | 93 +++++++++++++++++++
 6 files changed, 197 insertions(+)
 create mode 100644 Documentation/hwmon/mp5920.rst
 create mode 100644 drivers/hwmon/pmbus/mp5920.c
Signature · 1 line
2.43.0
#2 lore raw

PATCH v4 1/2 dt-bindings: hwmon: Add MPS mp5920

Add support for MPS mp5920 controller

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index ff70f0926..cb2fc26d9 100644
@@ -296,6 +296,8 @@ properties:
           - mps,mp2975
             # Monolithic Power Systems Inc. multi-phase controller mp2993
           - mps,mp2993
+            # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5920
+          - mps,mp5920
             # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
           - mps,mp5990
             # Monolithic Power Systems Inc. digital step-down converter mp9941
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v4 1/2] dt-bindings: hwmon: Add MPS mp5920

Quoted 3 lines · Alex Vdovydchenko

Add support for MPS mp5920 controller

So you keep ignoring and ignoring?

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions, under or above your Signed-off-by tag. Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.5-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v4 1/2] dt-bindings: hwmon: Add MPS mp5920

Quoted 7 lines · Guenter Roeck
Quoted 4 lines · Alex Vdovydchenko

Add support for MPS mp5920 controller

---

Applied, after adding Conor's Ack from v3.

Thanks :)

#6 lore raw

PATCH v4 2/2 hwmon: add MP5920 driver

In reply to Alex Vdovydchenko

Add support for MPS Hot-Swap controller mp5920. This driver exposes telemetry and limit value readings and writings.

---
 Documentation/hwmon/index.rst  |  1 +
 Documentation/hwmon/mp5920.rst | 91 +++++++++++++++++++++++++++++++++
 drivers/hwmon/pmbus/Kconfig    |  9 ++++
 drivers/hwmon/pmbus/Makefile   |  1 +
 drivers/hwmon/pmbus/mp5920.c   | 93 ++++++++++++++++++++++++++++++++++
 5 files changed, 195 insertions(+)
 create mode 100644 Documentation/hwmon/mp5920.rst
 create mode 100644 drivers/hwmon/pmbus/mp5920.c
Documentation/hwmon/index.rst +1 -0
index e92a3d5c7..9eba7e402 100644
@@ -168,6 +168,7 @@ Hardware Monitoring Kernel Drivers
    mp2975
    mp2993
    mp5023
+   mp5920
    mp5990
    mp9941
    mpq8785
Documentation/hwmon/mp5920.rst new file +91 -0

91 lines not on this page · raw message

drivers/hwmon/pmbus/Kconfig +9 -0
@@ -371,6 +371,15 @@ config SENSORS_MP5023
 	  This driver can also be built as a module. If so, the module will
 	  be called mp5023.
 
+config SENSORS_MP5920
+	tristate "MPS MP5920"
+	help
+	  If you say yes here you get hardware monitoring support for Monolithic
+	  MP5920.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called mp5920.
+
 config SENSORS_MP5990
 	tristate "MPS MP5990"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_SENSORS_MP2888)	+= mp2888.o
 obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
 obj-$(CONFIG_SENSORS_MP2993)	+= mp2993.o
 obj-$(CONFIG_SENSORS_MP5023)	+= mp5023.o
+obj-$(CONFIG_SENSORS_MP5920)	+= mp5920.o
 obj-$(CONFIG_SENSORS_MP5990)	+= mp5990.o
 obj-$(CONFIG_SENSORS_MP9941)	+= mp9941.o
 obj-$(CONFIG_SENSORS_MPQ7932)	+= mpq7932.o
drivers/hwmon/pmbus/mp5920.c new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v4 2/2
#7 lore raw

Re: [PATCH v4 2/2] hwmon: add MP5920 driver

Quoted 4 lines · Alex Vdovydchenko

Add support for MPS Hot-Swap controller mp5920. This driver exposes telemetry and limit value readings and writings.

Quoted 9 lines
---
 Documentation/hwmon/index.rst  |  1 +
 Documentation/hwmon/mp5920.rst | 91 +++++++++++++++++++++++++++++++++
 drivers/hwmon/pmbus/Kconfig    |  9 ++++
 drivers/hwmon/pmbus/Makefile   |  1 +
 drivers/hwmon/pmbus/mp5920.c   | 93 ++++++++++++++++++++++++++++++++++
 5 files changed, 195 insertions(+)
 create mode 100644 Documentation/hwmon/mp5920.rst
 create mode 100644 drivers/hwmon/pmbus/mp5920.c

The entry in MAINTAINERS seems to be missing.

Otherwise:

<snip>

maintainer
#8 lore raw

Re: [PATCH v4 2/2] hwmon: add MP5920 driver

Quoted 15 lines · Thomas Weißschuh
Quoted 11 lines · Alex Vdovydchenko

Add support for MPS Hot-Swap controller mp5920. This driver exposes telemetry and limit value readings and writings.

---
  Documentation/hwmon/index.rst  |  1 +
  Documentation/hwmon/mp5920.rst | 91 +++++++++++++++++++++++++++++++++
  drivers/hwmon/pmbus/Kconfig    |  9 ++++
  drivers/hwmon/pmbus/Makefile   |  1 +
  drivers/hwmon/pmbus/mp5920.c   | 93 ++++++++++++++++++++++++++++++++++
  5 files changed, 195 insertions(+)
Quoted 2 lines

create mode 100644 Documentation/hwmon/mp5920.rst create mode 100644 drivers/hwmon/pmbus/mp5920.c

Quoted 2 lines

The entry in MAINTAINERS seems to be missing.

That isn't mandatory; checkpatch asks for it, but I prefer not to have it in the first place if the submitter doesn't really plan to maintain it.

Quoted 4 lines

Otherwise:

Thanks,
Guenter

#10 lore raw

Re: [PATCH v4 2/2] hwmon: add MP5920 driver

In reply to Alex Vdovydchenko
kernel test robot noticed the following build warnings:

Hi Alex,

kernel test robot noticed the following build warnings:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on next-20240702]
[cannot apply to robh/for-next krzk-dt/for-next linus/master v6.10-rc6] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alex-Vdovydchenko/dt-bindings-hwmon-Add-MPS-mp5920/20240702-202656
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20240702115252.981416-3-xzeol%40yahoo.com
patch subject: [PATCH v4 2/2] hwmon: add MP5920 driver
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240703/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240703/[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 warnings (new ones prefixed by >>):

drivers/hwmon/pmbus/mp5920.c: In function 'mp5920_probe':

>> drivers/hwmon/pmbus/mp5920.c:49:62: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
      49 |                 return dev_err_probe(dev, -ENODEV, "Model '%.*s' not supported\n",
         |                                                            ~~^~
         |                                                              |
         |                                                              int
      50 |                                      sizeof(buf), buf);
         |                                      ~~~~~~~~~~~              
         |                                      |
         |                                      long unsigned int

vim +49 drivers/hwmon/pmbus/mp5920.c

    33	
    34	static int mp5920_probe(struct i2c_client *client)
    35	{
    36		struct device *dev =  &client->dev;
    37		int ret;
    38		u8 buf[I2C_SMBUS_BLOCK_MAX];
    39	
    40		if (!i2c_check_functionality(client->adapter,
    41					     I2C_FUNC_SMBUS_READ_WORD_DATA))
    42			return -ENODEV;
    43	
    44		ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
    45		if (ret < 0)
    46			return dev_err_probe(dev, ret, "Failed to read PMBUS_MFR_MODEL\n");
    47	
    48		if (ret != 6 || strncmp(buf, "MP5920", 6)) {
  > 49			return dev_err_probe(dev, -ENODEV, "Model '%.*s' not supported\n",
    50					     sizeof(buf), buf);
    51		}
    52	
    53		return pmbus_do_probe(client, &mp5920_info);
    54	}
    55	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#11 lore raw

Re: [PATCH v4 2/2] hwmon: add MP5920 driver

In reply to Alex Vdovydchenko
kernel test robot noticed the following build warnings:

Hi Alex,

kernel test robot noticed the following build warnings:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on next-20240702]
[cannot apply to robh/for-next krzk-dt/for-next linus/master v6.10-rc6] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alex-Vdovydchenko/dt-bindings-hwmon-Add-MPS-mp5920/20240702-202656
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20240702115252.981416-3-xzeol%40yahoo.com
patch subject: [PATCH v4 2/2] hwmon: add MP5920 driver
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20240703/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 326ba38a991250a8587a399a260b0f7af2c9166a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240703/[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 warnings (new ones prefixed by >>):

In file included from drivers/hwmon/pmbus/mp5920.c:2:
In file included from include/linux/i2c.h:13:
In file included from include/linux/acpi.h:39:
In file included from include/acpi/acpi_io.h:7:
In file included from arch/arm64/include/asm/acpi.h:14:
In file included from include/linux/memblock.h:12:
In file included from include/linux/mm.h:2253:
include/linux/vmstat.h:500:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]

     500 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     501 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:507:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     507 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     508 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:519:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     519 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     520 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:528:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     528 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     529 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/hwmon/pmbus/mp5920.c:49:48: warning: field precision should have type 'int', but argument has type 'unsigned long' [-Wformat]
      49 |                 return dev_err_probe(dev, -ENODEV, "Model '%.*s' not supported\n",
         |                                                            ~~^~
      50 |                                      sizeof(buf), buf);
         |                                      ~~~~~~~~~~~

6 warnings generated.

vim +49 drivers/hwmon/pmbus/mp5920.c

    33	
    34	static int mp5920_probe(struct i2c_client *client)
    35	{
    36		struct device *dev =  &client->dev;
    37		int ret;
    38		u8 buf[I2C_SMBUS_BLOCK_MAX];
    39	
    40		if (!i2c_check_functionality(client->adapter,
    41					     I2C_FUNC_SMBUS_READ_WORD_DATA))
    42			return -ENODEV;
    43	
    44		ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
    45		if (ret < 0)
    46			return dev_err_probe(dev, ret, "Failed to read PMBUS_MFR_MODEL\n");
    47	
    48		if (ret != 6 || strncmp(buf, "MP5920", 6)) {
  > 49			return dev_err_probe(dev, -ENODEV, "Model '%.*s' not supported\n",
    50					     sizeof(buf), buf);
    51		}
    52	
    53		return pmbus_do_probe(client, &mp5920_info);
    54	}
    55	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki