https://github.com/rinhizakura/vi2c-diva
The virtual I2C platform device "diva" and its device driver
https://github.com/rinhizakura/vi2c-diva
linux-i2c linux-kernel-driver linux-kernel-module
Last synced: 4 months ago
JSON representation
The virtual I2C platform device "diva" and its device driver
- Host: GitHub
- URL: https://github.com/rinhizakura/vi2c-diva
- Owner: RinHizakura
- Created: 2021-12-27T14:46:52.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-24T14:44:42.000Z (over 3 years ago)
- Last Synced: 2024-11-07T06:26:18.547Z (6 months ago)
- Topics: linux-i2c, linux-kernel-driver, linux-kernel-module
- Language: C
- Homepage:
- Size: 24.4 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vi2c-diva
## Introduction
The vi2c-diva project is trying to implement virtual I2C platform device "diva" and its device
driver. We'll try to understand the purpose of each component in the Linux I2C subsystem.
For traditional chinese users who want to learn more about this project, you
are welcome to check the [link](https://hackmd.io/@RinHizakura/BJDTZnUsF) for more
introduction of I2C. Welcome for any advice and discussion, thanks!## Usage
To build and insert these module, using the following command. Note that the sequence to
insert each module is important for kerenl to match our device and driver correctly.```
$ make subdirs
$ make -C pdev insert
$ make -C adap insert
$ make -C diva-dev insert
```If everything goes right, it means the probe function of 'adap' and 'diva-dev' will be
callbacked by kernel, which means we match the device driver to device successfully!```
$ dmesg
[diva-pdev] Init diva with status 0
[i2c-diva-adap] Connect to diva adap i2c-diva
[i2c-diva-dev] Connect to diva dev vi2c,diva-i2c
[i2c-diva-dev] Transfer message: PASS
```To remove the module from kernel, using the following command.
```
$ make -C diva-dev remove
$ make -C adap remove
$ make -C pdev remove
```## Reference
* [Day 10:I2C Driver (Part 1) - 使用 Device Tree 來找 Driver](https://ithelp.ithome.com.tw/articles/10244211)
* [Implementing I2C device drivers](https://www.kernel.org/doc/html/latest/i2c/writing-clients.html)
* [How to instantiate I2C devices](https://www.kernel.org/doc/html/latest/i2c/instantiating-devices.html)
* [linux/drivers/i2c/busses/i2c-bcm2835.c](https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-bcm2835.c)