aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorsbrissen <sbrissen@hotmail.com>2014-03-28 08:17:17 -0400
committersbrissen <sbrissen@hotmail.com>2014-03-28 08:21:00 -0400
commit7b33a26b963567fe06cc289b684775811c7a72ea (patch)
treede61c93023e8fd47ae40ac7aba8879a717302b0d /drivers
parentb1c5069196635586f0cc98cf3eca277c08b282f6 (diff)
downloadkernel_samsung_smdk4412-7b33a26b963567fe06cc289b684775811c7a72ea.zip
kernel_samsung_smdk4412-7b33a26b963567fe06cc289b684775811c7a72ea.tar.gz
kernel_samsung_smdk4412-7b33a26b963567fe06cc289b684775811c7a72ea.tar.bz2
smdk4412: cypress-touchkey - add keydisabler
Change-Id: I85efd4c5b2d6a7283c430f5eca2a730ef6b03d18
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/keyboard/cypress/cypress-touchkey.c41
1 files changed, 41 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);