From patchwork Fri Sep 4 16:24:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: miguel.aguilar@ridgerun.com X-Patchwork-Id: 45703 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n84GR8kI029889 for ; Fri, 4 Sep 2009 16:27:09 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id n84GPRHf018963; Fri, 4 Sep 2009 11:25:32 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n84GPQmq026988; Fri, 4 Sep 2009 11:25:26 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9B5778062A; Fri, 4 Sep 2009 11:25:13 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 8F03C8062A for ; Fri, 4 Sep 2009 11:25:11 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n84GPB9H025834 for ; Fri, 4 Sep 2009 11:25:11 -0500 (CDT) Received: from mail15-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.111]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n84GP6jh019250 for ; Fri, 4 Sep 2009 11:25:11 -0500 Received: from mail15-va3 (localhost.localdomain [127.0.0.1]) by mail15-va3-R.bigfish.com (Postfix) with ESMTP id 047351A68507 for ; Fri, 4 Sep 2009 16:25:06 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2fh64h) X-Spam-TCS-SCL: 3:0 X-MS-Exchange-Organization-Antispam-Report: OrigIP: 74.208.67.6; Service: EHS Received: by mail15-va3 (MessageSwitch) id 1252081500349807_9188; Fri, 4 Sep 2009 16:25:00 +0000 (UCT) Received: from mail.navvo.net (mail.navvo.net [74.208.67.6]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail15-va3.bigfish.com (Postfix) with ESMTP id 3FC1DCC8053; Fri, 4 Sep 2009 16:25:00 +0000 (UTC) Received: from [201.198.127.70] (helo=localhost.localdomain) by mail.navvo.net with esmtpa (Exim 4.63) (envelope-from ) id 1Mjbar-0002i7-33; Fri, 04 Sep 2009 11:24:59 -0500 From: miguel.aguilar@ridgerun.com To: davinci-linux-open-source@linux.davincidsp.com, nsnehaprabha@ti.com Date: Fri, 4 Sep 2009 10:24:57 -0600 Message-Id: <1252081497-31582-1-git-send-email-miguel.aguilar@ridgerun.com> X-Mailer: git-send-email 1.6.0.4 X-SA-Exim-Connect-IP: 201.198.127.70 X-SA-Exim-Mail-From: miguel.aguilar@ridgerun.com X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on mail.navvo.net X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,BAYES_00, NO_REAL_NAME autolearn=ham version=3.1.7-deb X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000) X-SA-Exim-Scanned: Yes (on mail.navvo.net) Cc: santiago.nunez@ridgerun.com, todd.fischer@ridgerun.com, clark.becker@ridgerun.com, Miguel Aguilar Subject: [PATCH 2/2] Davinci: DM365: Enable keypad support for DM365 EVM X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Miguel Aguilar The general structures are defined at DM365 SoC file and the specific platform data structure for the EVM is defined defined at board file. This patch was tested on a DM365 EVM rev c. Signed-off-by: Miguel Aguilar --- arch/arm/configs/davinci_all_defconfig | 1 + arch/arm/mach-davinci/board-dm365-evm.c | 50 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/dm365.c | 31 +++++++++++++++++ arch/arm/mach-davinci/include/mach/dm365.h | 5 +++ 4 files changed, 87 insertions(+), 0 deletions(-) diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig index ec63c15..e994c83 100644 --- a/arch/arm/configs/davinci_all_defconfig +++ b/arch/arm/configs/davinci_all_defconfig @@ -763,6 +763,7 @@ CONFIG_KEYBOARD_GPIO=y # CONFIG_KEYBOARD_STOWAWAY is not set # CONFIG_KEYBOARD_SUNKBD is not set CONFIG_KEYBOARD_XTKBD=m +CONFIG_KEYBOARD_DAVINCI_DM365=m # CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not set diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index f6adf79..c3de5ad 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -38,6 +38,7 @@ #include #include #include +#include static inline int have_imager(void) @@ -192,6 +193,53 @@ static struct davinci_i2c_platform_data i2c_pdata = { .bus_delay = 0 /* usec */, }; +/* Masks for the various keys on the DM365 EVM */ +#define KEY_DM365_KEY2 0 +#define KEY_DM365_LEFT 1 +#define KEY_DM365_EXIT 2 +#define KEY_DM365_DOWN 3 +#define KEY_DM365_ENTER 4 +#define KEY_DM365_UP 5 +#define KEY_DM365_KEY1 6 +#define KEY_DM365_RIGHT 7 +#define KEY_DM365_MENU 8 +#define KEY_DM365_REC 9 +#define KEY_DM365_REW 10 +#define KEY_DM365_SKIPMINUS 11 +#define KEY_DM365_STOP 12 +#define KEY_DM365_FF 13 +#define KEY_DM365_SKIPPLUL 14 +#define KEY_DM365_PLAYPAUSE 15 + +static int dm365evm_keymap[] = { + KEY_DM365_KEY2, + KEY_DM365_LEFT, + KEY_DM365_EXIT, + KEY_DM365_DOWN, + KEY_DM365_ENTER, + KEY_DM365_UP, + KEY_DM365_KEY1, + KEY_DM365_RIGHT, + KEY_DM365_MENU, + KEY_DM365_REC, + KEY_DM365_REW, + KEY_DM365_SKIPMINUS, + KEY_DM365_STOP, + KEY_DM365_FF, + KEY_DM365_SKIPPLUL, + KEY_DM365_PLAYPAUSE, + 0 +}; + +static struct davinci_kp_platform_data dm365evm_kp_data = { + .keymap = dm365evm_keymap, + .keymapsize = ARRAY_SIZE(dm365evm_keymap), + .rep = 1, + /* Scan period = strobe + interval */ + .strobe = 0x5, + .interval = 0x2, +}; + static int cpld_mmc_get_cd(int module) { if (!cpld) @@ -476,6 +524,8 @@ static __init void dm365_evm_init(void) /* maybe setup mmc1/etc ... _after_ mmc0 */ evm_init_cpld(); + + dm365_init_kp(&dm365evm_kp_data); } static __init void dm365_evm_irq_init(void) diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index e815174..53fc84f 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "clock.h" #include "mux.h" @@ -822,6 +823,29 @@ static struct map_desc dm365_io_desc[] = { }, }; +static struct resource kp_resources[] = { + { + /* registers */ + .start = DM365_KEYSCAN_BASE, + .end = DM365_KEYSCAN_BASE + SZ_1K - 1, + .flags = IORESOURCE_MEM, + }, + { + /* interrupt */ + .start = IRQ_DM365_KEYINT, + .end = IRQ_DM365_KEYINT, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device dm365_kp_device = { + .name = "dm365_keypad", + .id = 0, + .num_resources = ARRAY_SIZE(kp_resources), + .resource = kp_resources, +}; + + /* Contents of JTAG ID register used to identify exact cpu type */ static struct davinci_id dm365_ids[] = { { @@ -907,6 +931,13 @@ static struct davinci_soc_info davinci_soc_info_dm365 = { .sram_len = SZ_32K, }; +void __init dm365_init_kp(struct davinci_kp_platform_data *pdata) +{ + davinci_cfg_reg(DM365_KEYPAD); + dm365_kp_device.dev.platform_data = pdata; + platform_device_register(&dm365_kp_device); +} + void __init dm365_init(void) { davinci_common_init(&davinci_soc_info_dm365); diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h index 09db434..cbd00dc 100644 --- a/arch/arm/mach-davinci/include/mach/dm365.h +++ b/arch/arm/mach-davinci/include/mach/dm365.h @@ -16,6 +16,7 @@ #include #include #include +#include #define DM365_EMAC_BASE (0x01D07000) #define DM365_EMAC_CNTRL_OFFSET (0x0000) @@ -24,6 +25,10 @@ #define DM365_EMAC_MDIO_OFFSET (0x4000) #define DM365_EMAC_CNTRL_RAM_SIZE (0x2000) +/* Base of keypad register bank */ +#define DM365_KEYSCAN_BASE (0x01C69400) + void __init dm365_init(void); +void __init dm365_init_kp(struct davinci_kp_platform_data *pdata); #endif /* __ASM_ARCH_DM365_H */