Skip to contentSkip to conversation

hwmon: (pmbus) Add ST STPDDC60 pmbus driver

PATCH Applied Erik Rosen 2 participants 5 messages Feb 18, 2021 – Mar 11, 2021

Subsystems (3)
lore
Share & tools
lore

Erik Rosen

author
#0 lore raw

v3 cover hwmon: (pmbus) Add ST STPDDC60 pmbus driver

This patch series adds hardware monitoring support for the ST STPDDC60 chip. The driver has been tested with a Flex BMR481 converter.

The checkpatch script complains about an unneeded paranthesis in an if-statement but gcc gives a warning if it is removed.

v3
stpddc60_get_offset:
-Change type from u8 to int for "offset" to avoid potential overflow in calculation -Simplify if-expression for checking limits

v2
-Remove "chips" enum since it is not used
-Remove stpddc60_vid2mv function
-Remove stpddc60_mv2l function
-Add stpddc60_get_offset function
-Add stpddc60_adjust_linear function
stpddc60_read_word_data:
-Return the value reported by MFR_READ_VOUT to avoid having to convert from VID -Add explanation why only 11 bits are used
stpddc60_write_word_data:
-Rewrite comment
-Add support writing vout limits
-Adjust linear exponent to match read value
-Use the probe_new function callback

Erik Rosen (2):
Add pmbus_set_update() function to set update flag on selected sensors Add ST STPDDC60 pmbus driver

 Documentation/hwmon/index.rst    |   1 +
 Documentation/hwmon/stpddc60.rst |  90 +++++++++++
 MAINTAINERS                      |   7 +
 drivers/hwmon/pmbus/Kconfig      |  10 ++
 drivers/hwmon/pmbus/Makefile     |   2 +
 drivers/hwmon/pmbus/pmbus.h      |   1 +
 drivers/hwmon/pmbus/pmbus_core.c |  11 ++
 drivers/hwmon/pmbus/stpddc60.c   | 248 +++++++++++++++++++++++++++++++
 8 files changed, 370 insertions(+)
 create mode 100644 Documentation/hwmon/stpddc60.rst
 create mode 100644 drivers/hwmon/pmbus/stpddc60.c

base-commit: 6ee1d745b7c9fd573fba142a2efdad76a9f1cb04

Signature · 1 line
2.20.1
author
#1 lore raw

PATCH v3 1/2 hwmon: (pmbus) Add pmbus_set_update() function to set update flag

For the STPDDC60 chip, the vout alarm-limits are represented as an offset relative to the commanded output voltage. This means that the limits are dynamic and must not be cached by the pmbus driver. This patch adds a pmbus_set_sensor() function to pmbus_core to be able to set the update flag on selected sensors after auto-detection of limit attributes.

---
 drivers/hwmon/pmbus/pmbus.h      |  1 +
 drivers/hwmon/pmbus/pmbus_core.c | 11 +++++++++++
 2 files changed, 12 insertions(+)
drivers/hwmon/pmbus/pmbus.h +1 -0
index 4c30ec89f5bf..3968924f8533 100644
@@ -475,6 +475,7 @@ extern const struct regulator_ops pmbus_regulator_ops;
 /* Function declarations */
 
 void pmbus_clear_cache(struct i2c_client *client);
+void pmbus_set_update(struct i2c_client *client, u8 reg, bool update);
 int pmbus_set_page(struct i2c_client *client, int page, int phase);
 int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
 			 u8 reg);
drivers/hwmon/pmbus/pmbus_core.c +11 -0
index 192442b3b7a2..a8f910826a18 100644
@@ -141,6 +141,17 @@ void pmbus_clear_cache(struct i2c_client *client)
 }
 EXPORT_SYMBOL_GPL(pmbus_clear_cache);
 
