From patchwork Wed Jun 29 16:34:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Jiejing X-Patchwork-Id: 927472 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5T8Htc9011002 for ; Wed, 29 Jun 2011 08:17:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752878Ab1F2IRy (ORCPT ); Wed, 29 Jun 2011 04:17:54 -0400 Received: from db3ehsobe006.messaging.microsoft.com ([213.199.154.144]:29587 "EHLO DB3EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467Ab1F2IRx (ORCPT ); Wed, 29 Jun 2011 04:17:53 -0400 Received: from mail108-db3-R.bigfish.com (10.3.81.251) by DB3EHSOBE006.bigfish.com (10.3.84.26) with Microsoft SMTP Server id 14.1.225.22; Wed, 29 Jun 2011 08:17:51 +0000 Received: from mail108-db3 (localhost.localdomain [127.0.0.1]) by mail108-db3-R.bigfish.com (Postfix) with ESMTP id BFDB61050097; Wed, 29 Jun 2011 08:17:51 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail108-db3 (localhost.localdomain [127.0.0.1]) by mail108-db3 (MessageSwitch) id 1309335471605599_11711; Wed, 29 Jun 2011 08:17:51 +0000 (UTC) Received: from DB3EHSMHS002.bigfish.com (unknown [10.3.81.250]) by mail108-db3.bigfish.com (Postfix) with ESMTP id 90DD097804F; Wed, 29 Jun 2011 08:17:51 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS002.bigfish.com (10.3.87.102) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 29 Jun 2011 08:17:46 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.289.8; Wed, 29 Jun 2011 03:17:37 -0500 Received: from shdroid1.ap.freescale.net (udp160409uds.ap.freescale.net [10.192.224.88]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p5T8HZev004630; Wed, 29 Jun 2011 03:17:36 -0500 (CDT) From: Zhang Jiejing To: CC: Subject: [PATCH] input: mpr121: improve sensibility of touch key. Date: Thu, 30 Jun 2011 00:34:41 +0800 Message-ID: <1309365281-3444-1-git-send-email-jiejing.zhang@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 29 Jun 2011 08:17:55 +0000 (UTC) From: Jiejing Zhang There was an Quick Charge bit in Electrode conf register should be set in init function, this bit was missed in chip's document, which may cause touch controller charge too slow to generate an interrupt. Also, adjust the default vlaue of touch and release threshold to make touch key more sensitive, this fix touch may not sensitive after setup with plastic case. Signed-off-by: Jiejing Zhang --- drivers/input/keyboard/mpr121_touchkey.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 0a9e811..0607699 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -43,14 +43,15 @@ * enabled capacitance sensing inputs and its run/suspend mode. */ #define ELECTRODE_CONF_ADDR 0x5e +#define ELECTRODE_CONF_QUICK_CHARGE 0x80 #define AUTO_CONFIG_CTRL_ADDR 0x7b #define AUTO_CONFIG_USL_ADDR 0x7d #define AUTO_CONFIG_LSL_ADDR 0x7e #define AUTO_CONFIG_TL_ADDR 0x7f /* Threshold of touch/release trigger */ -#define TOUCH_THRESHOLD 0x0f -#define RELEASE_THRESHOLD 0x0a +#define TOUCH_THRESHOLD 0x08 +#define RELEASE_THRESHOLD 0x05 /* Masks for touch and release triggers */ #define TOUCH_STATUS_MASK 0xfff /* MPR121 has 12 keys */ @@ -127,7 +128,7 @@ static int __devinit mpr121_phys_init(const struct mpr121_platform_data *pdata, struct i2c_client *client) { const struct mpr121_init_register *reg; - unsigned char usl, lsl, tl; + unsigned char usl, lsl, tl, eleconf; int i, t, vdd, ret; /* Set up touch/release threshold for ele0-ele11 */ @@ -163,8 +164,13 @@ static int __devinit mpr121_phys_init(const struct mpr121_platform_data *pdata, ret = i2c_smbus_write_byte_data(client, AUTO_CONFIG_USL_ADDR, usl); ret |= i2c_smbus_write_byte_data(client, AUTO_CONFIG_LSL_ADDR, lsl); ret |= i2c_smbus_write_byte_data(client, AUTO_CONFIG_TL_ADDR, tl); + + /* Quick charge bit will let the capacitive charge to ready + state quickly, or the button may not function after system + boot */ + eleconf = mpr121->keycount | ELECTRODE_CONF_QUICK_CHARGE; ret |= i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, - mpr121->keycount); + eleconf); if (ret != 0) goto err_i2c_write;