linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jooaun <jasaw81@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, raphaelpereira@gmail.com,
	jooaun <jasaw81@gmail.com>
Subject: [PATCH 2/8] qt2160: configurable key sensitivity
Date: Tue,  9 Nov 2010 13:43:24 +1100	[thread overview]
Message-ID: <1289270604-4259-1-git-send-email-jasaw81@gmail.com> (raw)
In-Reply-To: <1289268911-32322-2-git-send-email-jasaw81@gmail.com>

Add configurable key sensitivity, disable unused keys.
Configurable key sensitivity to compensate for different touch sensor circuits.
Disable unused keys to reduce power consumption.
Signed-off-by: Joo Aun Saw <jasaw81@gmail.com>
---
 drivers/input/keyboard/qt2160.c |   38 ++++++++++++++++++++++++++++++++++++++
 include/linux/input/qt2160.h    |    2 ++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c
index 7ec256c..dcd05cd 100755
--- a/drivers/input/keyboard/qt2160.c
+++ b/drivers/input/keyboard/qt2160.c
@@ -43,9 +43,26 @@
 #define QT2160_CMD_SUBVER     7
 #define QT2160_CMD_CALIBRATE  10
 #define QT2160_CMD_RESET      11
+#define QT2160_CMD_BURST_REP  13
+#define QT2160_CMD_NEG_DRIFT  15
+#define QT2160_CMD_POS_DRIFT  16
+#define QT2160_CMD_DI_LIMIT   17
+#define QT2160_CMD_NEG_RECAL  18
+#define QT2160_CMD_DHTA       19
 #define QT2160_CMD_SLIDE_CTRL 20
 #define QT2160_CMD_SLIDE_OPT  21
 #define QT2160_CMD_KEY0_AKS   22
+#define QT2160_CMD_KEY0_NEGT  38
+#define QT2160_CMD_KEY0_BURST 54
+#define QT2160_CMD_GPIO_DRV1  70
+#define QT2160_CMD_GPIO_DRV2  71
+#define QT2160_CMD_GPIO_DIR   73
+#define QT2160_CMD_GPIO_PWM1  74
+#define QT2160_CMD_GPIO_PWM2  75
+#define QT2160_CMD_PWM_LEVEL  76
+#define QT2160_CMD_GPIO_WAKE  77
+#define QT2160_CMD_CC_KEYS1   78
+#define QT2160_CMD_CC_KEYS2   79
 
 #define QT2160_CYCLE_INTERVAL	(2*HZ)
 
@@ -297,6 +314,27 @@ static int __devinit qt2160_configure_device(struct i2c_client *client,
 	}
 
 	for (i = 0; i < QT2160_MAXKEYS; i++) {
+		/* setup burst length and disable unused keys */
+		if (i < pdata->slider_length) {
+			if (pdata->key_burst_length[i])
+				error |= i2c_smbus_write_byte_data(
+						client,
+						QT2160_CMD_KEY0_BURST + i,
+						pdata->key_burst_length[i]);
+		} else {
+			if (pdata->keycodes[i]) {
+				if (pdata->key_burst_length[i])
+					error |= i2c_smbus_write_byte_data(
+						client,
+						QT2160_CMD_KEY0_BURST + i,
+						pdata->key_burst_length[i]);
+			} else {
+				error |= i2c_smbus_write_byte_data(
+						client,
+						QT2160_CMD_KEY0_BURST + i,
+						0);
+			}
+		}
 		/* set AKS */
 		error |= i2c_smbus_write_byte_data(client,
 						   QT2160_CMD_KEY0_AKS + i,
diff --git a/include/linux/input/qt2160.h b/include/linux/input/qt2160.h
index 9d1252e..748c86e 100755
--- a/include/linux/input/qt2160.h
+++ b/include/linux/input/qt2160.h
@@ -15,12 +15,14 @@
  * @key_aks: adjacent key suppression; keys that form a slider must be in the
  *  same aks group; keys in the same aks group will only report 1 active key at
  *  any time; value 0 disables aks group; valid aks groups are 1, 2, 3
+ * @key_burst_length: key sensitivity; 0 use default
  */
 struct qt2160_info {
 	unsigned char slider_length;
 	unsigned int slider_axis;
 	unsigned short keycodes[QT2160_MAXKEYS];
 	unsigned char key_aks[QT2160_MAXKEYS];
+	unsigned char key_burst_length[QT2160_MAXKEYS];
 };
 
 #endif /* __QT2160_H__ */
-- 
1.7.0.4


  reply	other threads:[~2010-11-09  2:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  2:15 [PATCH 1/8] qt2160: add slider support jooaun
2010-11-09  2:15 ` [PATCH 2/8] qt2160: configurable key sensitivity jooaun
2010-11-09  2:43   ` jooaun [this message]
2010-11-09  2:15 ` [PATCH 3/8] qt2160: add PM support jooaun
2010-11-09  2:15 ` [PATCH 4/8] qt2160: add configurable power mode jooaun
2010-11-09  2:15 ` [PATCH 5/8] qt2160: fix starting of device calibration jooaun
2010-11-09  2:15 ` [PATCH 6/8] qt2160: only read device when Change pin is active jooaun
2010-11-09  2:45   ` jooaun
2010-11-09  2:15 ` [PATCH 7/8] qt2160: optional interrupt flag jooaun
2010-11-09  2:46   ` jooaun
2010-11-09  2:15 ` [PATCH 8/8] qt2160: add hardware reset jooaun
2010-11-09  2:47   ` jooaun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289270604-4259-1-git-send-email-jasaw81@gmail.com \
    --to=jasaw81@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=raphaelpereira@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).