2 * Copyright (C) ST-Ericsson SA 2010
4 * License terms: GNU General Public License (GPL), version 2
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/mfd/stmpe.h>
10 #include <linux/input/bu21013.h>
11 #include <linux/gpio.h>
12 #include <linux/interrupt.h>
13 #include <linux/i2c.h>
14 #include <linux/input/matrix_keypad.h>
15 #include <asm/mach-types.h>
17 #include "board-mop500.h"
19 /* STMPE/SKE keypad use this key layout */
20 static const unsigned int mop500_keymap
[] = {
23 KEY(3, 5, KEY_VOLUMEDOWN
),
37 KEY(4, 2, KEY_VOLUMEUP
),
43 static const struct matrix_keymap_data mop500_keymap_data
= {
44 .keymap
= mop500_keymap
,
45 .keymap_size
= ARRAY_SIZE(mop500_keymap
),
50 static struct stmpe_keypad_platform_data stmpe1601_keypad_data
= {
53 .no_autorepeat
= true,
54 .keymap_data
= &mop500_keymap_data
,
57 static struct stmpe_platform_data stmpe1601_data
= {
59 .blocks
= STMPE_BLOCK_KEYPAD
,
60 .irq_trigger
= IRQF_TRIGGER_FALLING
,
61 .irq_base
= MOP500_STMPE1601_IRQ(0),
62 .keypad
= &stmpe1601_keypad_data
,
64 .autosleep_timeout
= 1024,
67 static struct i2c_board_info __initdata mop500_i2c0_devices_stuib
[] = {
69 I2C_BOARD_INFO("stmpe1601", 0x40),
70 .irq
= NOMADIK_GPIO_TO_IRQ(218),
71 .platform_data
= &stmpe1601_data
,
72 .flags
= I2C_CLIENT_WAKE
,
77 * BU21013 ROHM touchscreen interface on the STUIBs
80 #define TOUCH_GPIO_PIN 84
82 #define TOUCH_XMAX 384
83 #define TOUCH_YMAX 704
85 #define PRCMU_CLOCK_OCR 0x1CC
86 #define TSC_EXT_CLOCK_9_6MHZ 0x840000
88 static struct bu21013_platform_device tsc_plat_device
= {
89 .touch_pin
= TOUCH_GPIO_PIN
,
90 .touch_x_max
= TOUCH_XMAX
,
91 .touch_y_max
= TOUCH_YMAX
,
97 static struct i2c_board_info __initdata u8500_i2c3_devices_stuib
[] = {
99 I2C_BOARD_INFO("bu21013_tp", 0x5C),
100 .platform_data
= &tsc_plat_device
,
103 I2C_BOARD_INFO("bu21013_tp", 0x5D),
104 .platform_data
= &tsc_plat_device
,
108 void __init
mop500_stuib_init(void)
110 if (machine_is_hrefv60())
111 tsc_plat_device
.cs_pin
= HREFV60_TOUCH_RST_GPIO
;
113 tsc_plat_device
.cs_pin
= GPIO_BU21013_CS
;
115 mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib
,
116 ARRAY_SIZE(mop500_i2c0_devices_stuib
));
118 mop500_uib_i2c_add(3, u8500_i2c3_devices_stuib
,
119 ARRAY_SIZE(u8500_i2c3_devices_stuib
));