public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] TWL4030 Keypad driver - incorporated review comments
@ 2007-05-10 19:40 Syed Mohammed, Khasim
  2007-05-11  0:04 ` nishanth menon
  0 siblings, 1 reply; 12+ messages in thread
From: Syed Mohammed, Khasim @ 2007-05-10 19:40 UTC (permalink / raw)
  To: linux-omap-open-source


Review comments were incorporated.

This patch adds TWL4030 Keypad driver support for 2430 SDP. 

Signed-off-by: Syed Mohammed Khasim  <x0khasim@ti.com>

Files:
 arch/arm/mach-omap2/board-2430sdp.c         |   57 +
 drivers/input/keyboard/Kconfig              |   10
 drivers/input/keyboard/Makefile             |    2
 drivers/input/keyboard/omap-twl4030keypad.c |  406  ++++++++++++++
 drivers/input/keyboard/twl4030-keypad.h     |  376
 include/asm-arm/arch-omap/board-2430sdp.h   |    8
 include/asm-arm/arch-omap/twl4030.h         |   17
	7 files changed, 873 insertions(+), 3 deletions(-)
       
=======================================================================
diff -purN linux-omap/drivers/input/keyboard/Kconfig lin_for_hsi2c/drivers/input/keyboard/Kconfig
--- linux-omap/drivers/input/keyboard/Kconfig	2007-05-07 20:59:21.000000000 -0500
+++ lin_for_hsi2c/drivers/input/keyboard/Kconfig	2007-05-09 14:48:03.000000000 -0500
@@ -214,6 +214,16 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
+config KEYBOARD_TWL4030
+	tristate "TI TWL4030 keypad support"
+	depends on TWL4030_CORE && MACH_OMAP_2430SDP
+	help
+	  Say Y here if you want to use the OMAP TWL4030 keypad.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called omap-twl4030keypad. This driver depends on
+	  TWL4030 Core and TWL4030 GPIO I2C client driver
+
 config OMAP_PS2
 	tristate "TI OMAP Innovator 1510 PS/2 keyboard & mouse support"
 	depends on ARCH_OMAP15XX && MACH_OMAP_INNOVATOR

diff -purN linux-omap/drivers/input/keyboard/Makefile lin_for_hsi2c/drivers/input/keyboard/Makefile
--- linux-omap/drivers/input/keyboard/Makefile	2007-05-07 20:59:21.000000000 -0500
+++ lin_for_hsi2c/drivers/input/keyboard/Makefile	2007-05-09 14:48:03.000000000 -0500
@@ -23,4 +23,4 @@ obj-$(CONFIG_KEYBOARD_PXA27x)		+= pxa27x
 obj-$(CONFIG_KEYBOARD_AAED2000)         += aaed2000_kbd.o
 obj-$(CONFIG_KEYBOARD_GPIO)		+= gpio_keys.o
 obj-$(CONFIG_KEYBOARD_TSC2301)		+= tsc2301_kp.o
-
+obj-$(CONFIG_KEYBOARD_TWL4030)	  += omap-twl4030keypad.o
diff -purN linux-omap/drivers/input/keyboard/omap-twl4030keypad.c lin_for_hsi2c/drivers/input/keyboard/omap-twl4030keypad.c
--- linux-omap/drivers/input/keyboard/omap-twl4030keypad.c	1969-12-31 18:00:00.000000000 -0600
+++ lin_for_hsi2c/drivers/input/keyboard/omap-twl4030keypad.c	2007-05-10 14:25:09.000000000 -0500
@@ -0,0 +1,406 @@
+/*
+ * drivers/input/keyboard/omap-twl4030keypad.c
+ *
+ * Copyright (C) 2007 Texas Instruments, Inc.
+ *
+ * Code re-written for 2430SDP by:
+ * Syed Mohammed Khasim <x0khasim@ti.com>
+ *
+ * Initial Code:
+ * Manjunatha G K <manjugk@ti.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/types.h>
+#include <linux/input.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <asm/irq.h>
+#include <asm/arch/keypad.h>
+#include <asm/arch/twl4030.h>
+#include "twl4030-keypad.h"
+
+#define OMAP_TWL4030KP_LOG_LEVEL	1
+
+#define KEY(col, row, val)	(((col) << 28) | ((row) << 24) | (val))
+#define NUM_ROWS		5
+#define NUM_COLS		6
+
+#define ROW_MASK		((1<<NUM_ROWS)-1)
+
+#define SCAN_RATE		HZ/20
+#define KEYNUM_MASK		0xFF000000
+#define ROWCOL_MASK		0x00FFFFFF
+
+#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
+char *switch_name[NUM_ROWS][NUM_COLS] = {
+	{"S2_L", "S2_D", "S2_S", "S3", "S4", "S23"},
+	{"S2_R", "S2_U", "S5", "S6", "S7", "S24"},
+	{"S8", "S9", "S10", "S11", "S12", "S25"},
+	{"S13", "S14", "S15", "S16", "S17", "S26"},
+	{"S18", "S19", "S20", "S21", "S22", "S27"},
+};
+#endif
+
+/* Global variables */
+static int *keymap;
+static unsigned char kp_state[NUM_ROWS];
+
+/* Function Templates */
+static struct input_dev *omap_twl4030kp;
+struct timer_list kptimer;
+static void omap_kp_timer(unsigned long);
+static void twl4030_kp_scan(void);
+struct work_struct timer_work;
+void twl4030_kp_work(void *data);
+void twl4030_timer_work(struct work_struct *unused);
+
+static int twl4030_kpread_u8(u32 module, u8 * data, u32 reg)
+{
+	int ret;
+
+	ret = twl4030_i2c_read_u8(module, data, reg);
+	if (ret < 0) {
+		printk(KERN_WARNING
+			"Couldn't read TWL4030 register %X - ret %d[%x]\n",
+			reg, ret, ret);
+		return ret;
+	}
+	return ret;
+}
+
+static int twl4030_kpwrite_u8(u32 module, u8 data, u32 reg)
+{
+	int ret;
+
+	ret = twl4030_i2c_write_u8(module, data, reg);
+	if (ret < 0) {
+		printk(KERN_WARNING
+			"Could not write TWL4030 register %X - ret %d[%x]\n",
+			reg, ret, ret);
+		return ret;
+	}
+	return ret;
+}
+
+static inline int omap_kp_find_key(int col, int row)
+{
+	int i, key;
+
+	key = KEY(col, row, 0);
+	for (i = 0; keymap[i] != 0; i++)
+		if ((keymap[i] & KEYNUM_MASK) == key)
+			return keymap[i] & ROWCOL_MASK;
+
+	return -EINVAL;
+}
+
+static void twl4030_kp_scan(void) {
+
+	unsigned char new_state[NUM_ROWS], changed, key_down = 0;
+	u8 col, row, spurious = 0;
+	u8 code_reg = REG_FULL_CODE_7_0;
+	int ret;
+
+	/* check for any changes */
+	ret =
+		twl4030_i2c_read(TWL4030_MODULE_KEYPAD, new_state, code_reg,
+				 NUM_ROWS);
+	if (ret < 0)
+		printk(KERN_WARNING
+			"Could not read TWL4030 register %X - ret %d[%x]\n",
+				code_reg, ret, ret);
+
+	/* check for changes and print those */
+	for (row = 0; row < NUM_ROWS; row++) {
+		changed = new_state[row] ^ kp_state[row];
+		key_down |= new_state[row];
+
+		if (changed == 0)
+			continue;
+
+		for (col = 0; col < NUM_COLS; col++) {
+			int key;
+
+			if (!(changed & (1 << col)))
+				continue;
+
+#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
+			printk("key %s %s\n", switch_name[row][col],
+				(new_state[row] & (1 << col)) ?
+				"press" : "release");
+#endif
+			key = omap_kp_find_key(col, row);
+			if (key < 0) {
+				printk(KERN_WARNING
+					"omap-kp: Spurious key event %d-%d\n",
+					col, row);
+				/* We scan again after a couple of seconds */
+				spurious = 1;
+				continue;
+			}
+			input_report_key(omap_twl4030kp, key,
+					 new_state[row] & (1 << col));
+		}
+	}
+	if (key_down) {
+		/*
+		 * some key is pressed - keep irq disabled and use timer
+		 * to poll for key release
+		 */
+		if (spurious)
+			mod_timer(&kptimer, jiffies + SCAN_RATE * 2);
+		else
+			mod_timer(&kptimer, jiffies + SCAN_RATE);
+	}
+	memcpy(kp_state, new_state, sizeof(kp_state));
+}
+
+void twl4030_timer_work(struct work_struct *unused)
+{
+	twl4030_kp_scan();
+}
+
+void omap_kp_timer(unsigned long data)
+{
+	schedule_work(&timer_work);
+}
+
+/*
+ * Keypad interrupt handler
+ */
+static irqreturn_t do_kp_irq(int irq, void *dev_id)
+{
+	u8 reg;
+	int ret;
+
+	/* Mask keypad interrupts */
+	reg = KEYP_IMR1_MASK;
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg, REG_KEYP_IMR1);
+
+	/*
+	 * Scan keypad for any changes
+	 * in keypad matrix.
+	 */
+	twl4030_kp_scan();
+
+	/* Clear TWL4030 PIH interrupt */
+	ret = twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEYP_ISR1);
+
+	/* Enable interrupts */
+	reg = KEYP_IMR1_UNMASK;
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg, REG_KEYP_IMR1);
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * Registers keypad device with input sub system
+ * and configures TWL4030 keypad registers
+ *
+ */
+static int __init omap_kp_probe(struct platform_device *pdev)
+{
+	u8 reg, i;
+	u8 code_reg = REG_FULL_CODE_7_0;
+	int ret = 0;
+	struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
+
+	if (!pdata->rows || !pdata->cols || !pdata->keymap) {
+		printk(KERN_ERR "No rows, cols or keymap from pdata\n");
+		return -EINVAL;
+	}
+
+	omap_twl4030kp = input_allocate_device();
+	if (omap_twl4030kp == NULL)
+		return -ENOMEM;
+
+	keymap = pdata->keymap;
+
+	/* setup input device */
+	set_bit(EV_KEY, omap_twl4030kp->evbit);
+
+	/* Enable auto repeat feature of Linux input subsystem */
+	set_bit(EV_REP, omap_twl4030kp->evbit);
+
+	for (i = 0; keymap[i] != 0; i++)
+		set_bit(keymap[i] & 0x00ffffff, omap_twl4030kp->keybit);
+
+	omap_twl4030kp->name 		= "omap_twl4030keypad";
+	omap_twl4030kp->phys 		= "omap_twl4030keypad/input0";
+	omap_twl4030kp->dev.parent 	= &pdev->dev;
+
+	omap_twl4030kp->id.bustype	= BUS_HOST;
+	omap_twl4030kp->id.vendor	= 0x0001;
+	omap_twl4030kp->id.product	= 0x0001;
+	omap_twl4030kp->id.version	= 0x0003;
+
+	omap_twl4030kp->keycode		= keymap;
+	omap_twl4030kp->keycodesize	= sizeof(unsigned int);
+	omap_twl4030kp->keycodemax	= pdata->keymapsize;
+
+	ret = input_register_device(omap_twl4030kp);
+	if (ret < 0) {
+		printk(KERN_ERR "Unable to register twl4030 keypad device\n");
+		goto err2;
+	}
+
+	setup_timer(&kptimer,omap_kp_timer,(unsigned long) omap_twl4030kp);
+
+	/*
+	 * Since keypad driver uses I2C for reading
+	 * twl4030 keypad registers, tasklets cannot
+	 * be used.
+ 	 */
+	INIT_WORK(&timer_work, twl4030_timer_work);
+
+	reg = KEYP_CTRL_REG_MASK_NOAUTORPT;
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg,
+						REG_KEYP_CTRL_REG);
+	if (ret < 0) goto err3;
+
+	/* Set all events to Falling Edge detection */
+	reg = KEYP_EDR_MASK;
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg, REG_KEYP_EDR);
+	if (ret < 0) goto err3;
+
+	/* Set Pre Scalar Field PTV to 4 */
+	reg = BIT_LK_PTV_REG_PTV_M & (BIT_PTV_REG_PTV4 << BIT_LK_PTV_REG_PTV);
+
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg, REG_LK_PTV_REG);
+	if (ret < 0) goto err3;
+
+	/*
+	 * Set key debounce time to 10 ms using equation
+	 * Tint = Tclk * (LOAD_TIM+1) * 2^(PTV+1)
+	 * Where Tclk = 31.25 us ( since kbd_if_clk is 32KHz)
+	 * PTV = 4 for all the operations.
+	 */
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, 0x3f,
+						REG_KEY_DEB_REG);
+	if (ret < 0) goto err3;
+
+	/* Set SIH Ctrl register */
+	reg = KEYP_SIH_CTRL_MASK;
+	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg,
+						REG_KEYP_SIH_CTRL);
+	if (ret < 0) goto err3;
+
+	/*
+	 * This ISR will always execute in kernel thread context because of
+	 * the need to access the TWL4030 over the I2C bus.
+	 */
+	ret = request_irq(TWL4030_MODIRQ_KEYPAD, do_kp_irq,
+		IRQF_DISABLED, "TWL4030 Keypad", omap_twl4030kp);
+	if (ret < 0) {
+		printk(KERN_INFO
+				"request_irq failed for irq no=%d\n",
+				TWL4030_MODIRQ_KEYPAD);
+		goto err3;
+	} else {
+		/* Enable keypad module interrupts now. */
+		reg = KEYP_IMR1_UNMASK;
+		ret =
+			twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg,
+						REG_KEYP_IMR1);
+		if (ret < 0) {
+			/* mask all events - dont care abt result */
+			(void)twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, 0xff,
+						 REG_KEYP_IMR1);
+			goto err4;
+		}
+	}
+
+#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
+	printk
+	  ("****TWL4030 keypad module configuration registers dump****\n");
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEYP_CTRL_REG);
+	printk("Register REG_KEYP_CTRL_REG : %X\n", reg);
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEYP_EDR);
+	printk("Register REG_KEYP_EDR: %X\n", reg);
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_LK_PTV_REG);
+	printk("Register REG_LK_PTV_REG: %X\n", reg);
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEY_DEB_REG);
+	printk("Register REG_KEY_DEB_REG: %X\n", reg);
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_LONG_KEY_REG1);
+	printk("Register REG_LONG_KEY_REG1: %X\n", reg);
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEYP_SIH_CTRL);
+	printk("Register REG_KEYP_SIH_CTRL: %X\n", reg);
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEYP_IMR1);
+	printk("Register REG_KEYP_IMR1: %X\n", reg);
+	printk("****************END******************\n");
+#endif
+	/* Read initial state of keypad matrix. */
+	ret = twl4030_i2c_read(TWL4030_MODULE_KEYPAD, kp_state, code_reg,
+		NUM_ROWS);
+	if (ret < 0) {
+		printk(KERN_WARNING
+				"Could not read TWL4030 register %X - ret %d[%x]\n",
+				reg, ret, ret);
+		goto err4;
+	}
+	return (ret);
+err4:
+	free_irq(TWL4030_MODIRQ_KEYPAD, NULL);
+err3:
+	input_unregister_device(omap_twl4030kp);
+err2:
+	input_free_device(omap_twl4030kp);
+	return -ENODEV;
+}
+
+static int omap_kp_remove(struct platform_device *pdev)
+{
+	free_irq(TWL4030_MODIRQ_KEYPAD, NULL);
+	del_timer_sync(&kptimer);
+
+	input_unregister_device(omap_twl4030kp);
+	return 0;
+}
+
+
+static struct platform_driver omap_kp_driver = {
+	.probe		= omap_kp_probe,
+	.remove		= omap_kp_remove,
+	.driver		= {
+		.name	= "omap_twl4030keypad",
+	},
+};
+
+/*
+ * OMAP TWL4030 Keypad init
+ */
+static int __devinit omap_kp_init(void)
+{
+	printk(KERN_INFO "OMAP TWL4030 Keypad Driver\n");
+	return platform_driver_register(&omap_kp_driver);
+}
+
+static void __exit omap_kp_exit(void)
+{
+	platform_driver_unregister(&omap_kp_driver);
+}
+
+module_init(omap_kp_init);
+module_exit(omap_kp_exit);
+MODULE_AUTHOR("Texas Instruments");
+MODULE_DESCRIPTION("OMAP TWL4030 Keypad Driver");
+MODULE_LICENSE("GPL");

diff -purN linux-omap/drivers/input/keyboard/twl4030-keypad.h lin_for_hsi2c/drivers/input/keyboard/twl4030-keypad.h
--- linux-omap/drivers/input/keyboard/twl4030-keypad.h	1969-12-31 18:00:00.000000000 -0600
+++ lin_for_hsi2c/drivers/input/keyboard/twl4030-keypad.h	2007-05-10 12:18:11.000000000 -0500
@@ -0,0 +1,376 @@
+/*
+ * drivers/input/keyboard/twl4030-keypad.h
+ *
+ * Copyright (C) 2006-2007 Texas Instruments, Inc.
+ *
+ * Intial Code:
+ *	Syed Mohammed Khasim <x0khasim@ti.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef __TWL4030_KEYPAD_H__
+#define __TWL4030_KEYPAD_H__
+
+/* Register Definitions */
+#define REG_KEYP_CTRL_REG			(0x0)
+#define REG_KEY_DEB_REG				(0x1)
+#define REG_LONG_KEY_REG1			(0x2)
+#define REG_LK_PTV_REG				(0x3)
+#define REG_TIME_OUT_REG1			(0x4)
+#define REG_TIME_OUT_REG2			(0x5)
+#define REG_KBC_REG				(0x6)
+#define REG_KBR_REG				(0x7)
+#define REG_KEYP_SMS				(0x8)
+#define REG_FULL_CODE_7_0			(0x9)
+#define REG_FULL_CODE_15_8			(0xA)
+#define REG_FULL_CODE_23_16			(0xB)
+#define REG_FULL_CODE_31_24			(0xC)
+#define REG_FULL_CODE_39_32			(0xD)
+#define REG_FULL_CODE_47_40			(0xE)
+#define REG_FULL_CODE_55_48			(0xF)
+#define REG_FULL_CODE_63_56			(0x10)
+#define REG_KEYP_ISR1				(0x11)
+#define REG_KEYP_IMR1				(0x12)
+#define REG_KEYP_ISR2				(0x13)
+#define REG_KEYP_IMR2				(0x14)
+#define REG_KEYP_SIR				(0x15)
+#define REG_KEYP_EDR				(0x16)
+#define REG_KEYP_SIH_CTRL			(0x17)
+
+/* BitField Definitions */
+
+/* KEYP_CTRL_REG Fields */
+#define BIT_KEYP_CTRL_REG_SOFT_NRST		(0x000)
+#define BIT_KEYP_CTRL_REG_SOFT_NRST_M		(0x00000001)
+#define BIT_KEYP_CTRL_REG_SOFTMODEN		(0x001)
+#define BIT_KEYP_CTRL_REG_SOFTMODEN_M		(0x00000002)
+#define BIT_KEYP_CTRL_REG_LK_EN			(0x002)
+#define BIT_KEYP_CTRL_REG_LK_EN_M		(0x00000004)
+#define BIT_KEYP_CTRL_REG_TOE_EN		(0x003)
+#define BIT_KEYP_CTRL_REG_TOE_EN_M		(0x00000008)
+#define BIT_KEYP_CTRL_REG_TOLE_EN		(0x004)
+#define BIT_KEYP_CTRL_REG_TOLE_EN_M		(0x00000010)
+#define BIT_KEYP_CTRL_REG_RP_EN			(0x005)
+#define BIT_KEYP_CTRL_REG_RP_EN_M		(0x00000020)
+#define BIT_KEYP_CTRL_REG_KBD_ON		(0x006)
+#define BIT_KEYP_CTRL_REG_KBD_ON_M		(0x00000040)
+
+#define KEYP_CTRL_REG_MASK_AUTORPT		BIT_KEYP_CTRL_REG_SOFT_NRST_M |\
+						BIT_KEYP_CTRL_REG_RP_EN_M |\
+						BIT_KEYP_CTRL_REG_SOFTMODEN_M |\
+								BIT_KEYP_CTRL_REG_KBD_ON_M
+
+#define KEYP_CTRL_REG_MASK_NOAUTORPT		BIT_KEYP_CTRL_REG_SOFT_NRST_M |\
+						BIT_KEYP_CTRL_REG_SOFTMODEN_M |\
+						BIT_KEYP_CTRL_REG_KBD_ON_M
+
+/* KEY_DEB_REG Fields */
+#define BIT_KEY_DEB_REG_KEYP_DEB		(0x000)
+#define BIT_KEY_DEB_REG_KEYP_DEB_M		(0x0000003F)
+#define BIT_KEY_DEB9				(0x9)
+
+/* LONG_KEY_REG1 Fields */
+#define BIT_LONG_KEY_REG1_LSB_LK		(0x000)
+#define BIT_LONG_KEY_REG1_LSB_LK_M		(0x000000FF)
+#define BIT_LONG_KEY_100MS			(0x63)
+
+/* LK_PTV_REG Fields */
+#define BIT_LK_PTV_REG_MSB_LK			(0x000)
+#define BIT_LK_PTV_REG_MSB_LK_M			(0x0000000F)
+#define BIT_LK_PTV_REG_PTV			(0x005)
+#define BIT_LK_PTV_REG_PTV_M			(0x000000E0)
+#define BIT_PTV_REG_PTV4			(0x4)
+
+/* TIME_OUT_REG1 Fields */
+#define BIT_TIME_OUT_REG1_LSB_TO		(0x000)
+#define BIT_TIME_OUT_REG1_LSB_TO_M		(0x000000FF)
+
+/* TIME_OUT_REG2 Fields */
+#define BIT_TIME_OUT_REG2_MSB_TO		(0x000)
+#define BIT_TIME_OUT_REG2_MSB_TO_M		(0x000000FF)
+
+/* KBC_REG Fields */
+#define BIT_KBC_REG_KBC0			(0x000)
+#define BIT_KBC_REG_KBC0_M			(0x00000001)
+#define BIT_KBC_REG_KBC1			(0x001)
+#define BIT_KBC_REG_KBC1_M			(0x00000002)
+#define BIT_KBC_REG_KBC2			(0x002)
+#define BIT_KBC_REG_KBC2_M			(0x00000004)
+#define BIT_KBC_REG_KBC3			(0x003)
+#define BIT_KBC_REG_KBC3_M			(0x00000008)
+#define BIT_KBC_REG_KBC4			(0x004)
+#define BIT_KBC_REG_KBC4_M			(0x00000010)
+#define BIT_KBC_REG_KBC5			(0x005)
+#define BIT_KBC_REG_KBC5_M			(0x00000020)
+#define BIT_KBC_REG_KBC6			(0x006)
+#define BIT_KBC_REG_KBC6_M			(0x00000040)
+#define BIT_KBC_REG_KBC7			(0x007)
+#define BIT_KBC_REG_KBC7_M			(0x00000080)
+
+/* KBR_REG Fields */
+#define BIT_KBR_REG_KBR0			(0x000)
+#define BIT_KBR_REG_KBR0_M			(0x00000001)
+#define BIT_KBR_REG_KBR1			(0x001)
+#define BIT_KBR_REG_KBR1_M			(0x00000002)
+#define BIT_KBR_REG_KBR2			(0x002)
+#define BIT_KBR_REG_KBR2_M			(0x00000004)
+#define BIT_KBR_REG_KBR3			(0x003)
+#define BIT_KBR_REG_KBR3_M			(0x00000008)
+#define BIT_KBR_REG_KBR4			(0x004)
+#define BIT_KBR_REG_KBR4_M			(0x00000010)
+#define BIT_KBR_REG_KBR5			(0x005)
+#define BIT_KBR_REG_KBR5_M			(0x00000020)
+#define BIT_KBR_REG_KBR6			(0x006)
+#define BIT_KBR_REG_KBR6_M			(0x00000040)
+#define BIT_KBR_REG_KBR7			(0x007)
+#define BIT_KBR_REG_KBR7_M			(0x00000080)
+
+/* KEYP_SMS Fields */
+#define BIT_KEYP_SMS_STMSTS			(0x000)
+#define BIT_KEYP_SMS_STMSTS_M			(0x0000000F)
+#define BIT_KEYP_SMS_SIR_EN			(0x004)
+#define BIT_KEYP_SMS_SIR_EN_M			(0x00000010)
+#define BIT_KEYP_SMS_MISS_EN			(0x005)
+#define BIT_KEYP_SMS_MISS_EN_M			(0x00000020)
+
+/* FULL_CODE_7_0 Fields */
+#define BIT_FULL_CODE_7_0_FULL_CODE_K0		(0x000)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K0_M	(0x00000001)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K1		(0x001)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K1_M	(0x00000002)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K2		(0x002)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K2_M	(0x00000004)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K3		(0x003)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K3_M	(0x00000008)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K4		(0x004)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K4_M	(0x00000010)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K5		(0x005)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K5_M	(0x00000020)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K6		(0x006)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K6_M	(0x00000040)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K7		(0x007)
+#define BIT_FULL_CODE_7_0_FULL_CODE_K7_M	(0x00000080)
+
+/* FULL_CODE_15_8 Fields */
+#define BIT_FULL_CODE_15_8_FULL_CODE_K8		(0x000)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K8_M	(0x00000001)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K9		(0x001)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K9_M	(0x00000002)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K10	(0x002)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K10_M	(0x00000004)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K11	(0x003)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K11_M	(0x00000008)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K12	(0x004)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K12_M	(0x00000010)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K13	(0x005)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K13_M	(0x00000020)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K14	(0x006)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K14_M	(0x00000040)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K15	(0x007)
+#define BIT_FULL_CODE_15_8_FULL_CODE_K15_M	(0x00000080)
+
+/* FULL_CODE_23_16 Fields */
+#define BIT_FULL_CODE_23_16_FULL_CODE_K16	(0x000)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K16_M	(0x00000001)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K17	(0x001)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K17_M	(0x00000002)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K18	(0x002)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K18_M	(0x00000004)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K19	(0x003)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K19_M	(0x00000008)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K20	(0x004)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K20_M	(0x00000010)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K21	(0x005)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K21_M	(0x00000020)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K22	(0x006)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K22_M	(0x00000040)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K23	(0x007)
+#define BIT_FULL_CODE_23_16_FULL_CODE_K23_M	(0x00000080)
+
+/* FULL_CODE_31_24 Fields */
+#define BIT_FULL_CODE_31_24_FULL_CODE_K24	(0x000)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K24_M	(0x00000001)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K25	(0x001)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K25_M	(0x00000002)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K26	(0x002)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K26_M	(0x00000004)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K27	(0x003)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K27_M	(0x00000008)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K28	(0x004)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K28_M	(0x00000010)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K29	(0x005)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K29_M	(0x00000020)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K30	(0x006)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K30_M	(0x00000040)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K31	(0x007)
+#define BIT_FULL_CODE_31_24_FULL_CODE_K31_M	(0x00000080)
+
+/* FULL_CODE_39_32 Fields */
+#define BIT_FULL_CODE_39_32_FULL_CODE_K32	(0x000)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K32_M	(0x00000001)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K33	(0x001)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K33_M	(0x00000002)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K34	(0x002)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K34_M	(0x00000004)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K35	(0x003)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K35_M	(0x00000008)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K36	(0x004)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K36_M	(0x00000010)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K37	(0x005)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K37_M	(0x00000020)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K38	(0x006)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K38_M	(0x00000040)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K39	(0x007)
+#define BIT_FULL_CODE_39_32_FULL_CODE_K39_M	(0x00000080)
+
+/* FULL_CODE_47_40 Fields */
+#define BIT_FULL_CODE_47_40_FULL_CODE_K40	(0x000)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K40_M	(0x00000001)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K41	(0x001)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K41_M	(0x00000002)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K42	(0x002)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K42_M	(0x00000004)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K43	(0x003)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K43_M	(0x00000008)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K44	(0x004)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K44_M	(0x00000010)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K45	(0x005)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K45_M	(0x00000020)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K46	(0x006)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K46_M	(0x00000040)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K47	(0x007)
+#define BIT_FULL_CODE_47_40_FULL_CODE_K47_M	(0x00000080)
+
+/* FULL_CODE_55_48 Fields */
+#define BIT_FULL_CODE_55_48_FULL_CODE_K48	(0x000)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K48_M	(0x00000001)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K49	(0x001)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K49_M	(0x00000002)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K50	(0x002)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K50_M	(0x00000004)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K51	(0x003)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K51_M	(0x00000008)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K52	(0x004)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K52_M	(0x00000010)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K53	(0x005)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K53_M	(0x00000020)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K54	(0x006)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K54_M	(0x00000040)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K55	(0x007)
+#define BIT_FULL_CODE_55_48_FULL_CODE_K55_M	(0x00000080)
+
+/* FULL_CODE_63_56 Fields */
+#define BIT_FULL_CODE_63_56_FULL_CODE_K56	(0x000)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K56_M	(0x00000001)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K57	(0x001)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K57_M	(0x00000002)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K58	(0x002)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K58_M	(0x00000004)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K59	(0x003)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K59_M	(0x00000008)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K60	(0x004)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K60_M	(0x00000010)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K61	(0x005)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K61_M	(0x00000020)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K62	(0x006)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K62_M	(0x00000040)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K63	(0x007)
+#define BIT_FULL_CODE_63_56_FULL_CODE_K63_M	(0x00000080)
+
+/* KEYP_ISR1 Fields */
+#define BIT_KEYP_ISR1_ITKPISR1			(0x000)
+#define BIT_KEYP_ISR1_ITKPISR1_M		(0x00000001)
+#define BIT_KEYP_ISR1_ITLKISR1			(0x001)
+#define BIT_KEYP_ISR1_ITLKISR1_M		(0x00000002)
+#define BIT_KEYP_ISR1_ITTOISR1			(0x002)
+#define BIT_KEYP_ISR1_ITTOISR1_M		(0x00000004)
+#define BIT_KEYP_ISR1_ITMISR1			(0x003)
+#define BIT_KEYP_ISR1_ITMISR1_M			(0x00000008)
+#define KEYP_ISR1_CLEAR				(0x0F)
+
+/* KEYP_IMR1 Fields */
+#define BIT_KEYP_IMR1_ITKPIMR1			(0x000)
+#define BIT_KEYP_IMR1_ITKPIMR1_M		(0x00000001)
+#define BIT_KEYP_IMR1_ITLKIMR1			(0x001)
+#define BIT_KEYP_IMR1_ITLKIMR1_M		(0x00000002)
+#define BIT_KEYP_IMR1_ITTOIMR1			(0x002)
+#define BIT_KEYP_IMR1_ITTOIMR1_M		(0x00000004)
+#define BIT_KEYP_IMR1_ITMISIMR1			(0x003)
+#define BIT_KEYP_IMR1_ITMISIMR1_M		(0x00000008)
+#define KEYP_IMR1_MASK				(0x0F)
+#define KEYP_IMR1_UNMASK			(0x00)
+
+/* KEYP_ISR2 Fields */
+#define BIT_KEYP_ISR2_ITKPISR2			(0x000)
+#define BIT_KEYP_ISR2_ITKPISR2_M		(0x00000001)
+#define BIT_KEYP_ISR2_ITLKISR2			(0x001)
+#define BIT_KEYP_ISR2_ITLKISR2_M		(0x00000002)
+#define BIT_KEYP_ISR2_ITTOISR2			(0x002)
+#define BIT_KEYP_ISR2_ITTOISR2_M		(0x00000004)
+#define BIT_KEYP_ISR2_ITMISR2			(0x003)
+#define BIT_KEYP_ISR2_ITMISR2_M			(0x00000008)
+
+/* KEYP_IMR2 Fields */
+#define BIT_KEYP_IMR2_ITKPIMR2			(0x000)
+#define BIT_KEYP_IMR2_ITKPIMR2_M		(0x00000001)
+#define BIT_KEYP_IMR2_ITLKIMR2			(0x001)
+#define BIT_KEYP_IMR2_ITLKIMR2_M		(0x00000002)
+#define BIT_KEYP_IMR2_ITTOIMR2			(0x002)
+#define BIT_KEYP_IMR2_ITTOIMR2_M		(0x00000004)
+#define BIT_KEYP_IMR2_ITMISIMR2			(0x003)
+#define BIT_KEYP_IMR2_ITMISIMR2_M		(0x00000008)
+
+/* KEYP_SIR Fields */
+#define BIT_KEYP_SIR_ITKPSIR			(0x000)
+#define BIT_KEYP_SIR_ITKPSIR_M			(0x00000001)
+#define BIT_KEYP_SIR_ITLKSIR			(0x001)
+#define BIT_KEYP_SIR_ITLKSIR_M			(0x00000002)
+#define BIT_KEYP_SIR_ITTOSIR			(0x002)
+#define BIT_KEYP_SIR_ITTOSIR_M			(0x00000004)
+#define BIT_KEYP_SIR_ITMISSIR			(0x003)
+#define BIT_KEYP_SIR_ITMISSIR_M			(0x00000008)
+
+/* KEYP_EDR Fields */
+#define BIT_KEYP_EDR_ITKPFALLING		(0x000)
+#define BIT_KEYP_EDR_ITKPFALLING_M		(0x00000001)
+#define BIT_KEYP_EDR_ITKPRISING			(0x001)
+#define BIT_KEYP_EDR_ITKPRISING_M		(0x00000002)
+#define BIT_KEYP_EDR_ITLKFALLING		(0x002)
+#define BIT_KEYP_EDR_ITLKFALLING_M		(0x00000004)
+#define BIT_KEYP_EDR_ITLKRISING			(0x003)
+#define BIT_KEYP_EDR_ITLKRISING_M		(0x00000008)
+#define BIT_KEYP_EDR_ITTOFALLING		(0x004)
+#define BIT_KEYP_EDR_ITTOFALLING_M		(0x00000010)
+#define BIT_KEYP_EDR_ITTORISING			(0x005)
+#define BIT_KEYP_EDR_ITTORISING_M		(0x00000020)
+#define BIT_KEYP_EDR_ITMISFALLING		(0x006)
+#define BIT_KEYP_EDR_ITMISFALLING_M		(0x00000040)
+#define BIT_KEYP_EDR_ITMISRISING		(0x007)
+#define BIT_KEYP_EDR_ITMISRISING_M		(0x00000080)
+
+#define KEYP_EDR_MASK				BIT_KEYP_EDR_ITKPFALLING_M |\
+						BIT_KEYP_EDR_ITLKFALLING_M |\
+						BIT_KEYP_EDR_ITTOFALLING_M |\
+						BIT_KEYP_EDR_ITMISFALLING_M
+/* KEYP_SIH_CTRL Fields */
+#define BIT_KEYP_SIH_CTRL_EXCLEN		(0x000)
+#define BIT_KEYP_SIH_CTRL_EXCLEN_M		(0x00000001)
+#define BIT_KEYP_SIH_CTRL_PENDDIS		(0x001)
+#define BIT_KEYP_SIH_CTRL_PENDDIS_M		(0x00000002)
+#define BIT_KEYP_SIH_CTRL_COR			(0x002)
+#define BIT_KEYP_SIH_CTRL_COR_M			(0x00000004)
+#define KEYP_SIH_CTRL_MASK			(0x04)
+
+#endif	/* End of __TWL4030-KEYPAD_H__ */

--- linux-omap/arch/arm/mach-omap2/board-2430sdp.c	2007-05-09 00:30:56.000000000 -0500
+++ lin_for_hsi2c/arch/arm/mach-omap2/board-2430sdp.c	2007-05-09 14:48:03.000000000 -0500
@@ -19,6 +19,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/delay.h>
+#include <linux/input.h>
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/spi/spi.h>
@@ -34,6 +35,7 @@
 #include <asm/arch/mux.h>
 #include <asm/arch/board.h>
 #include <asm/arch/common.h>
+#include <asm/arch/keypad.h>
 #include <asm/arch/gpmc.h>
 #include <asm/arch/mcspi.h>
 #include "prcm-regs.h"
@@ -120,9 +122,64 @@ static struct platform_device sdp2430_sm
 	.resource	= sdp2430_smc91x_resources,
 };
 
+/*
+ * Key mapping for 2430 SDP board
+ */
+
+static int sdp2430_keymap[] = {
+	KEY(0, 0, KEY_LEFT),
+	KEY(0, 1, KEY_RIGHT),
+	KEY(0, 2, KEY_A),
+	KEY(0, 3, KEY_B),
+	KEY(0, 4, KEY_C),
+	KEY(1, 0, KEY_DOWN),
+	KEY(1, 1, KEY_UP),
+	KEY(1, 2, KEY_E),
+	KEY(1, 3, KEY_F),
+	KEY(1, 4, KEY_G),
+	KEY(2, 0, KEY_ENTER),
+	KEY(2, 1, KEY_I),
+	KEY(2, 2, KEY_J),
+	KEY(2, 3, KEY_K),
+	KEY(2, 4, KEY_3),
+	KEY(3, 0, KEY_M),
+	KEY(3, 1, KEY_N),
+	KEY(3, 2, KEY_O),
+	KEY(3, 3, KEY_P),
+	KEY(3, 4, KEY_Q),
+	KEY(4, 0, KEY_R),
+	KEY(4, 1, KEY_4),
+	KEY(4, 2, KEY_T),
+	KEY(4, 3, KEY_U),
+	KEY(4, 4, KEY_D),
+	KEY(5, 0, KEY_V),
+	KEY(5, 1, KEY_W),
+	KEY(5, 2, KEY_L),
+	KEY(5, 3, KEY_S),
+	KEY(5, 4, KEY_H),
+	0
+};
+
+static struct omap_kp_platform_data sdp2430_kp_data = {
+	.rows		= 5,
+	.cols		= 6,
+	.keymap 	= sdp2430_keymap,
+	.keymapsize 	= ARRAY_SIZE(sdp2430_keymap),
+	.rep		= 1,
+};
+
+static struct platform_device sdp2430_kp_device = {
+	.name		= "omap_twl4030keypad",
+	.id		= -1,
+	.dev		= {
+		.platform_data = &sdp2430_kp_data,
+	},
+};
+
 static struct platform_device *sdp2430_devices[] __initdata = {
 	&sdp2430_smc91x_device,
 	&sdp2430_flash_device,
+	&sdp2430_kp_device,
 };
 
 static struct tsc2046_platform_data tsc2046_config = {

diff -purN linux-omap/include/asm-arm/arch-omap/board-2430sdp.h lin_for_hsi2c/include/asm-arm/arch-omap/board-2430sdp.h
--- linux-omap/include/asm-arm/arch-omap/board-2430sdp.h	2006-12-17 08:56:42.000000000 -0600
+++ lin_for_hsi2c/include/asm-arm/arch-omap/board-2430sdp.h	2007-05-09 14:48:03.000000000 -0500
@@ -30,7 +30,7 @@
 #define __ASM_ARCH_OMAP_2430SDP_H
 
 /* Placeholder for 2430SDP specific defines */
-#define OMAP24XX_ETHR_START		 0x08000300
+#define OMAP24XX_ETHR_START		0x08000300
 #define OMAP24XX_ETHR_GPIO_IRQ		149
 #define SDP2430_CS0_BASE		0x04000000
 
@@ -39,6 +39,10 @@
 /* TWL4030 Primary Interrupt Handler (PIH) interrupts */
 #define IH_TWL4030_BASE			IH_BOARD_BASE
 #define IH_TWL4030_END			(IH_TWL4030_BASE+8)
-#define NR_IRQS				(IH_TWL4030_END)
+
+/* TWL4030 GPIO Interrupts */
+#define IH_TWL4030_GPIO_BASE		(IH_TWL4030_END)
+#define IH_TWL4030_GPIO_END		(IH_TWL4030_BASE+18)
+#define NR_IRQS				(IH_TWL4030_GPIO_END)
 
 #endif /* __ASM_ARCH_OMAP_2430SDP_H */

diff -purN linux-omap/include/asm-arm/arch-omap/twl4030.h lin_for_hsi2c/include/asm-arm/arch-omap/twl4030.h
--- linux-omap/include/asm-arm/arch-omap/twl4030.h	2007-01-08 18:57:20.000000000 -0600
+++ lin_for_hsi2c/include/asm-arm/arch-omap/twl4030.h	2007-05-09 14:48:03.000000000 -0500
@@ -72,6 +72,23 @@
 #define TWL4030_VAUX3_DEV_GRP		0x1F
 #define TWL4030_VAUX3_DEDICATED		0x22
 
+/* TWL4030 GPIO interrupt definitions */
+
+#define TWL4030_GPIO_MIN		0
+#define TWL4030_GPIO_MAX		18
+#define TWL4030_GPIO_MAX_CD		2
+#define TWL4030_GPIO_IRQ_NO(n)		(IH_TWL4030_GPIO_BASE+n)
+#define TWL4030_GPIO_IS_INPUT		1
+#define TWL4030_GPIO_IS_OUTPUT		0
+#define TWL4030_GPIO_IS_ENABLE		1
+#define TWL4030_GPIO_IS_DISABLE		0
+#define TWL4030_GPIO_PULL_UP		0
+#define TWL4030_GPIO_PULL_DOWN		1
+#define TWL4030_GPIO_PULL_NONE		2
+#define TWL4030_GPIO_EDGE_NONE		0
+#define TWL4030_GPIO_EDGE_RISING	1
+#define TWL4030_GPIO_EDGE_FALLING	2
+
 /* Functions to read and write from TWL4030 */
 
 /*

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-10 19:40 [PATCH] TWL4030 Keypad driver - incorporated review comments Syed Mohammed, Khasim
@ 2007-05-11  0:04 ` nishanth menon
  2007-05-11  0:19   ` Syed Mohammed, Khasim
  0 siblings, 1 reply; 12+ messages in thread
From: nishanth menon @ 2007-05-11  0:04 UTC (permalink / raw)
  To: Syed Mohammed, Khasim; +Cc: linux-omap-open-source

One Tiny comment to save a lot of bytes in git database header file ;):
On 5/10/07, Syed Mohammed, Khasim <x0khasim@ti.com> wrote:
> +#define BIT_KEYP_CTRL_REG_SOFTMODEN            (0x001)
> +#define BIT_KEYP_CTRL_REG_SOFTMODEN_M          (0x00000002)
<snip>
> +#define BIT_TIME_OUT_REG1_LSB_TO               (0x000)
> +#define BIT_TIME_OUT_REG1_LSB_TO_M             (0x000000FF)
<snip>
why not have a single bit mask as follows:
#define MASK(OFFSET,NUMBITS) \
                (((0x1<<(NUMBITS))-1)<<(OFFSET))
#define MASK_1BIT(REG) (MASK((REG),1))
Or
#define MASK_1BIT(OFFSET) (0x1<<(OFFSET))

For the fields with more than one bits..
#define BIT_TIME_OUT_REG1_LSB_TO_BITS             (8)
MASK(OFFSET,NUMBITS)
and Just define the offsets.. i'd say that will save some bytes of
header file and bit more readable I think instead of figuring out _M
means a mask... :D Compiler with optimization is be able to get the
consts precompute and put them up as a single val..Here is my
verification process:
CODE:
#define BIT_KEYP_CTRL_REG_SOFTMODEN            (0x001)
#define BIT_KEYP_CTRL_REG_SOFTMODEN_M          (0x00000002)
#define MASK(OFFSET,NUMBITS) \
                (((0x1<<(NUMBITS))-1)<<(OFFSET))
#define MASK_1BIT(OFFSET) (1<<(OFFSET))
/* TIME_OUT_REG1 Fields */
#define BIT_TIME_OUT_REG1_LSB_TO               (0x000)
#define BIT_TIME_OUT_REG1_LSB_TO_M             (0x000000FF)
void some(unsigned int *i)
{
        *i = MASK_1BIT(BIT_KEYP_CTRL_REG_SOFTMODEN);
        //*i = BIT_KEYP_CTRL_REG_SOFTMODEN_M;
        //*i = MASK(BIT_TIME_OUT_REG1_LSB_TO,8);
        //*i = BIT_TIME_OUT_REG1_LSB_TO_M;
}
enable each line and see object file created..
(CodeSourcery ARM Sourcery G++ 2006q3-26) 4.1.1
 arm-none-linux-gnueabi-gcc -O3 -c -Wall -o a.o and
arm-none-linux-gnueabi-objdump -D a.o it looks as follows:
        *i = MASK_1BIT(BIT_KEYP_CTRL_REG_SOFTMODEN);
00000000 <some>:
   0:   e3a03002        mov     r3, #2  ; 0x2
   4:   e5803000        str     r3, [r0]
   8:   e12fff1e        bx      lr
 *i = BIT_KEYP_CTRL_REG_SOFTMODEN_M;
00000000 <some>:
   0:   e3a03002        mov     r3, #2  ; 0x2
   4:   e5803000        str     r3, [r0]
   8:   e12fff1e        bx      lr
*i = MASK(BIT_TIME_OUT_REG1_LSB_TO,8);
00000000 <some>:
   0:   e3a030ff        mov     r3, #255        ; 0xff
   4:   e5803000        str     r3, [r0]
   8:   e12fff1e        bx      lr
*i = BIT_TIME_OUT_REG1_LSB_TO_M;
00000000 <some>:
   0:   e3a030ff        mov     r3, #255        ; 0xff
   4:   e5803000        str     r3, [r0]
   8:   e12fff1e        bx      lr
They all match as to the expected.. so there is my 2 cents... :)
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-11  0:04 ` nishanth menon
@ 2007-05-11  0:19   ` Syed Mohammed, Khasim
  2007-05-11  1:00     ` Nishanth Menon
  0 siblings, 1 reply; 12+ messages in thread
