diff options
author | Nitin Garg <nitin.garg@freescale.com> | 2012-03-15 14:48:04 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2012-03-15 14:48:04 -0500 |
commit | 3a4cc222f95c22e84a50b2a4934ca5e208943b3a (patch) | |
tree | 1d6923cc71dbc7e8038804eb0e893ae427bb78ff | |
parent | d1da121bf06cb08e49485dbe419f5c5336d567b8 (diff) |
ENGR00177017: Improve the mpr121 capacitive button responsiveness on iMX53 SMDimx-android-r14-alpha
The capacitive buttons on iMX53 SMD sometimes misses
the touch events. Improve the sentivity by reducing
touch threshold and enabling baseline tracking in ECR.
Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
-rw-r--r-- | drivers/input/keyboard/mpr121.c | 13 | ||||
-rw-r--r-- | include/linux/i2c/mpr.h | 5 |
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/input/keyboard/mpr121.c b/drivers/input/keyboard/mpr121.c index 3e92eaf7735e..aa5e4e2523fd 100644 --- a/drivers/input/keyboard/mpr121.c +++ b/drivers/input/keyboard/mpr121.c @@ -30,7 +30,6 @@ #include <linux/delay.h> #include <linux/bitops.h> - struct mpr121_touchkey_data { struct i2c_client *client; struct input_dev *input_dev; @@ -88,8 +87,7 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id) data->statusbits = reg; data->key_val = data->keycodes[key_num]; - input_event(input, EV_MSC, MSC_SCAN, data->key_val); - input_report_key(input, data->key_val, pressed); + input_event(input, EV_KEY, data->key_val, !!pressed); input_sync(input); dev_dbg(&client->dev, "key %d %d %s\n", key_num, data->key_val, @@ -125,6 +123,7 @@ static int mpr121_phys_init(struct mpr121_platform_data *pdata, if (ret < 0) goto err_i2c_write; } + /* setup auto-register by vdd,the formula please ref:AN3889 */ vdd = pdata->vdd_uv / 1000; usl = ((vdd - 700) * 256) / vdd; @@ -140,7 +139,7 @@ static int mpr121_phys_init(struct mpr121_platform_data *pdata, if (ret < 0) goto err_i2c_write; ret = i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, - data->keycount); + ECR_CL_BT_5BIT_VAL | (data->keycount & 0xf)); if (ret < 0) goto err_i2c_write; @@ -203,11 +202,10 @@ static int __devinit mpr_touchkey_probe(struct i2c_client *client, input_dev->keycodemax = data->keycount; for (i = 0; i < input_dev->keycodemax; i++) { - __set_bit(pdata->matrix[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, pdata->matrix[i]); data->keycodes[i] = pdata->matrix[i]; } - input_set_capability(input_dev, EV_KEY, MSC_SCAN); input_set_drvdata(input_dev, data); error = request_threaded_irq(client->irq, NULL, @@ -264,7 +262,8 @@ static int mpr_resume(struct i2c_client *client) if (device_may_wakeup(&client->dev)) disable_irq_wake(client->irq); - i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, data->keycount); + i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, + ECR_CL_BT_5BIT_VAL | (data->keycount & 0xf)); return 0; } diff --git a/include/linux/i2c/mpr.h b/include/linux/i2c/mpr.h index ded00db775f3..8dbbee648098 100644 --- a/include/linux/i2c/mpr.h +++ b/include/linux/i2c/mpr.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2010-2012 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -43,6 +43,7 @@ * should be write at last. */ #define ELECTRODE_CONF_ADDR 0x5e +#define ECR_CL_BT_5BIT_VAL 0x80 #define AUTO_CONFIG_CTRL_ADDR 0x7b /* AUTO_CONFIG_USL: Upper Limit for auto baseline search, this * register is related to VDD supplied on your board, the value of @@ -55,7 +56,7 @@ #define AUTO_CONFIG_TL_ADDR 0x7f /* Threshold of touch/release trigger */ -#define TOUCH_THRESHOLD 0x0f +#define TOUCH_THRESHOLD 0x0c #define RELEASE_THRESHOLD 0x0a /* Mask Button bits of STATUS_0 & STATUS_1 register */ #define TOUCH_STATUS_MASK 0xfff |