2013/3/29 Sven Geggus <lists@xxxxxxxxxxxxxxxxxxxxx>
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.
The entry will only be created after the "Driver" probes the "Device" successfully. In your case, you need to be sure the corresponding platform_device is claimed in your board setup code. The setup logic vary from Arch/mach to Arch/mach. Here is one example from sh.
199static struct gpio_keys_platform_data baseboard_buttons_data = { 200 .buttons = baseboard_buttons, 201 .nbuttons = ARRAY_SIZE(baseboard_buttons), 202}; 203 204static struct platform_device baseboard_buttons_device = { 205 .name = "gpio-keys", 206 .id = -1, 207 .dev = { 208 .platform_data = &baseboard_buttons_data, 209 }, 210};
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@ircnet, http://sven.gegg.us/ on the Web
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies