On Fri, 18 Aug 2023 09:17 -07:00, Alexander Ivanov <amivanov@xxxxxxxxxxxx> wrote: > Hello, > > Appologies if submitting to wrong list. > > I am developing a driver for PCIe-based device that needs to receive > external signals through on-board GPIOs. The target platform is > Intel-based board and running Fedora 34 kernel 5.11.12-300.fc34.x86_64 > and has GPIO devices driver by gpio-it87. > > # gpiodetect > gpiochip0 [INT34BB:00] (312 lines) > gpiochip1 [gpio_it87] (64 lines) > > 8 of available 64 lines are connected to a header on the board: > > # gpioinfo 1 > ... > line 49: "it87_gp71" unused input active-high > line 50: "it87_gp72" unused input active-high > line 51: "it87_gp73" unused input active-high > line 52: "it87_gp74" unused input active-high > line 53: "it87_gp75" unused input active-high > line 54: "it87_gp76" unused input active-high > line 55: "it87_gp77" unused input active-high > ... > > These lines are verified with logic analyzer and `gpioset 1 nn=0|1` > > The PCIe device driver defines these lines as: > > static struct gpiod_lookup_table gpio_it87_gpios = { > .dev_id = "gpio_it87", > .table = { > GPIO_LOOKUP("gpio-it87", 48, "it87_gp70", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 49, "it87_gp71", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 50, "it87_gp72", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 51, "it87_gp73", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 52, "it87_gp74", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 53, "it87_gp75", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 54, "it87_gp76", GPIO_ACTIVE_HIGH), > GPIO_LOOKUP("gpio-it87", 55, "it87_gp77", GPIO_ACTIVE_HIGH), > {}, > }, > }; > > and then adds them to lookup table, eg.: > > gpiod_add_lookup_table(&gpio_it87_gpios); > > However, none of those lines are available at > > struct desc *gpio = gpiod_get(dev, "it87_gp70", GPIOD_IN); > > Above returns -ENOENT for any of those lines. > I believe it is due to incorrct lookup definions in gpio_it87_gpios > above, however, I cannot figure out what is wrong there. > Any suggestions on how to resolve the problem? Thanks, --Alex