Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: "Alexander Ivanov" <amivanov@fastmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: gpio-it87: gpiod_get*() always return -ENOENT
Date: Fri, 25 Aug 2023 11:23:21 -0700	[thread overview]
Message-ID: <119422e6-c159-41fd-8a95-4a0ac3b5822b@app.fastmail.com> (raw)
In-Reply-To: <CAJfuBxwOHo756697Nk0psHdB1TiSRmcY2gFcb7BzZeK1hhCo2w@mail.gmail.com>

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2023-08-25 18:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 23:45 how to fix MACRO_ARG_REUSE jim.cromie
2023-08-25 18:23 ` Alexander Ivanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=119422e6-c159-41fd-8a95-4a0ac3b5822b@app.fastmail.com \
    --to=amivanov@fastmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).