All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Smith <kevin.smith@elecsyscorp.com>
To: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Expose named GPIOs through sysfs
Date: Wed, 18 May 2016 20:43:36 +0000	[thread overview]
Message-ID: <573CD3FA.10306@elecsyscorp.com> (raw)

Hello,

I have several GPIOs that are not associated with kernel drivers that I 
would like to expose to userspace with names corresponding to their 
functions.  I am on Arm, so I would like to be able to specify this 
through a device tree.

As a concrete example, I have a USB device that is controlled with a 
userspace libusb driver which has a reset pin connected by GPIO.  I 
would like to expose this line as dev_reset.  Right now, userspace has 
to know the GPIO number, export the gpio, manually configure it as an 
output, then set its value.  Instead, I would like the device to simply 
show up as /sys/class/gpio/dev_reset/ (or similar) with the expected 
GPIO properties in this directory.

As a workaround, I have seen some people configure GPIOs with the LED 
driver and control the pin with "brightness", but this seems like a 
hack.  I am aware of gpio-hog, but as far as I can tell, once hogged, 
the GPIO is not exposed and cannot be changed (at least by userspace).

I see that there have been similar discussions before [1], but they 
don't seem to have reached a conclusion.  Before working on something, I 
wanted to contact the list to get some direction on the right way to 
proceed.  Is a dedicated driver the right way to do this?  Or an option 
added to the GPIO system?  I see some proposals in [2] ... is 
implementing the suggestions there the best way?

Thank you,
Kevin Smith

[1] https://www.mail-archive.com/linux-gpio@vger.kernel.org/msg00864.html
[2] https://www.mail-archive.com/linux-gpio@vger.kernel.org/msg01084.html

             reply	other threads:[~2016-05-18 20:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 20:43 Kevin Smith [this message]
2016-06-14  7:31 ` Expose named GPIOs through sysfs Linus Walleij

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=573CD3FA.10306@elecsyscorp.com \
    --to=kevin.smith@elecsyscorp.com \
    --cc=linux-gpio@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.