tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / include / linux / i2c / ist30xxc.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 __IST30XXC_H__
17 #define __IST30XXC_H__
18
19 #include <linux/input/tsp_ta_callback.h>
20 #ifdef CONFIG_INPUT_BOOSTER
21 #include <linux/input/input_booster.h>
22 #endif
23
24 /*
25  * Support F/W ver : IST30xxC v1.0.0.0
26  * Support IC : IST3026C, IST3032C
27  * Release : 2015.01.05 by Hoony
28  */
29
30 #define USE_TSP_TA_CALLBACKS
31
32 #define IMAGIS_DD_VERSION               ("2.0.0.0")
33
34 #define IMAGIS_IST3026C                 (1) /* 3026C */
35 #define IMAGIS_IST3032C                 (2) /* 3032C */
36 #define IMAGIS_IST3038C                 (3) /* 3038C */
37 #define IMAGIS_IST3044C                 (4) /* 3044C */
38 #define IMAGIS_IST3048C                 (5) /* 3048C */
39
40 #if defined(CONFIG_SEC_NOVEL_PROJECT)
41 #define IMAGIS_TSP_IC                   IMAGIS_IST3026C
42 #else
43 #define IMAGIS_TSP_IC                   IMAGIS_IST3038C
44 #endif
45
46 /* SEC defined [*/
47 #define FIRMWARE_PATH_LENGTH            64
48 #define FIRMWARE_PATH                   "tsp_imagis/"
49 /* SEC defined ] */
50
51 #define TSP_CHIP_VENDOR                 ("IMAGIS")
52
53 #define IMAGIS_PROTOCOL_A               (0xA)
54 #define IMAGIS_PROTOCOL_B               (0xB)
55 #define IMAGIS_PROTOCOL_TYPE            IMAGIS_PROTOCOL_B
56
57 #define IST30XXC_DEFAULT_CHIP_ID        (0x300C)
58 #define IST3048C_DEFAULT_CHIP_ID        (0x3048)
59 #if (IMAGIS_TSP_IC == IMAGIS_IST3026C)
60 #define TSP_CHIP_NAME                   ("IST3026C")
61 #define IST30XX_CHIP_ID                 (0x026C)
62 #define IST30XX_NODE_TOTAL_NUM          (16 * 16)
63 #elif (IMAGIS_TSP_IC == IMAGIS_IST3032C)
64 #define TSP_CHIP_NAME                   ("IST3032C")
65 #define IST30XX_CHIP_ID                 (0x032C)
66 #define IST30XX_NODE_TOTAL_NUM          (16 * 16)
67 #elif (IMAGIS_TSP_IC == IMAGIS_IST3038C)
68 #define TSP_CHIP_NAME                   ("IST3038C")
69 #define IST30XX_CHIP_ID                 (0x038C)
70 #define IST30XX_NODE_TOTAL_NUM          (24 * 24)
71 #elif (IMAGIS_TSP_IC == IMAGIS_IST3044C)
72 #define TSP_CHIP_NAME                   ("IST3044C")
73 #define IST30XX_CHIP_ID                 (0x044C)
74 #define IST30XX_NODE_TOTAL_NUM          (24 * 24)
75 #elif (IMAGIS_TSP_IC == IMAGIS_IST3048C)
76 #define TSP_CHIP_NAME                   ("IST3048C")
77 #define IST30XX_CHIP_ID                 (0x048C)
78 #define IST30XX_NODE_TOTAL_NUM          (24 * 24)
79 #else
80 #define TSP_CHIP_NAME                   ("IST30XXC")
81 #define IST30XX_CHIP_ID                 (0x300C)
82 #define IST30XX_NODE_TOTAL_NUM          (24 * 24)
83 #endif
84
85 /* IST30XX FUNCTION ENABLE & DISABLE */
86 #define IST30XX_INTERNAL_BIN            (1)
87 #define IST30XX_CHECK_CALIB             (0)
88 #if IST30XX_INTERNAL_BIN
89 #if (IMAGIS_TSP_IC < IMAGIS_IST3038C)
90 #if defined(CONFIG_SEC_NOVEL_PROJECT)
91 #define IST30XX_MULTIPLE_TSP            (1)
92 #else
93 #define IST30XX_MULTIPLE_TSP            (0)
94 #endif
95 #endif
96 #define IST30XX_UPDATE_BY_WORKQUEUE     (0)
97 #define IST30XX_UPDATE_DELAY            (3 * HZ)
98 #endif
99
100 #define IST30XX_EVENT_MODE              (1)
101 #if IST30XX_EVENT_MODE
102 #define IST30XX_NOISE_MODE              (1)
103 #define IST30XX_TRACKING_MODE           (1)
104 #define IST30XX_ALGORITHM_MODE          (1)
105 #else
106 #define IST30XX_NOISE_MODE              (0) /* fixed */
107 #define IST30XX_TRACKING_MODE           (0) /* fixed */
108 #define IST30XX_ALGORITHM_MODE          (0) /* fixed */
109 #endif
110
111 #define IST30XX_TA_RESET                (1)
112 #define IST30XX_USE_KEY                 (0)
113 #define IST30XX_DEBUG                   (1)
114 #define IST30XX_CMCS_TEST               (1)
115 #define IST30XX_CMCS_JIT_TEST           (1)
116 #define IST30XX_GESTURE                 (0)
117 #define IST30XX_SURFACE_TOUCH           (1)
118 #define IST30XX_BLADE_TOUCH             (1)
119 #define IST30XX_STATUS_DEBUG            (0)
120
121 #define SEC_FACTORY_MODE                (1)
122 /* IST30XX FUNCTION ENABLE & DISABLE */
123
124 #define IST30XX_ADDR_LEN                (4)
125 #define IST30XX_DATA_LEN                (4)
126
127 #define IST30XX_MAX_MT_FINGERS          (2)
128 #define IST30XX_MAX_KEYS                (5)
129
130 #if defined(CONFIG_SEC_NOVEL_PROJECT)
131 #define IST30XX_MAX_X                   (480) /* LCD Resolution */
132 #define IST30XX_MAX_Y                   (800) /* LCD Resolution */
133 #else
134 #define IST30XX_MAX_X                   (720) /* LCD Resolution */
135 #define IST30XX_MAX_Y                   (1280) /* LCD Resolution */
136 #endif
137 #define IST30XX_MAX_W                   (15)
138
139 #define IST30XX_EXCEPT_MASK             (0xFFFFFF00)
140 #define IST30XX_EXCEPT_VALUE            (0xE11CE900)
141 #define IST30XX_MAX_EXCEPT_SIZE         (2)
142
143 #define IST30XX_JIG_TOUCH               (0xC0)
144 #define IST30XX_ENABLE                  (1)
145 #define IST30XX_DISABLE                 (0)
146
147 /* retry count */
148 #define IST30XX_MAX_RETRY_CNT           (3)
149
150 /* Local */
151 #define TSP_LOCAL_EU                    (0)
152 #define TSP_LOCAL_EEU                   (1)
153 #define TSP_LOCAL_TD                    (11)
154 #define TSP_LOCAL_CMCC                  (12)
155 #define TSP_LOCAL_CU                    (13)
156 #define TSP_LOCAL_SPRD                  (14)
157 #define TSP_LOCAL_CTC                   (15)
158 #define TSP_LOCAL_INDIA                 (21)
159 #define TSP_LOCAL_SWASIA                (22)
160 #define TSP_LOCAL_NA                    (31)
161 #define TSP_LOCAL_LA                    (32)
162 #define TSP_LOCAL_CODE                  TSP_LOCAL_EU
163
164 /* Factory Test for Reliability Test Group */
165 enum ist30xx_reliability_commands {
166         TEST_RAW_ALL_DATA = 0,
167         TEST_CM_ALL_DATA,
168         TEST_CS_ALL_DATA,
169         TEST_SLOPE0_ALL_DATA,
170         TEST_SLOPE1_ALL_DATA,
171 };
172
173 /* Debug message */
174 #define DEV_ERR                         (1)
175 #define DEV_WARN                        (2)
176 #define DEV_INFO                        (3)
177 #define DEV_NOTI                        (4)
178 #define DEV_DEBUG                       (5)
179 #define DEV_VERB                        (6)
180
181 #define IST30XX_DEBUG_TAG               "[ TSP ]"
182 #define IST30XX_DEBUG_LEVEL             DEV_NOTI
183
184 #define tsp_err(fmt, ...)               tsp_printk(DEV_ERR, fmt, ## __VA_ARGS__)
185 #define tsp_warn(fmt, ...)              tsp_printk(DEV_WARN, fmt, ## __VA_ARGS__)
186 #define tsp_info(fmt, ...)              tsp_printk(DEV_DEBUG, fmt, ## __VA_ARGS__)
187 #define tsp_noti(fmt, ...)              tsp_printk(DEV_NOTI, fmt, ## __VA_ARGS__)
188 #define tsp_debug(fmt, ...)             tsp_printk(DEV_DEBUG, fmt, ## __VA_ARGS__)
189 #define tsp_verb(fmt, ...)              tsp_printk(DEV_VERB, fmt, ## __VA_ARGS__)
190
191 /* i2c setting */
192 /* I2C Device info */
193 #define IST30XX_DEV_NAME                "IST30XX"
194 #define IST30XX_DEV_ID                  (0xA0 >> 1)
195
196 /* I2C Mode */
197 #define I2C_BURST_MODE                  (1)
198 #define I2C_MONOPOLY_MODE               (0)
199
200 /* I2C transfer msg number */
201 #define WRITE_CMD_MSG_LEN               (1)
202 #define READ_CMD_MSG_LEN                (2)
203
204 /* I2C address/Data length */
205 #define IST30XX_ADDR_LEN                (4) /* bytes */
206 #define IST30XX_DATA_LEN                (4) /* bytes */
207
208 /* I2C transaction size */
209 #define I2C_MAX_WRITE_SIZE              (0x0100) /* bytes */
210 #define I2C_MAX_READ_SIZE               (0x0080) /* bytes */
211
212 /* I2C access mode */
213 #define IST30XX_DIRECT_ACCESS           (1 << 31)
214 #define IST30XX_BURST_ACCESS            (1 << 27)
215 #define IST30XX_HIB_ACCESS              (0x800B << 16)
216 #define IST30XX_DA_ADDR(n)              (n | IST30XX_DIRECT_ACCESS)
217 #define IST30XX_BA_ADDR(n)              (n | IST30XX_BURST_ACCESS)
218 #define IST30XX_HA_ADDR(n)              (n | IST30XX_HIB_ACCESS)
219
220 /* register */
221 /* Info register */
222 #define IST30XX_REG_CHIPID              IST30XX_DA_ADDR(0x40001000)
223 #define IST30XX_REG_TSPTYPE             IST30XX_DA_ADDR(0x40002010)
224 /* SEC defined [ */
225 #define IST30XX_REG_XY_RES              IST30XX_DA_ADDR(0x40)
226 #define IST30XX_REG_XY_SWAP             IST30XX_DA_ADDR(0x5C)
227 /* SEC defined ] */
228
229 /* HIB register */
230 #define IST30XX_HIB_BASE                (0x30000100)
231 #define IST30XX_HIB_TOUCH_STATUS        IST30XX_HA_ADDR(IST30XX_HIB_BASE | 0x00)
232 #define IST30XX_HIB_INTR_MSG            IST30XX_HA_ADDR(IST30XX_HIB_BASE | 0x04)
233 #define IST30XX_HIB_COORD               IST30XX_HA_ADDR(IST30XX_HIB_BASE | 0x08)
234 #define IST30XX_HIB_CMD                 IST30XX_HA_ADDR(IST30XX_HIB_BASE | 0x3C)
235 #define IST30XX_HIB_RW_STATUS           IST30XX_HA_ADDR(IST30XX_HIB_BASE | 0x40)
236
237 /* interrupt macro */
238 #define IST30XX_INTR_STATUS             (0x00000C00)
239 #define CHECK_INTR_STATUS(n)            (((n & IST30XX_INTR_STATUS) == IST30XX_INTR_STATUS) ? 1 : 0)
240 #define PARSE_FINGER_CNT(n)             ((n >> 12) & 0xF)
241 #define PARSE_KEY_CNT(n)                ((n >> 21) & 0x7)
242 /* Finger status: [9:0] */
243 #define PARSE_FINGER_STATUS(n)          (n & 0x3FF)
244 /* Key status: [20:16] */
245 #define PARSE_KEY_STATUS(n)             ((n >> 16) & 0x1F)
246 #define PRESSED_FINGER(s, id)           ((s & (1 << (id - 1))) ? true : false)
247 #define PRESSED_KEY(s, id)              ((s & (1 << (16 + id - 1))) ? true : false)
248
249 #define IST30XX_MAX_CMD_SIZE            (0x20)
250 #define IST30XX_CMD_ADDR(n)             (n * 4)
251 #define IST30XX_CMD_VALUE(n)            (n / 4)
252 enum ist30xx_read_commands {
253         eHCOM_GET_CHIP_ID               = IST30XX_CMD_ADDR(0x00),
254         eHCOM_GET_VER_MAIN              = IST30XX_CMD_ADDR(0x01),
255         eHCOM_GET_VER_FW                = IST30XX_CMD_ADDR(0x02),
256         eHCOM_GET_VER_CORE              = IST30XX_CMD_ADDR(0x03),
257         eHCOM_GET_VER_TEST              = IST30XX_CMD_ADDR(0x04),
258         eHCOM_GET_CRC32                 = IST30XX_CMD_ADDR(0x05),
259         eHCOM_GET_CRC32_ALL             = IST30XX_CMD_ADDR(0x06),
260         eHCOM_GET_CAL_RESULT            = IST30XX_CMD_ADDR(0x07),
261         eHCOM_GET_TSP_VENDOR            = IST30XX_CMD_ADDR(0x08),
262
263         eHCOM_GET_LCD_INFO              = IST30XX_CMD_ADDR(0x10),
264         eHCOM_GET_TSP_INFO              = IST30XX_CMD_ADDR(0x11),
265         eHCOM_GET_KEY_INFO_0            = IST30XX_CMD_ADDR(0x12),
266         eHCOM_GET_KEY_INFO_1            = IST30XX_CMD_ADDR(0x13),
267         eHCOM_GET_KEY_INFO_2            = IST30XX_CMD_ADDR(0x14),
268         eHCOM_GET_SCR_INFO              = IST30XX_CMD_ADDR(0x15),
269         eHCOM_GET_GTX_INFO              = IST30XX_CMD_ADDR(0x16),
270         eHCOM_GET_SWAP_INFO             = IST30XX_CMD_ADDR(0x17),
271         eHCOM_GET_FINGER_INFO           = IST30XX_CMD_ADDR(0x18),
272         eHCOM_GET_BASELINE              = IST30XX_CMD_ADDR(0x19),
273         eHCOM_GET_TOUCH_TH              = IST30XX_CMD_ADDR(0x1A),
274
275         eHCOM_GET_ZVALUE_BASE           = IST30XX_CMD_ADDR(0x1C),
276         eHCOM_GET_CDC_BASE              = IST30XX_CMD_ADDR(0x1D),
277         eHCOM_GET_ALGO_BASE             = IST30XX_CMD_ADDR(0x1E),
278         eHCOM_GET_COM_CHECKSUM          = IST30XX_CMD_ADDR(0x1F),
279 };
280
281 enum ist30xx_write_commands {
282         eHCOM_FW_START                  = 0x01,
283         eHCOM_FW_HOLD                   = 0x02,
284
285         eHCOM_CP_CORRECT_EN             = 0x10,
286         eHCOM_WDT_EN                    = 0x11,
287         eHCOM_GESTURE_EN                = 0x12,
288         eHCOM_SCALE_EN                  = 0x13,
289         eHCOM_NEW_POSITION_DIS          = 0x14,
290         eHCOM_SLEEP_MODE_EN             = 0x15,
291
292         eHCOM_SET_TIME_ACTIVE           = 0x20,
293         eHCOM_SET_TIME_IDLE             = 0x21,
294         eHCOM_SET_MODE_SPECIAL          = 0x22,
295         eHCOM_SET_LOCAL_MODEL           = 0x23,
296
297         eHCOM_RUN_RAMCODE               = 0x30,
298         eHCOM_RUN_CAL_AUTO              = 0x31,
299         eHCOM_RUN_CAL_PARAM             = 0x32,
300
301         eHCOM_SET_JIG_MODE              = 0x80,
302         eHCOM_SET_JIG_SENSITI           = 0x81,
303
304         eHCOM_DEFAULT                   = 0xFF,
305 };
306
307 typedef union {
308         struct {
309                 u32 y:12;
310                 u32 x:12;
311                 u32 area:4;
312                 u32 id:4;
313         } bit_field;
314         u32 full_field;
315 } finger_info;
316
317 struct ist30xx_status {
318         int power;
319         int update;
320         int update_result;
321         int calib;
322         int calib_msg;
323         int cmcs;
324         bool event_mode;
325         bool noise_mode;
326 };
327
328 struct ist30xx_version {
329         u32 main_ver;
330         u32 fw_ver;
331         u32 core_ver;
332         u32 test_ver;
333 };
334
335 struct ist30xx_fw {
336         struct ist30xx_version prev;
337         struct ist30xx_version cur;
338         struct ist30xx_version bin;
339         u32 index;
340         u32 size;
341         u32 chksum;
342         u32 buf_size;
343         u8 *buf;
344 };
345
346 #define IST30XX_TAG_MAGIC               "ISTV2TAG"
347 struct ist30xx_tags {
348         char magic1[8];
349         u32 rom_base;
350         u32 ram_base;
351         u32 reserved0;
352         u32 reserved1;
353
354         u32 fw_addr;
355         u32 fw_size;
356         u32 cfg_addr;
357         u32 cfg_size;
358         u32 sensor_addr;
359         u32 sensor_size;
360         u32 cp_addr;
361         u32 cp_size;
362         u32 flag_addr;
363         u32 flag_size;
364         u32 reserved2;
365         u32 reserved3;
366
367         u32 zvalue_base;
368         u32 algo_base;
369         u32 raw_base;
370         u32 filter_base;
371         u32 reserved4;
372         u32 reserved5;
373
374         u32 chksum;
375         u32 chksum_all;
376         u32 reserved6;
377         u32 reserved7;
378
379         u8 day;
380         u8 month;
381         u16 year;
382         u8 hour;
383         u8 min;
384         u8 sec;
385         u8 reserved8;
386         char magic2[8];
387 };
388
389 struct ist30xx_platform_data {
390         int max_x;
391         int max_y;
392         int max_w;
393         int irq_flag;
394         int avdd_volt;
395         struct regulator *avdd_regulator;
396 };
397
398 struct CH_NUM {
399         u8 tx;
400         u8 rx;
401 };
402
403 struct GTX_INFO {
404         u8 num;
405         u8 ch_num[4];
406 };
407
408 struct TSP_NODE_BUF {
409         u16 raw[IST30XX_NODE_TOTAL_NUM];
410         u16 base[IST30XX_NODE_TOTAL_NUM];
411         u16 filter[IST30XX_NODE_TOTAL_NUM];
412         u16 min_raw;
413         u16 max_raw;
414         u16 min_base;
415         u16 max_base;
416         u16 len;
417 };
418
419 struct TSP_DIRECTION {
420         bool swap_xy;
421         bool flip_x;
422         bool flip_y;
423 };
424
425 typedef struct _TSP_INFO {
426         struct CH_NUM ch_num;
427         struct CH_NUM screen;
428         struct GTX_INFO gtx;
429         struct TSP_DIRECTION dir;
430         struct TSP_NODE_BUF node;
431         int height;
432         int width;
433         int finger_num;
434         u16 baseline;
435 } TSP_INFO;
436
437 typedef struct _TKEY_INFO {
438         int key_num;
439         bool enable;
440         struct CH_NUM ch_num[IST30XX_MAX_KEYS];
441         u16 baseline;
442 } TKEY_INFO;
443
444 #if SEC_FACTORY_MODE
445 #include <linux/i2c/ist30xxc_sec.h>
446 #endif
447
448 #ifdef CONFIG_HAS_EARLYSUSPEND
449 #include <linux/earlysuspend.h>
450 #endif
451
452 #ifdef USE_TSP_TA_CALLBACKS
453 extern struct tsp_callbacks *ist30xxc_charger_callbacks;
454 struct tsp_callbacks {
455         void (*inform_charger)(struct tsp_callbacks *, int);
456 };
457 #endif
458
459 struct ist30xx_dt_data {
460         int irq_gpio;
461         int scl_gpio;
462         int sda_gpio;
463         int touch_en_gpio;
464         int keyled_en_gpio;
465         int bringup;
466         const char *tsp_vdd_name;
467         struct regulator *tsp_power;
468         int fw_bin;
469         int tkey;
470         int octa_hw;
471         int multiple_tsp;
472         const char *ic_version;
473         const char *project_name;
474         const char *extra_string;
475         char fw_path[FIRMWARE_PATH_LENGTH];
476         char cmcs_path[FIRMWARE_PATH_LENGTH];
477 };
478
479 struct ist30xx_data {
480         struct i2c_client *client;
481         struct input_dev *input_dev;
482         struct ist30xx_dt_data *dt_data;
483         struct ist30xx_platform_data *pdata;
484         TSP_INFO tsp_info;
485         TKEY_INFO tkey_info;
486 #ifdef CONFIG_HAS_EARLYSUSPEND
487         struct early_suspend early_suspend;
488 #endif
489         struct ist30xx_status status;
490         struct ist30xx_fw fw;
491         struct ist30xx_tags tags;
492         struct pinctrl *pinctrl;
493 #if SEC_FACTORY_MODE
494         struct sec_factory sec;
495 #endif
496         u32 chip_id;
497         u32 tsp_type;
498         u32 max_fingers;
499         u32 max_keys;
500         u32 t_status;
501         finger_info fingers[IST30XX_MAX_MT_FINGERS];
502         u32 lx[IST30XX_MAX_MT_FINGERS];
503         u32 ly[IST30XX_MAX_MT_FINGERS];
504         volatile bool irq_working;
505         u32 irq_enabled;
506         bool initialized;
507         u32 noise_mode;
508         u32 debug_mode;
509         u32 jig_mode;
510         u32 z_values[IST30XX_MAX_MT_FINGERS];
511         int report_rate;
512         int idle_rate;
513 #if IST30XX_GESTURE
514         bool suspend;
515         bool gesture;
516 #endif
517         int touch_pressed_num;
518 #ifdef CONFIG_INPUT_BOOSTER
519         struct input_booster *tsp_booster;
520 #endif
521         int scan_count;
522         int scan_retry;
523         int max_scan_retry;
524         int irq_err_cnt;
525         int max_irq_err_cnt;
526         /* SEC defined [*/
527         u16 max_x;
528         u16 max_y;
529         bool track_enable;
530         bool deep_sleep;
531         /* SEC defined ]*/
532         struct delayed_work     work_reset_check;
533         struct delayed_work     work_noise_protect;
534         struct delayed_work     work_debug_algorithm;
535 #if IST30XX_INTERNAL_BIN
536 #if IST30XX_UPDATE_BY_WORKQUEUE
537         struct delayed_work     work_fw_update;
538 #endif
539 #endif
540         bool touch_stopped;
541 #ifdef USE_TSP_TA_CALLBACKS
542         struct tsp_callbacks    callbacks;
543 #endif
544 #ifdef CONFIG_SLEEP_MONITOR
545         u32 release_cnt;
546 #endif
547 };
548
549 extern struct mutex ist30xx_mutex;
550 extern int ist30xx_dbg_level;
551 extern unsigned int system_rev;
552
553 void tsp_printk(int level, const char *fmt, ...);
554 int ist30xx_intr_wait(struct ist30xx_data *data, long ms);
555
556 void ist30xx_enable_irq(struct ist30xx_data *data);
557 void ist30xx_disable_irq(struct ist30xx_data *data);
558 void ist30xx_set_ta_mode(bool charging);
559 void ist30xx_set_edge_mode(int mode);
560 void ist30xx_set_cover_mode(int mode);
561 void ist30xx_start(struct ist30xx_data *data);
562 int ist30xx_get_ver_info(struct ist30xx_data *data);
563
564 int ist30xx_read_reg(struct i2c_client *client, u32 reg, u32 *buf);
565 int ist30xx_read_cmd(struct ist30xx_data *data, u32 cmd, u32 *buf);
566 int ist30xx_write_cmd(struct i2c_client *client, u32 cmd, u32 val);
567 int ist30xx_read_buf(struct i2c_client *client, u32 cmd, u32 *buf, u16 len);
568 int ist30xx_write_buf(struct i2c_client *client, u32 cmd, u32 *buf, u16 len);
569 int ist30xx_burst_read(struct i2c_client *client, u32 addr,
570                 u32 *buf32, u16 len, bool bit_en);
571 int ist30xx_burst_write(struct i2c_client *client, u32 addr,
572                 u32 *buf32, u16 len);
573
574 int ist30xx_cmd_start_scan(struct ist30xx_data *data);
575 int ist30xx_cmd_calibrate(struct i2c_client *client);
576 int ist30xx_cmd_check_calib(struct i2c_client *client);
577 int ist30xx_cmd_update(struct i2c_client *client, int cmd);
578 int ist30xx_cmd_hold(struct ist30xx_data *data, int enable);
579
580 int ist30xx_power_on(struct ist30xx_data *data, bool download);
581 int ist30xx_power_off(struct ist30xx_data *data);
582 int ist30xx_reset(struct ist30xx_data *data, bool download);
583
584 int ist30xx_internal_suspend(struct ist30xx_data *data);
585 int ist30xx_internal_resume(struct ist30xx_data *data);
586
587 int ist30xx_init_system(struct ist30xx_data *data);
588
589 extern struct class *ist30xx_class;
590 #if SEC_FACTORY_MODE
591 extern struct class *sec_class;
592 extern int sec_touch_sysfs(struct ist30xx_data *data);
593 extern int sec_fac_cmd_init(struct ist30xx_data *data);
594 extern void sec_fac_cmd_remove(struct ist30xx_data *data);
595 extern void sec_touch_sysfs_remove(struct ist30xx_data *data);
596
597 #endif
598
599 #endif /* __IST30XXC_H__ */