All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: linux-arm-kernel@lists.infradead.org,
	Imre Kaloz <kaloz@openwrt.org>,
	Krzysztof Halasa <khalasa@piap.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 03/31 v3] ARM: ixp4xx: Pass IRQ resource to beeper
Date: Mon,  8 Apr 2019 08:28:03 +0200	[thread overview]
Message-ID: <20190408062831.16422-4-linus.walleij@linaro.org> (raw)
In-Reply-To: <20190408062831.16422-1-linus.walleij@linaro.org>

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 <linus.walleij@linaro.org>
---
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);
 }
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-04-08  6:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08  6:28 [PATCH 00/31 v3] ARM: ixp4xx: Modernize and DT support Linus Walleij
2019-04-08  6:28 ` [PATCH 01/31 v3] ARM: ixp4xx: Add myself as maintainer Linus Walleij
2019-04-08  6:28 ` [PATCH 02/31 v3] ARM: ixp4xx: Convert to MULTI_IRQ_HANDLER Linus Walleij
2019-04-08  6:28 ` Linus Walleij [this message]
2019-04-08  6:28 ` [PATCH 04/31 v3] ARM: ixp4xx: Convert to SPARSE_IRQ Linus Walleij
2019-04-08  6:28 ` [PATCH 05/31 v3] irqchip: Add driver for IXP4xx Linus Walleij
2019-04-08  6:28 ` [PATCH 06/31 v3] gpio: ixp4xx: Add driver for the IXP4xx GPIO Linus Walleij
2019-04-08  6:28 ` [PATCH 07/31 v3] ARM: ixp4xx: Switch to use new IRQ+GPIO drivers Linus Walleij
2019-04-08  6:28 ` [PATCH 08/31 v3] clocksource/drivers/ixp4xx: Add driver Linus Walleij
2019-04-08  6:28 ` [PATCH 09/31 v3] ARM: ixp4xx: Switch to use new timer driver Linus Walleij
2019-04-08  6:28 ` [PATCH 10/31 v3] irqchip: ixp4xx: Add DT bindings Linus Walleij
2019-04-08  6:28   ` Linus Walleij
2019-04-08  6:28 ` [PATCH 11/31 v3] irqchip: ixp4xx: Add OF initialization support Linus Walleij
2019-04-08  6:28 ` [PATCH 12/31 v3] clocksource/drivers/ixp4xx: Add DT bindings Linus Walleij
2019-04-08  6:28   ` Linus Walleij
2019-04-08  6:28 ` [PATCH 13/31 v3] clocksource/drivers/ixp4xx: Add OF initialization support Linus Walleij
2019-04-08  6:28 ` [PATCH 14/31 v3] gpio: ixp4xx: Add DT bindings Linus Walleij
2019-04-08  6:28   ` Linus Walleij
2019-04-08  6:28 ` [PATCH 15/31 v3] gpio: ixp4xx: Add OF probing support Linus Walleij
2019-04-08  6:28 ` [PATCH 16/31 v3] ARM: ixp4xx: Add DT bindings Linus Walleij
2019-04-08  6:28   ` Linus Walleij
2019-04-08  6:28 ` [PATCH 17/31 v3] ARM: ixp4xx: Add device tree boot support Linus Walleij
2019-04-08  6:28 ` [PATCH 18/31 v3] ARM: dts: Add some initial IXP4xx device trees Linus Walleij
2019-04-08  6:28 ` [PATCH 19/31 v3] ARM: ixp4xx: Move NPE and QMGR to drivers/soc Linus Walleij
2019-04-08  6:28 ` [PATCH 20/31 v3] ARM: ixp4xx: Move IXP4xx QMGR and NPE headers Linus Walleij
2019-04-08  6:28 ` [PATCH 21/31 v3] ARM: ixp4xx: Turn the NPE into a platform device Linus Walleij
2019-04-08  6:28 ` [PATCH 22/31 v3] ARM: ixp4xx: Turn the QMGR " Linus Walleij
2019-04-08  6:28 ` [PATCH 23/31 v3] soc: ixp4xx: npe: Pass addresses as resources Linus Walleij
2019-04-08  6:28 ` [PATCH 24/31 v3] soc: ixp4xx: Uninline several functions Linus Walleij
2019-04-08  6:28 ` [PATCH 25/31 v3] soc: ixp4xx: Remove unused functions Linus Walleij
2019-04-08  6:28 ` [PATCH 26/31 v3] soc: ixp4xx: qmgr: Pass resources Linus Walleij
2019-04-08  6:28 ` [PATCH 27/31 v3] soc: ixp4xx: Add DT bindings for IXP4xx NPE Linus Walleij
2019-04-08  6:28   ` Linus Walleij
2019-04-09 13:44   ` Rob Herring
2019-04-09 13:44     ` Rob Herring
2019-04-08  6:28 ` [PATCH 28/31 v3] soc: ixp4xx: npe: Add DT probe code Linus Walleij
2019-04-08  6:28 ` [PATCH 29/31 v3] soc: ixp4xx: qmgr: Add DT bindings for IXP4xx qmgr Linus Walleij
2019-04-08  6:28   ` Linus Walleij
2019-04-09 13:12   ` Rob Herring
2019-04-09 13:12     ` Rob Herring
2019-04-08  6:28 ` [PATCH 30/31 v3] soc: ixp4xx: qmgr: Add DT probe code Linus Walleij
2019-04-08  6:28 ` [PATCH 31/31 v3] ARM: dts: Add queue manager and NPE to the IXP4xx DTSI Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190408062831.16422-4-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=kaloz@openwrt.org \
    --cc=khalasa@piap.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.