hwmon: (pmbus) Add support for MPS Multi-phase mp5023
Subsystems (2)
PATCH v2 1/1 hwmon: (pmbus) Add support for MPS Multi-phase mp5023
From: Howard Chiu <[email protected]>
Add support for mp5023 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a Hot-Swap Controller.
Link https://lore.kernel.org/r/HKAPR04MB400349AA406694FB976D78D096709@HKAPR04MB4003.apcprd04.prod.outlook.com open here
Signed-off-by Howard Chiu <[email protected]>
---
Change since v1:
- update commit message
- add lore link for reference
--- Documentation/hwmon/mp5023.rst | 84 ++++++++++++++++++++++++++++++++++ drivers/hwmon/pmbus/Kconfig | 9 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/mp5023.c | 66 ++++++++++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 Documentation/hwmon/mp5023.rst create mode 100644 drivers/hwmon/pmbus/mp5023.c
Documentation/hwmon/mp5023.rst new file +84 -0
@@ -0,0 +1,84 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver mp5023 +==================== + +Supported chips: + + * MPS MP5023 + + Prefix: 'mp5023' + + * Datasheet + + Publicly available at the MPS website : https://www.monolithicpower.com/en/mp5023.html + +Author: + + Howard Chiu <[email protected]> + +Description +----------- + +This driver implements support for Monolithic Power Systems, Inc. (MPS) +MP5023 Hot-Swap Controller. + +Device complaint with: + +- PMBus rev 1.3 interface. + +Device supports direct format for reading input voltage, output voltage, +output current, input power and temperature. + +The driver exports the following attributes via the 'sysfs' files +for input voltage: + +**in1_input** + +**in1_label** + +**in1_max** + +**in1_max_alarm** + +**in1_min** + +**in1_min_alarm** + +The driver provides the following attributes for output voltage: + +**in2_input** + +**in2_label** + +**in2_alarm** + +The driver provides the following attributes for output current: + +**curr1_input** + +**curr1_label** + +**curr1_alarm** + +**curr1_max** + +The driver provides the following attributes for input power: + +**power1_input** + +**power1_label** + +**power1_alarm** + +The driver provides the following attributes for temperature: + +**temp1_input** + +**temp1_max** + +**temp1_max_alarm** + +**temp1_crit** + +**temp1_crit_alarm**
drivers/hwmon/pmbus/Kconfig +9 -0
@@ -276,6 +276,15 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975. +config SENSORS_MP5023 + tristate "MPS MP5023" + help + If you say yes here you get hardware monitoring support for MPS + MP5023. + + This driver can also be built as a module. If so, the module will + be called mp5023. + config SENSORS_PIM4328 tristate "Flex PIM4328 and compatibles" help
drivers/hwmon/pmbus/Makefile +1 -0
@@ -31,6 +31,7 @@ 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_MP5023) += mp5023.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_Q54SJ108A2) += q54sj108a2.o
drivers/hwmon/pmbus/mp5023.c new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.17.1
Joel Stanley
AppliedQuoted 6 lines · Potin Lai
From: Howard Chiu <[email protected]>
Add support for mp5023 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a Hot-Swap Controller.
Quoted 7 lines
Link https://lore.kernel.org/r/HKAPR04MB400349AA406694FB976D78D096709@HKAPR04MB4003.apcprd04.prod.outlook.com open hereSigned-off-by Howard Chiu <[email protected]>---
Change since v1:
- update commit message
- add lore link for reference
Thanks, applied to dev-.5.15.
Quoted 206 lines
--- Documentation/hwmon/mp5023.rst | 84 ++++++++++++++++++++++++++++++++++ drivers/hwmon/pmbus/Kconfig | 9 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/mp5023.c | 66 ++++++++++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 Documentation/hwmon/mp5023.rst create mode 100644 drivers/hwmon/pmbus/mp5023.cDocumentation/hwmon/mp5023.rst new file +84
-0@@ -0,0 +1,84 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver mp5023 +==================== + +Supported chips: + + * MPS MP5023 + + Prefix: 'mp5023' + + * Datasheet + + Publicly available at the MPS website : https://www.monolithicpower.com/en/mp5023.html + +Author: + + Howard Chiu <[email protected]> + +Description +----------- + +This driver implements support for Monolithic Power Systems, Inc. (MPS) +MP5023 Hot-Swap Controller. + +Device complaint with: + +- PMBus rev 1.3 interface. + +Device supports direct format for reading input voltage, output voltage, +output current, input power and temperature. + +The driver exports the following attributes via the 'sysfs' files +for input voltage: + +**in1_input** + +**in1_label** + +**in1_max** + +**in1_max_alarm** + +**in1_min** + +**in1_min_alarm** + +The driver provides the following attributes for output voltage: + +**in2_input** + +**in2_label** + +**in2_alarm** + +The driver provides the following attributes for output current: + +**curr1_input** + +**curr1_label** + +**curr1_alarm** + +**curr1_max** + +The driver provides the following attributes for input power: + +**power1_input** + +**power1_label** + +**power1_alarm** + +The driver provides the following attributes for temperature: + +**temp1_input** + +**temp1_max** + +**temp1_max_alarm** + +**temp1_crit** + +**temp1_crit_alarm**drivers/hwmon/pmbus/Kconfig +9
-0@@ -276,6 +276,15 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975. +config SENSORS_MP5023 + tristate "MPS MP5023" + help + If you say yes here you get hardware monitoring support for MPS + MP5023. + + This driver can also be built as a module. If so, the module will + be called mp5023. + config SENSORS_PIM4328 tristate "Flex PIM4328 and compatibles" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -31,6 +31,7 @@ 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_MP5023) += mp5023.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_Q54SJ108A2) += q54sj108a2.odrivers/hwmon/pmbus/mp5023.c new file +66
-1@@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Driver for MPS MP5023 Hot-Swap Controller +*/ + +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include "pmbus.h" + +static struct pmbus_driver_info mp5023_info = { + .pages =1 , + + .format[PSC_VOLTAGE_IN ] = direct, + .format[PSC_VOLTAGE_OUT ] = direct, + .format[PSC_CURRENT_OUT ] = direct, + .format[PSC_POWER ] = direct, + .format[PSC_TEMPERATURE ] = direct, + + .m[PSC_VOLTAGE_IN ] =32 , + .b[PSC_VOLTAGE_IN ] =0 , + .R[PSC_VOLTAGE_IN ] =0 , + .m[PSC_VOLTAGE_OUT ] =32 , + .b[PSC_VOLTAGE_OUT ] =0 , + .R[PSC_VOLTAGE_OUT ] =0 , + .m[PSC_CURRENT_OUT ] =16 , + .b[PSC_CURRENT_OUT ] =0 , + .R[PSC_CURRENT_OUT ] =0 , + .m[PSC_POWER ] =1 , + .b[PSC_POWER ] =0 , + .R[PSC_POWER ] =0 , + .m[PSC_TEMPERATURE ] =2 , + .b[PSC_TEMPERATURE ] =0 , + .R[PSC_TEMPERATURE ] =0 , + + .func[0 ] = +PMBUS_HAVE_VIN |PMBUS_HAVE_VOUT |PMBUS_HAVE_PIN | +PMBUS_HAVE_TEMP |PMBUS_HAVE_IOUT | +PMBUS_HAVE_STATUS_INPUT |PMBUS_HAVE_STATUS_TEMP , +}; + +static int mp5023_probe (struct i2c_client *client) +{ +return pmbus_do_probe (client, &mp5023_info); +} + +static const struct of_device_id __maybe_unused mp5023_of_match[] = { + { .compatible ="mps,mp5023" , }, + {} +}; + +MODULE_DEVICE_TABLE (of, mp5023_of_match); + +static struct i2c_driver mp5023_driver = { + .driver = { + .name ="mp5023" , + .of_match_table =of_match_ptr (mp5023_of_match), + }, + .probe_new = mp5023_probe, +}; + +module_i2c_driver (mp5023_driver); + +MODULE_AUTHOR ("Howard Chiu <[email protected]>" ); +MODULE_DESCRIPTION ("PMBus driver for MPS MP5023 HSC" ); +MODULE_LICENSE ("GPL" ); --2.17.1