I am trying to configure my Yocto Linux distro to setup two on-board I2C GPIO Expanders and document how to access them programmatically (i.e. from a C user application). The GPIO Expanders are both NXP PCA9557, which is supported by the gpio-pca953x.c kernel driver.
I understand how to compile this driver into the kernel (using CONFIG_GPIO_PCA953X
configuration option) and load it (using modprobe
). I also understand I can instantiate these two I2C devices in the device tree (this is an embedded device, so the GPIO expanders are static and unchanging):
gpio@20 {
compatible = "nxp,pca9557";
reg = <0x1a>;
gpio-controller;
#gpio-cells = <2>;
};
The information I'm lacking is how to use the gpio-pca953x driver with these instantiated devices? Do I need to associate these devices with that particular driver? What APIs do I use to access them in a user application written in C? Do these just act like normal GPIOs once I've configured them correctly?
I'm more than happy to read through any relevant documentation, lengthy or otherwise, on how to do this. I'm just a beginner in Linux device drivers and have no idea where to go from here, despite a great deal of googling.