Merge "input: touchscreen: nt36xxx: Expose trusted touch event"

This commit is contained in:
qctecmdr 2021-01-08 14:20:45 -08:00 • committed by Gerrit - the friendly Code Review server
commit 1a91a6be35
5 changed files with 1438 additions and 34 deletions

View file

@ -155,6 +155,8 @@ CONFIG_TOUCHSCREEN_ST=y
CONFIG_ST_TRUSTED_TOUCH=y
CONFIG_TOUCHSCREEN_FTS=y
CONFIG_FTS_TRUSTED_TOUCH=y
CONFIG_TOUCHSCREEN_NT36XXX=y
CONFIG_NOVATEK_TRUSTED_TOUCH=y
CONFIG_INPUT_MISC=y
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIO_AMBAKMI=y

View file

@ -210,6 +210,7 @@ CONFIG_FTS_TRUSTED_TOUCH=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=m
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=m
CONFIG_TOUCHSCREEN_NT36XXX=m
CONFIG_NOVATEK_TRUSTED_TOUCH=y
CONFIG_SPS=m
CONFIG_SPS_SUPPORT_NDP_BAM=y
# CONFIG_SPS_SUPPORT_BAMDMA is not set

View file

@ -9,3 +9,10 @@ config TOUCHSCREEN_NT36XXX
to your system.
If unsure, say N.
config NOVATEK_TRUSTED_TOUCH
bool "Novatek Trusted Touch"
depends on TOUCHSCREEN_NT36XXX
help
Say Y here to enable Novatek Trusted Touch.
If unsure, say N.

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,7 @@
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/uaccess.h>
#include <linux/haven/hh_irq_lend.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
@ -89,6 +90,75 @@ extern const uint16_t gesture_key_array[];
#define NVT_TOUCH_ESD_PROTECT 0
#define NVT_TOUCH_ESD_CHECK_PERIOD 1500 /* ms */
enum trusted_touch_mode_config {
TRUSTED_TOUCH_VM_MODE,
TRUSTED_TOUCH_MODE_NONE
};
enum trusted_touch_pvm_states {
TRUSTED_TOUCH_PVM_INIT,
PVM_I2C_RESOURCE_ACQUIRED,
PVM_INTERRUPT_DISABLED,
PVM_IOMEM_LENT,
PVM_IOMEM_LENT_NOTIFIED,
PVM_IRQ_LENT,
PVM_IRQ_LENT_NOTIFIED,
PVM_IOMEM_RELEASE_NOTIFIED,
PVM_IRQ_RELEASE_NOTIFIED,
PVM_ALL_RESOURCES_RELEASE_NOTIFIED,
PVM_IRQ_RECLAIMED,
PVM_IOMEM_RECLAIMED,
PVM_INTERRUPT_ENABLED,
PVM_I2C_RESOURCE_RELEASED,
TRUSTED_TOUCH_PVM_STATE_MAX
};
enum trusted_touch_tvm_states {
TRUSTED_TOUCH_TVM_INIT,
TVM_IOMEM_LENT_NOTIFIED,
TVM_IRQ_LENT_NOTIFIED,
TVM_ALL_RESOURCES_LENT_NOTIFIED,
TVM_IOMEM_ACCEPTED,
TVM_I2C_SESSION_ACQUIRED,
TVM_IRQ_ACCEPTED,
TVM_INTERRUPT_ENABLED,
TVM_INTERRUPT_DISABLED,
TVM_IRQ_RELEASED,
TVM_I2C_SESSION_RELEASED,
TVM_IOMEM_RELEASED,
TRUSTED_TOUCH_TVM_STATE_MAX
};
#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH
#define TRUSTED_TOUCH_MEM_LABEL 0x7
#define TRUSTED_TOUCH_EVENT_LEND_FAILURE -1
#define TRUSTED_TOUCH_EVENT_LEND_NOTIFICATION_FAILURE -2
#define TRUSTED_TOUCH_EVENT_ACCEPT_FAILURE -3
#define TRUSTED_TOUCH_EVENT_FUNCTIONAL_FAILURE -4
#define TRUSTED_TOUCH_EVENT_RELEASE_FAILURE -5
#define TRUSTED_TOUCH_EVENT_RECLAIM_FAILURE -6
#define TRUSTED_TOUCH_EVENT_NOTIFICATIONS_PENDING 5
struct trusted_touch_vm_info {
enum hh_irq_label irq_label;
enum hh_vm_names vm_name;
u32 hw_irq;
hh_memparcel_handle_t vm_mem_handle;
u32 *iomem_bases;
u32 *iomem_sizes;
u32 iomem_list_size;
void *mem_cookie;
#ifdef CONFIG_ARCH_QTI_VM
struct mutex tvm_state_mutex;
atomic_t tvm_state;
#else
struct mutex pvm_state_mutex;
atomic_t pvm_state;
#endif
};
#endif
struct nvt_ts_data {
struct i2c_client *client;
struct input_dev *input_dev;
@ -122,6 +192,20 @@ struct nvt_ts_data {
uint8_t xbuf[1025];
struct mutex xbuf_lock;
bool irq_enabled;
#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH
struct trusted_touch_vm_info *vm_info;
struct mutex nvt_clk_io_ctrl_mutex;
const char *touch_environment;
struct completion trusted_touch_powerdown;
struct clk *core_clk;
struct clk *iface_clk;
atomic_t trusted_touch_initialized;
atomic_t trusted_touch_enabled;
atomic_t trusted_touch_event;
atomic_t trusted_touch_abort_status;
atomic_t delayed_vm_probe_pending;
atomic_t trusted_touch_mode;
#endif
};
#if NVT_TOUCH_PROC