Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] MTX-1: Add GPIO system button

This patch adds support for the GPIO connected system button on the MTX-1
boards. Default configuration is updated accordingly.

Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Florian Fainelli and committed by
Ralf Baechle
f6ed10ab 2d47c58e

+27 -1
+26 -1
arch/mips/au1000/mtx-1/platform.c
··· 22 22 #include <linux/types.h> 23 23 #include <linux/platform_device.h> 24 24 #include <linux/leds.h> 25 + #include <linux/gpio_keys.h> 26 + #include <linux/input.h> 25 27 26 28 #include <asm/gpio.h> 29 + 30 + static struct gpio_keys_button mtx1_gpio_button[] = { 31 + { 32 + .gpio = 207, 33 + .code = BTN_0, 34 + .desc = "System button", 35 + } 36 + }; 37 + 38 + static struct gpio_keys_platform_data mtx1_buttons_data = { 39 + .buttons = mtx1_gpio_button, 40 + .nbuttons = ARRAY_SIZE(mtx1_gpio_button), 41 + }; 42 + 43 + static struct platform_device mtx1_button = { 44 + .name = "gpio-keys", 45 + .id = -1, 46 + .dev = { 47 + .platform_data = &mtx1_buttons_data, 48 + } 49 + }; 27 50 28 51 static struct resource mtx1_wdt_res[] = { 29 52 [0] = { ··· 89 66 90 67 static struct __initdata platform_device * mtx1_devs[] = { 91 68 &mtx1_gpio_leds, 92 - &mtx1_wdt 69 + &mtx1_wdt, 70 + &mtx1_button 93 71 }; 94 72 95 73 static int __init mtx1_register_devices(void) 96 74 { 75 + gpio_direction_input(207); 97 76 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); 98 77 } 99 78
+1
arch/mips/configs/mtx1_defconfig
··· 1616 1616 # 1617 1617 CONFIG_INPUT_KEYBOARD=y 1618 1618 CONFIG_KEYBOARD_ATKBD=y 1619 + CONFIG_KEYBOARD_GPIO=y 1619 1620 CONFIG_KEYBOARD_SUNKBD=m 1620 1621 CONFIG_KEYBOARD_LKKBD=m 1621 1622 CONFIG_KEYBOARD_XTKBD=m