summaryrefstree
path: root/kernel/drivers/input/sec_input/sec_input.h
blob: 327b56bdd3186084407d2d6302d117616c866a0a (plain)
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
/* SPDX-License-Identifier: GPL-2.0-only */
/* drivers/input/sec_input/sec_input.h
 *
 * Core file for Samsung input device driver
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <asm/unaligned.h>
#include <linux/completion.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/fs.h>
#include <linux/gpio.h>
#include <linux/hrtimer.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/input/mt.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/time.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/pm_wakeup.h>
#include <linux/workqueue.h>
#include <linux/power_supply.h>
#include <linux/proc_fs.h>

#include "sec_cmd.h"
#include "sec_tclm_v2.h"

/*
 * sys/class/sec/tsp/support_feature
 * bit value should be made a promise with InputFramework.
 */
#define INPUT_FEATURE_ENABLE_SETTINGS_AOT	(1 << 0) /* Double tap wakeup settings */
#define INPUT_FEATURE_ENABLE_PRESSURE		(1 << 1) /* homekey pressure */
#define INPUT_FEATURE_ENABLE_SYNC_RR120		(1 << 2) /* sync reportrate 120hz */
#define INPUT_FEATURE_ENABLE_VRR		(1 << 3) /* variable refresh rate (support 240hz) */
#define INPUT_FEATURE_SUPPORT_WIRELESS_TX		(1 << 4) /* enable call wireless cmd during wireless power sharing */
#define INPUT_FEATURE_ENABLE_SYSINPUT_ENABLED		(1 << 5) /* resume/suspend called by system input service */
#define INPUT_FEATURE_ENABLE_PROX_LP_SCAN_ENABLED	(1 << 6) /* prox_lp_scan_mode called by system input service */

#define INPUT_FEATURE_SUPPORT_OPEN_SHORT_TEST		(1 << 8) /* open/short test support */
#define INPUT_FEATURE_SUPPORT_MIS_CALIBRATION_TEST	(1 << 9) /* mis-calibration test support */
#define INPUT_FEATURE_ENABLE_MULTI_CALIBRATION		(1 << 10) /* multi calibration support */

/*
 * sec Log
 */
#define SECLOG				"[sec_input]"
#define INPUT_LOG_BUF_SIZE		512
#define INPUT_TCLM_LOG_BUF_SIZE		64

#if IS_ENABLED(CONFIG_SEC_DEBUG_TSP_LOG)
#include <linux/sec_debug.h>		/* exynos */
#include "sec_tsp_log.h"

