I2C update for 2.6.6
Subsystems (10)
PATCH 1/1 I2C update for 2.6.6
Hi,
Here are some i2c driver patches for 2.6.6. The majority of them have been in the -mm kernels for a few weeks. They do the following:
- rename a driver
- add a new driver
- fix some bugs
- standardize on the proper way to specify i2c devices and buses across all i2c users.
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
drivers/i2c/busses/i2c-ixp42x.c | 176 ------------- Documentation/i2c/porting-clients | 8 arch/i386/pci/irq.c | 8 drivers/i2c/algos/i2c-algo-bit.c | 10 drivers/i2c/busses/Kconfig | 12 drivers/i2c/busses/Makefile | 2 drivers/i2c/busses/i2c-ali1535.c | 4 drivers/i2c/busses/i2c-ali1563.c | 4 drivers/i2c/busses/i2c-ali15x3.c | 4 drivers/i2c/busses/i2c-amd756.c | 4 drivers/i2c/busses/i2c-amd8111.c | 4 drivers/i2c/busses/i2c-i801.c | 30 +- drivers/i2c/busses/i2c-isa.c | 4 drivers/i2c/busses/i2c-ixp4xx.c | 285 +++++++++++++++++---- drivers/i2c/busses/i2c-keywest.c | 1 drivers/i2c/busses/i2c-nforce2.c | 4 drivers/i2c/busses/i2c-parport-light.c | 4 drivers/i2c/busses/i2c-parport.c | 4 drivers/i2c/busses/i2c-piix4.c | 5 drivers/i2c/busses/i2c-sis5595.c | 4 drivers/i2c/busses/i2c-sis630.c | 4 drivers/i2c/busses/i2c-sis96x.c | 4 drivers/i2c/busses/i2c-via.c | 4 drivers/i2c/busses/i2c-viapro.c | 4 drivers/i2c/busses/i2c-voodoo3.c | 4 drivers/i2c/busses/scx200_acb.c | 1 drivers/i2c/busses/scx200_i2c.c | 1 drivers/i2c/chips/Kconfig | 18 + drivers/i2c/chips/Makefile | 1 drivers/i2c/chips/adm1021.c | 4 drivers/i2c/chips/asb100.c | 12 drivers/i2c/chips/fscher.c | 4 drivers/i2c/chips/gl518sm.c | 4 drivers/i2c/chips/it87.c | 82 ++++++ drivers/i2c/chips/lm75.c | 4 drivers/i2c/chips/lm78.c | 4 drivers/i2c/chips/lm80.c | 4 drivers/i2c/chips/lm83.c | 4 drivers/i2c/chips/lm90.c | 53 ++-- drivers/i2c/chips/rtc8564.c | 396 ++++++++++++++++++++++++++++++ drivers/i2c/chips/rtc8564.h | 78 +++++ drivers/i2c/chips/via686a.c | 123 +++------ drivers/i2c/chips/w83781d.c | 38 +- drivers/i2c/chips/w83l785ts.c | 4 drivers/ide/pci/piix.c | 8 drivers/ide/pci/piix.h | 2 drivers/media/video/bt832.c | 2 drivers/media/video/bttv-i2c.c | 8 drivers/media/video/cx88/cx88-i2c.c | 4 drivers/media/video/dpc7146.c | 2 drivers/media/video/hexium_gemini.c | 2 drivers/media/video/hexium_orion.c | 2 drivers/media/video/msp3400.c | 4 drivers/media/video/mxb.c | 2 drivers/media/video/saa5246a.c | 2 drivers/media/video/saa5249.c | 2 drivers/media/video/saa7111.c | 59 ++++ drivers/media/video/saa7134/saa6752hs.c | 2 drivers/media/video/saa7134/saa7134-i2c.c | 4 drivers/media/video/tda7432.c | 4 drivers/media/video/tda9875.c | 4 drivers/media/video/tda9887.c | 4 drivers/media/video/tuner.c | 4 drivers/media/video/tvaudio.c | 4 drivers/media/video/tvmixer.c | 4 drivers/usb/media/w9968cf.c | 2 include/linux/i2c-id.h | 2 include/linux/i2c.h | 18 - include/linux/pci_ids.h | 24 + include/linux/video_decoder.h | 7 sound/oss/i810_audio.c | 10 71 files changed, 1147 insertions(+), 477 deletions(-)
-----
<bjorn:mork.no>:
o I2C: "probe" module param broken for it87 in Linux 2.6.6
<jdgaston:snoqualmie.dp.intel.com>:
o I2C: ICH6/6300ESB i2c support
<kevin:koconnor.net>:
o I2C: support I2C_M_NO_RD_ACK in i2c-algo-bit
Deepak Saxena:
o I2C: Missed ixp42x -> ixp4xx conversion
o I2C: Update IXP4xx I2C bus driver
Greg Kroah-Hartman:
o I2C: rename i2c-ip4xx.c driver
Jean Delvare:
o I2C: Rename hardware monitoring I2C class
o I2C: kill duplicate includes in i2c bus drivers
o I2C: Fix memory leaks in w83781d and asb100
o I2C: Rewrite temperature conversions in via686a driver
o I2C: Invert as99127f beep bits in kernel space
o I2C: Sensors (W83627HF) in Tyan S2882
o I2C: Voltage conversions in via686a
o I2C: Add LM99 support to the lm90 driver
Michael Hunold:
o I2C: add .class to i2c drivers
Ronald S. Bultje:
o I2C: new i2c video decoder calls: saa7111 driver
o I2C: new i2c video decoder calls
Stefan Eletzhofer:
o I2C: add I2C epson 8564 RTC chip driver
PATCH 1/1 I2C update for 2.6.6
ChangeSet 1.1587.15.1, 2004/05/01 16:47:38-07:00, [email protected]
[PATCH] I2C: Add LM99 support to the lm90 driver
The following patch adds support for the LM99 chip to the lm90 driver, on popular request. The nVidia GeForce FX 5900 series cards have such a chip on-board for monitoring the GPU temperature.
Relevant pointers:
http://archives.andrew.net.au/lm-sensors/msg07671.html
http://secure.netroedge.com/~lm78/readticket.cgi?ticket=1661
http://secure.netroedge.com/~lm78/readticket.cgi?ticket=1662
Additional effects of the patch:
* Do not consider the lm90 driver experimental anymore. I have had enough testers and not a single problem report, the driver is working OK.
* Support the LM89. According to the datasheets, it is exactly the same chip as the LM99 (to the chip ID). We've never seen this chip in a computer so far, but it doesn't cost anything to support it (actually we cannot not support it, since we have no way to differenciate with the LM99).
* Scan two addresses instead of one. The LM99 and LM89 have a "-1" variant using an alternate address.
* Update copyright year.
* Reword the identification code a bit. It is hopefully slightly less unreadable.
This patch was successfully tested by Corey Hickey.
drivers/i2c/chips/Kconfig | 6 ++--- drivers/i2c/chips/lm90.c | 49 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 15 deletions(-)
drivers/i2c/chips/Kconfig +3 -3
@@ -136,11 +136,11 @@ config SENSORS_LM90 tristate "National Semiconductor LM90 and compatibles" - depends on I2C && EXPERIMENTAL + depends on I2C select I2C_SENSOR help - If you say yes here you get support for National Semiconductor LM90 - and Analog Devices ADM1032 sensor chips. + If you say yes here you get support for National Semiconductor LM90, + LM89 and LM99, and Analog Devices ADM1032 sensor chips. This driver can also be built as a module. If so, the module will be called lm90.
drivers/i2c/chips/lm90.c +37 -12
88 lines not on this page · raw message
ChangeSet 1.1587.15.2, 2004/05/01 22:32:34-07:00, [email protected]
I2C: rename i2c-ip4xx.c driver
drivers/i2c/busses/i2c-ixp42x.c | 176 ---------------------------------------- drivers/i2c/busses/i2c-ixp4xx.c | 176 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+), 176 deletions(-)
drivers/i2c/busses/i2c-ixp42x.c deleted +0 -176
@@ -1,176 +0,0 @@ -/* -* drivers/i2c/i2c-adap-ixp42x.c -* -* Intel's IXP42x XScale NPU chipsets (IXP420, 421, 422, 425) do not have -* an on board I2C controller but provide 16 GPIO pins that are often -* used to create an I2C bus. This driver provides an i2c_adapter -* interface that plugs in under algo_bit and drives the GPIO pins -* as instructed by the alogorithm driver. -* -* Author: Deepak Saxena <[email protected]> -* -* Copyright (c) 2003-2004 MontaVista Software Inc. -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. -* -* NOTE: Since different platforms will use different GPIO pins for -* I2C, this driver uses an IXP42x-specific platform_data -* pointer to pass the GPIO numbers to the driver. This -* allows us to support all the different IXP42x platforms -* w/o having to put #ifdefs in this driver. -* -* See arch/arm/mach-ixp42x/ixdp425.c for an example of building a -* device list and filling in the ixp42x_i2c_pins data structure -* that is passed as the platform_data to this driver. -*/ - -#include <linux/config.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/device.h> -#include <linux/module.h> -#include <linux/i2c.h> - -#include <asm/hardware.h> /* Pick up IXP42x-specific bits */ - -static inline int ixp42x_scl_pin (void *data) -{ -return ((struct ixp42x_i2c_pins *)data)->scl_pin; -} - -static inline int ixp42x_sda_pin (void *data) -{ -return ((struct ixp42x_i2c_pins *)data)->sda_pin; -} - -static void ixp42x_bit_setscl (void *data,int val) -{ -gpio_line_set (ixp42x_scl_pin (data),0 ); -gpio_line_config (ixp42x_scl_pin (data), - val ?IXP425_GPIO_IN :IXP425_GPIO_OUT ); -} - -static void ixp42x_bit_setsda (void *data,int val) -{ -gpio_line_set (ixp42x_sda_pin (data),0 ); -gpio_line_config (ixp42x_sda_pin (data), - val ?IXP425_GPIO_IN :IXP425_GPIO_OUT ); -} - -static int ixp42x_bit_getscl (void *data) -{ -int scl; - -gpio_line_config (ixp42x_scl_pin (data),IXP425_GPIO_IN ); -gpio_line_get (ixp42x_scl_pin (data), &scl); - -return scl; -} - -static int ixp42x_bit_getsda (void *data) -{ -int sda; - -gpio_line_config (ixp42x_sda_pin (data),IXP425_GPIO_IN ); -gpio_line_get (ixp42x_sda_pin (data), &sda); - -return sda; -} - -struct ixp42x_i2c_data { -struct ixp42x_i2c_pins *gpio_pins; -struct i2c_adapter adapter; -struct i2c_algo_bit_data algo_data; -}; - -static int ixp42x_i2c_remove (struct device *dev) -{ -struct platform_device *plat_dev =to_platform_device (dev); -struct ixp42x_i2c_data *drv_data =dev_get_drvdata (&plat_dev->dev); - -dev_set_drvdata (&plat_dev->dev,NULL ); - -i2c_bit_del_bus (&drv_data->adapter); - -kfree (drv_data); - -return 0 ; -} - -static int ixp42x_i2c_probe (struct device *dev) -{ -int err; -struct platform_device *plat_dev =to_platform_device (dev); -struct ixp42x_i2c_pins *gpio = plat_dev->dev.platform_data; -struct ixp42x_i2c_data *drv_data = -kmalloc (sizeof (struct ixp42x_i2c_data ),GFP_KERNEL ); - -if (!drv_data) -return -ENOMEM ; - -memzero (drv_data,sizeof (struct ixp42x_i2c_data )); - drv_data->gpio_pins = gpio; - -/* -* We could make a lot of these structures static, but -* certain platforms may have multiple GPIO-based I2C -* buses for various device domains, so we need per-device -* algo_data->data. -*/ - drv_data->algo_data.data = gpio; - drv_data->algo_data.setsda = ixp42x_bit_setsda; - drv_data->algo_data.setscl = ixp42x_bit_setscl; - drv_data->algo_data.getsda = ixp42x_bit_getsda; - drv_data->algo_data.getscl = ixp42x_bit_getscl; - drv_data->algo_data.udelay =10 ; - drv_data->algo_data.mdelay =10 ; - drv_data->algo_data.timeout =100 ; - - drv_data->adapter.id =I2C_HW_B_IXP425 , - drv_data->adapter.algo_data = &drv_data->algo_data, - - drv_data->adapter.dev.parent = &plat_dev->dev; - -gpio_line_config (gpio->scl_pin,IXP425_GPIO_IN ); -gpio_line_config (gpio->sda_pin,IXP425_GPIO_IN ); -gpio_line_set (gpio->scl_pin,0 ); -gpio_line_set (gpio->sda_pin,0 ); - -if ((err =i2c_bit_add_bus (&drv_data->adapter) !=0 )) { -printk (KERN_ERR "ERROR: Could not install %s\n" , dev->bus_id); - -kfree (drv_data); -return err; - } - -dev_set_drvdata (&plat_dev->dev, drv_data); - -return 0 ; -} - -static struct device_driver ixp42x_i2c_driver = { - .name ="IXP42X-I2C" , - .bus = &platform_bus_type, - .probe = ixp42x_i2c_probe, - .remove = ixp42x_i2c_remove, -}; - -static int __init ixp42x_i2c_init (void ) -{ -return driver_register (&ixp42x_i2c_driver); -} - -static void __exit ixp42x_i2c_exit(void) -{ -driver_unregister (&ixp42x_i2c_driver); -} - -module_init (ixp42x_i2c_init); -module_exit (ixp42x_i2c_exit); - -MODULE_DESCRIPTION ("GPIO-based I2C driver for IXP42x systems" ); -MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Deepak Saxena <[email protected]>" ); -
drivers/i2c/busses/i2c-ixp4xx.c new file +176 -0
176 lines not on this page · raw message
ChangeSet 1.1587.15.3, 2004/05/01 22:33:50-07:00, [email protected]
[PATCH] I2C: Voltage conversions in via686a
My previous patch was actually not correct, reading from the chip's registers was fixed but writing limits to it wasn't. This new version of the patch should be better. Sorry for the trouble.
drivers/i2c/chips/via686a.c | 56 ++++++++++++++++++-------------------------- 1 files changed, 24 insertions(+), 32 deletions(-)
drivers/i2c/chips/via686a.c +24 -32
@@ -108,7 +108,7 @@#define VIA686A_TEMP_MODE_MASK 0x3F#define VIA686A_TEMP_MODE_CONTINUOUS (0x00) -/* Conversions. Rounding and limit checking is only done on the TO_REG +/* Conversions. Limit checking is only done on the TO_REG variants. ********* VOLTAGE CONVERSIONS (Bob Dougherty) ********
@@ -123,49 +123,41 @@volts = (25*regVal+133)*factor regVal = (volts/factor-133)/25 (These conversions were contributed by Jonathan Teh Soon Yew -<[email protected]>) -- These get us close, but they don't completely agree with what my BIOS -says- they are all a bit low. But, it all we have to go on... */ +<[email protected]>) */ static inline u8 IN_TO_REG (long val,int inNum) { -/* to avoid floating point, we multiply everything by 100. -val is guaranteed to be positive, so we can achieve the effect of -rounding by (...*10+5)/10. Note that the *10 is hidden in the -/250 (which should really be /2500). -At the end, we need to /100 because we *100 everything and we need -to /10 because of the rounding thing, so we /1000. */ +/* To avoid floating point, we multiply constants by 10 (100 for +12V). +Rounding is done (120500 is actually 133000 - 12500). +Remember that val is expressed in 0.001V/bit, which is why we divide +by an additional 10000 (100000 for +12V): 1000 for val and 10 (100) +for the constants. */ if (inNum <=1 )return (u8 ) -SENSORS_LIMIT (((val *210240 -13300 ) /250 +5 ) /1000 , -0 ,255 ); +SENSORS_LIMIT ((val *21024 -1205000 ) /250000 ,0 ,255 );else if (inNum ==2 )return (u8 ) -SENSORS_LIMIT (((val *157370 -13300 ) /250 +5 ) /1000 , -0 ,255 ); +SENSORS_LIMIT ((val *15737 -1205000 ) /250000 ,0 ,255 );else if (inNum ==3 )return (u8 ) -SENSORS_LIMIT (((val *101080 -13300 ) /250 +5 ) /1000 , -0 ,255 ); +SENSORS_LIMIT ((val *10108 -1205000 ) /250000 ,0 ,255 );else -return (u8 )SENSORS_LIMIT (((val *41714 -13300 ) /250 +5 ) - /1000 ,0 ,255 ); +return (u8 ) +SENSORS_LIMIT ((val *41714 -12050000 ) /2500000 ,0 ,255 ); }static inline long IN_FROM_REG (u8 val,int inNum) { -/* to avoid floating point, we multiply everything by 100. -val is guaranteed to be positive, so we can achieve the effect of -rounding by adding 0.5. Or, to avoid fp math, we do (...*10+5)/10. -We need to scale with *100 anyway, so no need to /100 at the end. */ +/* To avoid floating point, we multiply constants by 10 (100 for +12V). +We also multiply them by 1000 because we want 0.001V/bit for the +output value. Rounding is done. */ if (inNum <=1 ) -return (long ) (((250000 * val +13300 ) /210240 *10 +5 ) /10 ); +return (long ) ((250000 * val +1330000 +21024 /2 ) /21024 );else if (inNum ==2 ) -return (long ) (((250000 * val +13300 ) /157370 *10 +5 ) /10 ); +return (long ) ((250000 * val +1330000 +15737 /2 ) /15737 );else if (inNum ==3 ) -return (long ) (((250000 * val +13300 ) /101080 *10 +5 ) /10 ); +return (long ) ((250000 * val +1330000 +10108 /2 ) /10108 );else -return (long ) (((250000 * val +13300 ) /41714 *10 +5 ) /10 ); +return (long ) ((2500000 * val +13300000 +41714 /2 ) /41714 ); }/********* FAN RPM CONVERSIONS ********/
@@ -375,24 +367,24 @@/* 7 voltage sensors */ static ssize_t show_in (struct device *dev,char *buf,int nr) {struct via686a_data *data =via686a_update_device (dev); -return sprintf (buf,"%ld\n" ,IN_FROM_REG (data->in[nr], nr)*10 ); +return sprintf (buf,"%ld\n" ,IN_FROM_REG (data->in[nr], nr)); }static ssize_t show_in_min (struct device *dev,char *buf,int nr) {struct via686a_data *data =via686a_update_device (dev); -return sprintf (buf,"%ld\n" ,IN_FROM_REG (data->in_min[nr], nr)*10 ); +return sprintf (buf,"%ld\n" ,IN_FROM_REG (data->in_min[nr], nr)); }static ssize_t show_in_max (struct device *dev,char *buf,int nr) {struct via686a_data *data =via686a_update_device (dev); -return sprintf (buf,"%ld\n" ,IN_FROM_REG (data->in_max[nr], nr)*10 ); +return sprintf (buf,"%ld\n" ,IN_FROM_REG (data->in_max[nr], nr)); }static ssize_t set_in_min (struct device *dev,const char *buf,size_t count,int nr) {struct i2c_client *client =to_i2c_client (dev);struct via686a_data *data =i2c_get_clientdata (client); -unsigned long val =simple_strtoul (buf,NULL ,10 )/10 ; +unsigned long val =simple_strtoul (buf,NULL ,10 ); data->in_min[nr] =IN_TO_REG (val,nr);via686a_write_value (client,VIA686A_REG_IN_MIN (nr), data->in_min[nr]);
@@ -402,7 +394,7 @@ size_t count, int nr) {struct i2c_client *client =to_i2c_client (dev);struct via686a_data *data =i2c_get_clientdata (client); -unsigned long val =simple_strtoul (buf,NULL ,10 )/10 ; +unsigned long val =simple_strtoul (buf,NULL ,10 ); data->in_max[nr] =IN_TO_REG (val,nr);via686a_write_value (client,VIA686A_REG_IN_MAX (nr), data->in_max[nr]);
ChangeSet 1.1587.15.4, 2004/05/01 22:34:26-07:00, [email protected]
[PATCH] I2C: support I2C_M_NO_RD_ACK in i2c-algo-bit
I have an I2C device (Samsung ks0127 video grabber) with a peculiar i2c implementation. When reading bytes, it only senses for the stop condition in the place where the acknowledge bit should be. So, to properly support this device acks need to be turned off during reads.
There is an I2C_M_NO_RD_ACK bit already defined in i2c.h which appears to be what I want. Unfortunately it doesn't seem to be used anywhere in the current tree. At the end of this message is a patch to teach i2c_algo_bit to honor the bit.
drivers/i2c/algos/i2c-algo-bit.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +7 -3
@@ -381,7 +381,13 @@break ; } -if ( count >1 ) {/* send ack */ + temp++; + count--; + +if (msg->flags &I2C_M_NO_RD_ACK ) +continue ; + +if ( count >0 ) {/* send ack */ sdalo (adap);DEBPROTO (printk (" Am " )); }else {
@@ -395,8 +401,6 @@ };scllo (adap);sdahi (adap); - temp++; - count--; }return rdcount; }
ChangeSet 1.1587.15.5, 2004/05/01 22:35:09-07:00, [email protected]
[PATCH] I2C: Update IXP4xx I2C bus driver
The 2.6 IXP4xx code has been cleaned up to change all references to IXP42x/IXP425 with IXP4xx. The following patch updates the I2C bits. Before applying, you need to 'bk move i2c-ixp42x.c ixp-4xx.c".
drivers/i2c/busses/Kconfig | 10 +-- drivers/i2c/busses/Makefile | 2 drivers/i2c/busses/i2c-ixp4xx.c | 109 ++++++++++++++++++++-------------------- 3 files changed, 63 insertions(+), 58 deletions(-)
drivers/i2c/busses/Kconfig +5 -5
@@ -145,16 +145,16 @@ This support is also available as a module. If so, the module will be called i2c-ite. -config I2C_IXP42X - tristate "IXP42x GPIO-Based I2C Interface" - depends on I2C && ARCH_IXP425 +config I2C_IXP4XX + tristate "IXP4xx GPIO-Based I2C Interface" + depends on I2C && ARCH_IXP4XX select I2C_ALGOBIT help - Say Y here if you have an Intel IXP42x(420,421,422,425) based + Say Y here if you have an Intel IXP4xx(420,421,422,425) based system and are using GPIO lines for an I2C bus. This support is also available as a module. If so, the module - will be called i2c-ixp42x. + will be called i2c-ixp4xx. config I2C_KEYWEST tristate "Powermac Keywest I2C interface"
drivers/i2c/busses/Makefile +1 -1
@@ -15,7 +15,7 @@ obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o obj-$(CONFIG_I2C_ISA) += i2c-isa.o obj-$(CONFIG_I2C_ITE) += i2c-ite.o -obj-$(CONFIG_I2C_IXP42X) += i2c-ixp42x.o +obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o
drivers/i2c/busses/i2c-ixp4xx.c +57 -52
209 lines not on this page · raw message
ChangeSet 1.1587.15.6, 2004/05/01 23:04:01-07:00, [email protected]
[PATCH] I2C: add I2C epson 8564 RTC chip driver
Add support for the Epson 8564 RTC chip.
drivers/i2c/chips/Kconfig | 10 + drivers/i2c/chips/Makefile | 1 drivers/i2c/chips/rtc8564.c | 396 ++++++++++++++++++++++++++++++++++++++++++++ drivers/i2c/chips/rtc8564.h | 78 ++++++++ 4 files changed, 485 insertions(+)
drivers/i2c/chips/Kconfig +10 -0
@@ -230,4 +230,14 @@ This driver can also be built as a module. If so, the module will be called pcf8591. +config SENSORS_RTC8564 + tristate "Epson 8564 RTC chip" + depends on I2C && EXPERIMENTAL + select I2C_SENSOR + help + If you say yes here you get support for the Epson 8564 RTC chip. + + This driver can also be built as a module. If so, the module + will be called i2c-rtc8564. + endmenu
drivers/i2c/chips/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_SENSORS_LM90) += lm90.o obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o +obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o obj-$(CONFIG_SENSORS_VIA686A) += via686a.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
drivers/i2c/chips/rtc8564.c new file +396 -0
396 lines not on this page · raw message
drivers/i2c/chips/rtc8564.h new file +78 -0
78 lines not on this page · raw message
ChangeSet 1.1587.15.7, 2004/05/05 15:33:39-07:00, [email protected]
[PATCH] I2C: Sensors (W83627HF) in Tyan S2882
drivers/i2c/chips/Kconfig | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/chips/Kconfig +1 -1
@@ -163,7 +163,7 @@ select I2C_SENSOR help If you say yes here you get support for the Winbond W8378x series - of sensor chips: the W83781D, W83782D, W83783S and W83682HF, + of sensor chips: the W83781D, W83782D, W83783S and W83627HF, and the similar Asus AS99127F. This driver can also be built as a module. If so, the module
ChangeSet 1.1587.15.8, 2004/05/05 15:34:00-07:00, [email protected]
[PATCH] I2C: Invert as99127f beep bits in kernel space
The following patch changes the way we invert beep bits for the AS99127F sensor chip. This chip behaves differently from the other chips in that a disabled bit is 1, not 0. So far we didn't handle that specificity in the w83781d driver, so it was left to user-space applications to handle it. For the sake of uniformity, it's obviously better if it's done in the driver instead (although the meaning of each bit is still chip-dependant).
I already did a similar change to the 2.4 driver and the sensors program. I don't think that many user-space application will be affected, since most of them don't handle the beep mask as far as I can tell.
This also close Debian bug #209299:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=209299
Successfully tested on my AS99127F rev.1 chip. Aurelien Jarno also checked that there were no regression on non-Asus chips.
drivers/i2c/chips/w83781d.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)
drivers/i2c/chips/w83781d.c +16 -10
@@ -183,8 +183,10 @@#define ALARMS_FROM_REG (val) (val)#define PWM_FROM_REG (val) (val)#define PWM_TO_REG (val) (SENSORS_LIMIT((val),0,255)) -#define BEEP_MASK_FROM_REG (val) (val) -#define BEEP_MASK_TO_REG (val) ((val) & 0xffffff) +#define BEEP_MASK_FROM_REG (val,type) ((type) == as99127f ? \ + (val) ^ 0x7fff : (val)) +#define BEEP_MASK_TO_REG (val,type) ((type) == as99127f ? \ + (~(val)) & 0x7fff : (val) & 0xffffff)#define BEEP_ENABLE_TO_REG (val) ((val) ? 1 : 0)#define BEEP_ENABLE_FROM_REG (val) ((val) ? 1 : 0)
@@ -539,14 +541,18 @@ DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL)#define device_create_file_alarms (client) \ device_create_file(&client->dev, &dev_attr_alarms); -#define show_beep_reg (REG , reg) \ -static ssize_t show_beep_##reg (struct device *dev, char *buf) \ -{ \ - struct w83781d_data *data = w83781d_update_device(dev); \ - return sprintf(buf,"%ld\n", (long)BEEP_##REG##_FROM_REG(data->beep_##reg)); \ +static ssize_t show_beep_mask (struct device *dev,char *buf) +{ +struct w83781d_data *data =w83781d_update_device (dev); +return sprintf (buf,"%ld\n" , + (long )BEEP_MASK_FROM_REG (data->beep_mask, data->type)); +} +static ssize_t show_beep_enable (struct device *dev,char *buf) +{ +struct w83781d_data *data =w83781d_update_device (dev); +return sprintf (buf,"%ld\n" , + (long )BEEP_ENABLE_FROM_REG (data->beep_enable)); } -show_beep_reg (ENABLE , enable); -show_beep_reg (MASK , mask);#define BEEP_ENABLE 0/* Store beep_enable */ #define BEEP_MASK 1/* Store beep_mask */
@@ -562,7 +568,7 @@ val =simple_strtoul (buf,NULL ,10 );if (update_mask ==BEEP_MASK ) {/* We are storing beep_mask */ - data->beep_mask =BEEP_MASK_TO_REG (val); + data->beep_mask =BEEP_MASK_TO_REG (val, data->type);w83781d_write_value (client,W83781D_REG_BEEP_INTS1 , data->beep_mask &0xff );
ChangeSet 1.1587.15.9, 2004/05/05 15:34:20-07:00, [email protected]
[PATCH] I2C: Rewrite temperature conversions in via686a driver
The following patch rewrites the temperature conversion macros and functions found in the via686a chip driver. Contrary to the voltage conversions a few weeks ago, temperature conversions were numerically correct, but artificially complex. The new ones are cleaner. It also fixes a highly improbable array overflow (would take one of the measured temperatures to be over 145 degrees C).
Successfully tested by Mark D. Studebaker and I, and already applied to our CVS repository.
drivers/i2c/chips/via686a.c | 63 ++++++++++++++------------------------------ 1 files changed, 21 insertions(+), 42 deletions(-)
drivers/i2c/chips/via686a.c +21 -42
@@ -268,52 +268,31 @@ 239, 240 }; -/* Converting temps to (8-bit) hyst and over registers -No interpolation here. Just check the limits and go. -The +5 effectively rounds off properly and the +50 is because -the temps start at -50 */ +/* Converting temps to (8-bit) hyst and over registers +No interpolation here. +The +50 is because the temps start at -50 */ static inline u8 TEMP_TO_REG (long val) { -return (u8 ) -SENSORS_LIMIT (viaLUT[((val <=-500 ) ?0 : (val >=1100 ) ?160 : - ((val +5 ) /10 +50 ))],0 ,255 ); +return viaLUT[val <=-50000 ?0 : val >=110000 ?160 : + (val <0 ? val -500 : val +500 ) /1000 +50 ]; } -/* for 8-bit temperature hyst and over registers -The temp values are already *10, so we don't need to do that. -But we _will_ round these off to the nearest degree with (...*10+5)/10 */ -#define TEMP_FROM_REG (val) ((tempLUT[(val)]*10+5)/10) - -/* for 10-bit temperature readings -You might _think_ this is too long to inline, but's it's really only -called once... */ +/* for 8-bit temperature hyst and over registers */ +#define TEMP_FROM_REG (val) (tempLUT[(val)] * 100) + +/* for 10-bit temperature readings */ static inline long TEMP_FROM_REG10 (u16 val) { -/* the temp values are already *10, so we don't need to do that. */ -long temp;u16 eightBits = val >>2 ;u16 twoBits = val &3 ; -/* handle the extremes first (they won't interpolate well! ;-) */ -if (val ==0 ) -return (long ) tempLUT[0 ]; -if (val ==1023 ) -return (long ) tempLUT[255 ]; - -if (twoBits ==0 ) -return (long ) tempLUT[eightBits]; -else { -/* do some interpolation by multipying the lower and upper -bounds by 25, 50 or 75, then /100. */ - temp = ((25 * (4 - twoBits)) * tempLUT[eightBits] - + (25 * twoBits) * tempLUT[eightBits +1 ]); -/* increase the magnitude by 50 to achieve rounding. */ -if (temp >0 ) - temp +=50 ; -else - temp -=50 ; -return (temp /100 ); - } +/* no interpolation for these */ +if (twoBits ==0 || eightBits ==255 ) +return TEMP_FROM_REG (eightBits); + +/* do some linear interpolation */ +return (tempLUT[eightBits] * (4 - twoBits) + + tempLUT[eightBits +1 ] * twoBits) *25 ; }#define ALARMS_FROM_REG (val) (val)
@@ -441,21 +420,21 @@/* 3 temperatures */ static ssize_t show_temp (struct device *dev,char *buf,int nr) {struct via686a_data *data =via686a_update_device (dev); -return sprintf (buf,"%ld\n" ,TEMP_FROM_REG10 (data->temp[nr])*100 ); +return sprintf (buf,"%ld\n" ,TEMP_FROM_REG10 (data->temp[nr])); }static ssize_t show_temp_over (struct device *dev,char *buf,int nr) {struct via686a_data *data =via686a_update_device (dev); -return sprintf (buf,"%ld\n" ,TEMP_FROM_REG (data->temp_over[nr])*100 ); +return sprintf (buf,"%ld\n" ,TEMP_FROM_REG (data->temp_over[nr])); }static ssize_t show_temp_hyst (struct device *dev,char *buf,int nr) {struct via686a_data *data =via686a_update_device (dev); -return sprintf (buf,"%ld\n" ,TEMP_FROM_REG (data->temp_hyst[nr])*100 ); +return sprintf (buf,"%ld\n" ,TEMP_FROM_REG (data->temp_hyst[nr])); }static ssize_t set_temp_over (struct device *dev,const char *buf,size_t count,int nr) {struct i2c_client *client =to_i2c_client (dev);struct via686a_data *data =i2c_get_clientdata (client); -int val =simple_strtol (buf,NULL ,10 )/100 ; +int val =simple_strtol (buf,NULL ,10 ); data->temp_over[nr] =TEMP_TO_REG (val);via686a_write_value (client,VIA686A_REG_TEMP_OVER (nr), data->temp_over[nr]);return count;
@@ -464,7 +443,7 @@ size_t count, int nr) {struct i2c_client *client =to_i2c_client (dev);struct via686a_data *data =i2c_get_clientdata (client); -int val =simple_strtol (buf,NULL ,10 )/100 ; +int val =simple_strtol (buf,NULL ,10 ); data->temp_hyst[nr] =TEMP_TO_REG (val);via686a_write_value (client,VIA686A_REG_TEMP_HYST (nr), data->temp_hyst[nr]);return count;
ChangeSet 1.1587.15.10, 2004/05/05 15:34:40-07:00, [email protected]
[PATCH] I2C: Fix memory leaks in w83781d and asb100
Quoting myself
Quoted 9 lines
U-ho. I think I've introduced a memory leak with this patch :(
For drivers that handle subclients (asb100 and w83781d on i2c), the sublient memory is never released if I read the code correctly. This is because we now free the private data on unload, assuming that it contains the i2c client data as well. That's true for the main i2c client, but not for the subclients (data == NULL so nothing is freed).
Could someone take a look and confirm?
I could test and actually saw memory leaking when cycling the w83781d driver at a sustained rate (5/s).
Quoted 10 lines
I can see two different fixes:
1* When freeing the memory, free the data if it's not NULL (main client), else free client (subclients). Cleaner (I suppose?).
2* When creating subclients, do data = &client instead of data = NULL. Then freeing will work. Less code, faster. Are there side effects? (I don't think so)
My preference would go to 2*.
I ended up implementing 1*. That's cleaner and there's actually almost no extra code.
Mark, can you confirm that I'm doing the correct thing? I'll do something similar in our CVS repository (for now, the asb100 and w83781d drivers had not their memory allocation scheme reworked there).
drivers/i2c/chips/asb100.c | 8 +++++++- drivers/i2c/chips/w83781d.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/i2c/chips/asb100.c +7 -1
@@ -855,7 +855,13 @@return err; } -kfree (i2c_get_clientdata (client)); +if (i2c_get_clientdata (client)==NULL ) { +/* subclients */ +kfree (client); + }else { +/* main client */ +kfree (i2c_get_clientdata (client)); + }return 0 ; }
drivers/i2c/chips/w83781d.c +7 -1
@@ -1336,7 +1336,13 @@return err; } -kfree (i2c_get_clientdata (client)); +if (i2c_get_clientdata (client)==NULL ) { +/* subclients */ +kfree (client); + }else { +/* main client */ +kfree (i2c_get_clientdata (client)); + }return 0 ; }
ChangeSet 1.1587.15.11, 2004/05/05 16:14:40-07:00, [email protected]
[PATCH] I2C: add .class to i2c drivers
in the "[RFC|PATCH][2.6] Additional i2c adapter flags for i2c client isolation" thread, the i2c people have agreed that an ".class" field should be added to struct i2c_driver.
Currently only drivers do checks for plausibility ("Is this an adapter I can attach to?"), but adapters don't have a chance to keep drivers away from their bus.
If both drivers and adapters provide a .class entry, the i2c-core can easily compare them and let devices only probe on busses where they can really exist.
Real world example: DVB i2c adapters cannot ensure that only known DVB i2c chipsets probe their busses. Most client drivers probe every bus they get their hands on. This will confuse some DVB i2c busses.
With the new I2C_CLASS_ALL flag it will be possible that an adapter can request that really all drivers are probed on the adapter. On the other hand, drivers can make sure that they get the chance to probe on every i2c adapter out there (this is not encouraged, though)
The attached patch does the first step:
- add .class member to struct i2c_device
- remove unused .flags member from struct i2c_adapter
- rename I2C_ADAP_CLASS_xxx to I2C_CLASS_xxx (to be used both for drivers and adapters)
- add new I2C_CLASS_ALL and I2C_CLASS_SOUND classes
- follow these changes in the existing drivers with copy & paste
Documentation/i2c/porting-clients | 4 ++-- drivers/i2c/busses/i2c-ali1535.c | 2 +- drivers/i2c/busses/i2c-ali1563.c | 2 +- drivers/i2c/busses/i2c-ali15x3.c | 2 +- drivers/i2c/busses/i2c-amd756.c | 2 +- drivers/i2c/busses/i2c-amd8111.c | 2 +- drivers/i2c/busses/i2c-i801.c | 2 +- drivers/i2c/busses/i2c-isa.c | 2 +- drivers/i2c/busses/i2c-nforce2.c | 2 +- drivers/i2c/busses/i2c-parport-light.c | 2 +- drivers/i2c/busses/i2c-parport.c | 2 +- drivers/i2c/busses/i2c-piix4.c | 2 +- drivers/i2c/busses/i2c-sis5595.c | 2 +- drivers/i2c/busses/i2c-sis630.c | 2 +- drivers/i2c/busses/i2c-sis96x.c | 2 +- drivers/i2c/busses/i2c-via.c | 2 +- drivers/i2c/busses/i2c-viapro.c | 2 +- drivers/i2c/busses/i2c-voodoo3.c | 4 ++-- drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/asb100.c | 2 +- drivers/i2c/chips/fscher.c | 2 +- drivers/i2c/chips/gl518sm.c | 2 +- drivers/i2c/chips/it87.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- drivers/i2c/chips/lm78.c | 2 +- drivers/i2c/chips/lm80.c | 2 +- drivers/i2c/chips/lm83.c | 2 +- drivers/i2c/chips/lm90.c | 2 +- drivers/i2c/chips/via686a.c | 2 +- drivers/i2c/chips/w83781d.c | 2 +- drivers/i2c/chips/w83l785ts.c | 2 +- drivers/media/video/bt832.c | 2 +- drivers/media/video/bttv-i2c.c | 8 ++++---- drivers/media/video/cx88/cx88-i2c.c | 4 ++-- drivers/media/video/dpc7146.c | 2 +- drivers/media/video/hexium_gemini.c | 2 +- drivers/media/video/hexium_orion.c | 2 +- drivers/media/video/msp3400.c | 4 ++-- drivers/media/video/mxb.c | 2 +- drivers/media/video/saa5246a.c | 2 +- drivers/media/video/saa5249.c | 2 +- drivers/media/video/saa7134/saa6752hs.c | 2 +- drivers/media/video/saa7134/saa7134-i2c.c | 4 ++-- drivers/media/video/tda7432.c | 4 ++-- drivers/media/video/tda9875.c | 4 ++-- drivers/media/video/tda9887.c | 4 ++-- drivers/media/video/tuner.c | 4 ++-- drivers/media/video/tvaudio.c | 4 ++-- drivers/media/video/tvmixer.c | 4 ++-- drivers/usb/media/w9968cf.c | 2 +- include/linux/i2c.h | 16 +++++++++------- 51 files changed, 73 insertions(+), 71 deletions(-)
Documentation/i2c/porting-clients +2 -2
@@ -62,9 +62,9 @@ patch to the Documentation/i2c/sysfs-interface file. * [Attach] For I2C drivers, the attach function should make sure - that the adapter's class has I2C_ADAP_CLASS_SMBUS, using the + that the adapter's class has I2C_CLASS_SMBUS, using the following construct: - if (!(adapter->class & I2C_ADAP_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_SMBUS)) return 0; ISA-only drivers of course don't need this.
drivers/i2c/busses/i2c-ali1535.c +1 -1
@@ -480,7 +480,7 @@static struct i2c_adapter ali1535_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-ali1563.c +1 -1
@@ -357,7 +357,7 @@static struct i2c_adapter ali1563_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &ali1563_algorithm, };
drivers/i2c/busses/i2c-ali15x3.c +1 -1
@@ -470,7 +470,7 @@static struct i2c_adapter ali15x3_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-amd756.c +1 -1
@@ -303,7 +303,7 @@static struct i2c_adapter amd756_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-amd8111.c +1 -1
@@ -359,7 +359,7 @@ smbus->adapter.owner =THIS_MODULE ;snprintf (smbus->adapter.name,I2C_NAME_SIZE ,"SMBus2 AMD8111 adapter at %04x" , smbus->base); - smbus->adapter.class =I2C_ADAP_CLASS_SMBUS ; + smbus->adapter.class =I2C_CLASS_SMBUS ; smbus->adapter.algo = &smbus_algorithm; smbus->adapter.algo_data = smbus;
drivers/i2c/busses/i2c-i801.c +1 -1
@@ -539,7 +539,7 @@static struct i2c_adapter i801_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-isa.c +1 -1
@@ -43,7 +43,7 @@/* There can only be one... */ static struct i2c_adapter isa_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &isa_algorithm, .name ="ISA main adapter" , };
drivers/i2c/busses/i2c-nforce2.c +1 -1
@@ -119,7 +119,7 @@static struct i2c_adapter nforce2_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-parport-light.c +1 -1
@@ -112,7 +112,7 @@static struct i2c_adapter parport_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .id =I2C_HW_B_LP , .algo_data = &parport_algo_data, .name ="Parallel port adapter (light)" ,
drivers/i2c/busses/i2c-parport.c +1 -1
@@ -147,7 +147,7 @@static struct i2c_adapter parport_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .id =I2C_HW_B_LP , .name ="Parallel port adapter" , };
drivers/i2c/busses/i2c-piix4.c +1 -1
@@ -410,7 +410,7 @@static struct i2c_adapter piix4_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-sis5595.c +1 -1
@@ -360,7 +360,7 @@static struct i2c_adapter sis5595_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .name ="unset" , .algo = &smbus_algorithm, };
drivers/i2c/busses/i2c-sis630.c +1 -1
@@ -456,7 +456,7 @@static struct i2c_adapter sis630_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .name ="unset" , .algo = &smbus_algorithm, };
drivers/i2c/busses/i2c-sis96x.c +1 -1
@@ -260,7 +260,7 @@static struct i2c_adapter sis96x_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-via.c +1 -1
@@ -88,7 +88,7 @@static struct i2c_adapter vt586b_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .name ="VIA i2c" , .algo_data = &bit_data, };
drivers/i2c/busses/i2c-viapro.c +1 -1
@@ -289,7 +289,7 @@static struct i2c_adapter vt596_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_SMBUS , + .class =I2C_CLASS_SMBUS , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-voodoo3.c +2 -2
@@ -167,7 +167,7 @@static struct i2c_adapter voodoo3_i2c_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_TV_ANALOG , + .class =I2C_CLASS_TV_ANALOG , .name ="I2C Voodoo3/Banshee adapter" , .algo_data = &voo_i2c_bit_data, };
@@ -184,7 +184,7 @@static struct i2c_adapter voodoo3_ddc_adapter = { .owner =THIS_MODULE , - .class =I2C_ADAP_CLASS_DDC , + .class =I2C_CLASS_DDC , .name ="DDC Voodoo3/Banshee adapter" , .algo_data = &voo_ddc_bit_data, };
drivers/i2c/chips/adm1021.c +1 -1
@@ -200,7 +200,7 @@static int adm1021_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, adm1021_detect); }
drivers/i2c/chips/asb100.c +1 -1
@@ -609,7 +609,7 @@*/ static int asb100_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, asb100_detect); }
drivers/i2c/chips/fscher.c +1 -1
@@ -293,7 +293,7 @@static int fscher_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, fscher_detect); }
drivers/i2c/chips/gl518sm.c +1 -1
@@ -335,7 +335,7 @@static int gl518_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, gl518_detect); }
drivers/i2c/chips/it87.c +1 -1
@@ -500,7 +500,7 @@* when a new adapter is inserted (and it87_driver is still present) */ static int it87_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, it87_detect); }
drivers/i2c/chips/lm75.c +1 -1
@@ -105,7 +105,7 @@static int lm75_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, lm75_detect); }
drivers/i2c/chips/lm78.c +1 -1
@@ -488,7 +488,7 @@* when a new adapter is inserted (and lm78_driver is still present) */ static int lm78_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, lm78_detect); }
drivers/i2c/chips/lm80.c +1 -1
@@ -376,7 +376,7 @@static int lm80_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, lm80_detect); }
drivers/i2c/chips/lm83.c +1 -1
@@ -216,7 +216,7 @@static int lm83_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, lm83_detect); }
drivers/i2c/chips/lm90.c +1 -1
@@ -274,7 +274,7 @@static int lm90_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, lm90_detect); }
drivers/i2c/chips/via686a.c +1 -1
@@ -573,7 +573,7 @@/* This is called when the module is loaded */ static int via686a_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, via686a_detect); }
drivers/i2c/chips/w83781d.c +1 -1
@@ -911,7 +911,7 @@static int w83781d_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, w83781d_detect); }
drivers/i2c/chips/w83l785ts.c +1 -1
@@ -145,7 +145,7 @@static int w83l785ts_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_ADAP_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_SMBUS ))return 0 ;return i2c_detect (adapter, &addr_data, w83l785ts_detect); }
drivers/media/video/bt832.c +1 -1
@@ -197,7 +197,7 @@static int bt832_probe (struct i2c_adapter *adap) { -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, bt832_attach);return 0 ; }
drivers/media/video/bttv-i2c.c +4 -4
@@ -108,8 +108,8 @@ .inc_use = bttv_inc_use, .dec_use = bttv_dec_use,#endif -#ifdef I2C_ADAP_CLASS_TV_ANALOG - .class = I2C_ADAP_CLASS_TV_ANALOG, +#ifdef I2C_CLASS_TV_ANALOG + .class = I2C_CLASS_TV_ANALOG,#endif I2C_DEVNAME("bt848"), .id = I2C_HW_B_BT848,
@@ -291,8 +291,8 @@ .inc_use = bttv_inc_use, .dec_use = bttv_dec_use,#endif -#ifdef I2C_ADAP_CLASS_TV_ANALOG - .class = I2C_ADAP_CLASS_TV_ANALOG, +#ifdef I2C_CLASS_TV_ANALOG + .class = I2C_CLASS_TV_ANALOG,#endif I2C_DEVNAME("bt878"), .id = I2C_ALGO_BIT | I2C_HW_B_BT848 /* FIXME */,
drivers/media/video/cx88/cx88-i2c.c +2 -2
@@ -128,8 +128,8 @@ .inc_use = cx8800_inc_use, .dec_use = cx8800_dec_use,#endif -#ifdef I2C_ADAP_CLASS_TV_ANALOG - .class = I2C_ADAP_CLASS_TV_ANALOG, +#ifdef I2C_CLASS_TV_ANALOG + .class = I2C_CLASS_TV_ANALOG,#endif I2C_DEVNAME("cx2388x"), .id = I2C_HW_B_BT848,
drivers/media/video/dpc7146.c +1 -1
@@ -106,7 +106,7 @@video port pins should be enabled here ?! */ saa7146_write (dev,MC1 , (MASK_08 |MASK_24 |MASK_10 |MASK_26 )); -saa7146_i2c_adapter_prepare (dev, &dpc->i2c_adapter,I2C_ADAP_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 ); +saa7146_i2c_adapter_prepare (dev, &dpc->i2c_adapter,I2C_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&dpc->i2c_adapter) <0 ) {DEB_S (("cannot register i2c-device. skipping.\n" ));kfree (dpc);
drivers/media/video/hexium_gemini.c +1 -1
@@ -250,7 +250,7 @@/* enable i2c-port pins */ saa7146_write (dev,MC1 , (MASK_08 |MASK_24 |MASK_10 |MASK_26 )); -saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,I2C_ADAP_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 ); +saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,I2C_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&hexium->i2c_adapter) <0 ) {DEB_S (("cannot register i2c-device. skipping.\n" ));kfree (hexium);
drivers/media/video/hexium_orion.c +1 -1
@@ -237,7 +237,7 @@saa7146_write (dev,DD1_STREAM_B ,0x00000000 );saa7146_write (dev,MC2 , (MASK_09 |MASK_25 |MASK_10 |MASK_26 )); -saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,I2C_ADAP_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 ); +saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,I2C_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&hexium->i2c_adapter) <0 ) {DEB_S (("cannot register i2c-device. skipping.\n" ));kfree (hexium);
drivers/media/video/msp3400.c +2 -2
@@ -1353,8 +1353,8 @@static int msp_probe (struct i2c_adapter *adap) { -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +#ifdef I2C_CLASS_TV_ANALOG +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, msp_attach);#else switch (adap->id) {
drivers/media/video/mxb.c +1 -1
@@ -223,7 +223,7 @@video port pins should be enabled here ?! */ saa7146_write (dev,MC1 , (MASK_08 |MASK_24 |MASK_10 |MASK_26 )); -saa7146_i2c_adapter_prepare (dev, &mxb->i2c_adapter,I2C_ADAP_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 ); +saa7146_i2c_adapter_prepare (dev, &mxb->i2c_adapter,I2C_CLASS_TV_ANALOG ,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&mxb->i2c_adapter) <0 ) {DEB_S (("cannot register i2c-device. skipping.\n" ));kfree (mxb);
drivers/media/video/saa5246a.c +1 -1
@@ -143,7 +143,7 @@*/ static int saa5246a_probe (struct i2c_adapter *adap) { -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, saa5246a_attach);return 0 ; }
drivers/media/video/saa5249.c +1 -1
@@ -219,7 +219,7 @@static int saa5249_probe (struct i2c_adapter *adap) { -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, saa5249_attach);return 0 ; }
drivers/media/video/saa7134/saa6752hs.c +1 -1
@@ -335,7 +335,7 @@static int saa6752hs_probe (struct i2c_adapter *adap) { -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, saa6752hs_attach);return 0 ;
drivers/media/video/saa7134/saa7134-i2c.c +2 -2
@@ -347,8 +347,8 @@ .inc_use = inc_use, .dec_use = dec_use,#endif -#ifdef I2C_ADAP_CLASS_TV_ANALOG - .class = I2C_ADAP_CLASS_TV_ANALOG, +#ifdef I2C_CLASS_TV_ANALOG + .class = I2C_CLASS_TV_ANALOG,#endif I2C_DEVNAME("saa7134"), .id = I2C_ALGO_SAA7134,
drivers/media/video/tda7432.c +2 -2
@@ -338,8 +338,8 @@static int tda7432_probe (struct i2c_adapter *adap) { -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +#ifdef I2C_CLASS_TV_ANALOG +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, tda7432_attach);#else if (adap->id == (I2C_ALGO_BIT |I2C_HW_B_BT848 ))
drivers/media/video/tda9875.c +2 -2
@@ -272,8 +272,8 @@static int tda9875_probe (struct i2c_adapter *adap) { -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +#ifdef I2C_CLASS_TV_ANALOG +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, tda9875_attach);#else if (adap->id == (I2C_ALGO_BIT |I2C_HW_B_BT848 ))
drivers/media/video/tda9887.c +2 -2
@@ -370,8 +370,8 @@static int tda9887_probe (struct i2c_adapter *adap) { -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +#ifdef I2C_CLASS_TV_ANALOG +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, tda9887_attach);#else switch (adap->id) {
drivers/media/video/tuner.c +2 -2
@@ -1067,8 +1067,8 @@ } this_adap =0 ; -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +#ifdef I2C_CLASS_TV_ANALOG +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, tuner_attach);#else switch (adap->id) {
drivers/media/video/tvaudio.c +2 -2
@@ -1497,8 +1497,8 @@static int chip_probe (struct i2c_adapter *adap) { -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (adap->class &I2C_ADAP_CLASS_TV_ANALOG ) +#ifdef I2C_CLASS_TV_ANALOG +if (adap->class &I2C_CLASS_TV_ANALOG )return i2c_probe (adap, &addr_data, chip_attach);#else switch (adap->id) {
drivers/media/video/tvmixer.c +2 -2
@@ -263,8 +263,8 @@struct video_audio va;int i,minor; -#ifdef I2C_ADAP_CLASS_TV_ANALOG -if (!(client->adapter->class &I2C_ADAP_CLASS_TV_ANALOG )) +#ifdef I2C_CLASS_TV_ANALOG +if (!(client->adapter->class &I2C_CLASS_TV_ANALOG ))return -1 ;#else /* TV card ??? */
drivers/usb/media/w9968cf.c +1 -1
@@ -1578,7 +1578,7 @@static struct i2c_adapter adap = { .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_W9968CF , - .class =I2C_ADAP_CLASS_CAM_DIGITAL , + .class =I2C_CLASS_CAM_DIGITAL , .owner =THIS_MODULE , .client_register = w9968cf_i2c_attach_inform, .client_unregister = w9968cf_i2c_detach_inform,
include/linux/i2c.h +9 -7
@@ -113,6 +113,7 @@struct module *owner;char name[32 ];int id; +unsigned int class;unsigned int flags;/* div., see below */ /* Notifies the driver that a new bus has appeared. This routine
@@ -237,7 +238,6 @@/* data fields that are valid for all devices */ struct semaphore bus_lock;struct semaphore clist_lock; -unsigned int flags;/* flags specifying div. data */ int timeout;int retries;
@@ -286,12 +286,14 @@/* Must equal I2C_M_TEN below */ /* i2c adapter classes (bitmask) */ -#define I2C_ADAP_CLASS_SMBUS (1<<0)/* lm_sensors, ... */ -#define I2C_ADAP_CLASS_TV_ANALOG (1<<1)/* bttv + friends */ -#define I2C_ADAP_CLASS_TV_DIGITAL (1<<2)/* dbv cards */ -#define I2C_ADAP_CLASS_DDC (1<<3)/* i2c-matroxfb ? */ -#define I2C_ADAP_CLASS_CAM_ANALOG (1<<4)/* camera with analog CCD */ -#define I2C_ADAP_CLASS_CAM_DIGITAL (1<<5)/* most webcams */ +#define I2C_CLASS_SMBUS (1<<0)/* lm_sensors, ... */ +#define I2C_CLASS_TV_ANALOG (1<<1)/* bttv + friends */ +#define I2C_CLASS_TV_DIGITAL (1<<2)/* dvb cards */ +#define I2C_CLASS_DDC (1<<3)/* i2c-matroxfb ? */ +#define I2C_CLASS_CAM_ANALOG (1<<4)/* camera with analog CCD */ +#define I2C_CLASS_CAM_DIGITAL (1<<5)/* most webcams */ +#define I2C_CLASS_SOUND (1<<6)/* sound devices */ +#define I2C_CLASS_ALL (UINT_MAX)/* all of the above */ /* i2c_client_address_data is the struct for holding default client * addresses for a driver and for the parameters supplied on the
ChangeSet 1.1587.15.12, 2004/05/11 13:43:55-07:00, [email protected]
[PATCH] I2C: kill duplicate includes in i2c bus drivers
Following a suggestion of Arthur Othieno, here is a trivial patch that kills duplicate inclusions of config.h in four i2c bus drivers.
At first I was thinking of also removing inclusions of config.h wherever it doesn't seem to be necessary but Eugene doesn't seem to think it's a good idea. So I may give it a try later (in 2.7), but for now this simple patch will be enough.
drivers/i2c/busses/i2c-keywest.c | 1 - drivers/i2c/busses/i2c-piix4.c | 1 - drivers/i2c/busses/scx200_acb.c | 1 - drivers/i2c/busses/scx200_i2c.c | 1 - 4 files changed, 4 deletions(-)
drivers/i2c/busses/i2c-keywest.c +0 -1
@@ -48,7 +48,6 @@#include <linux/config.h> #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/ioport.h> #include <linux/pci.h>
drivers/i2c/busses/i2c-piix4.c +0 -1
@@ -31,7 +31,6 @@#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/pci.h> #include <linux/kernel.h> #include <linux/stddef.h>
drivers/i2c/busses/scx200_acb.c +0 -1
@@ -25,7 +25,6 @@*/ #include <linux/config.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h>
drivers/i2c/busses/scx200_i2c.c +0 -1
@@ -22,7 +22,6 @@*/ #include <linux/config.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h>
ChangeSet 1.1587.15.13, 2004/05/11 13:44:19-07:00, [email protected]
[PATCH] I2C: new i2c video decoder calls
Attached patch adds three new calls to the i2c video decoder API. The changes were requested by Michael (CC'ed) and approved by Gerd Knorr (v4l maintainer, CC'ed).
Short explanation:
* INIT is a general initialization call with optional initialization data. Reason for this is that several i2c decoders (or general: clients) are being used by several adapters (main drivers), and in some cases, one adapter simply needs different settings than the other, either because the adapter is completely different or because the card was reverse engineered in a way that doesn't allow multiple adapters to run using the same original initialization data. Michael faces such a problem right now. Both he and me lack time to properly sit together and work out the exact details or a proper way to merge.
* VBI_BYPASS and GPIO set specific pins on the decoder. This will be used in the saa7111 driver. My driver (zr36067, original user of the saa7111 driver) doesn't use any of this, but Michael's does.
include/linux/video_decoder.h | 7 +++++++ 1 files changed, 7 insertions(+)
include/linux/video_decoder.h +7 -0
@@ -22,6 +22,10 @@#define DECODER_STATUS_NTSC 8/* auto detected */ #define DECODER_STATUS_SECAM 16/* auto detected */ +struct video_decoder_init { +unsigned char len; +const unsigned char *data; +};#define DECODER_GET_CAPABILITIES _IOR('d', 1, struct video_decoder_capability)#define DECODER_GET_STATUS _IOR('d', 2, int)
@@ -30,6 +34,9 @@#define DECODER_SET_OUTPUT _IOW('d', 5, int)/* 0 <= output < #outputs */ #define DECODER_ENABLE_OUTPUT _IOW('d', 6, int)/* boolean output enable control */ #define DECODER_SET_PICTURE _IOW('d', 7, struct video_picture) +#define DECODER_SET_GPIO _IOW('d', 8, int)/* switch general purpose pin */ +#define DECODER_INIT _IOW('d', 9, struct video_decoder_init)/* init internal registers at once */ +#define DECODER_SET_VBI_BYPASS _IOW('d', 10, int)/* switch vbi bypass */ #define DECODER_DUMP _IO('d', 192)/* debug hook */
ChangeSet 1.1587.15.14, 2004/05/11 13:45:12-07:00, [email protected]
[PATCH] I2C: new i2c video decoder calls: saa7111 driver
Attached patch implements the i2c calls in the saa7111 driver.
The driver is still compatible with old behaviour, so the zr36067 driver (the original user of the saa7111 module) doesn't need any changes. I'll probably gradually make everything use DECODER_INIT instead of 0 (that was a nice hack back then) somewhere later.
Can I just remove '0' later on? Or are there official ABI rules for stable kernel versions?
drivers/media/video/saa7111.c | 59 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 54 insertions(+), 5 deletions(-)
drivers/media/video/saa7111.c +54 -5
@@ -9,6 +9,9 @@* Changes by Ronald Bultje <[email protected]> * - moved over to linux>=2.4.x i2c protocol (1/1/2003) * +* Changes by Michael Hunold <[email protected]> +* - implemented DECODER_SET_GPIO, DECODER_INIT, DECODER_SET_VBI_BYPASS +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
@@ -112,7 +115,7 @@u8 block_data[32 ]; msg.addr = client->addr; - msg.flags = client->flags; + msg.flags =0 ;while (len >=2 ) { msg.buf = (char *) block_data; msg.len =0 ;
@@ -142,6 +145,13 @@return ret; } +static int +saa7111_init_decoder (struct i2c_client *client, +struct video_decoder_init *init) +{ +return saa7111_write_block (client, init->data, init->len); +} +static inline int saa7111_read (struct i2c_client *client,u8 reg)
@@ -151,7 +161,7 @@/* ----------------------------------------------------------------------- */ -static const unsigned char init[] = { +static const unsigned char saa7111_i2c_init[] = {0x00 ,0x00 ,/* 00 - ID byte */ 0x01 ,0x00 ,/* 01 - reserved */
@@ -201,8 +211,18 @@switch (cmd) {case 0 : -//saa7111_write_block(client, init, sizeof(init)); -break ; +case DECODER_INIT : + { +struct video_decoder_init *init = arg; +if (NULL != init) +return saa7111_init_decoder (client, init); +else { +struct video_decoder_init vdi; + vdi.data = saa7111_i2c_init; + vdi.len =sizeof (saa7111_i2c_init); +return saa7111_init_decoder (client, &vdi); + } + }case DECODER_DUMP : {
@@ -274,6 +294,32 @@ }break ; +case DECODER_SET_GPIO : + { +int *iarg = arg; +if (0 != *iarg) { +saa7111_write (client,0x11 , + (decoder->reg[0x11 ] |0x80 )); + }else { +saa7111_write (client,0x11 , + (decoder->reg[0x11 ] &0x7f )); + } +break ; + } + +case DECODER_SET_VBI_BYPASS : + { +int *iarg = arg; +if (0 != *iarg) { +saa7111_write (client,0x13 , + (decoder->reg[0x13 ] &0xf0 ) |0x0a ); + }else { +saa7111_write (client,0x13 , + (decoder->reg[0x13 ] &0xf0 )); + } +break ; + } +case DECODER_SET_NORM : {int *iarg = arg;
@@ -465,6 +511,7 @@int i;struct i2c_client *client;struct saa7111 *decoder; +struct video_decoder_init vdi;dprintk (1 , KERN_INFO
@@ -509,7 +556,9 @@return i; } - i =saa7111_write_block (client, init,sizeof (init)); + vdi.data = saa7111_i2c_init; + vdi.len =sizeof (saa7111_i2c_init); + i =saa7111_init_decoder (client, &vdi);if (i <0 ) {dprintk (1 ,KERN_ERR "%s_attach error: init status %d\n" ,I2C_NAME (client), i);
ChangeSet 1.1587.15.15, 2004/05/11 13:46:12-07:00, [email protected]
[PATCH] I2C: Rename hardware monitoring I2C class
Quoting myself:
Quoted 7 lines
Mmm, I once proposed that
I2C_ADAP_CLASS_SMBUSwould be better renamedI2C_ADAP_CLASS_SENSORS(soI2C_CLASS_SENSORSnow). What about that? I think it would be great to embed that change into your patch, so that the name changes only once.BTW, if HWMON is prefered to SENSORS, this is fine with me too, I have no strong preference.
Below is a patch that does that. I finally went for HWMON. Yes, it's big, but it's actually nothing more than s/I2C_CLASS_SMBUS/I2C_CLASS_HWMON/ (thanks perl -wip :)).
Documentation/i2c/porting-clients | 4 ++-- drivers/i2c/busses/i2c-ali1535.c | 2 +- drivers/i2c/busses/i2c-ali1563.c | 2 +- drivers/i2c/busses/i2c-ali15x3.c | 2 +- drivers/i2c/busses/i2c-amd756.c | 2 +- drivers/i2c/busses/i2c-amd8111.c | 2 +- drivers/i2c/busses/i2c-i801.c | 2 +- drivers/i2c/busses/i2c-isa.c | 2 +- drivers/i2c/busses/i2c-nforce2.c | 2 +- drivers/i2c/busses/i2c-parport-light.c | 2 +- drivers/i2c/busses/i2c-parport.c | 2 +- drivers/i2c/busses/i2c-piix4.c | 2 +- drivers/i2c/busses/i2c-sis5595.c | 2 +- drivers/i2c/busses/i2c-sis630.c | 2 +- drivers/i2c/busses/i2c-sis96x.c | 2 +- drivers/i2c/busses/i2c-via.c | 2 +- drivers/i2c/busses/i2c-viapro.c | 2 +- drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/asb100.c | 2 +- drivers/i2c/chips/fscher.c | 2 +- drivers/i2c/chips/gl518sm.c | 2 +- drivers/i2c/chips/it87.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- drivers/i2c/chips/lm78.c | 2 +- drivers/i2c/chips/lm80.c | 2 +- drivers/i2c/chips/lm83.c | 2 +- drivers/i2c/chips/lm90.c | 2 +- drivers/i2c/chips/via686a.c | 2 +- drivers/i2c/chips/w83781d.c | 2 +- drivers/i2c/chips/w83l785ts.c | 2 +- include/linux/i2c.h | 2 +- 31 files changed, 32 insertions(+), 32 deletions(-)
Documentation/i2c/porting-clients +2 -2
@@ -62,9 +62,9 @@ patch to the Documentation/i2c/sysfs-interface file. * [Attach] For I2C drivers, the attach function should make sure - that the adapter's class has I2C_CLASS_SMBUS, using the + that the adapter's class has I2C_CLASS_HWMON, using the following construct: - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; ISA-only drivers of course don't need this.
drivers/i2c/busses/i2c-ali1535.c +1 -1
@@ -480,7 +480,7 @@static struct i2c_adapter ali1535_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-ali1563.c +1 -1
@@ -357,7 +357,7 @@static struct i2c_adapter ali1563_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &ali1563_algorithm, };
drivers/i2c/busses/i2c-ali15x3.c +1 -1
@@ -470,7 +470,7 @@static struct i2c_adapter ali15x3_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-amd756.c +1 -1
@@ -303,7 +303,7 @@static struct i2c_adapter amd756_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-amd8111.c +1 -1
@@ -359,7 +359,7 @@ smbus->adapter.owner =THIS_MODULE ;snprintf (smbus->adapter.name,I2C_NAME_SIZE ,"SMBus2 AMD8111 adapter at %04x" , smbus->base); - smbus->adapter.class =I2C_CLASS_SMBUS ; + smbus->adapter.class =I2C_CLASS_HWMON ; smbus->adapter.algo = &smbus_algorithm; smbus->adapter.algo_data = smbus;
drivers/i2c/busses/i2c-i801.c +1 -1
@@ -539,7 +539,7 @@static struct i2c_adapter i801_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-isa.c +1 -1
@@ -43,7 +43,7 @@/* There can only be one... */ static struct i2c_adapter isa_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &isa_algorithm, .name ="ISA main adapter" , };
drivers/i2c/busses/i2c-nforce2.c +1 -1
@@ -119,7 +119,7 @@static struct i2c_adapter nforce2_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-parport-light.c +1 -1
@@ -112,7 +112,7 @@static struct i2c_adapter parport_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .id =I2C_HW_B_LP , .algo_data = &parport_algo_data, .name ="Parallel port adapter (light)" ,
drivers/i2c/busses/i2c-parport.c +1 -1
@@ -147,7 +147,7 @@static struct i2c_adapter parport_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .id =I2C_HW_B_LP , .name ="Parallel port adapter" , };
drivers/i2c/busses/i2c-piix4.c +1 -1
@@ -409,7 +409,7 @@static struct i2c_adapter piix4_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-sis5595.c +1 -1
@@ -360,7 +360,7 @@static struct i2c_adapter sis5595_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .name ="unset" , .algo = &smbus_algorithm, };
drivers/i2c/busses/i2c-sis630.c +1 -1
@@ -456,7 +456,7 @@static struct i2c_adapter sis630_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .name ="unset" , .algo = &smbus_algorithm, };
drivers/i2c/busses/i2c-sis96x.c +1 -1
@@ -260,7 +260,7 @@static struct i2c_adapter sis96x_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/busses/i2c-via.c +1 -1
@@ -88,7 +88,7 @@static struct i2c_adapter vt586b_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .name ="VIA i2c" , .algo_data = &bit_data, };
drivers/i2c/busses/i2c-viapro.c +1 -1
@@ -289,7 +289,7 @@static struct i2c_adapter vt596_adapter = { .owner =THIS_MODULE , - .class =I2C_CLASS_SMBUS , + .class =I2C_CLASS_HWMON , .algo = &smbus_algorithm, .name ="unset" , };
drivers/i2c/chips/adm1021.c +1 -1
@@ -200,7 +200,7 @@static int adm1021_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, adm1021_detect); }
drivers/i2c/chips/asb100.c +1 -1
@@ -609,7 +609,7 @@*/ static int asb100_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, asb100_detect); }
drivers/i2c/chips/fscher.c +1 -1
@@ -293,7 +293,7 @@static int fscher_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, fscher_detect); }
drivers/i2c/chips/gl518sm.c +1 -1
@@ -335,7 +335,7 @@static int gl518_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, gl518_detect); }
drivers/i2c/chips/it87.c +1 -1
@@ -500,7 +500,7 @@* when a new adapter is inserted (and it87_driver is still present) */ static int it87_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, it87_detect); }
drivers/i2c/chips/lm75.c +1 -1
@@ -105,7 +105,7 @@static int lm75_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, lm75_detect); }
drivers/i2c/chips/lm78.c +1 -1
@@ -488,7 +488,7 @@* when a new adapter is inserted (and lm78_driver is still present) */ static int lm78_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, lm78_detect); }
drivers/i2c/chips/lm80.c +1 -1
@@ -376,7 +376,7 @@static int lm80_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, lm80_detect); }
drivers/i2c/chips/lm83.c +1 -1
@@ -216,7 +216,7 @@static int lm83_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, lm83_detect); }
drivers/i2c/chips/lm90.c +1 -1
@@ -274,7 +274,7 @@static int lm90_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, lm90_detect); }
drivers/i2c/chips/via686a.c +1 -1
@@ -573,7 +573,7 @@/* This is called when the module is loaded */ static int via686a_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, via686a_detect); }
drivers/i2c/chips/w83781d.c +1 -1
@@ -911,7 +911,7 @@static int w83781d_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, w83781d_detect); }
drivers/i2c/chips/w83l785ts.c +1 -1
@@ -145,7 +145,7 @@static int w83l785ts_attach_adapter (struct i2c_adapter *adapter) { -if (!(adapter->class &I2C_CLASS_SMBUS )) +if (!(adapter->class &I2C_CLASS_HWMON ))return 0 ;return i2c_detect (adapter, &addr_data, w83l785ts_detect); }
include/linux/i2c.h +1 -1
@@ -286,7 +286,7 @@/* Must equal I2C_M_TEN below */ /* i2c adapter classes (bitmask) */ -#define I2C_CLASS_SMBUS (1<<0)/* lm_sensors, ... */ +#define I2C_CLASS_HWMON (1<<0)/* lm_sensors, ... */ #define I2C_CLASS_TV_ANALOG (1<<1)/* bttv + friends */ #define I2C_CLASS_TV_DIGITAL (1<<2)/* dvb cards */ #define I2C_CLASS_DDC (1<<3)/* i2c-matroxfb ? */
ChangeSet 1.1587.15.16, 2004/05/14 14:58:42-07:00, [email protected]
[PATCH] I2C: ICH6/6300ESB i2c support
This patch adds DID support for ICH6 and 6300ESB to i2c-i801.c(SMBus). In order to add this support I needed to patch pci_ids.h with the SMBus DID's. To keep things orginized I renumbered the ICH6 and ESB entries in pci_ids.h. I then patched the piix IDE and i810 audio drivers to reflect the updated #define's. I also removed an error from irq.c; there was a reference to a 6300ESB DID that does not exist.
arch/i386/pci/irq.c | 3 ++- drivers/i2c/busses/Kconfig | 2 ++ drivers/i2c/busses/i2c-i801.c | 26 ++++++++++++++++++++------ drivers/ide/pci/piix.c | 8 ++++---- drivers/ide/pci/piix.h | 2 +- include/linux/pci_ids.h | 21 ++++++++++++++++++--- sound/oss/i810_audio.c | 10 +++++----- 7 files changed, 52 insertions(+), 20 deletions(-)
arch/i386/pci/irq.c +2 -1
@@ -479,8 +479,9 @@case PCI_DEVICE_ID_INTEL_82801DB_0 :case PCI_DEVICE_ID_INTEL_82801E_0 :case PCI_DEVICE_ID_INTEL_82801EB_0 : -case PCI_DEVICE_ID_INTEL_ESB_0 : +case PCI_DEVICE_ID_INTEL_ESB_1 :case PCI_DEVICE_ID_INTEL_ICH6_0 : +case PCI_DEVICE_ID_INTEL_ICH6_1 : r->name ="PIIX/ICH" ; r->get = pirq_piix_get; r->set = pirq_piix_set;
drivers/i2c/busses/Kconfig +2 -0
@@ -95,6 +95,8 @@ 82801CA/CAM 82801DB 82801EB + 6300ESB + ICH6 This driver can also be built as a module. If so, the module will be called i2c-i801.
drivers/i2c/busses/i2c-i801.c +20 -6
@@ -28,7 +28,8 @@ 82801CA/CAM 2483 82801DB 24C3 (HW PEC supported, 32 byte buffer not supported) 82801EB 24D3 (HW PEC supported, 32 byte buffer not supported) - + 6300ESB 25A4 + ICH6 266A This driver supports several versions of Intel's I/O Controller Hubs (ICH). For SMBus support, they are similar to the PIIX4 and are part of Intel's '810' and other chipsets.
@@ -121,7 +122,8 @@ I801_dev = dev;if ((dev->device ==PCI_DEVICE_ID_INTEL_82801DB_3 ) || - (dev->device ==PCI_DEVICE_ID_INTEL_82801EB_3 )) + (dev->device ==PCI_DEVICE_ID_INTEL_82801EB_3 ) || + (dev->device ==PCI_DEVICE_ID_INTEL_ESB_4 )) isich4 =1 ;else isich4 =0 ;
@@ -576,10 +578,22 @@ .subdevice = PCI_ANY_ID, }, { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801EB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_82801EB_3, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_ESB_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_ICH6_16, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, }, { 0, } };
drivers/ide/pci/piix.c +4 -4
@@ -153,7 +153,7 @@case PCI_DEVICE_ID_INTEL_82801EB_11 :case PCI_DEVICE_ID_INTEL_82801E_11 :case PCI_DEVICE_ID_INTEL_ESB_2 : -case PCI_DEVICE_ID_INTEL_ICH6_2 : +case PCI_DEVICE_ID_INTEL_ICH6_19 : p +=sprintf (p,"PIIX4 Ultra 100 " );break ;case PCI_DEVICE_ID_INTEL_82372FB_1 :
@@ -292,7 +292,7 @@case PCI_DEVICE_ID_INTEL_82801DB_11 :case PCI_DEVICE_ID_INTEL_82801EB_11 :case PCI_DEVICE_ID_INTEL_ESB_2 : -case PCI_DEVICE_ID_INTEL_ICH6_2 : +case PCI_DEVICE_ID_INTEL_ICH6_19 : mode =3 ;break ;/* UDMA 66 capable */
@@ -627,7 +627,7 @@case PCI_DEVICE_ID_INTEL_82801EB_11 :case PCI_DEVICE_ID_INTEL_82801E_11 :case PCI_DEVICE_ID_INTEL_ESB_2 : -case PCI_DEVICE_ID_INTEL_ICH6_2 : +case PCI_DEVICE_ID_INTEL_ICH6_19 : {unsigned int extra =0 ;pci_read_config_dword (dev,0x54 , &extra);
@@ -804,7 +804,7 @@ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18}, #endif /* !CONFIG_SCSI_SATA */ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19}, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, { 0, }, }; MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
drivers/ide/pci/piix.h +1 -1
@@ -70,7 +70,7 @@/* 17 */ DECLARE_PIIX_DEV (PCI_DEVICE_ID_INTEL_82801DB_10 ,"ICH4" ),/* 18 */ DECLARE_PIIX_DEV (PCI_DEVICE_ID_INTEL_82801EB_1 ,"ICH5-SATA" ),/* 19 */ DECLARE_PIIX_DEV (PCI_DEVICE_ID_INTEL_ESB_2 ,"ICH5" ), - /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_2, "ICH6"), + /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_19, "ICH6"), { .vendor =0 , .device = 0,
include/linux/pci_ids.h +18 -3
@@ -2058,7 +2058,6 @@#define PCI_DEVICE_ID_INTEL_82801EB_7 0x24d7#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd -#define PCI_DEVICE_ID_INTEL_ESB_0 0x25a0#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2#define PCI_DEVICE_ID_INTEL_ESB_3 0x25a3
@@ -2084,8 +2083,24 @@#define PCI_DEVICE_ID_INTEL_82875_IG 0x257b#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 -#define PCI_DEVICE_ID_INTEL_ICH6_2 0x266f -#define PCI_DEVICE_ID_INTEL_ICH6_3 0x266e +#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 +#define PCI_DEVICE_ID_INTEL_ICH6_3 0x2651 +#define PCI_DEVICE_ID_INTEL_ICH6_4 0x2652 +#define PCI_DEVICE_ID_INTEL_ICH6_5 0x2653 +#define PCI_DEVICE_ID_INTEL_ICH6_6 0x2658 +#define PCI_DEVICE_ID_INTEL_ICH6_7 0x2659 +#define PCI_DEVICE_ID_INTEL_ICH6_8 0x265a +#define PCI_DEVICE_ID_INTEL_ICH6_9 0x265b +#define PCI_DEVICE_ID_INTEL_ICH6_10 0x265c +#define PCI_DEVICE_ID_INTEL_ICH6_11 0x2660 +#define PCI_DEVICE_ID_INTEL_ICH6_12 0x2662 +#define PCI_DEVICE_ID_INTEL_ICH6_13 0x2664 +#define PCI_DEVICE_ID_INTEL_ICH6_14 0x2666 +#define PCI_DEVICE_ID_INTEL_ICH6_15 0x2668 +#define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a +#define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e +#define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
sound/oss/i810_audio.c +5 -5
@@ -120,8 +120,8 @@#ifndef PCI_DEVICE_ID_INTEL_ICH5 #define PCI_DEVICE_ID_INTEL_ICH5 0x24d5#endif -#ifndef PCI_DEVICE_ID_INTEL_ICH6_3 -#define PCI_DEVICE_ID_INTEL_ICH6_3 0x266e +#ifndef PCI_DEVICE_ID_INTEL_ICH6_18 +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e#endif #ifndef PCI_DEVICE_ID_INTEL_440MX #define PCI_DEVICE_ID_INTEL_440MX 0x7195
@@ -351,7 +351,7 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111}, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_3, + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, {0,}
@@ -2797,7 +2797,7 @@/* see i810_ac97_init for the next 7 lines (jsaw) */ inw (card->ac97base);if ((card->pci_id ==PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id ==PCI_DEVICE_ID_INTEL_ICH5 || - card->pci_id ==PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id ==PCI_DEVICE_ID_INTEL_ICH6_3 ) + card->pci_id ==PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id ==PCI_DEVICE_ID_INTEL_ICH6_18 ) && (card->use_mmio)) { primary_codec_id = (int )readl (card->iobase_mmio +SDM ) &0x3 ; printk(KERN_INFO "i810_audio: Primary codec has ID %d\n",
@@ -2868,7 +2868,7 @@last codec ID spoken to. */ if ((card->pci_id ==PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id ==PCI_DEVICE_ID_INTEL_ICH5 || - card->pci_id ==PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id ==PCI_DEVICE_ID_INTEL_ICH6_3 ) + card->pci_id ==PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id ==PCI_DEVICE_ID_INTEL_ICH6_18 ) && (card->use_mmio)) { ac97_id = (int )readl (card->iobase_mmio +SDM ) &0x3 ; printk(KERN_INFO "i810_audio: Connection %d with codec id %d\n",
ChangeSet 1.1587.15.17, 2004/05/14 14:59:26-07:00, [email protected]
[PATCH] I2C: "probe" module param broken for it87 in Linux 2.6.6
Quoted 3 lines · Jean Delvare
So I'd suggest that you simply use the standard exit sequence in the it87 driver (the second one in your current patch). A patch for the 2.4 driver would be appreciated as well.
OK. I've attached a new version of the patch against linux-2.6.6. I'll send a patch against current lm_sensors CVS removing the extra exit command in a separate mail.
Quoted 6 lines · Greg KH
Review
Quoted 2 lines · Bj?rn Mork
(quoted diff) +2
-0+ if (!it87_find(&addr)) { + printk("it87.o: new ISA address: 0x%04x\n", addr);That printk is wrong (no
KERN_level, ordev_printk()style use). Please fix it in your next revision of this patch.
Errh, I just added it to document my sloppyness. It was never meant to be in the patch I sent you. Sorry. Removed in the attached patch. The style of these drivers seem to be "just working, making no noise" so I assume informational printk's are unwanted.
drivers/i2c/chips/it87.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+)
drivers/i2c/chips/it87.c +78 -0
@@ -49,6 +49,54 @@/* Insmod parameters */ SENSORS_INSMOD_1 (it87); +#define REG 0x2e/* The register to read/write */ +#define DEV 0x07/* Register: Logical device select */ +#define VAL 0x2f/* The value to read/write */ +#define PME 0x04/* The device with the fan registers in it */ +#define DEVID 0x20/* Register: Device ID */ + +static inline void +superio_outb (int reg,int val) +{ +outb (reg,REG ); +outb (val,VAL ); +} + +static inline int +superio_inb (int reg) +{ +outb (reg,REG ); +return inb (VAL ); +} + +static inline void +superio_select (void ) +{ +outb (DEV ,REG ); +outb (PME ,VAL ); +} + +static inline void +superio_enter (void ) +{ +outb (0x87 ,REG ); +outb (0x01 ,REG ); +outb (0x55 ,REG ); +outb (0x55 ,REG ); +} + +static inline void +superio_exit (void ) +{ +outb (0x02 ,REG ); +outb (0x02 ,VAL ); +} + +/* just IT8712F for now - this should be extended to support the other +chips as well */ +#define IT8712F_DEVID 0x8712 +#define IT87_ACT_REG 0x30 +#define IT87_BASE_REG 0x60/* Update battery voltage after every reading if true */ static int update_vbat;
@@ -158,6 +206,7 @@static int it87_attach_adapter (struct i2c_adapter *adapter); +static int it87_find (int *address);static int it87_detect (struct i2c_adapter *adapter,int address,int kind);static int it87_detach_client (struct i2c_client *client);
@@ -505,6 +554,30 @@return i2c_detect (adapter, &addr_data, it87_detect); } +/* SuperIO detection - will change normal_isa[0] if a chip is found */ +static int it87_find (int *address) +{ +u16 val; + +superio_enter (); + val = (superio_inb (DEVID ) <<8 ) | +superio_inb (DEVID +1 ); +if (val !=IT8712F_DEVID ) { +superio_exit (); +return -ENODEV ; + } + +superio_select (); + val = (superio_inb (IT87_BASE_REG ) <<8 ) | +superio_inb (IT87_BASE_REG +1 ); +superio_exit (); + *address = val & ~(IT87_EXTENT -1 ); +if (*address ==0 ) { +return -ENODEV ; + } +return 0 ; +} +/* This function is called by i2c_detect */ int it87_detect (struct i2c_adapter *adapter,int address,int kind) {
@@ -853,6 +926,11 @@static int __init sm_it87_init (void ) { +int addr; + +if (!it87_find (&addr)) { + normal_isa[0 ] = addr; + }return i2c_add_driver (&it87_driver); }
ChangeSet 1.1587.15.18, 2004/05/14 15:00:02-07:00, [email protected]
[PATCH] I2C: Missed ixp42x -> ixp4xx conversion
Forgot to include this with my original patch a few weeks ago...
include/linux/i2c-id.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
include/linux/i2c-id.h +1 -1
@@ -222,7 +222,7 @@#define I2C_HW_B_OMAHA 0x14/* Omaha I2C interface (ARM) */ #define I2C_HW_B_GUIDE 0x15/* Guide bit-basher */ #define I2C_HW_B_IXP2000 0x16/* GPIO on IXP2000 systems */ -#define I2C_HW_B_IXP425 0x17/* GPIO on IXP425 systems */ +#define I2C_HW_B_IXP4XX 0x17/* GPIO on IXP4XX systems */ #define I2C_HW_B_S3VIA 0x18/* S3Via ProSavage adapter */ #define I2C_HW_B_ZR36067 0x19/* Zoran-36057/36067 based boards */
PATCH 1/1 I2C update for 2.6.6
In reply to Greg KHQuoted 2 lines
can somebody backport this to
lm_sensorsCVS? I'll do it in a couple of days if nobody does it first.
I've asked the original author to do so, he told me he would. Let's just hope he will ;)
http://marc.theaimsgroup.com/?t8438587000002&r=1&w=2
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
PATCH 1/1 I2C update for 2.6.6
In reply to Greg KHcan somebody backport this to lm_sensors CVS? I'll do it in a couple of days if nobody does it first. mds
Quoted 231 lines · Greg KH
ChangeSet 1.1587.15.16, 2004/05/14 14:58:42-07:00, [email protected]
[PATCH] I2C: ICH6/6300ESB i2c support
This patch adds DID support for ICH6 and 6300ESB to i2c-i801.c(SMBus). In order to add this support I needed to patch
pci_ids.hwith the SMBus DID's. To keep things orginized I renumbered the ICH6 and ESB entries inpci_ids.h. I then patched the piix IDE and i810 audio drivers to reflect the updated #define's. I also removed an error fromirq.c; there was a reference to a 6300ESB DID that does not exist.arch/i386/pci/irq.c | 3 ++- drivers/i2c/busses/Kconfig | 2 ++ drivers/i2c/busses/i2c-i801.c | 26 ++++++++++++++++++++------ drivers/ide/pci/piix.c | 8 ++++---- drivers/ide/pci/piix.h | 2 +- include/linux/pci_ids.h | 21 ++++++++++++++++++--- sound/oss/i810_audio.c | 10 +++++----- 7 files changed, 52 insertions(+), 20 deletions(-)diff -Nru
a/arch/i386/pci/irq.cb/arch/i386/pci/irq.carch/i386/pci/irq.c +2
-1@@ -479,8 +479,9 @@case PCI_DEVICE_ID_INTEL_82801DB_0 :case PCI_DEVICE_ID_INTEL_82801E_0 :case PCI_DEVICE_ID_INTEL_82801EB_0 : -case PCI_DEVICE_ID_INTEL_ESB_0 : +case PCI_DEVICE_ID_INTEL_ESB_1 :case PCI_DEVICE_ID_INTEL_ICH6_0 : +case PCI_DEVICE_ID_INTEL_ICH6_1 : r->name ="PIIX/ICH" ; r->get = pirq_piix_get; r->set = pirq_piix_set;diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
drivers/i2c/busses/Kconfig +2
-0@@ -95,6 +95,8 @@ 82801CA/CAM 82801DB 82801EB + 6300ESB + ICH6 This driver can also be built as a module. If so, the module will be called i2c-i801.diff -Nru
a/drivers/i2c/busses/i2c-i801.cb/drivers/i2c/busses/i2c-i801.cdrivers/i2c/busses/i2c-i801.c +20
-6@@ -28,7 +28,8 @@ 82801CA/CAM 2483 82801DB 24C3 (HW PEC supported, 32 byte buffer not supported) 82801EB 24D3 (HW PEC supported, 32 byte buffer not supported) - + 6300ESB 25A4 + ICH6 266A This driver supports several versions of Intel's I/O Controller Hubs (ICH). For SMBus support, they are similar to the PIIX4 and are part of Intel's '810' and other chipsets.@@ -121,7 +122,8 @@ I801_dev = dev;if ((dev->device =PCI_DEVICE_ID_INTEL_82801DB_3 ) || - (dev->device =PCI_DEVICE_ID_INTEL_82801EB_3 )) + (dev->device =PCI_DEVICE_ID_INTEL_82801EB_3 ) || + (dev->device =PCI_DEVICE_ID_INTEL_ESB_4 )) isich4 =1 ;else isich4 =0 ;@@ -576,10 +578,22 @@ .subdevice = PCI_ANY_ID, }, { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801EB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_82801EB_3, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_ESB_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_ICH6_16, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, }, { 0, } };diff -Nru
a/drivers/ide/pci/piix.cb/drivers/ide/pci/piix.cdrivers/ide/pci/piix.c +4
-4@@ -153,7 +153,7 @@case PCI_DEVICE_ID_INTEL_82801EB_11 :case PCI_DEVICE_ID_INTEL_82801E_11 :case PCI_DEVICE_ID_INTEL_ESB_2 : -case PCI_DEVICE_ID_INTEL_ICH6_2 : +case PCI_DEVICE_ID_INTEL_ICH6_19 : p +=sprintf (p,"PIIX4 Ultra 100 " );break ;case PCI_DEVICE_ID_INTEL_82372FB_1 :@@ -292,7 +292,7 @@case PCI_DEVICE_ID_INTEL_82801DB_11 :case PCI_DEVICE_ID_INTEL_82801EB_11 :case PCI_DEVICE_ID_INTEL_ESB_2 : -case PCI_DEVICE_ID_INTEL_ICH6_2 : +case PCI_DEVICE_ID_INTEL_ICH6_19 : mode =3 ;break ;/* UDMA 66 capable */ @@ -627,7 +627,7 @@case PCI_DEVICE_ID_INTEL_82801EB_11 :case PCI_DEVICE_ID_INTEL_82801E_11 :case PCI_DEVICE_ID_INTEL_ESB_2 : -case PCI_DEVICE_ID_INTEL_ICH6_2 : +case PCI_DEVICE_ID_INTEL_ICH6_19 : {unsigned int extra =0 ;pci_read_config_dword (dev,0x54 , &extra);@@ -804,7 +804,7 @@ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18}, #endif /* !CONFIG_SCSI_SATA */ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19}, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, { 0, }, }; MODULE_DEVICE_TABLE(pci, piix_pci_tbl);diff -Nru
a/drivers/ide/pci/piix.hb/drivers/ide/pci/piix.hdrivers/ide/pci/piix.h +1
-1@@ -70,7 +70,7 @@/* 17 */ DECLARE_PIIX_DEV (PCI_DEVICE_ID_INTEL_82801DB_10 ,"ICH4" ),/* 18 */ DECLARE_PIIX_DEV (PCI_DEVICE_ID_INTEL_82801EB_1 ,"ICH5-SATA" ),/* 19 */ DECLARE_PIIX_DEV (PCI_DEVICE_ID_INTEL_ESB_2 ,"ICH5" ), - /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_2, "ICH6"), + /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_19, "ICH6"), { .vendor =0 , .device = 0,diff -Nru
a/include/linux/pci_ids.hb/include/linux/pci_ids.hinclude/linux/pci_ids.h +18
-3@@ -2058,7 +2058,6 @@#define PCI_DEVICE_ID_INTEL_82801EB_7 0x24d7#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd -#define PCI_DEVICE_ID_INTEL_ESB_0 0x25a0#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2#define PCI_DEVICE_ID_INTEL_ESB_3 0x25a3@@ -2084,8 +2083,24 @@#define PCI_DEVICE_ID_INTEL_82875_IG 0x257b#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 -#define PCI_DEVICE_ID_INTEL_ICH6_2 0x266f -#define PCI_DEVICE_ID_INTEL_ICH6_3 0x266e +#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 +#define PCI_DEVICE_ID_INTEL_ICH6_3 0x2651 +#define PCI_DEVICE_ID_INTEL_ICH6_4 0x2652 +#define PCI_DEVICE_ID_INTEL_ICH6_5 0x2653 +#define PCI_DEVICE_ID_INTEL_ICH6_6 0x2658 +#define PCI_DEVICE_ID_INTEL_ICH6_7 0x2659 +#define PCI_DEVICE_ID_INTEL_ICH6_8 0x265a +#define PCI_DEVICE_ID_INTEL_ICH6_9 0x265b +#define PCI_DEVICE_ID_INTEL_ICH6_10 0x265c +#define PCI_DEVICE_ID_INTEL_ICH6_11 0x2660 +#define PCI_DEVICE_ID_INTEL_ICH6_12 0x2662 +#define PCI_DEVICE_ID_INTEL_ICH6_13 0x2664 +#define PCI_DEVICE_ID_INTEL_ICH6_14 0x2666 +#define PCI_DEVICE_ID_INTEL_ICH6_15 0x2668 +#define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a +#define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e +#define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577diff -Nru
a/sound/oss/i810_audio.cb/sound/oss/i810_audio.csound/oss/i810_audio.c +5
-5@@ -120,8 +120,8 @@#ifndef PCI_DEVICE_ID_INTEL_ICH5 #define PCI_DEVICE_ID_INTEL_ICH5 0x24d5#endif -#ifndef PCI_DEVICE_ID_INTEL_ICH6_3 -#define PCI_DEVICE_ID_INTEL_ICH6_3 0x266e +#ifndef PCI_DEVICE_ID_INTEL_ICH6_18 +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e#endif #ifndef PCI_DEVICE_ID_INTEL_440MX #define PCI_DEVICE_ID_INTEL_440MX 0x7195@@ -351,7 +351,7 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111}, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_3, + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, {0,}@@ -2797,7 +2797,7 @@/* see i810_ac97_init for the next 7 lines (jsaw) */ inw (card->ac97base);if ((card->pci_id =PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id =PCI_DEVICE_ID_INTEL_ICH5 || - card->pci_id =PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id =PCI_DEVICE_ID_INTEL_ICH6_3 ) + card->pci_id =PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id =PCI_DEVICE_ID_INTEL_ICH6_18 ) && (card->use_mmio)) { primary_codec_id = (int )readl (card->iobase_mmio +SDM ) &0x3 ; printk(KERN_INFO "i810_audio: Primary codec has ID %d\n",@@ -2868,7 +2868,7 @@last codec ID spoken to. */ if ((card->pci_id =PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id =PCI_DEVICE_ID_INTEL_ICH5 || - card->pci_id =PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id =PCI_DEVICE_ID_INTEL_ICH6_3 ) + card->pci_id =PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id =PCI_DEVICE_ID_INTEL_ICH6_18 ) && (card->use_mmio)) { ac97_id = (int )readl (card->iobase_mmio +SDM ) &0x3 ; printk(KERN_INFO "i810_audio: Connection %d with codec id %d\n",