Skip to contentSkip to conversation

DS1WM: decouple host IRQ and INTR active state settings.

PATCH In review Philipp Zabel 4 participants 10 messages Jan 6, 2008 – Feb 6, 2008 W1 dallas's 1-wire bus

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DS1WM: decouple host IRQ and INTR active state settings.

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

---
 drivers/w1/masters/ds1wm.c |    9 +++++----
 include/linux/ds1wm.h      |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/w1/masters/ds1wm.c +5 -4
index 5747997..688e435 100644
@@ -361,11 +361,12 @@ static int ds1wm_probe(struct platform_device *pdev)
 		goto err1;
 	}
 	ds1wm_data->irq = res->start;
-	ds1wm_data->active_high = (res->flags & IORESOURCE_IRQ_HIGHEDGE) ?
-		1 : 0;
+	ds1wm_data->active_high = plat->active_high;
 
-	set_irq_type(ds1wm_data->irq, ds1wm_data->active_high ?
-			IRQ_TYPE_EDGE_RISING : IRQ_TYPE_EDGE_FALLING);
+	if (res->flags & IORESOURCE_IRQ_HIGHEDGE)
+		set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);
+	if (res->flags & IORESOURCE_IRQ_LOWEDGE)
+		set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING);
 
 	ret = request_irq(ds1wm_data->irq, ds1wm_isr, IRQF_DISABLED,
 			  "ds1wm", ds1wm_data);
include/linux/ds1wm.h +1 -0
index 31f6e3c..d3c65e4 100644
@@ -6,6 +6,7 @@ struct ds1wm_platform_data {
 			     * e.g. on h5xxx and h2200 this is 2
 			     * (registers aligned to 4-byte boundaries),
 			     * while on hx4700 this is 1 */
+	int active_high;
 	void (*enable)(struct platform_device *pdev);
 	void (*disable)(struct platform_device *pdev);
 };
Signature · 1 line
1.5.3.7
#1 lore raw

Hi.

Quoted 6 lines · Philipp Zabel

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

I have no problem with this patch, thank you.

Andrew, please apply.

Signature · 1 line
	Evgeniy Polyakov
#2 lore raw
In reply to Philipp Zabel
Quoted 6 lines · Philipp Zabel

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

Looks good to me.

Matt

#3 lore raw
In reply to Philipp Zabel
Quoted 37 lines · On Sun, 06 Jan 2008 14:46:14 +0100 Philipp Zabel <[email protected]>…

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

---
 drivers/w1/masters/ds1wm.c |    9 +++++----
 include/linux/ds1wm.h      |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/w1/masters/ds1wm.c +5 -4
index 5747997..688e435 100644
@@ -361,11 +361,12 @@ static int ds1wm_probe(struct platform_device *pdev)
 		goto err1;
 	}
 	ds1wm_data->irq = res->start;
-	ds1wm_data->active_high = (res->flags & IORESOURCE_IRQ_HIGHEDGE) ?
-		1 : 0;
+	ds1wm_data->active_high = plat->active_high;
 
-	set_irq_type(ds1wm_data->irq, ds1wm_data->active_high ?
-			IRQ_TYPE_EDGE_RISING : IRQ_TYPE_EDGE_FALLING);
+	if (res->flags & IORESOURCE_IRQ_HIGHEDGE)
+		set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);
+	if (res->flags & IORESOURCE_IRQ_LOWEDGE)
+		set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING);
 
 	ret = request_irq(ds1wm_data->irq, ds1wm_isr, IRQF_DISABLED,
 			  "ds1wm", ds1wm_data);
include/linux/ds1wm.h +0 -0
index 31f6e3c..d3c65e4 100644

