Revision 1d4e547b hw/nseries.c
b/hw/nseries.c | ||
---|---|---|
45 | 45 |
i2c_bus *i2c; |
46 | 46 |
|
47 | 47 |
int keymap[0x80]; |
48 |
i2c_slave *kbd; |
|
48 | 49 |
|
49 | 50 |
struct tusb_s *usb; |
50 | 51 |
void *retu; |
... | ... | |
92 | 93 |
#define N8X0_TAHVO_GPIO 111 |
93 | 94 |
#define N800_UNKNOWN_GPIO4 112 /* out */ |
94 | 95 |
#define N810_SLEEPX_LED_GPIO 112 |
95 |
#define N810_TSC_UNKNOWN_GPIO 118 /* out */
|
|
96 |
#define N800_TSC_RESET_GPIO 119 /* ? */
|
|
96 |
#define N800_TSC_RESET_GPIO 118 /* ? */
|
|
97 |
#define N800_TSC_UNKNOWN_GPIO 119 /* out */
|
|
97 | 98 |
#define N8X0_TMP105_GPIO 125 |
98 | 99 |
|
99 | 100 |
/* Config */ |
100 | 101 |
#define XLDR_LL_UART 1 |
101 | 102 |
|
102 |
/* Addresses on the I2C bus */ |
|
103 |
#define N8X0_TMP105_ADDR 0x48 |
|
104 |
#define N8X0_MENELAUS_ADDR 0x72 |
|
103 |
/* Addresses on the I2C bus 0 */ |
|
104 |
#define N810_TLV320AIC33_ADDR 0x18 /* Audio CODEC */ |
|
105 |
#define N8X0_TCM825x_ADDR 0x29 /* Camera */ |
|
106 |
#define N810_LP5521_ADDR 0x32 /* LEDs */ |
|
107 |
#define N810_TSL2563_ADDR 0x3d /* Light sensor */ |
|
108 |
#define N810_LM8323_ADDR 0x45 /* Keyboard */ |
|
109 |
/* Addresses on the I2C bus 1 */ |
|
110 |
#define N8X0_TMP105_ADDR 0x48 /* Temperature sensor */ |
|
111 |
#define N8X0_MENELAUS_ADDR 0x72 /* Power management */ |
|
105 | 112 |
|
106 | 113 |
/* Chipselects on GPMC NOR interface */ |
107 | 114 |
#define N8X0_ONENAND_CS 0 |
... | ... | |
190 | 197 |
28, /* Enter */ |
191 | 198 |
77, /* Right */ |
192 | 199 |
-1, |
193 |
1, /* Cycle (ESC) */ |
|
200 |
1, /* Cycle (ESC) */
|
|
194 | 201 |
80, /* Down */ |
195 | 202 |
62, /* Menu (F4) */ |
196 | 203 |
-1, |
197 | 204 |
66, /* Zoom- (F8) */ |
198 |
64, /* FS (F6) */
|
|
205 |
64, /* FullScreen (F6) */
|
|
199 | 206 |
65, /* Zoom+ (F7) */ |
200 | 207 |
-1, |
201 | 208 |
}; |
... | ... | |
235 | 242 |
tsc2005_set_transform(s->ts.opaque, &n810_pointercal); |
236 | 243 |
} |
237 | 244 |
|
245 |
/* N810 Keyboard controller */ |
|
246 |
static void n810_key_event(void *opaque, int keycode) |
|
247 |
{ |
|
248 |
struct n800_s *s = (struct n800_s *) opaque; |
|
249 |
int code = s->keymap[keycode & 0x7f]; |
|
250 |
|
|
251 |
if (code == -1) { |
|
252 |
if ((keycode & 0x7f) == RETU_KEYCODE) |
|
253 |
retu_key_event(s->retu, !(keycode & 0x80)); |
|
254 |
return; |
|
255 |
} |
|
256 |
|
|
257 |
lm832x_key_event(s->kbd, code, !(keycode & 0x80)); |
|
258 |
} |
|
259 |
|
|
260 |
#define M 0 |
|
261 |
|
|
262 |
static int n810_keys[0x80] = { |
|
263 |
[0x01] = 16, /* Q */ |
|
264 |
[0x02] = 37, /* K */ |
|
265 |
[0x03] = 24, /* O */ |
|
266 |
[0x04] = 25, /* P */ |
|
267 |
[0x05] = 14, /* Backspace */ |
|
268 |
[0x06] = 30, /* A */ |
|
269 |
[0x07] = 31, /* S */ |
|
270 |
[0x08] = 32, /* D */ |
|
271 |
[0x09] = 33, /* F */ |
|
272 |
[0x0a] = 34, /* G */ |
|
273 |
[0x0b] = 35, /* H */ |
|
274 |
[0x0c] = 36, /* J */ |
|
275 |
|
|
276 |
[0x11] = 17, /* W */ |
|
277 |
[0x12] = 62, /* Menu (F4) */ |
|
278 |
[0x13] = 38, /* L */ |
|
279 |
[0x14] = 40, /* ' (Apostrophe) */ |
|
280 |
[0x16] = 44, /* Z */ |
|
281 |
[0x17] = 45, /* X */ |
|
282 |
[0x18] = 46, /* C */ |
|
283 |
[0x19] = 47, /* V */ |
|
284 |
[0x1a] = 48, /* B */ |
|
285 |
[0x1b] = 49, /* N */ |
|
286 |
[0x1c] = 42, /* Shift (Left shift) */ |
|
287 |
[0x1f] = 65, /* Zoom+ (F7) */ |
|
288 |
|
|
289 |
[0x21] = 18, /* E */ |
|
290 |
[0x22] = 39, /* ; (Semicolon) */ |
|
291 |
[0x23] = 12, /* - (Minus) */ |
|
292 |
[0x24] = 13, /* = (Equal) */ |
|
293 |
[0x2b] = 56, /* Fn (Left Alt) */ |
|
294 |
[0x2c] = 50, /* M */ |
|
295 |
[0x2f] = 66, /* Zoom- (F8) */ |
|
296 |
|
|
297 |
[0x31] = 19, /* R */ |
|
298 |
[0x32] = 29 | M, /* Right Ctrl */ |
|
299 |
[0x34] = 57, /* Space */ |
|
300 |
[0x35] = 51, /* , (Comma) */ |
|
301 |
[0x37] = 72 | M, /* Up */ |
|
302 |
[0x3c] = 82 | M, /* Compose (Insert) */ |
|
303 |
[0x3f] = 64, /* FullScreen (F6) */ |
|
304 |
|
|
305 |
[0x41] = 20, /* T */ |
|
306 |
[0x44] = 52, /* . (Dot) */ |
|
307 |
[0x46] = 77 | M, /* Right */ |
|
308 |
[0x4f] = 63, /* Home (F5) */ |
|
309 |
[0x51] = 21, /* Y */ |
|
310 |
[0x53] = 80 | M, /* Down */ |
|
311 |
[0x55] = 28, /* Enter */ |
|
312 |
[0x5f] = 1, /* Cycle (ESC) */ |
|
313 |
|
|
314 |
[0x61] = 22, /* U */ |
|
315 |
[0x64] = 75 | M, /* Left */ |
|
316 |
|
|
317 |
[0x71] = 23, /* I */ |
|
318 |
#if 0 |
|
319 |
[0x75] = 28 | M, /* KP Enter (KP Enter) */ |
|
320 |
#else |
|
321 |
[0x75] = 15, /* KP Enter (Tab) */ |
|
322 |
#endif |
|
323 |
}; |
|
324 |
|
|
325 |
#undef M |
|
326 |
|
|
327 |
static void n810_kbd_setup(struct n800_s *s) |
|
328 |
{ |
|
329 |
qemu_irq kbd_irq = omap2_gpio_in_get(s->cpu->gpif, N810_KEYBOARD_GPIO)[0]; |
|
330 |
int i; |
|
331 |
|
|
332 |
for (i = 0; i < 0x80; i ++) |
|
333 |
s->keymap[i] = -1; |
|
334 |
for (i = 0; i < 0x80; i ++) |
|
335 |
if (n810_keys[i] > 0) |
|
336 |
s->keymap[n810_keys[i]] = i; |
|
337 |
|
|
338 |
qemu_add_kbd_event_handler(n810_key_event, s); |
|
339 |
|
|
340 |
/* Attach the LM8322 keyboard to the I2C bus, |
|
341 |
* should happen in n8x0_i2c_setup and s->kbd be initialised here. */ |
|
342 |
s->kbd = lm8323_init(s->i2c, kbd_irq); |
|
343 |
i2c_set_slave_address(s->kbd, N810_LM8323_ADDR); |
|
344 |
} |
|
345 |
|
|
238 | 346 |
/* LCD MIPI DBI-C controller (URAL) */ |
239 | 347 |
struct mipid_s { |
240 | 348 |
int resp[4]; |
... | ... | |
954 | 1062 |
n8x0_i2c_setup(s); |
955 | 1063 |
if (model == 800) |
956 | 1064 |
n800_tsc_kbd_setup(s); |
957 |
else if (model == 810) |
|
1065 |
else if (model == 810) {
|
|
958 | 1066 |
n810_tsc_setup(s); |
1067 |
n810_kbd_setup(s); |
|
1068 |
} |
|
959 | 1069 |
n8x0_spi_setup(s); |
960 | 1070 |
n8x0_dss_setup(s, ds); |
961 | 1071 |
n8x0_cbus_setup(s); |
Also available in: Unified diff