From: Syed Mohammed, Khasim @ 2007-05-11  0:19 UTC (permalink / raw)
  To: nishanth menon; +Cc: linux-omap-open-source

Nishanth,

Thanks for comments.

>
>One Tiny comment to save a lot of bytes in git database header file ;):

Agreed,

>For the fields with more than one bits..
>#define BIT_TIME_OUT_REG1_LSB_TO_BITS             (8)
>MASK(OFFSET,NUMBITS)
>and Just define the offsets.. i'd say that will save some bytes of
>header file and bit more readable I think instead of figuring out _M
>means a mask... :D Compiler with optimization is be able to get the
>consts precompute and put them up as a single val..Here is my
>verification process:

I feel like not doing this, fundamental reason is we don't have an open TRM for TWL4030, this code is new to community and I don't want to confuse developers more. This though takes some kind of space is easy to understand and comment on. I can definitely revisit once I see some kind of usage of TWL4030 driver in community and having a public TRM to explain the same. Also I am just targeting drivers to get into some respectable form in GIT then we can improve them for more functionality and 

>They all match as to the expected.. so there is my 2 cents... :)

They were worth a $ :)

Regards,
Khasim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-11  0:19   ` Syed Mohammed, Khasim
@ 2007-05-11  1:00     ` Nishanth Menon
  2007-05-12  0:50       ` nishanth menon
  0 siblings, 1 reply; 12+ messages in thread
From: Nishanth Menon @ 2007-05-11  1:00 UTC (permalink / raw)
  To: Syed Mohammed, Khasim; +Cc: linux-omap-open-source

Syed Mohammed, Khasim stated on 5/10/2007 7:19 PM:
> I feel like not doing this, fundamental reason is we don't have an open TRM for TWL4030, this code is new to community and I don't want to confuse developers more. This though takes some kind of space is easy to understand and comment on. I can definitely revisit once I see some kind of usage of TWL4030 driver in community and having a public TRM to explain the same. Also I am just targeting drivers to get into some respectable form in GIT then we can improve them for more functionality and 
>   
I can send a patch for the same if you'd like to save yourself the
effort ;).... but just hoping to save git some bytes.. and hoping to see
some readable(it did take me a short while{due to the dud head i am}
that _M is infact a mask) code instead :D ... hoping to see a *public*
TRM may not happen even for 2430 - it needs to be recieved thru FAEs..
folks can get the T2 TRMs thru FAEs if they so desire..
Here are some more 1 cent comments in arnd 15 mins of patch look through:
> +#define OMAP_TWL4030KP_LOG_LEVEL    1
why enable debug by default?
> +void omap_kp_timer(unsigned long data)
> +{
> +    schedule_work(&timer_work);
> +}
ofcourse possibly workitem schedule overheads.. versus userlevel thread
running and scheduling it..

> +#define SCAN_RATE        HZ/20
what if I change my HZ to say 1000? should I not have this as a
configurable option -> just thinking....

> +#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
> +char *switch_name[NUM_ROWS][NUM_COLS] = {
this could have been static

> +		for (col = 0; col < NUM_COLS; col++) {
> +			int key;
> +
> +			if (!(changed & (1 << col)))
> +				continue;
Cant we use changed and a while loop to iterate less instead of a continue?

+	omap_twl4030kp->id.vendor	= 0x0001;
+	omap_twl4030kp->id.product	= 0x0001;
+	omap_twl4030kp->id.version	= 0x0003;
what are those? is there some registration values?
+	if (ret < 0) goto err3;
coding standard? should not goto err3 go below the if()?
+	/* Set Pre Scalar Field PTV to 4 */
+	reg = BIT_LK_PTV_REG_PTV_M & (BIT_PTV_REG_PTV4 << BIT_LK_PTV_REG_PTV);
why if i already have a bunch of _M masks defined - I am confused on this :)?
+#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
+	printk
+	  ("****TWL4030 keypad module configuration registers dump****\n");
+	twl4030_kpread_u8(TWL4030_MODULE_KEYPAD, &reg, REG_KEYP_CTRL_REG);
+	printk("Register REG_KEYP_CTRL_REG : %X\n", reg);

arent we supposed to use that kernel debug printk?
>  /* Placeholder for 2430SDP specific defines */
> -#define OMAP24XX_ETHR_START		 0x08000300
> +#define OMAP24XX_ETHR_START		0x08000300
what is this change anyway?
> -#define NR_IRQS				(IH_TWL4030_END)
> +
> +/* TWL4030 GPIO Interrupts */
> +#define IH_TWL4030_GPIO_BASE		(IH_TWL4030_END)
> +#define IH_TWL4030_GPIO_END		(IH_TWL4030_BASE+18)
> +#define NR_IRQS				(IH_TWL4030_GPIO_END)
>  
<snip>
> +
> +#define TWL4030_GPIO_MIN		0
> +#define TWL4030_GPIO_MAX		18
> +#define TWL4030_GPIO_MAX_CD		2
> +#define TWL4030_GPIO_IRQ_NO(n)		(IH_TWL4030_GPIO_BASE+n)
> +#define TWL4030_GPIO_IS_INPUT		1
> +#define TWL4030_GPIO_IS_OUTPUT		0
> +#define TWL4030_GPIO_IS_ENABLE		1

Should'nt this be a different patch - something like t2-gpio?

Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-11  1:00     ` Nishanth Menon
@ 2007-05-12  0:50       ` nishanth menon
  2007-05-16 16:13         ` tony
  0 siblings, 1 reply; 12+ messages in thread
