linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/8] OMAP4 Keyboard Controller Support
@ 2010-09-30  5:29 Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 1/8] OMAP4: hwmod data: add keyboard controller Abraham Arce
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Abraham Arce @ 2010-09-30  5:29 UTC (permalink / raw)
  To: linux-input, linux-omap; +Cc: Abraham Arce

Keyboard controller for OMAP4 includes

 - built-in scanning algorithm
 - debouncing feature

This patch series is based in already accepted OMAP4 keyboard controller:

 Linux Input Tree
 Commit a17f79553f052f04d47689a842118f775f81b7e3
 Input: add support for OMAP4 keyboard controller

Dependency on hwmod changes for OMAP4:
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28188.html

---

v1
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg26502.html
 Initial Version

v2
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28334.html

 Vimal.Singh.01 | Signed-off-by missing in patch
 Vimal.Singh.02 | row/column interpretation in board file
 Vimal.Singh.03 | 0 element removal in board file

 Trilok.Soni.01 | hwmod framework in mainline
 Trilok.Soni.02 | extra brackets in Kconfig
 Trilok.Soni.03 | default y/n option in Kconfig
 Trilok.Soni.04 | path/filename in the header of driver
 Trilok.Soni.05 | static? omap_device_pm_latency in driver
 Trilok.Soni.06 | input_sync added in driver
 Trilok.Soni.07 | check error return in all driver
 Trilok.Soni.08 | keypad_data->input=NULL

 Felipe.Balbi.01 | platform_driver to know about hwmod and omap_device?
 Felipe.Balbi.02 | blank line
 Felipe.Balbi.03 | saving struct device *
 Felipe.Balbi.04 | platform_data should not be saved
 Felipe.Balbi.05 | dev_dbg() usage
 Felipe.Balbi.06 | missing input_sync()
 Felipe.Balbi.07 | snprintf() usage
 Felipe.Balbi.08 | omap_hwmod and omap_device location
 Felipe.Balbi.09 | matrix_keypad_platform_data allocation from platform code
 Felipe.Balbi.10 | omap_device_build from platform code
 Felipe.Balbi.11 | registering/configuring call location

 Kevin.Hillman.01 | Driver Testing
 Kevin.Hillman.02 | omap_hwmod and omap_device location

 Dmitry.Torokhov.01 | reason to make omap_keypad_threaded threaded?
 Dmitry.Torokhov.02 | MATRIX_SCAN_CODE and incorrect values
 Dmitry.Torokhov.03 | matrix_keypad_platform_data allocation
 Dmitry.Torokhov.04 | overriding pdata pointer
 Dmitry.Torokhov.05 | keypad_codes separate allocation
 Dmitry.Torokhov.06 | keypad_data->base check location
 Dmitry.Torokhov.07 | keypad_data->irq check location
 Dmitry.Torokhov.08 | input_dev->keycodemax needed
 Dmitry.Torokhov.09 | KEY_OK set bit
 Dmitry.Torokhov.10 | MSC_SCAN report missing
 Dmitry.Torokhov.11 | input_dev = NULL;
 Dmitry.Torokhov.12 | free_irq call location in remove function

v3
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg29297.html

 Dmitry.Torokhov | Rework in driver code


v4
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30759.html

 Felipe.Balbi.01    | rows, cols, base and irq definitions
 Felipe.Balbi.02    | device_* calls
 Felipe.Balbi.03    | input device registration before irq enabling
 Felipe.Balbi.04    | kzalloc allocation never to be freed

 Tony.Lindgren.01   | test in omap2 and omap3
 Tony.Lindgren.02   | add cpu_is_omap44xx()

 Kevin.Hillman.01   | drop device_* calls
 Kevin.Hillman.01   | use runtime PM API

 Tomas.Petazzoni.01 | oh_name declaration

