aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsbrissen <sbrissen@hotmail.com>2014-06-02 12:45:58 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2014-06-02 12:45:58 +0000
commitdaf963537798a9e9e967a3ce316b3494f0f7c476 (patch)
treedb22ac181e6780987056a7c2c6dcd44108136305
parentfd943581d0f60320105aeef5c523060475dbf455 (diff)
parent7b33a26b963567fe06cc289b684775811c7a72ea (diff)
downloadkernel_samsung_smdk4412-daf963537798a9e9e967a3ce316b3494f0f7c476.zip
kernel_samsung_smdk4412-daf963537798a9e9e967a3ce316b3494f0f7c476.tar.gz
kernel_samsung_smdk4412-daf963537798a9e9e967a3ce316b3494f0f7c476.tar.bz2
Merge "smdk4412: cypress-touchkey - add keydisabler" into cm-11.0
-rw-r--r--drivers/input/keyboard/cypress/cypress-touchkey.c41
-rw-r--r--include/linux/i2c/touchkey_i2c.h1
2 files changed, 42 insertions, 0 deletions
diff --git a/drivers/input/keyboard/cypress/cypress-touchkey.c b/drivers/input/keyboard/cypress/cypress-touchkey.c
index d73ec15..8aafaad 100644
--- a/drivers/input/keyboard/cypress/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypress/cypress-touchkey.c
@@ -673,6 +673,10 @@ static irqreturn_t touchkey_interrupt(int irq, void *dev_id)
set_touchkey_debug('a');
+ if (!atomic_read(&tkey_i2c->keypad_enable)) {
+ return;
+ }
+
retry = 3;
while (retry--) {
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3);
@@ -1411,6 +1415,40 @@ static ssize_t set_touchkey_firm_status_show(struct device *dev,
return count;
}
+static ssize_t sec_keypad_enable_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%d\n", atomic_read(&tkey_i2c->keypad_enable));
+}
+
+static ssize_t sec_keypad_enable_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
+
+ unsigned int val = 0;
+ sscanf(buf, "%d", &val);
+ val = (val == 0 ? 0 : 1);
+ atomic_set(&tkey_i2c->keypad_enable, val);
+ if (val) {
+ set_bit(KEY_BACK, tkey_i2c->input_dev->keybit);
+ set_bit(KEY_MENU, tkey_i2c->input_dev->keybit);
+ set_bit(KEY_HOME, tkey_i2c->input_dev->keybit);
+ } else {
+ clear_bit(KEY_BACK, tkey_i2c->input_dev->keybit);
+ clear_bit(KEY_MENU, tkey_i2c->input_dev->keybit);
+ clear_bit(KEY_HOME, tkey_i2c->input_dev->keybit);
+ }
+ input_sync(tkey_i2c->input_dev);
+
+ return count;
+}
+
+static DEVICE_ATTR(keypad_enable, S_IRUGO|S_IWUSR, sec_keypad_enable_show,
+ sec_keypad_enable_store);
+
static DEVICE_ATTR(recommended_version, S_IRUGO | S_IWUSR | S_IWGRP,
touch_version_read, touch_version_write);
static DEVICE_ATTR(updated_version, S_IRUGO | S_IWUSR | S_IWGRP,
@@ -1496,6 +1534,7 @@ static struct attribute *touchkey_attributes[] = {
&dev_attr_touchkey_threshold.attr,
&dev_attr_autocal_enable.attr,
&dev_attr_autocal_stat.attr,
+ &dev_attr_keypad_enable.attr,
#endif
NULL,
};
@@ -1563,6 +1602,8 @@ static int i2c_touchkey_probe(struct i2c_client *client,
set_bit(LED_MISC, input_dev->ledbit);
set_bit(EV_KEY, input_dev->evbit);
+ atomic_set(&tkey_i2c->keypad_enable, 1);
+
for (i = 1; i < touchkey_count; i++)
set_bit(touchkey_keycode[i], input_dev->keybit);
diff --git a/include/linux/i2c/touchkey_i2c.h b/include/linux/i2c/touchkey_i2c.h
index be989b5..60002d2 100644
--- a/include/linux/i2c/touchkey_i2c.h
+++ b/include/linux/i2c/touchkey_i2c.h
@@ -188,6 +188,7 @@ struct touchkey_i2c {
int (*power)(int on);
struct work_struct update_work;
int update_status;
+ atomic_t keypad_enable;
};
#endif /* _LINUX_CYPRESS_TOUCHKEY_I2C_H */