From d2e5835634e94fbd4c3d3671cb5eb45597dd569b Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sat, 1 Sep 2001 14:33:41 +0000 Subject: [PATCH] fix unreliable initialization of limit registers by adding a rather large delay after resetting the device via register 0x40. There is obviously a state machine in the chip that takes a while to run after you reset it. Figured out the delay time by trial and error. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1168 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +++ kernel/chips/via686a.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index 1ef716ec..c3388206 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,9 @@ ask CVS about it: ----------------------------------------------------------------------------- +2.6.2 (2001????) + Module via686a: Make limit initializations reliable + 2.6.1 (20010830) File BUGS: Updated File doc/FAQ: More updates and additions diff --git a/kernel/chips/via686a.c b/kernel/chips/via686a.c index 0999a6c5..cf085f54 100644 --- a/kernel/chips/via686a.c +++ b/kernel/chips/via686a.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "version.h" #include "sensors.h" @@ -680,6 +681,13 @@ void via686a_init_client(struct i2c_client *client) /* Reset the device */ via686a_write_value(client, VIA686A_REG_CONFIG, 0x80); + /* Have to wait for reset to complete or else the following + initializations won't work reliably. The delay was arrived at + empirically, the datasheet doesn't tell you. + Waiting for the reset bit to clear doesn't work, it + clears in about 2-4 udelays and that isn't nearly enough. */ + udelay(50); + via686a_write_value(client, VIA686A_REG_IN_MIN(0), IN_TO_REG(VIA686A_INIT_IN_MIN_0, 0)); via686a_write_value(client, VIA686A_REG_IN_MAX(0),