gpio-it87: gpiod_get*() always return -ENOENT

Alexander Ivanov amivanov at fastmail.com
Fri Aug 25 14:23:21 EDT 2023


Hello,

I posted this message to linix-gpio group about a week ago, but it didn't get
any reply so far; thus trying here.

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
running Fedora 34 kernel 5.11.12-300.fc34.x86_64 and has GPIO controller driven
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 were 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 seem available

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. What am I missing?

Thanks,
--Alex



More information about the Kernelnewbies mailing list