From patchwork Mon Apr 8 06:28:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10888805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 207CD1669 for ; Mon, 8 Apr 2019 06:29:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03FF128614 for ; Mon, 8 Apr 2019 06:29:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC11A28619; Mon, 8 Apr 2019 06:29:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 70AD628614 for ; Mon, 8 Apr 2019 06:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QdpVEy7Ivfj/SwwrXgklnOZngNyOLmSQCUXWkZLxaZ0=; b=CbeieE661eObNE Kht8peUEhM4c+NoHvUj3wQLUDnzo2pl5qzy7t7Prhbg/Da4Wy6WDDl3/ddXNoid0hoUuFUEIqG1W4 AhEryp9Ad/t8cIdonX/UW+paSBMKu/+gBeMCrobnx6NcDHvjG2lj+f6drTqUCBL28ox/kJq6Yn9dG 6LQtO2dP4BGbr5M6y9imZr4GvgsRmV3gjUBvI+y2ZZ3eC8wXehehgHziSl+oumaAGoPn00kGkpi/C Z39kj0C3q5VSNnrCJmUxQx3xd6gCHqyy+l6j1iNybZluv8XE67X2XcySpP7Mz7gjKKtkRLh3tXa4G F79nxFzPCOqfXAj58tug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDNmM-0004RC-Ms; Mon, 08 Apr 2019 06:29:14 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDNlr-0003lm-2H for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2019 06:28:46 +0000 Received: by mail-lf1-x144.google.com with SMTP id u21so8589647lfu.2 for ; Sun, 07 Apr 2019 23:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ba7aPSJZttbHr7w2eZROfyslyovkkL1VUhynTDQMTZY=; b=h8pcE0l495SsUENYlc8LC8n2Me/Ngk1ibSiEoUl/J/ctMUa7/KkD01Dc+0eDaHoLtO sm/c/ypuGbcwbF7fEb4bceTfVFETgan/qChV5gBd+ns6iLW40zPW+wTRv6BLSoIhAAZj t54icy+XJoWZ0Tg7leiNvmXRbk8mfH4Q/RhCsgMkNQpETtY+u0Tb2gsZuecw/SPZ6Cah uMuzOL39u3+fQq2WpXzexGGPSe1WImQ27jsNBLzzoPH3NIk93pRd04IKEsmVQXSaFXsX Yl8lybG3x/6fcZSZULPc2dFEbnAU8T+CL8XZhXdlfhxUIJOFuSXnKXyjQQsnFn2ntZvz mpTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ba7aPSJZttbHr7w2eZROfyslyovkkL1VUhynTDQMTZY=; b=uE1jBYq8cG7/iqkW9JVMHd1c/ooFfu9RpaXKsB/gsBRXyl5WqUeMTYSmptQGVtyXA9 +8YbhaKZ5cQSEGwlcO1HIR8D8QrMdbI84//+ajXaJdzE6wQ3T6wjQAqXDEfkVYV14dug W9icV5sNiyY7wHKH0E0p22nGpaT+5pn38numZ+pxG1/brt20WDJzTzk4ojS0d2jhiVDl AXCgvuyzL2EYaMWmzx7hbkYyxnWX/Y4JHdNEQygVJhkktGUFTo9Hhh6I1/DC2Ae0gg9+ wFxUFpJJKPj+QEAm+hutaGbRTw1mQDq+Fd7sFsLzm+JWspwGl8w2XHbzFWta606DOI8/ n6VA== X-Gm-Message-State: APjAAAU9sdUkoI+zDvSFJp2QpN2xkOyE3GymQHMyKZ1imyfNm0DeMhzS zhUyqegQPyzH8ovqZNhIsxa09vaVWak= X-Google-Smtp-Source: APXvYqyHpK8T5PGRZ+5yqJYPNJv6HpJ0mmD/0s2uul7A9Jr/hpONqL6yMiPDaG+PRez+tXnOEGLV3g== X-Received: by 2002:ac2:5a41:: with SMTP id r1mr14248890lfn.60.1554704921013; Sun, 07 Apr 2019 23:28:41 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id v11sm5884443lfb.68.2019.04.07.23.28.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Apr 2019 23:28:40 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Imre Kaloz , Krzysztof Halasa Subject: [PATCH 03/31 v3] ARM: ixp4xx: Pass IRQ resource to beeper Date: Mon, 8 Apr 2019 08:28:03 +0200 Message-Id: <20190408062831.16422-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190408062831.16422-1-linus.walleij@linaro.org> References: <20190408062831.16422-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190407_232843_341913_E7EEB2C8 X-CRM114-Status: GOOD ( 17.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP All IXP4xx devices except the beeper passes the IRQ as a resource, augment the NSLU2 beeper to do the same. This is a prerequisite for SPARSE_IRQ. Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - Rebased on v5.1-rc1 --- arch/arm/mach-ixp4xx/nslu2-setup.c | 10 +++++++++- drivers/input/misc/ixp4xx-beeper.c | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 341b263482ef..7c2b6604187e 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -125,10 +125,18 @@ static struct platform_device nslu2_i2c_gpio = { }, }; +static struct resource nslu2_beeper_resources[] = { + { + .start = IRQ_IXP4XX_TIMER2, + .flags = IORESOURCE_IRQ, + }, +}; + static struct platform_device nslu2_beeper = { .name = "ixp4xx-beeper", .id = NSLU2_GPIO_BUZZ, - .num_resources = 0, + .resource = nslu2_beeper_resources, + .num_resources = ARRAY_SIZE(nslu2_beeper_resources), }; static struct resource nslu2_uart_resources[] = { diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 1fe149f3def2..4776273fa10b 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c @@ -30,6 +30,8 @@ MODULE_ALIAS("platform:ixp4xx-beeper"); static DEFINE_SPINLOCK(beep_lock); +static int ixp4xx_timer2_irq; + static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) { unsigned long flags; @@ -90,6 +92,7 @@ static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id) static int ixp4xx_spkr_probe(struct platform_device *dev) { struct input_dev *input_dev; + int irq; int err; input_dev = input_allocate_device(); @@ -110,15 +113,22 @@ 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; + irq = platform_get_irq(dev, 0); + if (irq < 0) { + err = irq; + goto err_free_device; + } + err = gpio_request(dev->id, "ixp4-beeper"); if (err) goto err_free_device; - err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, + err = request_irq(irq, &ixp4xx_spkr_interrupt, IRQF_NO_SUSPEND, "ixp4xx-beeper", (void *) dev->id); if (err) goto err_free_gpio; + ixp4xx_timer2_irq = irq; err = input_register_device(input_dev); if (err) @@ -129,7 +139,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev) return 0; err_free_irq: - free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); + free_irq(irq, (void *)dev->id); err_free_gpio: gpio_free(dev->id); err_free_device: @@ -146,10 +156,10 @@ static int ixp4xx_spkr_remove(struct platform_device *dev) input_unregister_device(input_dev); /* turn the speaker off */ - disable_irq(IRQ_IXP4XX_TIMER2); + disable_irq(ixp4xx_timer2_irq); ixp4xx_spkr_control(pin, 0); - free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); + free_irq(ixp4xx_timer2_irq, (void *)dev->id); gpio_free(dev->id); return 0; @@ -161,7 +171,7 @@ static void ixp4xx_spkr_shutdown(struct platform_device *dev) unsigned int pin = (unsigned int) input_get_drvdata(input_dev); /* turn off the speaker */ - disable_irq(IRQ_IXP4XX_TIMER2); + disable_irq(ixp4xx_timer2_irq); ixp4xx_spkr_control(pin, 0); }