i2c driver changes for 2.5.68
PATCH 1/1 i2c driver changes for 2.5.68
Hi,
Here are some i2c driver changes for 2.5.68. These include a lot of cleanup patches, removing dead or duplicated code. With these patches, we are almost able to remove i2c-sensor.h and i2c-sensor.c, but not quite there. Also a new i2c chip driver has been added.
Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.5
thanks,
greg k-h
drivers/i2c/busses/i2c-viapro.c | 321 +++++------- drivers/i2c/chips/Kconfig | 14 drivers/i2c/chips/Makefile | 1 drivers/i2c/chips/adm1021.c | 130 ----- drivers/i2c/chips/it87.c | 976 +++++++++++++++++++++++++++++++++++++-- drivers/i2c/chips/lm75.c | 8 drivers/i2c/chips/via686a.c | 8 drivers/i2c/chips/w83781d.c | 10 drivers/i2c/i2c-core.c | 8 drivers/i2c/i2c-sensor.c | 46 - drivers/media/video/msp3400.c | 6 drivers/media/video/saa5249.c | 2 drivers/media/video/saa7111.c | 2 drivers/media/video/tda7432.c | 3 drivers/media/video/tda9840.c | 2 drivers/media/video/tda9875.c | 3 drivers/media/video/tda9887.c | 3 drivers/media/video/tea6415c.c | 2 drivers/media/video/tea6420.c | 2 drivers/media/video/tuner-3036.c | 3 drivers/media/video/tuner.c | 3 drivers/media/video/tvaudio.c | 3 include/linux/i2c-sensor.h | 152 +----- include/linux/i2c.h | 25 24 files changed, 1216 insertions(+), 517 deletions(-)
-----
<[email protected]>:
o i2c: added it87 driver
Christoph Hellwig <[email protected]>:
o i2c: bring i2c-viapro uptodate with the style guide
o i2c: remove dead init code from i2c-sensors.c
o i2c: remove dead code from adm1021
o i2c: remove dead junk from i2c-sensors.h
Greg Kroah-Hartman <[email protected]>:
o i2c: remove a lot of dupliated macros from i2c-sensor.h and use the current values in i2c.h
o i2c: removed unneeded typedef from i2c-sensor.h
o i2c: fix up the media drivers due to removing flags paramater of callback function
o i2c: removed unused flags paramater in found_proc callback
o i2c: fix up it87.c check_region mess
PATCH 1/1 i2c driver changes for 2.5.68
ChangeSet 1.1179.3.1, 2003/04/23 11:32:48-07:00, [email protected]
[PATCH] i2c: remove dead junk from i2c-sensors.h
include/linux/i2c-sensor.h | 32 -------------------------------- 1 files changed, 32 deletions(-)
include/linux/i2c-sensor.h +0 -32
@@ -22,18 +22,6 @@#ifndef _LINUX_I2C_SENSOR_H#define _LINUX_I2C_SENSOR_H -#include <linux/sysctl.h> - -/* The type of callback functions used in sensors_{proc,sysctl}_real */ -typedef void (*i2c_real_callback ) (struct i2c_client * client, -int operation,int ctl_name, -int *nrels_mag,long *results); - -/* Values for the operation field in the above function type */ -#define SENSORS_PROC_REAL_INFO 1 -#define SENSORS_PROC_REAL_READ 2 -#define SENSORS_PROC_REAL_WRITE 3 -/* A structure containing detect information. Force variables overrule all other variables; they force a detection on that place. If a specific chip is given, the module blindly assumes this
@@ -350,24 +338,4 @@ else return value; } - - -/* The maximum length of the prefix */ -#define SENSORS_PREFIX_MAX 20 - -/* Sysctl IDs */ -#ifdef DEV_HWMON -#define DEV_SENSORS DEV_HWMON -#else /* ndef DEV_HWMOM */ -#define DEV_SENSORS 2/* The id of the lm_sensors directory within the -dev table */ -#endif /* def DEV_HWMON */ - -#define SENSORS_CHIPS 1 -struct i2c_chips_data { -int sysctl_id; -char name[SENSORS_PREFIX_MAX +13 ]; -}; -#endif /* def _LINUX_I2C_SENSOR_H */ -
ChangeSet 1.1179.3.2, 2003/04/23 11:33:09-07:00, [email protected]
[PATCH] i2c: remove dead code from adm1021
Enough testing :) This is the last user of some junk in i2c-sensors.h, so it should better go away sooner than later..
drivers/i2c/chips/adm1021.c | 122 -------------------------------------------- 1 files changed, 122 deletions(-)
drivers/i2c/chips/adm1021.c +0 -122
@@ -416,128 +416,6 @@up (&data->update_lock); } - -/* FIXME, remove these four functions, they are here to verify the sysfs -* conversion is correct, or not */ -__attribute__((unused)) -static void adm1021_temp (struct i2c_client *client,int operation, -int ctl_name,int *nrels_mag,long *results) -{ -struct adm1021_data *data =i2c_get_clientdata (client); - -if (operation ==SENSORS_PROC_REAL_INFO ) - *nrels_mag =0 ; -else if (operation ==SENSORS_PROC_REAL_READ ) { -adm1021_update_client (client); - results[0 ] =TEMP_FROM_REG (data->temp_max); - results[1 ] =TEMP_FROM_REG (data->temp_hyst); - results[2 ] =TEMP_FROM_REG (data->temp_input); - *nrels_mag =3 ; - }else if (operation ==SENSORS_PROC_REAL_WRITE ) { -if (*nrels_mag >=1 ) { - data->temp_max =TEMP_TO_REG (results[0 ]); -adm1021_write_value (client,ADM1021_REG_TOS_W , - data->temp_max); - } -if (*nrels_mag >=2 ) { - data->temp_hyst =TEMP_TO_REG (results[1 ]); -adm1021_write_value (client,ADM1021_REG_THYST_W , - data->temp_hyst); - } - } -} - -__attribute__((unused)) -static void adm1021_remote_temp (struct i2c_client *client,int operation, -int ctl_name,int *nrels_mag,long *results) -{ -struct adm1021_data *data =i2c_get_clientdata (client); -int prec =0 ; - -if (operation ==SENSORS_PROC_REAL_INFO ) -if (data->type == adm1023) { *nrels_mag =3 ; } -else { *nrels_mag =0 ; } -else if (operation ==SENSORS_PROC_REAL_READ ) { -adm1021_update_client (client); - results[0 ] =TEMP_FROM_REG (data->remote_temp_max); - results[1 ] =TEMP_FROM_REG (data->remote_temp_hyst); - results[2 ] =TEMP_FROM_REG (data->remote_temp_input); -if (data->type == adm1023) { - results[0 ] = results[0 ]*1000 + ((data->remote_temp_os_prec >>5 ) *125 ); - results[1 ] = results[1 ]*1000 + ((data->remote_temp_hyst_prec >>5 ) *125 ); - results[2 ] = (TEMP_FROM_REG (data->remote_temp_offset)*1000 ) + ((data->remote_temp_offset_prec >>5 ) *125 ); - results[3 ] = (TEMP_FROM_REG (data->remote_temp_input)*1000 ) + ((data->remote_temp_prec >>5 ) *125 ); - *nrels_mag =4 ; - }else { - *nrels_mag =3 ; - } - }else if (operation ==SENSORS_PROC_REAL_WRITE ) { -if (*nrels_mag >=1 ) { -if (data->type == adm1023) { - prec = ((results[0 ]-((results[0 ]/1000 )*1000 ))/125 )<<5 ; -adm1021_write_value (client,ADM1021_REG_REM_TOS_PREC , prec); - results[0 ] = results[0 ]/1000 ; - data->remote_temp_os_prec=prec; - } - data->remote_temp_max =TEMP_TO_REG (results[0 ]); -adm1021_write_value (client,ADM1021_REG_REMOTE_TOS_W , data->remote_temp_max); - } -if (*nrels_mag >=2 ) { -if (data->type == adm1023) { - prec = ((results[1 ]-((results[1 ]/1000 )*1000 ))/125 )<<5 ; -adm1021_write_value (client,ADM1021_REG_REM_THYST_PREC , prec); - results[1 ] = results[1 ]/1000 ; - data->remote_temp_hyst_prec=prec; - } - data->remote_temp_hyst =TEMP_TO_REG (results[1 ]); -adm1021_write_value (client,ADM1021_REG_REMOTE_THYST_W , data->remote_temp_hyst); - } -if (*nrels_mag >=3 ) { -if (data->type == adm1023) { - prec = ((results[2 ]-((results[2 ]/1000 )*1000 ))/125 )<<5 ; -adm1021_write_value (client,ADM1021_REG_REM_OFFSET_PREC , prec); - results[2 ]=results[2 ]/1000 ; - data->remote_temp_offset_prec=prec; - data->remote_temp_offset=results[2 ]; -adm1021_write_value (client,ADM1021_REG_REM_OFFSET , data->remote_temp_offset); - } - } - } -} - -__attribute__((unused)) -static void adm1021_die_code (struct i2c_client *client,int operation, -int ctl_name,int *nrels_mag,long *results) -{ -struct adm1021_data *data =i2c_get_clientdata (client); - -if (operation ==SENSORS_PROC_REAL_INFO ) - *nrels_mag =0 ; -else if (operation ==SENSORS_PROC_REAL_READ ) { -adm1021_update_client (client); - results[0 ] = data->die_code; - *nrels_mag =1 ; - }else if (operation ==SENSORS_PROC_REAL_WRITE ) { -/* Can't write to it */ - } -} - -__attribute__((unused)) -static void adm1021_alarms (struct i2c_client *client,int operation, -int ctl_name,int *nrels_mag,long *results) -{ -struct adm1021_data *data =i2c_get_clientdata (client); -if (operation ==SENSORS_PROC_REAL_INFO ) - *nrels_mag =0 ; -else if (operation ==SENSORS_PROC_REAL_READ ) { -adm1021_update_client (client); - results[0 ] = data->alarms; - *nrels_mag =1 ; - }else if (operation ==SENSORS_PROC_REAL_WRITE ) { -/* Can't write to it */ - } -} -static int __init sensors_adm1021_init (void ) {return i2c_add_driver (&adm1021_driver);
ChangeSet 1.1179.3.3, 2003/04/23 11:33:28-07:00, [email protected]
[PATCH] i2c: remove dead init code from i2c-sensors.c
drivers/i2c/i2c-sensor.c | 12 ------------ 1 files changed, 12 deletions(-)
drivers/i2c/i2c-sensor.c +0 -12
@@ -163,20 +163,8 @@return 0 ; } -static int __init i2c_sensor_init (void ) -{ -return 0 ; -} - -static void __exit i2c_sensor_exit(void) -{ -} -EXPORT_SYMBOL (i2c_detect);MODULE_AUTHOR ("Frodo Looijaard <[email protected]>" );MODULE_DESCRIPTION ("i2c-sensor driver" );MODULE_LICENSE ("GPL" ); - -module_init (i2c_sensor_init); -module_exit (i2c_sensor_exit);
ChangeSet 1.1179.3.4, 2003/04/23 11:33:48-07:00, [email protected]
[PATCH] i2c: bring i2c-viapro uptodate with the style guide
drivers/i2c/busses/i2c-viapro.c | 321 ++++++++++++++++++---------------------- 1 files changed, 149 insertions(+), 172 deletions(-)
drivers/i2c/busses/i2c-viapro.c +149 -172
@@ -42,23 +42,24 @@#include <linux/init.h> #include <asm/io.h> -#define SMBBA1 0x90 -#define SMBBA2 0x80 -#define SMBBA3 0xD0 +#define SMBBA1 0x90 +#define SMBBA2 0x80 +#define SMBBA3 0xD0/* SMBus address offsets */ -#define SMBHSTSTS (0 + vt596_smba) -#define SMBHSLVSTS (1 + vt596_smba) -#define SMBHSTCNT (2 + vt596_smba) -#define SMBHSTCMD (3 + vt596_smba) -#define SMBHSTADD (4 + vt596_smba) -#define SMBHSTDAT0 (5 + vt596_smba) -#define SMBHSTDAT1 (6 + vt596_smba) -#define SMBBLKDAT (7 + vt596_smba) -#define SMBSLVCNT (8 + vt596_smba) -#define SMBSHDWCMD (9 + vt596_smba) -#define SMBSLVEVT (0xA + vt596_smba) -#define SMBSLVDAT (0xC + vt596_smba) +static unsigned short vt596_smba; +#define SMBHSTSTS (vt596_smba + 0) +#define SMBHSLVSTS (vt596_smba + 1) +#define SMBHSTCNT (vt596_smba + 2) +#define SMBHSTCMD (vt596_smba + 3) +#define SMBHSTADD (vt596_smba + 4) +#define SMBHSTDAT0 (vt596_smba + 5) +#define SMBHSTDAT1 (vt596_smba + 6) +#define SMBBLKDAT (vt596_smba + 7) +#define SMBSLVCNT (vt596_smba + 8) +#define SMBSHDWCMD (vt596_smba + 9) +#define SMBSLVEVT (vt596_smba + 0xA) +#define SMBSLVDAT (vt596_smba + 0xC)/* PCI Address Constants */
@@ -68,14 +69,14 @@static unsigned short smb_cf_hstcfg =0xD2 ;#define SMBHSTCFG (smb_cf_hstcfg) -#define SMBSLVC (SMBHSTCFG+1) -#define SMBSHDW1 (SMBHSTCFG+2) -#define SMBSHDW2 (SMBHSTCFG+3) -#define SMBREV (SMBHSTCFG+4) +#define SMBSLVC (smb_cf_hstcfg + 1) +#define SMBSHDW1 (smb_cf_hstcfg + 2) +#define SMBSHDW2 (smb_cf_hstcfg + 3) +#define SMBREV (smb_cf_hstcfg + 4)/* Other settings */ -#define MAX_TIMEOUT 500 -#define ENABLE_INT9 0 +#define MAX_TIMEOUT 500 +#define ENABLE_INT9 0/* VT82C596 constants */ #define VT596_QUICK 0x00
@@ -84,144 +85,33 @@#define VT596_WORD_DATA 0x0C#define VT596_BLOCK_DATA 0x14 -/* insmod parameters */ /* If force is set to anything different from 0, we forcibly enable the VT596. DANGEROUS! */ -static int force =0 ; +static int force;MODULE_PARM (force,"i" );MODULE_PARM_DESC (force,"Forcibly enable the SMBus. DANGEROUS!" );/* If force_addr is set to anything different from 0, we forcibly enable the VT596 at the given address. VERY DANGEROUS! */ -static int force_addr =0 ; +static int force_addr;MODULE_PARM (force_addr,"i" );MODULE_PARM_DESC (force_addr,"Forcibly enable the SMBus at the given address. " "EXTREMELY DANGEROUS!" ); -static void vt596_do_pause (unsigned int amount); -static int vt596_transaction (void ); -s32 vt596_access (struct i2c_adapter * adap,u16 addr,unsigned short flags, -char read_write,u8 command,int size,union i2c_smbus_data * data); -u32 vt596_func (struct i2c_adapter *adapter); - -static struct i2c_algorithm smbus_algorithm = { - .name ="Non-I2C SMBus adapter" , - .id =I2C_ALGO_SMBUS , - .smbus_xfer = vt596_access, - .functionality = vt596_func, -}; - -static struct i2c_adapter vt596_adapter = { - .owner =THIS_MODULE , - .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_VIA2 , - .algo = &smbus_algorithm, - .dev = { - .name ="unset" , - }, -}; - - - - -static unsigned short vt596_smba =0 ; - - -/* Detect whether a compatible device can be found, and initialize it. */ -int vt596_setup (struct pci_dev *VT596_dev,struct pci_device_id const *id) -{ -unsigned char temp; - -dev_info (&VT596_dev->dev,"Found Via %s device\n" , VT596_dev->dev.name); - -/* Determine the address of the SMBus areas */ -if (force_addr) { - vt596_smba = force_addr &0xfff0 ; - force =0 ; - }else { -if ((pci_read_config_word (VT596_dev, id->driver_data, &vt596_smba)) - || !(vt596_smba &0x1 )) { -/* try 2nd address and config reg. for 596 */ -if ((id->device ==PCI_DEVICE_ID_VIA_82C596_3 ) && - (!pci_read_config_word (VT596_dev,SMBBA2 , &vt596_smba)) && - (vt596_smba &0x1 )) { - smb_cf_hstcfg =0x84 ; - }else { -/* no matches at all */ -dev_err (&VT596_dev->dev,"Cannot configure " -"SMBus I/O Base address\n" ); -return (-ENODEV ); - } - } - vt596_smba &=0xfff0 ; -if (vt596_smba ==0 ) { -dev_err (&VT596_dev->dev,"SMBus base address " -"uninitialized - upgrade BIOS or use " -"force_addr=0xaddr\n" ); -return -ENODEV ; - } - } - -if (!request_region (vt596_smba,8 ,"viapro-smbus" )) { -dev_err (&VT596_dev->dev,"SMBus region 0x%x already in use!\n" , - vt596_smba); -return (-ENODEV ); - } - -pci_read_config_byte (VT596_dev,SMBHSTCFG , &temp); -/* If force_addr is set, we program the new address here. Just to make -sure, we disable the VT596 first. */ -if (force_addr) { -pci_write_config_byte (VT596_dev,SMBHSTCFG , temp &0xfe ); -pci_write_config_word (VT596_dev, id->driver_data, vt596_smba); -pci_write_config_byte (VT596_dev,SMBHSTCFG , temp |0x01 ); -dev_warn (&VT596_dev->dev,"WARNING: SMBus interface set to new " -"address 0x%04x!\n" , vt596_smba); - }else if ((temp &1 ) ==0 ) { -if (force) { -/* NOTE: This assumes I/O space and other allocations -* WERE done by the Bios! Don't complain if your -* hardware does weird things after enabling this. -* :') Check for Bios updates before resorting to -* this. -*/ -pci_write_config_byte (VT596_dev,SMBHSTCFG , - temp |1 ); -dev_info (&VT596_dev->dev,"Enabling SMBus device\n" ); - }else { -dev_err (&VT596_dev->dev,"SMBUS: Error: Host SMBus " -"controller not enabled! - upgrade BIOS or " -"use force=1\n" ); -return (-ENODEV ); - } - } - -if ((temp &0x0E ) ==8 ) -dev_dbg (&VT596_dev->dev,"using Interrupt 9 for SMBus.\n" ); -else if ((temp &0x0E ) ==0 ) -dev_dbg (&VT596_dev->dev,"using Interrupt SMI# for SMBus.\n" ); -else -dev_dbg (&VT596_dev->dev,"Illegal Interrupt configuration " -"(or code out of date)!\n" ); - -pci_read_config_byte (VT596_dev,SMBREV , &temp); -dev_dbg (&VT596_dev->dev,"SMBREV = 0x%X\n" , temp); -dev_dbg (&VT596_dev->dev,"VT596_smba = 0x%X\n" , vt596_smba); - -return (0 ); -} +static struct i2c_adapter vt596_adapter;/* Internally used pause function */ -void vt596_do_pause (unsigned int amount) +static void vt596_do_pause (unsigned int amount) { current->state =TASK_INTERRUPTIBLE ;schedule_timeout (amount); }/* Another internally used function */ -int vt596_transaction (void ) +static int vt596_transaction (void ) {int temp;int result =0 ;
@@ -296,15 +186,16 @@ }/* Return -1 on error. */ -s32 vt596_access (struct i2c_adapter *adap,u16 addr,unsigned short flags, -char read_write,u8 command,int size, -union i2c_smbus_data * data) +static s32 vt596_access (struct i2c_adapter *adap,u16 addr, +unsigned short flags,char read_write,u8 command, +int size,union i2c_smbus_data *data) {int i, len;switch (size) {case I2C_SMBUS_PROC_CALL : -dev_info (&vt596_adapter.dev,"I2C_SMBUS_PROC_CALL not supported!\n" ); +dev_info (&vt596_adapter.dev, +"I2C_SMBUS_PROC_CALL not supported!\n" );return -1 ;case I2C_SMBUS_QUICK : outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
@@ -363,7 +254,6 @@if ((read_write ==I2C_SMBUS_WRITE ) || (size ==VT596_QUICK ))return 0 ; -switch (size) {case VT596_BYTE :/* Where is the result put? I assume here it is in
@@ -388,15 +278,127 @@return 0 ; } - -u32 vt596_func (struct i2c_adapter *adapter) +static u32 vt596_func (struct i2c_adapter *adapter) {return I2C_FUNC_SMBUS_QUICK |I2C_FUNC_SMBUS_BYTE |I2C_FUNC_SMBUS_BYTE_DATA |I2C_FUNC_SMBUS_WORD_DATA |I2C_FUNC_SMBUS_BLOCK_DATA ; } +static struct i2c_algorithm smbus_algorithm = { + .name ="Non-I2C SMBus adapter" , + .id =I2C_ALGO_SMBUS , + .smbus_xfer = vt596_access, + .functionality = vt596_func, +}; + +static struct i2c_adapter vt596_adapter = { + .owner =THIS_MODULE , + .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_VIA2 , + .algo = &smbus_algorithm, + .dev = { + .name ="unset" , + }, +}; + +static int __devinit vt596_probe (struct pci_dev *pdev, +const struct pci_device_id *id) +{ +unsigned char temp; +int error = -ENODEV ; + +/* Determine the address of the SMBus areas */ +if (force_addr) { + vt596_smba = force_addr &0xfff0 ; + force =0 ; + goto found; + } + +if ((pci_read_config_word (pdev, id->driver_data, &vt596_smba)) || + !(vt596_smba &0x1 )) { +/* try 2nd address and config reg. for 596 */ +if (id->device ==PCI_DEVICE_ID_VIA_82C596_3 && + !pci_read_config_word (pdev,SMBBA2 , &vt596_smba) && + (vt596_smba &0x1 )) { + smb_cf_hstcfg =0x84 ; + }else { +/* no matches at all */ +dev_err (&pdev->dev,"Cannot configure " +"SMBus I/O Base address\n" ); +return -ENODEV ; + } + } + vt596_smba &=0xfff0 ; +if (vt596_smba ==0 ) { +dev_err (&pdev->dev,"SMBus base address " +"uninitialized - upgrade BIOS or use " +"force_addr=0xaddr\n" ); +return -ENODEV ; + } + + found: +if (!request_region (vt596_smba,8 ,"viapro-smbus" )) { +dev_err (&pdev->dev,"SMBus region 0x%x already in use!\n" , + vt596_smba); +return -ENODEV ; + } + +pci_read_config_byte (pdev,SMBHSTCFG , &temp); +/* If force_addr is set, we program the new address here. Just to make +sure, we disable the VT596 first. */ +if (force_addr) { +pci_write_config_byte (pdev,SMBHSTCFG , temp &0xfe ); +pci_write_config_word (pdev, id->driver_data, vt596_smba); +pci_write_config_byte (pdev,SMBHSTCFG , temp |0x01 ); +dev_warn (&pdev->dev,"WARNING: SMBus interface set to new " +"address 0x%04x!\n" , vt596_smba); + }else if ((temp &1 ) ==0 ) { +if (force) { +/* NOTE: This assumes I/O space and other allocations +* WERE done by the Bios! Don't complain if your +* hardware does weird things after enabling this. +* :') Check for Bios updates before resorting to +* this. +*/ +pci_write_config_byte (pdev,SMBHSTCFG , temp |1 ); +dev_info (&pdev->dev,"Enabling SMBus device\n" ); + }else { +dev_err (&pdev->dev,"SMBUS: Error: Host SMBus " +"controller not enabled! - upgrade BIOS or " +"use force=1\n" ); + goto release_region; + } + } + +if ((temp &0x0E ) ==8 ) +dev_dbg (&pdev->dev,"using Interrupt 9 for SMBus.\n" ); +else if ((temp &0x0E ) ==0 ) +dev_dbg (&pdev->dev,"using Interrupt SMI# for SMBus.\n" ); +else +dev_dbg (&pdev->dev,"Illegal Interrupt configuration " +"(or code out of date)!\n" ); + +pci_read_config_byte (pdev,SMBREV , &temp); +dev_dbg (&pdev->dev,"SMBREV = 0x%X\n" , temp); +dev_dbg (&pdev->dev,"VT596_smba = 0x%X\n" , vt596_smba); + + vt596_adapter.dev.parent = &pdev->dev; +snprintf (vt596_adapter.dev.name,DEVICE_NAME_SIZE , +"SMBus Via Pro adapter at %04x" , vt596_smba); + +return i2c_add_adapter (&vt596_adapter); + + release_region: +release_region (vt596_smba,8 ); +return error; +} + +static void __devexit vt596_remove(struct pci_dev *pdev) +{ +i2c_del_adapter (&vt596_adapter); +release_region (vt596_smba,8 ); +}static struct pci_device_id vt596_ids[]__devinitdata = { {
@@ -451,29 +453,6 @@ { 0, } }; -static int __devinit vt596_probe (struct pci_dev *dev,const struct pci_device_id *id) -{ -int retval; - - retval =vt596_setup (dev, id); -if (retval) -return retval; - - vt596_adapter.dev.parent = &dev->dev; - -snprintf (vt596_adapter.dev.name,DEVICE_NAME_SIZE , -"SMBus Via Pro adapter at %04x" , vt596_smba); - - retval =i2c_add_adapter (&vt596_adapter); - -return retval; -} - -static void __devexit vt596_remove(struct pci_dev *dev) -{ -i2c_del_adapter (&vt596_adapter); -} -static struct pci_driver vt596_driver = { .name ="vt596 smbus" , .id_table = vt596_ids,
@@ -490,14 +469,12 @@ static void __exit i2c_vt596_exit(void) {pci_unregister_driver (&vt596_driver); -release_region (vt596_smba,8 ); } - - -MODULE_AUTHOR ("Frodo Looijaard <[email protected]> and Philip Edelbrock <[email protected]>" ); +MODULE_AUTHOR ( +"Frodo Looijaard <[email protected]> and " +"Philip Edelbrock <[email protected]>" );MODULE_DESCRIPTION ("vt82c596 SMBus driver" ); -MODULE_LICENSE ("GPL" );module_init (i2c_vt596_init);
ChangeSet 1.1179.3.5, 2003/04/24 09:57:20-07:00, [email protected]
[PATCH] i2c: added it87 driver
drivers/i2c/chips/Kconfig | 14 drivers/i2c/chips/Makefile | 1 drivers/i2c/chips/it87.c | 930 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 943 insertions(+), 2 deletions(-)
drivers/i2c/chips/Kconfig +12 -2
@@ -22,6 +22,16 @@ in the lm_sensors package, which you can download at http://www.lm-sensors.nu +config SENSORS_IT87 + tristate " National Semiconductors IT87 and compatibles" + depends on I2C && EXPERIMENTAL + help + The module will be called it87. + + You will also need the latest user-space utilties: you can find them + in the lm_sensors package, which you can download at + http://www.lm-sensors.nu + config SENSORS_LM75 tristate " National Semiconductors LM75 and compatibles" depends on I2C && EXPERIMENTAL
@@ -66,8 +76,8 @@ config I2C_SENSOR tristate - default y if SENSORS_ADM1021=y || SENSORS_LM75=y || SENSORS_VIA686A=y || SENSORS_W83781D=y - default m if SENSORS_ADM1021=m || SENSORS_LM75=m || SENSORS_VIA686A=m || SENSORS_W83781D=m + default y if SENSORS_ADM1021=y || SENSORS_IT87=y || SENSORS_LM75=y || SENSORS_VIA686A=y || SENSORS_W83781D=y + default m if SENSORS_ADM1021=m || SENSORS_IT87=m || SENSORS_LM75=m || SENSORS_VIA686A=m || SENSORS_W83781D=m default n endmenu
drivers/i2c/chips/Makefile +1 -0
@@ -3,6 +3,7 @@ # obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o +obj-$(CONFIG_SENSORS_IT87) += it87.o obj-$(CONFIG_SENSORS_LM75) += lm75.o obj-$(CONFIG_SENSORS_VIA686A) += via686a.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o
drivers/i2c/chips/it87.c new file +930 -0
930 lines not on this page · raw message
ChangeSet 1.1179.3.6, 2003/04/24 10:26:56-07:00, [email protected]
[PATCH] i2c: fix up it87.c check_region mess.
drivers/i2c/chips/it87.c | 38 ++++++++++++++++---------------------- 1 files changed, 16 insertions(+), 22 deletions(-)
drivers/i2c/chips/it87.c +16 -22
@@ -224,7 +224,6 @@allocated. */ struct it87_data {struct semaphore lock; -int sysctl_id;enum chips type;struct semaphore update_lock;
@@ -533,22 +532,21 @@int it87_detect (struct i2c_adapter *adapter,int address,int kind) {int i; -struct i2c_client *new_client; +struct i2c_client *new_client =NULL ;struct it87_data *data;int err =0 ;const char *name ="" ;const char *client_name ="" ;int is_isa =i2c_is_isa_adapter (adapter); -if (!is_isa - && !i2c_check_functionality (adapter, -I2C_FUNC_SMBUS_BYTE_DATA )) goto - ERROR0; +if (!is_isa && + !i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA )) + goto ERROR0; -if (is_isa) { -if (check_region (address,IT87_EXTENT )) +/* Reserve the ISA region */ +if (is_isa) +if (!request_region (address,IT87_EXTENT , name)) goto ERROR0; - }/* Probe whether there is anything available on this address. Already done for SMBus clients */
@@ -560,11 +558,11 @@if we read 'undefined' registers. */ i =inb_p (address +1 );if (inb_p (address +2 ) != i) - goto ERROR0; + goto ERROR1;if (inb_p (address +3 ) != i) - goto ERROR0; + goto ERROR1;if (inb_p (address +7 ) != i) - goto ERROR0; + goto ERROR1;#undef REALLY_SLOW_IO/* Let's just hope nothing breaks here */
@@ -585,7 +583,7 @@ sizeof(struct it87_data), GFP_KERNEL))) { err = -ENOMEM ; - goto ERROR0; + goto ERROR1; } data = (struct it87_data *) (new_client +1 );
@@ -635,10 +633,6 @@ goto ERROR1; } -/* Reserve the ISA region */ -if (is_isa) -request_region (address,IT87_EXTENT , name); -/* Fill in the remaining client fields and put it into the global list */ strncpy (new_client->dev.name, name,DEVICE_NAME_SIZE );
@@ -650,7 +644,7 @@/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client))) - goto ERROR2; + goto ERROR1;/* register sysfs hooks */ device_create_file (&new_client->dev, &dev_attr_in_input0);
@@ -689,12 +683,12 @@it87_init_client (new_client);return 0 ; - ERROR2: +ERROR1: +kfree (new_client); +if (is_isa)release_region (address,IT87_EXTENT ); - ERROR1: -kfree (new_client); - ERROR0: +ERROR0:return err; }
ChangeSet 1.1179.3.7, 2003/04/24 11:13:08-07:00, [email protected]
[PATCH] i2c: removed unused flags paramater in found_proc callback.
drivers/i2c/i2c-core.c | 8 ++++---- include/linux/i2c.h | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/i2c/i2c-core.c +4 -4
@@ -618,8 +618,8 @@* ---------------------------------------------------- */ int i2c_probe (struct i2c_adapter *adapter, -struct i2c_client_address_data *address_data, -i2c_client_found_addr_proc *found_proc) +struct i2c_client_address_data *address_data, +int (*found_proc) (struct i2c_adapter *,int ,int )) {int addr,i,found,err;int adap_id =i2c_adapter_id (adapter);
@@ -644,7 +644,7 @@ (addr == address_data->force[i+1])) {DEB2 (printk (KERN_DEBUG "i2c-core.o: found force parameter for adapter %d, addr %04x\n" , adap_id,addr)); -if ((err =found_proc (adapter,addr,0 ,0 ))) +if ((err =found_proc (adapter,addr,0 )))return err; found =1 ; }
@@ -732,7 +732,7 @@/* OK, so we really should examine this address. First check whether there is some client here at all! */ if (i2c_smbus_xfer (adapter,addr,0 ,0 ,0 ,I2C_SMBUS_QUICK ,NULL ) >=0 ) -if ((err =found_proc (adapter,addr,0 ,-1 ))) +if ((err =found_proc (adapter,addr,-1 )))return err; }return 0 ;
include/linux/i2c.h +1 -4
@@ -338,12 +338,9 @@* It will only call found_proc if some client is connected at the * specific address (unless a 'force' matched); */ -typedef int i2c_client_found_addr_proc (struct i2c_adapter *adapter, -int addr,unsigned short flags,int kind); -extern int i2c_probe (struct i2c_adapter *adapter,struct i2c_client_address_data *address_data, -i2c_client_found_addr_proc *found_proc); +int (*found_proc) (struct i2c_adapter *,int ,int ));/* An ioctl like call to set div. parameters of the adapter. */
ChangeSet 1.1179.3.8, 2003/04/24 11:14:04-07:00, [email protected]
[PATCH] i2c: fix up the media drivers due to removing flags paramater of callback function
drivers/media/video/msp3400.c | 6 ++---- drivers/media/video/saa5249.c | 2 +- drivers/media/video/saa7111.c | 2 +- drivers/media/video/tda7432.c | 3 +-- drivers/media/video/tda9840.c | 2 +- drivers/media/video/tda9875.c | 3 +-- drivers/media/video/tda9887.c | 3 +-- drivers/media/video/tea6415c.c | 2 +- drivers/media/video/tea6420.c | 2 +- drivers/media/video/tuner-3036.c | 3 +-- drivers/media/video/tuner.c | 3 +-- drivers/media/video/tvaudio.c | 3 +-- 12 files changed, 13 insertions(+), 21 deletions(-)
drivers/media/video/msp3400.c +2 -4
@@ -1208,8 +1208,7 @@/* ----------------------------------------------------------------------- */ -static int msp_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind); +static int msp_attach (struct i2c_adapter *adap,int addr,int kind);static int msp_detach (struct i2c_client *client);static int msp_probe (struct i2c_adapter *adap);static int msp_command (struct i2c_client *client,unsigned int cmd,void *arg);
@@ -1233,8 +1232,7 @@ }, }; -static int msp_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +static int msp_attach (struct i2c_adapter *adap,int addr,int kind) {DECLARE_MUTEX_LOCKED (sem);struct msp3400c *msp;
drivers/media/video/saa5249.c +1 -1
@@ -149,7 +149,7 @@static struct i2c_client client_template; -static int saa5249_attach (struct i2c_adapter *adap,int addr,unsigned short flags,int kind) +static int saa5249_attach (struct i2c_adapter *adap,int addr,int kind) {int pgbuf;int err;
drivers/media/video/saa7111.c +1 -1
@@ -66,7 +66,7 @@/* ----------------------------------------------------------------------- */ -static int saa7111_attach (struct i2c_adapter *adap,int addr,unsigned short flags,int kind) +static int saa7111_attach (struct i2c_adapter *adap,int addr,int kind) {int i;struct saa7111 *decoder;
drivers/media/video/tda7432.c +1 -2
@@ -312,8 +312,7 @@* i2c interface functions * * *********************** */ -static int tda7432_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +static int tda7432_attach (struct i2c_adapter *adap,int addr,int kind) {struct tda7432 *t;struct i2c_client *client;
drivers/media/video/tda9840.c +1 -1
@@ -178,7 +178,7 @@return 0 ; } -static int tda9840_detect (struct i2c_adapter *adapter,int address,unsigned short flags,int kind) +static int tda9840_detect (struct i2c_adapter *adapter,int address,int kind) {struct i2c_client *client;int result =0 ;
drivers/media/video/tda9875.c +1 -2
@@ -240,8 +240,7 @@return (0 ); } -static int tda9875_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +static int tda9875_attach (struct i2c_adapter *adap,int addr,int kind) {struct tda9875 *t;struct i2c_client *client;
drivers/media/video/tda9887.c +1 -2
@@ -345,8 +345,7 @@/* ---------------------------------------------------------------------- */ -static int tda9887_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +static int tda9887_attach (struct i2c_adapter *adap,int addr,int kind) {struct tda9887 *t;
drivers/media/video/tea6415c.c +1 -1
@@ -55,7 +55,7 @@static int tea6415c_id =0 ;/* this function is called by i2c_probe */ -static int tea6415c_detect (struct i2c_adapter *adapter,int address,unsigned short flags,int kind) +static int tea6415c_detect (struct i2c_adapter *adapter,int address,int kind) {struct i2c_client *client =0 ;int err =0 ;
drivers/media/video/tea6420.c +1 -1
@@ -95,7 +95,7 @@ }/* this function is called by i2c_probe */ -static int tea6420_detect (struct i2c_adapter *adapter,int address,unsigned short flags,int kind) +static int tea6420_detect (struct i2c_adapter *adapter,int address,int kind) {struct i2c_client *client;int err =0 , i =0 ;
drivers/media/video/tuner-3036.c +1 -2
@@ -114,8 +114,7 @@/* ---------------------------------------------------------------------- */ static int -tuner_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +tuner_attach (struct i2c_adapter *adap,int addr,int kind) {static unsigned char buffer[] = {0x29 ,0x32 ,0x2a ,0 ,0x2b ,0 };
drivers/media/video/tuner.c +1 -2
@@ -776,8 +776,7 @@/* ---------------------------------------------------------------------- */ -static int tuner_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +static int tuner_attach (struct i2c_adapter *adap,int addr,int kind) {struct tuner *t;struct i2c_client *client;
drivers/media/video/tvaudio.c +1 -2
@@ -1326,8 +1326,7 @@/* ---------------------------------------------------------------------- */ /* i2c registration */ -static int chip_attach (struct i2c_adapter *adap,int addr, -unsigned short flags,int kind) +static int chip_attach (struct i2c_adapter *adap,int addr,int kind) {struct CHIPSTATE *chip;struct CHIPDESC *desc;
ChangeSet 1.1179.3.9, 2003/04/24 11:14:26-07:00, [email protected]
[PATCH] i2c: removed unneeded typedef from i2c-sensor.h
drivers/i2c/i2c-sensor.c | 4 ++-- include/linux/i2c-sensor.h | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/i2c/i2c-sensor.c +2 -2
@@ -35,8 +35,8 @@/* Very inefficient for ISA detects, and won't work for 10-bit addresses! */ int i2c_detect (struct i2c_adapter *adapter, -struct i2c_address_data *address_data, -i2c_found_addr_proc * found_proc) +struct i2c_address_data *address_data, +int (*found_proc) (struct i2c_adapter *,int ,int )) {int addr, i, found, j, err;struct i2c_force_data *this_force;
include/linux/i2c-sensor.h +2 -5
@@ -315,16 +315,13 @@ {NULL}}; \SENSORS_INSMOD -typedef int i2c_found_addr_proc(struct i2c_adapter *adapter, -int addr,int kind); -/* Detect function. It iterates over all possible addresses itself. For SMBus addresses, it will only call found_proc if some client is connected to the SMBus (unless a 'force' matched); for ISA detections, this is not done. */ extern int i2c_detect(struct i2c_adapter *adapter, -struct i2c_address_data *address_data, -i2c_found_addr_proc * found_proc); +struct i2c_address_data *address_data, +int (*found_proc) (struct i2c_adapter *,int ,int ));/* This macro is used to scale user-input to sensible values in almost all
ChangeSet 1.1179.3.10, 2003/04/24 13:38:03-07:00, [email protected]
[PATCH] i2c: remove a lot of dupliated macros from i2c-sensor.h and use the current values in i2c.h
drivers/i2c/chips/adm1021.c | 8 +-- drivers/i2c/chips/it87.c | 8 +-- drivers/i2c/chips/lm75.c | 8 +-- drivers/i2c/chips/via686a.c | 8 +-- drivers/i2c/chips/w83781d.c | 10 +-- drivers/i2c/i2c-sensor.c | 30 +++++------ include/linux/i2c-sensor.h | 113 ++++++++++++++------------------------------ include/linux/i2c.h | 20 +++++-- 8 files changed, 86 insertions(+), 119 deletions(-)
drivers/i2c/chips/adm1021.c +4 -4
@@ -39,12 +39,12 @@#define ADM1021_ALARM_RTEMP_NA 0x04/* Addresses to scan */ -static unsigned short normal_i2c[] = {SENSORS_I2C_END }; +static unsigned short normal_i2c[] = {I2C_CLIENT_END };static unsigned short normal_i2c_range[] = {0x18 ,0x1a ,0x29 ,0x2b , -0x4c ,0x4e ,SENSORS_I2C_END +0x4c ,0x4e ,I2C_CLIENT_END }; -static unsigned int normal_isa[] = {SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = {SENSORS_ISA_END }; +static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END }; +static unsigned int normal_isa_range[] = {I2C_CLIENT_ISA_END };/* Insmod parameters */ SENSORS_INSMOD_8 (adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, mc1066);
drivers/i2c/chips/it87.c +4 -4
@@ -40,10 +40,10 @@/* Addresses to scan */ -static unsigned short normal_i2c[] = {SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = {0x20 ,0x2f ,SENSORS_I2C_END }; -static unsigned int normal_isa[] = {0x0290 ,SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = {SENSORS_ISA_END }; +static unsigned short normal_i2c[] = {I2C_CLIENT_END }; +static unsigned short normal_i2c_range[] = {0x20 ,0x2f ,I2C_CLIENT_END }; +static unsigned int normal_isa[] = {0x0290 ,I2C_CLIENT_ISA_END }; +static unsigned int normal_isa_range[] = {I2C_CLIENT_ISA_END };/* Insmod parameters */ SENSORS_INSMOD_4 (it87, it8705, it8712, sis950);
drivers/i2c/chips/lm75.c +4 -4
@@ -28,10 +28,10 @@/* Addresses to scan */ -static unsigned short normal_i2c[] = {SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = {0x48 ,0x4f ,SENSORS_I2C_END }; -static unsigned int normal_isa[] = {SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = {SENSORS_ISA_END }; +static unsigned short normal_i2c[] = {I2C_CLIENT_END }; +static unsigned short normal_i2c_range[] = {0x48 ,0x4f ,I2C_CLIENT_END }; +static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END }; +static unsigned int normal_isa_range[] = {I2C_CLIENT_ISA_END };/* Insmod parameters */ SENSORS_INSMOD_1 (lm75);
drivers/i2c/chips/via686a.c +4 -4
@@ -51,10 +51,10 @@/* Addresses to scan. Note that we can't determine the ISA address until we have initialized our module */ -static unsigned short normal_i2c[] = {SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = {SENSORS_I2C_END }; -static unsigned int normal_isa[] = {0x0000 ,SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = {SENSORS_ISA_END }; +static unsigned short normal_i2c[] = {I2C_CLIENT_END }; +static unsigned short normal_i2c_range[] = {I2C_CLIENT_END }; +static unsigned int normal_isa[] = {0x0000 ,I2C_CLIENT_ISA_END }; +static unsigned int normal_isa_range[] = {I2C_CLIENT_ISA_END };/* Insmod parameters */ SENSORS_INSMOD_1 (via686a);
drivers/i2c/chips/w83781d.c +5 -5
@@ -46,14 +46,14 @@#define W83781D_RT 1/* Addresses to scan */ -static unsigned short normal_i2c[] = {SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = {0x20 ,0x2f ,SENSORS_I2C_END }; -static unsigned int normal_isa[] = {0x0290 ,SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = {SENSORS_ISA_END }; +static unsigned short normal_i2c[] = {I2C_CLIENT_END }; +static unsigned short normal_i2c_range[] = {0x20 ,0x2f ,I2C_CLIENT_END }; +static unsigned int normal_isa[] = {0x0290 ,I2C_CLIENT_ISA_END }; +static unsigned int normal_isa_range[] = {I2C_CLIENT_ISA_END };/* Insmod parameters */ SENSORS_INSMOD_6 (w83781d, w83782d, w83783s, w83627hf, as99127f, w83697hf); -SENSORS_MODULE_PARM (force_subclients,"List of subclient addresses: " +I2C_CLIENT_MODULE_PARM (force_subclients,"List of subclient addresses: " "{bus, clientaddr, subclientaddr1, subclientaddr2}" );static int init =1 ;
drivers/i2c/i2c-sensor.c +15 -15
@@ -42,7 +42,7 @@struct i2c_force_data *this_force;int is_isa =i2c_is_isa_adapter (adapter);int adapter_id = - is_isa ?SENSORS_ISA_BUS :i2c_adapter_id (adapter); + is_isa ?ANY_I2C_ISA_BUS :i2c_adapter_id (adapter);/* Forget it if we can't probe using SMBUS_QUICK */ if ((!is_isa) &&
@@ -59,9 +59,9 @@detection at all */ found =0 ;for (i =0 ; !found && (this_force = address_data->forces + i, this_force->force); i++) { -for (j =0 ; !found && (this_force->force[j] !=SENSORS_I2C_END ); j +=2 ) { +for (j =0 ; !found && (this_force->force[j] !=I2C_CLIENT_END ); j +=2 ) {if ( ((adapter_id == this_force->force[j]) || - ((this_force->force[j] ==SENSORS_ANY_I2C_BUS ) && !is_isa)) && + ((this_force->force[j] ==ANY_I2C_BUS ) && !is_isa)) && (addr == this_force->force[j +1 ]) ) {dev_dbg (&adapter->dev,"found force parameter for adapter %d, addr %04x\n" , adapter_id, addr);if ((err =found_proc (adapter, addr, this_force->kind)))
@@ -75,18 +75,18 @@/* If this address is in one of the ignores, we can forget about it right now */ -for (i =0 ; !found && (address_data->ignore[i] !=SENSORS_I2C_END ); i +=2 ) { +for (i =0 ; !found && (address_data->ignore[i] !=I2C_CLIENT_END ); i +=2 ) {if ( ((adapter_id == address_data->ignore[i]) || - ((address_data->ignore[i] ==SENSORS_ANY_I2C_BUS ) && + ((address_data->ignore[i] ==ANY_I2C_BUS ) && !is_isa)) && (addr == address_data->ignore[i +1 ])) {dev_dbg (&adapter->dev,"found ignore parameter for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } } -for (i =0 ; !found && (address_data->ignore_range[i] !=SENSORS_I2C_END ); i +=3 ) { +for (i =0 ; !found && (address_data->ignore_range[i] !=I2C_CLIENT_END ); i +=3 ) {if ( ((adapter_id == address_data->ignore_range[i]) || - ((address_data-> ignore_range[i] ==SENSORS_ANY_I2C_BUS ) & + ((address_data-> ignore_range[i] ==ANY_I2C_BUS ) & !is_isa)) && (addr >= address_data->ignore_range[i +1 ]) && (addr <= address_data->ignore_range[i +2 ])) {
@@ -100,13 +100,13 @@/* Now, we will do a detection, but only if it is in the normal or probe entries */ if (is_isa) { -for (i =0 ; !found && (address_data->normal_isa[i] !=SENSORS_ISA_END ); i +=1 ) { +for (i =0 ; !found && (address_data->normal_isa[i] !=I2C_CLIENT_ISA_END ); i +=1 ) {if (addr == address_data->normal_isa[i]) {dev_dbg (&adapter->dev,"found normal isa entry for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } } -for (i =0 ; !found && (address_data->normal_isa_range[i] !=SENSORS_ISA_END ); i +=3 ) { +for (i =0 ; !found && (address_data->normal_isa_range[i] !=I2C_CLIENT_ISA_END ); i +=3 ) {if ((addr >= address_data->normal_isa_range[i]) && (addr <= address_data->normal_isa_range[i +1 ]) && ((addr - address_data->normal_isa_range[i]) % address_data->normal_isa_range[i +2 ] ==0 )) {
@@ -115,13 +115,13 @@ } } }else { -for (i =0 ; !found && (address_data->normal_i2c[i] !=SENSORS_I2C_END ); i +=1 ) { +for (i =0 ; !found && (address_data->normal_i2c[i] !=I2C_CLIENT_END ); i +=1 ) {if (addr == address_data->normal_i2c[i]) { found =1 ;dev_dbg (&adapter->dev,"found normal i2c entry for adapter %d, addr %02x" , adapter_id, addr); } } -for (i =0 ; !found && (address_data->normal_i2c_range[i] !=SENSORS_I2C_END ); i +=2 ) { +for (i =0 ; !found && (address_data->normal_i2c_range[i] !=I2C_CLIENT_END ); i +=2 ) {if ((addr >= address_data->normal_i2c_range[i]) && (addr <= address_data->normal_i2c_range[i +1 ])) {dev_dbg (&adapter->dev,"found normal i2c_range entry for adapter %d, addr %04x\n" , adapter_id, addr);
@@ -131,19 +131,19 @@ }for (i =0 ; - !found && (address_data->probe[i] !=SENSORS_I2C_END ); + !found && (address_data->probe[i] !=I2C_CLIENT_END ); i +=2 ) {if (((adapter_id == address_data->probe[i]) || ((address_data-> - probe[i] ==SENSORS_ANY_I2C_BUS ) & !is_isa)) + probe[i] ==ANY_I2C_BUS ) & !is_isa)) && (addr == address_data->probe[i +1 ])) {dev_dbg (&adapter->dev,"found probe parameter for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } } -for (i =0 ; !found && (address_data->probe_range[i] !=SENSORS_I2C_END ); i +=3 ) { +for (i =0 ; !found && (address_data->probe_range[i] !=I2C_CLIENT_END ); i +=3 ) {if ( ((adapter_id == address_data->probe_range[i]) || - ((address_data->probe_range[i] ==SENSORS_ANY_I2C_BUS ) & !is_isa)) && + ((address_data->probe_range[i] ==ANY_I2C_BUS ) & !is_isa)) && (addr >= address_data->probe_range[i +1 ]) && (addr <= address_data->probe_range[i +2 ])) { found =1 ;
include/linux/i2c-sensor.h +37 -76
216 lines not on this page · raw message
include/linux/i2c.h +13 -7
@@ -290,10 +290,12 @@ };/* Internal numbers to terminate lists */ -#define I2C_CLIENT_END 0xfffe +#define I2C_CLIENT_END 0xfffe +#define I2C_CLIENT_ISA_END 0xfffefffe/* The numbers to use to set I2C bus address */ -#define ANY_I2C_BUS 0xffff +#define ANY_I2C_BUS 0xffff +#define ANY_I2C_ISA_BUS 9191/* The length of the option lists */ #define I2C_CLIENT_MAX_OPTS 48
@@ -556,11 +558,15 @@I2C_CLIENT_MODULE_PARM (force, \"List of adapter,address pairs to boldly assume " \"to be present" ); \ -static struct i2c_client_address_data addr_data = \ - {normal_i2c, normal_i2c_range, \ - probe, probe_range, \ - ignore, ignore_range, \ - force} +static struct i2c_client_address_data addr_data = { \ + .normal_i2c = normal_i2c, \ + .normal_i2c_range = normal_i2c_range, \ + .probe = probe, \ + .probe_range = probe_range, \ + .ignore = ignore, \ + .ignore_range = ignore_range, \ + .force = force, \ + }/* Detect whether we are on the isa bus. If this returns true, all i2c access will fail! */