0

I recently acquired a 3rd party driver for a hardware device from the manufacturer that interfaces to the hardware device through i2c. The driver acts as an input device driver for a touchscreen controller.

It appears that in the initialization section of the driver there is a call to 'i2c_get_adapter()' which implies that the i2c adapter driver must have previously been loaded and running in order for the function call to be successful.

Having read the i2c readme under Linux/Documentation, the readme describes opening a device file for the adapter "/dev/i2c-x" in userspace.

Rather than having to open the i2c adapter device from userspace first before loading my 3rd party driver, is there another mechanism to do this from the driver? What is the common practice for doing this? Can I not just open the i2c adapter driver from my input driver? I'm asking because having taken a look at several other device drivers that communicate over i2c, it appears that they all make the same presumption that my input driver does. Which is a bit curious to me.

carlh
  • 31
  • 4
  • It is likely that your adapter driver will be part of Linux Kernel itself (mostly built in). Even if it is not the case, it will be automatically loaded by the Kernel and Udev combination. Linux kernel driver core model will probe and sends the uevent after finding the device in use. In short, Linux Kernel automatically takes care of it. You can check the picture in http://stackoverflow.com/a/33118405/2689839 – Parthiban May 11 '17 at 04:45
  • It seems you didn't get how current code works. Look at the existing touchscreen drivers in the vanilla kernel (check out the latest and greatest), I'm pretty sure if there is no exact driver for your hardware there are many close examples. – 0andriy May 11 '17 at 18:59

0 Answers0