diff options
-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 |