diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-10-28 14:31:46 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-28 14:31:46 -0400 |
commit | 80646b95863ba282330d07290c79254c2f002139 (patch) | |
tree | a990d3f36160ebb9530e8a30a237c9266f951a8c /drivers/hwmon/w83795.c | |
parent | 86ef4d2fd5921ff0bcfd1c0d88403a08862087bc (diff) |
hwmon: (w83795) Only start monitoring if needed
This saves an SMBus write if monitoring was already enabled.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r-- | drivers/hwmon/w83795.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index b45416011c2a..62deffcc64a3 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c | |||
@@ -55,6 +55,7 @@ MODULE_PARM_DESC(reset, "Set to 1 to reset chip, not recommended"); | |||
55 | #define W83795_REG_I2C_ADDR 0xfc | 55 | #define W83795_REG_I2C_ADDR 0xfc |
56 | #define W83795_REG_CONFIG 0x01 | 56 | #define W83795_REG_CONFIG 0x01 |
57 | #define W83795_REG_CONFIG_CONFIG48 0x04 | 57 | #define W83795_REG_CONFIG_CONFIG48 0x04 |
58 | #define W83795_REG_CONFIG_START 0x01 | ||
58 | 59 | ||
59 | /* Multi-Function Pin Ctrl Registers */ | 60 | /* Multi-Function Pin Ctrl Registers */ |
60 | #define W83795_REG_VOLT_CTRL1 0x02 | 61 | #define W83795_REG_VOLT_CTRL1 0x02 |
@@ -1664,12 +1665,18 @@ static const struct sensor_device_attribute_2 sda_single_files[] = { | |||
1664 | 1665 | ||
1665 | static void w83795_init_client(struct i2c_client *client) | 1666 | static void w83795_init_client(struct i2c_client *client) |
1666 | { | 1667 | { |
1668 | u8 config; | ||
1669 | |||
1667 | if (reset) | 1670 | if (reset) |
1668 | w83795_write(client, W83795_REG_CONFIG, 0x80); | 1671 | w83795_write(client, W83795_REG_CONFIG, 0x80); |
1669 | 1672 | ||
1670 | /* Start monitoring */ | 1673 | /* Start monitoring if needed */ |
1671 | w83795_write(client, W83795_REG_CONFIG, | 1674 | config = w83795_read(client, W83795_REG_CONFIG); |
1672 | w83795_read(client, W83795_REG_CONFIG) | 0x01); | 1675 | if (!(config & W83795_REG_CONFIG_START)) { |
1676 | dev_info(&client->dev, "Enabling monitoring operations\n"); | ||
1677 | w83795_write(client, W83795_REG_CONFIG, | ||
1678 | config | W83795_REG_CONFIG_START); | ||
1679 | } | ||
1673 | } | 1680 | } |
1674 | 1681 | ||
1675 | static int w83795_get_device_id(struct i2c_client *client) | 1682 | static int w83795_get_device_id(struct i2c_client *client) |