I2C chip Drivers

來源:互聯網
上載者:User
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>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.