From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Walleij Subject: [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib Date: Tue, 10 Sep 2013 14:30:10 +0200 Message-ID: <1378816210-7977-1-git-send-email-linus.walleij@linaro.org> Return-path: Received: from mail-lb0-f181.google.com ([209.85.217.181]:34215 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751371Ab3IJMaW (ORCPT ); Tue, 10 Sep 2013 08:30:22 -0400 Received: by mail-lb0-f181.google.com with SMTP id u14so6015392lbd.26 for ; Tue, 10 Sep 2013 05:30:21 -0700 (PDT) Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: linux-gpio@vger.kernel.org, Imre Kaloz , Krzysztof Halasa Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij , Arnd Bergmann , Greg Kroah-Hartman The platform using this beeper has support for gpiolib, so there is no point to use the custom gpio_line* API. A strange ambiguity where a line was first set as input and then driven high was solved by first driving the line high as output and then switch it to input. Cc: Imre Kaloz Cc: Krzysztof Halasa Cc: Alexandre Courbot Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: Linus Walleij --- Arnd/Greg: seeking your ACK to take this through the GPIO tree as part of the attempt at cleaning out custom GPIO implementations. --- drivers/input/misc/ixp4xx-beeper.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index f34beb2..f14afd0 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c @@ -20,6 +20,7 @@ #include #include #include +#include #include MODULE_AUTHOR("Alessandro Zummo "); @@ -35,15 +36,12 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) spin_lock_irqsave(&beep_lock, flags); - if (count) { - gpio_line_config(pin, IXP4XX_GPIO_OUT); - gpio_line_set(pin, IXP4XX_GPIO_LOW); - + if (count) { + gpio_direction_output(pin, 0); *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE; } else { - gpio_line_config(pin, IXP4XX_GPIO_IN); - gpio_line_set(pin, IXP4XX_GPIO_HIGH); - + gpio_direction_output(pin, 1); + gpio_direction_input(pin); *IXP4XX_OSRT2 = 0; } -- 1.8.3.1