linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH v3 2/4] OMAP4: Keyboard device registration
@ 2010-05-31 21:44 Arce, Abraham
  2010-06-01  4:47 ` Felipe Balbi
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Arce, Abraham @ 2010-05-31 21:44 UTC (permalink / raw)
  To: linux-input@vger.kernel.org, linux-omap@vger.kernel.org
  Cc: dmitry.torokhov@gmail.com

Register keyboard device with hwmod framework

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

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2271b9b..64d68a9 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -15,6 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/slab.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -26,6 +27,9 @@
 #include <plat/mux.h>
 #include <mach/gpio.h>
 #include <plat/mmc.h>
+#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
+#include <plat/omap4-keypad.h>
 
 #include "mux.h"
 
@@ -136,6 +140,61 @@ static inline void omap_init_camera(void)
 }
 #endif
 
+#ifdef CONFIG_ARCH_OMAP4
+
+struct omap_device_pm_latency omap_keyboard_latency[] = {
+	{
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+int omap4_init_kp(struct omap4_keypad_platform_data *kp)
+{
+	struct omap_hwmod *oh;
+	struct omap_device *od;
+	struct omap4_keypad_platform_data *pdata;
+
+	unsigned int length = 0, id = 0;
+	int hw_mod_name_len = 16;
+	char oh_name[hw_mod_name_len];
+	char *name = "omap4-keypad";
+
+	length = snprintf(oh_name, hw_mod_name_len, "kbd");
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (!oh) {
+		pr_err("Could not look up %s\n", oh_name);
+		return -EIO;
+	}
+
+	pdata = kzalloc(sizeof(struct omap4_keypad_platform_data), GFP_KERNEL);
+	if (!pdata) {
+		WARN(1, "Keyboard pdata memory allocation failed\n");
+		return -ENOMEM;
+	}
+
+	pdata = kp;
+
+	pdata->base = oh->_rt_va;
+	pdata->irq = oh->mpu_irqs[0].irq;
+	pdata->device_enable = omap_device_enable;
+	pdata->device_idle = omap_device_idle;
+	pdata->device_shutdown = omap_device_shutdown;
+
+	od = omap_device_build(name, id, oh, pdata,
+			sizeof(struct matrix_keypad_platform_data),
+			omap_keyboard_latency,
+			ARRAY_SIZE(omap_keyboard_latency), 1);
+	WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
+		name, oh_name);
+
+	return 0;
+}
+
+#endif
+
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
 #define MBOX_REG_SIZE   0x120
-- 
1.5.4.3


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

end of thread, other threads:[~2010-06-11  7:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 21:44 [RFC] [PATCH v3 2/4] OMAP4: Keyboard device registration Arce, Abraham
2010-06-01  4:47 ` Felipe Balbi
2010-06-01  4:49   ` Felipe Balbi
2010-06-01 17:48     ` Kevin Hilman
2010-06-01  9:43 ` Tony Lindgren
2010-06-01 15:14   ` Arce, Abraham
2010-06-01 18:53     ` Felipe Balbi
2010-06-01 20:13       ` Dmitry Torokhov
2010-06-11  7:31         ` Tony Lindgren
2010-06-02  8:28 ` Thomas Petazzoni
2010-06-02 12:45   ` Arce, Abraham
2010-06-02 13:46     ` Thomas Petazzoni

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