/* bus recovery specific initialization */ /*初始化sda、scl,通常这两个引脚会复用gpio引脚*/ if (adap-》bus_recovery_info) { struct i2c_bus_recovery_info *bri = adap-》bus_recovery_info; if (!bri-》recover_bus) { dev_err(&adap-》dev, “No recover_bus() found, not using recovery ...
/* bus recovery specific initialization */ /*初始化sda、scl,通常这两个引脚会复用gpio引脚*/ if (adap->bus_recovery_info) { struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; if (!bri->recover_bus) { dev_err(&adap->dev, "No recover_bus() found, not using recovery ");...
/* bus recovery specific initialization */ /*初始化sda、scl,通常这两个引脚会复用gpio引脚*/ if (adap->bus_recovery_info) { struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; if (!bri->recover_bus) { dev_err(&adap->dev, "No recover_bus() found, not using recovery\n")...
gpio_request(I2C_BUS_CLK, "gpioxx"); /* try to recover I2C bus */ gpio_direction_input(I2C_BUS_DATA); if (!__gpio_get_value(I2C_BUS_DATA)) { while((!__gpio_get_value(I2C_BUS_DATA)) && ++counter < 10) { udelay(5); gpio_direction_output(I2C_BUS_CLK, 1); udelay(5); g...
structi2c_bus_recovery_info*bri=adap->bus_recovery_info; if(!bri->recover_bus) { dev_err(&adap->dev,"No recover_bus() found, not using recovery\n"); adap->bus_recovery_info =NULL; gotoexit_recovery; } /* Generic GPIO recovery */ ...
612 int (*recover_bus)(struct i2c_adapter *adap); /* recovery的主函数,可以是驱动自己定义的,也可以用genetic的函数:i2c_generic_scl_recovery */ 613 614 int (*get_scl)(struct i2c_adapter *adap); /* 获得当前SCL线的电平状态,如果使用generic scl recovery,这个方法必须要指定 */ ...
To complement the above: the I2C communication works fine, as well as the called I2C_scan. It is only after a reset that SDA might hang low and that I can't recover fully from an SDA line stuck low by software. I get the line high again but cannot get I2C working again without pul...
static int __device_attach(struct device *dev, bool allow_async){ bus_for_each_drv(dev->bus, NULL,&data, __device_attach_driver);} 1. i2c_scan_static_board_info //扫描硬件信息,生成与adapter总线号相同的i2c_client设备 static void i2c_scan_static_board_info(struct i2c_adapter *adapter)...
intdriver_register(struct device_driver*drv){/* 检查总线上是否已经存在需要注册的驱动名,如果已经被注册,就会报错 */other=driver_find(drv->name,drv->bus);if(other){printk(KERN_ERR"Error: Driver '%s' is already registered, ""aborting...\n"...
adpter,适配器,实际就是CPU集成的IIC控制器,有cpu控制,完成i2c物理总线操作,busses文件夹里,有各个cpu adapter的具体实现;algorithm集成到这个模块里,而且是adapter的一部分,主要实现总 线传输的标准化。 i2c-dev,把adapter设备化,采用标准的file_operations字符设备的形式,便于用户层直接读写adapter设备文件,不是主流...