From patchwork Mon May 31 21:44:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abraham Arce X-Patchwork-Id: 103333 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4VLiwnk004375 for ; Mon, 31 May 2010 21:44:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754374Ab0EaVo4 (ORCPT ); Mon, 31 May 2010 17:44:56 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:40881 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753033Ab0EaVoz convert rfc822-to-8bit (ORCPT ); Mon, 31 May 2010 17:44:55 -0400 Received: from dlep33.itg.ti.com ([157.170.170.112]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o4VLisDk027019 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 31 May 2010 16:44:54 -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 o4VLisfl025847; Mon, 31 May 2010 16:44:54 -0500 (CDT) Received: from dsbe71.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o4VLisRK004435; Mon, 31 May 2010 16:44:54 -0500 (CDT) Received: from dlee03.ent.ti.com ([157.170.170.18]) by dsbe71.ent.ti.com ([156.117.232.23]) with mapi; Mon, 31 May 2010 16:44:54 -0500 From: "Arce, Abraham" To: "linux-input@vger.kernel.org" , "linux-omap@vger.kernel.org" CC: "dmitry.torokhov@gmail.com" Date: Mon, 31 May 2010 16:44:52 -0500 Subject: [RFC] [PATCH v3 2/4] OMAP4: Keyboard device registration Thread-Topic: [RFC] [PATCH v3 2/4] OMAP4: Keyboard device registration Thread-Index: AcsBCoBrEDqpqdLTSoqqEifwpX7ivA== Message-ID: <27F9C60D11D683428E133F85D2BB4A53043E537F74@dlee03.ent.ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US 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 (demeter.kernel.org [140.211.167.41]); Mon, 31 May 2010 21:44:58 +0000 (UTC) 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 #include #include +#include #include #include @@ -26,6 +27,9 @@ #include #include #include +#include +#include +#include #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