diff options
author | Raymond Yau <superquad.vortex2@gmail.com> | 2011-01-15 21:55:54 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-17 05:04:01 -0500 |
commit | d9ab344336f74c012f6643ed3d1ad8ca0136de3b (patch) | |
tree | 5a858bfefef38b288af7f9e94f1bb3a5714eedef /sound/pci/au88x0 | |
parent | 3e8b3b90fecedcf20d895c4e6ad01a379fe252bf (diff) |
ALSA : au88x0 - Limit number of channels to fix Oops via OSS emu
Fix playback/capture channels patch to change supported playback
channels of au8830 to 1,2,4 and capture channels to 1,2.
This prevent oops when oss emulation use SNDCTL_DSP_CHANNELS to
set 3 Channels
Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/au88x0')
-rw-r--r-- | sound/pci/au88x0/au88x0_pcm.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index b9d2f202cf9b..5439d662d104 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c | |||
@@ -42,11 +42,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_adb = { | |||
42 | .rate_min = 5000, | 42 | .rate_min = 5000, |
43 | .rate_max = 48000, | 43 | .rate_max = 48000, |
44 | .channels_min = 1, | 44 | .channels_min = 1, |
45 | #ifdef CHIP_AU8830 | ||
46 | .channels_max = 4, | ||
47 | #else | ||
48 | .channels_max = 2, | 45 | .channels_max = 2, |
49 | #endif | ||
50 | .buffer_bytes_max = 0x10000, | 46 | .buffer_bytes_max = 0x10000, |
51 | .period_bytes_min = 0x1, | 47 | .period_bytes_min = 0x1, |
52 | .period_bytes_max = 0x1000, | 48 | .period_bytes_max = 0x1000, |
@@ -115,6 +111,17 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_wt = { | |||
115 | .periods_max = 64, | 111 | .periods_max = 64, |
116 | }; | 112 | }; |
117 | #endif | 113 | #endif |
114 | #ifdef CHIP_AU8830 | ||
115 | static unsigned int au8830_channels[3] = { | ||
116 | 1, 2, 4, | ||
117 | }; | ||
118 | |||
119 | static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = { | ||
120 | .count = ARRAY_SIZE(au8830_channels), | ||
121 | .list = au8830_channels, | ||
122 | .mask = 0, | ||
123 | }; | ||
124 | #endif | ||
118 | /* open callback */ | 125 | /* open callback */ |
119 | static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) | 126 | static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) |
120 | { | 127 | { |
@@ -156,6 +163,15 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) | |||
156 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB | 163 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB |
157 | || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S) | 164 | || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S) |
158 | runtime->hw = snd_vortex_playback_hw_adb; | 165 | runtime->hw = snd_vortex_playback_hw_adb; |
166 | #ifdef CHIP_AU8830 | ||
167 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | ||
168 | VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) { | ||
169 | runtime->hw.channels_max = 4; | ||
170 | snd_pcm_hw_constraint_list(runtime, 0, | ||
171 | SNDRV_PCM_HW_PARAM_CHANNELS, | ||
172 | &hw_constraints_au8830_channels); | ||
173 | } | ||
174 | #endif | ||
159 | substream->runtime->private_data = NULL; | 175 | substream->runtime->private_data = NULL; |
160 | } | 176 | } |
161 | #ifndef CHIP_AU8810 | 177 | #ifndef CHIP_AU8810 |