From b721e68bdc5b39c51bf6a1469f8d3663fbe03243 Mon Sep 17 00:00:00 2001
From: Giuliano Pochini <pochini@shiny.it>
Date: Wed, 17 Feb 2010 00:57:44 +0100
Subject: ALSA: Echoaudio, fix Guru Meditation #00000005.48454C50

This patch fixes a division by zero error in the irq handler.

There is a small window between the hw_params() callback and when
runtime->frame_bits is set by ALSA middle layer. When another substream is
already running, if an interrupt is delivered during that window the irq
handler calls pcm_pointer() which does a division by zero. The patch below
makes the irq handler skip substreams that are initialized but not started
yet. Cc to Clemens Ladisch because he proposed an alternate fix.

For more information, please read the original thread in the linux-kernel
mailing list: http://lkml.org/lkml/2010/2/2/187

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/echoaudio/echoaudio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'sound/pci')

diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 1305f7ca02c3..641d7f07392c 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1821,7 +1821,9 @@ static irqreturn_t snd_echo_interrupt(int irq, void *dev_id)
 	/* The hardware doesn't tell us which substream caused the irq,
 	thus we have to check all running substreams. */
 	for (ss = 0; ss < DSP_MAXPIPES; ss++) {
-		if ((substream = chip->substream[ss])) {
+		substream = chip->substream[ss];
+		if (substream && ((struct audiopipe *)substream->runtime->
+				private_data)->state == PIPE_STATE_STARTED) {
 			period = pcm_pointer(substream) /
 				substream->runtime->period_size;
 			if (period != chip->last_period[ss]) {
-- 
cgit v1.2.3


From bf30a4309d4294d3eca248ea8a20c1c3570f5e74 Mon Sep 17 00:00:00 2001
From: Clemens Ladisch <clemens@ladisch.de>
Date: Mon, 22 Feb 2010 10:33:13 +0100
Subject: ALSA: via82xx: add quirk for D1289 motherboard

Add a headphones-only quirk for the Fujitsu Siemens D1289.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reported-and-tested-by: Marc Haber <mh+alsa201002@zugschlus.de>
Cc: <stable@kernel.org>

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 sound/pci/via82xx.c | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'sound/pci')

diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 8a332d2f615c..03d6aea19749 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1790,6 +1790,12 @@ static struct ac97_quirk ac97_quirks[] = {
 		.name = "ASRock K7VT2",
 		.type = AC97_TUNE_HP_ONLY
 	},
+	{
+		.subvendor = 0x110a,
+		.subdevice = 0x0079,
+		.name = "Fujitsu Siemens D1289",
+		.type = AC97_TUNE_HP_ONLY
+	},
 	{
 		.subvendor = 0x1019,
 		.subdevice = 0x0a81,
-- 
cgit v1.2.3