i2c probe not being called…not sure where to call

2019-04-16 12:18发布

I have an Intel systems. I am trying to load at24.ko and i2c-mux-pca9541.ko. both modules have probe functions which are not being called. according to the Documentation, i need to call i2c_registetr_board_info in the arch_init. but I am not sure where to do that for the Intel system (ie which files). I do not see any examples anywhere on the internet. can someone provide a pointer to the file that i add this call. if this is not the right approach, please let me know.

thank you in advance.

1条回答
看我几分像从前
2楼-- · 2019-04-16 12:58

The probe is not called because a "matching" device is not found by the kernel that could be associated with the driver. There are different ways to provide the device information to the kernel. They are discussed as follows :

If this is for testing purpose, you can probe the i2c devices through sysfs :

echo <device_name> <i2c_address> > /sys/bus/i2c/devices/i2c-0/new_device

device_name : name of the i2c device. Should be the one used in the driver.

i2c_address : Address of the i2c device as per the device datasheet

The above command assumes that the i2c bus '0' is the one where the device is attached.

Apart from this, there are some other ways to probe your device. You might specify the device info through a device tree or by calling i2c_register_board_info(). You could create a simple module that creates the i2c_board_info structure and registers it using i2c_register_board_info(), and then insert the module such that the device would be "known" to the kernel and binds the device with its driver. It need not be in the board init codes.

I recommend you to go through the following documentation on probing i2c devices : http://lxr.free-electrons.com/source/Documentation/i2c/instantiating-devices

查看更多
登录 后发表回答