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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2012 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_interface.c
*
* @brief This file defines the interface of touch screen
*
* @version v2.2.0.0
*
*/
/*=============================================================*/
// INCLUDE FILE
/*=============================================================*/
#include "mstar_drv_platform_interface.h"
#include "mstar_drv_main.h"
#include "mstar_drv_ic_fw_porting_layer.h"
#include "mstar_drv_platform_porting_layer.h"
/*=============================================================*/
// EXTERN VARIABLE DECLARATION
/*=============================================================*/
#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
extern u16 g_GestureWakeupMode;
extern u8 g_GestureWakeupFlag;
#endif //CONFIG_ENABLE_GESTURE_WAKEUP
/*=============================================================*/
// GLOBAL VARIABLE DEFINITION
/*=============================================================*/
extern struct input_dev *g_InputDevice;
/*=============================================================*/
// GLOBAL FUNCTION DEFINITION
/*=============================================================*/
void MsDrvInterfaceTouchDeviceSuspend(struct early_suspend *pSuspend)
{
DBG("*** %s() ***\n", __func__);
#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
// g_GestureWakeupMode = 0x1FFF; // Enable all gesture wakeup mode for testing
if (g_GestureWakeupMode != 0x0000)
{
DrvIcFwLyrOpenGestureWakeup(g_GestureWakeupMode);
return;
}
#endif //CONFIG_ENABLE_GESTURE_WAKEUP
DrvPlatformLyrFingerTouchReleased(0, 0); // Send touch end for clearing point touch
input_sync(g_InputDevice);
DrvPlatformLyrDisableFingerTouchReport();
DrvPlatformLyrTouchDevicePowerOff();
}
void MsDrvInterfaceTouchDeviceResume(struct early_suspend *pSuspend)
{
DBG("*** %s() ***\n", __func__);
#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
if (g_GestureWakeupFlag == 1)
{
DrvIcFwLyrCloseGestureWakeup();
}
else
{
DrvPlatformLyrEnableFingerTouchReport();
}
#endif //CONFIG_ENABLE_GESTURE_WAKEUP
DrvPlatformLyrTouchDevicePowerOn();
/*
DrvPlatformLyrFingerTouchReleased(0, 0);
input_sync(g_InputDevice);
*/
#ifdef CONFIG_ENABLE_FIRMWARE_DATA_LOG
DrvIcFwLyrRestoreFirmwareModeToLogDataMode();
#endif //CONFIG_ENABLE_FIRMWARE_DATA_LOG
#ifndef CONFIG_ENABLE_GESTURE_WAKEUP
DrvPlatformLyrEnableFingerTouchReport();
#endif //CONFIG_ENABLE_GESTURE_WAKEUP
}
#ifdef TOUCH_VIRTUAL_KEYS
/*static ssize_t virtual_keys_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sprintf(buf,
__stringify(EV_KEY) ":" __stringify(KEY_HOMEPAGE) ":192:1000:64:60"
":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":256:1000:64:60"
":" __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":128:1000:64:60"
":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":64:1000:64:60"
"\n");
}*/
static ssize_t virtual_keys_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
struct msg2138_ts_platform_data *pdata = g_I2cClient->dev.platform_data;
return sprintf(buf,"%s:%s:%d:%d:%d:%d:%s:%s:%d:%d:%d:%d:%s:%s:%d:%d:%d:%d\n"
,__stringify(EV_KEY), __stringify(KEY_APPSELECT),pdata ->virtualkeys[0],pdata ->virtualkeys[1],pdata ->virtualkeys[2],pdata ->virtualkeys[3]
,__stringify(EV_KEY), __stringify(KEY_HOMEPAGE),pdata ->virtualkeys[4],pdata ->virtualkeys[5],pdata ->virtualkeys[6],pdata ->virtualkeys[7]
,__stringify(EV_KEY), __stringify(KEY_BACK),pdata ->virtualkeys[8],pdata ->virtualkeys[9],pdata ->virtualkeys[10],pdata ->virtualkeys[11]);
}
static struct kobj_attribute virtual_keys_attr = {
.attr = {
.name = "virtualkeys.msg2138_ts",
.mode = S_IRUGO,
},
.show = &virtual_keys_show,
};
static struct attribute *properties_attrs[] = {
&virtual_keys_attr.attr,
NULL
};
static struct attribute_group properties_attr_group = {
.attrs = properties_attrs,
};
static void pixcir_ts_virtual_keys_init(void)
{
int ret;
struct kobject *properties_kobj;
properties_kobj = kobject_create_and_add("board_properties", NULL);
if (properties_kobj)
ret = sysfs_create_group(properties_kobj,
&properties_attr_group);
if (!properties_kobj || ret)
pr_err("failed to create board_properties\n");
}
#endif
/* probe function is used for matching and initializing input device */
s32 /*__devinit*/ MsDrvInterfaceTouchDeviceProbe(struct i2c_client *pClient, const struct i2c_device_id *pDeviceId)
{
s32 nRetVal = 0;
DBG("*** %s() ***\n", __func__);
DrvPlatformLyrInputDeviceInitialize(pClient);
nRetVal = DrvPlatformLyrTouchDeviceRequestGPIO();
if(nRetVal < 0) {
pr_err("[Mstar] DrvPlatformLyrTouchDeviceRequestGPIO failed %d\n",nRetVal);
return nRetVal;
}
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
DrvPlatformLyrTouchDeviceRegulatorPowerOn();
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON
DrvPlatformLyrTouchDevicePowerOn();
nRetVal = DrvMainTouchDeviceInitialize();
if(nRetVal < 0) {
pr_err("[Mstar] DrvMainTouchDeviceInitialize failed %d\n",nRetVal);
return nRetVal;
}
#ifdef TOUCH_VIRTUAL_KEYS
pixcir_ts_virtual_keys_init();
#endif
DrvPlatformLyrTouchDeviceRegisterFingerTouchInterruptHandler();
DrvPlatformLyrTouchDeviceRegisterEarlySuspend();
printk("*** MStar touch driver registered ***\n");
return nRetVal;
}
/* remove function is triggered when the input device is removed from input sub-system */
s32 /*__devexit*/ MsDrvInterfaceTouchDeviceRemove(struct i2c_client *pClient)
{
DBG("*** %s() ***\n", __func__);
return DrvPlatformLyrTouchDeviceRemove(pClient);
}
void MsDrvInterfaceTouchDeviceSetIicDataRate(struct i2c_client *pClient, u32 nIicDataRate)
{
DBG("*** %s() ***\n", __func__);
DrvPlatformLyrSetIicDataRate(pClient, nIicDataRate);
}
|