RE: [PATCH] input: samsung-keypad - Add samsung keypad driver

2010-06-22 Thread Kukjin Kim
Joonyoung Shim wrote:
> 
> On 6/22/2010 8:31 AM, Kukjin Kim wrote:
> > From: Joonyoung Shim 
> >
> > This patch adds support for keypad driver running on Samsung SoCs. This
> > driver is tested on SMDK6410(S3C6410), SMDKC100(S5PC100),
> Aquila(S5PC110),
> > GONI(S5PC110) and SMDKV210(S5PV210) boards.
> >
> > Signed-off-by: Joonyoung Shim 
> > Signed-off-by: Kyungmin Park 
> > Tested-by: Naveen Krishna Ch 
> > [kgene@samsung.com: added comments]
> > Acked-by: Kukjin Kim 
> > Signed-off-by: Kukjin Kim 
> 
> I think this is duplicated posting. Why don't you just reply the
> tested-by or acked-by at previous my mail?

I was just thinking, need to modify comments when added 'Tested-by'.

Anyway, if any problems in here, please kindly ignore.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim , Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] input: samsung-keypad - Add samsung keypad driver

2010-06-21 Thread Joonyoung Shim
On 6/22/2010 8:31 AM, Kukjin Kim wrote:
> From: Joonyoung Shim 
> 
> This patch adds support for keypad driver running on Samsung SoCs. This
> driver is tested on SMDK6410(S3C6410), SMDKC100(S5PC100), Aquila(S5PC110),
> GONI(S5PC110) and SMDKV210(S5PV210) boards.
> 
> Signed-off-by: Joonyoung Shim 
> Signed-off-by: Kyungmin Park 
> Tested-by: Naveen Krishna Ch 
> [kgene@samsung.com: added comments]
> Acked-by: Kukjin Kim 
> Signed-off-by: Kukjin Kim 

I think this is duplicated posting. Why don't you just reply the
tested-by or acked-by at previous my mail?
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] input: samsung-keypad - Add samsung keypad driver

2010-06-21 Thread Kukjin Kim
From: Joonyoung Shim 

This patch adds support for keypad driver running on Samsung SoCs. This
driver is tested on SMDK6410(S3C6410), SMDKC100(S5PC100), Aquila(S5PC110),
GONI(S5PC110) and SMDKV210(S5PV210) boards.

Signed-off-by: Joonyoung Shim 
Signed-off-by: Kyungmin Park 
Tested-by: Naveen Krishna Ch 
[kgene@samsung.com: added comments]
Acked-by: Kukjin Kim 
Signed-off-by: Kukjin Kim 
---
 drivers/input/keyboard/Kconfig  |9 +
 drivers/input/keyboard/Makefile |1 +
 drivers/input/keyboard/samsung-keypad.c |  400 +++
 3 files changed, 410 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/keyboard/samsung-keypad.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index d8fa5d7..bf6a50f 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -342,6 +342,15 @@ config KEYBOARD_PXA930_ROTARY
  To compile this driver as a module, choose M here: the
  module will be called pxa930_rotary.
 
+config KEYBOARD_SAMSUNG
+   tristate "Samsung keypad support"
+   depends on SAMSUNG_DEV_KEYPAD
+   help
+ Say Y here if you want to use the Samsung keypad.
+
+ To compile this driver as a module, choose M here: the
+ module will be called samsung-keypad.
+
 config KEYBOARD_STOWAWAY
tristate "Stowaway keyboard"
select SERIO
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 4596d0c..8f973ed 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_KEYBOARD_OPENCORES)  += opencores-kbd.o
 obj-$(CONFIG_KEYBOARD_PXA27x)  += pxa27x_keypad.o
 obj-$(CONFIG_KEYBOARD_PXA930_ROTARY)   += pxa930_rotary.o
 obj-$(CONFIG_KEYBOARD_QT2160)  += qt2160.o
+obj-$(CONFIG_KEYBOARD_SAMSUNG) += samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)+= sh_keysc.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)+= stowaway.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)  += sunkbd.o
diff --git a/drivers/input/keyboard/samsung-keypad.c 
b/drivers/input/keyboard/samsung-keypad.c
new file mode 100644
index 000..4b56e6f
--- /dev/null
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -0,0 +1,400 @@
+/*
+ * samsung-keypad.c  --  Samsung keypad driver
+ *
+ * Copyright (C) 2010 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim 
+ * Author: Donghwa Lee 
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum samsung_keypad_type {
+   KEYPAD_TYPE_SAMSUNG,
+   KEYPAD_TYPE_S5PV210,
+};
+
+struct samsung_keypad {
+   struct input_dev *input_dev;
+   struct clk *clk;
+   struct delayed_work work;
+   void __iomem *base;
+   unsigned short *keycodes;
+   unsigned int row_shift;
+   unsigned int rows;
+   unsigned int cols;
+   unsigned int row_state[SAMSUNG_MAX_COLS];
+   int irq;
+};
+
+static int samsung_keypad_is_s5pv210(struct device *dev)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+   enum samsung_keypad_type type;
+
+   type = platform_get_device_id(pdev)->driver_data;
+   return type == KEYPAD_TYPE_S5PV210;
+}
+
+static void samsung_keypad_scan(struct samsung_keypad *keypad,
+   unsigned int *row_state)
+{
+   struct device *dev = keypad->input_dev->dev.parent;
+   unsigned int col;
+   unsigned int val;
+
+   for (col = 0; col < keypad->cols; col++) {
+   if (samsung_keypad_is_s5pv210(dev)) {
+   val = S5PV210_KEYIFCOLEN_MASK;
+   val &= ~(1 << col) << 8;
+   } else {
+   val = SAMSUNG_KEYIFCOL_MASK;
+   val &= ~(1 << col);
+   }
+
+   writel(val, keypad->base + SAMSUNG_KEYIFCOL);
+   mdelay(1);
+
+   val = readl(keypad->base + SAMSUNG_KEYIFROW);
+   row_state[col] = ~val & ((1 << keypad->rows) - 1);
+   }
+
+   /* KEYIFCOL reg clear */
+   writel(0, keypad->base + SAMSUNG_KEYIFCOL);
+}
+
+static void samsung_keypad_worker(struct work_struct *work)
+{
+   struct samsung_keypad *keypad = container_of(work,
+   struct samsung_keypad, work.work);
+   unsigned int row_state[SAMSUNG_MAX_COLS];
+   unsigned int val;
+   unsigned int changed;
+   unsigned int pressed;
+   unsigned int key_down = 0;
+   int col, row;
+
+   clk_enable(keypad->clk);
+
+   val = readl(keypad->base + SAMSUNG_KEYIFSTSCLR);
+
+   /* interrupt clear */
+   writel(~0x0, keyp