aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/ad1816a/ad1816a_lib.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-08-03 08:02:47 -0400
committerJaroslav Kysela <perex@suse.cz>2005-08-30 02:43:43 -0400
commit5b8f7f7329289fa3b74ef8cdbaa9d2929787d3e6 (patch)
treea90354362cd044d3ef6b2e272eb73124b973e3f3 /sound/isa/ad1816a/ad1816a_lib.c
parent5549d54992391d81a8cbfbaac45a958876fbc9cb (diff)
[ALSA] ad1816a - Add clockfreq module option
Documentation,AD1816A driver Added clockfreq module option for the card with a different clock frequency than 33kHz. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/ad1816a/ad1816a_lib.c')
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index 625b2eff14a1..ae860360ecf9 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -234,7 +234,7 @@ static int snd_ad1816a_playback_prepare(snd_pcm_substream_t *substream)
234 ad1816a_t *chip = snd_pcm_substream_chip(substream); 234 ad1816a_t *chip = snd_pcm_substream_chip(substream);
235 unsigned long flags; 235 unsigned long flags;
236 snd_pcm_runtime_t *runtime = substream->runtime; 236 snd_pcm_runtime_t *runtime = substream->runtime;
237 unsigned int size; 237 unsigned int size, rate;
238 238
239 spin_lock_irqsave(&chip->lock, flags); 239 spin_lock_irqsave(&chip->lock, flags);
240 240
@@ -245,7 +245,10 @@ static int snd_ad1816a_playback_prepare(snd_pcm_substream_t *substream)
245 snd_dma_program(chip->dma1, runtime->dma_addr, size, 245 snd_dma_program(chip->dma1, runtime->dma_addr, size,
246 DMA_MODE_WRITE | DMA_AUTOINIT); 246 DMA_MODE_WRITE | DMA_AUTOINIT);
247 247
248 snd_ad1816a_write(chip, AD1816A_PLAYBACK_SAMPLE_RATE, runtime->rate); 248 rate = runtime->rate;
249 if (chip->clock_freq)
250 rate = (rate * 33000) / chip->clock_freq;
251 snd_ad1816a_write(chip, AD1816A_PLAYBACK_SAMPLE_RATE, rate);
249 snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, 252 snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG,
250 AD1816A_FMT_ALL | AD1816A_FMT_STEREO, 253 AD1816A_FMT_ALL | AD1816A_FMT_STEREO,
251 snd_ad1816a_get_format(chip, runtime->format, 254 snd_ad1816a_get_format(chip, runtime->format,
@@ -263,7 +266,7 @@ static int snd_ad1816a_capture_prepare(snd_pcm_substream_t *substream)
263 ad1816a_t *chip = snd_pcm_substream_chip(substream); 266 ad1816a_t *chip = snd_pcm_substream_chip(substream);
264 unsigned long flags; 267 unsigned long flags;
265 snd_pcm_runtime_t *runtime = substream->runtime; 268 snd_pcm_runtime_t *runtime = substream->runtime;
266 unsigned int size; 269 unsigned int size, rate;
267 270
268 spin_lock_irqsave(&chip->lock, flags); 271 spin_lock_irqsave(&chip->lock, flags);
269 272
@@ -274,7 +277,10 @@ static int snd_ad1816a_capture_prepare(snd_pcm_substream_t *substream)
274 snd_dma_program(chip->dma2, runtime->dma_addr, size, 277 snd_dma_program(chip->dma2, runtime->dma_addr, size,
275 DMA_MODE_READ | DMA_AUTOINIT); 278 DMA_MODE_READ | DMA_AUTOINIT);
276 279
277 snd_ad1816a_write(chip, AD1816A_CAPTURE_SAMPLE_RATE, runtime->rate); 280 rate = runtime->rate;
281 if (chip->clock_freq)
282 rate = (rate * 33000) / chip->clock_freq;
283 snd_ad1816a_write(chip, AD1816A_CAPTURE_SAMPLE_RATE, rate);
278 snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, 284 snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG,
279 AD1816A_FMT_ALL | AD1816A_FMT_STEREO, 285 AD1816A_FMT_ALL | AD1816A_FMT_STEREO,
280 snd_ad1816a_get_format(chip, runtime->format, 286 snd_ad1816a_get_format(chip, runtime->format,