From f7b2534fbacf80c025dd9cc84350093badc14c87 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 21 Feb 2004 14:10:31 +0000 Subject: [PATCH] Preserve other bits when forcing temp2/3 to comparator mode. Backported from Linux 2.6. Requested by Keith Duthie. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2302 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/w83627hf.c | 5 ++++- kernel/chips/w83781d.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/chips/w83627hf.c b/kernel/chips/w83627hf.c index f002e939..34619906 100644 --- a/kernel/chips/w83627hf.c +++ b/kernel/chips/w83627hf.c @@ -916,7 +916,10 @@ static void w83627hf_init_client(struct i2c_client *client) } /* enable comparator mode for temp2 and temp3 so alarm indication will work correctly */ - w83627hf_write_value(client, W83781D_REG_IRQ, 0x41); + i = w83627hf_read_value(client, W83781D_REG_IRQ); + if (!(i & 0x40)) + w83627hf_write_value(client, W83781D_REG_IRQ, + i | 0x40); } /* Start monitoring */ diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 7e98db0c..db9e69c3 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -1378,7 +1378,11 @@ static void w83781d_init_client(struct i2c_client *client) if (type != w83781d) { /* enable comparator mode for temp2 and temp3 so alarm indication will work correctly */ - w83781d_write_value(client, W83781D_REG_IRQ, 0x41); + i = w83781d_read_value(client, W83781D_REG_IRQ); + if (!(i & 0x40)) + w83781d_write_value(client, W83781D_REG_IRQ, + i | 0x40); + for(i = 0; i < 3; i++) data->pwmenable[i] = 1; }