summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-11-09 18:53:56 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-11-15 11:52:20 -0800
commit17039fec9ef8c71bc3ec77ed8bb131f077a3f8a5 (patch)
tree0aba449d9b07d530c46e4778a2a1c0846c888e93
parentec1c562461090170ce9515147954185c9a5bda44 (diff)
input: tegra-kbc: Support to configure any pins to row/column
Any of the KBC GPIO pins can be configured to either as row or as column. Adding support for this. bug 804531 Reviewed-on: http://git-master/r/59927 (cherry picked from commit 59b90aa62766d34290e623fc6e2dfc8fc630af0e) Change-Id: I01100fc6964278940b97428a3df561616f356f2f Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/64034
-rw-r--r--arch/arm/mach-tegra/include/mach/kbc.h28
-rw-r--r--drivers/input/keyboard/tegra-kbc.c8
2 files changed, 31 insertions, 5 deletions
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h
index 44d686fbe45e..88c1f93c3e72 100644
--- a/arch/arm/mach-tegra/include/mach/kbc.h
+++ b/arch/arm/mach-tegra/include/mach/kbc.h
@@ -27,8 +27,34 @@
#define KBC_MAX_ROW 16
#define KBC_MAX_COL 8
-#define KBC_MAX_GPIO (KBC_MAX_ROW + KBC_MAX_COL)
#define KBC_MAX_KPRESS_EVENT 8
+
+#define KBC_PIN_GPIO_0 0
+#define KBC_PIN_GPIO_1 1
+#define KBC_PIN_GPIO_2 2
+#define KBC_PIN_GPIO_3 3
+#define KBC_PIN_GPIO_4 4
+#define KBC_PIN_GPIO_5 5
+#define KBC_PIN_GPIO_6 6
+#define KBC_PIN_GPIO_7 7
+#define KBC_PIN_GPIO_8 8
+#define KBC_PIN_GPIO_9 9
+#define KBC_PIN_GPIO_10 10
+#define KBC_PIN_GPIO_11 11
+#define KBC_PIN_GPIO_12 12
+#define KBC_PIN_GPIO_13 13
+#define KBC_PIN_GPIO_14 14
+#define KBC_PIN_GPIO_15 15
+#define KBC_PIN_GPIO_16 16
+#define KBC_PIN_GPIO_17 17
+#define KBC_PIN_GPIO_18 18
+#define KBC_PIN_GPIO_19 19
+#define KBC_PIN_GPIO_20 20
+#define KBC_PIN_GPIO_21 21
+#define KBC_PIN_GPIO_22 22
+#define KBC_PIN_GPIO_23 23
+
+#define KBC_MAX_GPIO (KBC_MAX_ROW + KBC_MAX_COL)
#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL)
enum {
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index 61db75e512ce..67f07678e765 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -339,8 +339,8 @@ static void tegra_kbc_config_pins(struct tegra_kbc *kbc)
col_config[i] = 0;
for (i = 0; i < KBC_MAX_GPIO; i++) {
- u32 r_shift = 5 * (pdata->pin_cfg[i].num % 6);
- u32 c_shift = 4 * (pdata->pin_cfg[i].num % 8);
+ u32 r_shift = 5 * (i % 6);
+ u32 c_shift = 4 * (i % 8);
u32 r_mask = 0x1f << r_shift;
u32 c_mask = 0xf << c_shift;
u32 index;
@@ -349,12 +349,12 @@ static void tegra_kbc_config_pins(struct tegra_kbc *kbc)
continue;
if (pdata->pin_cfg[i].pin_type == kbc_pin_row) {
- index = pdata->pin_cfg[i].num / 6;
+ index = i / 6;
row_config[index] &= ~r_mask;
row_config[index] |=
((pdata->pin_cfg[i].num << 1) | 1) << r_shift;
} else {
- index = (pdata->pin_cfg[i].num + KBC_MAX_ROW) / 8;
+ index = i / 8;
col_config[index] &= ~c_mask;
col_config[index] |=
((pdata->pin_cfg[i].num << 1) | 1) << c_shift;