i2c driver fixes for 2.6.3-rc1
Subsystems (2)
PATCH 1/1 i2c driver fixes for 2.6.3-rc1
Hi,
Here are some i2c driver updates for 2.6.3-rc1. It's a few small bugfixes and tree new i2c drivers. All of the bugfixes and two of the i2c drivers have been in the last few -mm trees with no problems.
Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.6
Individual patches will follow, sent to the sensors and linux-kernel lists.
thanks,
greg k-h
MAINTAINERS | 12 drivers/i2c/busses/Kconfig | 12 drivers/i2c/busses/Makefile | 1 drivers/i2c/busses/i2c-hydra.c | 186 +++++++++++ drivers/i2c/chips/Kconfig | 22 + drivers/i2c/chips/Makefile | 2 drivers/i2c/chips/fscher.c | 681 +++++++++++++++++++++++++++++++++++++++++ drivers/i2c/chips/gl518sm.c | 612 ++++++++++++++++++++++++++++++++++++ drivers/i2c/chips/lm85.c | 6 drivers/i2c/chips/w83l785ts.c | 63 ++- drivers/i2c/i2c-core.c | 2 include/linux/i2c-id.h | 1 12 files changed, 1571 insertions(+), 29 deletions(-)
-----
<ender:debian.org>:
o I2C: fix typos
Geert Uytterhoeven:
o I2C: add Hydra i2c bus driver
Greg Kroah-Hartman:
o I2C: fix oops when CONFIG_I2C_DEBUG_CORE is enabled and the bttv driver is loaded
Jean Delvare:
o I2C: add new chip driver: fscher
o I2C: Update I2C maintainers entry
o I2C: add new driver, gl518sm
o I2C: Handle read errors in w83l785ts
o I2C: Bring w83l785ts in compliance with sysfs naming conventions
ChangeSet 1.1500.11.7, 2004/02/05 17:04:24-08:00, [email protected]
[PATCH] I2C: Update I2C maintainers entry
I propose the following update of the "I2C AND SENSORS DRIVERS" entry in MAINTAINERS:
* Remove Frodo Looijaard. He isn't active in the project anymore, and forwards everythings he receives to the mailing-list. More work for everyone, and increased latency.
* Move your name to the top. This is more realistic since you are the real maintainer of the i2c subsystem in 2.6.
* Reindent. Spaces were used instead of tabs.
MAINTAINERS | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
MAINTAINERS +5 -7
@@ -922,15 +922,13 @@ S: Maintained I2C AND SENSORS DRIVERS -P: Frodo Looijaard -M: [email protected] -P: Philip Edelbrock -M: [email protected] P: Greg Kroah-Hartman M: [email protected] -L: [email protected] -W: http://www.lm-sensors.nu/ -S: Maintained +P: Philip Edelbrock +M: [email protected] +L: [email protected] +W: http://www.lm-sensors.nu/ +S: Maintained i386 BOOT CODE P: Riley H. Williams
ChangeSet 1.1500.11.2, 2004/01/30 16:56:36-08:00, [email protected]
[PATCH] I2C: fix typos
Following patch fixes two typos and a missing full stop.
drivers/i2c/chips/lm85.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/chips/lm85.c +3 -3
@@ -816,7 +816,7 @@ kind = lm85b ; }else if ( company ==LM85_COMPANY_NATIONAL && (verstep &0xf0 ) ==LM85_VERSTEP_GENERIC ) { -dev_err (&adapter->dev,"Unrecgonized version/stepping 0x%02x" +dev_err (&adapter->dev,"Unrecognized version/stepping 0x%02x" " Defaulting to LM85.\n" , verstep); kind = any_chip ; } else if( company == LM85_COMPANY_ANALOG_DEV
@@ -827,7 +827,7 @@ kind = adt7463 ; }else if ( company ==LM85_COMPANY_ANALOG_DEV && (verstep &0xf0 ) ==LM85_VERSTEP_GENERIC ) { -dev_err (&adapter->dev,"Unrecgonized version/stepping 0x%02x" +dev_err (&adapter->dev,"Unrecognized version/stepping 0x%02x" " Defaulting to ADM1027.\n" , verstep); kind = adm1027 ; }else if ( kind ==0 && (verstep &0xf0 ) ==0x60 ) {
@@ -1204,7 +1204,7 @@/* Thanks to Richard Barrington for adding the LM85 to sensors-detect. * Thanks to Margit Schubert-While <[email protected]> for help with -* post 2.7.0 CVS changes +* post 2.7.0 CVS changes. */ MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Philip Pokorny <[email protected]>, Margit Schubert-While <[email protected]>" );
ChangeSet 1.1500.11.6, 2004/02/03 17:01:31-08:00, [email protected]
[PATCH] I2C: fix oops when CONFIG_I2C_DEBUG_CORE is enabled and the bttv driver is loaded.
drivers/i2c/i2c-core.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core.c +1 -1
@@ -598,7 +598,7 @@ ret = adap->algo->master_xfer (adap,&msg,1 );up (&adap->bus_lock); -dev_dbg (&client->dev,"master_recv: return:%d (count:%d, addr:0x%02x)\n" , +dev_dbg (&client->adapter->dev,"master_recv: return:%d (count:%d, addr:0x%02x)\n" , ret, count, client->addr);/* if everything went ok (i.e. 1 msg transmitted), return #bytes
ChangeSet 1.1500.11.5, 2004/02/02 15:04:34-08:00, [email protected]
[PATCH] I2C: add new driver, gl518sm
Here comes a new i2c chip driver for Linux 2.6: gl518sm, ported from our CVS repository by Hong-Gunn Chew. I have reviewed Gunn's code and we made a few cleanups and improvements over the original driver. See our complete exchange on the sensors mailing-list for details.
drivers/i2c/chips/Kconfig | 11 drivers/i2c/chips/Makefile | 1 drivers/i2c/chips/gl518sm.c | 612 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 624 insertions(+)
drivers/i2c/chips/Kconfig +11 -0
@@ -45,6 +45,17 @@ This driver can also be built as a module. If so, the module will be called eeprom. +config SENSORS_GL518SM + tristate "Genesys Logic GL518SM" + depends on I2C && EXPERIMENTAL + select I2C_SENSOR + help + If you say yes here you get support for Genesys Logic GL518SM + sensor chips. + + This driver can also be built as a module. If so, the module + will be called gl518sm. + config SENSORS_IT87 tristate "ITE IT87xx and compatibles" depends on I2C && EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o +obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o obj-$(CONFIG_SENSORS_IT87) += it87.o obj-$(CONFIG_SENSORS_LM75) += lm75.o obj-$(CONFIG_SENSORS_LM78) += lm78.o
drivers/i2c/chips/gl518sm.c new file +612 -0
612 lines not on this page · raw message
ChangeSet 1.1500.11.8, 2004/02/09 13:18:09-08:00, [email protected]
[PATCH] I2C: add new chip driver: fscher
This is a new ported driver, fscher, which supports the FSC Hermes chip. The original driver was written by Reinhard Nissl, who also ported it to Linux 2.6, as discussed on the lm_sensors mailing list during the last two weeks. I reviewed the code and we made the necessary changes, so that what we have now looks good to me. Please apply on top of your i2c patches stack.
drivers/i2c/chips/Kconfig | 11 drivers/i2c/chips/Makefile | 1 drivers/i2c/chips/fscher.c | 681 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c-id.h | 1 4 files changed, 694 insertions(+)
drivers/i2c/chips/Kconfig +11 -0
@@ -45,6 +45,17 @@ This driver can also be built as a module. If so, the module will be called eeprom. +config SENSORS_FSCHER + tristate "FSC Hermes" + depends on I2C && EXPERIMENTAL + select I2C_SENSOR + help + If you say yes here you get support for Fujitsu Siemens + Computers Hermes sensor chips. + + This driver can also be built as a module. If so, the module + will be called fscher. + config SENSORS_GL518SM tristate "Genesys Logic GL518SM" depends on I2C && EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o +obj-$(CONFIG_SENSORS_FSCHER) += fscher.o obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o obj-$(CONFIG_SENSORS_IT87) += it87.o obj-$(CONFIG_SENSORS_LM75) += lm75.o
drivers/i2c/chips/fscher.c new file +681 -0
681 lines not on this page · raw message
include/linux/i2c-id.h +1 -0
@@ -156,6 +156,7 @@#define I2C_DRIVERID_LM83 1040#define I2C_DRIVERID_LM90 1042#define I2C_DRIVERID_ASB100 1043 +#define I2C_DRIVERID_FSCHER 1046#define I2C_DRIVERID_W83L785TS 1047/*
PATCH 1/1 i2c driver fixes for 2.6.3-rc1
In reply to Greg KHChangeSet 1.1500.11.1, 2004/01/30 16:40:31-08:00, [email protected]
[PATCH] I2C: add Hydra i2c bus driver
Here's a new version, incorporating these comments, and making a few more changes:
- Use struct definition in <asm/hydra.h> instead of #defined offset
- Remove flushes are register writes, they are no longer needed
- Use pci_resource_start() instead of dev->resource[].start
- ioremap() the whole resource instead of the first 256 bytes
- Check for errors returned by ioremap() and i2c_bit_add_bus()
- Add resource management
- Call iounmap() in hydra_remove() instead of in i2c_hydra_exit()
- Let I2C_HYDRA depend on I2C and select I2C_ALGOBIT instead of depending on I2C_ALGOBIT
drivers/i2c/busses/Kconfig | 12 ++ drivers/i2c/busses/Makefile | 1 drivers/i2c/busses/i2c-hydra.c | 186 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+)
drivers/i2c/busses/Kconfig +12 -0
@@ -69,6 +69,18 @@ This support is also available as a module. If so, the module will be called i2c-elv. +config I2C_HYDRA + tristate "CHRP Apple Hydra Mac I/O I2C interface" + depends on I2C && PCI && PPC_CHRP && EXPERIMENTAL + select I2C_ALGOBIT + help + This supports the use of the I2C interface in the Apple Hydra Mac + I/O chip on some CHRP machines (e.g. the LongTrail). Say Y if you + have such a machine. + + This support is also available as a module. If so, the module + will be called i2c-hydra. + config I2C_I801 tristate "Intel 801" depends on I2C && PCI && EXPERIMENTAL
drivers/i2c/busses/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o obj-$(CONFIG_I2C_ELV) += i2c-elv.o +obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o obj-$(CONFIG_I2C_I801) += i2c-i801.o obj-$(CONFIG_I2C_I810) += i2c-i810.o obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o
drivers/i2c/busses/i2c-hydra.c new file +186 -0
186 lines not on this page · raw message
ChangeSet 1.1500.11.3, 2004/02/02 14:51:45-08:00, [email protected]
[PATCH] I2C: Bring w83l785ts in compliance with sysfs naming conventions
Here is a patch that brings the w83l785ts driver in compliance with sysfs naming conventions. This is pretty much the same problem and solution that occured very recently with the lm75 and lm78 drivers.
The patch was tested to work fine by James Bolt.
drivers/i2c/chips/w83l785ts.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/chips/w83l785ts.c +4 -4
@@ -137,8 +137,8 @@return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp_over)); } -static DEVICE_ATTR(temp_input, S_IRUGO, show_temp, NULL) -static DEVICE_ATTR (temp_max, S_IRUGO, show_temp_over, NULL) +static DEVICE_ATTR(temp_input1, S_IRUGO, show_temp, NULL) +static DEVICE_ATTR (temp_max1, S_IRUGO, show_temp_over, NULL)/* * Real code
@@ -249,8 +249,8 @@*/ /* Register sysfs hooks */ -device_create_file (&new_client->dev, &dev_attr_temp_input); -device_create_file (&new_client->dev, &dev_attr_temp_max); +device_create_file (&new_client->dev, &dev_attr_temp_input1); +device_create_file (&new_client->dev, &dev_attr_temp_max1);return 0 ;
ChangeSet 1.1500.11.4, 2004/02/02 14:52:07-08:00, [email protected]
[PATCH] I2C: Handle read errors in w83l785ts
Here is a patch that adds proper read error handling in the w83l785ts driver. This is needed for this driver because on many Asus boards the BIOS or something accesses the chip in our back and causes collisions or something similar that causes many read errors. For now, these errors make the driver return temperature values of -1 from times to times.
I have been working with James Bolt on this. See the thread on the lm_sensors mailing list for details. The patch is fairly well tested. It is against 2.6.2-rc3 + your current stack of patches as I know it.
The "retry until it works" method is the best I could think of, since we have no information from Asus and I don't expect to get any. If it still doesn't work after an arbitrary number (5) of tries it returns the previously known value and generates an error in the logs. James' tests showed that it will probably never happen though (highest retry count was 3 and happened once out of 3000 reads) unless we lower the arbitrary number (but we don't want to, do we?)
I inserted incremental delays as reads fail, I felt like it should help avoid collisions with whatever-is-bugging-us. Seems to work OK, but it's not perfect (since we sometimes need 3 retries) and I didn't test with a different policy (no delay, constant delay or different increment).
drivers/i2c/chips/w83l785ts.c | 55 +++++++++++++++++++++++++++++++----------- 1 files changed, 41 insertions(+), 14 deletions(-)
drivers/i2c/chips/w83l785ts.c +41 -14
@@ -38,6 +38,9 @@#include <linux/i2c.h> #include <linux/i2c-sensor.h> +/* How many retries on register read error */ +#define MAX_RETRIES 5 +/* * Address to scan * Address is fully defined internally and cannot be changed.
@@ -82,6 +85,7 @@static int w83l785ts_detect (struct i2c_adapter *adapter,int address,int kind);static int w83l785ts_detach_client (struct i2c_client *client); +static u8 w83l785ts_read_value (struct i2c_client *client,u8 reg,u8 defval);static void w83l785ts_update_client (struct i2c_client *client);/*
@@ -196,10 +200,10 @@* are skipped. */ if (kind <0 ) {/* detection */ -if (((i2c_smbus_read_byte_data (new_client, -W83L785TS_REG_CONFIG ) &0x80 ) !=0x00 ) - || ((i2c_smbus_read_byte_data (new_client, -W83L785TS_REG_TYPE ) &0xFC ) !=0x00 )) { +if (((w83l785ts_read_value (new_client, +W83L785TS_REG_CONFIG ,0 ) &0x80 ) !=0x00 ) + || ((w83l785ts_read_value (new_client, +W83L785TS_REG_TYPE ,0 ) &0xFC ) !=0x00 )) {dev_dbg (&adapter->dev,"W83L785TS-S detection failed at 0x%02x.\n" , address);
@@ -211,12 +215,12 @@u16 man_id;u8 chip_id; - man_id = (i2c_smbus_read_byte_data (new_client, -W83L785TS_REG_MAN_ID1 ) <<8 ) + -i2c_smbus_read_byte_data (new_client, -W83L785TS_REG_MAN_ID2 ); - chip_id =i2c_smbus_read_byte_data (new_client, -W83L785TS_REG_CHIP_ID ); + man_id = (w83l785ts_read_value (new_client, +W83L785TS_REG_MAN_ID1 ,0 ) <<8 ) + +w83l785ts_read_value (new_client, +W83L785TS_REG_MAN_ID2 ,0 ); + chip_id =w83l785ts_read_value (new_client, +W83L785TS_REG_CHIP_ID ,0 );if (man_id ==0x5CA3 ) {/* Winbond */ if (chip_id ==0x70 ) {/* W83L785TS-S */
@@ -239,6 +243,9 @@ data->valid =0 ;init_MUTEX (&data->update_lock); +/* Default values in case the first read fails (unlikely). */ + data->temp_over = data->temp =0 ; +/* Tell the I2C layer a new client has arrived. */ if ((err =i2c_attach_client (new_client))) goto exit_free;
@@ -274,6 +281,26 @@return 0 ; } +static u8 w83l785ts_read_value (struct i2c_client *client,u8 reg,u8 defval) +{ +int value, i; + +/* Frequent read errors have been reported on Asus boards, so we +* retry on read errors. If it still fails (unlikely), return the +* default value requested by the caller. */ +for (i =1 ; i <=MAX_RETRIES ; i++) { + value =i2c_smbus_read_byte_data (client, reg); +if (value >=0 ) +return value; +dev_dbg (&client->dev,"Read failed, will retry in %d.\n" , i); +i2c_delay (i); + } + +dev_err (&client->dev,"Couldn't read value from register. " +"Please report.\n" ); +return defval; +} +static void w83l785ts_update_client (struct i2c_client *client) {struct w83l785ts_data *data =i2c_get_clientdata (client);
@@ -284,10 +311,10 @@ || (jiffies - data->last_updated > HZ * 2) || (jiffies < data->last_updated)) {dev_dbg (&client->dev,"Updating w83l785ts data.\n" ); - data->temp =i2c_smbus_read_byte_data (client, -W83L785TS_REG_TEMP ); - data->temp_over =i2c_smbus_read_byte_data (client, -W83L785TS_REG_TEMP_OVER ); + data->temp =w83l785ts_read_value (client, +W83L785TS_REG_TEMP , data->temp); + data->temp_over =w83l785ts_read_value (client, +W83L785TS_REG_TEMP_OVER , data->temp_over); data->last_updated = jiffies; data->valid =1 ;