Merge tag 'v3.10.55' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-mt8127 / tpw8127_c_mlc / keypad / mtk_kpd.h
1 /*
2 * Copyright (C) 2010 MediaTek, Inc.
3 *
4 * Author: Terry Chang <terry.chang@mediatek.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17 #ifndef _MTK_KPD_H_
18 #define _MTK_KPD_H_
19
20 #include <linux/kernel.h>
21 #include <cust_kpd.h>
22 #include <mach/mt_pm_ldo.h>
23 #include <linux/delay.h>
24 /* include PMIC header file */
25 #include <mach/mt_typedefs.h>
26 #include <mach/pmic_mt6329_hw_bank1.h>
27 #include <mach/pmic_mt6329_sw_bank1.h>
28 #include <mach/pmic_mt6329_hw.h>
29 #include <mach/pmic_mt6329_sw.h>
30 #include <mach/pmic_mt6320_sw.h>
31 #include <mach/upmu_common_sw.h>
32 #include <mach/upmu_hw.h>
33
34 #define KPD_PWRKEY_MAP KEY_POWER
35 #define KPD_PWRKEY_USE_EINT KPD_NO
36 #define KPD_PWRKEY_USE_PMIC KPD_YES
37 #define KPD_DRV_CTRL_BACKLIGHT KPD_NO /* retired, move to Lights framework */
38 #define KPD_BACKLIGHT_TIME 8 /* sec */
39 /* the keys can wake up the system and we should enable backlight */
40 #define KPD_BACKLIGHT_WAKE_KEY \
41 { \
42 KEY_ENDCALL, KEY_POWER, \
43 }
44
45 #define KPD_HAS_SLIDE_QWERTY KPD_NO
46 #if KPD_HAS_SLIDE_QWERTY
47 static inline bool powerOn_slidePin_interface() {
48 return hwPowerOn(MT65XX_POWER_LDO_VCAM_IO, VOL_2800, "Qwerty slide");
49 }
50 static inline bool powerOff_slidePin_interface(){
51 return hwPowerDown(MT65XX_POWER_LDO_VCAM_IO, "Qwerty slide");
52 }
53 #endif
54 #define KPD_SLIDE_EINT CUST_EINT_KPD_SLIDE_NUM
55 #define KPD_SLIDE_DEBOUNCE CUST_EINT_KPD_SLIDE_DEBOUNCE_CN /* ms */
56 #define KPD_SLIDE_POLARITY CUST_EINT_KPD_SLIDE_POLARITY
57 #define KPD_SLIDE_SENSITIVE CUST_EINT_KPD_SLIDE_SENSITIVE
58
59 #if KPD_DRV_CTRL_BACKLIGHT
60 extern void kpd_enable_backlight(void);
61 extern void kpd_disable_backlight(void);
62 extern void kpd_backlight_handler(bool pressed, u16 linux_keycode);
63 #else
64 #define kpd_enable_backlight() do {} while (0)
65 #define kpd_disable_backlight() do {} while (0)
66 #define kpd_backlight_handler(pressed, linux_keycode) do {} while (0)
67 #endif
68
69 /* for META tool */
70 extern void kpd_set_backlight(bool onoff, void *val1, void *val2);
71
72 #if KPD_PWRKEY_USE_PMIC
73 void kpd_pwrkey_pmic_handler(unsigned long pressed);
74 #else
75 static inline void kpd_pwrkey_pmic_handler(unsigned long data){}
76 #endif
77
78 void kpd_pmic_rstkey_handler(unsigned long pressed);
79
80 #define ONEKEY_REBOOT_NORMAL_MODE
81 //#define TWOKEY_REBOOT_NORMAL_MODE
82 #define ONEKEY_REBOOT_OTHER_MODE
83 //#define TWOKEY_REBOOT_OTHER_MODE
84 #define KPD_PMIC_RSTKEY_MAP KEY_VOLUMEDOWN
85 #define KPD_PMIC_LPRST_TD 1 /* timeout period. 0: 7sec; 1: 11sec; 2: 14sec; 3: 5sec */
86
87 #endif