From patchwork Tue Sep 10 12:30:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2866371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35A91BF43F for ; Tue, 10 Sep 2013 13:52:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F991202B9 for ; Tue, 10 Sep 2013 13:52:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5108E202B1 for ; Tue, 10 Sep 2013 13:52:25 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJNTv-0002hf-GX; Tue, 10 Sep 2013 12:55:48 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJNTJ-0003MQ-MG; Tue, 10 Sep 2013 12:55:09 +0000 Received: from bombadil.infradead.org ([2001:1868:205::9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJNS9-0003DP-87 for linux-arm-kernel@merlin.infradead.org; Tue, 10 Sep 2013 12:53:57 +0000 Received: from mail-la0-f53.google.com ([209.85.215.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJN6J-0002O2-Aw for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2013 12:31:24 +0000 Received: by mail-la0-f53.google.com with SMTP id el20so6033475lab.40 for ; Tue, 10 Sep 2013 05:30:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ROs6x3QC/ggsHCP+1A/kw3Nmc4akmvaP65HHzD/fx7k=; b=lOnm49j8oL4cSI4LTiu0evyDhbY6NElZAp10WjNoeFjUny0LmV1v2U6vL8seY+tRwP 1cc6xDHYUh8QkgFFI1c8dy1n59KsinNiO78OnTr1/jI3GgABg1xect+m8zcgKFWOkDTR Q5PnF8vpon38NkBRRK7+sPvAlKOZ3obIi1BU5+0HFgChTHXMwIryzSNBeQmzrdEff/Nk Qo0nXUMQsp7Vmii0LJk+Z5YGUdjvoCaLz+68fBSpIW+IxelvASlOe8fHq7UVE+B74YH8 d3y/jraJ+f+uW/A5BGz6VGK4gHjPH9UQvqCDIOyGVyzdp0ASYCSJOyWNlFEeFHnxEOeo meng== X-Gm-Message-State: ALoCoQn1fdjPrqb2FHNg+5V+cmsS2uYJgr+OjzTzBnNQeOBxny04+w+/AIVYyVgNVVqye1oijcsJ X-Received: by 10.112.64.7 with SMTP id k7mr1050862lbs.43.1378816237723; Tue, 10 Sep 2013 05:30:37 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id rd5sm8460376lbb.16.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:30:36 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 3/7] misc: ixp4-beeper: use gpiolib strictly Date: Tue, 10 Sep 2013 14:30:26 +0200 Message-Id: <1378816226-8016-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130910_053123_585425_48D550E9 X-CRM114-Status: GOOD ( 13.79 ) X-Spam-Score: -0.7 (/) Cc: Greg Kroah-Hartman , Linus Walleij , Alexandre Courbot , Arnd Bergmann , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Request and free the GPIO line used for the beeper properly. Then use the gpiolib API to flip the output of the GPIO pin instead of relying on hacks to poke the register bits. Cc: Imre Kaloz Cc: Krzysztof Halasa Cc: Alexandre Courbot Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: Linus Walleij Acked-by: Arnd Bergmann Acked-by: Greg Kroah-Hartman --- 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index f14afd0..fb3bec5 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c @@ -76,11 +76,13 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id) { + unsigned int pin = (unsigned int) dev_id; + /* clear interrupt */ *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND; /* flip the beeper output */ - *IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id); + gpio_set_value(pin, ~gpio_get_value(pin)); return IRQ_HANDLED; } @@ -108,11 +110,15 @@ static int ixp4xx_spkr_probe(struct platform_device *dev) input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); input_dev->event = ixp4xx_spkr_event; + err = gpio_request(dev->id, "ixp4-beeper"); + if (err) + goto err_free_device; + err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, IRQF_NO_SUSPEND, "ixp4xx-beeper", (void *) dev->id); if (err) - goto err_free_device; + goto err_free_gpio; err = input_register_device(input_dev); if (err) @@ -124,6 +130,8 @@ static int ixp4xx_spkr_probe(struct platform_device *dev) err_free_irq: free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); + err_free_gpio: + gpio_free(dev->id); err_free_device: input_free_device(input_dev); @@ -142,6 +150,7 @@ static int ixp4xx_spkr_remove(struct platform_device *dev) ixp4xx_spkr_control(pin, 0); free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); + gpio_free(dev->id); return 0; }