From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Uwe.Kleine-Koenig@digi.com, gregkh@suse.de,
akpm@linux-foundation.org, hjk@linutronix.de,
lethal@linux-sh.org, Magnus Damm <magnus.damm@gmail.com>,
tglx@linutronix.de
Subject: [PATCH] uio_pdrv: Unique IRQ Mode
Date: Wed, 04 Jun 2008 15:08:26 +0900 [thread overview]
Message-ID: <20080604060826.17162.46972.sendpatchset@rx1.opensource.se> (raw)
From: Magnus Damm <damm@igel.co.jp>
This patch adds a "Unique IRQ Mode" to the uio_pdrv UIO platform driver.
In this mode the user space driver is responsible for acknowledging and
re-enabling the interrupt. Shared interrupts are not supported.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
Think of this as V2 of "[PATCH 00/03][RFC] Reusable UIO Platform Driver".
Needs "[PATCH 0/1] UIO: Add a write() function to enable/disable interrupts"
drivers/uio/uio_pdrv.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
--- 0006/drivers/uio/uio_pdrv.c
+++ work/drivers/uio/uio_pdrv.c 2008-06-04 14:51:56.000000000 +0900
@@ -16,8 +16,34 @@
struct uio_platdata {
struct uio_info *uioinfo;
+ unsigned long irq_disabled;
};
+static irqreturn_t uio_pdrv_unique_handler(int irq, struct uio_info *dev_info)
+{
+ struct uio_platdata *priv = dev_info->priv;
+
+ /* In "Unique IRQ Mode", just disable the interrupt and remember
+ * the state so we can enable it later.
+ */
+ disable_irq(irq);
+ set_bit(0, &priv->irq_disabled);
+ return IRQ_HANDLED;
+}
+
+static int uio_pdrv_unique_irqcontrol(struct uio_info *dev_info, s32 irq_on)
+{
+ struct uio_platdata *priv = dev_info->priv;
+
+ /* "Unique IRQ Mode" allows re-enabling of the interrupt */
+ if (irq_on && test_and_clear_bit(0, &priv->irq_disabled)) {
+ enable_irq(dev_info->irq);
+ return 0;
+ }
+
+ return -ENOSYS;
+}
+
static int uio_pdrv_probe(struct platform_device *pdev)
{
struct uio_info *uioinfo = pdev->dev.platform_data;
@@ -68,6 +94,23 @@ static int uio_pdrv_probe(struct platfor
pdata->uioinfo->priv = pdata;
+ /* This driver supports a special "Unique IRQ Mode".
+ *
+ * In this mode, no hardware specific kernel code is required to
+ * acknowledge interrupts. Instead, the interrupt is disabled by
+ * the interrupt handler. User space is responsible for performing
+ * hardware specific acknowledge and enabling of interrupts.
+ *
+ * Interrupt sharing is _not_ supported by the "Unique IRQ Mode".
+ *
+ * Enable this mode by passing IRQ number but omitting irq callbacks.
+ */
+ if (!uioinfo->handler && !uioinfo->irqcontrol && uioinfo->irq >= 0) {
+ uioinfo->irq_flags = IRQF_DISABLED;
+ uioinfo->handler = uio_pdrv_unique_handler;
+ uioinfo->irqcontrol = uio_pdrv_unique_irqcontrol;
+ }
+
ret = uio_register_device(&pdev->dev, pdata->uioinfo);
if (ret) {
next reply other threads:[~2008-06-04 6:08 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-04 6:08 Magnus Damm [this message]
2008-06-04 10:11 ` [PATCH] uio_pdrv: Unique IRQ Mode Hans J. Koch
2008-06-05 1:25 ` Magnus Damm
2008-06-05 6:49 ` Uwe Kleine-König
2008-06-06 2:55 ` Magnus Damm
2008-06-06 10:04 ` Hans J. Koch
2008-06-08 10:03 ` Magnus Damm
2008-06-05 9:09 ` Hans J. Koch
2008-06-05 9:46 ` Magnus Damm
2008-06-05 11:27 ` Hans J. Koch
2008-06-08 10:19 ` Magnus Damm
2008-06-08 20:54 ` Hans J. Koch
2008-06-09 1:12 ` Magnus Damm
2008-06-09 8:44 ` Hans J. Koch
2008-06-09 9:01 ` Paul Mundt
2008-06-09 12:34 ` Uwe Kleine-König
2008-06-10 3:12 ` Greg KH
2008-06-10 4:40 ` Magnus Damm
2008-06-10 7:10 ` Uwe Kleine-König
2008-06-10 7:14 ` [PATCH] UIO: minor style and comment fixes Uwe Kleine-König
2008-06-10 9:07 ` Hans J. Koch
2008-06-10 13:50 ` [PATCH] uio_pdrv: Unique IRQ Mode Magnus Damm
2008-06-10 17:32 ` Paul Mundt
2008-06-10 19:24 ` Uwe Kleine-König
2008-06-09 4:09 ` Paul Mundt
2008-06-09 7:57 ` Uwe Kleine-König
2008-06-09 8:00 ` Paul Mundt
2008-06-09 9:54 ` Hans J. Koch
2008-06-09 12:32 ` Uwe Kleine-König
2008-06-09 14:20 ` Hans J. Koch
2008-06-10 6:11 ` Uwe Kleine-König
2008-06-10 9:01 ` Hans J. Koch
2008-06-05 11:33 ` Uwe Kleine-König
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=20080604060826.17162.46972.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=Uwe.Kleine-Koenig@digi.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=hjk@linutronix.de \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox