tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / input / touchscreen / ist30xx / ist30xx_misc.h
1 /*
2  *  Copyright (C) 2010, Imagis Technology Co. Ltd. All Rights Reserved.
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  */
15
16 #ifndef __IST30XX_MISC_H__
17 #define __IST30XX_MISC_H__
18
19 #include "ist30xx_tsp.h"
20
21
22 #define IST30XXB_RAW_ADDR           (0x40100200)
23 #define IST30XXB_FILTER_ADDR        (0x40101000)
24
25 #define IST30XX_RX_CNT_ADDR         (0x20000038)
26 #define IST30XX_CONFIG_ADDR         (0x20000040)
27
28 #define NODE_FLAG_RAW               (1)
29 #define NODE_FLAG_BASE              (1 << 1)
30 #define NODE_FLAG_FILTER            (1 << 2)
31 #define NODE_FLAG_DIFF              (1 << 3)
32 #define NODE_FLAG_ALL               (0xF)
33 #define NODE_FLAG_NO_CCP            (1 << 7)
34
35 struct TSP_CH_NUM {
36         u8      tx;
37         u8      rx;
38 };
39 struct TSP_NODE_BUF {
40         u16     raw[NODE_TX_NUM][NODE_RX_NUM];
41         u16     base[NODE_TX_NUM][NODE_RX_NUM];
42         u16     filter[NODE_TX_NUM][NODE_RX_NUM];
43         u16     min_raw;
44         u16     max_raw;
45         u16     min_base;
46         u16     max_base;
47         u16     len;
48 };
49 struct TSP_DIRECTION {
50         bool    swap_xy;
51         bool    flip_x;
52         bool    flip_y;
53 };
54 typedef struct _TSP_INFO {
55         struct TSP_CH_NUM       ch_num;
56         struct TSP_DIRECTION    dir;
57         struct TSP_NODE_BUF     node;
58         int                     height;
59         int                     width;
60         int                     finger_num;
61 } TSP_INFO;
62 typedef struct _TKEY_INFO {
63         int     key_num;
64         bool    enable;
65         bool    axis_rx;
66         u8      axis_chnum;
67         u8      ch_num[5];
68 } TKEY_INFO;
69
70 int ist30xx_parse_touch_node(u8 flag, struct TSP_NODE_BUF *node);
71 int ist30xx_read_touch_node(u8 flag, struct TSP_NODE_BUF *node);
72
73 int ist30xx_tsp_update_info(void);
74 int ist30xx_tkey_update_info(void);
75
76 int ist30xx_get_tsp_info(struct ist30xx_data *data);
77 int ist30xx_get_tkey_info(struct ist30xx_data *data);
78
79 int ist30xx_init_misc_sysfs(void);
80
81 #endif  // __IST30XX_MISC_H__