I am building LineageOS 14.1 from source and I am integrating a PCF857x GPIO-expander driver into my Linux kernel (Version ~3.2 Linux). The driver itself (pcf857x.c, pcf857x.h) is already included in the kernel. So I just need to set it up to specify my specific GPIO expander (PCF8574). As this is built on an older version of the Linux kernel, I use a board file to setup this driver.
/* PCF8574 GPIO expander platform data */
static struct pcf857x_platform_data pcf857x_data[] = {
{
.gpio_base = 300,
},
};
/* I2C1 */
static struct i2c_board_info i2c_devs1[] __initdata = {
{
I2C_BOARD_INFO("pcf857x", 0x20),
.type = "pcf8574",
.platform_data = &pcf857x_data[0],
},
};
When I eventually flash the LineageOS build onto my hardware (Samsung Galaxy S2 AT&T i777 which runs on an Exynos4210 SoC), I see the device registered on the appropriate I2C bus at the correct address (I2C1 at 0x20). However, I do not see any GPIOs being registered. For now, I have not actually connected my expander to my I2C1 bus yet, but I think I should still be able to see the GPIOs registered. Specifically, I should see GPIO 300-307 registered (as it is an 8 bit expander). But I don't.
The GPIOs that I do see from the hardware via "cat /sys/kernel/debug/gpio" range from 0-287. Since I don't want to conflict with any physical GPIO, I chose my expander GPIOs to be out of this range (300+). Part of the problem I believe is that GPIOs out of this range don't exist. When I try to export GPIO 300, nothing happen (echo 300 > /sys/class/gpio/export). In the kernel, there is a macro "ARCH_NR_GPIOS" that defines the total number of GPIOs (both built-in/SoC GPIOs and more such as those on GPIO expanders). I tried increasing this ARCH_NR_GPIOS several times, even to 1000 at one point. But I still cannot export anything beyond the original 0-287 GPIOs (I can't export some of these as some are currently used by other drivers but I can export many of them). What do you think the issue might be?