v5
 Basak.Partha.01 | Enable Wakeup patch dependency by Rajendra
 Basak.Partha.02 | dev_pm_ops dummy functions, avoid .runtime functions
 Basak.Partha.03 | Remove omap_hwmod_for_each_by_class 
 Basak.Partha.04 | Remove request_mem_region
 Basak.Partha.04 | Overall PM runtime implementation

 Benoit.Cousson.01 | Detailed history required

 Anand.Gadiyar.01 | s/initialization/init for omap4_keypad_initialization
                    It will be renamed to omap4_keyboard_init
 Anand.Gadiyar.02 | 2 unnecessary line additions
 Anand.Gadiyar.03 | 1 unnecessary line removal
 Anand.Gadiyar.04 | Correct interrupt line behaviour in a separate patch
 Anand.Gadiyar.05 | cpu_is_omap44xx() extra check

 Sergio.Aguirre.01 | Change sdp4430_keypad_data naming, use keypad_data instead
 Sergio.Aguirre.02 | Remove unnecessary keypad_data variable
 Sergio.Aguirre.03 | 2 changes for name/oh_name definition, to be const
 Sergio.Aguirre.04 | Use sdp4430_keypad_data variable directly
 Sergio.Aguirre.05 | Add check for return value for WARN(IS_ERR(od)...

 Manjunatha.GK.01 | Use different subject: OMAP3: hwmod data: add system DMA
 Manjunatha.GK.02 | change unsigned used for negative number
 Manjunatha.GK.03 | cpu_is_omap44xx() under CONFIG_ARCH_OMAP4

---

Abraham Arce (5):
  Input: omap4 - use platform device helpers
  Input: omap4 - SYSCONFIG register configuration
  Input: omap4 - Interrupt line configuration
  OMAP4: Keyboard device registration
  Input: omap4 - pm runtime

Benoit Cousson (1):
  OMAP4: hwmod data: add keyboard controller

Mike Turquette (1):
  Input: omap4 - Wake-up on events & long presses

Syed Rafiuddin (1):
  OMAP4: Keyboard board support

 arch/arm/mach-omap2/board-4430sdp.c            |   90 ++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c                  |   39 ++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c     |   69 ++++++++++++++++++
 arch/arm/plat-omap/include/plat/omap4-keypad.h |    4 +-
 drivers/input/keyboard/omap4-keypad.c          |   66 ++++++++++++++----
 5 files changed, 251 insertions(+), 17 deletions(-)


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

* [PATCH v6 1/8] OMAP4: hwmod data: add keyboard controller
  2010-09-30  5:29 [PATCH v6 0/8] OMAP4 Keyboard Controller Support Abraham Arce
@ 2010-09-30  5:29 ` Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 2/8] Input: omap4 - use platform device helpers Abraham Arce
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Abraham Arce @ 2010-09-30  5:29 UTC (permalink / raw)
  To: linux-input, linux-omap; +Cc: Benoit Cousson, Abraham Arce

From: Benoit Cousson <b-cousson@ti.com>

Add hwmod data for OMAP4 keyboard controller
taking the following patch as base:

 OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Abraham Arce <x0066660@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   69 ++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index e20b0ee..c04a04d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -413,6 +413,72 @@ static struct omap_hwmod omap44xx_mpu_private_hwmod = {
 };
 
 /*
+ * 'kbd' class
+ * keyboard controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_kbd_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap44xx_kbd_hwmod_class = {
+	.name = "kbd",
+	.sysc = &omap44xx_kbd_sysc,
+};
+
+/* kbd */
+static struct omap_hwmod omap44xx_kbd_hwmod;
+static struct omap_hwmod_irq_info omap44xx_kbd_irqs[] = {
+	{ .irq = 120 + OMAP44XX_IRQ_GIC_START },
+};
+
+static struct omap_hwmod_addr_space omap44xx_kbd_addrs[] = {
+	{
+		.pa_start	= 0x4a31c000,
+		.pa_end		= 0x4a31c07f,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_wkup -> kbd */
+static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = {
+	.master		= &omap44xx_l4_wkup_hwmod,
+	.slave		= &omap44xx_kbd_hwmod,
+	.clk		= "l4_wkup_clk_mux_ck",
+	.addr		= omap44xx_kbd_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap44xx_kbd_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* kbd slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_kbd_slaves[] = {
+	&omap44xx_l4_wkup__kbd,
+};
+
+static struct omap_hwmod omap44xx_kbd_hwmod = {
+	.name		= "kbd",
+	.class		= &omap44xx_kbd_hwmod_class,
+	.mpu_irqs	= omap44xx_kbd_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_kbd_irqs),
+	.main_clk	= "kbd_fck",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
+		},
+	},
+	.slaves		= omap44xx_kbd_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap44xx_kbd_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
+};
+
+/*
  * 'mpu' class
  * mpu sub-system
  */
@@ -470,6 +536,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 	/* mpu_bus class */
 	&omap44xx_mpu_private_hwmod,
 
+	/* kbd class */
+	&omap44xx_kbd_hwmod,
+
 	/* mpu class */
 	&omap44xx_mpu_hwmod,
 	NULL,
-- 
1.6.3.3


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

* [PATCH v6 2/8] Input: omap4 - use platform device helpers
  2010-09-30  5:29 [PATCH v6 0/8] OMAP4 Keyboard Controller Support Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 1/8] OMAP4: hwmod data: add keyboard controller Abraham Arce
@ 2010-09-30  5:29 ` Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 3/8] Input: omap4 - SYSCONFIG register configuration Abraham Arce
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Abraham Arce @ 2010-09-30  5:29 UTC (permalink / raw)
  To: linux-input, linux-omap; +Cc: Abraham Arce

