khali@linux-fr.org [PATCH] I2C: Enable w83781d and w83627hf temperature channels ChangeSet 1.2092, 2005/03/02 12:09:28-08:00, khali@linux-fr.org [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.html Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman drivers/i2c/chips/w83627hf.c | 21 +++++++++++++++++++++ drivers/i2c/chips/w83781d.c | 23 ++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff -Nru a/drivers/i2c/chips/w83627hf.c b/drivers/i2c/chips/w83627hf.c --- a/drivers/i2c/chips/w83627hf.c 2005-03-04 12:25:24 -08:00 +++ b/drivers/i2c/chips/w83627hf.c 2005-03-04 12:25:24 -08:00 @@ -1321,6 +1321,27 @@ 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) */ diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c --- a/drivers/i2c/chips/w83781d.c 2005-03-04 12:25:24 -08:00 +++ b/drivers/i2c/chips/w83781d.c 2005-03-04 12:25:24 -08:00 @@ -1562,11 +1562,28 @@ } #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 */