* [PATCH 0/4] RETU fetch IRQ via struct resource
@ 2011-02-10 10:21 Felipe Balbi
2011-02-10 10:21 ` [PATCH 1/4] cbus: retu: pass " Felipe Balbi
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-02-10 10:21 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
Hi Tony,
here are 4 very quick patches to grab IRQ
via struct resource. Now all these changes
need to be ported to Tahvo. I'm not sure
I'll have any time to look at that for a
while, though.
Felipe Balbi (4):
cbus: retu: pass IRQ via struct resource
cbus: retu: headset: grab IRQ via struct resource
cbus: retu: pwrbutton: grab IRQ via struct resource
cbus: retu: rtc: grab IRQ via struct resource
drivers/cbus/retu-headset.c | 11 +++++++--
drivers/cbus/retu-pwrbutton.c | 2 +-
drivers/cbus/retu-rtc.c | 23 +++++++++++++++------
drivers/cbus/retu.c | 42 ++++++++++++++++++++++++++++++++++------
4 files changed, 60 insertions(+), 18 deletions(-)
--
1.7.4.rc2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] cbus: retu: pass IRQ via struct resource
2011-02-10 10:21 [PATCH 0/4] RETU fetch IRQ via struct resource Felipe Balbi
@ 2011-02-10 10:21 ` Felipe Balbi
2011-02-10 10:21 ` [PATCH 2/4] cbus: retu: headset: grab " Felipe Balbi
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-02-10 10:21 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
that's the preferred way to pass resources
to drivers anyway.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu.c | 42 +++++++++++++++++++++++++++++++++++-------
1 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index fa666fe..6134781 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -306,12 +306,24 @@ static void retu_power_off(void)
for (;;);
}
+static struct resource generic_resources[] = {
+ {
+ .start = -EINVAL, /* fixed later */
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = -EINVAL, /* fixed later */
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
/**
* retu_allocate_child - Allocates one Retu child
* @name: name of new child
* @parent: parent device for this child
*/
-static struct device *retu_allocate_child(char *name, struct device *parent)
+static struct device *retu_allocate_child(char *name, struct device *parent,
+ int irq_base, int irq1, int irq2, int num)
{
struct platform_device *pdev;
int status;
@@ -324,6 +336,18 @@ static struct device *retu_allocate_child(char *name, struct device *parent)
pdev->dev.parent = parent;
+ if (num) {
+ generic_resources[0].start = irq_base + irq1;
+ generic_resources[1].start = irq_base + irq2;
+
+ status = platform_device_add_resources(pdev,
+ generic_resources, num);
+ if (status < 0) {
+ dev_dbg(parent, "can't add resources to %s\n", name);
+ goto err;
+ }
+ }
+
status = platform_device_add(pdev);
if (status < 0) {
dev_dbg(parent, "can't add %s\n", name);
@@ -334,29 +358,33 @@ static struct device *retu_allocate_child(char *name, struct device *parent)
err:
platform_device_put(pdev);
+
return NULL;
}
/**
* retu_allocate_children - Allocates Retu's children
*/
-static int retu_allocate_children(struct device *parent)
+static int retu_allocate_children(struct device *parent, int irq_base)
{
struct device *child;
- child = retu_allocate_child("retu-pwrbutton", parent);
+ child = retu_allocate_child("retu-pwrbutton", parent, irq_base,
+ RETU_INT_PWR, -1, 1);
if (!child)
return -ENOMEM;
- child = retu_allocate_child("retu-headset", parent);
+ child = retu_allocate_child("retu-headset", parent, irq_base,
+ RETU_INT_HOOK, -1, 1);
if (!child)
return -ENOMEM;
- child = retu_allocate_child("retu-rtc", parent);
+ child = retu_allocate_child("retu-rtc", parent, irq_base,
+ RETU_INT_RTCS, RETU_INT_RTCA, 2);
if (!child)
return -ENOMEM;
- child = retu_allocate_child("retu-wdt", parent);
+ child = retu_allocate_child("retu-wdt", parent, -1, -1, -1, 0);
if (!child)
return -ENOMEM;
@@ -423,7 +451,7 @@ static int __init retu_probe(struct platform_device *pdev)
/* Register power off function */
pm_power_off = retu_power_off;
- ret = retu_allocate_children(&pdev->dev);
+ ret = retu_allocate_children(&pdev->dev, retu->irq_base);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to allocate Retu children\n");
goto err2;
--
1.7.4.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] cbus: retu: headset: grab IRQ via struct resource
2011-02-10 10:21 [PATCH 0/4] RETU fetch IRQ via struct resource Felipe Balbi
2011-02-10 10:21 ` [PATCH 1/4] cbus: retu: pass " Felipe Balbi
@ 2011-02-10 10:21 ` Felipe Balbi
2011-02-10 10:21 ` [PATCH 3/4] cbus: retu: pwrbutton: " Felipe Balbi
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-02-10 10:21 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
now that we pass IRQ via struct resource, we can
simply use it.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu-headset.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/cbus/retu-headset.c b/drivers/cbus/retu-headset.c
index 661534c..acf5cbe7 100644
--- a/drivers/cbus/retu-headset.c
+++ b/drivers/cbus/retu-headset.c
@@ -45,6 +45,7 @@ struct retu_headset {
unsigned pressed;
struct timer_list enable_timer;
struct timer_list detect_timer;
+ int irq;
};
static void retu_headset_set_bias(int enable)
@@ -219,6 +220,7 @@ static void retu_headset_detect_timer(unsigned long arg)
static int __init retu_headset_probe(struct platform_device *pdev)
{
struct retu_headset *hs;
+ int irq;
int r;
hs = kzalloc(sizeof(*hs), GFP_KERNEL);
@@ -258,8 +260,11 @@ static int __init retu_headset_probe(struct platform_device *pdev)
setup_timer(&hs->detect_timer, retu_headset_detect_timer,
(unsigned long) hs);
- r = request_threaded_irq(CBUS_RETU_IRQ_BASE + RETU_INT_HOOK, NULL,
- retu_headset_hook_interrupt, 0, "hookdet", hs);
+ irq = platform_get_irq(pdev, 0);
+ hs->irq = irq;
+
+ r = request_threaded_irq(irq, NULL, retu_headset_hook_interrupt, 0,
+ "hookdet", hs);
if (r != 0) {
dev_err(&pdev->dev, "hookdet IRQ not available\n");
goto err6;
@@ -290,7 +295,7 @@ static int retu_headset_remove(struct platform_device *pdev)
device_remove_file(&pdev->dev, &dev_attr_enable_det);
retu_headset_disable(hs);
retu_headset_det_disable(hs);
- free_irq(CBUS_RETU_IRQ_BASE + RETU_INT_HOOK, hs);
+ free_irq(hs->irq, hs);
input_unregister_device(hs->idev);
input_free_device(hs->idev);
--
1.7.4.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] cbus: retu: pwrbutton: grab IRQ via struct resource
2011-02-10 10:21 [PATCH 0/4] RETU fetch IRQ via struct resource Felipe Balbi
2011-02-10 10:21 ` [PATCH 1/4] cbus: retu: pass " Felipe Balbi
2011-02-10 10:21 ` [PATCH 2/4] cbus: retu: headset: grab " Felipe Balbi
@ 2011-02-10 10:21 ` Felipe Balbi
2011-02-10 10:21 ` [PATCH 4/4] cbus: retu: rtc: " Felipe Balbi
2011-02-14 19:00 ` [PATCH 0/4] RETU fetch " Felipe Balbi
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-02-10 10:21 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
now that we pass IRQ via struct resource, we can
simply use it.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu-pwrbutton.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/cbus/retu-pwrbutton.c b/drivers/cbus/retu-pwrbutton.c
index 24efdee..593a73a 100644
--- a/drivers/cbus/retu-pwrbutton.c
+++ b/drivers/cbus/retu-pwrbutton.c
@@ -83,7 +83,7 @@ static int __init retubutton_probe(struct platform_device *pdev)
goto err0;
}
- pwr->irq = CBUS_RETU_IRQ_BASE + RETU_INT_PWR;
+ pwr->irq = platform_get_irq(pdev, 0);
platform_set_drvdata(pdev, pwr);
ret = request_threaded_irq(pwr->irq, NULL, retubutton_irq, 0,
--
1.7.4.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] cbus: retu: rtc: grab IRQ via struct resource
2011-02-10 10:21 [PATCH 0/4] RETU fetch IRQ via struct resource Felipe Balbi
` (2 preceding siblings ...)
2011-02-10 10:21 ` [PATCH 3/4] cbus: retu: pwrbutton: " Felipe Balbi
@ 2011-02-10 10:21 ` Felipe Balbi
2011-02-14 19:00 ` [PATCH 0/4] RETU fetch " Felipe Balbi
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-02-10 10:21 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
now that we pass IRQ via struct resource, we can
simply use it.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu-rtc.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/cbus/retu-rtc.c b/drivers/cbus/retu-rtc.c
index a011ba7..5f52edf 100644
--- a/drivers/cbus/retu-rtc.c
+++ b/drivers/cbus/retu-rtc.c
@@ -52,6 +52,8 @@ struct retu_rtc {
struct rtc_device *rtc;
u16 alarm_expired;
+ int irq_rtcs;
+ int irq_rtca;
};
static void retu_rtc_do_reset(struct retu_rtc *rtc)
@@ -86,17 +88,24 @@ static irqreturn_t retu_rtc_interrupt(int irq, void *_rtc)
static int retu_rtc_init_irq(struct retu_rtc *rtc)
{
+ int irq;
int ret;
- ret = request_threaded_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCS, NULL, retu_rtc_interrupt,
+ irq = platform_get_irq(to_platform_device(rtc->dev), 0);
+ rtc->irq_rtcs = irq;
+
+ irq = platform_get_irq(to_platform_device(rtc->dev), 1);
+ rtc->irq_rtca = irq;
+
+ ret = request_threaded_irq(rtc->irq_rtcs, NULL, retu_rtc_interrupt,
0, "RTCS", rtc);
if (ret != 0)
return ret;
- ret = request_threaded_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCA, NULL, retu_rtc_interrupt,
+ ret = request_threaded_irq(rtc->irq_rtca, NULL, retu_rtc_interrupt,
0, "RTCA", rtc);
if (ret != 0) {
- free_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCS, rtc);
+ free_irq(rtc->irq_rtcs, rtc);
return ret;
}
@@ -235,8 +244,8 @@ static int __init retu_rtc_probe(struct platform_device *pdev)
return 0;
err2:
- free_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCS, rtc);
- free_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCA, rtc);
+ free_irq(rtc->irq_rtcs, rtc);
+ free_irq(rtc->irq_rtca, rtc);
err1:
kfree(rtc);
@@ -249,8 +258,8 @@ static int __devexit retu_rtc_remove(struct platform_device *pdev)
{
struct retu_rtc *rtc = platform_get_drvdata(pdev);
- free_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCS, rtc);
- free_irq(CBUS_RETU_IRQ_BASE + RETU_INT_RTCA, rtc);
+ free_irq(rtc->irq_rtcs, rtc);
+ free_irq(rtc->irq_rtca, rtc);
rtc_device_unregister(rtc->rtc);
kfree(rtc);
--
1.7.4.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] RETU fetch IRQ via struct resource
2011-02-10 10:21 [PATCH 0/4] RETU fetch IRQ via struct resource Felipe Balbi
` (3 preceding siblings ...)
2011-02-10 10:21 ` [PATCH 4/4] cbus: retu: rtc: " Felipe Balbi
@ 2011-02-14 19:00 ` Felipe Balbi
2011-02-14 23:22 ` Tony Lindgren
4 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2011-02-14 19:00 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Tony Lindgren, Linux OMAP Mailing List
Hi,
On Thu, Feb 10, 2011 at 12:21:17PM +0200, Felipe Balbi wrote:
> here are 4 very quick patches to grab IRQ
> via struct resource. Now all these changes
> need to be ported to Tahvo. I'm not sure
> I'll have any time to look at that for a
> while, though.
I have put together a few more patches which are now available at [1],
here's the diffstat against tony/master:
arch/arm/mach-omap1/board-nokia770.c | 1 +
arch/arm/mach-omap2/board-n8x0.c | 1 +
arch/arm/plat-omap/include/plat/cbus.h | 4 +
drivers/cbus/retu-headset.c | 46 +++++---
drivers/cbus/retu-pwrbutton.c | 6 +-
drivers/cbus/retu-rtc.c | 57 +++++-----
drivers/cbus/retu-wdt.c | 15 +--
drivers/cbus/retu.c | 202 ++++++++++++++++++++-----------
drivers/cbus/retu.h | 10 +-
9 files changed, 206 insertions(+), 136 deletions(-)
and here's the new shortlog:
Felipe Balbi (19):
cbus: retu: pass IRQ via struct resource
cbus: retu: headset: grab IRQ via struct resource
cbus: retu: pwrbutton: grab IRQ via struct resource
cbus: retu: rtc: grab IRQ via struct resource
cbus: retu: drop retu_get_status
cbus: retu: replace BUG_ON with WARN
cbus: retu: drop the unnecessary spinlock_t
cbus: retu: drop unused PFX macro
arm: omap: cbus: add IDs for Retu and Tahvo
arm: omap: pass Retu ID via platform_data
cbus: retu: use the devid from platform_data
cbus: retu: introduce internal read/write functions
cbus: retu: search and replace
cbus: retu: pwrbutton: save device pointer on our structure
cbus: retu: pass the child device pointer to all retu functions
cbus: retu: headset: don't save pdev pointer
cbus: retu: replace EXPORT_SYMBOL with EXPORT_SYMBOL_GPL
cbus: retu: tabify retu initialization
cbus: retu: set pm_power_off to NULL when removing retu
Want me to re-send all patches or you can pull from my cbus branch to
test ?
Any taker for fixing tahvo ? All you have to do is port the changes done
in retu to tahvo. Tahvo is a lot simpler than retu though.
--
balbi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] RETU fetch IRQ via struct resource
2011-02-14 19:00 ` [PATCH 0/4] RETU fetch " Felipe Balbi
@ 2011-02-14 23:22 ` Tony Lindgren
2011-02-15 8:08 ` Felipe Balbi
0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2011-02-14 23:22 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Linux OMAP Mailing List
* Felipe Balbi <balbi@ti.com> [110214 10:58]:
> Hi,
>
> On Thu, Feb 10, 2011 at 12:21:17PM +0200, Felipe Balbi wrote:
> > here are 4 very quick patches to grab IRQ
> > via struct resource. Now all these changes
> > need to be ported to Tahvo. I'm not sure
> > I'll have any time to look at that for a
> > while, though.
OK, great those four are working. I've applied them
to the cbus branch.
> Want me to re-send all patches or you can pull from my cbus branch to
> test ?
Hmm well maybe send the new ones? Then I can pull assuming you
rebase on the cbus branch. That's usable now too and up to v2.6.38-rc4.
> Any taker for fixing tahvo ? All you have to do is port the changes done
> in retu to tahvo. Tahvo is a lot simpler than retu though.
It will be at least few weeks before I can do anything except
look and merge patches..
Tony
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] RETU fetch IRQ via struct resource
2011-02-14 23:22 ` Tony Lindgren
@ 2011-02-15 8:08 ` Felipe Balbi
0 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-02-15 8:08 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Felipe Balbi, Linux OMAP Mailing List
Hi,
On Mon, Feb 14, 2011 at 03:22:42PM -0800, Tony Lindgren wrote:
> Hmm well maybe send the new ones? Then I can pull assuming you
> rebase on the cbus branch. That's usable now too and up to v2.6.38-rc4.
Will do that later on today.
--
balbi
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-02-15 8:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 10:21 [PATCH 0/4] RETU fetch IRQ via struct resource Felipe Balbi
2011-02-10 10:21 ` [PATCH 1/4] cbus: retu: pass " Felipe Balbi
2011-02-10 10:21 ` [PATCH 2/4] cbus: retu: headset: grab " Felipe Balbi
2011-02-10 10:21 ` [PATCH 3/4] cbus: retu: pwrbutton: " Felipe Balbi
2011-02-10 10:21 ` [PATCH 4/4] cbus: retu: rtc: " Felipe Balbi
2011-02-14 19:00 ` [PATCH 0/4] RETU fetch " Felipe Balbi
2011-02-14 23:22 ` Tony Lindgren
2011-02-15 8:08 ` Felipe Balbi
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.