Get mem and irq resources using platform helpers

 - platform_get_base
 - platform_get_irq

Signed-off-by: Abraham Arce <x0066660@ti.com>
---
 arch/arm/plat-omap/include/plat/omap4-keypad.h |    4 +--
 drivers/input/keyboard/omap4-keypad.c          |   40 +++++++++++++++++++++---
 2 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap4-keypad.h b/arch/arm/plat-omap/include/plat/omap4-keypad.h
index 522a8ab..2b1d9bc 100644
--- a/arch/arm/plat-omap/include/plat/omap4-keypad.h
+++ b/arch/arm/plat-omap/include/plat/omap4-keypad.h
@@ -8,9 +8,7 @@ struct omap4_keypad_platform_data {
 
 	u8 rows;
 	u8 cols;
-
-	u16 irq;
-	void __iomem *base;
 };
 
+extern int omap4_keyboard_init(struct omap4_keypad_platform_data *);
 #endif
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 975f8bb..788169d 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -148,7 +148,10 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	const struct omap4_keypad_platform_data *pdata;
 	struct omap4_keypad *keypad_data;
 	struct input_dev *input_dev;
+	struct resource *res;
+	resource_size_t size;
 	unsigned int row_shift, max_keys;
+	int irq;
 	int error;
 
 	/* platform data */
@@ -158,12 +161,14 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	if (!pdata->base) {
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
 		dev_err(&pdev->dev, "no base address specified\n");
 		return -EINVAL;
 	}
 
-	if (!pdata->irq) {
+	irq = platform_get_irq(pdev, 0);
+	if (!irq) {
 		dev_err(&pdev->dev, "no keyboard irq assigned\n");
 		return -EINVAL;
 	}
@@ -184,9 +189,23 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	keypad_data->base = pdata->base;
-	keypad_data->irq = pdata->irq;
+	size = resource_size(res);
+
+	res = request_mem_region(res->start, size, pdev->name);
+	if (!res) {
+		dev_err(&pdev->dev, "can't request mem region\n");
+		error = -EBUSY;
+		goto err_free_keypad;
+	}
 
+	keypad_data->base = ioremap(res->start, resource_size(res));
+	if (!keypad_data->base) {
+		dev_err(&pdev->dev, "can't ioremap mem resource\n");
+		error = -ENOMEM;
+		goto err_release_mem;
+	}
+
+	keypad_data->irq = irq;
 	keypad_data->row_shift = row_shift;
 	keypad_data->rows = pdata->rows;
 	keypad_data->cols = pdata->cols;
@@ -195,7 +214,7 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	keypad_data->input = input_dev = input_allocate_device();
 	if (!input_dev) {
 		error = -ENOMEM;
-		goto err_free_keypad;
+		goto err_unmap;
 	}
 
 	input_dev->name = pdev->name;
@@ -243,6 +262,10 @@ err_free_irq:
 	free_irq(keypad_data->irq, keypad_data);
 err_free_input:
 	input_free_device(input_dev);
+err_unmap:
+	iounmap(keypad_data->base);
+err_release_mem:
+	release_mem_region(res->start, size);
 err_free_keypad:
 	kfree(keypad_data);
 	return error;
@@ -251,9 +274,16 @@ err_free_keypad:
 static int __devexit omap4_keypad_remove(struct platform_device *pdev)
 {
 	struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
+	struct resource *res;
 
 	free_irq(keypad_data->irq, keypad_data);
 	input_unregister_device(keypad_data->input);
+
+	iounmap(keypad_data->base);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	release_mem_region(res->start, resource_size(res));
+
 	kfree(keypad_data);
 	platform_set_drvdata(pdev, NULL);
 
-- 
1.6.3.3


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

* [PATCH v6 3/8] Input: omap4 - SYSCONFIG register configuration
  2010-09-30  5:29 [PATCH v6 0/8] OMAP4 Keyboard Controller Support Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 1/8] OMAP4: hwmod data: add keyboard controller Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 2/8] Input: omap4 - use platform device helpers Abraham Arce
