linux-ti33x-psp 3.2: LCD7 A3 support, eMMC cape support, camera cape improvements
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / beaglebone / 0081-beaglebone-add-support-for-LCD7-A3.patch
1 From 44bfbc3cbd6ddc95db9a886744582ffddb79fe47 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Tue, 24 Jul 2012 13:23:28 +0200
4 Subject: [PATCH 81/84] beaglebone: add support for LCD7 A3
6 ---
7  arch/arm/mach-omap2/board-am335xevm.c |   93 ++++++++++++++++++++++++++++++++-
8  1 files changed, 92 insertions(+), 1 deletions(-)
10 diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
11 index 82020fc..0c305b6 100644
12 --- a/arch/arm/mach-omap2/board-am335xevm.c
13 +++ b/arch/arm/mach-omap2/board-am335xevm.c
14 @@ -660,6 +660,12 @@ static struct pinmux_config bbtoys7a2_pin_mux[] = {
15         {NULL, 0},
16  };
17  
18 +/* Module pin mux for Beagleboardtoys 7" LCD cape */
19 +static struct pinmux_config bbtoys7a3_pin_mux[] = {
20 +       {"spi0_sclk.gpio0_2", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // AVDD_EN
21 +       {"gpmc_a2.ehrpwm1A", OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT}, // Backlight
22 +       {NULL, 0},
23 +};
24  
25  static struct pinmux_config w1_gpio_pin_mux[] = {
26         {"gpmc_ad3.gpio1_3",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
27 @@ -1164,6 +1170,82 @@ static void beaglebone_lcd7_keys_init(int evm_id, int profile)
28                 pr_err("failed to register gpio keys for LCD7 cape\n");
29  }
30  
31 +/* pinmux for lcd7 keys */
32 +static struct pinmux_config lcd7a3_keys_pin_mux[] = {
33 +       {"gpmc_a0.gpio1_16",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //left
34 +       {"gpmc_a1.gpio1_17",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //right
35 +       {"gpmc_a3.gpio1_19",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //up
36 +       {"mcasp0_axr0.gpio3_16",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //down
37 +       {"sdpi0_d0.gpio0_3",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //enter
38 +       {NULL, 0},
39 +};
40 +
41 +/* Configure GPIOs for lcd7 keys */
42 +static struct gpio_keys_button beaglebone_lcd7a3_gpio_keys[] = {
43 +       {
44 +               .code                   = KEY_LEFT,
45 +               .gpio                   = GPIO_TO_PIN(1, 16),
46 +               .active_low             = true,
47 +               .desc                   = "left",
48 +               .type                   = EV_KEY,
49 +               .wakeup                 = 1,
50 +       },
51 +       {
52 +               .code                   = KEY_RIGHT,
53 +               .gpio                   = GPIO_TO_PIN(1, 17),
54 +               .active_low             = true,
55 +               .desc                   = "right",
56 +               .type                   = EV_KEY,
57 +               .wakeup                 = 1,
58 +       },
59 +       {
60 +               .code                   = KEY_UP,
61 +               .gpio                   = GPIO_TO_PIN(1, 19),
62 +               .active_low             = true,
63 +               .desc                   = "up",
64 +               .type                   = EV_KEY,
65 +               .wakeup                 = 1,
66 +       },
67 +       {
68 +               .code                   = KEY_DOWN,
69 +               .gpio                   = GPIO_TO_PIN(3, 16),
70 +               .active_low             = true,
71 +               .desc                   = "down",
72 +               .type                   = EV_KEY,
73 +               .wakeup                 = 1,
74 +       },
75 +       {
76 +               .code                   = KEY_ENTER,
77 +               .gpio                   = GPIO_TO_PIN(0, 3),
78 +               .active_low             = true,
79 +               .desc                   = "enter",
80 +               .type                   = EV_KEY,
81 +               .wakeup                 = 1,
82 +       },
83 +};
84 +
85 +static struct gpio_keys_platform_data beaglebone_lcd7a3_gpio_key_info = {
86 +       .buttons        = beaglebone_lcd7a3_gpio_keys,
87 +       .nbuttons       = ARRAY_SIZE(beaglebone_lcd7a3_gpio_keys),
88 +};
89 +
90 +static struct platform_device beaglebone_lcd7a3_keys = {
91 +       .name   = "gpio-keys",
92 +       .id     = -1,
93 +       .dev    = {
94 +               .platform_data  = &beaglebone_lcd7a3_gpio_key_info,
95 +       },
96 +};
97 +
98 +static void beaglebone_lcd7a3_keys_init(int evm_id, int profile)
99 +{
100 +       int err;
101 +       setup_pin_mux(lcd7a3_keys_pin_mux);
102 +       err = platform_device_register(&beaglebone_lcd7a3_keys);
103 +       if (err)
104 +               pr_err("failed to register gpio keys for LCD7 cape\n");
105 +}
107  /* pinmux for lcd3 keys */
108  static struct pinmux_config lcd3_keys_pin_mux[] = {
109         {"gpmc_a0.gpio1_16",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
110 @@ -1719,6 +1801,7 @@ static void lcdc_init(int evm_id, int profile)
111  
112  #define BEAGLEBONE_LCD_AVDD_EN GPIO_TO_PIN(0, 7)
113  #define BEAGLEBONE_LCD7A2_AVDD_EN GPIO_TO_PIN(1, 31)
114 +#define BEAGLEBONE_LCD7A3_AVDD_EN GPIO_TO_PIN(0, 2)
115  
116  static void bbtoys7lcd_init(int evm_id, int profile)
117  {
118 @@ -2934,6 +3017,10 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
119                         setup_pin_mux(bbtoys7a2_pin_mux);
120                         gpio_request(BEAGLEBONE_LCD7A2_AVDD_EN, "BONE_LCD_AVDD_EN");
121                         gpio_direction_output(BEAGLEBONE_LCD7A2_AVDD_EN, 1);
122 +               } else if(!strncmp("00A3", cape_config.version, 4)) {
123 +                       setup_pin_mux(bbtoys7a3_pin_mux);
124 +                       gpio_request(BEAGLEBONE_LCD7A3_AVDD_EN, "BONE_LCD_AVDD_EN");
125 +                       gpio_direction_output(BEAGLEBONE_LCD7A3_AVDD_EN, 1);                    
126                 } else {
127                         setup_pin_mux(bbtoys7_pin_mux);
128                         gpio_request(BEAGLEBONE_LCD_AVDD_EN, "BONE_LCD_AVDD_EN");
129 @@ -2948,7 +3035,11 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
130                 enable_ehrpwm1(0,0);
131                 beaglebone_tsadcpins_free = 0;
132                 pr_info("BeagleBone cape: Registering gpio-keys for LCD cape\n");
133 -               beaglebone_lcd7_keys_init(0,0);
134 +               if (!strncmp("00A3", cape_config.version, 4)) {
135 +                       beaglebone_lcd7a3_keys_init(0,0);
136 +               } else {
137 +                       beaglebone_lcd7_keys_init(0,0);
138 +               }
139                 
140                 beaglebone_spi1_free = 0;
141                 // A1 or newer
142 -- 
143 1.7.7.6