@@ -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