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: 19851 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70C47246A4 for ; Tue, 10 Sep 2013 12:30:40 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id gd11sf8704454vcb.4 for ; Tue, 10 Sep 2013 05:30:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ROs6x3QC/ggsHCP+1A/kw3Nmc4akmvaP65HHzD/fx7k=; b=NyvQkkmVpAm9ByhMZibupHMLREyjX+wwq+Xuq46IANMDEQPvQelA9/a/ixmM1qaNXa 3qYinpGr0aJ8t0st0Rf02Hv5dLWEOonhYwEyFzoiHZ9eXYtarmEKvp1haE3yYIj5NgsT wgJz8KjKrxUYQfIDFNxWwBCu8/gVkMMIzHKPpExXfJM/7UId4vf1gLN3VP1DBNGx3nrm bFcfFSFDxqlXsrDNX0MpjfzQEbdWN/m2qUhhOVXsZgl7zu9lzFQ7LJ9bYBlv0BPdBh23 XCn8IU7IpSI1z0NF27a6+4nJNGS76aDAh4udNMYRz3m9aRyAl+1kP4cg8ntaW1eZs5g3 Q32w== X-Received: by 10.236.138.108 with SMTP id z72mr597058yhi.18.1378816240230; Tue, 10 Sep 2013 05:30:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.83 with SMTP id s19ls2140057qeu.7.gmail; Tue, 10 Sep 2013 05:30:40 -0700 (PDT) X-Received: by 10.220.186.202 with SMTP id ct10mr23228133vcb.14.1378816239989; Tue, 10 Sep 2013 05:30:39 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id st7si3623294vdc.42.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:30:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id q14so5107121vbe.27 for ; Tue, 10 Sep 2013 05:30:39 -0700 (PDT) X-Gm-Message-State: ALoCoQkl8+7t8nYVB/DhlXESvDRKAZ/8y1tUCum9yIP8cwhrljxu6MirOfs1svM5r6XRRO6yiqHl X-Received: by 10.58.165.70 with SMTP id yw6mr8269116veb.19.1378816239817; Tue, 10 Sep 2013 05:30:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp18397vcz; Tue, 10 Sep 2013 05:30:39 -0700 (PDT) X-Received: by 10.112.72.229 with SMTP id g5mr21078687lbv.10.1378816238387; Tue, 10 Sep 2013 05:30:38 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx.google.com with ESMTPS id pw1si7986744lbb.31.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:30:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.182 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id c11so6111467lbj.41 for ; Tue, 10 Sep 2013 05:30:37 -0700 (PDT) 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 Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij , Arnd Bergmann , Greg Kroah-Hartman 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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; }