1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2014 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (??MStar Confidential Information??) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
////////////////////////////////////////////////////////////////////////////////
/**
*
* @file mstar_drv_platform_porting_layer.h
*
* @brief This file defines the interface of touch screen
*
*
*/
#ifndef __MSTAR_DRV_PLATFORM_PORTING_LAYER_H__
#define __MSTAR_DRV_PLATFORM_PORTING_LAYER_H__
/*--------------------------------------------------------------------------*/
/* INCLUDE FILE */
/*--------------------------------------------------------------------------*/
#include "mstar_drv_common.h"
#if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM)
#include <soc/sprd/board.h>
#include <soc/sprd/gpio.h>
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
#include <soc/sprd/regulator.h>
#include <linux/regulator/consumer.h>
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON
#ifdef CONFIG_ENABLE_PROXIMITY_DETECTION
#include <linux/input/vir_ps.h>
#endif //CONFIG_ENABLE_PROXIMITY_DETECTION
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM)
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
#include <linux/regulator/consumer.h>
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON
#ifdef CONFIG_ENABLE_NOTIFIER_FB
#include <linux/notifier.h>
#include <linux/fb.h>
#endif //CONFIG_ENABLE_NOTIFIER_FB
#ifdef CONFIG_ENABLE_PROXIMITY_DETECTION
#include <linux/input/vir_ps.h>
#endif //CONFIG_ENABLE_PROXIMITY_DETECTION
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM)
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/rtpm_prio.h>
#include <linux/wait.h>
#include <linux/time.h>
#include <linux/hwmsen_helper.h>
#include <linux/namei.h>
#include <linux/vmalloc.h>
#ifdef CONFIG_ENABLE_PROXIMITY_DETECTION
#include <linux/hwmsensor.h>
#include <linux/hwmsen_dev.h>
#include <linux/sensors_io.h>
#endif //CONFIG_ENABLE_PROXIMITY_DETECTION
#include <mach/mt_pm_ldo.h>
#include <mach/mt_typedefs.h>
#include <mach/mt_boot.h>
#include <mach/mt_gpio.h>
#include <cust_eint.h>
#include "tpd.h"
#include "cust_gpio_usage.h"
#include <pmic_drv.h>
#endif
/*--------------------------------------------------------------------------*/
/* PREPROCESSOR CONSTANT DEFINITION */
/*--------------------------------------------------------------------------*/
/*
* Note.
* Please change the below GPIO pin setting to follow the platform that you are using(EX. MediaTek, Spreadtrum, Qualcomm).
*/
#if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM)
// TODO : Please FAE colleague to confirm with customer device driver engineer about the value of RST and INT GPIO setting
//#define MS_TS_MSG_IC_GPIO_RST GPIO_TOUCH_RESET //53 //35
//#define MS_TS_MSG_IC_GPIO_INT GPIO_TOUCH_IRQ //52 //37
#ifdef CONFIG_TP_HAVE_KEY
#define TOUCH_KEY_MENU (139) //229
#define TOUCH_KEY_HOME (172) //102
#define TOUCH_KEY_BACK (158)
#define TOUCH_KEY_SEARCH (217)
#define MAX_KEY_NUM (4)
#endif //CONFIG_TP_HAVE_KEY
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM)
// TODO : Please FAE colleague to confirm with customer device driver engineer about the value of RST and INT GPIO setting
#define MS_TS_MSG_IC_GPIO_RST 0
#define MS_TS_MSG_IC_GPIO_INT 1
#ifdef CONFIG_TP_HAVE_KEY
#define TOUCH_KEY_MENU (139) //229
#define TOUCH_KEY_HOME (172) //102
#define TOUCH_KEY_BACK (158)
#define TOUCH_KEY_SEARCH (217)
#define MAX_KEY_NUM (4)
#endif //CONFIG_TP_HAVE_KEY
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM)
#define MS_TS_MSG_IC_GPIO_RST (GPIO_CTP_RST_PIN)
#define MS_TS_MSG_IC_GPIO_INT (GPIO_CTP_EINT_PIN)
#ifdef CONFIG_TP_HAVE_KEY
#define TOUCH_KEY_MENU KEY_MENU
#define TOUCH_KEY_HOME KEY_HOMEPAGE
#define TOUCH_KEY_BACK KEY_BACK
#define TOUCH_KEY_SEARCH KEY_SEARCH
#define MAX_KEY_NUM (4)
#endif //CONFIG_TP_HAVE_KEY
#endif
/*--------------------------------------------------------------------------*/
/* GLOBAL FUNCTION DECLARATION */
/*--------------------------------------------------------------------------*/
extern void DrvPlatformLyrDisableFingerTouchReport(void);
extern void DrvPlatformLyrEnableFingerTouchReport(void);
extern void DrvPlatformLyrFingerTouchPressed(s32 nX, s32 nY, s32 nPressure, s32 nId);
extern void DrvPlatformLyrFingerTouchReleased(s32 nX, s32 nY);
extern s32 DrvPlatformLyrInputDeviceInitialize(struct i2c_client *pClient);
extern void DrvPlatformLyrSetIicDataRate(struct i2c_client *pClient, u32 nIicDataRate);
extern void DrvPlatformLyrTouchDevicePowerOff(void);
extern void DrvPlatformLyrTouchDevicePowerOn(void);
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
extern void DrvPlatformLyrTouchDeviceRegulatorPowerOn(void);
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON
extern void DrvPlatformLyrTouchDeviceRegisterEarlySuspend(void);
extern s32 DrvPlatformLyrTouchDeviceRegisterFingerTouchInterruptHandler(void);
extern s32 DrvPlatformLyrTouchDeviceRemove(struct i2c_client *pClient);
extern s32 DrvPlatformLyrTouchDeviceRequestGPIO(void);
extern void DrvPlatformLyrTouchDeviceResetHw(void);
#ifdef CONFIG_ENABLE_PROXIMITY_DETECTION
extern int DrvPlatformLyrGetTpPsData(void);
#if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM)
extern void DrvPlatformLyrTpPsEnable(int nEnable);
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM)
extern int DrvPlatformLyrTpPsOperate(void* pSelf, u32 nCommand, void* pBuffIn, int nSizeIn, void* pBuffOut, int nSizeOut, int* pActualOut);
#endif
#endif //CONFIG_ENABLE_PROXIMITY_DETECTION
#endif /* __MSTAR_DRV_PLATFORM_PORTING_LAYER_H__ */
|