From: nishanth menon @ 2007-05-12  0:50 UTC (permalink / raw)
  To: Syed Mohammed, Khasim; +Cc: linux-omap-open-source

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

Hi Khasim,

On 5/10/07, Nishanth Menon <menon.nishanth@gmail.com> wrote:
> Syed Mohammed, Khasim stated on 5/10/2007 7:19 PM:
> > I feel like not doing this, fundamental reason is we don't have an open TRM for TWL4030, this code is new to community and I don't want to confuse developers more. This though takes some kind of space is easy to understand and comment on. I can definitely revisit once I see some kind of usage of TWL4030 driver in community and having a public TRM to explain the same. Also I am just targeting drivers to get into some respectable form in GIT then we can improve them for more functionality and
> >
> I can send a patch for the same if you'd like to save yourself the
> effort ;).... but just hoping to save git some bytes.. and hoping to see
Attached is a clean up patch for the same.. - this is a follow on
patch in mail: Thu 5/10/2007 11:49 PM

Regards,
Nishanth Menon

[-- Attachment #2: 0002-OMAP-KeyPad-Cleanup-initial-Patch.patch --]
[-- Type: application/octet-stream, Size: 23517 bytes --]

From c0cded048cebb6cc63179eae7ee6b316e941dcb6 Mon Sep 17 00:00:00 2001
From: Nishanth Menon <menon.nishanth@gmail.com>
Date: Fri, 11 May 2007 19:38:37 -0500
Subject: [PATCH] [OMAP] [KeyPad] Cleanup initial Patch
This is follow up patch for Khasim's patch which does the following:
a) Replace all printks with either dev_err,info,warn or dbg as much
   possible
