I'm trying to implement four push-buttons via the GPIO functionality
on pins 3, 5, 7, and 9 of the expansion header (GPIO139, GPIO138,
GPIO137, and GPIO136 respectively). After compiling the kernel and
booting into the console-image of Angstrom, I have no /dev/input/
folder and nothing is in the /sys/class/input/ folder. I can,
however, cd into /sys/class/gpio/ and perform the following:
# echo 139 > export
# cd gpio139
# echo in > direction
# cat value
At this point I get correct values of 0 when the button is not
depressed, and 1 when the button is depressed. So it seems that the
pins are correctly assigned and invoked.
I'm assuming this is a kernel configuration problem. I did have to
edit the .config file as by default the event interface and sysfs
interface are not selected. Therefore, I changed the following two
lines in linux-omap-2.6/.config:
CONFIG_GPIO_SYSFS=y
CONFIG_INPUT_EVDEV=y
For the sake of completeness, the following are diffs of the kernel
files I've changed to implement these push-buttons.
linux-omap-2.6/arch/arm/plat-omap/include/mach/mux.h:
--- mux.h.orig 2009-03-20 00:34:24.000000000 -0500
+++ mux.h 2009-04-01 18:50:24.000000000 -0500
@@ -796,7 +796,10 @@
L8_34XX_GPIO63,
G25_34XX_GPIO86_OUT,
AG4_34XX_GPIO134_OUT,
- AE4_34XX_GPIO136_OUT,
+ AE4_34XX_GPIO136,
+ AH3_34XX_GPIO137,
+ AF3_34XX_GPIO138,
+ AE3_34XX_GPIO139,
AF6_34XX_GPIO140_UP,
AE6_34XX_GPIO141,
AF5_34XX_GPIO142,
linux-omap-2.6/arch/arm/mach-omap2/mux.c:
--- mux.c.orig 2009-03-20 00:34:23.000000000 -0500
+++ mux.c 2009-03-22 17:50:58.000000000 -0500
@@ -472,8 +472,14 @@
OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
MUX_CFG_34XX("AG4_34XX_GPIO134_OUT", 0x160,
OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
-MUX_CFG_34XX("AE4_34XX_GPIO136_OUT", 0x164,
- OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("AE4_34XX_GPIO136", 0x164,
+ OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("AH3_34XX_GPIO137", 0x166,
+ OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("AF3_34XX_GPIO138", 0x168,
+ OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("AE3_34XX_GPIO139", 0x16a,
+ OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
MUX_CFG_34XX("AF6_34XX_GPIO140_UP", 0x16c,
OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
MUX_CFG_34XX("AE6_34XX_GPIO141", 0x16e,
linux-omap-2.6/arch/arm/mach-omap2/board-omap3beagle.c:
--- board-omap3beagle.c.orig 2009-03-20 00:34:23.000000000 -0500
+++ board-omap3beagle.c 2009-03-29 23:47:59.000000000 -0500
@@ -304,6 +304,30 @@
.desc = "user",
.wakeup = 1,
},
+ {
+ .code = BTN_0,
+ .gpio = AE4_34XX_GPIO136,
+ .desc = "btn_0",
+ .wakeup = 1,
+ },
+ {
+ .code = BTN_1,
+ .gpio = AH3_34XX_GPIO137,
+ .desc = "btn_1",
+ .wakeup = 1,
+ },
+ {
+ .code = BTN_2,
+ .gpio = AF3_34XX_GPIO138,
+ .desc = "btn_2",
+ .wakeup = 1,
+ },
+ {
+ .code = BTN_3,
+ .gpio = AE3_34XX_GPIO139,
+ .desc = "btn_3",
+ .wakeup = 1,
+ },
};
static struct gpio_keys_platform_data gpio_key_info = {
Any help would be greatly appreciated.
-caleb