diff options
author | James Courtier-Dutton <James@superbug.co.uk> | 2005-05-04 11:26:28 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:06:13 -0400 |
commit | c702563703b5680a7143f8ac66613d082a190ca2 (patch) | |
tree | 6281d1668c7782fc756b6ff1fb7d433fb44adc4c | |
parent | 14c7e472aa979eecc15255eec5cec2763649c599 (diff) |
[ALSA] Support multiple capture rates on p16v.
EMU10K1/EMU10K2 driver
The capture rate does in fact vary, but it only captures anything if
the HD Capture source is set to I2S or AC97. I have not tested if the sound
is actually captured from an physical input of some type or not.
TODO: Get SPDIF capture working.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
-rw-r--r-- | sound/pci/emu10k1/p16v.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 776761fe5577..13f7e62ee56b 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -133,25 +133,24 @@ static snd_pcm_hardware_t snd_p16v_playback_hw = { | |||
133 | }; | 133 | }; |
134 | 134 | ||
135 | static snd_pcm_hardware_t snd_p16v_capture_hw = { | 135 | static snd_pcm_hardware_t snd_p16v_capture_hw = { |
136 | .info = (SNDRV_PCM_INFO_MMAP | | 136 | .info = (SNDRV_PCM_INFO_MMAP | |
137 | SNDRV_PCM_INFO_INTERLEAVED | | 137 | SNDRV_PCM_INFO_INTERLEAVED | |
138 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 138 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
139 | SNDRV_PCM_INFO_MMAP_VALID), | 139 | SNDRV_PCM_INFO_MMAP_VALID), |
140 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | 140 | .formats = SNDRV_PCM_FMTBIT_S32_LE, |
141 | .rates = SNDRV_PCM_RATE_48000, | 141 | .rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100, |
142 | .rate_min = 48000, | 142 | .rate_min = 44100, |
143 | .rate_max = 48000, | 143 | .rate_max = 192000, |
144 | .channels_min = 2, | 144 | .channels_min = 2, |
145 | .channels_max = 2, | 145 | .channels_max = 2, |
146 | .buffer_bytes_max = (32*1024), | 146 | .buffer_bytes_max = (32*1024), |
147 | .period_bytes_min = 64, | 147 | .period_bytes_min = 64, |
148 | .period_bytes_max = (16*1024), | 148 | .period_bytes_max = (16*1024), |
149 | .periods_min = 2, | 149 | .periods_min = 2, |
150 | .periods_max = 2, | 150 | .periods_max = 2, |
151 | .fifo_size = 0, | 151 | .fifo_size = 0, |
152 | }; | 152 | }; |
153 | 153 | ||
154 | |||
155 | static void snd_p16v_pcm_free_substream(snd_pcm_runtime_t *runtime) | 154 | static void snd_p16v_pcm_free_substream(snd_pcm_runtime_t *runtime) |
156 | { | 155 | { |
157 | emu10k1_pcm_t *epcm = runtime->private_data; | 156 | emu10k1_pcm_t *epcm = runtime->private_data; |
@@ -362,7 +361,25 @@ static int snd_p16v_pcm_prepare_capture(snd_pcm_substream_t *substream) | |||
362 | emu10k1_t *emu = snd_pcm_substream_chip(substream); | 361 | emu10k1_t *emu = snd_pcm_substream_chip(substream); |
363 | snd_pcm_runtime_t *runtime = substream->runtime; | 362 | snd_pcm_runtime_t *runtime = substream->runtime; |
364 | int channel = substream->pcm->device - emu->p16v_device_offset; | 363 | int channel = substream->pcm->device - emu->p16v_device_offset; |
365 | //printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); | 364 | u32 tmp; |
365 | //printk("prepare capture:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); | ||
366 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); | ||
367 | switch (runtime->rate) { | ||
368 | case 44100: | ||
369 | snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0800); | ||
370 | break; | ||
371 | case 96000: | ||
372 | snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0400); | ||
373 | break; | ||
374 | case 192000: | ||
375 | snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0200); | ||
376 | break; | ||
377 | case 48000: | ||
378 | default: | ||
379 | snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0000); | ||
380 | break; | ||
381 | } | ||
382 | /* FIXME: Check emu->buffer.size before actually writing to it. */ | ||
366 | snd_emu10k1_ptr20_write(emu, 0x13, channel, 0); | 383 | snd_emu10k1_ptr20_write(emu, 0x13, channel, 0); |
367 | snd_emu10k1_ptr20_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); | 384 | snd_emu10k1_ptr20_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); |
368 | snd_emu10k1_ptr20_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes | 385 | snd_emu10k1_ptr20_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes |