Content in/sys/bus/I2C/devices and i2c_board_info struct

Source: Internet
Author: User

I2C devices in the system can be found in the/sys/bus/I2C/devices directory, as follows:

View plaincopy to clipboardprint?
# Ls
0-0034
0-0030
0-0011
0-0058
# Ls
0-0034
0-0030
0-0011
0-0058

These devices exist in the system.

How did these devices come from?

In your machine configuration, you will execute the "i2c_register_board_info" function, which will register an i2c_board_info struct into the system,

The i2c_board_info struct describes information about all I2C devices on the board, as shown in the following example:

View plaincopy to clipboardprint?
Static struct i2c_board_info littleton_i2c_board_info [] = {
# If defined (config_pxa3xx_micco) | defined (config_pxa3xx_micco_module)
{
. Type = "Micco ",
. ADDR = 0x34,
. Platform_data = & micco_data,
. IRQ = irq_gpio (mfp_to_gpio (mfp_pin_gpio18 )),
},
# Endif
# If defined (config_gpio_max7320) | defined (config_gpio_max7320_module)
{
. Type = "max7320 ",
. ADDR = 0x50,
. Platform_data = & exp0_pdata,
},
# Endif
# If defined (config_gpio_max7321) | defined (config_gpio_max7321_module)
{
/* On 8385 WLAN Board */
. Type = "max7321 ",
. ADDR = 0x60,
. Platform_data = & exp1_pdata [board_8385_wlan],
},
{
/* On UMTS Board */
. Type = "max7321 ",
. ADDR = 0x61,
. Platform_data = & exp1_pdata [board_umts],
},
{
/* On Siemens baseband radio interposer Board */
. Type = "max7321 ",
. ADDR = 0x62,
. Platform_data = & exp1_pdata [board_siemens_baseband],
},
{
/* On 8688 WLAN/camera Board */
. Type = "max7321 ",
. ADDR = 0x63,
. Platform_data = & exp1_pdata [board_8688_wlan_camera],
},
{
/* On camera Board */
. Type = "max7321 ",
. ADDR = 0x64,
. Platform_data = & exp1_pdata [board_camera],
},
{
/* On 8686 WLAN/camera Board */
. Type = "max7321 ",
. ADDR = 0x66,
. Platform_data = & exp1_pdata [board_81__wlan_camera],
},
{
/* On 8385 WLAN/camera Board */
. Type = "max7321 ",
. ADDR = 0x6c,
. Platform_data = & exp1_pdata [board_81__wlan_camera],
},
{
/* On 8688 WLAN Board */
. Type = "max7321 ",
. ADDR = 0x6d,
. Platform_data = & exp1_pdata [board_8688_wlan],
. IRQ = irq_gpio (mfp_to_gpio (mfp_pin_gpio77 )),
},
# Endif
# If defined (config_pxa_camera)
{
. Type = "sensor_ov7673 ",
. ADDR = 0x21,
. Platform_data = & ov7673_sensor_data,
},
{
. Type = "sensor_ov5623 ",
. ADDR = 0x30,
. Platform_data = & ov5623_sensor_data,
},
# Endif
};
Static struct i2c_board_info littleton_i2c_board_info [] = {
# If defined (config_pxa3xx_micco) | defined (config_pxa3xx_micco_module)
{
. Type = "Micco ",
. ADDR = 0x34,
. Platform_data = & micco_data,
. IRQ = irq_gpio (mfp_to_gpio (mfp_pin_gpio18 )),
},
# Endif
# If defined (config_gpio_max7320) | defined (config_gpio_max7320_module)
{
. Type = "max7320 ",
. ADDR = 0x50,
. Platform_data = & exp0_pdata,
},
# Endif
# If defined (config_gpio_max7321) | defined (config_gpio_max7321_module)
{
/* On 8385 WLAN Board */
. Type = "max7321 ",
. ADDR = 0x60,
. Platform_data = & exp1_pdata [board_8385_wlan],
},
{
/* On UMTS Board */
. Type = "max7321 ",
. ADDR = 0x61,
. Platform_data = & exp1_pdata [board_umts],
},
{
/* On Siemens baseband radio interposer Board */
. Type = "max7321 ",
. ADDR = 0x62,
. Platform_data = & exp1_pdata [board_siemens_baseband],
},
{
/* On 8688 WLAN/camera Board */
. Type = "max7321 ",
. ADDR = 0x63,
. Platform_data = & exp1_pdata [board_8688_wlan_camera],
},
{
/* On camera Board */
. Type = "max7321 ",
. ADDR = 0x64,
. Platform_data = & exp1_pdata [board_camera],
},
{
/* On 8686 WLAN/camera Board */
. Type = "max7321 ",
. ADDR = 0x66,
. Platform_data = & exp1_pdata [board_81__wlan_camera],
},
{
/* On 8385 WLAN/camera Board */
. Type = "max7321 ",
. ADDR = 0x6c,
. Platform_data = & exp1_pdata [board_81__wlan_camera],
},
{
/* On 8688 WLAN Board */
. Type = "max7321 ",
. ADDR = 0x6d,
. Platform_data = & exp1_pdata [board_8688_wlan],
. IRQ = irq_gpio (mfp_to_gpio (mfp_pin_gpio77 )),
},
# Endif
# If defined (config_pxa_camera)
{
. Type = "sensor_ov7673 ",
. ADDR = 0x21,
. Platform_data = & ov7673_sensor_data,
},
{
. Type = "sensor_ov5623 ",
. ADDR = 0x30,
. Platform_data = & ov5623_sensor_data,
},
# Endif
};
 

It can be found that the device under the/sys/bus/I2C/devices directory is the I2C device described in the i2c_board_info structure,

The device names under/sys/bus/I2C/devices are named according to the I2C address defined in the i2c_board_info struct.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/codehat/archive/2010/03/04/5344897.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.