Skip to content

Commit

Permalink
hwmon: (pmbus) Add function to clear sensor cache
Browse files Browse the repository at this point in the history
For PMBus chips, modifying one limit register may affect other limits.
Since limits are all cached in the PMBus core driver, related changes
are not reflected in reported limits.

Introduce function to clear the attribute cache. After calling this function,
the core pmbus driver re-reads all cached values.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Guenter Roeck committed Feb 6, 2013
1 parent aebcbbf commit ce603b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hwmon/pmbus/pmbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ struct pmbus_driver_info {

/* Function declarations */

void pmbus_clear_cache(struct i2c_client *client);
int pmbus_set_page(struct i2c_client *client, u8 page);
int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg);
int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word);
Expand Down
8 changes: 8 additions & 0 deletions drivers/hwmon/pmbus/pmbus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ struct pmbus_data {
u8 currpage;
};

void pmbus_clear_cache(struct i2c_client *client)
{
struct pmbus_data *data = i2c_get_clientdata(client);

data->valid = false;
}
EXPORT_SYMBOL_GPL(pmbus_clear_cache);

int pmbus_set_page(struct i2c_client *client, u8 page)
{
struct pmbus_data *data = i2c_get_clientdata(client);
Expand Down

0 comments on commit ce603b1

Please sign in to comment.