I am after some clarification/guidance. For a leaning experiment I am wanting to implement a driver for both the MCP23xxx gpio expander ICs. One series using i2c and the other SPI.
I have experience with i2c drivers for onboard sensors but am now a little unsure of the approach I should take. This exceptional answer and the LWM article it links gave some great insight into platform drivers. I understand that a platform drivers would make sense as thee gpio expanders are not discoverable devices. Now I am unsure of how one would implement a platform drivers that is really an i2c driver(focusing on just one of the chip variants for now). The sensors I have worked with in the past are instantiated in the device tree and the the device driver can make easy use of the i2c_client
to interface with the device. Something that I am unsure of is how a platform driver would, for example, interface with i2c devices. I have struggled to find any resources in this.
I would be greatly appreciative if someone would quickly outline for me how platform drivers could be used as device drivers for devices that are, in their most basic form, i2c devices or spi devices. It could be that my understanding of platform drivers is also won't in this context. Clarification there would , as such, also be greatly appreciated.