| Electronic Components Datasheet Search |
|
UM0851 Datasheet(PDF) 82 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM0851 Datasheet(HTML) 82 Page - STMicroelectronics |
|
82 / 245 page ![]() Communication device drivers UM0851 82/245 Doc ID 16604 Rev 2 Attaching an adapter After the registration of the I2C chip driver, when an I2C bus driver is loaded, the attach_adapter() function callback is called. This function checks if any I2C devices are on the I2C bus to which the client driver wants to attach. static int eeprom_attach_adapter(struct i2c_adapter *adapter) { return i2c_probe(adapter, &addr_data, eeprom_detect); } The i2c_probe() function probes the I2C adapter, looking for the different addresses specified in the struct addr_data. If a device is found, the eeprom_detect() function is called. The addr_data macro is defined in the include/linux/i2c.h file. It sets up a static variable called addr_data based on the number of different types of chips that this driver supports and the addresses at which these chips typically are present. It then provides the ability to override these values by using module parameters. static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = probe, .ignore = ignore, .forces = forces, } /* normal_i2c: An I2C chip driver provide the variables normal_i2c. It is an array of addresses, all terminated by special value I2C_CLIENT_END. Usually a specific type of I2C chip shows up in only a limited range of addresses. The eeprom.c driver defines these variables as static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,0x55, 0x56, 0x57, I2C_CLIENT_END } The normal_i2c_range variable specifies that we can find this chip device at any I2C address. Probe: A list of pairs. The first value is a bus number (adapter id), the second is the I2C address. These addresses are also probed, as if they were in the 'normal' list. The i2c_probe function will call the eeprom_detect function only for those i2c addresses and the adapter id that actually have a device on them (unless a `force' parameter was used). Ignore: List of adapter, address pairs not to scan. These addresses are Never probed. Forces: Contains list of valid address along with there adapter id. The first value is a bus number (adapter id), the second is the I2C address. A device is blindly assumed to be on the given address, no probing is done. */ Chip detection In the chip driver, when an I2C chip device is found, the function chip_detect() is called by the I2C core. This function is declared with the following parameters: static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind); The adapter variable is the I2C adapter structure on which this chip is located. The address variable contains the address where the chip was found, and the kind variable indicates what kind of chip was found. Note: The kind variable usually is ignored, but some I2C chip drivers support different kinds of I2C chips, so this variable can be used to determine the type of chip present. |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |