aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/input/touchscreen/FT5336/ft5x06_720p.c90
-rw-r--r--drivers/input/touchscreen/IST30xx/ist30xxc.c87
-rw-r--r--drivers/input/touchscreen/IST30xx/ist30xxc.h1
-rw-r--r--include/linux/input/ft5x06_720p.h1
4 files changed, 176 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/FT5336/ft5x06_720p.c b/drivers/input/touchscreen/FT5336/ft5x06_720p.c
index c0e070949bc5..c4cf9a66aa29 100644
--- a/drivers/input/touchscreen/FT5336/ft5x06_720p.c
+++ b/drivers/input/touchscreen/FT5336/ft5x06_720p.c
@@ -85,9 +85,11 @@ static u8 pre_charger_status;
#endif
+static ssize_t ft5x06_ts_disable_keys_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
-
-
+static ssize_t ft5x06_ts_disable_keys_store(struct device *dev,
+struct device_attribute *attr, const char *buf, size_t count);
static int ft5x06_i2c_read(struct i2c_client *client, char *writebuf,
int writelen, char *readbuf, int readlen)
@@ -231,6 +233,10 @@ static irqreturn_t ft5x06_ts_interrupt(int irq, void *dev_id)
break;
if (y == 2000) {
+
+ if (data->disable_keys)
+ break;
+
y = 1344;
switch (x) {
@@ -806,6 +812,53 @@ static int ft5x06_parse_dt(struct device *dev,
}
#endif
+static DEVICE_ATTR(disable_keys, S_IWUSR | S_IRUSR, ft5x06_ts_disable_keys_show,
+ ft5x06_ts_disable_keys_store);
+
+static struct attribute *ft5x06_ts_attrs[] = {
+ &dev_attr_disable_keys.attr,
+ NULL
+};
+
+static const struct attribute_group ft5x06_ts_attr_group = {
+ .attrs = ft5x06_ts_attrs,
+};
+
+static int ft5x06_proc_init(struct ft5x06_ts_data *data)
+{
+ struct i2c_client *client = data->client;
+
+ int ret = 0;
+ char *buf, *path = NULL;
+ char *key_disabler_sysfs_node;
+ struct proc_dir_entry *proc_entry_tp = NULL;
+ struct proc_dir_entry *proc_symlink_tmp = NULL;
+
+ buf = kzalloc(sizeof(struct ft5x06_ts_data), GFP_KERNEL);
+ if (buf)
+ path = "/devices/soc/78b7000.i2c/i2c-3/3-003e";
+
+ proc_entry_tp = proc_mkdir("touchpanel", NULL);
+ if (proc_entry_tp == NULL) {
+ dev_err(&client->dev, "Couldn't create touchpanel dir in procfs\n");
+ ret = -ENOMEM;
+ }
+
+ key_disabler_sysfs_node = kzalloc(sizeof(struct ft5x06_ts_data), GFP_KERNEL);
+ if (key_disabler_sysfs_node)
+ sprintf(key_disabler_sysfs_node, "/sys%s/%s", path, "disable_keys");
+ proc_symlink_tmp = proc_symlink("capacitive_keys_enable",
+ proc_entry_tp, key_disabler_sysfs_node);
+ if (proc_symlink_tmp == NULL) {
+ dev_err(&client->dev, "Couldn't create capacitive_keys_enable symlink\n");
+ ret = -ENOMEM;
+ }
+
+ kfree(buf);
+ kfree(key_disabler_sysfs_node);
+ return ret;
+}
+
static int ft5x06_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -1047,6 +1100,14 @@ static int ft5x06_ts_probe(struct i2c_client *client,
CTP_DEBUG("tp battery supply not found\n");
#endif
+ err = sysfs_create_group(&client->dev.kobj, &ft5x06_ts_attr_group);
+ if (err) {
+ dev_err(&client->dev, "Failure %d creating sysfs group\n",
+ err);
+ goto free_reset_gpio;
+ }
+
+ ft5x06_proc_init(data);
enable_irq(data->client->irq);
return 0;
@@ -1121,11 +1182,36 @@ static int ft5x06_ts_remove(struct i2c_client *client)
else
ft5x06_power_init(data, false);
+ sysfs_remove_group(&client->dev.kobj, &ft5x06_ts_attr_group);
+
input_unregister_device(data->input_dev);
return 0;
}
+static ssize_t ft5x06_ts_disable_keys_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct ft5x06_ts_data *data = dev_get_drvdata(dev);
+ const char c = data->disable_keys ? '1' : '0';
+ return sprintf(buf, "%c\n", c);
+}
+
+static ssize_t ft5x06_ts_disable_keys_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct ft5x06_ts_data *data = dev_get_drvdata(dev);
+ int i;
+
+ if (sscanf(buf, "%u", &i) == 1 && i < 2) {
+ data->disable_keys = (i == 1);
+ return count;
+ } else {
+ dev_dbg(dev, "disable_keys write error\n");
+ return -EINVAL;
+ }
+}
+
static const struct i2c_device_id ft5x06_ts_id[] = {
{"ft5x06_720p", 0},
{},
diff --git a/drivers/input/touchscreen/IST30xx/ist30xxc.c b/drivers/input/touchscreen/IST30xx/ist30xxc.c
index 0f1f074ae26a..dcd3916ce9a0 100644
--- a/drivers/input/touchscreen/IST30xx/ist30xxc.c
+++ b/drivers/input/touchscreen/IST30xx/ist30xxc.c
@@ -139,6 +139,12 @@ void tsp_printk(int level, const char *fmt, ...)
va_end(args);
}
+static ssize_t ist30xx_disable_keys_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+
+static ssize_t ist30xx_disable_keys_store(struct device *dev,
+struct device_attribute *attr, const char *buf, size_t count);
+
long get_milli_second(void)
{
ktime_get_ts(&t_current);
@@ -828,7 +834,7 @@ static void report_input_data(struct ist30xx_data *data, int finger_counts,
fingers[idx].bit_field.w);
idx++;
}
- if (key_press == true) {
+ if ( (key_press == true) && (data->disable_keys == false) ) {
tsp_info("key press ( %d, %d)\n",
fhd_key_dim_x[id + 1], FHD_KEY_Y);
input_mt_slot(data->input_dev, 0);
@@ -1858,6 +1864,53 @@ static int get_boot_mode(struct i2c_client *client)
}
#endif
+static DEVICE_ATTR(disable_keys, S_IWUSR | S_IRUSR, ist30xx_disable_keys_show,
+ ist30xx_disable_keys_store);
+
+static struct attribute *ist30xx_attrs[] = {
+ &dev_attr_disable_keys.attr,
+ NULL
+};
+
+static const struct attribute_group ist30xx_attr_group = {
+ .attrs = ist30xx_attrs,
+};
+
+static int ist30xx_proc_init(struct ist30xx_data *data)
+{
+ struct i2c_client *client = data->client;
+
+ int ret = 0;
+ char *buf, *path = NULL;
+ char *key_disabler_sysfs_node;
+ struct proc_dir_entry *proc_entry_tp = NULL;
+ struct proc_dir_entry *proc_symlink_tmp = NULL;
+
+ buf = kzalloc(sizeof(struct ist30xx_data), GFP_KERNEL);
+ if (buf)
+ path = "/devices/soc/78b7000.i2c/i2c-3/3-0050";
+
+ proc_entry_tp = proc_mkdir("touchpanel", NULL);
+ if (proc_entry_tp == NULL) {
+ dev_err(&client->dev, "Couldn't create touchpanel dir in procfs\n");
+ ret = -ENOMEM;
+ }
+
+ key_disabler_sysfs_node = kzalloc(sizeof(struct ist30xx_data), GFP_KERNEL);
+ if (key_disabler_sysfs_node)
+ sprintf(key_disabler_sysfs_node, "/sys%s/%s", path, "disable_keys");
+ proc_symlink_tmp = proc_symlink("capacitive_keys_enable",
+ proc_entry_tp, key_disabler_sysfs_node);
+ if (proc_symlink_tmp == NULL) {
+ dev_err(&client->dev, "Couldn't create capacitive_keys_enable symlink\n");
+ ret = -ENOMEM;
+ }
+
+ kfree(buf);
+ kfree(key_disabler_sysfs_node);
+ return ret;
+}
+
static int ist30xx_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -2186,6 +2239,14 @@ static int ist30xx_probe(struct i2c_client *client,
ist30xx_write_cmd(data, IST30XX_HIB_CMD,
(eHCOM_FW_HOLD << 16) | (0 & 0xFFFF));
+ err = sysfs_create_group(&client->dev.kobj, &ist30xx_attr_group);
+ if (err) {
+ dev_err(&client->dev, "Failure %d creating sysfs group\n",
+ err);
+ goto err_sysfs;
+ }
+
+ ist30xx_proc_init(data);
data->initialized = true;
tsp_info("### IMAGIS probe success ###\n");
@@ -2237,6 +2298,7 @@ static int ist30xx_remove(struct i2c_client *client)
unregister_early_suspend(&data->early_suspend);
#endif
+ sysfs_remove_group(&client->dev.kobj, &ist30xx_attr_group);
ist30xx_disable_irq(data);
free_irq(client->irq, data);
ist30xx_power_off(data);
@@ -2265,6 +2327,29 @@ static void ist30xx_shutdown(struct i2c_client *client)
mutex_unlock(&ist30xx_mutex);
}
+static ssize_t ist30xx_disable_keys_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct ist30xx_data *data = dev_get_drvdata(dev);
+ char c = data->disable_keys ? '1' : '0';
+ return sprintf(buf, "%c\n", c);
+}
+
+static ssize_t ist30xx_disable_keys_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct ist30xx_data *data = dev_get_drvdata(dev);
+ int i;
+
+ if (sscanf(buf, "%u", &i) == 1 && i < 2) {
+ data->disable_keys = (i == 1);
+ return count;
+ } else {
+ dev_dbg(dev, "disable_keys write error\n");
+ return -EINVAL;
+ }
+}
+
static struct i2c_device_id ist30xx_idtable[] = {
{IST30XX_DEV_NAME, 0},
{},
diff --git a/drivers/input/touchscreen/IST30xx/ist30xxc.h b/drivers/input/touchscreen/IST30xx/ist30xxc.h
index f00d426d38b0..86161e171fcc 100644
--- a/drivers/input/touchscreen/IST30xx/ist30xxc.h
+++ b/drivers/input/touchscreen/IST30xx/ist30xxc.h
@@ -533,6 +533,7 @@ struct ist30xx_data {
struct pinctrl_state *gpio_state_suspend;
u32 product_id;
u32 lockdown_upper;
+ bool disable_keys;
};
extern struct mutex ist30xx_mutex;
diff --git a/include/linux/input/ft5x06_720p.h b/include/linux/input/ft5x06_720p.h
index c0bf06be8ad1..da1ec599ff72 100644
--- a/include/linux/input/ft5x06_720p.h
+++ b/include/linux/input/ft5x06_720p.h
@@ -289,6 +289,7 @@ struct ft5x06_ts_data {
struct pinctrl *ts_pinctrl;
struct pinctrl_state *gpio_state_active;
struct pinctrl_state *gpio_state_suspend;
+ bool disable_keys;
};