mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
input: touchscreen: focaltech: Add trusted touch support
Add Trusted touch support to lahaina QRD 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. Change-Id: I342a0a19977365ef08ea0c8fc191a2505e6e3984 Signed-off-by: Ritesh Kumar <riteshk@codeaurora.org>
This commit is contained in:
parent
122f4cad33
commit
ad6dfecd4d
4 changed files with 1081 additions and 49 deletions
|
|
@ -12,3 +12,12 @@ config TOUCHSCREEN_FTS_DIRECTORY
|
|||
string "Focaltech ts directory name"
|
||||
default "focaltech_touch"
|
||||
depends on TOUCHSCREEN_FTS
|
||||
|
||||
config FTS_TRUSTED_TOUCH
|
||||
bool "Focaltech Trusted Touch"
|
||||
depends on TOUCHSCREEN_FTS
|
||||
help
|
||||
Say Y here to enable Focaltech Trusted Touch.
|
||||
If unsure, say N.
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -61,6 +61,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/haven/hh_irq_lend.h>
|
||||
#include "focaltech_common.h"
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
@ -138,6 +139,33 @@ struct ts_event {
|
|||
int area;
|
||||
};
|
||||
|
||||
enum trusted_touch_mode_config {
|
||||
TRUSTED_TOUCH_VM_MODE,
|
||||
TRUSTED_TOUCH_MODE_NONE
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FTS_TRUSTED_TOUCH
|
||||
#define TRUSTED_TOUCH_MEM_LABEL 0x7
|
||||
|
||||
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
|
||||
atomic_t tvm_owns_iomem;
|
||||
atomic_t tvm_owns_irq;
|
||||
#else
|
||||
atomic_t pvm_owns_iomem;
|
||||
atomic_t pvm_owns_irq;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
struct fts_ts_data {
|
||||
struct i2c_client *client;
|
||||
struct spi_device *spi;
|
||||
|
|
@ -190,6 +218,20 @@ struct fts_ts_data {
|
|||
#elif defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
struct early_suspend early_suspend;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FTS_TRUSTED_TOUCH
|
||||
struct trusted_touch_vm_info *vm_info;
|
||||
struct mutex fts_clk_io_ctrl_mutex;
|
||||
const char *touch_environment;
|
||||
struct completion trusted_touch_powerdown;
|
||||
struct completion resource_checkpoint;
|
||||
struct clk *core_clk;
|
||||
struct clk *iface_clk;
|
||||
atomic_t trusted_touch_initialized;
|
||||
atomic_t trusted_touch_enabled;
|
||||
atomic_t delayed_vm_probe_pending;
|
||||
atomic_t trusted_touch_mode;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
@ -258,4 +300,6 @@ int fts_ex_mode_recovery(struct fts_ts_data *ts_data);
|
|||
|
||||
void fts_irq_disable(void);
|
||||
void fts_irq_enable(void);
|
||||
int fts_ts_handle_trusted_touch_pvm(struct fts_ts_data *ts_data, int value);
|
||||
int fts_ts_handle_trusted_touch_tvm(struct fts_ts_data *ts_data, int value);
|
||||
#endif /* __LINUX_FOCALTECH_CORE_H__ */
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ static ssize_t fts_bootmode_show(
|
|||
}
|
||||
|
||||
/* fts_tpfwver interface */
|
||||
static ssize_t fts_tpfwver_show(
|
||||
static ssize_t fts_fw_version_show(
|
||||
struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct fts_ts_data *ts_data = fts_data;
|
||||
|
|
@ -659,7 +659,7 @@ static ssize_t fts_tpfwver_show(
|
|||
return num_read_chars;
|
||||
}
|
||||
|
||||
static ssize_t fts_tpfwver_store(
|
||||
static ssize_t fts_fw_version_store(
|
||||
struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
|
|
@ -1058,8 +1058,72 @@ static ssize_t fts_log_level_store(
|
|||
return count;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FTS_TRUSTED_TOUCH
|
||||
|
||||
static ssize_t trusted_touch_enable_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct fts_ts_data *info;
|
||||
|
||||
if (!client)
|
||||
return scnprintf(buf, PAGE_SIZE, "client is null\n");
|
||||
|
||||
info = i2c_get_clientdata(client);
|
||||
if (!info) {
|
||||
FTS_ERROR("info is null\n");
|
||||
return scnprintf(buf, PAGE_SIZE, "info is null\n");
|
||||
}
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%d",
|
||||
atomic_read(&info->trusted_touch_enabled));
|
||||
}
|
||||
|
||||
static ssize_t trusted_touch_enable_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct fts_ts_data *info;
|
||||
unsigned long value;
|
||||
int err = 0;
|
||||
|
||||
if (!client)
|
||||
return -EIO;
|
||||
info = i2c_get_clientdata(client);
|
||||
if (!info) {
|
||||
FTS_ERROR("info is null\n");
|
||||
return -EIO;
|
||||
}
|
||||
if (count > 2)
|
||||
return -EINVAL;
|
||||
err = kstrtoul(buf, 10, &value);
|
||||
if (err != 0)
|
||||
return err;
|
||||
|
||||
if (!atomic_read(&info->trusted_touch_initialized))
|
||||
return -EIO;
|
||||
|
||||
#ifdef CONFIG_ARCH_QTI_VM
|
||||
err = fts_ts_handle_trusted_touch_tvm(info, value);
|
||||
if (err) {
|
||||
pr_err("Failed to handle trusted touch in tvm\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
#else
|
||||
err = fts_ts_handle_trusted_touch_pvm(info, value);
|
||||
if (err) {
|
||||
pr_err("Failed to handle trusted touch in pvm\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
err = count;
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* get the fw version example:cat fw_version */
|
||||
static DEVICE_ATTR(fts_fw_version, S_IRUGO | S_IWUSR, fts_tpfwver_show, fts_tpfwver_store);
|
||||
static DEVICE_ATTR_RW(fts_fw_version);
|
||||
|
||||
/* read and write register(s)
|
||||
* All data type is **HEX**
|
||||
|
|
@ -1082,6 +1146,9 @@ static DEVICE_ATTR(fts_irq, S_IRUGO | S_IWUSR, fts_irq_show, fts_irq_store);
|
|||
static DEVICE_ATTR(fts_boot_mode, S_IRUGO | S_IWUSR, fts_bootmode_show, fts_bootmode_store);
|
||||
static DEVICE_ATTR(fts_touch_point, S_IRUGO | S_IWUSR, fts_tpbuf_show, fts_tpbuf_store);
|
||||
static DEVICE_ATTR(fts_log_level, S_IRUGO | S_IWUSR, fts_log_level_show, fts_log_level_store);
|
||||
#ifdef CONFIG_FTS_TRUSTED_TOUCH
|
||||
static DEVICE_ATTR_RW(trusted_touch_enable);
|
||||
#endif
|
||||
|
||||
/* add your attr in here*/
|
||||
static struct attribute *fts_attributes[] = {
|
||||
|
|
@ -1094,6 +1161,9 @@ static struct attribute *fts_attributes[] = {
|
|||
&dev_attr_fts_boot_mode.attr,
|
||||
&dev_attr_fts_touch_point.attr,
|
||||
&dev_attr_fts_log_level.attr,
|
||||
#ifdef CONFIG_FTS_TRUSTED_TOUCH
|
||||
&dev_attr_trusted_touch_enable.attr,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue