Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763082AbZJOVRI (ORCPT ); Thu, 15 Oct 2009 17:17:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754902AbZJOVRH (ORCPT ); Thu, 15 Oct 2009 17:17:07 -0400 Received: from ns.penguin.cz ([84.21.108.25]:42120 "EHLO ns.penguin.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758673AbZJOVRG (ORCPT ); Thu, 15 Oct 2009 17:17:06 -0400 Subject: Re: spitz: add gpio button support (fixes regression) From: Stanislav Brabec To: Pavel Machek Cc: Eric Miao , Andrew Morton , Mark Brown , rpurdie@rpsys.net, lenz@cs.wisc.edu, kernel list , Dirk@opfer-online.de, arminlitzel@web.de, Cyril Hrubis , thommycheck@gmail.com, linux-arm-kernel , dbaryshkov@gmail.com, omegamoon@gmail.com In-Reply-To: <20091006200933.GA1606@ucw.cz> References: <20091006074635.GA2775@ucw.cz> <1254829732.3546.35.camel@utx.utx.cz> <20091007085806.GB28807@elf.ucw.cz> <1254914991.4213.80.camel@hammer.suse.cz> <20091007120643.GA17069@rakim.wolfsonmicro.main> <20091006200933.GA1606@ucw.cz> Content-Type: text/plain; charset=UTF-8 Date: Thu, 15 Oct 2009 23:16:25 +0200 Message-Id: <1255641385.3985.55.camel@utx.utx.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1.1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3165 Lines: 103 Pavel Machek wrote: > > So what's the conclusion of the patch? Any ACK/NAK or patch needs updating? Well, AK_INT as it is implemented does not give any useful information, but it does not break anything. When inserting or removing remote, or (any) remote key is pressed, it generates one or more switch events. This code will have to be removed after implementing full remote support (turning pull-up resistor may cause false events, insert/remove needs more aggressive debounce), so I would prefer not adding AK_INT support. (See patch below.) > Please take this updated version. > Spitz switched to generic matrix-gpio keyboard driver in 2.6.32-rc0, > but that means that support for power button and lid switches was > lost. This restores it, using button-gpio code. I just tested it. It returns keys function, but suspend button does not cause suspend. Just an input event occurs, see below for output from evtest. Resume after "echo mem >/sys/power/state" is impossible. I think it is not intended behavior.  Event: time 1255640047.262125, type 1 (Key), code 205 (Suspend), value 1 Event: time 1255640047.262173, -------------- Report Sync ------------ Event: time 1255640047.813401, type 1 (Key), code 205 (Suspend), value 0 Event: time 1255640047.813446, -------------- Report Sync ------------ diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index ee8d603..a8ef058 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -375,6 +376,43 @@ static struct platform_device spitzkbd_device = { }; +static struct gpio_keys_button spitz_gpio_keys[] = { + { + .type = EV_KEY, + .code = KEY_SUSPEND, + .gpio = SPITZ_GPIO_ON_KEY, + .desc = "Power button", + .wakeup = 1, + }, + /* Two buttons detecting the LID state */ + { + .type = EV_SW, + .code = 0, + .gpio = SPITZ_GPIO_SWA, + .desc = "Lid SWA", + }, + { + .type = EV_SW, + .code = 1, + .gpio = SPITZ_GPIO_SWB, + .desc = "Lid SWB", + }, +}; + +static struct gpio_keys_platform_data spitz_gpio_keys_platform_data = { + .buttons = spitz_gpio_keys, + .nbuttons = ARRAY_SIZE(spitz_gpio_keys), +}; + +static struct platform_device spitz_gpio_keys_device = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &spitz_gpio_keys_platform_data, + }, +}; + + /* * Spitz LEDs */ @@ -689,6 +727,7 @@ static struct platform_device sharpsl_rom_device = { static struct platform_device *devices[] __initdata = { &spitzscoop_device, &spitzkbd_device, + &spitz_gpio_keys_device, &spitzled_device, &sharpsl_nand_device, &sharpsl_rom_device, ________________________________________________________________________ Stanislav Brabec http://www.penguin.cz/~utx/zaurus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/