omap24xx: Refresh 3.1 patches
[openwrt.git] / target / linux / omap24xx / patches-3.1 / 320-nokia-various.patch
1 Index: linux-3.1/arch/arm/mach-omap2/board-n8x0.c
2 ===================================================================
3 --- linux-3.1.orig/arch/arm/mach-omap2/board-n8x0.c     2011-10-30 00:48:48.205044041 +0200
4 +++ linux-3.1/arch/arm/mach-omap2/board-n8x0.c  2011-10-30 00:48:49.837042881 +0200
5 @@ -24,6 +24,8 @@
6  #include <linux/usb/musb.h>
7  #include <sound/tlv320aic3x.h>
8  #include <linux/spi/tsc2005.h>
9 +#include <linux/input.h>
10 +#include <linux/i2c/lm8323.h>
11  
12  #include <asm/mach/arch.h>
13  #include <asm/mach-types.h>
14 @@ -37,6 +39,7 @@
15  #include <plat/mmc.h>
16  #include <plat/serial.h>
17  #include <plat/cbus.h>
18 +#include <plat/gpio-switch.h>
19  
20  #include "mux.h"
21  
22 @@ -104,6 +107,152 @@ extern struct mipid_platform_data n8x0_m
23  extern void n8x0_mipid_init(void);
24  extern void n8x0_blizzard_init(void);
25  
26 +/* We map the FN key as LALT to workaround an X keycode problem.
27 + * The XKB map needs to be adjusted to support this. */
28 +#define MAP_FN_AS_LEFTALT
29 +
30 +static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
31 +       [0x01] = KEY_Q,
32 +       [0x02] = KEY_K,
33 +       [0x03] = KEY_O,
34 +       [0x04] = KEY_P,
35 +       [0x05] = KEY_BACKSPACE,
36 +       [0x06] = KEY_A,
37 +       [0x07] = KEY_S,
38 +       [0x08] = KEY_D,
39 +       [0x09] = KEY_F,
40 +       [0x0a] = KEY_G,
41 +       [0x0b] = KEY_H,
42 +       [0x0c] = KEY_J,
43 +
44 +       [0x11] = KEY_W,
45 +       [0x12] = KEY_F4,
46 +       [0x13] = KEY_L,
47 +       [0x14] = KEY_APOSTROPHE,
48 +       [0x16] = KEY_Z,
49 +       [0x17] = KEY_X,
50 +       [0x18] = KEY_C,
51 +       [0x19] = KEY_V,
52 +       [0x1a] = KEY_B,
53 +       [0x1b] = KEY_N,
54 +       [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
55 +       [0x1f] = KEY_F7,
56 +
57 +       [0x21] = KEY_E,
58 +       [0x22] = KEY_SEMICOLON,
59 +       [0x23] = KEY_MINUS,
60 +       [0x24] = KEY_EQUAL,
61 +#ifdef MAP_FN_AS_LEFTALT
62 +       [0x2b] = KEY_LEFTALT,
63 +#else
64 +       [0x2b] = KEY_FN,
65 +#endif
66 +       [0x2c] = KEY_M,
67 +       [0x2f] = KEY_F8,
68 +
69 +       [0x31] = KEY_R,
70 +       [0x32] = KEY_RIGHTCTRL,
71 +       [0x34] = KEY_SPACE,
72 +       [0x35] = KEY_COMMA,
73 +       [0x37] = KEY_UP,
74 +       [0x3c] = KEY_COMPOSE,
75 +       [0x3f] = KEY_F6,
76 +
77 +       [0x41] = KEY_T,
78 +       [0x44] = KEY_DOT,
79 +       [0x46] = KEY_RIGHT,
80 +       [0x4f] = KEY_F5,
81 +       [0x51] = KEY_Y,
82 +       [0x53] = KEY_DOWN,
83 +       [0x55] = KEY_ENTER,
84 +       [0x5f] = KEY_ESC,
85 +
86 +       [0x61] = KEY_U,
87 +       [0x64] = KEY_LEFT,
88 +
89 +       [0x71] = KEY_I,
90 +       [0x75] = KEY_KPENTER,
91 +};
92 +
93 +static struct lm8323_platform_data lm8323_pdata = {
94 +       .repeat         = 0, /* Repeat is handled in userspace for now. */
95 +       .keymap         = rx44_keymap,
96 +       .size_x         = 8,
97 +       .size_y         = 12,
98 +       .debounce_time  = 12,
99 +       .active_time    = 500,
100 +
101 +       .name           = "Internal keyboard",
102 +       .pwm_names[0]   = "n810::keyboard",
103 +       .pwm_names[1]   = "n810::cover",
104 +};
105 +
106 +#define OMAP_TAG_NOKIA_BT      0x4e01
107 +
108 +struct omap_bluetooth_config {
109 +       u8    chip_type;
110 +       u8    bt_wakeup_gpio;
111 +       u8    host_wakeup_gpio;
112 +       u8    reset_gpio;
113 +       u8    bt_uart;
114 +       u8    bd_addr[6];
115 +       u8    bt_sysclk;
116 +};
117 +
118 +static struct platform_device n8x0_bt_device = {
119 +       .name           = "hci_h4p",
120 +       .id             = -1,
121 +       .num_resources  = 0,
122 +};
123 +
124 +void __init n8x0_bt_init(void)
125 +{
126 +       const struct omap_bluetooth_config *bt_config;
127 +
128 +       bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
129 +                                            struct omap_bluetooth_config);
130 +       n8x0_bt_device.dev.platform_data = (void *) bt_config;
131 +       if (platform_device_register(&n8x0_bt_device) < 0)
132 +               BUG();
133 +}
134 +
135 +static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
136 +       {
137 +               .name                   = "headphone",
138 +               .gpio                   = -1,
139 +               .debounce_rising        = 200,
140 +               .debounce_falling       = 200,
141 +       }, {
142 +               .name                   = "cam_act",
143 +               .gpio                   = -1,
144 +               .debounce_rising        = 200,
145 +               .debounce_falling       = 200,
146 +       }, {
147 +               .name                   = "cam_turn",
148 +               .gpio                   = -1,
149 +               .debounce_rising        = 100,
150 +               .debounce_falling       = 100,
151 +       }, {
152 +               .name                   = "slide",
153 +               .gpio                   = -1,
154 +               .debounce_rising        = 200,
155 +               .debounce_falling       = 200,
156 +       }, {
157 +               .name                   = "kb_lock",
158 +               .gpio                   = -1,
159 +               .debounce_rising        = 200,
160 +               .debounce_falling       = 200,
161 +       },
162 +};
163 +
164 +static void __init n8x0_gpio_switches_init(void)
165 +{
166 +       /* The switches are actually registered through ATAG mechanism.
167 +        * This just updates the parameters (thus .gpio is -1) */
168 +       omap_register_gpio_switches(n8x0_gpio_switches,
169 +                                   ARRAY_SIZE(n8x0_gpio_switches));
170 +}
171 +
172  #define TUSB6010_ASYNC_CS      1
173  #define TUSB6010_SYNC_CS       4
174  #define TUSB6010_GPIO_INT      58
175 @@ -799,6 +948,11 @@ static struct aic3x_pdata n810_aic33_dat
176  };
177  
178  static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
179 +       {
180 +               I2C_BOARD_INFO("lm8323", 0x45),
181 +               .irq            = OMAP_GPIO_IRQ(109),
182 +               .platform_data  = &lm8323_pdata,
183 +       },
184         {
185                 I2C_BOARD_INFO("tlv320aic3x", 0x18),
186                 .platform_data = &n810_aic33_data,
187 @@ -868,7 +1022,9 @@ static inline void board_serial_init(voi
188  static void __init n8x0_init_machine(void)
189  {
190         omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
191 +       n8x0_gpio_switches_init();
192         n8x0_cbus_init();
193 +       n8x0_bt_init();
194  
195         /* FIXME: add n810 spi devices */
196         tsc2005_set_config();
197 Index: linux-3.1/arch/arm/plat-omap/include/plat/cbus.h
198 ===================================================================
199 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
200 +++ linux-3.1/arch/arm/plat-omap/include/plat/cbus.h    2011-10-30 00:48:49.837042881 +0200
201 @@ -0,0 +1,40 @@
202 +/*
203 + * cbus.h - CBUS platform_data definition
204 + *
205 + * Copyright (C) 2004 - 2009 Nokia Corporation
206 + *
207 + * Written by Felipe Balbi <felipe.balbi@nokia.com>
208 + *
209 + * This file is subject to the terms and conditions of the GNU General
210 + * Public License. See the file "COPYING" in the main directory of this
211 + * archive for more details.
212 + *
213 + * This program is distributed in the hope that it will be useful,
214 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
215 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
216 + * GNU General Public License for more details.
217 + *
218 + * You should have received a copy of the GNU General Public License
219 + * along with this program; if not, write to the Free Software
220 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
221 + */
222 +
223 +#ifndef __PLAT_CBUS_H
224 +#define __PLAT_CBUS_H
225 +
226 +#define CBUS_RETU_DEVICE_ID    0x01
227 +#define CBUS_TAHVO_DEVICE_ID   0x02
228 +
229 +struct cbus_host_platform_data {
230 +       int     dat_gpio;
231 +       int     clk_gpio;
232 +       int     sel_gpio;
233 +};
234 +
235 +struct cbus_retu_platform_data {
236 +       int     irq_base;
237 +       int     irq_end;
238 +       int     devid;
239 +};
240 +
241 +#endif /* __PLAT_CBUS_H */