#define input_dbg(mode, dev, fmt, ...)						\
({										\
	static char input_log_buf[INPUT_LOG_BUF_SIZE];				\
	dev_dbg(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
	if (mode) {								\
		if (dev)							\
			snprintf(input_log_buf, sizeof(input_log_buf), "%s %s",	\
					dev_driver_string(dev), dev_name(dev));	\
		else								\
			snprintf(input_log_buf, sizeof(input_log_buf), "NULL");	\
		sec_debug_tsp_log_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
	}									\
})
#define input_info(mode, dev, fmt, ...)						\
({										\
	static char input_log_buf[INPUT_LOG_BUF_SIZE];				\
	dev_info(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
	if (mode) {								\
		if (dev)							\
			snprintf(input_log_buf, sizeof(input_log_buf), "%s %s",	\
					dev_driver_string(dev), dev_name(dev));	\
		else								\
			snprintf(input_log_buf, sizeof(input_log_buf), "NULL");	\
		sec_debug_tsp_log_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
	}									\
})
#define input_err(mode, dev, fmt, ...)						\
({										\
	static char input_log_buf[INPUT_LOG_BUF_SIZE];				\
	dev_err(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
	if (mode) {								\
		if (dev)							\
			snprintf(input_log_buf, sizeof(input_log_buf), "%s %s",	\
					dev_driver_string(dev), dev_name(dev));	\
		else								\
			snprintf(input_log_buf, sizeof(input_log_buf), "NULL");	\
		sec_debug_tsp_log_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
	}									\
})

#if IS_ENABLED(CONFIG_TOUCHSCREEN_DUAL_FOLDABLE)
#define MAIN_TOUCH	1
#define SUB_TOUCH	2

#define input_raw_info(mode, dev, fmt, ...)					\
({										\
	static char input_log_buf[INPUT_LOG_BUF_SIZE];				\
	dev_info(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
	if (mode == SUB_TOUCH) {						\
 		if (dev)							\
			snprintf(input_log_buf, sizeof(input_log_buf), "%s %s", \
					dev_driver_string(dev), dev_name(dev)); \
		else								\
			snprintf(input_log_buf, sizeof(input_log_buf), "NULL"); \
		sec_debug_tsp_log_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
		sec_debug_tsp_raw_data_msg(mode, input_log_buf, fmt, ## __VA_ARGS__);	\
	} else {						\
		if (dev)							\
			snprintf(input_log_buf, sizeof(input_log_buf), "%s %s", \
					dev_driver_string(dev), dev_name(dev)); \
		else								\
			snprintf(input_log_buf, sizeof(input_log_buf), "NULL"); \
		sec_debug_tsp_log_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
		sec_debug_tsp_raw_data_msg(mode, input_log_buf, fmt, ## __VA_ARGS__);	\
	}									\
})
#define input_raw_data_clear(mode) sec_tsp_raw_data_clear(mode)
#else
#define input_raw_info(mode, dev, fmt, ...)					\
({										\
	static char input_log_buf[INPUT_LOG_BUF_SIZE];				\
	dev_info(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
	if (mode) {								\
		if (dev)							\
			snprintf(input_log_buf, sizeof(input_log_buf), "%s %s", \
					dev_driver_string(dev), dev_name(dev)); \
		else								\
			snprintf(input_log_buf, sizeof(input_log_buf), "NULL"); \
		sec_debug_tsp_log_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
		sec_debug_tsp_raw_data_msg(input_log_buf, fmt, ## __VA_ARGS__);	\
	}									\
})
#define input_raw_data_clear() sec_tsp_raw_data_clear()
#endif
#define input_log_fix()	sec_tsp_log_fix()
#else
#define input_dbg(mode, dev, fmt, ...)						\
({										\
	dev_dbg(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
})
#define input_info(mode, dev, fmt, ...)						\
({										\
	dev_info(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
})
#define input_err(mode, dev, fmt, ...)						\
({										\
	dev_err(dev, SECLOG " " fmt, ## __VA_ARGS__);				\
})
#define input_raw_info(mode, dev, fmt, ...) input_info(mode, dev, fmt, ## __VA_ARGS__)
#define input_log_fix()	{}
#define input_raw_data_clear() {}
#endif

/*
 * for input_event_codes.h
 */
#define KEY_WAKEUP_UNLOCK	253	/* Wake-up to recent view, ex: AOP */
#define KEY_RECENT		254

#define BTN_PALM		0x118	/* palm flag */
#define BTN_LARGE_PALM		0x119	/* large palm flag */

#define KEY_BLACK_UI_GESTURE	0x1c7
#define KEY_INT_CANCEL		0x2be	/* for touch event skip */
#define KEY_DEX_ON		0x2bd
#define KEY_WINK			0x2bf	/* Intelligence Key */

#define ABS_MT_CUSTOM		0x3e	/* custom event */

#define SW_PEN_INSERT		0x13  /* set = pen insert, remove */

enum grip_write_mode {
	G_NONE				= 0,
	G_SET_EDGE_HANDLER		= 1,
	G_SET_EDGE_ZONE			= 2,
	G_SET_NORMAL_MODE		= 4,
	G_SET_LANDSCAPE_MODE	= 8,
	G_CLR_LANDSCAPE_MODE	= 16,
};
enum grip_set_data {
	ONLY_EDGE_HANDLER		= 0,
	GRIP_ALL_DATA			= 1,
};

enum external_noise_mode {
	EXT_NOISE_MODE_NONE		= 0,
	EXT_NOISE_MODE_MONITOR		= 1,	/* for dex mode */
	EXT_NOISE_MODE_MAX,			/* add new mode above this line */
};

enum wireless_charger_param {
	TYPE_WIRELESS_CHARGER_NONE	= 0,
	TYPE_WIRELESS_CHARGER		= 1,
	TYPE_WIRELESS_BATTERY_PACK	= 3,
};

enum set_temperature_state {
	SEC_INPUT_SET_TEMPERATURE_NORMAL = 0,
	SEC_INPUT_SET_TEMPERATURE_IN_IRQ,
	SEC_INPUT_SET_TEMPERATURE_FORCE,
};

/* FACTORY TEST RESULT SAVING FUNCTION
 * bit 3 ~ 0 : OCTA Assy
 * bit 7 ~ 4 : OCTA module
 * param[0] : OCTA modue(1) / OCTA Assy(2)
 * param[1] : TEST NONE(0) / TEST FAIL(1) / TEST PASS(2) : 2 bit
 */
#define TEST_OCTA_MODULE 1
#define TEST_OCTA_ASSAY  2
#define TEST_OCTA_NONE  0
#define TEST_OCTA_FAIL  1
#define TEST_OCTA_PASS  2

/*
 * write 0xE4 [ 11 | 10 | 01 | 00 ]
 * MSB <-------------------> LSB
 * read 0xE4
 * mapping sequnce : LSB -> MSB
 * struct sec_ts_test_result {
 * * assy : front + OCTA assay
 * * module : only OCTA
 *  union {
 *   struct {
 *    u8 assy_count:2;  -> 00
 *    u8 assy_result:2;  -> 01
 *    u8 module_count:2; -> 10
 *    u8 module_result:2; -> 11
 *   } __attribute__ ((packed));
 *   unsigned char data[1];
 *  };
 *};
 */

struct sec_ts_test_result {
 union {
  struct {
   u8 assy_count:2;
   u8 assy_result:2;
   u8 module_count:2;
   u8 module_result:2;
  } __attribute__ ((packed));
  unsigned char data[1];
 };
};

typedef enum {
	SPONGE_EVENT_TYPE_SPAY			= 0x04,
	SPONGE_EVENT_TYPE_SINGLE_TAP		= 0x08,
	SPONGE_EVENT_TYPE_AOD_PRESS		= 0x09,
	SPONGE_EVENT_TYPE_AOD_LONGPRESS		= 0x0A,
	SPONGE_EVENT_TYPE_AOD_DOUBLETAB		= 0x0B,
	SPONGE_EVENT_TYPE_AOD_HOMEKEY_PRESS	= 0x0C,
	SPONGE_EVENT_TYPE_AOD_HOMEKEY_RELEASE	= 0x0D,
	SPONGE_EVENT_TYPE_AOD_HOMEKEY_RELEASE_NO_HAPTIC	= 0x0E,
	SPONGE_EVENT_TYPE_FOD_PRESS		= 0x0F,
	SPONGE_EVENT_TYPE_FOD_RELEASE		= 0x10,
	SPONGE_EVENT_TYPE_FOD_OUT		= 0x11,
	SPONGE_EVENT_TYPE_TSP_SCAN_UNBLOCK	= 0xE1,
	SPONGE_EVENT_TYPE_TSP_SCAN_BLOCK	= 0xE2,
} SPONGE_EVENT_TYPE;

/* SEC_TS_DEBUG : Print event contents */
#define SEC_TS_DEBUG_PRINT_ALLEVENT  0x01
#define SEC_TS_DEBUG_PRINT_ONEEVENT  0x02
#define SEC_TS_DEBUG_PRINT_I2C_READ_CMD  0x04
#define SEC_TS_DEBUG_PRINT_I2C_WRITE_CMD 0x08
#define SEC_TS_DEBUG_SEND_UEVENT  0x80

#define CMD_RESULT_WORD_LEN		10

#define SEC_TS_I2C_RETRY_CNT		3
#define SEC_TS_WAIT_RETRY_CNT		100

#define SEC_TS_LOCATION_DETECT_SIZE		6
#define SEC_TS_SUPPORT_TOUCH_COUNT		10
#define SEC_TS_GESTURE_REPORT_BUFF_SIZE		20

#define SEC_TS_MODE_SPONGE_SWIPE		(1 << 1)
#define SEC_TS_MODE_SPONGE_AOD			(1 << 2)
#define SEC_TS_MODE_SPONGE_SINGLE_TAP		(1 << 3)
#define SEC_TS_MODE_SPONGE_PRESS		(1 << 4)
#define SEC_TS_MODE_SPONGE_DOUBLETAP_TO_WAKEUP	(1 << 5)

/*SPONGE library parameters*/
#define SEC_TS_MAX_SPONGE_DUMP_BUFFER	512
#define SEC_TS_SPONGE_DUMP_EVENT_MASK	0x7F
#define SEC_TS_SPONGE_DUMP_INF_MASK	0x80
#define SEC_TS_SPONGE_DUMP_INF_SHIFT	7

/* SEC_TS SPONGE OPCODE COMMAND */
#define SEC_TS_CMD_SPONGE_DUMP_FLUSH			0x01
#define SEC_TS_CMD_SPONGE_AOD_ACTIVE_INFO		0x0A
#define SEC_TS_CMD_SPONGE_OFFSET_UTC			0x10
#define SEC_TS_CMD_SPONGE_PRESS_PROPERTY		0x14
#define SEC_TS_CMD_SPONGE_FOD_INFO			0x15
#define SEC_TS_CMD_SPONGE_FOD_POSITION			0x19
#define SEC_TS_CMD_SPONGE_GET_INFO			0x90
#define SEC_TS_CMD_SPONGE_WRITE_PARAM			0x91
#define SEC_TS_CMD_SPONGE_READ_PARAM			0x92
#define SEC_TS_CMD_SPONGE_NOTIFY_PACKET			0x93
#define SEC_TS_CMD_SPONGE_LP_DUMP			0xF0
#define SEC_TS_CMD_SPONGE_LP_DUMP_CUR_IDX		0xF2
#define SEC_TS_CMD_SPONGE_LP_DUMP_EVENT			0xF4

#define SEC_TS_MAX_FW_PATH		64
#define TSP_EXTERNAL_FW		"tsp.bin"
#define TSP_EXTERNAL_FW_SIGNED	"tsp_signed.bin"
#define TSP_SPU_FW_SIGNED		"/TSP/ffu_tsp.bin"

enum power_mode {
	SEC_INPUT_STATE_POWER_OFF = 0,
	SEC_INPUT_STATE_LPM,
	SEC_INPUT_STATE_POWER_ON
};

enum sec_ts_cover_id {
	SEC_TS_FLIP_COVER = 0,
	SEC_TS_SVIEW_COVER,
	SEC_TS_NONE,
	SEC_TS_SVIEW_CHARGER_COVER,
	SEC_TS_HEALTH_COVER,
	SEC_TS_S_CHARGER_COVER,
	SEC_TS_S_VIEW_WALLET_COVER,
	SEC_TS_LED_COVER,
	SEC_TS_CLEAR_COVER,
	SEC_TS_KEYBOARD_KOR_COVER,

	SEC_TS_KEYBOARD_US_COVER = 10,
	SEC_TS_NEON_COVER,
	SEC_TS_ALCANTARA_COVER,
	SEC_TS_GAMEPACK_COVER,
	SEC_TS_LED_BACK_COVER,
	SEC_TS_CLEAR_SIDE_VIEW_COVER,
	SEC_TS_MINI_SVIEW_WALLET_COVER,

	SEC_TS_MONTBLANC_COVER = 100,
	SEC_TS_NFC_SMART_COVER = 255,
};

#define TEST_MODE_MIN_MAX		false
#define TEST_MODE_ALL_NODE		true
#define TEST_MODE_READ_FRAME		false
#define TEST_MODE_READ_CHANNEL		true

enum offset_fac_position {
	OFFSET_FAC_NOSAVE		= 0,	// FW index 0
	OFFSET_FAC_SUB			= 1,	// FW Index 2
	OFFSET_FAC_MAIN			= 2,	// FW Index 3
	OFFSET_FAC_SVC			= 3,	// FW Index 4
};

enum offset_fw_position {
	OFFSET_FW_NOSAVE		= 0,
	OFFSET_FW_SDC			= 1,
	OFFSET_FW_SUB			= 2,
	OFFSET_FW_MAIN			= 3,
	OFFSET_FW_SVC			= 4,
};

enum offset_fac_data_type {
	OFFSET_FAC_DATA_NO			= 0,
	OFFSET_FAC_DATA_CM			= 1,
	OFFSET_FAC_DATA_CM2			= 2,
	OFFSET_FAC_DATA_CM3			= 3,
	OFFSET_FAC_DATA_MISCAL			= 5,
	OFFSET_FAC_DATA_SELF_FAIL	= 7,
};

enum sec_input_notify_t {
	NOTIFIER_NOTHING = 0,
	NOTIFIER_MAIN_TOUCH_ON,
	NOTIFIER_MAIN_TOUCH_OFF,
	NOTIFIER_SUB_TOUCH_ON,
	NOTIFIER_SUB_TOUCH_OFF,
	NOTIFIER_SECURE_TOUCH_ENABLE,		/* secure touch is enabled */
	NOTIFIER_SECURE_TOUCH_DISABLE,		/* secure touch is disabled */
	NOTIFIER_TSP_BLOCKING_REQUEST,		/* wacom called tsp block enable */
	NOTIFIER_TSP_BLOCKING_RELEASE,		/* wacom called tsp block disable */
	NOTIFIER_WACOM_PEN_CHARGING_FINISHED,	/* to tsp: pen charging finished */
	NOTIFIER_WACOM_PEN_CHARGING_STARTED,	/* to tsp: pen charging started */
	NOTIFIER_WACOM_PEN_INSERT,		/* to tsp: pen is inserted */
	NOTIFIER_WACOM_PEN_REMOVE,		/* to tsp: pen is removed */
	NOTIFIER_LCD_VRR_LFD_LOCK_REQUEST,	/* to LCD: set LFD min lock */
	NOTIFIER_LCD_VRR_LFD_LOCK_RELEASE,	/* to LCD: unset LFD min lock */
	NOTIFIER_LCD_VRR_LFD_OFF_REQUEST,	/* to LCD: set LFD OFF */
	NOTIFIER_LCD_VRR_LFD_OFF_RELEASE,	/* to LCD: unset LFD OFF */
	NOTIFIER_TSP_ESD_INTERRUPT,
	NOTIFIER_VALUE_MAX,
};

enum notify_set_scan_mode {
	DISABLE_TSP_SCAN_BLOCK		= 0,
	ENABLE_TSP_SCAN_BLOCK		= 1,
	ENABLE_SPEN_CHARGING_MODE		= 2,
	DISABLE_SPEN_CHARGING_MODE		= 3,
	ENABLE_SPEN_IN		= 4,
	ENABLE_SPEN_OUT		= 5,
};

enum coord_action {
	SEC_TS_COORDINATE_ACTION_NONE = 0,
	SEC_TS_COORDINATE_ACTION_PRESS = 1,
	SEC_TS_COORDINATE_ACTION_MOVE = 2,
	SEC_TS_COORDINATE_ACTION_RELEASE = 3,
	SEC_TS_COORDINATE_ACTION_FORCE_RELEASE = 4,
};

#define SEC_TS_LFD_CTRL_LOCK_TIME	500	/* msec */
#define SEC_TS_WAKE_LOCK_TIME		500	/* msec */

enum lfd_lock_ctrl {
	SEC_TS_LFD_CTRL_LOCK = 0,
	SEC_TS_LFD_CTRL_UNLOCK,
};

enum notify_tsp_type {
	MAIN_TOUCHSCREEN = 0,
	SUB_TOUCHSCREEN,
};

enum sec_ts_error {
	SEC_SKIP = 1,
	SEC_SUCCESS = 0,
	SEC_ERROR = -1,
};

struct sec_input_grip_data {
	u8 edgehandler_direction;
	int edgehandler_start_y;
	int edgehandler_end_y;
	u16 edge_range;
	u8 deadzone_up_x;
	u8 deadzone_dn_x;
	int deadzone_y;
	u8 deadzone_dn2_x;
	int deadzone_dn_y;
	u8 landscape_mode;
	int landscape_edge;
	u16 landscape_deadzone;
	u16 landscape_top_deadzone;
	u16 landscape_bottom_deadzone;
	u16 landscape_top_gripzone;
	u16 landscape_bottom_gripzone;
};

struct sec_input_notify_data {
	u8 dual_policy;
};

struct sec_ts_coordinate {
	u8 id;
	u8 ttype;
	u8 action;
	u16 x;
	u16 y;
	u16 p_x;
	u16 p_y;
	u8 z;
	u8 hover_flag;
	u8 glove_flag;
	u8 touch_height;
	u16 mcount;
	u8 major;
	u8 minor;
	bool palm;
	int palm_count;
	u8 left_event;
	u8 noise_level;
	u8 max_strength;
	u8 hover_id_num;
	u8 noise_status;
};

struct sec_ts_aod_data {
	u16 rect_data[4];
	u16 active_area[3];
};

struct sec_ts_fod_data {
	bool set_val;
	u16 rect_data[4];

	u8 vi_x;
	u8 vi_y;
	u8 vi_size;
	u8 vi_data[SEC_CMD_STR_LEN];

	u8 press_prop;
};

#define SEC_INPUT_HW_PARAM_SIZE		512

struct sec_ts_hw_param_data {
	unsigned char ito_test[4];
	bool check_multi;
	unsigned int multi_count;
	unsigned int wet_count;
	unsigned int noise_count;
	unsigned int comm_err_count;
	unsigned int checksum_result;
	unsigned int all_finger_count;
	unsigned int all_aod_tap_count;
	unsigned int all_spay_count;
	int mode_change_failed_count;
	int ic_reset_count;
};

struct sec_ts_plat_data {
	struct input_dev *input_dev;
	struct input_dev *input_dev_pad;
	struct input_dev *input_dev_proximity;

	int max_x;
	int max_y;
	int display_x;
	int display_y;
	int x_node_num;
	int y_node_num;

	unsigned irq_gpio;
	int gpio_spi_cs;
	int i2c_burstmax;
	int bringup;
	u32 area_indicator;
	u32 area_navigation;
	u32 area_edge;
	char location[SEC_TS_LOCATION_DETECT_SIZE];

	u8 prox_power_off;

	struct sec_ts_coordinate coord[SEC_TS_SUPPORT_TOUCH_COUNT];
	struct sec_ts_coordinate prev_coord[SEC_TS_SUPPORT_TOUCH_COUNT];
	int touch_count;
	unsigned int palm_flag;
	volatile u8 touch_noise_status;
	volatile u8 touch_pre_noise_status;
	int gesture_id;
	int gesture_x;
	int gesture_y;

	struct sec_ts_fod_data fod_data;
	struct sec_ts_aod_data aod_data;

	const char *firmware_name;
	struct regulator *dvdd;
	struct regulator *avdd;

	u8 core_version_of_ic[4];
	u8 core_version_of_bin[4];
	u8 config_version_of_ic[4];
	u8 config_version_of_bin[4];
	u8 img_version_of_ic[4];
	u8 img_version_of_bin[4];

	struct pinctrl *pinctrl;

	int (*pinctrl_configure)(struct device *dev, bool on);
	int (*power)(struct device *dev, bool on);
	int (*start_device)(void *data);
	int (*stop_device)(void *data);
	int (*lpmode)(void *data, u8 mode);
	void (*init)(void *data);
	int (*stui_tsp_enter)(void);
	int (*stui_tsp_exit)(void);

	union power_supply_propval psy_value;
	struct power_supply *psy;
	u8 tsp_temperature_data;
	bool tsp_temperature_data_skip;
	int (*set_temperature)(struct device *dev, u8 temperature_data);

	struct sec_input_grip_data grip_data;
	void (*set_grip_data)(struct device *dev, u8 flag);

	int tsp_icid;
	int tsp_id;
	int tspicid_val;
	int tspid_val;

	volatile bool enabled;
	volatile int power_state;
	volatile bool shutdown_called;

	u16 touch_functions;
	u16 ic_status;
	u8 lowpower_mode;
	u8 external_noise_mode;
	u8 touchable_area;
	u8 ed_enable;
	u8 pocket_mode;
	u8 fod_lp_mode;
	int cover_type;
	u8 wirelesscharger_mode;
	bool force_wirelesscharger_mode;
	int wet_mode;

	bool regulator_boot_on;
	bool support_mt_pressure;
	bool support_dex;
	bool support_ear_detect;
#if IS_ENABLED(CONFIG_INPUT_SEC_SECURE_TOUCH)
	int ss_touch_num;
#endif
	bool support_fod;
	bool support_fod_lp_mode;
	bool enable_settings_aot;
	bool sync_reportrate_120;
	bool support_vrr;
	bool support_open_short_test;
	bool support_mis_calibration_test;
	bool support_wireless_tx;
	bool support_flex_mode;
	int support_dual_foldable;

	struct completion resume_done;
	struct wakeup_source *sec_ws;

	struct sec_ts_hw_param_data hw_param;

	u32 print_info_cnt_release;
	u32 print_info_cnt_open;
	u16 print_info_currnet_mode;
};

#ifdef TCLM_CONCEPT
int sec_tclm_data_read(struct i2c_client *client, int address);
int sec_tclm_data_write(struct i2c_client *client, int address);
int sec_tclm_execute_force_calibration(struct i2c_client *client, int cal_mode);
#endif

#if IS_ENABLED(CONFIG_DISPLAY_SAMSUNG)
extern int get_lcd_attached(char *mode);
#endif

#if IS_ENABLED(CONFIG_EXYNOS_DPU30)
extern int get_lcd_info(char *arg);
#endif

#if IS_ENABLED(CONFIG_MTK_LCM)
extern unsigned int lcdtype;
#endif

int sec_input_handler_start(struct device *dev);
void sec_delay(unsigned int ms);
int sec_input_set_temperature(struct device *dev, int state);
void sec_input_set_grip_type(struct device *dev, u8 set_type);
int sec_input_check_cover_type(struct device *dev);
void sec_input_set_fod_info(struct device *dev, int vi_x, int vi_y, int vi_size);
ssize_t sec_input_get_fod_info(struct device *dev, char *buf);
bool sec_input_set_fod_rect(struct device *dev, int *rect_data);
int sec_input_check_wirelesscharger_mode(struct device *dev, int mode, int force);

ssize_t sec_input_get_common_hw_param(struct sec_ts_plat_data *pdata, char *buf);
void sec_input_clear_common_hw_param(struct sec_ts_plat_data *pdata);

void sec_input_print_info(struct device *dev, struct sec_tclm_data *tdata);

void sec_input_proximity_report(struct device *dev, int data);
void sec_input_gesture_report(struct device *dev, int id, int x, int y);
void sec_input_coord_event(struct device *dev, int t_id);
void sec_input_release_all_finger(struct device *dev);
int sec_input_device_register(struct device *dev, void *data);
void sec_tclm_parse_dt(struct device *dev, struct sec_tclm_data *tdata);
int sec_input_parse_dt(struct device *dev);
void sec_tclm_parse_dt_dev(struct device *dev, struct sec_tclm_data *tdata);
int sec_input_pinctrl_configure(struct device *dev, bool on);
int sec_input_power(struct device *dev, bool on);
int sec_input_sysfs_create(struct kobject *kobj);
void sec_input_sysfs_remove(struct kobject *kobj);

#if IS_ENABLED(CONFIG_BATTERY_SAMSUNG)
extern unsigned int lpcharge;
#endif

#if IS_ENABLED(CONFIG_SAMSUNG_LPM_MODE)
extern int poweroff_charging;
#endif

void sec_input_register_notify(struct notifier_block *nb, notifier_fn_t notifier_call, int priority);
void sec_input_unregister_notify(struct notifier_block *nb);
int sec_input_notify(struct notifier_block *nb, unsigned long noti, void *v);
int sec_input_self_request_notify(struct notifier_block *nb);