summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/max1619.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-04-19 18:15:38 +0200
committerGuenter Roeck <linux@roeck-us.net>2014-05-22 01:02:25 +0200
commit628c6d27c0f41657362262000d01861e8cb36c3a (patch)
treea9b3dd49174d47a88f312c55c8f10317a7bfca37 /drivers/hwmon/max1619.c
parenthwmon: (jc42) Add support for STTS2004 and AT30TSE004 (diff)
downloadlinux-628c6d27c0f41657362262000d01861e8cb36c3a.tar.xz
linux-628c6d27c0f41657362262000d01861e8cb36c3a.zip
hwmon: (max1619) Fix critical alarm display
The overtemperature status bit, which is used to display critical alarm status, matches the output of the OVERT signal 1:1. If that signal is active-low, the bit will read 1 if there is no alarm. It is therefore necessary to reverse the bit in this case. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/max1619.c')
-rw-r--r--drivers/hwmon/max1619.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index 4c23afe113e2..0927902ceba3 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -325,6 +325,7 @@ static struct max1619_data *max1619_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct max1619_data *data = i2c_get_clientdata(client);
+ int config;
mutex_lock(&data->update_lock);
@@ -344,6 +345,10 @@ static struct max1619_data *max1619_update_device(struct device *dev)
MAX1619_REG_R_TCRIT_HYST);
data->alarms = i2c_smbus_read_byte_data(client,
MAX1619_REG_R_STATUS);
+ /* If OVERT polarity is low, reverse alarm bit */
+ config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG);
+ if (!(config & 0x20))
+ data->alarms ^= 0x02;
data->last_updated = jiffies;
data->valid = 1;