aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsbrissen <sbrissen@hotmail.com>2014-12-08 00:27:21 -0500
committerTony Layher <layhertony@gmail.com>2015-02-27 19:07:26 -0500
commit88d212d7d8bc95932b0ece07aad4d22aed9fa826 (patch)
tree0adcd53a31dc4aa07ab938986eed380c2592081f
parent258517c490bb31386216d8c229e3cc5d3126bbcd (diff)
trlte: cypress-touchkey: Add key disabler.
Change-Id: I16fb039c32f63938e4aece5faa5e2a46bed411d6
-rwxr-xr-xdrivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.c39
-rwxr-xr-xdrivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.c b/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.c
index 53b2b213c28..73385380b0f 100755
--- a/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.c
@@ -564,6 +564,10 @@ static irqreturn_t cypress_touchkey_interrupt(int irq, void *dev_id)
int ret;
int i;
+ if (!atomic_read(&info->keypad_enable)) {
+ goto out;
+ }
+
ret = gpio_get_value(info->pdata->gpio_int);
if (ret) {
dev_info(&info->client->dev,
@@ -1388,6 +1392,38 @@ static ssize_t cypress_touchkey_read_register(struct device *dev,
return size;
}
+static ssize_t sec_keypad_enable_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct cypress_touchkey_info *info = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%d\n", atomic_read(&info->keypad_enable));
+}
+
+static ssize_t sec_keypad_enable_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct cypress_touchkey_info *info = dev_get_drvdata(dev);
+ int i;
+
+ unsigned int val = 0;
+ sscanf(buf, "%d", &val);
+ val = (val == 0 ? 0 : 1);
+ atomic_set(&info->keypad_enable, val);
+ if (val) {
+ for (i = 0; i < ARRAY_SIZE(info->keycode); i++)
+ set_bit(info->keycode[i], info->input_dev->keybit);
+ } else {
+ for (i = 0; i < ARRAY_SIZE(info->keycode); i++)
+ clear_bit(info->keycode[i], info->input_dev->keybit);
+ }
+ input_sync(info->input_dev);
+
+ return count;
+}
+
+static DEVICE_ATTR(keypad_enable, S_IRUGO|S_IWUSR, sec_keypad_enable_show,
+ sec_keypad_enable_store);
static DEVICE_ATTR(touchkey_firm_update_status, S_IRUGO | S_IWUSR | S_IWGRP,
cypress_touchkey_firm_status_show, NULL);
static DEVICE_ATTR(touchkey_firm_version_panel, S_IRUGO,
@@ -1456,6 +1492,7 @@ static DEVICE_ATTR(read_reg, S_IRUGO | S_IWUSR | S_IWGRP, NULL,
cypress_touchkey_read_register);
static struct attribute *touchkey_attributes[] = {
+ &dev_attr_keypad_enable.attr,
&dev_attr_touchkey_firm_update_status.attr,
&dev_attr_touchkey_firm_version_panel.attr,
&dev_attr_touchkey_firm_version_phone.attr,
@@ -1906,6 +1943,8 @@ static int cypress_touchkey_probe(struct i2c_client *client,
set_bit(EV_LED, input_dev->evbit);
set_bit(LED_MISC, input_dev->ledbit);
+ atomic_set(&info->keypad_enable, 1);
+
wake_lock_init(&info->fw_wakelock, WAKE_LOCK_SUSPEND, "cypress_touchkey");
for (i = 0; i < pdata->keycodes_size; i++) {
diff --git a/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.h b/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.h
index 7a2f2c6f163..b92d0b69282 100755
--- a/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.h
+++ b/drivers/input/keyboard/cypress_touchkey_t/cypress-touchkey.h
@@ -223,6 +223,7 @@ struct cypress_touchkey_info {
int device_ver;
bool support_fw_update;
struct wake_lock fw_wakelock;
+ atomic_t keypad_enable;
#ifdef CRC_CHECK_INTERNAL
int crc;
#endif