Skip to contentSkip to conversation

pxa2xx ac97 driver

PATCH Ian Campbell 4 participants 5 messages Feb 11, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Nico,

I've just grabbed your pxa2xx audio driver from alsa CVS and given it a go on my PXA255 based board. I'm running 2.6.10 with the DMA mmap API backported. I got it working pretty quick with only a couple of issues -- thanks!

First issue was minor: I think *_EOC only exist on PXA270, or at least they aren't documented on the 255 and the symbols aren't defined for CONFIG_PXA25x so I wrapped them in CONFIG_PXA27x. I don't know if it would hurt to write to the reserved bits on 255...

Second issue is a bit strange. The code in the reset function does:

	GCR = GCR_COLD_RST;
	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
which either causes a hang or causes repeated interrupts so that it is
impossible to see what is going on (didn't see anything from a printk in
the irq handler though). I changed it to 
	GCR = GCR_COLD_RST;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);

which matches the way the old OSS driver did the reset and now the driver works great.

I don't understand this though since the documentation would appear to suggest that the PRIRDY way makes more sense. I guess it's possible that it is related to 255 errata #30 ("Invalid AC'97 interrupt during cold reset") but I'm not sure...

Anyway, here is the patch for the changes I made, what do you think?

sound/arm/pxa2xx-ac97.c +3 -1
Index: 2.6/sound/arm/pxa2xx-ac97.c
===================================================================
@@ -115,7 +117,7 @@
 	udelay(50);
 #else
 	GCR = GCR_COLD_RST;
-	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
+	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
 	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
 #endif
 
@@ -157,12 +159,14 @@
 		gsr_bits |= status;
 		wake_up(&gsr_wq);
 
+#ifdef CONFIG_PXA27x
 		/* Although we don't use those we still need to clear them
 		   since they tend to spuriously trigger when MMC is used
 		   (hardware bug? go figure)... */
 		MISR = MISR_EOC;
 		PISR = PISR_EOC;
 		MCSR = MCSR_EOC;
+#endif
 
 		return IRQ_HANDLED;
 	}

Cheers,
Ian.

Signature · 12 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road,                    Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom       Phone:  +44 (0)1223 411 200



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
#1 lore raw

Hi Ian,

Quoted 10 lines · Ian Campbell

Second issue is a bit strange. The code in the reset function does:

	GCR = GCR_COLD_RST;
	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
which either causes a hang or causes repeated interrupts so that it is
impossible to see what is going on (didn't see anything from a printk in
the irq handler though). I changed it to 
	GCR = GCR_COLD_RST;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
Quoted 2 lines

which matches the way the old OSS driver did the reset and now the driver works great.

I've not had any problems with this code on PXA27x. I know there are some differences between the PXA25x and PXA27x wrt AC97 CDONE/SDONE bits that can cause some problems.

Perhaps we should use your changes for the PXA25x and Nico's for PXA27x ?

Liam

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#2 lore raw
Quoted 17 lines · Liam Girdwood

Hi Ian,

Quoted 10 lines · Ian Campbell

Second issue is a bit strange. The code in the reset function does:

	GCR = GCR_COLD_RST;
	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
which either causes a hang or causes repeated interrupts so that it is
impossible to see what is going on (didn't see anything from a printk in
the irq handler though). I changed it to 
	GCR = GCR_COLD_RST;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
Quoted 2 lines

which matches the way the old OSS driver did the reset and now the driver works great.

Quoted 6 lines

I've not had any problems with this code on PXA27x. I know there are some differences between the PXA25x and PXA27x wrt AC97 CDONE/SDONE bits that can cause some problems.

Perhaps we should use your changes for the PXA25x and Nico's for PXA27x ?

I should have quoted a bit more context from the function in question -- the code I gave is actually already inside the #else of a #ifdef CONFIG_PXA27x (i.e. it's 25x specific).

Ian.

Signature · 17 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road,                    Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom       Phone:  +44 (0)1223 411 200


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been virus scanned by MessageLabs.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
#3 lore raw
In reply to Ian Campbell
Quoted 25 lines · Ian Campbell

Hi Nico,

I've just grabbed your pxa2xx audio driver from alsa CVS and given it a go on my PXA255 based board. I'm running 2.6.10 with the DMA mmap API backported. I got it working pretty quick with only a couple of issues -- thanks!

First issue was minor: I think *_EOC only exist on PXA270, or at least they aren't documented on the 255 and the symbols aren't defined for CONFIG_PXA25x so I wrapped them in CONFIG_PXA27x. I don't know if it would hurt to write to the reserved bits on 255...

Second issue is a bit strange. The code in the reset function does:

	GCR = GCR_COLD_RST;
	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
which either causes a hang or causes repeated interrupts so that it is
impossible to see what is going on (didn't see anything from a printk in
the irq handler though). I changed it to 
	GCR = GCR_COLD_RST;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);

which matches the way the old OSS driver did the reset and now the driver works great.

Quoted 8 lines

I don't understand this though since the documentation would appear to suggest that the PRIRDY way makes more sense. I guess it's possible that it is related to 255 errata #30 ("Invalid AC'97 interrupt during cold reset") but I'm not sure...

Anyway, here is the patch for the changes I made, what do you think?

Looks fine to me.

Quoted 29 lines

Index: 2.6/sound/arm/pxa2xx-ac97.c
===================================================================

sound/arm/pxa2xx-ac97.c +3 -1
@@ -115,7 +117,7 @@
 	udelay(50);
 #else
 	GCR = GCR_COLD_RST;
-	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
+	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
 	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
 #endif
 
@@ -157,12 +159,14 @@
 		gsr_bits |= status;
 		wake_up(&gsr_wq);
 
+#ifdef CONFIG_PXA27x
 		/* Although we don't use those we still need to clear them
 		   since they tend to spuriously trigger when MMC is used
 		   (hardware bug? go figure)... */
 		MISR = MISR_EOC;
 		PISR = PISR_EOC;
 		MCSR = MCSR_EOC;
+#endif
 
 		return IRQ_HANDLED;
 	}
Quoted 8 lines

Cheers,
Ian.

Signature · 4 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road,                    Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom       Phone:  +44 (0)1223 411 200

Nicolas

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#4 lore raw

At Fri, 11 Feb 2005 10:50:22 -0500 (EST),

Quoted 33 lines · Nicolas Pitre
Quoted 30 lines · Ian Campbell

Hi Nico,

I've just grabbed your pxa2xx audio driver from alsa CVS and given it a go on my PXA255 based board. I'm running 2.6.10 with the DMA mmap API backported. I got it working pretty quick with only a couple of issues -- thanks!

First issue was minor: I think *_EOC only exist on PXA270, or at least they aren't documented on the 255 and the symbols aren't defined for CONFIG_PXA25x so I wrapped them in CONFIG_PXA27x. I don't know if it would hurt to write to the reserved bits on 255...

Second issue is a bit strange. The code in the reset function does:

	GCR = GCR_COLD_RST;
	GCR |= GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
which either causes a hang or causes repeated interrupts so that it is
impossible to see what is going on (didn't see anything from a printk in
the irq handler though). I changed it to 
	GCR = GCR_COLD_RST;
	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);

which matches the way the old OSS driver did the reset and now the driver works great.

I don't understand this though since the documentation would appear to suggest that the PRIRDY way makes more sense. I guess it's possible that it is related to 255 errata #30 ("Invalid AC'97 interrupt during cold reset") but I'm not sure...

Quoted 7 lines
Quoted 3 lines

Anyway, here is the patch for the changes I made, what do you think?

Looks fine to me.

OK, applied to CVS.

thanks,

Takashi

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click