From: Felipe Balbi <balbi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: "Linux OMAP Mailing List" <linux-omap@vger.kernel.org>,
"Michael Büsch" <mb@bu3sch.de>, "Felipe Balbi" <balbi@ti.com>
Subject: [PATCH 14/22] cbus: tahvo: usb: fix up to use threaded irqs
Date: Mon, 11 Jul 2011 14:17:27 +0300 [thread overview]
Message-ID: <1310383055-20211-15-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1310383055-20211-1-git-send-email-balbi@ti.com>
fix up tahvo-usb to use threaded irqs and the
new IRQ chip.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/tahvo-usb.c | 35 +++++++++++++----------------------
1 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index be0333f..10619a8 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -93,12 +93,13 @@ struct tahvo_usb {
struct platform_device *pt_dev;
struct otg_transceiver otg;
int vbus_state;
- struct work_struct irq_work;
struct mutex serialize;
#ifdef CONFIG_USB_OTG
int tahvo_mode;
#endif
struct clk *ick;
+
+ int irq;
};
static struct tahvo_usb *tahvo_usb_device;
@@ -523,23 +524,13 @@ static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadg
return 0;
}
-static void tahvo_usb_irq_work(struct work_struct *work)
+static irqreturn_t tahvo_usb_vbus_interrupt(int irq, void *_tu)
{
- struct tahvo_usb *tu = container_of(work, struct tahvo_usb, irq_work);
+ struct tahvo_usb *tu = _tu;
- mutex_lock(&tu->serialize);
check_vbus_state(tu);
- mutex_unlock(&tu->serialize);
-}
-static void tahvo_usb_vbus_interrupt(unsigned long arg)
-{
- struct tahvo_usb *tu = (struct tahvo_usb *) arg;
-
- tahvo_ack_irq(TAHVO_INT_VBUSON);
- /* Seems we need this to acknowledge the interrupt */
- tahvo_read_reg(TAHVO_REG_IDSR);
- schedule_work(&tu->irq_work);
+ return IRQ_HANDLED;
}
#ifdef CONFIG_USB_OTG
@@ -602,6 +593,7 @@ static int __init tahvo_usb_probe(struct platform_device *pdev)
struct tahvo_usb *tu;
struct device *dev = &pdev->dev;
int ret;
+ int irq;
ret = tahvo_get_status();
if (!ret)
@@ -625,7 +617,6 @@ static int __init tahvo_usb_probe(struct platform_device *pdev)
#endif
#endif
- INIT_WORK(&tu->irq_work, tahvo_usb_irq_work);
mutex_init(&tu->serialize);
tu->ick = clk_get(NULL, "usb_l4_ick");
@@ -640,9 +631,12 @@ static int __init tahvo_usb_probe(struct platform_device *pdev)
* state changes */
tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01;
+ irq = platform_get_irq(pdev, 0);
+ tu->irq = irq;
+
/* We cannot enable interrupt until omap_udc is initialized */
- ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt,
- (unsigned long) tu, "vbus_interrupt");
+ ret = request_threaded_irq(irq, NULL, tahvo_usb_vbus_interrupt,
+ IRQF_ONESHOT, "tahvo-vbus", tu);
if (ret != 0) {
printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n");
goto err_release_clk;
@@ -675,13 +669,10 @@ static int __init tahvo_usb_probe(struct platform_device *pdev)
dev_set_drvdata(dev, tu);
- /* Act upon current vbus state once at startup. A vbus state irq may or
- * may not be generated in addition to this. */
- schedule_work(&tu->irq_work);
return 0;
err_free_irq:
- tahvo_free_irq(TAHVO_INT_VBUSON);
+ free_irq(tu->irq, tu);
err_release_clk:
clk_disable(tu->ick);
clk_put(tu->ick);
@@ -698,7 +689,7 @@ static int __exit tahvo_usb_remove(struct platform_device *pdev)
dev_dbg(&pdev->dev, "remove\n");
- tahvo_free_irq(TAHVO_INT_VBUSON);
+ free_irq(tu->irq, tu);
flush_scheduled_work();
otg_set_transceiver(0);
device_remove_file(&pdev->dev, &dev_attr_vbus_state);
--
1.7.6
next prev parent reply other threads:[~2011-07-11 11:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 11:17 [PATCH 00/22] Tahvo cleanups and Retu optimization Felipe Balbi
2011-07-11 11:17 ` [PATCH 01/22] cbus: tahvo: convert spinlock into mutex Felipe Balbi
2011-07-11 11:17 ` [PATCH 02/22] cbus: tahvo: move to __devinit/__devexit sections Felipe Balbi
2011-07-11 11:17 ` [PATCH 03/22] cbus: tahvo: a switch looks better Felipe Balbi
2011-07-11 11:17 ` [PATCH 04/22] cbus: tahvo: don't go over 80 columns Felipe Balbi
2011-07-11 11:17 ` [PATCH 05/22] cbus: tahvo: drop the tasklet Felipe Balbi
2011-07-11 11:17 ` [PATCH 06/22] cbus: retu: set IRQF_ONESHOT flag Felipe Balbi
2011-07-11 11:17 ` [PATCH 07/22] cbus: tahvo: git it a context structure Felipe Balbi
2011-07-11 11:17 ` [PATCH 08/22] cbus: tahvo: pass tahvo to IRQ handler Felipe Balbi
2011-07-11 11:17 ` [PATCH 09/22] cbus: tahvo: introduce __tahvo_(read/write)_reg Felipe Balbi
2011-07-11 11:17 ` [PATCH 10/22] cbus: tahvo: drop some unneded defines Felipe Balbi
2011-07-11 11:17 ` [PATCH 11/22] cbus: retu: IRQ demux optimization Felipe Balbi
2011-07-11 11:17 ` [PATCH 12/22] cbus: tahvo: give it an irq_chip Felipe Balbi
2011-07-11 11:17 ` [PATCH 13/22] cbus: tahvo: start using irq_chip Felipe Balbi
2011-07-11 11:17 ` Felipe Balbi [this message]
2011-07-11 11:17 ` [PATCH 15/22] cbus: tahvo drop the legacy interfaces Felipe Balbi
2011-07-11 11:17 ` [PATCH 16/22] cbus: tahvo: usb: drop unused variable Felipe Balbi
2011-07-11 11:17 ` [PATCH 17/22] cbus: tahvo: no need to mask interrupts on exit Felipe Balbi
2011-07-11 11:17 ` [PATCH 18/22] cbus: tahvo: drop the get_status hack Felipe Balbi
2011-07-11 11:17 ` [PATCH 19/22] cbus: tahvo: drop more unused interfaces Felipe Balbi
2011-07-11 11:17 ` [PATCH 20/22] cbus: tahvo: pass child device pointer Felipe Balbi
2011-07-11 11:17 ` [PATCH 21/22] cbus: tahvo: drop backlight interfaces Felipe Balbi
2011-07-11 11:17 ` [PATCH 22/22] cbus: tahvo: drop static global pointer Felipe Balbi
2011-07-11 11:28 ` [PATCH 00/22] Tahvo cleanups and Retu optimization Michael Büsch
2011-07-11 13:12 ` Felipe Balbi
2011-07-11 13:41 ` Michael Büsch
2011-07-11 13:45 ` Felipe Balbi
2011-07-11 13:51 ` Michael Büsch
2011-07-11 14:03 ` Felipe Balbi
2011-07-11 14:19 ` Michael Büsch
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=1310383055-20211-15-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=mb@bu3sch.de \
--cc=tony@atomide.com \
/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