Commit bbb7e78c authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] I2C: Enable w83781d and w83627hf temperature channels

The chips supported by the w83781d and w83627hf drivers might come up
with their temperature channels disabled. Currently, the w83781d driver
does so for temp3 but omits temp2, while the w83627hf driver omits both.
The following patch fixes that, and prints warning messages when the
driver has to enable the channels (normally the BIOS should do it for
us). We also skip this initialization step for the AS99127F chips, for
which we have no documentation.

This should hopefully solve the problem reported here:
http://archives.andrew.net.au/lm-sensors/msg29150.htmlSigned-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 683d88c8
......@@ -1321,6 +1321,27 @@ static void w83627hf_init_client(struct i2c_client *client)
data->pwmenable[2] = 1;
if(init) {
/* Enable temp2 */
tmp = w83627hf_read_value(client, W83781D_REG_TEMP2_CONFIG);
if (tmp & 0x01) {
dev_warn(&client->dev, "Enabling temp2, readings "
"might not make sense\n");
w83627hf_write_value(client, W83781D_REG_TEMP2_CONFIG,
tmp & 0xfe);
}
/* Enable temp3 */
if (type != w83697hf) {
tmp = w83627hf_read_value(client,
W83781D_REG_TEMP3_CONFIG);
if (tmp & 0x01) {
dev_warn(&client->dev, "Enabling temp3, "
"readings might not make sense\n");
w83627hf_write_value(client,
W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
}
}
if (type == w83627hf) {
/* enable PWM2 control (can't hurt since PWM reg
should have been reset to 0xff) */
......
......@@ -1562,11 +1562,28 @@ w83781d_init_client(struct i2c_client *client)
}
#endif /* W83781D_RT */
if (init) {
if (init && type != as99127f) {
/* Enable temp2 */
tmp = w83781d_read_value(client, W83781D_REG_TEMP2_CONFIG);
if (tmp & 0x01) {
dev_warn(&client->dev, "Enabling temp2, readings "
"might not make sense\n");
w83781d_write_value(client, W83781D_REG_TEMP2_CONFIG,
tmp & 0xfe);
}
/* Enable temp3 */
if (type != w83783s && type != w83697hf) {
w83781d_write_value(client, W83781D_REG_TEMP3_CONFIG,
0x00);
tmp = w83781d_read_value(client,
W83781D_REG_TEMP3_CONFIG);
if (tmp & 0x01) {
dev_warn(&client->dev, "Enabling temp3, "
"readings might not make sense\n");
w83781d_write_value(client,
W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
}
}
if (type != w83781d) {
/* enable comparator mode for temp2 and temp3 so
alarm indication will work correctly */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment