From patchwork Thu Feb 25 13:15:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram X-Patchwork-Id: 81985 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 o1PDFEZD003144 for ; Thu, 25 Feb 2010 13:15:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932477Ab0BYNPK (ORCPT ); Thu, 25 Feb 2010 08:15:10 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:49714 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932473Ab0BYNPH (ORCPT ); Thu, 25 Feb 2010 08:15:07 -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 o1PDF3Qi022856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Feb 2010 07:15:06 -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 o1PDF2TI020536; Thu, 25 Feb 2010 18:45:02 +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 o1PDF22n023876; Thu, 25 Feb 2010 18:45:02 +0530 Received: (from a0875517@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id o1PDF24W023873; Thu, 25 Feb 2010 18:45:02 +0530 From: Sriramakrishnan To: linux-omap@vger.kernel.org, linux-input@vger.kernel.org Cc: Sriramakrishnan Subject: [PATCH 3/3] AM3517: Board hookup for TCA6416 keypad driver. Date: Thu, 25 Feb 2010 18:45:01 +0530 Message-Id: <1267103701-23823-4-git-send-email-srk@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1267103701-23823-3-git-send-email-srk@ti.com> References: <1267103701-23823-1-git-send-email-srk@ti.com> <1267103701-23823-2-git-send-email-srk@ti.com> <1267103701-23823-3-git-send-email-srk@ti.com> 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]); Thu, 25 Feb 2010 13:15:15 +0000 (UTC) diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index b336adc..a8228b7 100644 --- 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,51 @@ 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, descr) \ +{ \ + .type = ev_type, \ + .code = ev_code, \ + .active_low = act_low, \ + .desc = "btn " descr, \ +} + +#define KEYPAD_BUTTON_LOW(event_code, description) \ + KEYPAD_BUTTON(EV_KEY, event_code, 1, description) + +static struct gpio_keys_button am3517_gpio_keys[] = { + KEYPAD_BUTTON_LOW(KEY_DOWN, "down"), + KEYPAD_BUTTON_LOW(KEY_UP, "up"), + KEYPAD_BUTTON_LOW(KEY_MENU, "menu"), + KEYPAD_BUTTON_LOW(KEY_MODE, "mode"), + KEYPAD_BUTTON_LOW(KEY_LEFTSHIFT, "shift"), + KEYPAD_BUTTON_LOW(KEY_REWIND, "rewind"), + KEYPAD_BUTTON_LOW(KEY_FORWARD, "forward"), + KEYPAD_BUTTON_LOW(KEY_STOP, "stop"), + KEYPAD_BUTTON_LOW(KEY_PLAY, "play"), + KEYPAD_BUTTON_LOW(KEY_RECORD, "rec"), }; + +static struct tca6416_keys_platform_data am3517evm_tca6416_keys_info = { + .buttons = am3517_gpio_keys, + .nbuttons = ARRAY_SIZE(am3517_gpio_keys), + .rep = 0, + .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),