24 #include <linux/pci.h>
26 #include <linux/slab.h>
30 #include <linux/module.h>
48 #define CTL_ROUTE_ANALOG 0
49 #define CTL_ROUTE_DIGITAL 1
140 static int snd_aw2_control_switch_capture_info(
struct snd_kcontrol *kcontrol,
142 static int snd_aw2_control_switch_capture_get(
struct snd_kcontrol *kcontrol,
145 static int snd_aw2_control_switch_capture_put(
struct snd_kcontrol *kcontrol,
173 .name = KBUILD_MODNAME,
174 .id_table = snd_aw2_ids,
175 .probe = snd_aw2_probe,
183 .open = snd_aw2_pcm_playback_open,
184 .close = snd_aw2_pcm_playback_close,
186 .hw_params = snd_aw2_pcm_hw_params,
187 .hw_free = snd_aw2_pcm_hw_free,
188 .prepare = snd_aw2_pcm_prepare_playback,
189 .trigger = snd_aw2_pcm_trigger_playback,
190 .pointer = snd_aw2_pcm_pointer_playback,
195 .open = snd_aw2_pcm_capture_open,
196 .close = snd_aw2_pcm_capture_close,
198 .hw_params = snd_aw2_pcm_hw_params,
199 .hw_free = snd_aw2_pcm_hw_free,
200 .prepare = snd_aw2_pcm_prepare_capture,
201 .trigger = snd_aw2_pcm_trigger_capture,
202 .pointer = snd_aw2_pcm_pointer_capture,
207 .name =
"PCM Capture Route",
210 .private_value = 0xffff,
211 .info = snd_aw2_control_switch_capture_info,
212 .get = snd_aw2_control_switch_capture_get,
213 .put = snd_aw2_control_switch_capture_put
251 .dev_free = snd_aw2_dev_free,
264 (pci_set_consistent_dma_mask(pci,
DMA_BIT_MASK(32)) < 0)) {
329 "Audiowerk 2 sound card (saa7146 chipset) detected and "
357 err = snd_aw2_create(card, pci, &chip);
375 snd_aw2_new_pcm(chip);
385 pci_set_drvdata(pci, card);
395 pci_set_drvdata(pci,
NULL);
404 runtime->
hw = snd_aw2_playback_hw;
420 runtime->
hw = snd_aw2_capture_hw;
449 struct aw2 *chip = pcm_device->
chip;
455 period_size = snd_pcm_lib_period_bytes(substream);
456 buffer_size = snd_pcm_lib_buffer_bytes(substream);
478 struct aw2 *chip = pcm_device->
chip;
484 period_size = snd_pcm_lib_period_bytes(substream);
485 buffer_size = snd_pcm_lib_buffer_bytes(substream);
509 struct aw2 *chip = pcm_device->
chip;
535 struct aw2 *chip = pcm_device->
chip;
560 struct aw2 *chip = pcm_device->
chip;
561 unsigned int current_ptr;
571 return bytes_to_frames(substream->
runtime, current_ptr);
579 struct aw2 *chip = pcm_device->
chip;
580 unsigned int current_ptr;
590 return bytes_to_frames(substream->
runtime, current_ptr);
596 struct snd_pcm *pcm_playback_ana;
597 struct snd_pcm *pcm_playback_num;
615 strcpy(pcm_playback_ana->
name,
"Analog playback");
620 &snd_aw2_playback_ops);
622 pcm_device->
pcm = pcm_playback_ana;
635 64 * 1024, 64 * 1024);
638 "error (0x%X)\n", err);
651 strcpy(pcm_playback_num->
name,
"Digital playback");
656 &snd_aw2_playback_ops);
658 pcm_device->
pcm = pcm_playback_num;
671 64 * 1024, 64 * 1024);
674 "aw2: snd_pcm_lib_preallocate_pages_for_all error "
696 &snd_aw2_capture_ops);
698 pcm_device->
pcm = pcm_capture;
711 64 * 1024, 64 * 1024);
714 "aw2: snd_pcm_lib_preallocate_pages_for_all error "
728 static int snd_aw2_control_switch_capture_info(
struct snd_kcontrol *kcontrol,
731 static char *texts[2] = {
746 static int snd_aw2_control_switch_capture_get(
struct snd_kcontrol *kcontrol,
758 static int snd_aw2_control_switch_capture_put(
struct snd_kcontrol *kcontrol,