diff mbox

[v6,6/8] OMAP4: Keyboard device registration

Message ID 1285824565-24906-7-git-send-email-x0066660@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Abraham Arce Sept. 30, 2010, 5:29 a.m. UTC
None
diff mbox

Patch

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