1 // SPDX-License-Identifier: GPL-2.0-only 2 /***************************************************************************** 3 * 4 * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and 5 * Jean-Christian Hassler <jhassler@free.fr> 6 * 7 * This file is part of the Audiowerk2 ALSA driver 8 * 9 *****************************************************************************/ 10 #include <linux/init.h> 11 #include <linux/pci.h> 12 #include <linux/dma-mapping.h> 13 #include <linux/slab.h> 14 #include <linux/interrupt.h> 15 #include <linux/delay.h> 16 #include <linux/io.h> 17 #include <linux/module.h> 18 #include <sound/core.h> 19 #include <sound/initval.h> 20 #include <sound/pcm.h> 21 #include <sound/pcm_params.h> 22 #include <sound/control.h> 23 24 #include "saa7146.h" 25 #include "aw2-saa7146.h" 26 27 MODULE_AUTHOR("Cedric Bregardis <cedric.bregardis@free.fr>, " 28 "Jean-Christian Hassler <jhassler@free.fr>"); 29 MODULE_DESCRIPTION("Emagic Audiowerk 2 sound driver"); 30 MODULE_LICENSE("GPL"); 31 32 /********************************* 33 * DEFINES 34 ********************************/ 35 #define CTL_ROUTE_ANALOG 0 36 #define CTL_ROUTE_DIGITAL 1 37 38 /********************************* 39 * TYPEDEFS 40 ********************************/ 41 /* hardware definition */ 42 static const struct snd_pcm_hardware snd_aw2_playback_hw = { 43 .info = (SNDRV_PCM_INFO_MMAP | 44 SNDRV_PCM_INFO_INTERLEAVED | 45 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), 46 .formats = SNDRV_PCM_FMTBIT_S16_LE, 47 .rates = SNDRV_PCM_RATE_44100, 48 .rate_min = 44100, 49 .rate_max = 44100, 50 .channels_min = 2, 51 .channels_max = 4, 52 .buffer_bytes_max = 32768, 53 .period_bytes_min = 4096, 54 .period_bytes_max = 32768, 55 .periods_min = 1, 56 .periods_max = 1024, 57 }; 58 59 static const struct snd_pcm_hardware snd_aw2_capture_hw = { 60 .info = (SNDRV_PCM_INFO_MMAP | 61 SNDRV_PCM_INFO_INTERLEAVED | 62 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), 63 .formats = SNDRV_PCM_FMTBIT_S16_LE, 64 .rates = SNDRV_PCM_RATE_44100, 65 .rate_min = 44100, 66 .rate_max = 44100, 67 .channels_min = 2, 68 .channels_max = 2, 69 .buffer_bytes_max = 32768, 70 .period_bytes_min = 4096, 71 .period_bytes_max = 32768, 72 .periods_min = 1, 73 .periods_max = 1024, 74 }; 75 76 struct aw2_pcm_device { 77 struct snd_pcm *pcm; 78 unsigned int stream_number; 79 struct aw2 *chip; 80 }; 81 82 struct aw2 { 83 struct snd_aw2_saa7146 saa7146; 84 85 struct pci_dev *pci; 86 int irq; 87 spinlock_t reg_lock; 88 struct mutex mtx; 89 90 unsigned long iobase_phys; 91 void __iomem *iobase_virt; 92 93 struct snd_card *card; 94 95 struct aw2_pcm_device device_playback[NB_STREAM_PLAYBACK]; 96 struct aw2_pcm_device device_capture[NB_STREAM_CAPTURE]; 97 }; 98 99 /********************************* 100 * FUNCTION DECLARATIONS 101 ********************************/ 102 static int snd_aw2_create(struct snd_card *card, struct pci_dev *pci); 103 static int snd_aw2_probe(struct pci_dev *pci, 104 const struct pci_device_id *pci_id); 105 static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream); 106 static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream); 107 static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream); 108 static int snd_aw2_pcm_capture_close(struct snd_pcm_substream *substream); 109 static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream); 110 static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream); 111 static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream, 112 int cmd); 113 static int snd_aw2_pcm_trigger_capture(struct snd_pcm_substream *substream, 114 int cmd); 115 static snd_pcm_uframes_t snd_aw2_pcm_pointer_playback(struct snd_pcm_substream 116 *substream); 117 static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream 118 *substream); 119 static int snd_aw2_new_pcm(struct aw2 *chip); 120 121 static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol, 122 struct snd_ctl_elem_info *uinfo); 123 static int snd_aw2_control_switch_capture_get(struct snd_kcontrol *kcontrol, 124 struct snd_ctl_elem_value 125 *ucontrol); 126 static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol, 127 struct snd_ctl_elem_value 128 *ucontrol); 129 130 /********************************* 131 * VARIABLES 132 ********************************/ 133 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 134 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 135 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 136 137 module_param_array(index, int, NULL, 0444); 138 MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard."); 139 module_param_array(id, charp, NULL, 0444); 140 MODULE_PARM_DESC(id, "ID string for the Audiowerk2 soundcard."); 141 module_param_array(enable, bool, NULL, 0444); 142 MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); 143 144 static const struct pci_device_id snd_aw2_ids[] = { 145 {PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, 0, 0, 146 0, 0, 0}, 147 {0} 148 }; 149 150 MODULE_DEVICE_TABLE(pci, snd_aw2_ids); 151 152 /* pci_driver definition */ 153 static struct pci_driver aw2_driver = { 154 .name = KBUILD_MODNAME, 155 .id_table = snd_aw2_ids, 156 .probe = snd_aw2_probe, 157 }; 158 159 module_pci_driver(aw2_driver); 160 161 /* operators for playback PCM alsa interface */ 162 static const struct snd_pcm_ops snd_aw2_playback_ops = { 163 .open = snd_aw2_pcm_playback_open, 164 .close = snd_aw2_pcm_playback_close, 165 .prepare = snd_aw2_pcm_prepare_playback, 166 .trigger = snd_aw2_pcm_trigger_playback, 167 .pointer = snd_aw2_pcm_pointer_playback, 168 }; 169 170 /* operators for capture PCM alsa interface */ 171 static const struct snd_pcm_ops snd_aw2_capture_ops = { 172 .open = snd_aw2_pcm_capture_open, 173 .close = snd_aw2_pcm_capture_close, 174 .prepare = snd_aw2_pcm_prepare_capture, 175 .trigger = snd_aw2_pcm_trigger_capture, 176 .pointer = snd_aw2_pcm_pointer_capture, 177 }; 178 179 static const struct snd_kcontrol_new aw2_control = { 180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 181 .name = "PCM Capture Route", 182 .index = 0, 183 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 184 .private_value = 0xffff, 185 .info = snd_aw2_control_switch_capture_info, 186 .get = snd_aw2_control_switch_capture_get, 187 .put = snd_aw2_control_switch_capture_put 188 }; 189 190 /********************************* 191 * FUNCTION IMPLEMENTATIONS 192 ********************************/ 193 194 /* component-destructor */ 195 static void snd_aw2_free(struct snd_card *card) 196 { 197 struct aw2 *chip = card->private_data; 198 199 /* Free hardware */ 200 snd_aw2_saa7146_free(&chip->saa7146); 201 } 202 203 /* chip-specific constructor */ 204 static int snd_aw2_create(struct snd_card *card, 205 struct pci_dev *pci) 206 { 207 struct aw2 *chip = card->private_data; 208 int err; 209 210 /* initialize the PCI entry */ 211 err = pcim_enable_device(pci); 212 if (err < 0) 213 return err; 214 pci_set_master(pci); 215 216 /* check PCI availability (32bit DMA) */ 217 if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) { 218 dev_err(card->dev, "Impossible to set 32bit mask DMA\n"); 219 return -ENXIO; 220 } 221 222 /* initialize the stuff */ 223 chip->card = card; 224 chip->pci = pci; 225 chip->irq = -1; 226 227 /* (1) PCI resource allocation */ 228 err = pcim_iomap_regions(pci, 1 << 0, "Audiowerk2"); 229 if (err < 0) 230 return err; 231 chip->iobase_phys = pci_resource_start(pci, 0); 232 chip->iobase_virt = pcim_iomap_table(pci)[0]; 233 234 /* (2) initialization of the chip hardware */ 235 snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt); 236 237 if (devm_request_irq(&pci->dev, pci->irq, snd_aw2_saa7146_interrupt, 238 IRQF_SHARED, KBUILD_MODNAME, chip)) { 239 dev_err(card->dev, "Cannot grab irq %d\n", pci->irq); 240 return -EBUSY; 241 } 242 chip->irq = pci->irq; 243 card->sync_irq = chip->irq; 244 card->private_free = snd_aw2_free; 245 246 dev_info(card->dev, 247 "Audiowerk 2 sound card (saa7146 chipset) detected and managed\n"); 248 return 0; 249 } 250 251 /* constructor */ 252 static int snd_aw2_probe(struct pci_dev *pci, 253 const struct pci_device_id *pci_id) 254 { 255 static int dev; 256 struct snd_card *card; 257 struct aw2 *chip; 258 int err; 259 260 /* (1) Continue if device is not enabled, else inc dev */ 261 if (dev >= SNDRV_CARDS) 262 return -ENODEV; 263 if (!enable[dev]) { 264 dev++; 265 return -ENOENT; 266 } 267 268 /* (2) Create card instance */ 269 err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 270 sizeof(*chip), &card); 271 if (err < 0) 272 return err; 273 chip = card->private_data; 274 275 /* (3) Create main component */ 276 err = snd_aw2_create(card, pci); 277 if (err < 0) 278 return err; 279 280 /* initialize mutex */ 281 mutex_init(&chip->mtx); 282 /* init spinlock */ 283 spin_lock_init(&chip->reg_lock); 284 /* (4) Define driver ID and name string */ 285 strcpy(card->driver, "aw2"); 286 strcpy(card->shortname, "Audiowerk2"); 287 288 sprintf(card->longname, "%s with SAA7146 irq %i", 289 card->shortname, chip->irq); 290 291 /* (5) Create other components */ 292 snd_aw2_new_pcm(chip); 293 294 /* (6) Register card instance */ 295 err = snd_card_register(card); 296 if (err < 0) 297 return err; 298 299 /* (7) Set PCI driver data */ 300 pci_set_drvdata(pci, card); 301 302 dev++; 303 return 0; 304 } 305 306 /* open callback */ 307 static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream) 308 { 309 struct snd_pcm_runtime *runtime = substream->runtime; 310 311 dev_dbg(substream->pcm->card->dev, "Playback_open\n"); 312 runtime->hw = snd_aw2_playback_hw; 313 return 0; 314 } 315 316 /* close callback */ 317 static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream) 318 { 319 return 0; 320 321 } 322 323 static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream) 324 { 325 struct snd_pcm_runtime *runtime = substream->runtime; 326 327 dev_dbg(substream->pcm->card->dev, "Capture_open\n"); 328 runtime->hw = snd_aw2_capture_hw; 329 return 0; 330 } 331 332 /* close callback */ 333 static int snd_aw2_pcm_capture_close(struct snd_pcm_substream *substream) 334 { 335 /* TODO: something to do ? */ 336 return 0; 337 } 338 339 /* prepare callback for playback */ 340 static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream) 341 { 342 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream); 343 struct aw2 *chip = pcm_device->chip; 344 struct snd_pcm_runtime *runtime = substream->runtime; 345 unsigned long period_size, buffer_size; 346 347 mutex_lock(&chip->mtx); 348 349 period_size = snd_pcm_lib_period_bytes(substream); 350 buffer_size = snd_pcm_lib_buffer_bytes(substream); 351 352 snd_aw2_saa7146_pcm_init_playback(&chip->saa7146, 353 pcm_device->stream_number, 354 runtime->dma_addr, period_size, 355 buffer_size); 356 357 /* Define Interrupt callback */ 358 snd_aw2_saa7146_define_it_playback_callback(pcm_device->stream_number, 359 (snd_aw2_saa7146_it_cb) 360 snd_pcm_period_elapsed, 361 (void *)substream); 362 363 mutex_unlock(&chip->mtx); 364 365 return 0; 366 } 367 368 /* prepare callback for capture */ 369 static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream) 370 { 371 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream); 372 struct aw2 *chip = pcm_device->chip; 373 struct snd_pcm_runtime *runtime = substream->runtime; 374 unsigned long period_size, buffer_size; 375 376 mutex_lock(&chip->mtx); 377 378 period_size = snd_pcm_lib_period_bytes(substream); 379 buffer_size = snd_pcm_lib_buffer_bytes(substream); 380 381 snd_aw2_saa7146_pcm_init_capture(&chip->saa7146, 382 pcm_device->stream_number, 383 runtime->dma_addr, period_size, 384 buffer_size); 385 386 /* Define Interrupt callback */ 387 snd_aw2_saa7146_define_it_capture_callback(pcm_device->stream_number, 388 (snd_aw2_saa7146_it_cb) 389 snd_pcm_period_elapsed, 390 (void *)substream); 391 392 mutex_unlock(&chip->mtx); 393 394 return 0; 395 } 396 397 /* playback trigger callback */ 398 static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream, 399 int cmd) 400 { 401 int status = 0; 402 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream); 403 struct aw2 *chip = pcm_device->chip; 404 spin_lock(&chip->reg_lock); 405 switch (cmd) { 406 case SNDRV_PCM_TRIGGER_START: 407 snd_aw2_saa7146_pcm_trigger_start_playback(&chip->saa7146, 408 pcm_device-> 409 stream_number); 410 break; 411 case SNDRV_PCM_TRIGGER_STOP: 412 snd_aw2_saa7146_pcm_trigger_stop_playback(&chip->saa7146, 413 pcm_device-> 414 stream_number); 415 break; 416 default: 417 status = -EINVAL; 418 } 419 spin_unlock(&chip->reg_lock); 420 return status; 421 } 422 423 /* capture trigger callback */ 424 static int snd_aw2_pcm_trigger_capture(struct snd_pcm_substream *substream, 425 int cmd) 426 { 427 int status = 0; 428 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream); 429 struct aw2 *chip = pcm_device->chip; 430 spin_lock(&chip->reg_lock); 431 switch (cmd) { 432 case SNDRV_PCM_TRIGGER_START: 433 snd_aw2_saa7146_pcm_trigger_start_capture(&chip->saa7146, 434 pcm_device-> 435 stream_number); 436 break; 437 case SNDRV_PCM_TRIGGER_STOP: 438 snd_aw2_saa7146_pcm_trigger_stop_capture(&chip->saa7146, 439 pcm_device-> 440 stream_number); 441 break; 442 default: 443 status = -EINVAL; 444 } 445 spin_unlock(&chip->reg_lock); 446 return status; 447 } 448 449 /* playback pointer callback */ 450 static snd_pcm_uframes_t snd_aw2_pcm_pointer_playback(struct snd_pcm_substream 451 *substream) 452 { 453 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream); 454 struct aw2 *chip = pcm_device->chip; 455 unsigned int current_ptr; 456 457 /* get the current hardware pointer */ 458 struct snd_pcm_runtime *runtime = substream->runtime; 459 current_ptr = 460 snd_aw2_saa7146_get_hw_ptr_playback(&chip->saa7146, 461 pcm_device->stream_number, 462 runtime->dma_area, 463 runtime->buffer_size); 464 465 return bytes_to_frames(substream->runtime, current_ptr); 466 } 467 468 /* capture pointer callback */ 469 static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream 470 *substream) 471 { 472 struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream); 473 struct aw2 *chip = pcm_device->chip; 474 unsigned int current_ptr; 475 476 /* get the current hardware pointer */ 477 struct snd_pcm_runtime *runtime = substream->runtime; 478 current_ptr = 479 snd_aw2_saa7146_get_hw_ptr_capture(&chip->saa7146, 480 pcm_device->stream_number, 481 runtime->dma_area, 482 runtime->buffer_size); 483 484 return bytes_to_frames(substream->runtime, current_ptr); 485 } 486 487 /* create a pcm device */ 488 static int snd_aw2_new_pcm(struct aw2 *chip) 489 { 490 struct snd_pcm *pcm_playback_ana; 491 struct snd_pcm *pcm_playback_num; 492 struct snd_pcm *pcm_capture; 493 struct aw2_pcm_device *pcm_device; 494 int err = 0; 495 496 /* Create new Alsa PCM device */ 497 498 err = snd_pcm_new(chip->card, "Audiowerk2 analog playback", 0, 1, 0, 499 &pcm_playback_ana); 500 if (err < 0) { 501 dev_err(chip->card->dev, "snd_pcm_new error (0x%X)\n", err); 502 return err; 503 } 504 505 /* Creation ok */ 506 pcm_device = &chip->device_playback[NUM_STREAM_PLAYBACK_ANA]; 507 508 /* Set PCM device name */ 509 strcpy(pcm_playback_ana->name, "Analog playback"); 510 /* Associate private data to PCM device */ 511 pcm_playback_ana->private_data = pcm_device; 512 /* set operators of PCM device */ 513 snd_pcm_set_ops(pcm_playback_ana, SNDRV_PCM_STREAM_PLAYBACK, 514 &snd_aw2_playback_ops); 515 /* store PCM device */ 516 pcm_device->pcm = pcm_playback_ana; 517 /* give base chip pointer to our internal pcm device 518 structure */ 519 pcm_device->chip = chip; 520 /* Give stream number to PCM device */ 521 pcm_device->stream_number = NUM_STREAM_PLAYBACK_ANA; 522 523 /* pre-allocation of buffers */ 524 /* Preallocate continuous pages. */ 525 snd_pcm_set_managed_buffer_all(pcm_playback_ana, 526 SNDRV_DMA_TYPE_DEV, 527 &chip->pci->dev, 528 64 * 1024, 64 * 1024); 529 530 err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0, 531 &pcm_playback_num); 532 533 if (err < 0) { 534 dev_err(chip->card->dev, "snd_pcm_new error (0x%X)\n", err); 535 return err; 536 } 537 /* Creation ok */ 538 pcm_device = &chip->device_playback[NUM_STREAM_PLAYBACK_DIG]; 539 540 /* Set PCM device name */ 541 strcpy(pcm_playback_num->name, "Digital playback"); 542 /* Associate private data to PCM device */ 543 pcm_playback_num->private_data = pcm_device; 544 /* set operators of PCM device */ 545 snd_pcm_set_ops(pcm_playback_num, SNDRV_PCM_STREAM_PLAYBACK, 546 &snd_aw2_playback_ops); 547 /* store PCM device */ 548 pcm_device->pcm = pcm_playback_num; 549 /* give base chip pointer to our internal pcm device 550 structure */ 551 pcm_device->chip = chip; 552 /* Give stream number to PCM device */ 553 pcm_device->stream_number = NUM_STREAM_PLAYBACK_DIG; 554 555 /* pre-allocation of buffers */ 556 /* Preallocate continuous pages. */ 557 snd_pcm_set_managed_buffer_all(pcm_playback_num, 558 SNDRV_DMA_TYPE_DEV, 559 &chip->pci->dev, 560 64 * 1024, 64 * 1024); 561 562 err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1, 563 &pcm_capture); 564 565 if (err < 0) { 566 dev_err(chip->card->dev, "snd_pcm_new error (0x%X)\n", err); 567 return err; 568 } 569 570 /* Creation ok */ 571 pcm_device = &chip->device_capture[NUM_STREAM_CAPTURE_ANA]; 572 573 /* Set PCM device name */ 574 strcpy(pcm_capture->name, "Capture"); 575 /* Associate private data to PCM device */ 576 pcm_capture->private_data = pcm_device; 577 /* set operators of PCM device */ 578 snd_pcm_set_ops(pcm_capture, SNDRV_PCM_STREAM_CAPTURE, 579 &snd_aw2_capture_ops); 580 /* store PCM device */ 581 pcm_device->pcm = pcm_capture; 582 /* give base chip pointer to our internal pcm device 583 structure */ 584 pcm_device->chip = chip; 585 /* Give stream number to PCM device */ 586 pcm_device->stream_number = NUM_STREAM_CAPTURE_ANA; 587 588 /* pre-allocation of buffers */ 589 /* Preallocate continuous pages. */ 590 snd_pcm_set_managed_buffer_all(pcm_capture, 591 SNDRV_DMA_TYPE_DEV, 592 &chip->pci->dev, 593 64 * 1024, 64 * 1024); 594 595 /* Create control */ 596 err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip)); 597 if (err < 0) { 598 dev_err(chip->card->dev, "snd_ctl_add error (0x%X)\n", err); 599 return err; 600 } 601 602 return 0; 603 } 604 605 static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol, 606 struct snd_ctl_elem_info *uinfo) 607 { 608 static const char * const texts[2] = { 609 "Analog", "Digital" 610 }; 611 return snd_ctl_enum_info(uinfo, 1, 2, texts); 612 } 613 614 static int snd_aw2_control_switch_capture_get(struct snd_kcontrol *kcontrol, 615 struct snd_ctl_elem_value 616 *ucontrol) 617 { 618 struct aw2 *chip = snd_kcontrol_chip(kcontrol); 619 if (snd_aw2_saa7146_is_using_digital_input(&chip->saa7146)) 620 ucontrol->value.enumerated.item[0] = CTL_ROUTE_DIGITAL; 621 else 622 ucontrol->value.enumerated.item[0] = CTL_ROUTE_ANALOG; 623 return 0; 624 } 625 626 static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol, 627 struct snd_ctl_elem_value 628 *ucontrol) 629 { 630 struct aw2 *chip = snd_kcontrol_chip(kcontrol); 631 int changed = 0; 632 int is_disgital = 633 snd_aw2_saa7146_is_using_digital_input(&chip->saa7146); 634 635 if (((ucontrol->value.integer.value[0] == CTL_ROUTE_DIGITAL) 636 && !is_disgital) 637 || ((ucontrol->value.integer.value[0] == CTL_ROUTE_ANALOG) 638 && is_disgital)) { 639 snd_aw2_saa7146_use_digital_input(&chip->saa7146, !is_disgital); 640 changed = 1; 641 } 642 return changed; 643 } 644