kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* How is gpio_keys.ko supposed to work?
@ 2013-03-28 16:13 Sven Geggus
  2013-03-29 17:46 ` Jerry Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Geggus @ 2013-03-28 16:13 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I have a userland application on Raspberry Pi which uses select to read
input from a button connected to gpio like this:

GPIO --+---- BUTTON ----- GND
       |
       +--- RESISTOR 2k -- VCC (3.3V)

The sysfs "file" I use select at is /sys/class/gpio/gpioX/value with the
method found in Documentation/gpio.txt.

However, this same file also states the following:
Note that standard kernel drivers exist for common "LEDs and Buttons"
GPIO tasks:  "leds-gpio" and "gpio_keys", respectively.  Use those
instead of talking directly to the GPIOs; they integrate with kernel
frameworks better than your userspace code could.

So how can I make this "standard kernel drivers" work?

I would like to get rid of using /sys/class/gpio/gpioX/value and use
/dev/input/eventX instead, because the first method will require debouncing
in userland and is not portable to other keyboard types.

I tried to compile a kernel with CONFIG_KEYBOARD_GPIO enabled and load
gpio_keys.ko. However this did neither create a new device in /dev/input/
nor /sys/devices/platform/gpio-keys.

Kconfig states the following:
...
Your board-specific setup logic must also provide a platform device,
with configuration data saying which GPIOs are used.
...

So looks like my "board-specific setup logic" (whatever this might be) does
not "provide a platform device with configuration data saying which GPIOs
are used".

So my question is twofold:
1. Where can I find the "board-specific setup logic" (for Rapberry Pi in my
case
2. How would this "board-specific setup logic" (if unavailable) look like to
make gpio_keys.ko work?

Sven

P.S.: The kernel in use is the one from
git://github.com/raspberrypi/linux.git which is basically a vanilla 3.6.11
with Raspberry Pi specific patches.

-- 
Threading is a performance hack.
(The Art of Unix Programming by Eric S. Raymond)

/me is giggls at ircnet, http://sven.gegg.us/ on the Web

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

end of thread, other threads:[~2013-03-30 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 16:13 How is gpio_keys.ko supposed to work? Sven Geggus
2013-03-29 17:46 ` Jerry Zhang
2013-03-30 18:41   ` Sven Geggus

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).