hwmon: Add driver for STMicroelectronics PM6764 Voltage Regulator
A message that is not in the archive (sent off-list or not yet received): [email protected]
Guenter Roeck
maintainerQuoted 6 lines · Charles
Add the pmbus driver for the STMicroelectronics pm6764 voltage regulator.
the output voltage use the
MFR_READ_VOUT0xD4
vout value returned is linear11Signed-off-by Charles Hsu <[email protected]>
This patch (again) didn't make it to any of the mailing lists. Please try to find out why this is the case. I usually pick up patches from https://patchwork.kernel.org/project/linux-hwmon/list/,
and may easily miss a patch if I can't find it there.
Quoted 35 lines
---
v5:
- AddMAINTAINERS
- Add a reference intotrivial-devices.yamlv4:
- Add pm6764tr toDocumentation/hwmon/index.rst. v3:
- Add Documentation(Documentation/hwmon/pm6764tr.rst).
- Fix include order.
v2:
- Fix formatting.
- Removepmbus_do_remove.
- Change from .probe to .probe_new.
v1:
- Initial patchset.---
.../devicetree/bindings/trivial-devices.yaml | 2 + Documentation/hwmon/index.rst | 1 + Documentation/hwmon/pm6764tr.rst | 33 ++++++++ MAINTAINERS | 7 ++ drivers/hwmon/pmbus/Kconfig | 9 +++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/pm6764tr.c | 76 +++++++++++++++++++ 7 files changed, 129 insertions(+) create mode 100644 Documentation/hwmon/pm6764tr.rst create mode 100644 drivers/hwmon/pmbus/pm6764tr.cDocumentation/devicetree/bindings/trivial-devices.yaml +0
-0
Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 355
Quoted 8 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2
-0@@ -348,6 +348,8 @@ properties: - socionext,synquacer-tpm-mmio # i2c serial eeprom (24cxx) - st,24c256 + # SMBus/I2C Voltage Regulator + - st,pm6764tr # Ambient Light Sensor with SMBUS/Two Wire Serial Interface - taos,tsl2550 # 8-Channels, 12-bit ADC
This, like all devicetre changes, needs to be a separate patch. Also, please make sure to copy dt maintainers and the dt mailing list when you send that patch.
Quoted 32 lines
Documentation/hwmon/index.rst +1
-0@@ -144,6 +144,7 @@ Hardware Monitoring Kernel Drivers pc87360 pc87427 pcf8591 + pm6764tr pmbus powr1220 pxe1610Documentation/hwmon/pm6764tr.rst new file +14
-0@@ -0,0 +1,33 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Kernel driver pm6764tr +====================== + +Supported chips: + + * ST PM6764TR + + Prefix: 'pm6764tr' + + Addresses scanned: - + + Datasheet: http://www.st.com/resource/en/data_brief/pm6764.pdf
Documentation/hwmon/pm6764tr.rst line 24
Quoted 10 lines
Documentation/hwmon/pm6764tr.rst new file +10
-0+ +Authors: + <[email protected]> + +Description: +------------ + +This driver supports the STMicroelectronics PM6764TR chip. The PM6764TR is a high +performance digital controller designed to power Intel’s VR12.5 processors and memories. +
Unrelated side note: I understand this means that you are forced to keep the datasheet under wraps, which in turn means I can not suggest functionality improvements since I don't have access to it. If the chip happens to support per-rail telemetry, you might want to consider adding support for that in a follow-up patch.
Documentation/hwmon/pm6764tr.rst line 31
Quoted 7 lines
Documentation/hwmon/pm6764tr.rst new file +7
-0+The device utilizes digital technology to implement all control and power management +functions to provide maximum flexibility and performance. The NVM is embedded to store +custom configurations. The PM6764TR device features up to 4-phase programmable operation. + +The PM6764TR supports power state transitions featuring VFDE, and programmable DPM +maintaining the best efficiency over all loading conditions without compromising transient +response. The device assures fast and independent protectionagainstload overcurrent,
"protectionagainstload" -> "protection against load"
Documentation/hwmon/pm6764tr.rst line 33
Quoted 2 lines
Documentation/hwmon/pm6764tr.rst new file +2
-0+under/overvoltage and feedback disconnections. +
Drop empty line at end.
MAINTAINERS M: Logan Gunthorpe <[email protected]> · line 13905
Quoted 7 lines
MAINTAINERS +0
-0@@ -13904,6 +13904,13 @@ M: Logan Gunthorpe <[email protected]> S: Maintained F: drivers/dma/plx_dma.c
Add empty line.
Quoted 15 lines
MAINTAINERS +7
-0+PM6764TR DRIVER +M: Charles Hsu <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/hwmon/pm6764tr.rst +F: drivers/hwmon/pmbus/pm6764tr.c + PM-GRAPH UTILITY M: "Todd E Brandt" <[email protected]> L: [email protected]drivers/hwmon/pmbus/Kconfig +0
-0
drivers/hwmon/pmbus/Kconfig config SENSORS_MP2975 · line 221
Quoted 2 lines
drivers/hwmon/pmbus/Kconfig +0
-0@@ -220,6 +220,15 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975.
Add empty line.
Quoted 109 lines
drivers/hwmon/pmbus/Kconfig +9
-0+config SENSORS_PM6764TR + tristate "ST PM6764TR" + help + If you say yes here you get hardware monitoring support for ST + PM6764TR. + + This driver can also be built as a module. If so, the module will + be called pm6764tr. + config SENSORS_PXE1610 tristate "Infineon PXE1610" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_SENSORS_MAX31785) += max31785.o obj-$(CONFIG_SENSORS_MAX34440) += max34440.o obj-$(CONFIG_SENSORS_MAX8688) += max8688.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o +obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o obj-$(CONFIG_SENSORS_TPS53679) += tps53679.odrivers/hwmon/pmbus/pm6764tr.c new file +76
-0@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Hardware monitoring driver for STMicroelectronics digital controller PM6764TR +*/ + +#include <linux/err.h> +#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pmbus.h> +#include "pmbus.h" + +#define PM6764TR_PMBUS_READ_VOUT 0xD4 + +static int pm6764tr_read_word_data (struct i2c_client *client,int page,int reg) +{ +int ret; + +switch (reg) { +case PMBUS_VIRT_READ_VMON : + ret =pmbus_read_word_data (client, page,PM6764TR_PMBUS_READ_VOUT ); +break ; +default : + ret = -ENODATA ; +break ; + } +return ret; +} + +static struct pmbus_driver_info pm6764tr_info = { + .pages =1 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = vid, + .format[PSC_TEMPERATURE ] = linear, + .format[PSC_CURRENT_OUT ] = linear, + .format[PSC_POWER ] = linear, + .func[0 ] =PMBUS_HAVE_VIN |PMBUS_HAVE_IIN |PMBUS_HAVE_PIN | +PMBUS_HAVE_IOUT |PMBUS_HAVE_POUT |PMBUS_HAVE_VMON | +PMBUS_HAVE_STATUS_IOUT |PMBUS_HAVE_STATUS_VOUT | +PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_TEMP , + .read_word_data = pm6764tr_read_word_data, +}; + +static int pm6764tr_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +return pmbus_do_probe (client, id, &pm6764tr_info); +} + +static const struct i2c_device_id pm6764tr_id[] = { + {"pm6764tr" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (i2c, pm6764tr_id); + +static const struct of_device_id pm6764tr_of_match[] = { + {.compatible ="st,pm6764tr" }, + {} +}; + +/* This is the driver that will be inserted */ +static struct i2c_driver pm6764tr_driver = { + .driver = { + .name ="pm6764tr" , + .of_match_table =of_match_ptr (pm6764tr_of_match), + }, + .probe_new = pm6764tr_probe, + .id_table = pm6764tr_id, +}; + +module_i2c_driver (pm6764tr_driver); + +MODULE_AUTHOR ("Charles Hsu" ); +MODULE_DESCRIPTION ("PMBus driver for ST PM6764TR" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
2.25.1
Quoted 42 lines · Guenter Roeck
Quoted 6 lines · Charles
Add the pmbus driver for the STMicroelectronics pm6764 voltage regulator.
the output voltage use the
MFR_READ_VOUT0xD4
vout value returned is linear11Signed-off-by Charles Hsu <[email protected]>This patch (again) didn't make it to any of the mailing lists. Please try to find out why this is the case. I usually pick up patches from https://patchwork.kernel.org/project/linux-hwmon/list/,
and may easily miss a patch if I can't find it there.Quoted 30 lines
---
v5:
- AddMAINTAINERS
- Add a reference intotrivial-devices.yaml
v4:
- Add pm6764tr toDocumentation/hwmon/index.rst.
v3:
- Add Documentation(Documentation/hwmon/pm6764tr.rst).
- Fix include order.
v2:
- Fix formatting.
- Removepmbus_do_remove.
- Change from .probe to .probe_new.
v1:
- Initial patchset.---
.../devicetree/bindings/trivial-devices.yaml | 2 + Documentation/hwmon/index.rst | 1 + Documentation/hwmon/pm6764tr.rst | 33 ++++++++ MAINTAINERS | 7 ++ drivers/hwmon/pmbus/Kconfig | 9 +++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/pm6764tr.c | 76 +++++++++++++++++++ 7 files changed, 129 insertions(+)create mode 100644
Documentation/hwmon/pm6764tr.rstcreate mode 100644drivers/hwmon/pmbus/pm6764tr.c
Quoted 16 lines
Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 355
Quoted 13 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2
-0@@ -348,6 +348,8 @@ properties: - socionext,synquacer-tpm-mmio # i2c serial eeprom (24cxx) - st,24c256 + # SMBus/I2C Voltage Regulator + - st,pm6764tr # Ambient Light Sensor with SMBUS/Two Wire Serial Interface - taos,tsl2550 # 8-Channels, 12-bit ADCThis, like all devicetre changes, needs to be a separate patch. Also, please make sure to copy dt maintainers and the dt mailing list when you send that patch.
Thank you for your suggestions.
I will send that patch as soon as possible.
Quoted 61 lines
Quoted 32 lines
Documentation/hwmon/index.rst +1
-0@@ -144,6 +144,7 @@ Hardware Monitoring Kernel Drivers pc87360 pc87427 pcf8591 + pm6764tr pmbus powr1220 pxe1610Documentation/hwmon/pm6764tr.rst new file +14
-0@@ -0,0 +1,33 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Kernel driver pm6764tr +====================== + +Supported chips: + + * ST PM6764TR + + Prefix: 'pm6764tr' + + Addresses scanned: - + + Datasheet: http://www.st.com/resource/en/data_brief/pm6764.pdfDocumentation/hwmon/pm6764tr.rst line 24
Quoted 10 lines
Documentation/hwmon/pm6764tr.rst new file +10
-0+ +Authors: + <[email protected]> + +Description: +------------ + +This driver supports the STMicroelectronics PM6764TR chip. The PM6764TR is a high +performance digital controller designed to power Intel’s VR12.5 processors and memories. +Unrelated side note: I understand this means that you are forced to keep the datasheet under wraps, which in turn means I can not suggest functionality improvements since I don't have access to it. If the chip happens to support per-rail telemetry, you might want to consider adding support for that in a follow-up patch.
Documentation/hwmon/pm6764tr.rst line 31
Quoted 7 lines
Documentation/hwmon/pm6764tr.rst new file +7
-0+The device utilizes digital technology to implement all control and power management +functions to provide maximum flexibility and performance. The NVM is embedded to store +custom configurations. The PM6764TR device features up to 4-phase programmable operation. + +The PM6764TR supports power state transitions featuring VFDE, and programmable DPM +maintaining the best efficiency over all loading conditions without compromising transient +response. The device assures fast and independent protectionagainstload overcurrent,"protectionagainstload" -> "protection against load"
Documentation/hwmon/pm6764tr.rst line 33
Quoted 2 lines
Documentation/hwmon/pm6764tr.rst new file +2
-0+under/overvoltage and feedback disconnections. +Drop empty line at end.
Quoted 8 lines
MAINTAINERS M: Logan Gunthorpe <[email protected]> · line 13905
Quoted 7 lines
MAINTAINERS +0
-0@@ -13904,6 +13904,13 @@ M: Logan Gunthorpe <[email protected]> S: Maintained F: drivers/dma/plx_dma.cAdd empty line.
There is an empty line here,
Should I add one more empty line?
Quoted 10 lines
Quoted 10 lines
MAINTAINERS +7
-0+PM6764TR DRIVER +M: Charles Hsu <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/hwmon/pm6764tr.rst +F: drivers/hwmon/pmbus/pm6764tr.c + PM-GRAPH UTILITY M: "Todd E Brandt" <[email protected]> L: [email protected]
Quoted 8 lines
drivers/hwmon/pmbus/Kconfig config SENSORS_MP2975 · line 221
Quoted 7 lines
drivers/hwmon/pmbus/Kconfig +0
-0@@ -220,6 +220,15 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975.Add empty line.
Same as above.
Quoted 109 lines
Quoted 109 lines
drivers/hwmon/pmbus/Kconfig +9
-0+config SENSORS_PM6764TR + tristate "ST PM6764TR" + help + If you say yes here you get hardware monitoring support for ST + PM6764TR. + + This driver can also be built as a module. If so, the module will + be called pm6764tr. + config SENSORS_PXE1610 tristate "Infineon PXE1610" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_SENSORS_MAX31785) += max31785.o obj-$(CONFIG_SENSORS_MAX34440) += max34440.o obj-$(CONFIG_SENSORS_MAX8688) += max8688.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o +obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o obj-$(CONFIG_SENSORS_TPS53679) += tps53679.odrivers/hwmon/pmbus/pm6764tr.c new file +76
-0@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Hardware monitoring driver for STMicroelectronics digital controller PM6764TR +*/ + +#include <linux/err.h> +#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pmbus.h> +#include "pmbus.h" + +#define PM6764TR_PMBUS_READ_VOUT 0xD4 + +static int pm6764tr_read_word_data (struct i2c_client *client,int page,int reg) +{ +int ret; + +switch (reg) { +case PMBUS_VIRT_READ_VMON : + ret =pmbus_read_word_data (client, page,PM6764TR_PMBUS_READ_VOUT ); +break ; +default : + ret = -ENODATA ; +break ; + } +return ret; +} + +static struct pmbus_driver_info pm6764tr_info = { + .pages =1 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = vid, + .format[PSC_TEMPERATURE ] = linear, + .format[PSC_CURRENT_OUT ] = linear, + .format[PSC_POWER ] = linear, + .func[0 ] =PMBUS_HAVE_VIN |PMBUS_HAVE_IIN |PMBUS_HAVE_PIN | +PMBUS_HAVE_IOUT |PMBUS_HAVE_POUT |PMBUS_HAVE_VMON | +PMBUS_HAVE_STATUS_IOUT |PMBUS_HAVE_STATUS_VOUT | +PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_TEMP , + .read_word_data = pm6764tr_read_word_data, +}; + +static int pm6764tr_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +return pmbus_do_probe (client, id, &pm6764tr_info); +} + +static const struct i2c_device_id pm6764tr_id[] = { + {"pm6764tr" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (i2c, pm6764tr_id); + +static const struct of_device_id pm6764tr_of_match[] = { + {.compatible ="st,pm6764tr" }, + {} +}; + +/* This is the driver that will be inserted */ +static struct i2c_driver pm6764tr_driver = { + .driver = { + .name ="pm6764tr" , + .of_match_table =of_match_ptr (pm6764tr_of_match), + }, + .probe_new = pm6764tr_probe, + .id_table = pm6764tr_id, +}; + +module_i2c_driver (pm6764tr_driver); + +MODULE_AUTHOR ("Charles Hsu" ); +MODULE_DESCRIPTION ("PMBus driver for ST PM6764TR" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
2.25.1
Guenter Roeck
maintainerQuoted 137 lines · Charles
Quoted 42 lines · Guenter Roeck
Quoted 6 lines · Charles
Add the pmbus driver for the STMicroelectronics pm6764 voltage regulator.
the output voltage use the
MFR_READ_VOUT0xD4
vout value returned is linear11Signed-off-by Charles Hsu <[email protected]>This patch (again) didn't make it to any of the mailing lists. Please try to find out why this is the case. I usually pick up patches from https://patchwork.kernel.org/project/linux-hwmon/list/,
and may easily miss a patch if I can't find it there.Quoted 30 lines
---
v5:
- AddMAINTAINERS
- Add a reference intotrivial-devices.yaml
v4:
- Add pm6764tr toDocumentation/hwmon/index.rst.
v3:
- Add Documentation(Documentation/hwmon/pm6764tr.rst).
- Fix include order.
v2:
- Fix formatting.
- Removepmbus_do_remove.
- Change from .probe to .probe_new.
v1:
- Initial patchset.---
.../devicetree/bindings/trivial-devices.yaml | 2 + Documentation/hwmon/index.rst | 1 + Documentation/hwmon/pm6764tr.rst | 33 ++++++++ MAINTAINERS | 7 ++ drivers/hwmon/pmbus/Kconfig | 9 +++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/pm6764tr.c | 76 +++++++++++++++++++ 7 files changed, 129 insertions(+)create mode 100644
Documentation/hwmon/pm6764tr.rstcreate mode 100644drivers/hwmon/pmbus/pm6764tr.cQuoted 16 lines
Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 355
Quoted 13 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2
-0@@ -348,6 +348,8 @@ properties: - socionext,synquacer-tpm-mmio # i2c serial eeprom (24cxx) - st,24c256 + # SMBus/I2C Voltage Regulator + - st,pm6764tr # Ambient Light Sensor with SMBUS/Two Wire Serial Interface - taos,tsl2550 # 8-Channels, 12-bit ADCThis, like all devicetre changes, needs to be a separate patch. Also, please make sure to copy dt maintainers and the dt mailing list when you send that patch.
Thank you for your suggestions.
I will send that patch as soon as possible.
Quoted 61 lines
Quoted 32 lines
Documentation/hwmon/index.rst +1
-0@@ -144,6 +144,7 @@ Hardware Monitoring Kernel Drivers pc87360 pc87427 pcf8591 + pm6764tr pmbus powr1220 pxe1610Documentation/hwmon/pm6764tr.rst new file +14
-0@@ -0,0 +1,33 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Kernel driver pm6764tr +====================== + +Supported chips: + + * ST PM6764TR + + Prefix: 'pm6764tr' + + Addresses scanned: - + + Datasheet: http://www.st.com/resource/en/data_brief/pm6764.pdfDocumentation/hwmon/pm6764tr.rst line 24
Quoted 10 lines
Documentation/hwmon/pm6764tr.rst new file +10
-0+ +Authors: + <[email protected]> + +Description: +------------ + +This driver supports the STMicroelectronics PM6764TR chip. The PM6764TR is a high +performance digital controller designed to power Intel’s VR12.5 processors and memories. +Unrelated side note: I understand this means that you are forced to keep the datasheet under wraps, which in turn means I can not suggest functionality improvements since I don't have access to it. If the chip happens to support per-rail telemetry, you might want to consider adding support for that in a follow-up patch.
Documentation/hwmon/pm6764tr.rst line 31
Quoted 7 lines
Documentation/hwmon/pm6764tr.rst new file +7
-0+The device utilizes digital technology to implement all control and power management +functions to provide maximum flexibility and performance. The NVM is embedded to store +custom configurations. The PM6764TR device features up to 4-phase programmable operation. + +The PM6764TR supports power state transitions featuring VFDE, and programmable DPM +maintaining the best efficiency over all loading conditions without compromising transient +response. The device assures fast and independent protectionagainstload overcurrent,"protectionagainstload" -> "protection against load"
Documentation/hwmon/pm6764tr.rst line 33
Quoted 2 lines
Documentation/hwmon/pm6764tr.rst new file +2
-0+under/overvoltage and feedback disconnections. +Drop empty line at end.
Quoted 8 lines
MAINTAINERS M: Logan Gunthorpe <[email protected]> · line 13905
Quoted 7 lines
MAINTAINERS +0
-0@@ -13904,6 +13904,13 @@ M: Logan Gunthorpe <[email protected]> S: Maintained F: drivers/dma/plx_dma.cAdd empty line.
Quoted 4 lines
There is an empty line here,
Should I add one more empty line?
One empty line is needed. Maybe I missed it. I am looking forward to the next version of your patch; then we'll see.
Thanks,
Guenter