]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.36.4/alsa-au88x0-limit-number-of-channels-to-fix-oops-via-oss-emu.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.4 / alsa-au88x0-limit-number-of-channels-to-fix-oops-via-oss-emu.patch
CommitLineData
e2b52abc
GKH
1From d9ab344336f74c012f6643ed3d1ad8ca0136de3b Mon Sep 17 00:00:00 2001
2From: Raymond Yau <superquad.vortex2@gmail.com>
3Date: Sun, 16 Jan 2011 10:55:54 +0800
4Subject: ALSA : au88x0 - Limit number of channels to fix Oops via OSS emu
5
6From: Raymond Yau <superquad.vortex2@gmail.com>
7
8commit d9ab344336f74c012f6643ed3d1ad8ca0136de3b upstream.
9
10Fix playback/capture channels patch to change supported playback
11channels of au8830 to 1,2,4 and capture channels to 1,2.
12This prevent oops when oss emulation use SNDCTL_DSP_CHANNELS to
13set 3 Channels
14
15Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
16Signed-off-by: Takashi Iwai <tiwai@suse.de>
17Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18
19---
20 sound/pci/au88x0/au88x0_pcm.c | 24 ++++++++++++++++++++----
21 1 file changed, 20 insertions(+), 4 deletions(-)
22
23--- a/sound/pci/au88x0/au88x0_pcm.c
24+++ b/sound/pci/au88x0/au88x0_pcm.c
25@@ -42,11 +42,7 @@ static struct snd_pcm_hardware snd_vorte
26 .rate_min = 5000,
27 .rate_max = 48000,
28 .channels_min = 1,
29-#ifdef CHIP_AU8830
30- .channels_max = 4,
31-#else
32 .channels_max = 2,
33-#endif
34 .buffer_bytes_max = 0x10000,
35 .period_bytes_min = 0x1,
36 .period_bytes_max = 0x1000,
37@@ -115,6 +111,17 @@ static struct snd_pcm_hardware snd_vorte
38 .periods_max = 64,
39 };
40 #endif
41+#ifdef CHIP_AU8830
42+static unsigned int au8830_channels[3] = {
43+ 1, 2, 4,
44+};
45+
46+static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = {
47+ .count = ARRAY_SIZE(au8830_channels),
48+ .list = au8830_channels,
49+ .mask = 0,
50+};
51+#endif
52 /* open callback */
53 static int snd_vortex_pcm_open(struct snd_pcm_substream *substream)
54 {
55@@ -156,6 +163,15 @@ static int snd_vortex_pcm_open(struct sn
56 if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB
57 || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S)
58 runtime->hw = snd_vortex_playback_hw_adb;
59+#ifdef CHIP_AU8830
60+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
61+ VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) {
62+ runtime->hw.channels_max = 4;
63+ snd_pcm_hw_constraint_list(runtime, 0,
64+ SNDRV_PCM_HW_PARAM_CHANNELS,
65+ &hw_constraints_au8830_channels);
66+ }
67+#endif
68 substream->runtime->private_data = NULL;
69 }
70 #ifndef CHIP_AU8810