@ 2010-09-30  5:29 ` Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 4/8] Input: omap4 - Interrupt line configuration Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 6/8] OMAP4: Keyboard device registration Abraham Arce
  4 siblings, 0 replies; 6+ messages in thread
From: Abraham Arce @ 2010-09-30  5:29 UTC (permalink / raw)
  To: linux-input, linux-omap; +Cc: Abraham Arce

Remove SYSCONFIG register configuration, omap hwmod framework will
use internal API to modify as required

Other minor updates:

- Change a variable name from DEF to VAL, this represents a value
- Break line width to 80 characters

Signed-off-by: Abraham Arce <x0066660@ti.com>
---
 drivers/input/keyboard/omap4-keypad.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 788169d..2b61f5f 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -51,17 +51,15 @@
 #define OMAP4_KBD_FULLCODE63_32		0x48
 
 /* OMAP4 bit definitions */
-#define OMAP4_DEF_SYSCONFIG_SOFTRST	(1 << 1)
-#define OMAP4_DEF_SYSCONFIG_ENAWKUP	(1 << 2)
 #define OMAP4_DEF_IRQENABLE_EVENTEN	(1 << 0)
 #define OMAP4_DEF_IRQENABLE_LONGKEY	(1 << 1)
 #define OMAP4_DEF_IRQENABLE_TIMEOUTEN	(1 << 2)
 #define OMAP4_DEF_CTRL_NOSOFTMODE	(1 << 1)
 #define OMAP4_DEF_CTRLPTVVALUE		(1 << 2)
 #define OMAP4_DEF_CTRLPTV		(1 << 1)
-#define OMAP4_DEF_IRQDISABLE		0x00
 
 /* OMAP4 values */
+#define OMAP4_VAL_IRQDISABLE		0x00
 #define OMAP4_VAL_DEBOUNCINGTIME	0x07
 #define OMAP4_VAL_FUNCTIONALCFG		0x1E
 
@@ -82,13 +80,11 @@ struct omap4_keypad {
 
 static void __devinit omap4_keypad_config(struct omap4_keypad *keypad_data)
 {
-	__raw_writel(OMAP4_DEF_SYSCONFIG_SOFTRST | OMAP4_DEF_SYSCONFIG_ENAWKUP,
-			keypad_data->base + OMAP4_KBD_SYSCONFIG);
 	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
 			keypad_data->base + OMAP4_KBD_CTRL);
 	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
 			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_DEF_IRQDISABLE,
+	__raw_writel(OMAP4_VAL_IRQDISABLE,
 			keypad_data->base + OMAP4_KBD_IRQSTATUS);
 	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
 			keypad_data->base + OMAP4_KBD_IRQENABLE);
@@ -104,11 +100,12 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	u32 *new_state = (u32 *) key_state;
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_DEF_IRQDISABLE,
+	__raw_writel(OMAP4_VAL_IRQDISABLE,
 		     keypad_data->base + OMAP4_KBD_IRQENABLE);
 
 	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
-	*(new_state + 1) = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE63_32);
+	*(new_state + 1) = __raw_readl(keypad_data->base
+						+ OMAP4_KBD_FULLCODE63_32);
 
 	for (row = 0; row < keypad_data->rows; row++) {
 		changed = key_state[row] ^ keypad_data->key_state[row];
-- 
1.6.3.3


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

* [PATCH v6 4/8] Input: omap4 - Interrupt line configuration
  2010-09-30  5:29 [PATCH v6 0/8] OMAP4 Keyboard Controller Support Abraham Arce
                   ` (2 preceding siblings ...)
  2010-09-30  5:29 ` [PATCH v6 3/8] Input: omap4 - SYSCONFIG register configuration Abraham Arce
@ 2010-09-30  5:29 ` Abraham Arce
  2010-09-30  5:29 ` [PATCH v6 6/8] OMAP4: Keyboard device registration Abraham Arce
  4 siblings, 0 replies; 6+ messages in thread
From: Abraham Arce @ 2010-09-30  5:29 UTC (permalink / raw)
  To: linux-input, linux-omap; +Cc: Abraham Arce

Select correct interrupt line behaviour

Signed-off-by: Abraham Arce <x0066660@ti.com>
---
 drivers/input/keyboard/omap4-keypad.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 2b61f5f..07e792e 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -238,7 +238,7 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	omap4_keypad_config(keypad_data);
 
 	error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
-			     IRQF_TRIGGER_FALLING,
+			     IRQF_TRIGGER_RISING,
 			     "omap4-keypad", keypad_data);
 	if (error) {
 		dev_err(&pdev->dev, "failed to register interrupt\n");
-- 
1.6.3.3


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

* [PATCH v6 6/8] OMAP4: Keyboard device registration
  2010-09-30  5:29 [PATCH v6 0/8] OMAP4 Keyboard Controller Support Abraham Arce
                   ` (3 preceding siblings ...)
  2010-09-30  5:29 ` [PATCH v6 4/8] Input: omap4 - Interrupt line configuration Abraham Arce
@ 2010-09-30  5:29 ` Abraham Arce
  4 siblings, 0 replies; 6+ messages in thread
