From 8861601cc203db0bd927873c84173dd956eaeeb4 Mon Sep 17 00:00:00 2001 From: Kyosti Malkki Date: Tue, 27 Jul 1999 16:51:00 +0000 Subject: [PATCH] =?UTF-8?q?(Ky=C3=B6sti)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * removed algorithm registration in i2c-isa * renamed i2c-via2.o to i2c-viapro.o in the driver messages * added detection for new drivers in sensors-detect script * minor gl518sm fix git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@522 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/busses/i2c-isa.c | 18 ++---------- kernel/busses/i2c-viapro.c | 56 +++++++++++++++++++------------------- kernel/chips/gl518sm.c | 6 ++++ kernel/include/sensors.h | 5 ++-- prog/detect/sensors-detect | 17 ++++++++++++ 5 files changed, 55 insertions(+), 47 deletions(-) diff --git a/kernel/busses/i2c-isa.c b/kernel/busses/i2c-isa.c index 35fb1903..d3afe297 100644 --- a/kernel/busses/i2c-isa.c +++ b/kernel/busses/i2c-isa.c @@ -105,15 +105,9 @@ int __init i2c_isa_init(void) } #endif isa_initialized = 0; - if ((res = i2c_add_algorithm(&isa_algorithm))) { - printk("i2c-isa.o: Algorithm registration failed, module not inserted.\n"); - isa_cleanup(); - return res; - } - isa_initialized++; if ((res = i2c_add_adapter(&isa_adapter))) { printk("i2c-isa.o: Adapter registration failed, " - "module isa.o is not inserted\n."); + "module i2c-isa.o is not inserted\n."); isa_cleanup(); return res; } @@ -125,7 +119,7 @@ int __init i2c_isa_init(void) int __init isa_cleanup(void) { int res; - if (isa_initialized >= 2) + if (isa_initialized >= 1) { if ((res = i2c_del_adapter(&isa_adapter))) { printk("i2c-isa.o: Adapter deregistration failed, module not removed.\n"); @@ -133,14 +127,6 @@ int __init isa_cleanup(void) } else isa_initialized--; } - if (isa_initialized >= 1) - { - if ((res = i2c_del_algorithm(&isa_algorithm))) { - printk("i2c-isa.o: Algorithm deregistration failed, module not removed.\n"); - return res; - } else - isa_initialized--; - } return 0; } diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c index 4499db51..c2fe81e1 100644 --- a/kernel/busses/i2c-viapro.c +++ b/kernel/busses/i2c-viapro.c @@ -1,5 +1,5 @@ /* - i2c-via2.c - Part of lm_sensors, Linux kernel modules for hardware + i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware monitoring Copyright (c) 1998, 1999 Frodo Looijaard , Philip Edelbrock , Kyösti Mälkki @@ -171,7 +171,7 @@ int vt596_setup(void) /* First check whether we can access PCI at all */ if (pci_present() == 0) { - printk("i2c-via2.o: Error: No PCI-bus found!\n"); + printk("i2c-viapro.o: Error: No PCI-bus found!\n"); error_return=-ENODEV; goto END; } @@ -204,7 +204,7 @@ int vt596_setup(void) if (res) { #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,54) */ - printk("i2c-via2.o: Error: Can't detect vt82c596 or vt82c686"); + printk("i2c-viapro.o: Error: Can't detect vt82c596 or vt82c686"); error_return=-ENODEV; goto END; } @@ -219,7 +219,7 @@ int vt596_setup(void) smb_cf_base = SMBBA2; smb_cf_hstcfg = 0x84; } else { - printk("i2c-via2.o: Cannot configure SMBus I/O Base address\n"); + printk("i2c-viapro.o: Cannot configure SMBus I/O Base address\n"); error_return=-ENODEV; goto END; } @@ -233,7 +233,7 @@ int vt596_setup(void) } if (check_region(vt596_smba, 8)) { - printk("i2c-via2.o: vt82c596_smb region 0x%x already in use!\n", vt596_smba); + printk("i2c-viapro.o: vt82c596_smb region 0x%x already in use!\n", vt596_smba); error_return=-ENODEV; goto END; } @@ -249,7 +249,7 @@ int vt596_setup(void) SMBBA,vt596_smba); pci_write_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, SMBHSTCFG, temp | 0x01); - printk("i2c-via2.o: WARNING: VT596 SMBus interface set to new " + printk("i2c-viapro.o: WARNING: VT596 SMBus interface set to new " "address %04x!\n",vt596_smba); } else if ((temp & 1) == 0) { if (force) { @@ -259,7 +259,7 @@ int vt596_setup(void) resorting to this. */ pci_write_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, SMBHSTCFG, temp | 1); - printk("i2c-via2.o: WARNING: SMBus interface has been FORCEFULLY " + printk("i2c-viapro.o: WARNING: SMBus interface has been FORCEFULLY " "ENABLED!\n"); } else { printk("SMBUS: Error: Host SMBus controller not enabled!\n"); @@ -273,17 +273,17 @@ int vt596_setup(void) #ifdef DEBUG if ((temp & 0x0E) == 8) - printk("i2c-via2.o: using Interrupt 9 for SMBus.\n"); + printk("i2c-viapro.o: using Interrupt 9 for SMBus.\n"); else if ((temp & 0x0E) == 0) - printk("i2c-via2.o: using Interrupt SMI# for SMBus.\n"); + printk("i2c-viapro.o: using Interrupt SMI# for SMBus.\n"); else - printk("i2c-via2.o: Illegal Interrupt configuration (or code out " + printk("i2c-viapro.o: Illegal Interrupt configuration (or code out " "of date)!\n"); pci_read_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, SMBREV, &temp); - printk("i2c-via2.o: SMBREV = 0x%X\n",temp); - printk("i2c-via2.o: VT596_smba = 0x%X\n",vt596_smba); + printk("i2c-viapro.o: SMBREV = 0x%X\n",temp); + printk("i2c-viapro.o: VT596_smba = 0x%X\n",vt596_smba); #endif /* DEBUG */ END: @@ -306,7 +306,7 @@ int vt596_transaction(void) int timeout=0; #ifdef DEBUG - printk("i2c-via2.o: Transaction (pre): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, " + printk("i2c-viapro.o: Transaction (pre): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, " "DAT1=%02x\n", inb_p(SMBHSTCNT),inb_p(SMBHSTCMD),inb_p(SMBHSTADD),inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); @@ -315,17 +315,17 @@ int vt596_transaction(void) /* Make sure the SMBus host is ready to start transmitting */ if ((temp = inb_p(SMBHSTSTS)) != 0x00) { #ifdef DEBUG - printk("i2c-via2.o: SMBus busy (%02x). Resetting... \n",temp); + printk("i2c-viapro.o: SMBus busy (%02x). Resetting... \n",temp); #endif outb_p(temp, SMBHSTSTS); if ((temp = inb_p(SMBHSTSTS)) != 0x00) { #ifdef DEBUG - printk("i2c-via2.o: Failed! (%02x)\n",temp); + printk("i2c-viapro.o: Failed! (%02x)\n",temp); #endif return -1; } else { #ifdef DEBUG - printk("i2c-via2.o: Successfull!\n"); + printk("i2c-viapro.o: Successfull!\n"); #endif } } @@ -343,7 +343,7 @@ int vt596_transaction(void) /* If the SMBus is still busy, we give up */ if (timeout >= MAX_TIMEOUT) { #ifdef DEBUG - printk("i2c-via2.o: SMBus Timeout!\n"); + printk("i2c-viapro.o: SMBus Timeout!\n"); result = -1; #endif } @@ -351,13 +351,13 @@ int vt596_transaction(void) if (temp & 0x10) { result = -1; #ifdef DEBUG - printk("i2c-via2.o: Error: Failed bus transaction\n"); + printk("i2c-viapro.o: Error: Failed bus transaction\n"); #endif } if (temp & 0x08) { result = -1; - printk("i2c-via2.o: Bus collision! SMBus may be locked until next hard + printk("i2c-viapro.o: Bus collision! SMBus may be locked until next hard reset. (sorry!)\n"); /* Clock stops and slave is stuck in mid-transmission */ } @@ -365,7 +365,7 @@ int vt596_transaction(void) if (temp & 0x04) { result = -1; #ifdef DEBUG - printk("i2c-via2.o: Error: no response!\n"); + printk("i2c-viapro.o: Error: no response!\n"); #endif } @@ -374,11 +374,11 @@ int vt596_transaction(void) if ((temp = inb_p(SMBHSTSTS)) != 0x00) { #ifdef DEBUG - printk("i2c-via2.o: Failed reset at end of transaction (%02x)\n",temp); + printk("i2c-viapro.o: Failed reset at end of transaction (%02x)\n",temp); #endif } #ifdef DEBUG - printk("i2c-via2.o: Transaction (post): CNT=%02x, CMD=%02x, ADD=%02x, " + printk("i2c-viapro.o: Transaction (post): CNT=%02x, CMD=%02x, ADD=%02x, " "DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),inb_p(SMBHSTCMD),inb_p(SMBHSTADD),inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); @@ -394,7 +394,7 @@ s32 vt596_access(struct i2c_adapter *adap, u8 addr, char read_write, switch(size) { case I2C_SMBUS_PROC_CALL: - printk("i2c-via2.o: I2C_SMBUS_PROC_CALL not supported!\n"); + printk("i2c-viapro.o: I2C_SMBUS_PROC_CALL not supported!\n"); return -1; case I2C_SMBUS_QUICK: outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), SMBHSTADD); @@ -490,25 +490,25 @@ int __init i2c_vt596_init(void) #ifdef DEBUG /* PE- It might be good to make this a permanent part of the code! */ if (vt596_initialized) { - printk("i2c-via2.o: Oops, vt596_init called a second time!\n"); + printk("i2c-viapro.o: Oops, vt596_init called a second time!\n"); return -EBUSY; } #endif vt596_initialized = 0; if ((res = vt596_setup())) { - printk("i2c-via2.o: vt82c596 not detected, module not inserted.\n"); + printk("i2c-viapro.o: vt82c596 not detected, module not inserted.\n"); vt596_cleanup(); return res; } vt596_initialized ++; sprintf(vt596_adapter.name,"SMBus vt82c596 adapter at %04x",vt596_smba); if ((res = i2c_add_adapter(&vt596_adapter))) { - printk("i2c-via2.o: Adapter registration failed, module not inserted.\n"); + printk("i2c-viapro.o: Adapter registration failed, module not inserted.\n"); vt596_cleanup(); return res; } vt596_initialized++; - printk("i2c-via2.o: vt82c596 bus detected and initialized\n"); + printk("i2c-viapro.o: vt82c596 bus detected and initialized\n"); return 0; } @@ -518,7 +518,7 @@ int __init vt596_cleanup(void) if (vt596_initialized >= 2) { if ((res = i2c_del_adapter(&vt596_adapter))) { - printk("i2c-via2.o: i2c_del_adapter failed, module not removed\n"); + printk("i2c-viapro.o: i2c_del_adapter failed, module not removed\n"); return res; } else vt596_initialized--; diff --git a/kernel/chips/gl518sm.c b/kernel/chips/gl518sm.c index 8de8048f..b04906f2 100644 --- a/kernel/chips/gl518sm.c +++ b/kernel/chips/gl518sm.c @@ -455,6 +455,7 @@ void gl518_init_client(struct i2c_client *client) int gl518_detach_client(struct i2c_client *client) { int err,i; + struct gl518_data *data = client->data; sensors_deregister_entry(((struct gl518_data *)(client->data))->sysctl_id); @@ -471,6 +472,11 @@ int gl518_detach_client(struct i2c_client *client) return -ENOENT; } gl518_list[i] = NULL; + + if (data->thread) { + data->quit_thread = 1; + wake_up_interruptible(&data->wq); + } kfree(client); diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index 4bfbc6c8..a100c18e 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -293,9 +293,8 @@ extern inline int SENSORS_LIMIT(long value, long low, long high) /* The maximum length of the prefix */ #define SENSORS_PREFIX_MAX 20 -/* Driver IDs */ -#define I2C_DRIVERID_I2CDEV 1000 -#define I2C_DRIVERID_I2CPROC 1001 +/* IDs -- Use DRIVERIDs 1000-1999 for sensors. + Other drivers define the id in linux/i2c.h */ #define I2C_DRIVERID_LM78 1002 #define I2C_DRIVERID_LM75 1003 #define I2C_DRIVERID_GL518 1004 diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 3255cf05..a61656d6 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -63,6 +63,22 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); driver => "i2c-via", match => sub { $_[0] =~ /^VIA i2c/ }, } , + { + vendid => 0x1106, + devid => 0x3050, + func => 3, + procid => "VIA Technologies VT 82C596 Apollo ACPI", + driver => "i2c-viapro", + match => sub { $_[0] =~ /^SMBus vt82c596 adapter at [0-9,a-f]{4}/ }, + } , + { + vendid => 0x1106, + devid => 0x3057, + func => 4, + procid => "VIA Technologies VT 82C686 Apollo ACPI", + driver => "i2c-viapro", + match => sub { $_[0] =~ /^SMBus vt82c596 adapter at [0-9,a-f]{4}/ }, + } , { vendid => 0x1039, devid => 0x0008, @@ -200,6 +216,7 @@ use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect }, { name => "Genesys Logic GL520SM", + driver => "gl520sm", i2c_addrs => [0x2c, 0x2d], i2c_detect => sub { gl520sm_detect @_} , },