mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
input: touchscreen: nt36xxx: Add trusted touch support
Add Trusted touch support to nt36xxx Touchscreen driver. This feature enables driver to operate in trusted touch mode in trusted virtual machine(TVM). The primary virtual machine(PVM) lends resources such as IO memory and touch irq to TVM prior to trusted touch is initiated and reclaims those resources back after trusted touch usecase finishes. The resource requirements of TVM such as clock, regulators etc are taken care by PVM. Introduce state machine for various checkpoints in trusted touch usecase. In error scenarios, this state machine helps driver to rollback to previous state. Change-Id: I5000ba016cee21c7b6b6beab8a7bb15a8c23f8d5 Signed-off-by: Ritesh Kumar <riteshk@codeaurora.org>
This commit is contained in:
parent
4afb66961f
commit
36f6aedb51
3 changed files with 1376 additions and 34 deletions
|
|
@ -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
|
|
@ -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_IOMEM_RELEASED,
|
||||
TVM_I2C_SESSION_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
|
||||
|
|
|
|||
Loading…
Reference in a new issue