Linux I2C notes

本文探讨了I2C总线系统中主从设备的概念,详细介绍了Linux环境下如何为I2C主控制器和从设备设计驱动程序。主控制器驱动负责向从设备发送指令和数据,而从设备驱动则关注于访问寄存器和数据。文章通过一张图表清晰地展示了客户端(从设备)与适配器(主设备)之间的交互,并指导如何在设备树中添加这些组件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.youkuaiyun.com/wangpengqi/article/details/17711165

 

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. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值