I have a hardware device consisting of 3 separate chips on an I2C bus. I would like to group them together and expose them to userland as one logical device. The user will see the logical device represented by one directory somewhere in /sys, as well as the nodes that you expect from I2C chips, under /sys/class/i2c-adapter/i2c-?/*.
One of the chips is the MCP23017, which, as far as I can tell, already has a driver ( drivers/gpio/gpio-mcp23s08.c), and I would like to reuse it. Another chip is the PCA9685, and I would like to provide a driver for this chip that uses PWM's system include/linux/pwm.h. The third chip is MCU firmware that performs custom firmware.
How should I structure a set of drivers? One of my ideas is to register the platform driver to represent the logical device and use the I2C drivers from this. Is this a good way to go? Are there any better ways?
The logical device is the engine driver board and IR receiver. I have a simple diagram of its structure .
I am looking to create two interfaces. The first is similar to /sys/class/gpiowhere the engines can be "exported" and then accessible via read and write attributes. This would be useful for accessing the shell script and quickly debugging the mechanical parts of the system connected to the engines. The second node-in character device /dev, where data can be read or written in binary format, is more useful for managing applications.