Actually, it's about the last platform bus.
In the Arch/arm/mach-mx6/board-mx6q_sabresd.c file
1 Static void__init Mx6_sabresd_board_init (void) 2 { 3 ..... 4strcpy (mxc_i2c0_board_info[0].type,"wm8962"); 5mxc_i2c0_board_info[0].platform_data = &Wm8962_config_data; 6 7IMX6Q_ADD_IMX_I2C (0, &mx6q_sabresd_i2c_data); 8IMX6Q_ADD_IMX_I2C (1, &mx6q_sabresd_i2c_data); 9IMX6Q_ADD_IMX_I2C (2, &mx6q_sabresd_i2c_data); Ten ..... One}
3 I²c buses are added here
Look at the prototype of Mx6q_sabresd_i2c_data.
1 Static struct imxi2c_platform_data mx6q_sabresd_i2c_data = { 2 //. Bitrate = 100000, 3 400000, 4 };
Set the I²C bit rate
Into the inside of the code:
1 #define imx6q_add_imx_i2c (ID, pdata) \ 2 imx_add_imx_i2c (&imx6q_imx_i2c_data[ ID], pdata)
Inside is a macro definition, obviously, this may be another person writing code, there is a structure
1 extern Const struct
1 struct Imx_imx_i2c_data { 2 int ID; 3 Resour ce_size_t iobase; 4 resource_size_t Iosize; 5 RESOURC e_size_t IRQ; 6 };
Re-enter IMX_ADD_IMX_I2C ();
1 structPlatform_device *__init IMX_ADD_IMX_I2C (2 Const structImx_imx_i2c_data *data,3 Const structImxi2c_platform_data *pdata)4 { 5 structResource res[] = { 6 { 7. Start = data->Iobase,8. end = Data->iobase + Data->iosize-1, 9. Flags =Ioresource_mem,Ten }, { One. Start = data->IRQ, A. end = Data->IRQ, -. Flags =Ioresource_irq, - }, the }; - - returnImx_add_platform_device ("IMX-I2C", data->ID, - Res, array_size (res), +pdatasizeof(*pdata)); -}
Linux kernel i²c underlying code tracking