1 /*****************************************************************************
3 * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and
4 * Jean-Christian Hassler <jhassler@free.fr>
6 * This file is part of the Audiowerk2 ALSA driver
8 * The Audiowerk2 ALSA driver is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2.
12 * The Audiowerk2 ALSA driver is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with the Audiowerk2 ALSA driver; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 *****************************************************************************/
23 #include <linux/init.h>
24 #include <linux/pci.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/slab.h>
27 #include <linux/interrupt.h>
28 #include <linux/delay.h>
30 #include <sound/core.h>
31 #include <sound/initval.h>
32 #include <sound/pcm.h>
33 #include <sound/pcm_params.h>
34 #include <sound/control.h>
37 #include "aw2-saa7146.h"
39 MODULE_LICENSE("GPL");
40 MODULE_AUTHOR("Cedric Bregardis <cedric.bregardis@free.fr>, "
41 "Jean-Christian Hassler <jhassler@free.fr>");
42 MODULE_DESCRIPTION("Emagic Audiowerk 2 sound driver");
43 MODULE_LICENSE("GPL");
45 /*********************************
47 ********************************/
48 #define PCI_VENDOR_ID_SAA7146 0x1131
49 #define PCI_DEVICE_ID_SAA7146 0x7146
51 #define CTL_ROUTE_ANALOG 0
52 #define CTL_ROUTE_DIGITAL 1
54 /*********************************
56 ********************************/
57 /* hardware definition */
58 static struct snd_pcm_hardware snd_aw2_playback_hw = {
59 .info = (SNDRV_PCM_INFO_MMAP |
60 SNDRV_PCM_INFO_INTERLEAVED |
61 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID),
62 .formats = SNDRV_PCM_FMTBIT_S16_LE,
63 .rates = SNDRV_PCM_RATE_44100,
68 .buffer_bytes_max = 32768,
69 .period_bytes_min = 4096,
70 .period_bytes_max = 32768,
75 static struct snd_pcm_hardware snd_aw2_capture_hw = {
76 .info = (SNDRV_PCM_INFO_MMAP |
77 SNDRV_PCM_INFO_INTERLEAVED |
78 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID),
79 .formats = SNDRV_PCM_FMTBIT_S16_LE,
80 .rates = SNDRV_PCM_RATE_44100,
85 .buffer_bytes_max = 32768,
86 .period_bytes_min = 4096,
87 .period_bytes_max = 32768,
92 struct aw2_pcm_device {
94 unsigned int stream_number;
99 struct snd_aw2_saa7146 saa7146;
106 unsigned long iobase_phys;
107 void __iomem *iobase_virt;
109 struct snd_card *card;
111 struct aw2_pcm_device device_playback[NB_STREAM_PLAYBACK];
112 struct aw2_pcm_device device_capture[NB_STREAM_CAPTURE];
115 /*********************************
116 * FUNCTION DECLARATIONS
117 ********************************/
118 static int __init alsa_card_aw2_init(void);
119 static void __exit alsa_card_aw2_exit(void);
120 static int snd_aw2_dev_free(struct snd_device *device);
121 static int __devinit snd_aw2_create(struct snd_card *card,
122 struct pci_dev *pci, struct aw2 **rchip);
123 static int __devinit snd_aw2_probe(struct pci_dev *pci,
124 const struct pci_device_id *pci_id);
125 static void __devexit snd_aw2_remove(struct pci_dev *pci);
126 static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream);
127 static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream);
128 static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream);
129 static int snd_aw2_pcm_capture_close(struct snd_pcm_substream *substream);
130 static int snd_aw2_pcm_hw_params(struct snd_pcm_substream *substream,
131 struct snd_pcm_hw_params *hw_params);
132 static int snd_aw2_pcm_hw_free(struct snd_pcm_substream *substream);
133 static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream);
134 static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream);
135 static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream,
137 static int snd_aw2_pcm_trigger_capture(struct snd_pcm_substream *substream,
139 static snd_pcm_uframes_t snd_aw2_pcm_pointer_playback(struct snd_pcm_substream
141 static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream
143 static int __devinit snd_aw2_new_pcm(struct aw2 *chip);
145 static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol,
146 struct snd_ctl_elem_info *uinfo);
147 static int snd_aw2_control_switch_capture_get(struct snd_kcontrol *kcontrol,
148 struct snd_ctl_elem_value
150 static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol,
151 struct snd_ctl_elem_value
154 /*********************************
156 ********************************/
157 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
158 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
159 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
161 module_param_array(index, int, NULL, 0444);
162 MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard.");
163 module_param_array(id, charp, NULL, 0444);
164 MODULE_PARM_DESC(id, "ID string for the Audiowerk2 soundcard.");
165 module_param_array(enable, bool, NULL, 0444);
166 MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");
168 static struct pci_device_id snd_aw2_ids[] = {
169 {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID,
174 MODULE_DEVICE_TABLE(pci, snd_aw2_ids);
176 /* pci_driver definition */
177 static struct pci_driver driver = {
178 .name = "Emagic Audiowerk 2",
179 .id_table = snd_aw2_ids,
180 .probe = snd_aw2_probe,
181 .remove = __devexit_p(snd_aw2_remove),
184 /* operators for playback PCM alsa interface */
185 static struct snd_pcm_ops snd_aw2_playback_ops = {
186 .open = snd_aw2_pcm_playback_open,
187 .close = snd_aw2_pcm_playback_close,
188 .ioctl = snd_pcm_lib_ioctl,
189 .hw_params = snd_aw2_pcm_hw_params,
190 .hw_free = snd_aw2_pcm_hw_free,
191 .prepare = snd_aw2_pcm_prepare_playback,
192 .trigger = snd_aw2_pcm_trigger_playback,
193 .pointer = snd_aw2_pcm_pointer_playback,
196 /* operators for capture PCM alsa interface */
197 static struct snd_pcm_ops snd_aw2_capture_ops = {
198 .open = snd_aw2_pcm_capture_open,
199 .close = snd_aw2_pcm_capture_close,
200 .ioctl = snd_pcm_lib_ioctl,
201 .hw_params = snd_aw2_pcm_hw_params,
202 .hw_free = snd_aw2_pcm_hw_free,
203 .prepare = snd_aw2_pcm_prepare_capture,
204 .trigger = snd_aw2_pcm_trigger_capture,
205 .pointer = snd_aw2_pcm_pointer_capture,
208 static struct snd_kcontrol_new aw2_control __devinitdata = {
209 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
210 .name = "PCM Capture Route",
212 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
213 .private_value = 0xffff,
214 .info = snd_aw2_control_switch_capture_info,
215 .get = snd_aw2_control_switch_capture_get,
216 .put = snd_aw2_control_switch_capture_put
219 /*********************************
220 * FUNCTION IMPLEMENTATIONS
221 ********************************/
223 /* initialization of the module */
224 static int __init alsa_card_aw2_init(void)
226 snd_printdd(KERN_DEBUG "aw2: Load aw2 module\n");
227 return pci_register_driver(&driver);
230 /* clean up the module */
231 static void __exit alsa_card_aw2_exit(void)
233 snd_printdd(KERN_DEBUG "aw2: Unload aw2 module\n");
234 pci_unregister_driver(&driver);
237 module_init(alsa_card_aw2_init);
238 module_exit(alsa_card_aw2_exit);
240 /* component-destructor */
241 static int snd_aw2_dev_free(struct snd_device *device)
243 struct aw2 *chip = device->device_data;
246 snd_aw2_saa7146_free(&chip->saa7146);
248 /* release the irq */
250 free_irq(chip->irq, (void *)chip);
251 /* release the i/o ports & memory */
252 if (chip->iobase_virt)
253 iounmap(chip->iobase_virt);
255 pci_release_regions(chip->pci);
256 /* disable the PCI entry */
257 pci_disable_device(chip->pci);
258 /* release the data */
264 /* chip-specific constructor */
265 static int __devinit snd_aw2_create(struct snd_card *card,
266 struct pci_dev *pci, struct aw2 **rchip)
270 static struct snd_device_ops ops = {
271 .dev_free = snd_aw2_dev_free,
276 /* initialize the PCI entry */
277 err = pci_enable_device(pci);
282 /* check PCI availability (32bit DMA) */
283 if ((pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) ||
284 (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0)) {
285 printk(KERN_ERR "aw2: Impossible to set 32bit mask DMA\n");
286 pci_disable_device(pci);
289 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
291 pci_disable_device(pci);
295 /* initialize the stuff */
300 /* (1) PCI resource allocation */
301 err = pci_request_regions(pci, "Audiowerk2");
303 pci_disable_device(pci);
307 chip->iobase_phys = pci_resource_start(pci, 0);
309 ioremap_nocache(chip->iobase_phys,
310 pci_resource_len(pci, 0));
312 if (chip->iobase_virt == NULL) {
313 printk(KERN_ERR "aw2: unable to remap memory region");
314 pci_release_regions(pci);
315 pci_disable_device(pci);
321 if (request_irq(pci->irq, snd_aw2_saa7146_interrupt,
322 IRQF_SHARED, "Audiowerk2", chip)) {
323 printk(KERN_ERR "aw2: Cannot grab irq %d\n", pci->irq);
325 iounmap(chip->iobase_virt);
326 pci_release_regions(chip->pci);
327 pci_disable_device(chip->pci);
331 chip->irq = pci->irq;
333 /* (2) initialization of the chip hardware */
334 snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt);
335 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
337 free_irq(chip->irq, (void *)chip);
338 iounmap(chip->iobase_virt);
339 pci_release_regions(chip->pci);
340 pci_disable_device(chip->pci);
345 snd_card_set_dev(card, &pci->dev);
349 "Audiowerk 2 sound card (saa7146 chipset) detected and "
355 static int __devinit snd_aw2_probe(struct pci_dev *pci,
356 const struct pci_device_id *pci_id)
359 struct snd_card *card;
363 /* (1) Continue if device is not enabled, else inc dev */
364 if (dev >= SNDRV_CARDS)
371 /* (2) Create card instance */
372 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
376 /* (3) Create main component */
377 err = snd_aw2_create(card, pci, &chip);
383 /* initialize mutex */
384 mutex_init(&chip->mtx);
386 spin_lock_init(&chip->reg_lock);
387 /* (4) Define driver ID and name string */
388 strcpy(card->driver, "aw2");
389 strcpy(card->shortname, "Audiowerk2");
391 sprintf(card->longname, "%s with SAA7146 irq %i",
392 card->shortname, chip->irq);
394 /* (5) Create other components */
395 snd_aw2_new_pcm(chip);
397 /* (6) Register card instance */
398 err = snd_card_register(card);
404 /* (7) Set PCI driver data */
405 pci_set_drvdata(pci, card);
412 static void __devexit snd_aw2_remove(struct pci_dev *pci)
414 snd_card_free(pci_get_drvdata(pci));
415 pci_set_drvdata(pci, NULL);
419 static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream)
421 struct snd_pcm_runtime *runtime = substream->runtime;
423 snd_printdd(KERN_DEBUG "aw2: Playback_open \n");
424 runtime->hw = snd_aw2_playback_hw;
429 static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream)
435 static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream)
437 struct snd_pcm_runtime *runtime = substream->runtime;
439 snd_printdd(KERN_DEBUG "aw2: Capture_open \n");
440 runtime->hw = snd_aw2_capture_hw;
445 static int snd_aw2_pcm_capture_close(struct snd_pcm_substream *substream)
447 /* TODO: something to do ? */
451 /* hw_params callback */
452 static int snd_aw2_pcm_hw_params(struct snd_pcm_substream *substream,
453 struct snd_pcm_hw_params *hw_params)
455 return snd_pcm_lib_malloc_pages(substream,
456 params_buffer_bytes(hw_params));
459 /* hw_free callback */
460 static int snd_aw2_pcm_hw_free(struct snd_pcm_substream *substream)
462 return snd_pcm_lib_free_pages(substream);
465 /* prepare callback for playback */
466 static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream)
468 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
469 struct aw2 *chip = pcm_device->chip;
470 struct snd_pcm_runtime *runtime = substream->runtime;
471 unsigned long period_size, buffer_size;
473 mutex_lock(&chip->mtx);
475 period_size = snd_pcm_lib_period_bytes(substream);
476 buffer_size = snd_pcm_lib_buffer_bytes(substream);
478 snd_aw2_saa7146_pcm_init_playback(&chip->saa7146,
479 pcm_device->stream_number,
480 runtime->dma_addr, period_size,
483 /* Define Interrupt callback */
484 snd_aw2_saa7146_define_it_playback_callback(pcm_device->stream_number,
485 (snd_aw2_saa7146_it_cb)
486 snd_pcm_period_elapsed,
489 mutex_unlock(&chip->mtx);
494 /* prepare callback for capture */
495 static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream)
497 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
498 struct aw2 *chip = pcm_device->chip;
499 struct snd_pcm_runtime *runtime = substream->runtime;
500 unsigned long period_size, buffer_size;
502 mutex_lock(&chip->mtx);
504 period_size = snd_pcm_lib_period_bytes(substream);
505 buffer_size = snd_pcm_lib_buffer_bytes(substream);
507 snd_aw2_saa7146_pcm_init_capture(&chip->saa7146,
508 pcm_device->stream_number,
509 runtime->dma_addr, period_size,
512 /* Define Interrupt callback */
513 snd_aw2_saa7146_define_it_capture_callback(pcm_device->stream_number,
514 (snd_aw2_saa7146_it_cb)
515 snd_pcm_period_elapsed,
518 mutex_unlock(&chip->mtx);
523 /* playback trigger callback */
524 static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream,
528 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
529 struct aw2 *chip = pcm_device->chip;
530 spin_lock(&chip->reg_lock);
532 case SNDRV_PCM_TRIGGER_START:
533 snd_aw2_saa7146_pcm_trigger_start_playback(&chip->saa7146,
537 case SNDRV_PCM_TRIGGER_STOP:
538 snd_aw2_saa7146_pcm_trigger_stop_playback(&chip->saa7146,
545 spin_unlock(&chip->reg_lock);
549 /* capture trigger callback */
550 static int snd_aw2_pcm_trigger_capture(struct snd_pcm_substream *substream,
554 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
555 struct aw2 *chip = pcm_device->chip;
556 spin_lock(&chip->reg_lock);
558 case SNDRV_PCM_TRIGGER_START:
559 snd_aw2_saa7146_pcm_trigger_start_capture(&chip->saa7146,
563 case SNDRV_PCM_TRIGGER_STOP:
564 snd_aw2_saa7146_pcm_trigger_stop_capture(&chip->saa7146,
571 spin_unlock(&chip->reg_lock);
575 /* playback pointer callback */
576 static snd_pcm_uframes_t snd_aw2_pcm_pointer_playback(struct snd_pcm_substream
579 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
580 struct aw2 *chip = pcm_device->chip;
581 unsigned int current_ptr;
583 /* get the current hardware pointer */
584 struct snd_pcm_runtime *runtime = substream->runtime;
586 snd_aw2_saa7146_get_hw_ptr_playback(&chip->saa7146,
587 pcm_device->stream_number,
589 runtime->buffer_size);
591 return bytes_to_frames(substream->runtime, current_ptr);
594 /* capture pointer callback */
595 static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream
598 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
599 struct aw2 *chip = pcm_device->chip;
600 unsigned int current_ptr;
602 /* get the current hardware pointer */
603 struct snd_pcm_runtime *runtime = substream->runtime;
605 snd_aw2_saa7146_get_hw_ptr_capture(&chip->saa7146,
606 pcm_device->stream_number,
608 runtime->buffer_size);
610 return bytes_to_frames(substream->runtime, current_ptr);
613 /* create a pcm device */
614 static int __devinit snd_aw2_new_pcm(struct aw2 *chip)
616 struct snd_pcm *pcm_playback_ana;
617 struct snd_pcm *pcm_playback_num;
618 struct snd_pcm *pcm_capture;
619 struct aw2_pcm_device *pcm_device;
622 /* Create new Alsa PCM device */
624 err = snd_pcm_new(chip->card, "Audiowerk2 analog playback", 0, 1, 0,
627 printk(KERN_ERR "aw2: snd_pcm_new error (0x%X)\n", err);
632 pcm_device = &chip->device_playback[NUM_STREAM_PLAYBACK_ANA];
634 /* Set PCM device name */
635 strcpy(pcm_playback_ana->name, "Analog playback");
636 /* Associate private data to PCM device */
637 pcm_playback_ana->private_data = pcm_device;
638 /* set operators of PCM device */
639 snd_pcm_set_ops(pcm_playback_ana, SNDRV_PCM_STREAM_PLAYBACK,
640 &snd_aw2_playback_ops);
641 /* store PCM device */
642 pcm_device->pcm = pcm_playback_ana;
643 /* give base chip pointer to our internal pcm device
645 pcm_device->chip = chip;
646 /* Give stream number to PCM device */
647 pcm_device->stream_number = NUM_STREAM_PLAYBACK_ANA;
649 /* pre-allocation of buffers */
650 /* Preallocate continuous pages. */
651 err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana,
655 64 * 1024, 64 * 1024);
657 printk(KERN_ERR "aw2: snd_pcm_lib_preallocate_pages_for_all "
658 "error (0x%X)\n", err);
660 err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0,
664 printk(KERN_ERR "aw2: snd_pcm_new error (0x%X)\n", err);
668 pcm_device = &chip->device_playback[NUM_STREAM_PLAYBACK_DIG];
670 /* Set PCM device name */
671 strcpy(pcm_playback_num->name, "Digital playback");
672 /* Associate private data to PCM device */
673 pcm_playback_num->private_data = pcm_device;
674 /* set operators of PCM device */
675 snd_pcm_set_ops(pcm_playback_num, SNDRV_PCM_STREAM_PLAYBACK,
676 &snd_aw2_playback_ops);
677 /* store PCM device */
678 pcm_device->pcm = pcm_playback_num;
679 /* give base chip pointer to our internal pcm device
681 pcm_device->chip = chip;
682 /* Give stream number to PCM device */
683 pcm_device->stream_number = NUM_STREAM_PLAYBACK_DIG;
685 /* pre-allocation of buffers */
686 /* Preallocate continuous pages. */
687 err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num,
691 64 * 1024, 64 * 1024);
694 "aw2: snd_pcm_lib_preallocate_pages_for_all error "
699 err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1,
703 printk(KERN_ERR "aw2: snd_pcm_new error (0x%X)\n", err);
708 pcm_device = &chip->device_capture[NUM_STREAM_CAPTURE_ANA];
710 /* Set PCM device name */
711 strcpy(pcm_capture->name, "Capture");
712 /* Associate private data to PCM device */
713 pcm_capture->private_data = pcm_device;
714 /* set operators of PCM device */
715 snd_pcm_set_ops(pcm_capture, SNDRV_PCM_STREAM_CAPTURE,
716 &snd_aw2_capture_ops);
717 /* store PCM device */
718 pcm_device->pcm = pcm_capture;
719 /* give base chip pointer to our internal pcm device
721 pcm_device->chip = chip;
722 /* Give stream number to PCM device */
723 pcm_device->stream_number = NUM_STREAM_CAPTURE_ANA;
725 /* pre-allocation of buffers */
726 /* Preallocate continuous pages. */
727 err = snd_pcm_lib_preallocate_pages_for_all(pcm_capture,
731 64 * 1024, 64 * 1024);
734 "aw2: snd_pcm_lib_preallocate_pages_for_all error "
739 err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip));
741 printk(KERN_ERR "aw2: snd_ctl_add error (0x%X)\n", err);
748 static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol,
749 struct snd_ctl_elem_info *uinfo)
751 static char *texts[2] = {
754 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
756 uinfo->value.enumerated.items = 2;
757 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) {
758 uinfo->value.enumerated.item =
759 uinfo->value.enumerated.items - 1;
761 strcpy(uinfo->value.enumerated.name,
762 texts[uinfo->value.enumerated.item]);
766 static int snd_aw2_control_switch_capture_get(struct snd_kcontrol *kcontrol,
767 struct snd_ctl_elem_value
770 struct aw2 *chip = snd_kcontrol_chip(kcontrol);
771 if (snd_aw2_saa7146_is_using_digital_input(&chip->saa7146))
772 ucontrol->value.enumerated.item[0] = CTL_ROUTE_DIGITAL;
774 ucontrol->value.enumerated.item[0] = CTL_ROUTE_ANALOG;
778 static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol,
779 struct snd_ctl_elem_value
782 struct aw2 *chip = snd_kcontrol_chip(kcontrol);
785 snd_aw2_saa7146_is_using_digital_input(&chip->saa7146);
787 if (((ucontrol->value.integer.value[0] == CTL_ROUTE_DIGITAL)
789 || ((ucontrol->value.integer.value[0] == CTL_ROUTE_ANALOG)
791 snd_aw2_saa7146_use_digital_input(&chip->saa7146, !is_disgital);