Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / arm / mach-ux500 / board-mop500-u8500uib.c
1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * Board data for the U8500 UIB, also known as the New UIB
5  * License terms: GNU General Public License (GPL), version 2
6  */
7
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/i2c.h>
11 #include <linux/gpio.h>
12 #include <linux/interrupt.h>
13 #include <linux/mfd/tc3589x.h>
14 #include <linux/input/matrix_keypad.h>
15 #include <../drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h>
16
17 #include <mach/gpio.h>
18 #include <mach/irqs.h>
19
20 #include "board-mop500.h"
21
22 /*
23  * Synaptics RMI4 touchscreen interface on the U8500 UIB
24  */
25
26 /*
27  * Descriptor structure.
28  * Describes the number of i2c devices on the bus that speak RMI.
29  */
30 static struct synaptics_rmi4_platform_data rmi4_i2c_dev_platformdata = {
31         .irq_number     = NOMADIK_GPIO_TO_IRQ(84),
32         .irq_type       = (IRQF_TRIGGER_FALLING | IRQF_SHARED),
33         .x_flip         = false,
34         .y_flip         = true,
35         .regulator_en   = false,
36 };
37
38 static struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = {
39         {
40                 I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B),
41                 .platform_data = &rmi4_i2c_dev_platformdata,
42         },
43 };
44
45 /*
46  * TC35893
47  */
48 static const unsigned int u8500_keymap[] = {
49         KEY(3, 1, KEY_END),
50         KEY(4, 1, KEY_POWER),
51         KEY(6, 4, KEY_VOLUMEDOWN),
52         KEY(4, 2, KEY_EMAIL),
53         KEY(3, 3, KEY_RIGHT),
54         KEY(2, 5, KEY_BACKSPACE),
55
56         KEY(6, 7, KEY_MENU),
57         KEY(5, 0, KEY_ENTER),
58         KEY(4, 3, KEY_0),
59         KEY(3, 4, KEY_DOT),
60         KEY(5, 2, KEY_UP),
61         KEY(3, 5, KEY_DOWN),
62
63         KEY(4, 5, KEY_SEND),
64         KEY(0, 5, KEY_BACK),
65         KEY(6, 2, KEY_VOLUMEUP),
66         KEY(1, 3, KEY_SPACE),
67         KEY(7, 6, KEY_LEFT),
68         KEY(5, 5, KEY_SEARCH),
69 };
70
71 static struct matrix_keymap_data u8500_keymap_data = {
72         .keymap         = u8500_keymap,
73         .keymap_size    = ARRAY_SIZE(u8500_keymap),
74 };
75
76 static struct tc3589x_keypad_platform_data tc35893_data = {
77         .krow = TC_KPD_ROWS,
78         .kcol = TC_KPD_COLUMNS,
79         .debounce_period = TC_KPD_DEBOUNCE_PERIOD,
80         .settle_time = TC_KPD_SETTLE_TIME,
81         .irqtype = IRQF_TRIGGER_FALLING,
82         .enable_wakeup = true,
83         .keymap_data    = &u8500_keymap_data,
84         .no_autorepeat  = true,
85 };
86
87 static struct tc3589x_platform_data tc3589x_keypad_data = {
88         .block = TC3589x_BLOCK_KEYPAD,
89         .keypad = &tc35893_data,
90         .irq_base = MOP500_EGPIO_IRQ_BASE,
91 };
92
93 static struct i2c_board_info __initdata mop500_i2c0_devices_u8500[] = {
94         {
95                 I2C_BOARD_INFO("tc3589x", 0x44),
96                 .platform_data = &tc3589x_keypad_data,
97                 .irq = NOMADIK_GPIO_TO_IRQ(218),
98                 .flags = I2C_CLIENT_WAKE,
99         },
100 };
101
102
103 void __init mop500_u8500uib_init(void)
104 {
105         mop500_uib_i2c_add(3, mop500_i2c3_devices_u8500,
106                         ARRAY_SIZE(mop500_i2c3_devices_u8500));
107
108         mop500_uib_i2c_add(0, mop500_i2c0_devices_u8500,
109                         ARRAY_SIZE(mop500_i2c0_devices_u8500));
110
111 }