From 831fd5e911cb807a742d896440f2dcb393b93ce4 Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Fri, 4 Dec 1998 15:26:29 +0000 Subject: [PATCH] Corrected LM78 probing. If your LM78/78-J/79 is still not detected, please recompile lm78.o with DEBUG=1 and mail the output of dmesg. Same for Winbonds. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@33 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/lm78.c | 20 +++++++++++++------- src/lm78.c | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index eb250cc4..0beeebd7 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -334,7 +334,7 @@ int lm78_detect_isa(struct isa_adapter *adapter) /* Determine exact type */ outb_p(LM78_REG_CHIPID,address + LM78_ADDR_REG_OFFSET); - err = inb_p(address + LM78_DATA_REG_OFFSET); + err = inb_p(address + LM78_DATA_REG_OFFSET) & 0xfe; if (err == 0x00) { type = lm78; type_name = "lm78"; @@ -343,14 +343,16 @@ int lm78_detect_isa(struct isa_adapter *adapter) type = lm78j; type_name = "lm78-j"; client_name = "LM78-J chip"; - } else if (err == 0x80) { + } else if (err == 0xc0) { type = lm79; type_name = "lm79"; client_name = "LM79 chip"; - } - else + } else { +#ifdef DEBUG + printk("lm78.o: warning: probed non-lm78 chip?!? (%x)\n",err); +#endif continue; - + } request_region(address, LM78_EXTENT, type_name); @@ -448,7 +450,7 @@ int lm78_detect_smbus(struct i2c_adapter *adapter) /* Real detection code goes here */ /* Determine exact type */ - err = smbus_read_byte_data(adapter,address,LM78_REG_CHIPID); + err = smbus_read_byte_data(adapter,address,LM78_REG_CHIPID) & 0xfe; if (err == 0x00) { type = lm78; type_name = "lm78"; @@ -461,8 +463,12 @@ int lm78_detect_smbus(struct i2c_adapter *adapter) type = lm79; type_name = "lm79"; client_name = "LM79 chip"; - } else + } else { +#ifdef DEBUG + printk("lm78.o: warning: probed non-lm78 chip?!? (%x)\n",err); +#endif continue; + } /* Allocate space for a new client structure. To counter memory diff --git a/src/lm78.c b/src/lm78.c index eb250cc4..0beeebd7 100644 --- a/src/lm78.c +++ b/src/lm78.c @@ -334,7 +334,7 @@ int lm78_detect_isa(struct isa_adapter *adapter) /* Determine exact type */ outb_p(LM78_REG_CHIPID,address + LM78_ADDR_REG_OFFSET); - err = inb_p(address + LM78_DATA_REG_OFFSET); + err = inb_p(address + LM78_DATA_REG_OFFSET) & 0xfe; if (err == 0x00) { type = lm78; type_name = "lm78"; @@ -343,14 +343,16 @@ int lm78_detect_isa(struct isa_adapter *adapter) type = lm78j; type_name = "lm78-j"; client_name = "LM78-J chip"; - } else if (err == 0x80) { + } else if (err == 0xc0) { type = lm79; type_name = "lm79"; client_name = "LM79 chip"; - } - else + } else { +#ifdef DEBUG + printk("lm78.o: warning: probed non-lm78 chip?!? (%x)\n",err); +#endif continue; - + } request_region(address, LM78_EXTENT, type_name); @@ -448,7 +450,7 @@ int lm78_detect_smbus(struct i2c_adapter *adapter) /* Real detection code goes here */ /* Determine exact type */ - err = smbus_read_byte_data(adapter,address,LM78_REG_CHIPID); + err = smbus_read_byte_data(adapter,address,LM78_REG_CHIPID) & 0xfe; if (err == 0x00) { type = lm78; type_name = "lm78"; @@ -461,8 +463,12 @@ int lm78_detect_smbus(struct i2c_adapter *adapter) type = lm79; type_name = "lm79"; client_name = "LM79 chip"; - } else + } else { +#ifdef DEBUG + printk("lm78.o: warning: probed non-lm78 chip?!? (%x)\n",err); +#endif continue; + } /* Allocate space for a new client structure. To counter memory