Hi,
Either there is something wrong with both the Angstrom 3.0.17 kernel
and the Yocto 3.0.12 kernel or I'm not doing something right (probably
the latter).
I'll try to provide enough info so hopefully someone will spot where
the problem is.
I have several buttons hanging off the expansion connector. My fist
step was to setup the pinmux for the beagleboard user button and all
of my buttons. I also use a spidev device so I have McSPI 3
configured as well.
Here is my pinmux setting in board-omap3beagle.c:
#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {
// See TRM section 7.4.4 Pad Functional Multiplexing and Configuration
OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP), //
GPIO7 User Button
OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 3 GPIO 139
OMAP3_MUX(UART2_CTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 4 GPIO 144
OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 5 GPIO 138
OMAP3_MUX(UART2_TX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 6 GPIO 146
OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 7 GPIO 137
OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 8 GPIO 143
OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 9 GPIO 136
OMAP3_MUX(UART2_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 10 GPIO 145
OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE1 | OMAP_PULL_UP |
OMAP_PULL_ENA), // Pin 11 McSPI3_CS0
OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 12 GPIO 158
OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 13 GPIO 134
OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 14 GPIO 162
OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 15 GPIO 133
OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 16 GPIO 161
OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 17 GPIO 132
OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 18 GPIO 159
OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE1),
// Pin 19 McSPI3_SIMO
OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 20 GPIO 156
OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLDOWN),
// Pin 21 McSPI3_CLK
OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 22 GPIO 157
OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
// Pin 23 GPIO 183
{ .reg_offset = OMAP_MUX_TERMINATOR },
};
#endif
Here is my gpio buttons setup:
static struct gpio_keys_button gpio_buttons[] = {
{
.code = BTN_EXTRA,
.gpio = 7,
.active_low = 1,
.desc = "user",
.type = EV_KEY,
.wakeup = 1,
},
{
.code = BTN_TRIGGER_HAPPY10,
.gpio = 158,
.active_low = 1,
.desc = "10yd",
.wakeup = 1,
.type = EV_KEY,
.debounce_interval = 20
},
{
.code = BTN_TRIGGER_HAPPY15,
.gpio = 134,
.desc = "15yd",
.wakeup = 1,
},
{
.code = BTN_TRIGGER_HAPPY20,
.gpio = 162,
.desc = "20yd",
.wakeup = 1,
},
{
.code = BTN_TRIGGER_HAPPY25,
.gpio = 133,
.desc = "25yd",
.wakeup = 1,
},
{
.code = BTN_SELECT,
.gpio = 161,
.desc = "select",
.wakeup = 1,
},
{
.code = KEY_UP,
.gpio = 132,
.desc = "up",
.wakeup = 1,
},
{
.code = KEY_DOWN,
.gpio = 159,
.desc = "down",
.wakeup = 1,
},
{
.code = BTN_MODE,
.gpio = 156,
.desc = "mode",
.wakeup = 1,
},
{
.code = KEY_SAVE,
.gpio = 157,
.desc = "save",
.wakeup = 1,
},
{
.code = KEY_DIRECTION,
.gpio = 183,
.desc = "direction",
.wakeup = 1,
}
};
I'm not sure if I should have EV_KEY defined for all the buttons or
not and if I need wakeup or anything else setup (like active_low). I
figured I would focus first on getting the beagle user button working
first and then focus on getting the setup for the rest of my buttons
correct.
In my .config I've verified that all the kernel options that I "think"
I need to get this to work are all turned on. And I verified the
kernel running on the hardware is in fact configured the way I think
it is:
root@beagleboard:/dev# zcat /proc/config.gz | grep -i keyboard_gpio
# CONFIG_KEYBOARD_GPIO_POLLED is not set
CONFIG_KEYBOARD_GPIO=y
root@beagleboard:/dev# zcat /proc/config.gz | grep -i input_evdev
CONFIG_INPUT_EVDEV=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
CONFIG_USB_PWC_INPUT_EVDEV=y
Not sure what else is required. I can attach my entire .config if needed.
On the Angstrom 3.0.17 kernel, if I run evtest /dev/input/event0 I see:
root@beagleboard:/dev# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "twl4030_pwrbutton"
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 116 (Power)
Testing ... (interrupt to exit)
.... this output does not reflect the config of my buttons in
board-omap3beagle.c
Now if I run the same test using the Yocto 3.0.12 kernel I see:
root@beagleboard:~# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 103 (Up)
Event code 108 (Down)
Event code 153 (Direction)
Event code 234 (?)
Event code 276 (ExtraBtn)
Event code 314 (BtnSelect)
Event code 316 (BtnMode)
Testing ... (interrupt to exit)
... this at least reflects my button config which looks promising.
But ... in both cases I can press buttons and I see no events
displayed so I think I'm on the right track but am missing something.
Regards,
Brian