Skip to contentSkip to conversation

snd-aoa: fix onyx resume

PATCH Applied Johannes Berg 2 participants 5 messages Dec 14, 2006 – Feb 2, 2007

Subsystems (2)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 snd-aoa: fix onyx resume

When the machine resumes the onyx codec might be in a weird state. Hence, simply fully reset it once (and keep the code to take it out of suspend in case the suspend of the codec chip survives a reset).

---
There's another problem with i2sbus suspend, namely that the i2sbus code doesn't really handle a suspend well at all, it needs to re-init the hardware during resume. I noticed because firmware on the quad powermac doesn't set the i2sbus to 44.1kHz but 42kHz or something like that so when I was playing a song across suspend/resume it ended up slower...

I don't want to fix this until that i2sbus control rewrite/fix though because it'll most likely collide.

Takashi, please apply this fix.

sound/aoa/codecs/snd-aoa-codec-onyx.c +10 -1
@@ -825,7 +825,16 @@ static int onyx_resume(struct codec_info
 	int err = -ENXIO;
 
 	mutex_lock(&onyx->mutex);
-	/* take codec out of suspend */
+
+	/* reset codec */
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
+	msleep(1);
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 1);
+	msleep(1);
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
+	msleep(1);
+
+	/* take codec out of suspend (if it still is after reset) */
 	if (onyx_read_register(onyx, ONYX_REG_CONTROL, &v))
 		goto out_unlock;
 	onyx_write_register(onyx, ONYX_REG_CONTROL, v & ~(ONYX_ADPSV | ONYX_DAPSV));

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Applied
#1 lore raw

At Thu, 14 Dec 2006 15:27:48 +0100,

Quoted 6 lines · Johannes Berg

When the machine resumes the onyx codec might be in a weird state. Hence, simply fully reset it once (and keep the code to take it out of suspend in case the suspend of the codec chip survives a reset).

Applied to ALSA tree now. Thanks.

Takashi

Quoted 46 lines

---
There's another problem with i2sbus suspend, namely that the i2sbus code doesn't really handle a suspend well at all, it needs to re-init the hardware during resume. I noticed because firmware on the quad powermac doesn't set the i2sbus to 44.1kHz but 42kHz or something like that so when I was playing a song across suspend/resume it ended up slower...

I don't want to fix this until that i2sbus control rewrite/fix though because it'll most likely collide.

Takashi, please apply this fix.

sound/aoa/codecs/snd-aoa-codec-onyx.c +10 -2
@@ -825,7 +825,16 @@ static int onyx_resume(struct codec_info
 	int err = -ENXIO;
 
 	mutex_lock(&onyx->mutex);
-	/* take codec out of suspend */
+
+	/* reset codec */
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
+	msleep(1);
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 1);
+	msleep(1);
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
+	msleep(1);
+
+	/* take codec out of suspend (if it still is after reset) */
 	if (onyx_read_register(onyx, ONYX_REG_CONTROL, &v))
 		goto out_unlock;
 	onyx_write_register(onyx, ONYX_REG_CONTROL, v & ~(ONYX_ADPSV | ONYX_DAPSV));
 
 
 
-------------------------------------------------------------------------

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

author maintainer
#2 lore raw
Quoted 10 lines · Takashi Iwai

At Thu, 14 Dec 2006 15:27:48 +0100,

Quoted 6 lines · Johannes Berg

When the machine resumes the onyx codec might be in a weird state. Hence, simply fully reset it once (and keep the code to take it out of suspend in case the suspend of the codec chip survives a reset).

Applied to ALSA tree now. Thanks.

It doesn't seem to be upstream yet, is there some holdup? Not that it's important to me at this time, just curious.

johannes

#3 lore raw

At Thu, 01 Feb 2007 21:17:39 +0100,

Quoted 9 lines · Johannes Berg
Quoted 7 lines · Takashi Iwai

At Thu, 14 Dec 2006 15:27:48 +0100,

Quoted 5 lines · Johannes Berg

When the machine resumes the onyx codec might be in a weird state. Hence, simply fully reset it once (and keep the code to take it out of suspend in case the suspend of the codec chip survives a reset).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Applied to ALSA tree now. Thanks.

It doesn't seem to be upstream yet, is there some holdup? Not that it's important to me at this time, just curious.

It's in alsa.git mm branch. A bunch of patches are only in mm tree just because the push request missed the 2.6.20 merge window, unfortunately...

Takashi

Applied
#4 lore raw
In reply to Johannes Berg

At Thu, 14 Dec 2006 15:27:48 +0100,

Quoted 6 lines · Johannes Berg

When the machine resumes the onyx codec might be in a weird state. Hence, simply fully reset it once (and keep the code to take it out of suspend in case the suspend of the codec chip survives a reset).

Applied to ALSA tree now. Thanks.

Takashi

Quoted 37 lines

---
There's another problem with i2sbus suspend, namely that the i2sbus code doesn't really handle a suspend well at all, it needs to re-init the hardware during resume. I noticed because firmware on the quad powermac doesn't set the i2sbus to 44.1kHz but 42kHz or something like that so when I was playing a song across suspend/resume it ended up slower...

I don't want to fix this until that i2sbus control rewrite/fix though because it'll most likely collide.

Takashi, please apply this fix.

sound/aoa/codecs/snd-aoa-codec-onyx.c +10 -2
@@ -825,7 +825,16 @@ static int onyx_resume(struct codec_info
 	int err = -ENXIO;
 
 	mutex_lock(&onyx->mutex);
-	/* take codec out of suspend */
+
+	/* reset codec */
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
+	msleep(1);
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 1);
+	msleep(1);
+	onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
+	msleep(1);
+
+	/* take codec out of suspend (if it still is after reset) */
 	if (onyx_read_register(onyx, ONYX_REG_CONTROL, &v))
 		goto out_unlock;
 	onyx_write_register(onyx, ONYX_REG_CONTROL, v & ~(ONYX_ADPSV | ONYX_DAPSV));
 
 
 
-------------------------------------------------------------------------
Quoted 9 lines

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV