当前位置:网站首页>Summary of communication mode and detailed explanation of I2C drive

Summary of communication mode and detailed explanation of I2C drive

2022-06-23 08:26:00 Be good to me

1. Common mode of communication

 Insert picture description here

2.I2C Bus

2.1 I2C Bus hardware connection

 Insert picture description here

2.2 I2C Software architecture

 Insert picture description here

2.3 I2C Subsystem implementation process

(1)i2c adapter establish i2c client;
(2)i2c adapter Medium i2c client And i2c driver adopt i2c core Complete registration matching ;
(3)i2c driver Transfer the data of the upper application to i2c client;
(4)i2c client adopt i2c adapter Find the corresponding i2c algorithm, And transmit data ;
(5)i2c The controller generates SCL and SDA.

3. I2C Device tree implementation

 Insert picture description here
    Where nodes i2c_4 It means that the 4 Group i2c controller ( Each group of controllers has SCL and SDA), Two sets of i2c controller :i2c_4 and i2c_5, among i2c_4 The address for 78b8000,i2c_5 The address for 78b9000.
    i2c_4 Represents the adapter node , Its address is 0x78b8000( stay mdm9607 On chip ),wcd9xxx_codec Indicates specific equipment ( It's also a chip ) node , His address is 0x0d( On the device chip ).

3.1 View device nodes

    1) stay /sys/firmware/devicetree/base( Shortcut Directory /proc/device-tree) Under the table of contents : Is presented in a directory structure dtb file . The root node corresponds to base Catalog , Each node corresponds to a directory , Each attribute corresponds to a file ;
    2) stay /sys/devices/platform Under the table of contents : It shows all the registered platform devices . If there is... Under the equipment of_node, Just to prove this platform_device It is created by passing parameters from the device tree ; If it were not so of_node A link file for , Then it is not created from the device tree file , It may be created during kernel compilation or by installing modules .

3.2 Example

(1) All device trees are in /proc/device-tree Under the table of contents , and i2c Hang on to soc Next , Therefore, in /proc/device-tree /soc The node name can be seen under :
 Insert picture description here
adopt cat compatible You can view the device name attribute :
 Insert picture description here

原网站

版权声明
本文为[Be good to me]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230809397728.html