summaryrefslogtreecommitdiff
path: root/touch_apis.h
blob: 1aa72d006ab8d6ca2987488629c9669dd4e36871 (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
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Sysfs APIs for Google Pixel devices.
 *
 * Copyright 2022 Google LLC.
 */

#ifndef _TOUCH_APIS_H_
#define _TOUCH_APIS_H_

#if IS_ENABLED(CONFIG_TOUCHSCREEN_MOTION_FILTER)
#include "touch_mf_mode.h"
#endif
#if IS_ENABLED(CONFIG_GOOG_TOUCH_INTERFACE)
#include <goog_touch_interface.h>
#endif

enum scan_mode : u8 {
	SCAN_MODE_AUTO = 0,
	SCAN_MODE_NORMAL_ACTIVE,
	SCAN_MODE_NORMAL_IDLE,
	SCAN_MODE_LOW_POWER_ACTIVE,
	SCAN_MODE_LOW_POWER_IDLE,
	SCAN_MODE_MAX,
};

enum reset_result {
	RESET_RESULT_SUCCESS = 0,
	RESET_RESULT_FAIL = -1,
	RESET_RESULT_NOT_READY = -2,
	RESET_RESULT_NOT_SUPPORT = -3,
};

struct touch_apis_data {
	int reset_result;
	int scan_mode;
#if IS_ENABLED(CONFIG_TOUCHSCREEN_MOTION_FILTER)
	struct touch_mf *tmf;
	enum touch_mf_mode mf_mode;
#endif

	int (*get_fw_version)(struct device *dev, char *buf, size_t buf_size);
	int (*get_irq_enabled)(struct device *dev);
	int (*set_irq_enabled)(struct device *dev, bool enabled);
	bool (*is_scan_mode_supported)(struct device *dev, enum scan_mode mode);
	int (*ping)(struct device *dev);
	int (*hardware_reset)(struct device *dev);
	int (*software_reset)(struct device *dev);
	int (*set_scan_mode)(struct device *dev, enum scan_mode mode);
	int (*set_sensing_enabled)(struct device *dev, bool enabled);
#if IS_ENABLED(CONFIG_GOOG_TOUCH_INTERFACE) && IS_ENABLED(CONFIG_GTI_PM)
	bool (*get_wake_lock_state)(
		struct device *dev, enum gti_pm_wakelock_type type);
	int (*set_wake_lock_state)(
		struct device *dev, enum gti_pm_wakelock_type type, bool locked);
#endif
};

extern int touch_apis_init(struct device *dev, struct touch_apis_data *data);
extern void touch_apis_deinit(struct device *dev);

#endif