aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ctxfi/ctpcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-09 02:19:02 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-09 02:19:02 -0400
commita5990dc5b96f537618b0f057c8723a6a0b0cdc74 (patch)
treed5c7e3283c2827ab0ce00aaf204315a696114edd /sound/pci/ctxfi/ctpcm.c
parent5242bc7613311aa1a3d5ed41e9cf81015b65563f (diff)
ALSA: ctxfi - Clear PCM resources at hw_params and hw_free
Currently the PCM resources are allocated only once and ever in prepare callback, assuming that the PCM parameters are never changed. But it's not true. This patch adds the call of atc->pcm_release_resources() at hw_params and hw_free callbacks to assure that the PCM setup is done correctly for each h/w parameter changes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ctxfi/ctpcm.c')
-rw-r--r--sound/pci/ctxfi/ctpcm.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c
index 870fa170f046..9e5c0c4da726 100644
--- a/sound/pci/ctxfi/ctpcm.c
+++ b/sound/pci/ctxfi/ctpcm.c
@@ -176,12 +176,26 @@ static int ct_pcm_playback_close(struct snd_pcm_substream *substream)
176static int ct_pcm_hw_params(struct snd_pcm_substream *substream, 176static int ct_pcm_hw_params(struct snd_pcm_substream *substream,
177 struct snd_pcm_hw_params *hw_params) 177 struct snd_pcm_hw_params *hw_params)
178{ 178{
179 return snd_pcm_lib_malloc_pages(substream, 179 struct ct_atc *atc = snd_pcm_substream_chip(substream);
180 struct ct_atc_pcm *apcm = substream->runtime->private_data;
181 int err;
182
183 err = snd_pcm_lib_malloc_pages(substream,
180 params_buffer_bytes(hw_params)); 184 params_buffer_bytes(hw_params));
185 if (err < 0)
186 return err;
187 /* clear previous resources */
188 atc->pcm_release_resources(atc, apcm);
189 return err;
181} 190}
182 191
183static int ct_pcm_hw_free(struct snd_pcm_substream *substream) 192static int ct_pcm_hw_free(struct snd_pcm_substream *substream)
184{ 193{
194 struct ct_atc *atc = snd_pcm_substream_chip(substream);
195 struct ct_atc_pcm *apcm = substream->runtime->private_data;
196
197 /* clear previous resources */
198 atc->pcm_release_resources(atc, apcm);
185 /* Free snd-allocated pages */ 199 /* Free snd-allocated pages */
186 return snd_pcm_lib_free_pages(substream); 200 return snd_pcm_lib_free_pages(substream);
187} 201}