]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0024-beaglebone-add-gpio-keys-for-lcd.patch
am33x-cm3: add firmware for am33x suspend/resume
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / beaglebone / 0024-beaglebone-add-gpio-keys-for-lcd.patch
1 From d76d09ea8918a1aa315b44d4e12b71a522545da8 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Mon, 19 Mar 2012 15:15:06 +0100
4 Subject: [PATCH 24/26] beaglebone: add gpio-keys for lcd
6 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
7 ---
8  arch/arm/mach-omap2/board-am335xevm.c |   82 +++++++++++++++++++++++++++++++--
9  1 file changed, 78 insertions(+), 4 deletions(-)
11 diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
12 index e77bcd6..ed2ea68 100644
13 --- a/arch/arm/mach-omap2/board-am335xevm.c
14 +++ b/arch/arm/mach-omap2/board-am335xevm.c
15 @@ -1068,6 +1068,82 @@ static void beaglebone_lcd7_keys_init(int evm_id, int profile)
16                 pr_err("failed to register gpio keys for LCD7 cape\n");
17  }
18  
19 +/* pinmux for lcd3 keys */
20 +static struct pinmux_config lcd3_keys_pin_mux[] = {
21 +       {"gpmc_a0.gpio1_16",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
22 +       {"gpmc_a1.gpio1_17",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
23 +       {"mcasp0_fsr.gpio3_19",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
24 +       {"gpmc_ben1.gpio1_28",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
25 +       {"ecap0_in_pwm0_out.gpio0_7",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
26 +       {NULL, 0},
27 +};
28 +
29 +/* Configure GPIOs for lcd3 keys */
30 +static struct gpio_keys_button beaglebone_lcd3_gpio_keys[] = {
31 +       {
32 +               .code                   = KEY_LEFT,
33 +               .gpio                   = GPIO_TO_PIN(1, 16),
34 +               .active_low             = false,
35 +               .desc                   = "left",
36 +               .type                   = EV_KEY,
37 +               .wakeup                 = 1,
38 +       },
39 +       {
40 +               .code                   = KEY_RIGHT,
41 +               .gpio                   = GPIO_TO_PIN(1, 17),
42 +               .active_low             = false,
43 +               .desc                   = "right",
44 +               .type                   = EV_KEY,
45 +               .wakeup                 = 1,
46 +       },
47 +       {
48 +               .code                   = KEY_UP,
49 +               .gpio                   = GPIO_TO_PIN(3, 19),
50 +               .active_low             = false,
51 +               .desc                   = "up",
52 +               .type                   = EV_KEY,
53 +               .wakeup                 = 1,
54 +       },
55 +       {
56 +               .code                   = KEY_DOWN,
57 +               .gpio                   = GPIO_TO_PIN(1, 28),
58 +               .active_low             = false,
59 +               .desc                   = "down",
60 +               .type                   = EV_KEY,
61 +               .wakeup                 = 1,
62 +       },
63 +       {
64 +               .code                   = KEY_ENTER,
65 +               .gpio                   = GPIO_TO_PIN(0, 7),
66 +               .active_low             = false,
67 +               .desc                   = "down",
68 +               .type                   = EV_KEY,
69 +               .wakeup                 = 1,
70 +       },
71 +};
72 +
73 +static struct gpio_keys_platform_data beaglebone_lcd3_gpio_key_info = {
74 +       .buttons        = beaglebone_lcd3_gpio_keys,
75 +       .nbuttons       = ARRAY_SIZE(beaglebone_lcd3_gpio_keys),
76 +};
77 +
78 +static struct platform_device beaglebone_lcd3_keys = {
79 +       .name   = "gpio-keys",
80 +       .id     = -1,
81 +       .dev    = {
82 +               .platform_data  = &beaglebone_lcd3_gpio_key_info,
83 +       },
84 +};
85 +
86 +static void beaglebone_lcd3_keys_init(int evm_id, int profile)
87 +{
88 +       int err;
89 +       setup_pin_mux(lcd3_keys_pin_mux);
90 +       err = platform_device_register(&beaglebone_lcd3_keys);
91 +       if (err)
92 +               pr_err("failed to register gpio keys for LCD3 cape\n");
93 +}
94 +
95  /*
96  * @evm_id - evm id which needs to be configured
97  * @dev_cfg - single evm structure which includes
98 @@ -2029,10 +2105,8 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
99                 pr_info("BeagleBone cape: initializing LCD cape touchscreen\n");
100                 tsc_init(0,0);
101                 beaglebone_tsadcpins_free = 0;
102 -               // gpio1_16 -> button
103 -               // gpio1_17 -> button
104 -               // gpio3_19 -> button
105 -               // gpio1_28 -> button
106 +               pr_info("BeagleBone cape: Registering gpio-keys for LCD cape\n");
107 +               beaglebone_lcd3_keys_init(0,0);
108         }
109         
110         if (!strncmp("BB-BONE-VGA-01", cape_config.partnumber, 15)) {
111 -- 
112 1.7.9.5