include/linux/ds1wm.h struct ds1wm_platform_data { · line 12

Quoted 7 lines
include/linux/ds1wm.h +1 -0
@@ -6,6 +6,7 @@ struct ds1wm_platform_data {
 			     * e.g. on h5xxx and h2200 this is 2
 			     * (registers aligned to 4-byte boundaries),
 			     * while on hx4700 this is 1 */
+	int active_high;
 	void (*enable)(struct platform_device *pdev);
 	void (*disable)(struct platform_device *pdev);
 };

But no drivers are converted to set ds1wm_platform_data.active_high. Won't IORESOURCE_IRQ_HIGHEDGE devices be broken by this change?

#4 lore raw
Quoted 10 lines · Andrew Morton
Quoted 4 lines · On Sun, 06 Jan 2008 14:46:14 +0100 Philipp Zabel <[email protected]>…

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

But no drivers are converted to set ds1wm_platform_data.active_high. Won't IORESOURCE_IRQ_HIGHEDGE devices be broken by this change?

Good point; I think you're right. I'd guess the other platforms that use this driver are in the handhelds.org tree, but I've been out of the loop a while. Philipp, is this the case?

Matt

#5 lore raw
Quoted 9 lines · Matt Reimer
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Sun, 06 Jan 2008 14:46:14 +0100 Philipp Zabel <[email protected]>…

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

Quoted 6 lines
Quoted 2 lines

But no drivers are converted to set ds1wm_platform_data.active_high. Won't IORESOURCE_IRQ_HIGHEDGE devices be broken by this change?

Good point; I think you're right. I'd guess the other platforms that use this driver are in the handhelds.org tree, but I've been out of the loop a while. Philipp, is this the case?

Yes, I think so. I am only aware of four chips that include a DS1WM:
HTC's ASIC3, PASIC2 and PASIC3 and Samsung SAMCOP.
All of those drivers have yet to be submitted.

I will also apply this patch to hh.org CVS and fix up the devices that are affected by this change (aximx30, blueangel, magician, h1900, h4000, h5400, himalaya, hx4700, sable, universal).
But none of those set IORESOURCE_IRQ_HIGHEDGE (most are just missing the IORESOURCE_IRQ_LOWEDGE flag). I am not sure about the status of rx3000 or other devices that might live in other trees.

I'm currently cleaning up the PASIC2/3 driver. After that I'll try to help cleaning up ASIC3 and finally getting it ready for submission. A whole load of devices in the hh.org tree depend on it.

regards
Philipp

#6 lore raw
Quoted 28 lines · On Tue, 8 Jan 2008 09:21:55 +0100 "pHilipp Zabel" <[email protected]>…
Quoted 9 lines · Matt Reimer
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Sun, 06 Jan 2008 14:46:14 +0100 Philipp Zabel <[email protected]>…

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

Quoted 6 lines
Quoted 2 lines

But no drivers are converted to set ds1wm_platform_data.active_high. Won't IORESOURCE_IRQ_HIGHEDGE devices be broken by this change?

Good point; I think you're right. I'd guess the other platforms that use this driver are in the handhelds.org tree, but I've been out of the loop a while. Philipp, is this the case?

Yes, I think so. I am only aware of four chips that include a DS1WM:
HTC's ASIC3, PASIC2 and PASIC3 and Samsung SAMCOP.
All of those drivers have yet to be submitted.

I will also apply this patch to hh.org CVS and fix up the devices that are affected by this change (aximx30, blueangel, magician, h1900, h4000, h5400, himalaya, hx4700, sable, universal).
But none of those set IORESOURCE_IRQ_HIGHEDGE (most are just missing the IORESOURCE_IRQ_LOWEDGE flag). I am not sure about the status of rx3000 or other devices that might live in other trees.

Quoted 4 lines

I'm currently cleaning up the PASIC2/3 driver. After that I'll try to help cleaning up ASIC3 and finally getting it ready for submission. A whole load of devices in the hh.org tree depend on it.

Guys, I'm thinking that by the time we actually need this patch in the mainline tree, it may well be obsolete. So I should drop the copy I have?

#7 lore raw

Hi Andrew,

Quoted 31 lines · Andrew Morton
Quoted 28 lines · On Tue, 8 Jan 2008 09:21:55 +0100 "pHilipp Zabel" <[email protected]>…
Quoted 9 lines · Matt Reimer
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Sun, 06 Jan 2008 14:46:14 +0100 Philipp Zabel <[email protected]>…

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

Quoted 6 lines
Quoted 2 lines

But no drivers are converted to set ds1wm_platform_data.active_high. Won't IORESOURCE_IRQ_HIGHEDGE devices be broken by this change?

Good point; I think you're right. I'd guess the other platforms that use this driver are in the handhelds.org tree, but I've been out of the loop a while. Philipp, is this the case?

Yes, I think so. I am only aware of four chips that include a DS1WM:
HTC's ASIC3, PASIC2 and PASIC3 and Samsung SAMCOP.
All of those drivers have yet to be submitted.

I will also apply this patch to hh.org CVS and fix up the devices that are affected by this change (aximx30, blueangel, magician, h1900, h4000, h5400, himalaya, hx4700, sable, universal).
But none of those set IORESOURCE_IRQ_HIGHEDGE (most are just missing the IORESOURCE_IRQ_LOWEDGE flag). I am not sure about the status of rx3000 or other devices that might live in other trees.

Quoted 7 lines
Quoted 4 lines

I'm currently cleaning up the PASIC2/3 driver. After that I'll try to help cleaning up ASIC3 and finally getting it ready for submission. A whole load of devices in the hh.org tree depend on it.

Guys, I'm thinking that by the time we actually need this patch in the mainline tree, it may well be obsolete. So I should drop the copy I have?

I obviously think it should be applied.
But if you prefer that I resend once it is actually needed by something in the tree, I'll happily do that, too.
The PASIC2/3 mfd driver is currently waiting for something like Dmitry Baryshkov's clocklib patches to go in.

regards
Philipp

#8 lore raw
Quoted 8 lines · On Wed, 6 Feb 2008 15:35:14 +0100 "pHilipp Zabel" <[email protected]>…
Quoted 2 lines

Guys, I'm thinking that by the time we actually need this patch in the mainline tree, it may well be obsolete. So I should drop the copy I have?

I obviously think it should be applied.
But if you prefer that I resend once it is actually needed by something in the tree, I'll happily do that, too.
The PASIC2/3 mfd driver is currently waiting for something like Dmitry Baryshkov's clocklib patches to go in.

Well. It's a very small patch - I'm not particularly fussed either way. As long as you gus are sure it's safe and will be useful then I guess we can proceed with it?

#9 lore raw
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Wed, 6 Feb 2008 15:35:14 +0100 "pHilipp Zabel" <[email protected]>…
Quoted 2 lines

Guys, I'm thinking that by the time we actually need this patch in the mainline tree, it may well be obsolete. So I should drop the copy I have?

I obviously think it should be applied.
But if you prefer that I resend once it is actually needed by something in the tree, I'll happily do that, too.
The PASIC2/3 mfd driver is currently waiting for something like Dmitry Baryshkov's clocklib patches to go in.

Quoted 3 lines

Well. It's a very small patch - I'm not particularly fussed either way. As long as you gus are sure it's safe and will be useful then I guess we can proceed with it?

I agree with Philipp, and think it should go in.

Matt