+void pmbus_set_update(struct i2c_client *client, u8 reg, bool update)
+{
+	struct pmbus_data *data = i2c_get_clientdata(client);
+	struct pmbus_sensor *sensor;
+
+	for (sensor = data->sensors; sensor; sensor = sensor->next)
+		if (sensor->reg == reg)
+			sensor->update = update;
+}
+EXPORT_SYMBOL_GPL(pmbus_set_update);
+
 int pmbus_set_page(struct i2c_client *client, int page, int phase)
 {
 	struct pmbus_data *data = i2c_get_clientdata(client);
Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw

Re: [PATCH v3 1/2] hwmon: (pmbus) Add pmbus_set_update() function to set update flag

Quoted 7 lines · Erik Rosen

For the STPDDC60 chip, the vout alarm-limits are represented as an offset relative to the commanded output voltage. This means that the limits are dynamic and must not be cached by the pmbus driver. This patch adds a pmbus_set_sensor() function to pmbus_core to be able to set the update flag on selected sensors after auto-detection of limit attributes.

Applied.

Thanks,
Guenter

Quoted 39 lines
---
 drivers/hwmon/pmbus/pmbus.h      |  1 +
 drivers/hwmon/pmbus/pmbus_core.c | 11 +++++++++++
 2 files changed, 12 insertions(+)
drivers/hwmon/pmbus/pmbus.h +1 -0
index 4c30ec89f5bf..3968924f8533 100644
@@ -475,6 +475,7 @@ extern const struct regulator_ops pmbus_regulator_ops;
 /* Function declarations */
 
 void pmbus_clear_cache(struct i2c_client *client);
+void pmbus_set_update(struct i2c_client *client, u8 reg, bool update);
 int pmbus_set_page(struct i2c_client *client, int page, int phase);
 int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
 			 u8 reg);
drivers/hwmon/pmbus/pmbus_core.c +11 -0
index 192442b3b7a2..a8f910826a18 100644
@@ -141,6 +141,17 @@ void pmbus_clear_cache(struct i2c_client *client)
 }
 EXPORT_SYMBOL_GPL(pmbus_clear_cache);
 
