Linux I2C notes

I2C has Master and Slave.

Master could be SoC I2C controller.

Slave could be EEPROM, LCD, Audio Codec.

 

So Linux should provide master driver and slave driver. 

Master driver: how to send cmd/data to slave device

Slave driver: how to access slave register, data.

 

borrow a picture from https://blog.****.net/wangpengqi/article/details/17711165

 

Linux I2C notes

In this picture, Client is slave, adaptor is master. Then everything is easy to understand.

To add Master/adaptor, you need add it in the device tree based on the SoC spec info.

To add Slave/client, you need add it in the device tree as subnode of master/adaptor node.