b) Clean up some coding standard issues of white spaces etc
c) Thourough cleanup of header to declare only those defines that are used
---
 drivers/input/keyboard/omap-twl4030keypad.c |   64 +++---
 drivers/input/keyboard/twl4030-keypad.h     |  348 ++-------------------------
 2 files changed, 52 insertions(+), 360 deletions(-)

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c b/drivers/input/keyboard/omap-twl4030keypad.c
index d6b25de..f6ffc40 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -50,7 +50,6 @@
 #define KEYNUM_MASK		0xFF000000
 #define ROWCOL_MASK		0x00FFFFFF
 
-#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
 static char *switch_name[NUM_ROWS][NUM_COLS] = {
 	{"S2_L", "S2_D", "S2_S", "S3", "S4", "S23"},
 	{"S2_R", "S2_U", "S5", "S6", "S7", "S24"},
@@ -58,11 +57,11 @@ static char *switch_name[NUM_ROWS][NUM_COLS] = {
 	{"S13", "S14", "S15", "S16", "S17", "S26"},
 	{"S18", "S19", "S20", "S21", "S22", "S27"},
 };
-#endif
 
 /* Global variables */
 static int *keymap;
 static unsigned char kp_state[NUM_ROWS];
+static struct device * dbg_dev;
 
 /* Function Templates */
 static struct input_dev *omap_twl4030kp;
@@ -70,8 +69,7 @@ struct timer_list kptimer;
 static void omap_kp_timer(unsigned long);
 static void twl4030_kp_scan(void);
 struct work_struct timer_work;
-void twl4030_kp_work(void *data);
-void twl4030_timer_work(struct work_struct *unused);
+static void twl4030_timer_work(struct work_struct *unused);
 
 static int twl4030_kpread_u8(u32 module, u8 * data, u32 reg)
 {
@@ -79,9 +77,8 @@ static int twl4030_kpread_u8(u32 module, u8 * data, u32 reg)
 
 	ret = twl4030_i2c_read_u8(module, data, reg);
 	if (ret < 0) {
-		printk(KERN_WARNING
-			"Couldn't read TWL4030 register %X - ret %d[%x]\n",
-			reg, ret, ret);
+		dev_warn(dbg_dev, "Couldn't read TWL4030 register %X - ret %d[%x]\n",
+			 reg, ret, ret);
 		return ret;
 	}
 	return ret;
@@ -93,9 +90,8 @@ static int twl4030_kpwrite_u8(u32 module, u8 data, u32 reg)
 
 	ret = twl4030_i2c_write_u8(module, data, reg);
 	if (ret < 0) {
-		printk(KERN_WARNING
-			"Could not write TWL4030 register %X - ret %d[%x]\n",
-			reg, ret, ret);
+		dev_warn(dbg_dev, "Could not write TWL4030 register %X - ret %d[%x]\n",
+			 reg, ret, ret);
 		return ret;
 	}
 	return ret;
@@ -125,9 +121,8 @@ static void twl4030_kp_scan(void) {
 		twl4030_i2c_read(TWL4030_MODULE_KEYPAD, new_state, code_reg,
 				 NUM_ROWS);
 	if (ret < 0)
-		printk(KERN_WARNING
-			"Could not read TWL4030 register %X - ret %d[%x]\n",
-				code_reg, ret, ret);
+		dev_warn(dbg_dev, "Could not read TWL4030 register %X - ret %d[%x]\n",
+			 code_reg, ret, ret);
 
 	/* check for changes and print those */
 	for (row = 0; row < NUM_ROWS; row++) {
@@ -143,16 +138,14 @@ static void twl4030_kp_scan(void) {
 			if (!(changed & (1 << col)))
 				continue;
 
-#if (OMAP_TWL4030KP_LOG_LEVEL >= 1)
-			printk("key %s %s\n", switch_name[row][col],
+			dev_dbg(dbg_dev, "key %s %s\n", switch_name[row][col],
 				(new_state[row] & (1 << col)) ?
 				"press" : "release");
-#endif
+
 			key = omap_kp_find_key(col, row);
 			if (key < 0) {
-				printk(KERN_WARNING
-					"omap-kp: Spurious key event %d-%d\n",
-					col, row);
+				dev_warn(dbg_dev, "omap-kp: Spurious key event %d-%d\n",
+					 col, row);
 				/* We scan again after a couple of seconds */
 				spurious = 1;
 				continue;
@@ -174,7 +167,7 @@ static void twl4030_kp_scan(void) {
 	memcpy(kp_state, new_state, sizeof(kp_state));
 }
 
-void twl4030_timer_work(struct work_struct *unused)
+static void twl4030_timer_work(struct work_struct *unused)
 {
 	twl4030_kp_scan();
 }
@@ -224,8 +217,11 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 	int ret = 0;
 	struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
 
+	/* Get the debug Device */
+	dbg_dev = &(pdev->dev);
+
 	if (!pdata->rows || !pdata->cols || !pdata->keymap) {
-		printk(KERN_ERR "No rows, cols or keymap from pdata\n");
+		dev_err(dbg_dev, "No rows, cols or keymap from pdata\n");
 		return -EINVAL;
 	}
 
@@ -244,9 +240,9 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 	for (i = 0; keymap[i] != 0; i++)
 		set_bit(keymap[i] & 0x00ffffff, omap_twl4030kp->keybit);
 
-	omap_twl4030kp->name 		= "omap_twl4030keypad";
-	omap_twl4030kp->phys 		= "omap_twl4030keypad/input0";
-	omap_twl4030kp->dev.parent 	= &pdev->dev;
+	omap_twl4030kp->name		= "omap_twl4030keypad";
+	omap_twl4030kp->phys		= "omap_twl4030keypad/input0";
+	omap_twl4030kp->dev.parent	= &pdev->dev;
 
 	omap_twl4030kp->id.bustype	= BUS_HOST;
 	omap_twl4030kp->id.vendor	= 0x0001;
@@ -259,7 +255,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 
 	ret = input_register_device(omap_twl4030kp);
 	if (ret < 0) {
-		printk(KERN_ERR "Unable to register twl4030 keypad device\n");
+		dev_err(dbg_dev, "Unable to register twl4030 keypad device\n");
 		goto err2;
 	}
 
@@ -269,7 +265,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 	 * Since keypad driver uses I2C for reading
 	 * twl4030 keypad registers, tasklets cannot
 	 * be used.
- 	 */
+	 */
 	INIT_WORK(&timer_work, twl4030_timer_work);
 
 	reg = KEYP_CTRL_REG_MASK_NOAUTORPT;
@@ -285,7 +281,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 		goto err3;
 
 	/* Set Pre Scalar Field PTV to 4 */
-	reg = BIT_LK_PTV_REG_PTV_M & (BIT_PTV_REG_PTV4 << BIT_LK_PTV_REG_PTV);
+	reg = BIT_LK_PTV_REG_PTV_MASK & (BIT_PTV_REG_PTV4 << BIT_LK_PTV_REG_PTV);
 
 	ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg, REG_LK_PTV_REG);
 	if (ret < 0)
@@ -316,15 +312,13 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 	ret = request_irq(TWL4030_MODIRQ_KEYPAD, do_kp_irq,
 		IRQF_DISABLED, "TWL4030 Keypad", omap_twl4030kp);
 	if (ret < 0) {
-		printk(KERN_INFO
-				"request_irq failed for irq no=%d\n",
-				TWL4030_MODIRQ_KEYPAD);
+		dev_info(dbg_dev, "request_irq failed for irq no=%d\n",
+			TWL4030_MODIRQ_KEYPAD);
 		goto err3;
 	} else {
 		/* Enable keypad module interrupts now. */
 		reg = KEYP_IMR1_UNMASK;
-		ret =
-			twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg,
+		ret = twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD, reg,
 						REG_KEYP_IMR1);
 		if (ret < 0) {
 			/* mask all events - dont care abt result */
@@ -338,9 +332,8 @@ static int __init omap_kp_probe(struct platform_device *pdev)
 	ret = twl4030_i2c_read(TWL4030_MODULE_KEYPAD, kp_state, code_reg,
 		NUM_ROWS);
 	if (ret < 0) {
-		printk(KERN_WARNING
-				"Could not read TWL4030 register %X - ret %d[%x]\n",
-				reg, ret, ret);
+		dev_warn(dbg_dev, "Could not read TWL4030 register %X - ret %d[%x]\n",
+			 reg, ret, ret);
 		goto err4;
 	}
 	return (ret);
@@ -376,7 +369,6 @@ static struct platform_driver omap_kp_driver = {
  */
 static int __devinit omap_kp_init(void)
 {
-	printk(KERN_INFO "OMAP TWL4030 Keypad Driver\n");
 	return platform_driver_register(&omap_kp_driver);
 }
 
diff --git a/drivers/input/keyboard/twl4030-keypad.h b/drivers/input/keyboard/twl4030-keypad.h
index c33ab43..642b851 100644
--- a/drivers/input/keyboard/twl4030-keypad.h
+++ b/drivers/input/keyboard/twl4030-keypad.h
@@ -26,351 +26,51 @@
 /* Register Definitions */
 #define REG_KEYP_CTRL_REG			(0x0)
 #define REG_KEY_DEB_REG				(0x1)
-#define REG_LONG_KEY_REG1			(0x2)
 #define REG_LK_PTV_REG				(0x3)
-#define REG_TIME_OUT_REG1			(0x4)
-#define REG_TIME_OUT_REG2			(0x5)
-#define REG_KBC_REG				(0x6)
-#define REG_KBR_REG				(0x7)
-#define REG_KEYP_SMS				(0x8)
 #define REG_FULL_CODE_7_0			(0x9)
-#define REG_FULL_CODE_15_8			(0xA)
-#define REG_FULL_CODE_23_16			(0xB)
-#define REG_FULL_CODE_31_24			(0xC)
-#define REG_FULL_CODE_39_32			(0xD)
-#define REG_FULL_CODE_47_40			(0xE)
-#define REG_FULL_CODE_55_48			(0xF)
-#define REG_FULL_CODE_63_56			(0x10)
 #define REG_KEYP_ISR1				(0x11)
 #define REG_KEYP_IMR1				(0x12)
-#define REG_KEYP_ISR2				(0x13)
-#define REG_KEYP_IMR2				(0x14)
-#define REG_KEYP_SIR				(0x15)
 #define REG_KEYP_EDR				(0x16)
 #define REG_KEYP_SIH_CTRL			(0x17)
 
-/* BitField Definitions */
-
 /* KEYP_CTRL_REG Fields */
-#define BIT_KEYP_CTRL_REG_SOFT_NRST		(0x000)
-#define BIT_KEYP_CTRL_REG_SOFT_NRST_M		(0x00000001)
-#define BIT_KEYP_CTRL_REG_SOFTMODEN		(0x001)
-#define BIT_KEYP_CTRL_REG_SOFTMODEN_M		(0x00000002)
-#define BIT_KEYP_CTRL_REG_LK_EN			(0x002)
-#define BIT_KEYP_CTRL_REG_LK_EN_M		(0x00000004)
-#define BIT_KEYP_CTRL_REG_TOE_EN		(0x003)
-#define BIT_KEYP_CTRL_REG_TOE_EN_M		(0x00000008)
-#define BIT_KEYP_CTRL_REG_TOLE_EN		(0x004)
-#define BIT_KEYP_CTRL_REG_TOLE_EN_M		(0x00000010)
-#define BIT_KEYP_CTRL_REG_RP_EN			(0x005)
-#define BIT_KEYP_CTRL_REG_RP_EN_M		(0x00000020)
-#define BIT_KEYP_CTRL_REG_KBD_ON		(0x006)
-#define BIT_KEYP_CTRL_REG_KBD_ON_M		(0x00000040)
-
-#define KEYP_CTRL_REG_MASK_AUTORPT		BIT_KEYP_CTRL_REG_SOFT_NRST_M |\
-						BIT_KEYP_CTRL_REG_RP_EN_M |\
-						BIT_KEYP_CTRL_REG_SOFTMODEN_M |\
-								BIT_KEYP_CTRL_REG_KBD_ON_M
-
-#define KEYP_CTRL_REG_MASK_NOAUTORPT		BIT_KEYP_CTRL_REG_SOFT_NRST_M |\
-						BIT_KEYP_CTRL_REG_SOFTMODEN_M |\
-						BIT_KEYP_CTRL_REG_KBD_ON_M
+#define BIT_KEYP_CTRL_REG_SOFT_NRST_MASK	(0x00000001)
+#define BIT_KEYP_CTRL_REG_SOFTMODEN_MASK	(0x00000002)
+#define BIT_KEYP_CTRL_REG_LK_EN_MASK		(0x00000004)
+#define BIT_KEYP_CTRL_REG_TOE_EN_MASK		(0x00000008)
+#define BIT_KEYP_CTRL_REG_TOLE_EN_MASK		(0x00000010)
+#define BIT_KEYP_CTRL_REG_RP_EN_MASK		(0x00000020)
+#define BIT_KEYP_CTRL_REG_KBD_ON_MASK		(0x00000040)
 
-/* KEY_DEB_REG Fields */
-#define BIT_KEY_DEB_REG_KEYP_DEB		(0x000)
-#define BIT_KEY_DEB_REG_KEYP_DEB_M		(0x0000003F)
-#define BIT_KEY_DEB9				(0x9)
 
-/* LONG_KEY_REG1 Fields */
-#define BIT_LONG_KEY_REG1_LSB_LK		(0x000)
-#define BIT_LONG_KEY_REG1_LSB_LK_M		(0x000000FF)
-#define BIT_LONG_KEY_100MS			(0x63)
+#define KEYP_CTRL_REG_MASK_NOAUTORPT		BIT_KEYP_CTRL_REG_SOFT_NRST_MASK |\
+						BIT_KEYP_CTRL_REG_SOFTMODEN_MASK |\
+						BIT_KEYP_CTRL_REG_KBD_ON_MASK
 
 /* LK_PTV_REG Fields */
-#define BIT_LK_PTV_REG_MSB_LK			(0x000)
-#define BIT_LK_PTV_REG_MSB_LK_M			(0x0000000F)
 #define BIT_LK_PTV_REG_PTV			(0x005)
-#define BIT_LK_PTV_REG_PTV_M			(0x000000E0)
+#define BIT_LK_PTV_REG_PTV_MASK			(0x000000E0)
 #define BIT_PTV_REG_PTV4			(0x4)
 
-/* TIME_OUT_REG1 Fields */
-#define BIT_TIME_OUT_REG1_LSB_TO		(0x000)
-#define BIT_TIME_OUT_REG1_LSB_TO_M		(0x000000FF)
-
-/* TIME_OUT_REG2 Fields */
-#define BIT_TIME_OUT_REG2_MSB_TO		(0x000)
-#define BIT_TIME_OUT_REG2_MSB_TO_M		(0x000000FF)
-
-/* KBC_REG Fields */
-#define BIT_KBC_REG_KBC0			(0x000)
-#define BIT_KBC_REG_KBC0_M			(0x00000001)
-#define BIT_KBC_REG_KBC1			(0x001)
-#define BIT_KBC_REG_KBC1_M			(0x00000002)
-#define BIT_KBC_REG_KBC2			(0x002)
-#define BIT_KBC_REG_KBC2_M			(0x00000004)
-#define BIT_KBC_REG_KBC3			(0x003)
-#define BIT_KBC_REG_KBC3_M			(0x00000008)
-#define BIT_KBC_REG_KBC4			(0x004)
-#define BIT_KBC_REG_KBC4_M			(0x00000010)
-#define BIT_KBC_REG_KBC5			(0x005)
-#define BIT_KBC_REG_KBC5_M			(0x00000020)
-#define BIT_KBC_REG_KBC6			(0x006)
-#define BIT_KBC_REG_KBC6_M			(0x00000040)
-#define BIT_KBC_REG_KBC7			(0x007)
-#define BIT_KBC_REG_KBC7_M			(0x00000080)
-
-/* KBR_REG Fields */
-#define BIT_KBR_REG_KBR0			(0x000)
-#define BIT_KBR_REG_KBR0_M			(0x00000001)
-#define BIT_KBR_REG_KBR1			(0x001)
-#define BIT_KBR_REG_KBR1_M			(0x00000002)
-#define BIT_KBR_REG_KBR2			(0x002)
-#define BIT_KBR_REG_KBR2_M			(0x00000004)
-#define BIT_KBR_REG_KBR3			(0x003)
-#define BIT_KBR_REG_KBR3_M			(0x00000008)
-#define BIT_KBR_REG_KBR4			(0x004)
-#define BIT_KBR_REG_KBR4_M			(0x00000010)
-#define BIT_KBR_REG_KBR5			(0x005)
-#define BIT_KBR_REG_KBR5_M			(0x00000020)
-#define BIT_KBR_REG_KBR6			(0x006)
-#define BIT_KBR_REG_KBR6_M			(0x00000040)
-#define BIT_KBR_REG_KBR7			(0x007)
-#define BIT_KBR_REG_KBR7_M			(0x00000080)
-
-/* KEYP_SMS Fields */
-#define BIT_KEYP_SMS_STMSTS			(0x000)
-#define BIT_KEYP_SMS_STMSTS_M			(0x0000000F)
-#define BIT_KEYP_SMS_SIR_EN			(0x004)
-#define BIT_KEYP_SMS_SIR_EN_M			(0x00000010)
-#define BIT_KEYP_SMS_MISS_EN			(0x005)
-#define BIT_KEYP_SMS_MISS_EN_M			(0x00000020)
-
-/* FULL_CODE_7_0 Fields */
-#define BIT_FULL_CODE_7_0_FULL_CODE_K0		(0x000)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K0_M	(0x00000001)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K1		(0x001)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K1_M	(0x00000002)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K2		(0x002)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K2_M	(0x00000004)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K3		(0x003)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K3_M	(0x00000008)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K4		(0x004)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K4_M	(0x00000010)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K5		(0x005)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K5_M	(0x00000020)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K6		(0x006)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K6_M	(0x00000040)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K7		(0x007)
-#define BIT_FULL_CODE_7_0_FULL_CODE_K7_M	(0x00000080)
-
-/* FULL_CODE_15_8 Fields */
-#define BIT_FULL_CODE_15_8_FULL_CODE_K8		(0x000)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K8_M	(0x00000001)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K9		(0x001)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K9_M	(0x00000002)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K10	(0x002)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K10_M	(0x00000004)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K11	(0x003)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K11_M	(0x00000008)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K12	(0x004)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K12_M	(0x00000010)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K13	(0x005)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K13_M	(0x00000020)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K14	(0x006)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K14_M	(0x00000040)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K15	(0x007)
-#define BIT_FULL_CODE_15_8_FULL_CODE_K15_M	(0x00000080)
-
-/* FULL_CODE_23_16 Fields */
-#define BIT_FULL_CODE_23_16_FULL_CODE_K16	(0x000)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K16_M	(0x00000001)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K17	(0x001)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K17_M	(0x00000002)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K18	(0x002)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K18_M	(0x00000004)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K19	(0x003)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K19_M	(0x00000008)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K20	(0x004)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K20_M	(0x00000010)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K21	(0x005)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K21_M	(0x00000020)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K22	(0x006)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K22_M	(0x00000040)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K23	(0x007)
-#define BIT_FULL_CODE_23_16_FULL_CODE_K23_M	(0x00000080)
-
-/* FULL_CODE_31_24 Fields */
-#define BIT_FULL_CODE_31_24_FULL_CODE_K24	(0x000)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K24_M	(0x00000001)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K25	(0x001)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K25_M	(0x00000002)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K26	(0x002)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K26_M	(0x00000004)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K27	(0x003)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K27_M	(0x00000008)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K28	(0x004)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K28_M	(0x00000010)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K29	(0x005)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K29_M	(0x00000020)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K30	(0x006)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K30_M	(0x00000040)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K31	(0x007)
-#define BIT_FULL_CODE_31_24_FULL_CODE_K31_M	(0x00000080)
-
-/* FULL_CODE_39_32 Fields */
-#define BIT_FULL_CODE_39_32_FULL_CODE_K32	(0x000)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K32_M	(0x00000001)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K33	(0x001)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K33_M	(0x00000002)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K34	(0x002)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K34_M	(0x00000004)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K35	(0x003)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K35_M	(0x00000008)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K36	(0x004)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K36_M	(0x00000010)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K37	(0x005)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K37_M	(0x00000020)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K38	(0x006)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K38_M	(0x00000040)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K39	(0x007)
-#define BIT_FULL_CODE_39_32_FULL_CODE_K39_M	(0x00000080)
-
-/* FULL_CODE_47_40 Fields */
-#define BIT_FULL_CODE_47_40_FULL_CODE_K40	(0x000)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K40_M	(0x00000001)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K41	(0x001)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K41_M	(0x00000002)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K42	(0x002)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K42_M	(0x00000004)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K43	(0x003)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K43_M	(0x00000008)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K44	(0x004)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K44_M	(0x00000010)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K45	(0x005)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K45_M	(0x00000020)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K46	(0x006)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K46_M	(0x00000040)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K47	(0x007)
-#define BIT_FULL_CODE_47_40_FULL_CODE_K47_M	(0x00000080)
-
-/* FULL_CODE_55_48 Fields */
-#define BIT_FULL_CODE_55_48_FULL_CODE_K48	(0x000)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K48_M	(0x00000001)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K49	(0x001)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K49_M	(0x00000002)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K50	(0x002)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K50_M	(0x00000004)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K51	(0x003)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K51_M	(0x00000008)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K52	(0x004)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K52_M	(0x00000010)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K53	(0x005)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K53_M	(0x00000020)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K54	(0x006)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K54_M	(0x00000040)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K55	(0x007)
-#define BIT_FULL_CODE_55_48_FULL_CODE_K55_M	(0x00000080)
-
-/* FULL_CODE_63_56 Fields */
-#define BIT_FULL_CODE_63_56_FULL_CODE_K56	(0x000)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K56_M	(0x00000001)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K57	(0x001)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K57_M	(0x00000002)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K58	(0x002)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K58_M	(0x00000004)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K59	(0x003)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K59_M	(0x00000008)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K60	(0x004)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K60_M	(0x00000010)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K61	(0x005)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K61_M	(0x00000020)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K62	(0x006)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K62_M	(0x00000040)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K63	(0x007)
-#define BIT_FULL_CODE_63_56_FULL_CODE_K63_M	(0x00000080)
-
-/* KEYP_ISR1 Fields */
-#define BIT_KEYP_ISR1_ITKPISR1			(0x000)
-#define BIT_KEYP_ISR1_ITKPISR1_M		(0x00000001)
-#define BIT_KEYP_ISR1_ITLKISR1			(0x001)
-#define BIT_KEYP_ISR1_ITLKISR1_M		(0x00000002)
-#define BIT_KEYP_ISR1_ITTOISR1			(0x002)
-#define BIT_KEYP_ISR1_ITTOISR1_M		(0x00000004)
-#define BIT_KEYP_ISR1_ITMISR1			(0x003)
-#define BIT_KEYP_ISR1_ITMISR1_M			(0x00000008)
-#define KEYP_ISR1_CLEAR				(0x0F)
-
 /* KEYP_IMR1 Fields */
-#define BIT_KEYP_IMR1_ITKPIMR1			(0x000)
-#define BIT_KEYP_IMR1_ITKPIMR1_M		(0x00000001)
-#define BIT_KEYP_IMR1_ITLKIMR1			(0x001)
-#define BIT_KEYP_IMR1_ITLKIMR1_M		(0x00000002)
-#define BIT_KEYP_IMR1_ITTOIMR1			(0x002)
-#define BIT_KEYP_IMR1_ITTOIMR1_M		(0x00000004)
-#define BIT_KEYP_IMR1_ITMISIMR1			(0x003)
-#define BIT_KEYP_IMR1_ITMISIMR1_M		(0x00000008)
 #define KEYP_IMR1_MASK				(0x0F)
 #define KEYP_IMR1_UNMASK			(0x00)
 
-/* KEYP_ISR2 Fields */
-#define BIT_KEYP_ISR2_ITKPISR2			(0x000)
-#define BIT_KEYP_ISR2_ITKPISR2_M		(0x00000001)
-#define BIT_KEYP_ISR2_ITLKISR2			(0x001)
-#define BIT_KEYP_ISR2_ITLKISR2_M		(0x00000002)
-#define BIT_KEYP_ISR2_ITTOISR2			(0x002)
-#define BIT_KEYP_ISR2_ITTOISR2_M		(0x00000004)
-#define BIT_KEYP_ISR2_ITMISR2			(0x003)
-#define BIT_KEYP_ISR2_ITMISR2_M			(0x00000008)
-
-/* KEYP_IMR2 Fields */
-#define BIT_KEYP_IMR2_ITKPIMR2			(0x000)
-#define BIT_KEYP_IMR2_ITKPIMR2_M		(0x00000001)
-#define BIT_KEYP_IMR2_ITLKIMR2			(0x001)
-#define BIT_KEYP_IMR2_ITLKIMR2_M		(0x00000002)
-#define BIT_KEYP_IMR2_ITTOIMR2			(0x002)
-#define BIT_KEYP_IMR2_ITTOIMR2_M		(0x00000004)
-#define BIT_KEYP_IMR2_ITMISIMR2			(0x003)
-#define BIT_KEYP_IMR2_ITMISIMR2_M		(0x00000008)
-
-/* KEYP_SIR Fields */
-#define BIT_KEYP_SIR_ITKPSIR			(0x000)
-#define BIT_KEYP_SIR_ITKPSIR_M			(0x00000001)
-#define BIT_KEYP_SIR_ITLKSIR			(0x001)
-#define BIT_KEYP_SIR_ITLKSIR_M			(0x00000002)
-#define BIT_KEYP_SIR_ITTOSIR			(0x002)
-#define BIT_KEYP_SIR_ITTOSIR_M			(0x00000004)
-#define BIT_KEYP_SIR_ITMISSIR			(0x003)
-#define BIT_KEYP_SIR_ITMISSIR_M			(0x00000008)
-
 /* KEYP_EDR Fields */
-#define BIT_KEYP_EDR_ITKPFALLING		(0x000)
-#define BIT_KEYP_EDR_ITKPFALLING_M		(0x00000001)
-#define BIT_KEYP_EDR_ITKPRISING			(0x001)
-#define BIT_KEYP_EDR_ITKPRISING_M		(0x00000002)
-#define BIT_KEYP_EDR_ITLKFALLING		(0x002)
-#define BIT_KEYP_EDR_ITLKFALLING_M		(0x00000004)
-#define BIT_KEYP_EDR_ITLKRISING			(0x003)
-#define BIT_KEYP_EDR_ITLKRISING_M		(0x00000008)
-#define BIT_KEYP_EDR_ITTOFALLING		(0x004)
-#define BIT_KEYP_EDR_ITTOFALLING_M		(0x00000010)
-#define BIT_KEYP_EDR_ITTORISING			(0x005)
-#define BIT_KEYP_EDR_ITTORISING_M		(0x00000020)
-#define BIT_KEYP_EDR_ITMISFALLING		(0x006)
-#define BIT_KEYP_EDR_ITMISFALLING_M		(0x00000040)
-#define BIT_KEYP_EDR_ITMISRISING		(0x007)
-#define BIT_KEYP_EDR_ITMISRISING_M		(0x00000080)
-
-#define KEYP_EDR_MASK				BIT_KEYP_EDR_ITKPFALLING_M |\
-						BIT_KEYP_EDR_ITLKFALLING_M |\
-						BIT_KEYP_EDR_ITTOFALLING_M |\
-						BIT_KEYP_EDR_ITMISFALLING_M
+#define BIT_KEYP_EDR_ITKPFALLING_MASK		(0x00000001)
+#define BIT_KEYP_EDR_ITKPRISING_MASK		(0x00000002)
+#define BIT_KEYP_EDR_ITLKFALLING_MASK		(0x00000004)
+#define BIT_KEYP_EDR_ITLKRISING_MASK		(0x00000008)
+#define BIT_KEYP_EDR_ITTOFALLING_MASK		(0x00000010)
+#define BIT_KEYP_EDR_ITTORISING_MASK		(0x00000020)
+#define BIT_KEYP_EDR_ITMISFALLING_MASK		(0x00000040)
+#define BIT_KEYP_EDR_ITMISRISING_MASK		(0x00000080)
+
+#define KEYP_EDR_MASK				BIT_KEYP_EDR_ITKPFALLING_MASK |\
+						BIT_KEYP_EDR_ITLKFALLING_MASK |\
+						BIT_KEYP_EDR_ITTOFALLING_MASK |\
+						BIT_KEYP_EDR_ITMISFALLING_MASK
 /* KEYP_SIH_CTRL Fields */
-#define BIT_KEYP_SIH_CTRL_EXCLEN		(0x000)
-#define BIT_KEYP_SIH_CTRL_EXCLEN_M		(0x00000001)
-#define BIT_KEYP_SIH_CTRL_PENDDIS		(0x001)
-#define BIT_KEYP_SIH_CTRL_PENDDIS_M		(0x00000002)
-#define BIT_KEYP_SIH_CTRL_COR			(0x002)
-#define BIT_KEYP_SIH_CTRL_COR_M			(0x00000004)
 #define KEYP_SIH_CTRL_MASK			(0x04)
 
 #endif	/* End of __TWL4030-KEYPAD_H__ */
-- 
1.5.0.6


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-12  0:50       ` nishanth menon
@ 2007-05-16 16:13         ` tony
  2007-05-16 16:16           ` Syed Mohammed, Khasim
  2007-05-16 17:19           ` Dmitry Krivoschekov
  0 siblings, 2 replies; 12+ messages in thread
From: tony @ 2007-05-16 16:13 UTC (permalink / raw)
  To: nishanth menon; +Cc: linux-omap-open-source

* nishanth menon <menon.nishanth@gmail.com> [070511 17:51]:
> Hi Khasim,
> 
> On 5/10/07, Nishanth Menon <menon.nishanth@gmail.com> wrote:
> >Syed Mohammed, Khasim stated on 5/10/2007 7:19 PM:
> >> I feel like not doing this, fundamental reason is we don't have an open 
> >TRM for TWL4030, this code is new to community and I don't want to confuse 
> >developers more. This though takes some kind of space is easy to 
> >understand and comment on. I can definitely revisit once I see some kind 
> >of usage of TWL4030 driver in community and having a public TRM to explain 
> >the same. Also I am just targeting drivers to get into some respectable 
> >form in GIT then we can improve them for more functionality and
> >>
> >I can send a patch for the same if you'd like to save yourself the
> >effort ;).... but just hoping to save git some bytes.. and hoping to see
> Attached is a clean up patch for the same.. - this is a follow on
> patch in mail: Thu 5/10/2007 11:49 PM

Khasim, can you repost one more time with Nishants clean-up patch merged
if you're OK with that? It's pointless to add the driver to the git tree
and then immediately fix it.

Again, that will make it easier for us to use the same patches for
sending upstream without need to rewrite them.

Tony

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-16 16:13         ` tony
@ 2007-05-16 16:16           ` Syed Mohammed, Khasim
  2007-05-16 16:19             ` tony
  2007-05-16 17:19           ` Dmitry Krivoschekov
  1 sibling, 1 reply; 12+ messages in thread
From: Syed Mohammed, Khasim @ 2007-05-16 16:16 UTC (permalink / raw)
  To: tony, nishanth menon; +Cc: linux-omap-open-source


Hi Tony,

>
>Khasim, can you repost one more time with Nishants clean-up patch merged
>if you're OK with that? It's pointless to add the driver to the git tree
>and then immediately fix it.
>
I will repost.

Thanks Nishanth.

Regards,
Khasim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-16 16:16           ` Syed Mohammed, Khasim
@ 2007-05-16 16:19             ` tony
  2007-05-16 16:35               ` Syed Mohammed, Khasim
  0 siblings, 1 reply; 12+ messages in thread
From: tony @ 2007-05-16 16:19 UTC (permalink / raw)
  To: Syed Mohammed, Khasim; +Cc: linux-omap-open-source

* Syed Mohammed, Khasim <x0khasim@ti.com> [070516 09:17]:
> 
> Hi Tony,
> 
> >
> >Khasim, can you repost one more time with Nishants clean-up patch merged
> >if you're OK with that? It's pointless to add the driver to the git tree
> >and then immediately fix it.
> >
> I will repost.

Actually looks like Khasim has posted yet another version, can you see if
your changes are included in that one already?

Regards,

Tony

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-16 16:19             ` tony
@ 2007-05-16 16:35               ` Syed Mohammed, Khasim
  0 siblings, 0 replies; 12+ messages in thread
From: Syed Mohammed, Khasim @ 2007-05-16 16:35 UTC (permalink / raw)
  To: tony; +Cc: linux-omap-open-source

Tony,

>Actually looks like Khasim has posted yet another version, can you see if
>your changes are included in that one already?
>
No they don't have Nishanth's latest changes. I will generate a new one and I will repost the patch.

Regards,
Khasim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-16 16:13         ` tony
  2007-05-16 16:16           ` Syed Mohammed, Khasim
@ 2007-05-16 17:19           ` Dmitry Krivoschekov
  2007-05-16 17:31             ` Syed Mohammed, Khasim
  1 sibling, 1 reply; 12+ messages in thread
From: Dmitry Krivoschekov @ 2007-05-16 17:19 UTC (permalink / raw)
  To: tony; +Cc: linux-omap-open-source

tony@atomide.com wrote:
> * nishanth menon <menon.nishanth@gmail.com> [070511 17:51]:
>> Hi Khasim,
>>
>> On 5/10/07, Nishanth Menon <menon.nishanth@gmail.com> wrote:
>>> Syed Mohammed, Khasim stated on 5/10/2007 7:19 PM:
>>>> I feel like not doing this, fundamental reason is we don't have an open 
>>> TRM for TWL4030, this code is new to community and I don't want to confuse 
>>> developers more. This though takes some kind of space is easy to 
>>> understand and comment on. I can definitely revisit once I see some kind 
>>> of usage of TWL4030 driver in community and having a public TRM to explain 
>>> the same. Also I am just targeting drivers to get into some respectable 
>>> form in GIT then we can improve them for more functionality and
>>> I can send a patch for the same if you'd like to save yourself the
>>> effort ;).... but just hoping to save git some bytes.. and hoping to see
>> Attached is a clean up patch for the same.. - this is a follow on
>> patch in mail: Thu 5/10/2007 11:49 PM
>
> Khasim, can you repost one more time with Nishants clean-up patch merged
> if you're OK with that? It's pointless to add the driver to the git tree
> and then immediately fix it.

while testing the TWL4030 keypad driver I found that it causes I2C errors,
but Nishant's  "FIFO Handling support and broken hw workaround" patch fixes
the problem. So, the problem is not in the keypad driver itself
but it's in i2c-omap driver. Tony, consider pushing the I2C fix too.


Thanks,
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-16 17:19           ` Dmitry Krivoschekov
@ 2007-05-16 17:31             ` Syed Mohammed, Khasim
  2007-05-16 22:04               ` Tony Lindgren
  0 siblings, 1 reply; 12+ messages in thread
From: Syed Mohammed, Khasim @ 2007-05-16 17:31 UTC (permalink / raw)
  To: Dmitry Krivoschekov, tony; +Cc: linux-omap-open-source


>while testing the TWL4030 keypad driver I found that it causes I2C errors,
>but Nishant's  "FIFO Handling support and broken hw workaround" patch fixes
>the problem. So, the problem is not in the keypad driver itself
>but it's in i2c-omap driver. Tony, consider pushing the I2C fix too.

Yes, it does fix I2C issues as it adds FIFO support to existing I2C driver. Tony please consider this patch.

Let me know if you have any comments, I can fix them along with TWLKEYPAD patch.

Regards,
Khasim


_______________________________________________
Linux-omap-open-source mailing list
Linux-omap-open-source@linux.omap.com
http://linux.omap.com/mailman/listinfo/linux-omap-open-source

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TWL4030 Keypad driver - incorporated review comments
  2007-05-16 17:31             ` Syed Mohammed, Khasim
@ 2007-05-16 22:04               ` Tony Lindgren
  0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2007-05-16 22:04 UTC (permalink / raw)
  To: Syed Mohammed, Khasim; +Cc: linux-omap-open-source

* Syed Mohammed, Khasim <x0khasim@ti.com> [070516 10:33]:
> 
> >while testing the TWL4030 keypad driver I found that it causes I2C errors,
> >but Nishant's  "FIFO Handling support and broken hw workaround" patch fixes
> >the problem. So, the problem is not in the keypad driver itself
> >but it's in i2c-omap driver. Tony, consider pushing the I2C fix too.
> 
> Yes, it does fix I2C issues as it adds FIFO support to existing I2C driver. Tony please consider this patch.
> 
> Let me know if you have any comments, I can fix them along with TWLKEYPAD patch.

Pushing today.

Tony

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-05-16 22:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10 19:40 [PATCH] TWL4030 Keypad driver - incorporated review comments Syed Mohammed, Khasim
2007-05-11  0:04 ` nishanth menon
2007-05-11  0:19   ` Syed Mohammed, Khasim
2007-05-11  1:00     ` Nishanth Menon
2007-05-12  0:50       ` nishanth menon
2007-05-16 16:13         ` tony
2007-05-16 16:16           ` Syed Mohammed, Khasim
2007-05-16 16:19             ` tony
2007-05-16 16:35               ` Syed Mohammed, Khasim
2007-05-16 17:19           ` Dmitry Krivoschekov
2007-05-16 17:31             ` Syed Mohammed, Khasim
2007-05-16 22:04               ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox