From patchwork Thu Sep 30 05:29:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abraham Arce X-Patchwork-Id: 218802 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8U5VM8B024392 for ; Thu, 30 Sep 2010 05:31:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753959Ab0I3FbU (ORCPT ); Thu, 30 Sep 2010 01:31:20 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42578 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753137Ab0I3FbT (ORCPT ); Thu, 30 Sep 2010 01:31:19 -0400 Received: from dlep33.itg.ti.com ([157.170.170.112]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o8U5VJYw004706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Sep 2010 00:31:19 -0500 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id o8U5VJqn001265; Thu, 30 Sep 2010 00:31:19 -0500 (CDT) Received: from dlee73.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o8U5VJ3j000940; Thu, 30 Sep 2010 00:31:19 -0500 (CDT) Received: from localhost.localdomain (128.247.79.52) by dlee73.ent.ti.com (157.170.170.88) with Microsoft SMTP Server (TLS) id 8.1.358.0; Thu, 30 Sep 2010 00:31:18 -0500 From: Abraham Arce To: , CC: Abraham Arce Subject: [PATCH v6 6/8] OMAP4: Keyboard device registration Date: Thu, 30 Sep 2010 00:29:23 -0500 Message-ID: <1285824565-24906-7-git-send-email-x0066660@ti.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1285824565-24906-1-git-send-email-x0066660@ti.com> References: <1285824565-24906-1-git-send-email-x0066660@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 30 Sep 2010 05:31:22 +0000 (UTC) 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 #include #include +#include +#include +#include #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