From patchwork Fri Sep 13 08:32:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20015 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AAC2125E09 for ; Fri, 13 Sep 2013 08:32:52 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id c41sf963628yho.0 for ; Fri, 13 Sep 2013 01:32:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=DX9asI9wTfjFOPXZvbpVzK2Rysh44R4VlGdeSj4nmKM=; b=aIxtKmH2m/UGI+vYdzNvN96cbJwhoDvU9d/oWYXLMzaJR0SXpIKFcvmOAl0BctOZuT vKNzWhxLStMMoleNMHAtwvPvrF7kW7OTs83Xf7WxjK+aBDSNSd8zRtH2xeDDROgTVMMT GG33v6iJ5sjvy0HdfP339KqplDuIvmNZ5CnmKtrGcuKsUiovkhHwX+tbJJg0LAxwAXiT gxtnbf0nShKqftiBYKQMM2U33g48Mm8aK+F8kyoUauuwzoUS6ACVKemnv8vV4cyvr9he OaLpffOAtXmpi4qeaze5H7EhKgBNY9zvv7aC2mEe/eVUuUU8f4G0OyE8FQ6OyEIlNzT1 msXA== X-Gm-Message-State: ALoCoQmW0wQS85J2olMjxRUKFO2yxiD1iGoMGnZqkr1x55SA8gdkcLepTJzGCaTAuNraxCuTZ5DI X-Received: by 10.236.2.5 with SMTP id 5mr4539821yhe.23.1379061172364; Fri, 13 Sep 2013 01:32:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.58.244 with SMTP id u20ls1075362qeq.74.gmail; Fri, 13 Sep 2013 01:32:52 -0700 (PDT) X-Received: by 10.58.155.68 with SMTP id vu4mr6030163veb.21.1379061171412; Fri, 13 Sep 2013 01:32:51 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sc5si2774280vdc.139.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 01:32:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id gf11so707222vcb.11 for ; Fri, 13 Sep 2013 01:32:51 -0700 (PDT) X-Received: by 10.220.11.7 with SMTP id r7mr10943316vcr.12.1379061171289; Fri, 13 Sep 2013 01:32:51 -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 u4csp67876vcz; Fri, 13 Sep 2013 01:32:50 -0700 (PDT) X-Received: by 10.152.5.162 with SMTP id t2mr9940521lat.1.1379061170110; Fri, 13 Sep 2013 01:32:50 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id ze5si5240686lbb.88.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 01:32:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id lv10so735548lab.37 for ; Fri, 13 Sep 2013 01:32:49 -0700 (PDT) X-Received: by 10.152.2.74 with SMTP id 10mr303723las.36.1379061169409; Fri, 13 Sep 2013 01:32:49 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id js17sm3720488lab.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 01:32:48 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Imre Kaloz , Krzysztof Halasa , Dmitry Torokhov , Dmitry Torokhov Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 3/7 v2] input: misc: ixp4-beeper: use gpiolib strictly Date: Fri, 13 Sep 2013 10:32:40 +0200 Message-Id: <1379061160-22361-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.220.180 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: Dmitry Torokhov Acked-by: Arnd Bergmann Signed-off-by: Linus Walleij --- Hi Dmitry, requesting an ACK for this to take it through the GPIO tree as part of an IXP4 clean-up attempt. ChangeLog v1->v2: - Invert using the bang ! instead of XOR ~ --- 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..17ccba8 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; }