+void pmbus_set_update(struct i2c_client *client, u8 reg, bool update)
+{
+	struct pmbus_data *data = i2c_get_clientdata(client);
+	struct pmbus_sensor *sensor;
+
+	for (sensor = data->sensors; sensor; sensor = sensor->next)
+		if (sensor->reg == reg)
+			sensor->update = update;
+}
+EXPORT_SYMBOL_GPL(pmbus_set_update);
+
 int pmbus_set_page(struct i2c_client *client, int page, int phase)
 {
 	struct pmbus_data *data = i2c_get_clientdata(client);
author
#3 lore raw

PATCH v3 2/2 hwmon: (pmbus/stpddc60) Add ST STPDDC60 pmbus driver

In reply to Erik Rosen

Add hardware monitoring support for ST STPDDC60 Unversal Digital Multicell Controller.

---
 Documentation/hwmon/index.rst    |   1 +
 Documentation/hwmon/stpddc60.rst |  90 +++++++++++
 MAINTAINERS                      |   7 +
 drivers/hwmon/pmbus/Kconfig      |  10 ++
 drivers/hwmon/pmbus/Makefile     |   2 +
 drivers/hwmon/pmbus/stpddc60.c   | 248 +++++++++++++++++++++++++++++++
 6 files changed, 358 insertions(+)
 create mode 100644 Documentation/hwmon/stpddc60.rst
 create mode 100644 drivers/hwmon/pmbus/stpddc60.c
Documentation/hwmon/index.rst +1 -0
index fcb870ce6286..94b4fcf182cd 100644
@@ -169,6 +169,7 @@ Hardware Monitoring Kernel Drivers
    smsc47m192
    smsc47m1
    sparx5-temp
+   stpddc60
    tc654
    tc74
    thmc50
Documentation/hwmon/stpddc60.rst new file +90 -0

90 lines not on this page · raw message

MAINTAINERS +7 -0
index 992fe3b0900a..e4c696f8eabe 100644
@@ -16819,6 +16819,13 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/i2c/busses/i2c-stm32*
 
+ST STPDDC60 DRIVER
+M:	Daniel Nilsson <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/hwmon/stpddc60.rst
+F:	drivers/hwmon/pmbus/stpddc60.c
+
 ST VL53L0X ToF RANGER(I2C) IIO DRIVER
 M:	Song Qiang <[email protected]>
 L:	[email protected]
drivers/hwmon/pmbus/Kconfig +10 -0
index 03606d4298a4..b2becdd84b11 100644
@@ -247,6 +247,16 @@ config SENSORS_Q54SJ108A2
 	  This driver can also be built as a module. If so, the module will
 	  be called q54sj108a2.
 
+config SENSORS_STPDDC60
+	tristate "ST STPDDC60"
+	help
+	  If you say yes here you get hardware monitoring support for ST
+	  STPDDC60 Universal Digital Multicell Controller, as well as for
+	  Flex BMR481.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called stpddc60.
+
 config SENSORS_TPS40422
 	tristate "TI TPS40422"
 	help
drivers/hwmon/pmbus/Makefile +2 -0
index 6a4ba0fdc1db..ef468806238c 100644
@@ -28,9 +28,11 @@ obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
 obj-$(CONFIG_SENSORS_PM6764TR)	+= pm6764tr.o
 obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
 obj-$(CONFIG_SENSORS_Q54SJ108A2)	+= q54sj108a2.o
+obj-$(CONFIG_SENSORS_STPDDC60)	+= stpddc60.o
 obj-$(CONFIG_SENSORS_TPS40422)	+= tps40422.o
 obj-$(CONFIG_SENSORS_TPS53679)	+= tps53679.o
 obj-$(CONFIG_SENSORS_UCD9000)	+= ucd9000.o
 obj-$(CONFIG_SENSORS_UCD9200)	+= ucd9200.o
 obj-$(CONFIG_SENSORS_XDPE122)	+= xdpe12284.o
 obj-$(CONFIG_SENSORS_ZL6100)	+= zl6100.o
+
drivers/hwmon/pmbus/stpddc60.c new file +248 -0

248 lines not on this page · raw message

Signature · 1 line
2.20.1
maintainer
#4 lore raw

Re: [PATCH v3 2/2] hwmon: (pmbus/stpddc60) Add ST STPDDC60 pmbus driver

Quoted 4 lines · Erik Rosen

Add hardware monitoring support for ST STPDDC60 Unversal Digital Multicell Controller.

Applied but ...

Quoted 4 lines
drivers/hwmon/pmbus/Makefile +0 -0
@@ -28,9 +28,11 @@ obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
 obj-$(CONFIG_SENSORS_PM6764TR)	+= pm6764tr.o

drivers/hwmon/pmbus/Makefile obj-$(CONFIG_SENSORS_MP2975) += mp2975.o · line 38

Quoted 10 lines
drivers/hwmon/pmbus/Makefile +2 -0
 obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
 obj-$(CONFIG_SENSORS_Q54SJ108A2)	+= q54sj108a2.o
+obj-$(CONFIG_SENSORS_STPDDC60)	+= stpddc60.o
 obj-$(CONFIG_SENSORS_TPS40422)	+= tps40422.o
 obj-$(CONFIG_SENSORS_TPS53679)	+= tps53679.o
 obj-$(CONFIG_SENSORS_UCD9000)	+= ucd9000.o
 obj-$(CONFIG_SENSORS_UCD9200)	+= ucd9200.o
 obj-$(CONFIG_SENSORS_XDPE122)	+= xdpe12284.o
 obj-$(CONFIG_SENSORS_ZL6100)	+= zl6100.o
+

I fixed this up. Please check for such whitespace errors.

Thanks,
Guenter