[PATCH] [UBUNTU:sound/{core, pci/emu10k1}] Fix silence on resume and OOPS on suspend for emu10k

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Fri Apr 7 07:46:45 UTC 2006


Subject: [PATCH] [UBUNTU:sound/{core,pci/emu10k1}] Fix silence on resume and OOPS on suspend for emu10k

UpstreamStatus: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=4d7d7596287588a953f450a3f18c5d4587f763d0
                http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=603bf524aa4cba95e4fcd64dbfffc41f804c65ab

These two git commits by Takashi Iwai <tiwai at suse.de> (applied by
Linus) fix inaudible sound after resume for emu10k and add a NULL check
to prevent an OOPS on suspend, respectively. This patch closes LP#4215.
Thanks to <undefined at pobox.com> for narrowing down the appropriate git
ids.

Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>

---

 sound/core/pcm_native.c      |    6 ++++++
 sound/pci/emu10k1/emumixer.c |    8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

c1fe5e4843b6824d992368036b33ea852f730278
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 16e252f..69c6a83 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1054,6 +1054,9 @@ int snd_pcm_suspend(snd_pcm_substream_t 
 	int err;
 	unsigned long flags;
 
+	if (! substream)
+		return 0;
+
 	snd_pcm_stream_lock_irqsave(substream, flags);
 	err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
 	snd_pcm_stream_unlock_irqrestore(substream, flags);
@@ -1072,6 +1075,9 @@ int snd_pcm_suspend_all(snd_pcm_t *pcm)
 	snd_pcm_substream_t *substream;
 	int stream, err = 0;
 
+	if (! pcm)
+		return 0;
+
 	for (stream = 0; stream < 2; stream++) {
 		for (substream = pcm->streams[stream].substream; substream; substream = substream->next) {
 			/* FIXME: the open/close code should lock this as well */
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index 6c39e7b..7e84457 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -822,9 +822,9 @@ int __devinit snd_emu10k1_mixer(emu10k1_
 		}
 		if (emu->audigy) {
 			/* set master volume to 0 dB */
-			snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000);
+			snd_ac97_write_cache(emu->ac97, AC97_MASTER, 0x0000);
 			/* set capture source to mic */
-			snd_ac97_write(emu->ac97, AC97_REC_SEL, 0x0000);
+			snd_ac97_write_cache(emu->ac97, AC97_REC_SEL, 0x0000);
 			c = audigy_remove_ctls;
 		} else {
 			/*
@@ -837,8 +837,8 @@ int __devinit snd_emu10k1_mixer(emu10k1_
 				snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT);
 			}
 			/* remove unused AC97 controls */
-			snd_ac97_write(emu->ac97, AC97_SURROUND_MASTER, 0x0202);
-			snd_ac97_write(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202);
+			snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202);
+			snd_ac97_write_cache(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202);
 			c = emu10k1_remove_ctls;
 		}
 		for (; *c; c++)
-- 
1.1.3


-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:   www.sh.nu/~crimsun/pubkey.gpg.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060407/67083b35/attachment.sig>


More information about the kernel-team mailing list