From patchwork Fri Mar 12 09:18:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram X-Patchwork-Id: 85220 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 o2C9ITWa025025 for ; Fri, 12 Mar 2010 09:18:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757127Ab0CLJS2 (ORCPT ); Fri, 12 Mar 2010 04:18:28 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:40436 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757061Ab0CLJSZ (ORCPT ); Fri, 12 Mar 2010 04:18:25 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o2C9IMVL024190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Mar 2010 03:18:24 -0600 Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o2C9IKEi014821; Fri, 12 Mar 2010 14:48:20 +0530 (IST) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by psplinux051.india.ti.com (8.13.1/8.13.1) with ESMTP id o2C9IKvK007336; Fri, 12 Mar 2010 14:48:20 +0530 Received: (from a0875517@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id o2C9IKY3007333; Fri, 12 Mar 2010 14:48:20 +0530 From: Sriramakrishnan To: linux-omap@vger.kernel.org, linux-input@vger.kernel.org Cc: Sriramakrishnan Subject: [PATCHv2 2/3] AM3517: Board hookup for TCA6416 keypad driver. Date: Fri, 12 Mar 2010 14:48:18 +0530 Message-Id: <1268385499-7075-3-git-send-email-srk@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1268385499-7075-2-git-send-email-srk@ti.com> References: <1268385499-7075-1-git-send-email-srk@ti.com> <1268385499-7075-2-git-send-email-srk@ti.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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]); Fri, 12 Mar 2010 09:18:30 +0000 (UTC) diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c old mode 100644 new mode 100755 index 6ae8805..d50e505 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c @@ -20,7 +20,10 @@ #include #include #include +#include #include +#include +#include #include #include @@ -88,16 +91,50 @@ static struct i2c_board_info __initdata am3517evm_tca6416_info_0[] = { }; /* Mounted on UI Card */ -static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_1 = { +/* IO expander at address 0x20 on UI card will be managed by Keypad driver */ + +static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = { .gpio_base = OMAP_MAX_GPIO_LINES + 16, }; -static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = { - .gpio_base = OMAP_MAX_GPIO_LINES + 32, + +/*Keypad Initialization */ +#define KEYPAD_PIN_MASK 0xFFC0 + +#define KEYPAD_BUTTON(ev_type, ev_code, act_low) \ +{ \ + .type = ev_type, \ + .code = ev_code, \ + .active_low = act_low, \ +} + +#define KEYPAD_BUTTON_LOW(event_code) \ + KEYPAD_BUTTON(EV_KEY, event_code, 1) + +static struct tca6416_button am3517_gpio_keys[] = { + KEYPAD_BUTTON_LOW(KEY_DOWN), + KEYPAD_BUTTON_LOW(KEY_UP), + KEYPAD_BUTTON_LOW(KEY_MENU), + KEYPAD_BUTTON_LOW(KEY_MODE), + KEYPAD_BUTTON_LOW(KEY_LEFTSHIFT), + KEYPAD_BUTTON_LOW(KEY_REWIND), + KEYPAD_BUTTON_LOW(KEY_FORWARD), + KEYPAD_BUTTON_LOW(KEY_STOP), + KEYPAD_BUTTON_LOW(KEY_PLAY), + KEYPAD_BUTTON_LOW(KEY_RECORD), }; + +static struct tca6416_keys_platform_data am3517evm_tca6416_keys_info = { + .buttons = am3517_gpio_keys, + .nbuttons = ARRAY_SIZE(am3517_gpio_keys), + .rep = 1, + .use_polling = 1, + .pinmask = KEYPAD_PIN_MASK, +}; + static struct i2c_board_info __initdata am3517evm_ui_tca6416_info[] = { { - I2C_BOARD_INFO("tca6416", 0x20), - .platform_data = &am3517evm_ui_gpio_expander_info_1, + I2C_BOARD_INFO("tca6416-keys", 0x20), + .platform_data = &am3517evm_tca6416_keys_info, }, { I2C_BOARD_INFO("tca6416", 0x21),