linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to use an ACPI declared GPIO in a userspace ...
@ 2020-09-29 15:37 Flavio Suligoi
  2020-09-29 15:47 ` Bartosz Golaszewski
  0 siblings, 1 reply; 17+ messages in thread
From: Flavio Suligoi @ 2020-09-29 15:37 UTC (permalink / raw)
  To: linux-gpio, linux-acpi; +Cc: linux-kernel

Hi all,

I need to expose to the userspace a GPIO, physically connected to a board
push-button. This GPIO must expose a pre-defined name, such as
"user-push-button", so that the userspace applications can use it without
know any physical GPIO details.

I can customize the board BIOS and so my goal is to add an ACPI table with
a content like this:

...
Scope (\_SB.GPO1)
	{
		Device (BTNS)
		{
			Name (_HID, "PRP0001")
			Name (_DDN, "GPIO buttons device")

			Name (_CRS, ResourceTemplate ()
			{
				GpioIo (
				Exclusive,               // Not shared
				PullNone,                // No need for pulls
				0,                       // Debounce timeout
				0,                       // Drive strength
				IoRestrictionInputOnly,  // Only used as input
				"\\_SB.GPO1",            // GPIO controller
				0, ResourceConsumer, , ) // Must be 0
				{
					25,              // GPIO number
				}
...

I know that this GPIO can be used from other drivers.
For example I successfully tested it using the "gpio-keys" device driver,
giving to my GPIO a key-code and emulating in this way a keyboard key.
This could be a possible solution.

But I prefer to expose my GPIO as a classic GPIO, not as a keyboard key.

I was wondering if there is a generic GPIO driver that I can use to expose
this GPIO with its pre-defined name (caming from the ACPI table declaration),
to the userspace...

Best regards,

Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-10-02 13:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 15:37 How to use an ACPI declared GPIO in a userspace Flavio Suligoi
2020-09-29 15:47 ` Bartosz Golaszewski
2020-09-29 16:10   ` Andy Shevchenko
2020-09-29 16:21     ` Flavio Suligoi
2020-09-29 16:27       ` Andy Shevchenko
2020-09-30 12:04         ` Flavio Suligoi
2020-09-30 13:01           ` Andy Shevchenko
2020-09-30 15:39             ` Flavio Suligoi
2020-09-30 15:54               ` Andy Shevchenko
2020-09-30 16:10                 ` Andy Shevchenko
2020-10-02 10:02                   ` Flavio Suligoi
2020-10-02 12:48                     ` Andy Shevchenko
2020-10-02 13:23                       ` Andy Shevchenko
2020-10-02 13:29                         ` Flavio Suligoi
2020-10-02 10:26                   ` Flavio Suligoi
2020-10-02 12:40                     ` Andy Shevchenko
2020-09-29 16:10   ` Flavio Suligoi

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 NNTP newsgroup(s).