hwmon: (pmbus) Add pmbus_set_update() function to set update flag
authorErik Rosen <erik.rosen@metormote.com>
Thu, 18 Feb 2021 11:52:48 +0000 (12:52 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 20 Apr 2021 13:50:14 +0000 (06:50 -0700)
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.

Signed-off-by: Erik Rosen <erik.rosen@metormote.com>
Link: https://lore.kernel.org/r/20210218115249.28513-2-erik.rosen@metormote.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus.h
drivers/hwmon/pmbus/pmbus_core.c

index 4c30ec89f5bf82b55e6639211e8b95538baa3e73..3968924f85330ebfc6a3c0a5570040306696c44d 100644 (file)
@@ -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);
index aadea85fe630776806f66d38ba1e9b3f2a90a62f..e1de93658a649da31dc34df09b11d89c6b747abf 100644 (file)
@@ -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);