1 i2c_board_info資料結構的定義
static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {<br />/* Techically this a pca9500 - but it's compatible with the 8574<br /> * for gpio expansion and the 24c02 for eeprom access.<br /> */<br />{<br />.type = "pcf8574",<br />.addr = 0x27,<br />.platform_data = &platform_data_pcf857x,<br />}, {<br />.type = "24c02",<br />.addr = 0x57,<br />.platform_data = &pca9500_eeprom_pdata,<br />}, {<br />.type = "max1238",<br />.addr = 0x35,<br />}, { /* ITS400 Sensor board only */<br />.type = "max1363",<br />.addr = 0x34,<br />/* Through a nand gate - Also beware, on V2 sensor board the<br /> * pull up resistors are missing.<br /> */<br />.irq = IRQ_GPIO(99),<br />}, { /* ITS400 Sensor board only */<br />.type = "tsl2561",<br />.addr = 0x49,<br />/* Through a nand gate - Also beware, on V2 sensor board the<br /> * pull up resistors are missing.<br /> */<br />.irq = IRQ_GPIO(99),<br />}, { /* ITS400 Sensor board only */<br />.type = "tmp175",<br />.addr = 0x4A,<br />.irq = IRQ_GPIO(96),<br />},<br />};</p><p>static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {<br />{<br />.type = "da9030",<br />.addr = 0x49,<br />.platform_data = &stargate2_da9030_pdata,<br />.irq = gpio_to_irq(1),<br />},<br />};
Note:Pay attetion on the value of the addr member.(addr=chip_address>>1)
2 I2C 器件註冊到I2C Bus
i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
i2c_register_board_info(1,
ARRAY_AND_SIZE(stargate2_pwr_i2c_board_info));
Note: The first parameter is the I2C Bus ID.
Author: WoodPecker <Pecker.hu@gmail.com>