2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-03 07:45:30 +00:00

Changes regarding the new i2c_check_addr function

Changes in sensors.c:

  sensors_detect now skips addresses which are already taken. Even a
  force parameter can not override this, as it could lead to major
  problems.
  For ISA addresses, the same is done; but the client drivers still need
  a check if they claim more than one ISA address (as all of the current
  ISA clients do).

Changes in chip drivers:

  Removed the comment about needing address registration

Changes in i2cdetect.c:

  Marks addresses which are already claimed

Changes in sensors-detect:

  Warns when an address is already claimed, and skips it.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@667 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard
1999-12-08 20:37:09 +00:00
parent d3441611d6
commit fd545796ee
17 changed files with 15 additions and 43 deletions

2
TODO
View File

@@ -25,7 +25,7 @@ KERNEL MODULES
in Simon Vogl's i2c modules. in Simon Vogl's i2c modules.
* Better general locking, or at least a once-over to check no race-conditions * Better general locking, or at least a once-over to check no race-conditions
remain. This is part of the SMP-safeness, and can better be done at once. remain. This is part of the SMP-safeness, and can better be done at once.
* Test SIS5595(/91/98) sensor support. Write generic i2c support. * Test SIS5595(/91/98) sensor support and SMBus support
Thomas Dickel <Thomas.Dickel@mni.fh-giessen.de> owns one SIS5595. Thomas Dickel <Thomas.Dickel@mni.fh-giessen.de> owns one SIS5595.
* adm9240: check whether the current voltage computations are correct. * adm9240: check whether the current voltage computations are correct.
Probably not, as they are different from the datasheet specifications. Probably not, as they are different from the datasheet specifications.

View File

@@ -213,9 +213,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* We need address registration for the I2C bus too. That is not yet
implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access adm1021_{read,write}_value. */ But it allows us to access adm1021_{read,write}_value. */

View File

@@ -367,9 +367,6 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address,
if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* We need address registration for the I2C bus too. That is not yet
implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access adm9240_{read,write}_value. */ But it allows us to access adm9240_{read,write}_value. */

View File

@@ -185,9 +185,6 @@ printk("bt869.o: probing address %d .\n",address);
I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access bt869_{read,write}_value. */ But it allows us to access bt869_{read,write}_value. */

View File

@@ -180,9 +180,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address,
I2C_FUNC_SMBUS_WRITE_WORD_DATA)) I2C_FUNC_SMBUS_WRITE_WORD_DATA))
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access eeprom_{read,write}_value. */ But it allows us to access eeprom_{read,write}_value. */

View File

@@ -317,9 +317,6 @@ static int gl518_detect(struct i2c_adapter *adapter, int address,
I2C_FUNC_SMBUS_WORD_DATA)) I2C_FUNC_SMBUS_WORD_DATA))
goto ERROR0; goto ERROR0;
/* We need address registration for the I2C bus too. That is not yet
implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access gl518_{read,write}_value. */ But it allows us to access gl518_{read,write}_value. */

View File

@@ -312,9 +312,6 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
I2C_FUNC_SMBUS_WORD_DATA)) I2C_FUNC_SMBUS_WORD_DATA))
goto ERROR0; goto ERROR0;
/* We need address registration for the I2C bus too. That is not yet
implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access gl520_{read,write}_value. */ But it allows us to access gl520_{read,write}_value. */

View File

@@ -159,9 +159,6 @@ int lm75_detect(struct i2c_adapter *adapter, int address,
I2C_FUNC_SMBUS_WORD_DATA)) I2C_FUNC_SMBUS_WORD_DATA))
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access lm75_{read,write}_value. */ But it allows us to access lm75_{read,write}_value. */

View File

@@ -319,8 +319,6 @@ int lm78_detect(struct i2c_adapter *adapter, int address,
if (!is_isa && ! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) if (!is_isa && ! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* We need address registration for the I2C bus too. That is not yet
implemented. */
if (is_isa) { if (is_isa) {
if (check_region(address,LM78_EXTENT)) if (check_region(address,LM78_EXTENT))
goto ERROR0; goto ERROR0;

View File

@@ -310,9 +310,6 @@ int lm80_detect(struct i2c_adapter *adapter, int address,
if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access lm80_{read,write}_value. */ But it allows us to access lm80_{read,write}_value. */

View File

@@ -172,9 +172,6 @@ int ltc1710_detect(struct i2c_adapter *adapter, int address,
if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE)) if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE))
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access ltc1710_{read,write}_value. */ But it allows us to access ltc1710_{read,write}_value. */

View File

@@ -146,9 +146,6 @@ int matorb_detect(struct i2c_adapter *adapter, int address,
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access matorb_{read,write}_value. */ But it allows us to access matorb_{read,write}_value. */

View File

@@ -204,9 +204,6 @@ int thmc50_detect(struct i2c_adapter *adapter, int address,
if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* Here, we have to do the address registration check for the I2C bus.
But that is not yet implemented. */
/* OK. For now, we presume we have a valid client. We now create the /* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet. client structure, even though we cannot fill it completely yet.
But it allows us to access thmc50_{read,write}_value. */ But it allows us to access thmc50_{read,write}_value. */

View File

@@ -653,8 +653,6 @@ int w83781d_detect(struct i2c_adapter *adapter, int address,
if (!is_isa && ! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) if (!is_isa && ! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA))
goto ERROR0; goto ERROR0;
/* We need address registration for the I2C bus too. That is not yet
implemented. */
if (is_isa) { if (is_isa) {
if (check_region(address,W83781D_EXTENT)) if (check_region(address,W83781D_EXTENT))
goto ERROR0; goto ERROR0;

View File

@@ -25,6 +25,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/ioport.h>
#include "version.h" #include "version.h"
#include <linux/i2c.h> #include <linux/i2c.h>
@@ -613,6 +614,9 @@ int sensors_detect(struct i2c_adapter *adapter,
for (addr = 0x00; for (addr = 0x00;
addr <= (is_isa?0xffff:0x7f); addr <= (is_isa?0xffff:0x7f);
addr ++) { addr ++) {
if ((is_isa && check_region(addr,1)) ||
(!is_isa && i2c_check_addr(adapter,addr)))
continue;
/* If it is in one of the force entries, we don't do any detection /* If it is in one of the force entries, we don't do any detection
at all */ at all */

View File

@@ -87,9 +87,14 @@ int main(int argc, char *argv[])
printf("%02x: ",i); printf("%02x: ",i);
for(j = 0; j < 16; j++) { for(j = 0; j < 16; j++) {
if (ioctl(file,I2C_SLAVE,i+j) < 0) { if (ioctl(file,I2C_SLAVE,i+j) < 0) {
fprintf(stderr,"Error: Could not set address to %d: %s\n",i+j, if (errno == EBUSY) {
strerror(errno)); printf("UU ");
exit(1); continue;
} else {
fprintf(stderr,"Error: Could not set address to %02x: %s\n",i+j,
strerror(errno));
exit(1);
}
} }
res = i2c_smbus_write_quick(file, I2C_SMBUS_WRITE); res = i2c_smbus_write_quick(file, I2C_SMBUS_WRITE);

View File

@@ -1082,8 +1082,8 @@ sub scan_adapter
next; next;
} }
i2c_set_slave_addr(\*FILE,$addr) or print("Can't set address to $_?!?\n"), i2c_set_slave_addr(\*FILE,$addr) or
next; printf("Client at address 0x%02x can not be probed - unload all client drivers first!\n",$addr), next;
next unless i2c_smbus_write_quick(\*FILE,$SMBUS_WRITE) >= 0; next unless i2c_smbus_write_quick(\*FILE,$SMBUS_WRITE) >= 0;
printf "Client found at address 0x%02x\n",$addr; printf "Client found at address 0x%02x\n",$addr;