How to contorl I2C device or GPIO device in the kernel.
Dear Sir.
My env is see below
- Platform : x86 atom rangeley.
- linux kernel : 4.7.0
Linux kernel is already support I2C device driver and GPIO device driver.
And this device is successfully worked.
If i was loading the "i2c-i801.ko", created the "/dev/i2c-0" and can running.
If i was loading the "gpio-ich.ko", created the "/sys/class/gpio" and can running.
But my goal ls create the new kernel device driver.
And I must contorl i2c and gpio in the my new device driver.
Never use the file descriptor on user space. Just use the kernel APIs.
But I don't know "How to can get some descriptor for I2C, GPIO in kernel space".
Some kernel code use the special API(ex. get_deviceXXXX()).
Could you support some example code?
Thank you.
|