From patchwork Fri Mar 11 23:08:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 521 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:17 -0000 Delivered-To: patches@linaro.org Received: by 10.224.67.207 with SMTP id s15cs76515qai; Fri, 11 Mar 2011 15:08:36 -0800 (PST) Received: by 10.236.95.38 with SMTP id o26mr3623892yhf.155.1299884916007; Fri, 11 Mar 2011 15:08:36 -0800 (PST) Received: from mail-yi0-f50.google.com (mail-yi0-f50.google.com [209.85.218.50]) by mx.google.com with ESMTPS id h41si6817932yhm.2.2011.03.11.15.08.34 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Mar 2011 15:08:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.218.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.218.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.218.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by yie30 with SMTP id 30so1690293yie.37 for ; Fri, 11 Mar 2011 15:08:34 -0800 (PST) Received: by 10.146.232.9 with SMTP id e9mr14416375yah.21.1299884914419; Fri, 11 Mar 2011 15:08:34 -0800 (PST) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net [70.73.24.112]) by mx.google.com with ESMTPS id i10sm5945021anh.32.2011.03.11.15.08.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Mar 2011 15:08:33 -0800 (PST) From: mathieu.poirier@linaro.org To: linux-arm-kernel@lists.infradead.org Cc: mathieu.poirier@linaro.org, patches@linaro.org, linus.walleij@stericsson.com Subject: [PATCH 07/10] ux500: added snowball-digio.c Date: Fri, 11 Mar 2011 16:08:09 -0700 Message-Id: <1299884892-6766-8-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1299884892-6766-1-git-send-email-mathieu.poirier@linaro.org> References: <1299884892-6766-1-git-send-email-mathieu.poirier@linaro.org> From: Alessandro Rubini This file includes definitions for the output led and 5 input buttons, 4 on the strip on the side and one soldered near the mmc slot. This work is originally by Gregory Hermant, split by me to a separate file. Signed-off-by: Alessandro Rubini --- arch/arm/mach-ux500/board-snowball-digio.c | 122 ++++++++++++++++++++++++++++ 1 files changed, 122 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-ux500/board-snowball-digio.c diff --git a/arch/arm/mach-ux500/board-snowball-digio.c b/arch/arm/mach-ux500/board-snowball-digio.c new file mode 100644 index 0000000..57f9e3f --- /dev/null +++ b/arch/arm/mach-ux500/board-snowball-digio.c @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2010-2011 ST-Ericsson + * + * This defines the user led (output) and 4-keys gpio keyboard (input) + * Original code by Gregory Hermant + * Split to a standalone file by Alessandro Rubini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "pins-db5500.h" + +static pin_cfg_t snowball_pins[] = { + PIN_CFG(32, GPIO) | PIN_INPUT_PULLUP, /* led */ + PIN_CFG(151, GPIO) | PIN_INPUT_PULLUP, /* button */ + PIN_CFG(152, GPIO) | PIN_INPUT_PULLUP, /* button */ + PIN_CFG(161, GPIO) | PIN_INPUT_PULLUP, /* button */ + PIN_CFG(162, GPIO) | PIN_INPUT_PULLUP, /* button */ +}; + +static struct gpio_led snowball_led_array[] = { + { + .name = "user_led", + .default_trigger = "none", + .gpio = 142, + }, +}; + +static struct gpio_led_platform_data snowball_led_data = { + .leds = snowball_led_array, + .num_leds = ARRAY_SIZE(snowball_led_array), +}; + +static struct platform_device snowball_led_dev = { + .name = "leds-gpio", + .dev = { + .platform_data = &snowball_led_data, + }, +}; + +static struct gpio_keys_button snowball_key_array[] = { + { + .gpio = 32, + .type = EV_KEY, + .code = KEY_1, + .desc = "userpb", + .active_low = 1, + .debounce_interval = 50, + .wakeup = 1, + }, + { + .gpio = 151, + .type = EV_KEY, + .code = KEY_2, + .desc = "extkb1", + .active_low = 1, + .debounce_interval = 50, + .wakeup = 1, + }, + { + .gpio = 152, + .type = EV_KEY, + .code = KEY_3, + .desc = "extkb2", + .active_low = 1, + .debounce_interval = 50, + .wakeup = 1, + }, + { + .gpio = 161, + .type = EV_KEY, + .code = KEY_4, + .desc = "extkb3", + .active_low = 1, + .debounce_interval = 50, + .wakeup = 1, + }, + { + .gpio = 162, + .type = EV_KEY, + .code = KEY_5, + .desc = "extkb4", + .active_low = 1, + .debounce_interval = 50, + .wakeup = 1, + }, +}; + +static struct gpio_keys_platform_data snowball_key_data = { + .buttons = snowball_key_array, + .nbuttons = ARRAY_SIZE(snowball_key_array), +}; + +static struct platform_device snowball_key_dev = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &snowball_key_data, + } +}; + +static int snowball_digio_init(void) +{ + nmk_config_pins(snowball_pins, ARRAY_SIZE(snowball_pins)); + platform_device_register(&snowball_led_dev); + platform_device_register(&snowball_key_dev); + return 0; +} + +module_init(snowball_digio_init); + +/* no release function: I'm lazy at this point */