From: Abraham Arce @ 2010-09-30  5:29 UTC (permalink / raw)
  To: linux-input, linux-omap; +Cc: Abraham Arce

Register keyboard device with hwmod framework

Signed-off-by: Abraham Arce <x0066660@ti.com>
---
 arch/arm/mach-omap2/devices.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9e5d51b..226cc7a 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -28,6 +28,9 @@
 #include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/dma.h>
+#include <plat/omap_device.h>
+#include <plat/omap_hwmod.h>
+#include <plat/omap4-keypad.h>
 
 #include "mux.h"
 
@@ -138,6 +141,42 @@ static inline void omap_init_camera(void)
 }
 #endif
 
+struct omap_device_pm_latency omap4_keyboard_latency[] = {
+	{
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+int omap4_keyboard_init(struct omap4_keypad_platform_data
+						*keypad_data)
+{
+	struct omap_device *od;
+	struct omap_hwmod *oh;
+	const char *oh_name = "kbd";
+	const char *name = "omap4-keypad";
+
+	if (!cpu_is_omap44xx())
+		return -ENODEV;
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (!oh) {
+		pr_err("Could not look up %s\n", oh_name);
+		return -ENODEV;
+	}
+
+	od = omap_device_build(name, -1, oh, keypad_data,
+			sizeof(*keypad_data),
+			omap4_keyboard_latency,
+			ARRAY_SIZE(omap4_keyboard_latency), 0);
+	if (WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
+		name, oh->name))
+		return -ENODEV;
+
+	return 0;
+}
+
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
 #define MBOX_REG_SIZE   0x120
-- 
1.6.3.3


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

end of thread, other threads:[~2010-09-30  5:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30  5:29 [PATCH v6 0/8] OMAP4 Keyboard Controller Support Abraham Arce
2010-09-30  5:29 ` [PATCH v6 1/8] OMAP4: hwmod data: add keyboard controller Abraham Arce
2010-09-30  5:29 ` [PATCH v6 2/8] Input: omap4 - use platform device helpers Abraham Arce
2010-09-30  5:29 ` [PATCH v6 3/8] Input: omap4 - SYSCONFIG register configuration Abraham Arce
2010-09-30  5:29 ` [PATCH v6 4/8] Input: omap4 - Interrupt line configuration Abraham Arce
2010-09-30  5:29 ` [PATCH v6 6/8] OMAP4: Keyboard device registration Abraham Arce

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).