import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / alsps / cm36283-new / cm36283.h
1 /*
2 * This software is licensed under the terms of the GNU General Public
3 * License version 2, as published by the Free Software Foundation, and
4 * may be copied, distributed, and modified under those terms.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 */
12 /*
13 * Definitions for CM36283 als/ps sensor chip.
14 */
15 #ifndef __CM36283_H__
16 #define __CM36283_H__
17
18 #include <linux/ioctl.h>
19
20 /*cm36283 als/ps sensor register related macro*/
21 #define CM36283_REG_ALS_CONF 0X00
22 #define CM36283_REG_ALS_THDH 0X01
23 #define CM36283_REG_ALS_THDL 0X02
24 #define CM36283_REG_PS_CONF1_2 0X03
25 #define CM36283_REG_PS_CONF3_MS 0X04
26 #define CM36283_REG_PS_CANC 0X05
27 #define CM36283_REG_PS_THD 0X06
28 #define CM36283_REG_PS_DATA 0X08
29 #define CM36283_REG_ALS_DATA 0X09
30 #define CM36283_REG_INT_FLAG 0X0B
31 #define CM36283_REG_ID_MODE 0X0C
32
33 /*CM36283 related driver tag macro*/
34 #define CM36283_SUCCESS 0
35 #define CM36283_ERR_I2C -1
36 #define CM36283_ERR_STATUS -3
37 #define CM36283_ERR_SETUP_FAILURE -4
38 #define CM36283_ERR_GETGSENSORDATA -5
39 #define CM36283_ERR_IDENTIFICATION -6
40
41 /*----------------------------------------------------------------------------*/
42 typedef enum{
43 CM36283_NOTIFY_PROXIMITY_CHANGE = 1,
44 }CM36283_NOTIFY_TYPE;
45 /*----------------------------------------------------------------------------*/
46 typedef enum{
47 CM36283_CUST_ACTION_SET_CUST = 1,
48 CM36283_CUST_ACTION_CLR_CALI,
49 CM36283_CUST_ACTION_SET_CALI,
50 CM36283_CUST_ACTION_SET_PS_THRESHODL
51 }CM36283_CUST_ACTION;
52 /*----------------------------------------------------------------------------*/
53 typedef struct
54 {
55 uint16_t action;
56 }CM36283_CUST;
57 /*----------------------------------------------------------------------------*/
58 typedef struct
59 {
60 uint16_t action;
61 uint16_t part;
62 int32_t data[0];
63 }CM36283_SET_CUST;
64 /*----------------------------------------------------------------------------*/
65 typedef CM36283_CUST CM36283_CLR_CALI;
66 /*----------------------------------------------------------------------------*/
67 typedef struct
68 {
69 uint16_t action;
70 int32_t cali;
71 }CM36283_SET_CALI;
72 /*----------------------------------------------------------------------------*/
73 typedef struct
74 {
75 uint16_t action;
76 int32_t threshold[2];
77 }CM36283_SET_PS_THRESHOLD;
78 /*----------------------------------------------------------------------------*/
79 typedef union
80 {
81 uint32_t data[10];
82 CM36283_CUST cust;
83 CM36283_SET_CUST setCust;
84 CM36283_CLR_CALI clearCali;
85 CM36283_SET_CALI setCali;
86 CM36283_SET_PS_THRESHOLD setPSThreshold;
87 }CM36283_CUST_DATA;
88 /*----------------------------------------------------------------------------*/
89
90 #endif
91