Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / input / touchscreen / calibration_ts.h
1 /*\r
2  * drivers/input/touchscreen/calibration_ts.h\r
3  *\r
4  * Copyright (C) 2010 ROCKCHIP, Inc.\r
5  *\r
6  * This software is licensed under the terms of the GNU General Public\r
7  * License version 2, as published by the Free Software Foundation, and\r
8  * may be copied, distributed, and modified under those terms.\r
9  *\r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  */\r
15 \r
16 #ifndef __DRIVERS_TOUCHSCREEN_CALIBRATION_TS_H\r
17 #define __DRIVERS_TOUCHSCREEN_CALIBRATION_TS_H\r
18 \r
19 struct adc_point\r
20 {\r
21     int x;\r
22     int y;\r
23 };\r
24 \r
25 #define TWO_DIMENSIONAL_CALIBRATION 1\r
26 \r
27 #define ADC_PRECISION       12          // Precision of ADC output (in bits)\r
28 #define MAX_TERM_PRECISION  27          // Reserve 1 bit for sign and two bits for\r
29                                         //  three terms (there are three terms in\r
30                                         //  each of x and y mapping functions.)\r
31 \r
32 //\r
33 // All a1, a2, b1, and b2 must have less than MAX_COEFF_PRECISION bits since\r
34 //  they all are multiplied with either an X or a Y to form a term.\r
35 // Both c1 and c2 can have up to MAX_TERM_PRECISION since they each alone\r
36 //  forms a term.\r
37 //\r
38 #define MAX_COEFF_PRECISION (MAX_TERM_PRECISION - ADC_PRECISION)\r
39 \r
40 unsigned char\r
41 TouchPanelSetCalibration(\r
42     int   cCalibrationPoints,     //@PARM The number of calibration points\r
43     int   *pScreenXBuffer,        //@PARM List of screen X coords displayed\r
44     int   *pScreenYBuffer,        //@PARM List of screen Y coords displayed\r
45     int   *pUncalXBuffer,         //@PARM List of X coords collected\r
46     int   *pUncalYBuffer          //@PARM List of Y coords collected\r
47     );\r
48 \r
49 void\r
50 TouchPanelCalibrateAPoint(\r
51     int   UncalX,     //@PARM The uncalibrated X coordinate\r
52     int   UncalY,     //@PARM The uncalibrated Y coordinate\r
53     int   *pCalX,     //@PARM The calibrated X coordinate\r
54     int   *pCalY      //@PARM The calibrated Y coordinate\r
55     );\r
56 \r
57 int  tp_calib_iface_init(int *x,int *y,int *uncali_x, int *uncali_y);\r
58 void  tp_calib_iface_exit(void);\r
59 #endif\r