omap24xx: switch to 3.3 and add broken flag
[openwrt.git] / target / linux / omap24xx / patches-3.1 / 320-nokia-various.patch
1 --- a/arch/arm/mach-omap2/board-n8x0.c
2 +++ b/arch/arm/mach-omap2/board-n8x0.c
3 @@ -25,6 +25,8 @@
4  #include <linux/usb/musb.h>
5  #include <sound/tlv320aic3x.h>
6  #include <linux/spi/tsc2005.h>
7 +#include <linux/input.h>
8 +#include <linux/i2c/lm8323.h>
9  
10  #include <asm/mach/arch.h>
11  #include <asm/mach-types.h>
12 @@ -37,6 +39,7 @@
13  #include <plat/onenand.h>
14  #include <plat/mmc.h>
15  #include <plat/serial.h>
16 +#include <plat/gpio-switch.h>
17  
18  #include "mux.h"
19  
20 @@ -104,6 +107,152 @@ extern struct mipid_platform_data n8x0_m
21  extern void n8x0_mipid_init(void);
22  extern void n8x0_blizzard_init(void);
23  
24 +/* We map the FN key as LALT to workaround an X keycode problem.
25 + * The XKB map needs to be adjusted to support this. */
26 +#define MAP_FN_AS_LEFTALT
27 +
28 +static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
29 +       [0x01] = KEY_Q,
30 +       [0x02] = KEY_K,
31 +       [0x03] = KEY_O,
32 +       [0x04] = KEY_P,
33 +       [0x05] = KEY_BACKSPACE,
34 +       [0x06] = KEY_A,
35 +       [0x07] = KEY_S,
36 +       [0x08] = KEY_D,
37 +       [0x09] = KEY_F,
38 +       [0x0a] = KEY_G,
39 +       [0x0b] = KEY_H,
40 +       [0x0c] = KEY_J,
41 +
42 +       [0x11] = KEY_W,
43 +       [0x12] = KEY_F4,
44 +       [0x13] = KEY_L,
45 +       [0x14] = KEY_APOSTROPHE,
46 +       [0x16] = KEY_Z,
47 +       [0x17] = KEY_X,
48 +       [0x18] = KEY_C,
49 +       [0x19] = KEY_V,
50 +       [0x1a] = KEY_B,
51 +       [0x1b] = KEY_N,
52 +       [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
53 +       [0x1f] = KEY_F7,
54 +
55 +       [0x21] = KEY_E,
56 +       [0x22] = KEY_SEMICOLON,
57 +       [0x23] = KEY_MINUS,
58 +       [0x24] = KEY_EQUAL,
59 +#ifdef MAP_FN_AS_LEFTALT
60 +       [0x2b] = KEY_LEFTALT,
61 +#else
62 +       [0x2b] = KEY_FN,
63 +#endif
64 +       [0x2c] = KEY_M,
65 +       [0x2f] = KEY_F8,
66 +
67 +       [0x31] = KEY_R,
68 +       [0x32] = KEY_RIGHTCTRL,
69 +       [0x34] = KEY_SPACE,
70 +       [0x35] = KEY_COMMA,
71 +       [0x37] = KEY_UP,
72 +       [0x3c] = KEY_COMPOSE,
73 +       [0x3f] = KEY_F6,
74 +
75 +       [0x41] = KEY_T,
76 +       [0x44] = KEY_DOT,
77 +       [0x46] = KEY_RIGHT,
78 +       [0x4f] = KEY_F5,
79 +       [0x51] = KEY_Y,
80 +       [0x53] = KEY_DOWN,
81 +       [0x55] = KEY_ENTER,
82 +       [0x5f] = KEY_ESC,
83 +
84 +       [0x61] = KEY_U,
85 +       [0x64] = KEY_LEFT,
86 +
87 +       [0x71] = KEY_I,
88 +       [0x75] = KEY_KPENTER,
89 +};
90 +
91 +static struct lm8323_platform_data lm8323_pdata = {
92 +       .repeat         = 0, /* Repeat is handled in userspace for now. */
93 +       .keymap         = rx44_keymap,
94 +       .size_x         = 8,
95 +       .size_y         = 12,
96 +       .debounce_time  = 12,
97 +       .active_time    = 500,
98 +
99 +       .name           = "Internal keyboard",
100 +       .pwm_names[0]   = "n810::keyboard",
101 +       .pwm_names[1]   = "n810::cover",
102 +};
103 +
104 +#define OMAP_TAG_NOKIA_BT      0x4e01
105 +
106 +struct omap_bluetooth_config {
107 +       u8    chip_type;
108 +       u8    bt_wakeup_gpio;
109 +       u8    host_wakeup_gpio;
110 +       u8    reset_gpio;
111 +       u8    bt_uart;
112 +       u8    bd_addr[6];
113 +       u8    bt_sysclk;
114 +};
115 +
116 +static struct platform_device n8x0_bt_device = {
117 +       .name           = "hci_h4p",
118 +       .id             = -1,
119 +       .num_resources  = 0,
120 +};
121 +
122 +void __init n8x0_bt_init(void)
123 +{
124 +       const struct omap_bluetooth_config *bt_config;
125 +
126 +       bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
127 +                                            struct omap_bluetooth_config);
128 +       n8x0_bt_device.dev.platform_data = (void *) bt_config;
129 +       if (platform_device_register(&n8x0_bt_device) < 0)
130 +               BUG();
131 +}
132 +
133 +static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
134 +       {
135 +               .name                   = "headphone",
136 +               .gpio                   = -1,
137 +               .debounce_rising        = 200,
138 +               .debounce_falling       = 200,
139 +       }, {
140 +               .name                   = "cam_act",
141 +               .gpio                   = -1,
142 +               .debounce_rising        = 200,
143 +               .debounce_falling       = 200,
144 +       }, {
145 +               .name                   = "cam_turn",
146 +               .gpio                   = -1,
147 +               .debounce_rising        = 100,
148 +               .debounce_falling       = 100,
149 +       }, {
150 +               .name                   = "slide",
151 +               .gpio                   = -1,
152 +               .debounce_rising        = 200,
153 +               .debounce_falling       = 200,
154 +       }, {
155 +               .name                   = "kb_lock",
156 +               .gpio                   = -1,
157 +               .debounce_rising        = 200,
158 +               .debounce_falling       = 200,
159 +       },
160 +};
161 +
162 +static void __init n8x0_gpio_switches_init(void)
163 +{
164 +       /* The switches are actually registered through ATAG mechanism.
165 +        * This just updates the parameters (thus .gpio is -1) */
166 +       omap_register_gpio_switches(n8x0_gpio_switches,
167 +                                   ARRAY_SIZE(n8x0_gpio_switches));
168 +}
169 +
170  #define TUSB6010_ASYNC_CS      1
171  #define TUSB6010_SYNC_CS       4
172  #define TUSB6010_GPIO_INT      58
173 @@ -795,6 +944,11 @@ static struct aic3x_pdata n810_aic33_dat
174  };
175  
176  static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
177 +       {
178 +               I2C_BOARD_INFO("lm8323", 0x45),
179 +               .irq            = OMAP_GPIO_IRQ(109),
180 +               .platform_data  = &lm8323_pdata,
181 +       },
182         {
183                 I2C_BOARD_INFO("tlv320aic3x", 0x18),
184                 .platform_data = &n810_aic33_data,
185 @@ -864,7 +1018,9 @@ static inline void board_serial_init(voi
186  static void __init n8x0_init_machine(void)
187  {
188         omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
189 +       n8x0_gpio_switches_init();
190         n8x0_cbus_init();
191 +       n8x0_bt_init();
192  
193         /* FIXME: add n810 spi devices */
194         tsc2005_set_config();