aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ca0106/ca0106_main.c4
-rw-r--r--sound/pci/ctxfi/ctamixer.c14
-rw-r--r--sound/pci/ctxfi/ctdaio.c4
-rw-r--r--sound/pci/ctxfi/ctsrc.c7
-rw-r--r--sound/pci/emu10k1/p16v.c2
-rw-r--r--sound/pci/hda/hda_beep.c11
-rw-r--r--sound/pci/hda/hda_codec.c8
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_eld.c4
-rw-r--r--sound/pci/hda/hda_intel.c137
-rw-r--r--sound/pci/hda/patch_analog.c2
-rw-r--r--sound/pci/hda/patch_realtek.c63
-rw-r--r--sound/pci/hda/patch_sigmatel.c24
-rw-r--r--sound/pci/hda/patch_via.c89
-rw-r--r--sound/pci/riptide/riptide.c7
15 files changed, 238 insertions, 140 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index f24bf1ecb36d..15e4138bce17 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -325,9 +325,9 @@ static struct snd_pcm_hardware snd_ca0106_capture_hw = {
325 .rate_max = 192000, 325 .rate_max = 192000,
326 .channels_min = 2, 326 .channels_min = 2,
327 .channels_max = 2, 327 .channels_max = 2,
328 .buffer_bytes_max = ((65536 - 64) * 8), 328 .buffer_bytes_max = 65536 - 128,
329 .period_bytes_min = 64, 329 .period_bytes_min = 64,
330 .period_bytes_max = (65536 - 64), 330 .period_bytes_max = 32768 - 64,
331 .periods_min = 2, 331 .periods_min = 2,
332 .periods_max = 2, 332 .periods_max = 2,
333 .fifo_size = 0, 333 .fifo_size = 0,
diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c
index a1db51b3ead8..a7f4a671f7b7 100644
--- a/sound/pci/ctxfi/ctamixer.c
+++ b/sound/pci/ctxfi/ctamixer.c
@@ -242,13 +242,12 @@ static int get_amixer_rsc(struct amixer_mgr *mgr,
242 242
243 /* Allocate mem for amixer resource */ 243 /* Allocate mem for amixer resource */
244 amixer = kzalloc(sizeof(*amixer), GFP_KERNEL); 244 amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
245 if (NULL == amixer) { 245 if (!amixer)
246 err = -ENOMEM; 246 return -ENOMEM;
247 return err;
248 }
249 247
250 /* Check whether there are sufficient 248 /* Check whether there are sufficient
251 * amixer resources to meet request. */ 249 * amixer resources to meet request. */
250 err = 0;
252 spin_lock_irqsave(&mgr->mgr_lock, flags); 251 spin_lock_irqsave(&mgr->mgr_lock, flags);
253 for (i = 0; i < desc->msr; i++) { 252 for (i = 0; i < desc->msr; i++) {
254 err = mgr_get_resource(&mgr->mgr, 1, &idx); 253 err = mgr_get_resource(&mgr->mgr, 1, &idx);
@@ -397,12 +396,11 @@ static int get_sum_rsc(struct sum_mgr *mgr,
397 396
398 /* Allocate mem for sum resource */ 397 /* Allocate mem for sum resource */
399 sum = kzalloc(sizeof(*sum), GFP_KERNEL); 398 sum = kzalloc(sizeof(*sum), GFP_KERNEL);
400 if (NULL == sum) { 399 if (!sum)
401 err = -ENOMEM; 400 return -ENOMEM;
402 return err;
403 }
404 401
405 /* Check whether there are sufficient sum resources to meet request. */ 402 /* Check whether there are sufficient sum resources to meet request. */
403 err = 0;
406 spin_lock_irqsave(&mgr->mgr_lock, flags); 404 spin_lock_irqsave(&mgr->mgr_lock, flags);
407 for (i = 0; i < desc->msr; i++) { 405 for (i = 0; i < desc->msr; i++) {
408 err = mgr_get_resource(&mgr->mgr, 1, &idx); 406 err = mgr_get_resource(&mgr->mgr, 1, &idx);
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c
index 082e35c08c02..deb6cfa73600 100644
--- a/sound/pci/ctxfi/ctdaio.c
+++ b/sound/pci/ctxfi/ctdaio.c
@@ -57,9 +57,9 @@ struct daio_rsc_idx idx_20k1[NUM_DAIOTYP] = {
57 57
58struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { 58struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = {
59 [LINEO1] = {.left = 0x40, .right = 0x41}, 59 [LINEO1] = {.left = 0x40, .right = 0x41},
60 [LINEO2] = {.left = 0x70, .right = 0x71}, 60 [LINEO2] = {.left = 0x60, .right = 0x61},
61 [LINEO3] = {.left = 0x50, .right = 0x51}, 61 [LINEO3] = {.left = 0x50, .right = 0x51},
62 [LINEO4] = {.left = 0x60, .right = 0x61}, 62 [LINEO4] = {.left = 0x70, .right = 0x71},
63 [LINEIM] = {.left = 0x45, .right = 0xc5}, 63 [LINEIM] = {.left = 0x45, .right = 0xc5},
64 [SPDIFOO] = {.left = 0x00, .right = 0x01}, 64 [SPDIFOO] = {.left = 0x00, .right = 0x01},
65 [SPDIFIO] = {.left = 0x05, .right = 0x85}, 65 [SPDIFIO] = {.left = 0x05, .right = 0x85},
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index e1c145d8b702..df43a5cd3938 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -724,12 +724,11 @@ static int get_srcimp_rsc(struct srcimp_mgr *mgr,
724 724
725 /* Allocate mem for SRCIMP resource */ 725 /* Allocate mem for SRCIMP resource */
726 srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL); 726 srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL);
727 if (NULL == srcimp) { 727 if (!srcimp)
728 err = -ENOMEM; 728 return -ENOMEM;
729 return err;
730 }
731 729
732 /* Check whether there are sufficient SRCIMP resources. */ 730 /* Check whether there are sufficient SRCIMP resources. */
731 err = 0;
733 spin_lock_irqsave(&mgr->mgr_lock, flags); 732 spin_lock_irqsave(&mgr->mgr_lock, flags);
734 for (i = 0; i < desc->msr; i++) { 733 for (i = 0; i < desc->msr; i++) {
735 err = mgr_get_resource(&mgr->mgr, 1, &idx); 734 err = mgr_get_resource(&mgr->mgr, 1, &idx);
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index e617acaf10e3..61b8ab39800f 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -644,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm *
644 int err; 644 int err;
645 int capture=1; 645 int capture=1;
646 646
647 /* snd_printk("KERN_DEBUG snd_p16v_pcm called. device=%d\n", device); */ 647 /* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d\n", device); */
648 emu->p16v_device_offset = device; 648 emu->p16v_device_offset = device;
649 if (rpcm) 649 if (rpcm)
650 *rpcm = NULL; 650 *rpcm = NULL;
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 29272f2e95a0..b0275a050870 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -50,19 +50,22 @@ static void snd_hda_generate_beep(struct work_struct *work)
50 * The tone frequency of beep generator on IDT/STAC codecs is 50 * The tone frequency of beep generator on IDT/STAC codecs is
51 * defined from the 8bit tone parameter, in Hz, 51 * defined from the 8bit tone parameter, in Hz,
52 * freq = 48000 * (257 - tone) / 1024 52 * freq = 48000 * (257 - tone) / 1024
53 * that is from 12kHz to 93.75kHz in step of 46.875 hz 53 * that is from 12kHz to 93.75Hz in steps of 46.875 Hz
54 */ 54 */
55static int beep_linear_tone(struct hda_beep *beep, int hz) 55static int beep_linear_tone(struct hda_beep *beep, int hz)
56{ 56{
57 if (hz <= 0)
58 return 0;
57 hz *= 1000; /* fixed point */ 59 hz *= 1000; /* fixed point */
58 hz = hz - DIGBEEP_HZ_MIN; 60 hz = hz - DIGBEEP_HZ_MIN
61 + DIGBEEP_HZ_STEP / 2; /* round to nearest step */
59 if (hz < 0) 62 if (hz < 0)
60 hz = 0; /* turn off PC beep*/ 63 hz = 0; /* turn off PC beep*/
61 else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) 64 else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN))
62 hz = 0xff; 65 hz = 1; /* max frequency */
63 else { 66 else {
64 hz /= DIGBEEP_HZ_STEP; 67 hz /= DIGBEEP_HZ_STEP;
65 hz++; 68 hz = 255 - hz;
66 } 69 }
67 return hz; 70 return hz;
68} 71}
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 26d255de6beb..c7df01b72cac 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -174,7 +174,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
174 mutex_lock(&bus->cmd_mutex); 174 mutex_lock(&bus->cmd_mutex);
175 err = bus->ops.command(bus, cmd); 175 err = bus->ops.command(bus, cmd);
176 if (!err && res) 176 if (!err && res)
177 *res = bus->ops.get_response(bus); 177 *res = bus->ops.get_response(bus, codec->addr);
178 mutex_unlock(&bus->cmd_mutex); 178 mutex_unlock(&bus->cmd_mutex);
179 snd_hda_power_down(codec); 179 snd_hda_power_down(codec);
180 if (res && *res == -1 && bus->rirb_error) { 180 if (res && *res == -1 && bus->rirb_error) {
@@ -332,6 +332,12 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
332 AC_VERB_GET_CONNECT_LIST, i); 332 AC_VERB_GET_CONNECT_LIST, i);
333 range_val = !!(parm & (1 << (shift-1))); /* ranges */ 333 range_val = !!(parm & (1 << (shift-1))); /* ranges */
334 val = parm & mask; 334 val = parm & mask;
335 if (val == 0) {
336 snd_printk(KERN_WARNING "hda_codec: "
337 "invalid CONNECT_LIST verb %x[%i]:%x\n",
338 nid, i, parm);
339 return 0;
340 }
335 parm >>= shift; 341 parm >>= shift;
336 if (range_val) { 342 if (range_val) {
337 /* ranges between the previous and this one */ 343 /* ranges between the previous and this one */
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index cad79efaabc9..1b75f28ed092 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -568,7 +568,7 @@ struct hda_bus_ops {
568 /* send a single command */ 568 /* send a single command */
569 int (*command)(struct hda_bus *bus, unsigned int cmd); 569 int (*command)(struct hda_bus *bus, unsigned int cmd);
570 /* get a response from the last command */ 570 /* get a response from the last command */
571 unsigned int (*get_response)(struct hda_bus *bus); 571 unsigned int (*get_response)(struct hda_bus *bus, unsigned int addr);
572 /* free the private data */ 572 /* free the private data */
573 void (*private_free)(struct hda_bus *); 573 void (*private_free)(struct hda_bus *);
574 /* attach a PCM stream */ 574 /* attach a PCM stream */
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index fcad5ec31773..9446a5abea13 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -508,7 +508,7 @@ static void hdmi_write_eld_info(struct snd_info_entry *entry,
508 char name[64]; 508 char name[64];
509 char *sname; 509 char *sname;
510 long long val; 510 long long val;
511 int n; 511 unsigned int n;
512 512
513 while (!snd_info_get_line(buffer, line, sizeof(line))) { 513 while (!snd_info_get_line(buffer, line, sizeof(line))) {
514 if (sscanf(line, "%s %llx", name, &val) != 2) 514 if (sscanf(line, "%s %llx", name, &val) != 2)
@@ -539,7 +539,7 @@ static void hdmi_write_eld_info(struct snd_info_entry *entry,
539 sname++; 539 sname++;
540 n = 10 * n + name[4] - '0'; 540 n = 10 * n + name[4] - '0';
541 } 541 }
542 if (n < 0 || n > 31) /* double the CEA limit */ 542 if (n >= ELD_MAX_SAD)
543 continue; 543 continue;
544 if (!strcmp(sname, "_coding_type")) 544 if (!strcmp(sname, "_coding_type"))
545 e->sad[n].format = val; 545 e->sad[n].format = val;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1877d95d4aa6..175f07a381ba 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -253,7 +253,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
253 253
254/* STATESTS int mask: S3,SD2,SD1,SD0 */ 254/* STATESTS int mask: S3,SD2,SD1,SD0 */
255#define AZX_MAX_CODECS 4 255#define AZX_MAX_CODECS 4
256#define STATESTS_INT_MASK 0x0f 256#define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1)
257 257
258/* SD_CTL bits */ 258/* SD_CTL bits */
259#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ 259#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
@@ -361,8 +361,8 @@ struct azx_rb {
361 dma_addr_t addr; /* physical address of CORB/RIRB buffer */ 361 dma_addr_t addr; /* physical address of CORB/RIRB buffer */
362 /* for RIRB */ 362 /* for RIRB */
363 unsigned short rp, wp; /* read/write pointers */ 363 unsigned short rp, wp; /* read/write pointers */
364 int cmds; /* number of pending requests */ 364 int cmds[AZX_MAX_CODECS]; /* number of pending requests */
365 u32 res; /* last read value */ 365 u32 res[AZX_MAX_CODECS]; /* last read value */
366}; 366};
367 367
368struct azx { 368struct azx {
@@ -418,7 +418,7 @@ struct azx {
418 unsigned int probing :1; /* codec probing phase */ 418 unsigned int probing :1; /* codec probing phase */
419 419
420 /* for debugging */ 420 /* for debugging */
421 unsigned int last_cmd; /* last issued command (to sync) */ 421 unsigned int last_cmd[AZX_MAX_CODECS];
422 422
423 /* for pending irqs */ 423 /* for pending irqs */
424 struct work_struct irq_pending_work; 424 struct work_struct irq_pending_work;
@@ -513,6 +513,7 @@ static int azx_alloc_cmd_io(struct azx *chip)
513 513
514static void azx_init_cmd_io(struct azx *chip) 514static void azx_init_cmd_io(struct azx *chip)
515{ 515{
516 spin_lock_irq(&chip->reg_lock);
516 /* CORB set up */ 517 /* CORB set up */
517 chip->corb.addr = chip->rb.addr; 518 chip->corb.addr = chip->rb.addr;
518 chip->corb.buf = (u32 *)chip->rb.area; 519 chip->corb.buf = (u32 *)chip->rb.area;
@@ -531,7 +532,8 @@ static void azx_init_cmd_io(struct azx *chip)
531 /* RIRB set up */ 532 /* RIRB set up */
532 chip->rirb.addr = chip->rb.addr + 2048; 533 chip->rirb.addr = chip->rb.addr + 2048;
533 chip->rirb.buf = (u32 *)(chip->rb.area + 2048); 534 chip->rirb.buf = (u32 *)(chip->rb.area + 2048);
534 chip->rirb.wp = chip->rirb.rp = chip->rirb.cmds = 0; 535 chip->rirb.wp = chip->rirb.rp = 0;
536 memset(chip->rirb.cmds, 0, sizeof(chip->rirb.cmds));
535 azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr); 537 azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr);
536 azx_writel(chip, RIRBUBASE, upper_32_bits(chip->rirb.addr)); 538 azx_writel(chip, RIRBUBASE, upper_32_bits(chip->rirb.addr));
537 539
@@ -543,30 +545,60 @@ static void azx_init_cmd_io(struct azx *chip)
543 azx_writew(chip, RINTCNT, 1); 545 azx_writew(chip, RINTCNT, 1);
544 /* enable rirb dma and response irq */ 546 /* enable rirb dma and response irq */
545 azx_writeb(chip, RIRBCTL, ICH6_RBCTL_DMA_EN | ICH6_RBCTL_IRQ_EN); 547 azx_writeb(chip, RIRBCTL, ICH6_RBCTL_DMA_EN | ICH6_RBCTL_IRQ_EN);
548 spin_unlock_irq(&chip->reg_lock);
546} 549}
547 550
548static void azx_free_cmd_io(struct azx *chip) 551static void azx_free_cmd_io(struct azx *chip)
549{ 552{
553 spin_lock_irq(&chip->reg_lock);
550 /* disable ringbuffer DMAs */ 554 /* disable ringbuffer DMAs */
551 azx_writeb(chip, RIRBCTL, 0); 555 azx_writeb(chip, RIRBCTL, 0);
552 azx_writeb(chip, CORBCTL, 0); 556 azx_writeb(chip, CORBCTL, 0);
557 spin_unlock_irq(&chip->reg_lock);
558}
559
560static unsigned int azx_command_addr(u32 cmd)
561{
562 unsigned int addr = cmd >> 28;
563
564 if (addr >= AZX_MAX_CODECS) {
565 snd_BUG();
566 addr = 0;
567 }
568
569 return addr;
570}
571
572static unsigned int azx_response_addr(u32 res)
573{
574 unsigned int addr = res & 0xf;
575
576 if (addr >= AZX_MAX_CODECS) {
577 snd_BUG();
578 addr = 0;
579 }
580
581 return addr;
553} 582}
554 583
555/* send a command */ 584/* send a command */
556static int azx_corb_send_cmd(struct hda_bus *bus, u32 val) 585static int azx_corb_send_cmd(struct hda_bus *bus, u32 val)
557{ 586{
558 struct azx *chip = bus->private_data; 587 struct azx *chip = bus->private_data;
588 unsigned int addr = azx_command_addr(val);
559 unsigned int wp; 589 unsigned int wp;
560 590
591 spin_lock_irq(&chip->reg_lock);
592
561 /* add command to corb */ 593 /* add command to corb */
562 wp = azx_readb(chip, CORBWP); 594 wp = azx_readb(chip, CORBWP);
563 wp++; 595 wp++;
564 wp %= ICH6_MAX_CORB_ENTRIES; 596 wp %= ICH6_MAX_CORB_ENTRIES;
565 597
566 spin_lock_irq(&chip->reg_lock); 598 chip->rirb.cmds[addr]++;
567 chip->rirb.cmds++;
568 chip->corb.buf[wp] = cpu_to_le32(val); 599 chip->corb.buf[wp] = cpu_to_le32(val);
569 azx_writel(chip, CORBWP, wp); 600 azx_writel(chip, CORBWP, wp);
601
570 spin_unlock_irq(&chip->reg_lock); 602 spin_unlock_irq(&chip->reg_lock);
571 603
572 return 0; 604 return 0;
@@ -578,13 +610,14 @@ static int azx_corb_send_cmd(struct hda_bus *bus, u32 val)
578static void azx_update_rirb(struct azx *chip) 610static void azx_update_rirb(struct azx *chip)
579{ 611{
580 unsigned int rp, wp; 612 unsigned int rp, wp;
613 unsigned int addr;
581 u32 res, res_ex; 614 u32 res, res_ex;
582 615
583 wp = azx_readb(chip, RIRBWP); 616 wp = azx_readb(chip, RIRBWP);
584 if (wp == chip->rirb.wp) 617 if (wp == chip->rirb.wp)
585 return; 618 return;
586 chip->rirb.wp = wp; 619 chip->rirb.wp = wp;
587 620
588 while (chip->rirb.rp != wp) { 621 while (chip->rirb.rp != wp) {
589 chip->rirb.rp++; 622 chip->rirb.rp++;
590 chip->rirb.rp %= ICH6_MAX_RIRB_ENTRIES; 623 chip->rirb.rp %= ICH6_MAX_RIRB_ENTRIES;
@@ -592,18 +625,24 @@ static void azx_update_rirb(struct azx *chip)
592 rp = chip->rirb.rp << 1; /* an RIRB entry is 8-bytes */ 625 rp = chip->rirb.rp << 1; /* an RIRB entry is 8-bytes */
593 res_ex = le32_to_cpu(chip->rirb.buf[rp + 1]); 626 res_ex = le32_to_cpu(chip->rirb.buf[rp + 1]);
594 res = le32_to_cpu(chip->rirb.buf[rp]); 627 res = le32_to_cpu(chip->rirb.buf[rp]);
628 addr = azx_response_addr(res_ex);
595 if (res_ex & ICH6_RIRB_EX_UNSOL_EV) 629 if (res_ex & ICH6_RIRB_EX_UNSOL_EV)
596 snd_hda_queue_unsol_event(chip->bus, res, res_ex); 630 snd_hda_queue_unsol_event(chip->bus, res, res_ex);
597 else if (chip->rirb.cmds) { 631 else if (chip->rirb.cmds[addr]) {
598 chip->rirb.res = res; 632 chip->rirb.res[addr] = res;
599 smp_wmb(); 633 smp_wmb();
600 chip->rirb.cmds--; 634 chip->rirb.cmds[addr]--;
601 } 635 } else
636 snd_printk(KERN_ERR SFX "spurious response %#x:%#x, "
637 "last cmd=%#08x\n",
638 res, res_ex,
639 chip->last_cmd[addr]);
602 } 640 }
603} 641}
604 642
605/* receive a response */ 643/* receive a response */
606static unsigned int azx_rirb_get_response(struct hda_bus *bus) 644static unsigned int azx_rirb_get_response(struct hda_bus *bus,
645 unsigned int addr)
607{ 646{
608 struct azx *chip = bus->private_data; 647 struct azx *chip = bus->private_data;
609 unsigned long timeout; 648 unsigned long timeout;
@@ -616,10 +655,10 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus)
616 azx_update_rirb(chip); 655 azx_update_rirb(chip);
617 spin_unlock_irq(&chip->reg_lock); 656 spin_unlock_irq(&chip->reg_lock);
618 } 657 }
619 if (!chip->rirb.cmds) { 658 if (!chip->rirb.cmds[addr]) {
620 smp_rmb(); 659 smp_rmb();
621 bus->rirb_error = 0; 660 bus->rirb_error = 0;
622 return chip->rirb.res; /* the last value */ 661 return chip->rirb.res[addr]; /* the last value */
623 } 662 }
624 if (time_after(jiffies, timeout)) 663 if (time_after(jiffies, timeout))
625 break; 664 break;
@@ -633,7 +672,8 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus)
633 672
634 if (chip->msi) { 673 if (chip->msi) {
635 snd_printk(KERN_WARNING SFX "No response from codec, " 674 snd_printk(KERN_WARNING SFX "No response from codec, "
636 "disabling MSI: last cmd=0x%08x\n", chip->last_cmd); 675 "disabling MSI: last cmd=0x%08x\n",
676 chip->last_cmd[addr]);
637 free_irq(chip->irq, chip); 677 free_irq(chip->irq, chip);
638 chip->irq = -1; 678 chip->irq = -1;
639 pci_disable_msi(chip->pci); 679 pci_disable_msi(chip->pci);
@@ -648,7 +688,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus)
648 if (!chip->polling_mode) { 688 if (!chip->polling_mode) {
649 snd_printk(KERN_WARNING SFX "azx_get_response timeout, " 689 snd_printk(KERN_WARNING SFX "azx_get_response timeout, "
650 "switching to polling mode: last cmd=0x%08x\n", 690 "switching to polling mode: last cmd=0x%08x\n",
651 chip->last_cmd); 691 chip->last_cmd[addr]);
652 chip->polling_mode = 1; 692 chip->polling_mode = 1;
653 goto again; 693 goto again;
654 } 694 }
@@ -672,7 +712,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus)
672 712
673 snd_printk(KERN_ERR "hda_intel: azx_get_response timeout, " 713 snd_printk(KERN_ERR "hda_intel: azx_get_response timeout, "
674 "switching to single_cmd mode: last cmd=0x%08x\n", 714 "switching to single_cmd mode: last cmd=0x%08x\n",
675 chip->last_cmd); 715 chip->last_cmd[addr]);
676 chip->single_cmd = 1; 716 chip->single_cmd = 1;
677 bus->response_reset = 0; 717 bus->response_reset = 0;
678 /* re-initialize CORB/RIRB */ 718 /* re-initialize CORB/RIRB */
@@ -692,7 +732,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus)
692 */ 732 */
693 733
694/* receive a response */ 734/* receive a response */
695static int azx_single_wait_for_response(struct azx *chip) 735static int azx_single_wait_for_response(struct azx *chip, unsigned int addr)
696{ 736{
697 int timeout = 50; 737 int timeout = 50;
698 738
@@ -700,7 +740,7 @@ static int azx_single_wait_for_response(struct azx *chip)
700 /* check IRV busy bit */ 740 /* check IRV busy bit */
701 if (azx_readw(chip, IRS) & ICH6_IRS_VALID) { 741 if (azx_readw(chip, IRS) & ICH6_IRS_VALID) {
702 /* reuse rirb.res as the response return value */ 742 /* reuse rirb.res as the response return value */
703 chip->rirb.res = azx_readl(chip, IR); 743 chip->rirb.res[addr] = azx_readl(chip, IR);
704 return 0; 744 return 0;
705 } 745 }
706 udelay(1); 746 udelay(1);
@@ -708,7 +748,7 @@ static int azx_single_wait_for_response(struct azx *chip)
708 if (printk_ratelimit()) 748 if (printk_ratelimit())
709 snd_printd(SFX "get_response timeout: IRS=0x%x\n", 749 snd_printd(SFX "get_response timeout: IRS=0x%x\n",
710 azx_readw(chip, IRS)); 750 azx_readw(chip, IRS));
711 chip->rirb.res = -1; 751 chip->rirb.res[addr] = -1;
712 return -EIO; 752 return -EIO;
713} 753}
714 754
@@ -716,6 +756,7 @@ static int azx_single_wait_for_response(struct azx *chip)
716static int azx_single_send_cmd(struct hda_bus *bus, u32 val) 756static int azx_single_send_cmd(struct hda_bus *bus, u32 val)
717{ 757{
718 struct azx *chip = bus->private_data; 758 struct azx *chip = bus->private_data;
759 unsigned int addr = azx_command_addr(val);
719 int timeout = 50; 760 int timeout = 50;
720 761
721 bus->rirb_error = 0; 762 bus->rirb_error = 0;
@@ -728,7 +769,7 @@ static int azx_single_send_cmd(struct hda_bus *bus, u32 val)
728 azx_writel(chip, IC, val); 769 azx_writel(chip, IC, val);
729 azx_writew(chip, IRS, azx_readw(chip, IRS) | 770 azx_writew(chip, IRS, azx_readw(chip, IRS) |
730 ICH6_IRS_BUSY); 771 ICH6_IRS_BUSY);
731 return azx_single_wait_for_response(chip); 772 return azx_single_wait_for_response(chip, addr);
732 } 773 }
733 udelay(1); 774 udelay(1);
734 } 775 }
@@ -739,10 +780,11 @@ static int azx_single_send_cmd(struct hda_bus *bus, u32 val)
739} 780}
740 781
741/* receive a response */ 782/* receive a response */
742static unsigned int azx_single_get_response(struct hda_bus *bus) 783static unsigned int azx_single_get_response(struct hda_bus *bus,
784 unsigned int addr)
743{ 785{
744 struct azx *chip = bus->private_data; 786 struct azx *chip = bus->private_data;
745 return chip->rirb.res; 787 return chip->rirb.res[addr];
746} 788}
747 789
748/* 790/*
@@ -757,7 +799,7 @@ static int azx_send_cmd(struct hda_bus *bus, unsigned int val)
757{ 799{
758 struct azx *chip = bus->private_data; 800 struct azx *chip = bus->private_data;
759 801
760 chip->last_cmd = val; 802 chip->last_cmd[azx_command_addr(val)] = val;
761 if (chip->single_cmd) 803 if (chip->single_cmd)
762 return azx_single_send_cmd(bus, val); 804 return azx_single_send_cmd(bus, val);
763 else 805 else
@@ -765,13 +807,14 @@ static int azx_send_cmd(struct hda_bus *bus, unsigned int val)
765} 807}
766 808
767/* get a response */ 809/* get a response */
768static unsigned int azx_get_response(struct hda_bus *bus) 810static unsigned int azx_get_response(struct hda_bus *bus,
811 unsigned int addr)
769{ 812{
770 struct azx *chip = bus->private_data; 813 struct azx *chip = bus->private_data;
771 if (chip->single_cmd) 814 if (chip->single_cmd)
772 return azx_single_get_response(bus); 815 return azx_single_get_response(bus, addr);
773 else 816 else
774 return azx_rirb_get_response(bus); 817 return azx_rirb_get_response(bus, addr);
775} 818}
776 819
777#ifdef CONFIG_SND_HDA_POWER_SAVE 820#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -1243,10 +1286,12 @@ static int probe_codec(struct azx *chip, int addr)
1243 (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; 1286 (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
1244 unsigned int res; 1287 unsigned int res;
1245 1288
1289 mutex_lock(&chip->bus->cmd_mutex);
1246 chip->probing = 1; 1290 chip->probing = 1;
1247 azx_send_cmd(chip->bus, cmd); 1291 azx_send_cmd(chip->bus, cmd);
1248 res = azx_get_response(chip->bus); 1292 res = azx_get_response(chip->bus, addr);
1249 chip->probing = 0; 1293 chip->probing = 0;
1294 mutex_unlock(&chip->bus->cmd_mutex);
1250 if (res == -1) 1295 if (res == -1)
1251 return -EIO; 1296 return -EIO;
1252 snd_printdd(SFX "codec #%d probed OK\n", addr); 1297 snd_printdd(SFX "codec #%d probed OK\n", addr);
@@ -1455,6 +1500,17 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1455 return err; 1500 return err;
1456 } 1501 }
1457 snd_pcm_limit_hw_rates(runtime); 1502 snd_pcm_limit_hw_rates(runtime);
1503 /* sanity check */
1504 if (snd_BUG_ON(!runtime->hw.channels_min) ||
1505 snd_BUG_ON(!runtime->hw.channels_max) ||
1506 snd_BUG_ON(!runtime->hw.formats) ||
1507 snd_BUG_ON(!runtime->hw.rates)) {
1508 azx_release_device(azx_dev);
1509 hinfo->ops.close(hinfo, apcm->codec, substream);
1510 snd_hda_power_down(apcm->codec);
1511 mutex_unlock(&chip->open_mutex);
1512 return -EINVAL;
1513 }
1458 spin_lock_irqsave(&chip->reg_lock, flags); 1514 spin_lock_irqsave(&chip->reg_lock, flags);
1459 azx_dev->substream = substream; 1515 azx_dev->substream = substream;
1460 azx_dev->running = 0; 1516 azx_dev->running = 0;
@@ -1463,13 +1519,6 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1463 runtime->private_data = azx_dev; 1519 runtime->private_data = azx_dev;
1464 snd_pcm_set_sync(substream); 1520 snd_pcm_set_sync(substream);
1465 mutex_unlock(&chip->open_mutex); 1521 mutex_unlock(&chip->open_mutex);
1466
1467 if (snd_BUG_ON(!runtime->hw.channels_min || !runtime->hw.channels_max))
1468 return -EINVAL;
1469 if (snd_BUG_ON(!runtime->hw.formats))
1470 return -EINVAL;
1471 if (snd_BUG_ON(!runtime->hw.rates))
1472 return -EINVAL;
1473 return 0; 1522 return 0;
1474} 1523}
1475 1524
@@ -2329,9 +2378,19 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2329 gcap = azx_readw(chip, GCAP); 2378 gcap = azx_readw(chip, GCAP);
2330 snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap); 2379 snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap);
2331 2380
2332 /* ATI chips seems buggy about 64bit DMA addresses */ 2381 /* disable SB600 64bit support for safety */
2333 if (chip->driver_type == AZX_DRIVER_ATI) 2382 if ((chip->driver_type == AZX_DRIVER_ATI) ||
2334 gcap &= ~ICH6_GCAP_64OK; 2383 (chip->driver_type == AZX_DRIVER_ATIHDMI)) {
2384 struct pci_dev *p_smbus;
2385 p_smbus = pci_get_device(PCI_VENDOR_ID_ATI,
2386 PCI_DEVICE_ID_ATI_SBX00_SMBUS,
2387 NULL);
2388 if (p_smbus) {
2389 if (p_smbus->revision < 0x30)
2390 gcap &= ~ICH6_GCAP_64OK;
2391 pci_dev_put(p_smbus);
2392 }
2393 }
2335 2394
2336 /* allow 64bit DMA address if supported by H/W */ 2395 /* allow 64bit DMA address if supported by H/W */
2337 if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) 2396 if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index be7d25fa7f35..3da85caf8af1 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -3754,7 +3754,7 @@ static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol,
3754 int mute = (!ucontrol->value.integer.value[0] && 3754 int mute = (!ucontrol->value.integer.value[0] &&
3755 !ucontrol->value.integer.value[1]); 3755 !ucontrol->value.integer.value[1]);
3756 /* toggle GPIO1 according to the mute state */ 3756 /* toggle GPIO1 according to the mute state */
3757 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 3757 snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3758 mute ? 0x02 : 0x0); 3758 mute ? 0x02 : 0x0);
3759 return ret; 3759 return ret;
3760} 3760}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e661b21354be..51c44fdbc0f0 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -275,13 +275,13 @@ struct alc_spec {
275 */ 275 */
276 unsigned int num_init_verbs; 276 unsigned int num_init_verbs;
277 277
278 char stream_name_analog[16]; /* analog PCM stream */ 278 char stream_name_analog[32]; /* analog PCM stream */
279 struct hda_pcm_stream *stream_analog_playback; 279 struct hda_pcm_stream *stream_analog_playback;
280 struct hda_pcm_stream *stream_analog_capture; 280 struct hda_pcm_stream *stream_analog_capture;
281 struct hda_pcm_stream *stream_analog_alt_playback; 281 struct hda_pcm_stream *stream_analog_alt_playback;
282 struct hda_pcm_stream *stream_analog_alt_capture; 282 struct hda_pcm_stream *stream_analog_alt_capture;
283 283
284 char stream_name_digital[16]; /* digital PCM stream */ 284 char stream_name_digital[32]; /* digital PCM stream */
285 struct hda_pcm_stream *stream_digital_playback; 285 struct hda_pcm_stream *stream_digital_playback;
286 struct hda_pcm_stream *stream_digital_capture; 286 struct hda_pcm_stream *stream_digital_capture;
287 287
@@ -559,7 +559,7 @@ static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
559 559
560 /* Find enumerated value for current pinctl setting */ 560 /* Find enumerated value for current pinctl setting */
561 i = alc_pin_mode_min(dir); 561 i = alc_pin_mode_min(dir);
562 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) 562 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
563 i++; 563 i++;
564 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); 564 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
565 return 0; 565 return 0;
@@ -4505,6 +4505,12 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4505 &dig_nid, 1); 4505 &dig_nid, 1);
4506 if (err < 0) 4506 if (err < 0)
4507 continue; 4507 continue;
4508 if (dig_nid > 0x7f) {
4509 printk(KERN_ERR "alc880_auto: invalid dig_nid "
4510 "connection 0x%x for NID 0x%x\n", dig_nid,
4511 spec->autocfg.dig_out_pins[i]);
4512 continue;
4513 }
4508 if (!i) 4514 if (!i)
4509 spec->multiout.dig_out_nid = dig_nid; 4515 spec->multiout.dig_out_nid = dig_nid;
4510 else { 4516 else {
@@ -6919,9 +6925,6 @@ static struct hda_verb alc882_targa_verbs[] = {
6919 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6925 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6920 6926
6921 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 6927 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6922 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6923 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6924 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6925 { } /* end */ 6928 { } /* end */
6926}; 6929};
6927 6930
@@ -7241,7 +7244,8 @@ static struct alc_config_preset alc882_presets[] = {
7241 }, 7244 },
7242 [ALC882_TARGA] = { 7245 [ALC882_TARGA] = {
7243 .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, 7246 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7244 .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, 7247 .init_verbs = { alc882_init_verbs, alc880_gpio3_init_verbs,
7248 alc882_targa_verbs},
7245 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 7249 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7246 .dac_nids = alc882_dac_nids, 7250 .dac_nids = alc882_dac_nids,
7247 .dig_out_nid = ALC882_DIGOUT_NID, 7251 .dig_out_nid = ALC882_DIGOUT_NID,
@@ -9238,7 +9242,8 @@ static struct alc_config_preset alc883_presets[] = {
9238 }, 9242 },
9239 [ALC883_TARGA_DIG] = { 9243 [ALC883_TARGA_DIG] = {
9240 .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, 9244 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9241 .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, 9245 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9246 alc883_targa_verbs},
9242 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9247 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9243 .dac_nids = alc883_dac_nids, 9248 .dac_nids = alc883_dac_nids,
9244 .dig_out_nid = ALC883_DIGOUT_NID, 9249 .dig_out_nid = ALC883_DIGOUT_NID,
@@ -9251,7 +9256,8 @@ static struct alc_config_preset alc883_presets[] = {
9251 }, 9256 },
9252 [ALC883_TARGA_2ch_DIG] = { 9257 [ALC883_TARGA_2ch_DIG] = {
9253 .mixers = { alc883_targa_2ch_mixer}, 9258 .mixers = { alc883_targa_2ch_mixer},
9254 .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, 9259 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9260 alc883_targa_verbs},
9255 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9261 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9256 .dac_nids = alc883_dac_nids, 9262 .dac_nids = alc883_dac_nids,
9257 .adc_nids = alc883_adc_nids_alt, 9263 .adc_nids = alc883_adc_nids_alt,
@@ -10625,6 +10631,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10625 alc262_lenovo_3000_automute(codec, 1); 10631 alc262_lenovo_3000_automute(codec, 1);
10626} 10632}
10627 10633
10634static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10635 int dir, int idx, long *valp)
10636{
10637 int i, change = 0;
10638
10639 for (i = 0; i < 2; i++, valp++)
10640 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10641 HDA_AMP_MUTE,
10642 *valp ? 0 : HDA_AMP_MUTE);
10643 return change;
10644}
10645
10628/* bind hp and internal speaker mute (with plug check) */ 10646/* bind hp and internal speaker mute (with plug check) */
10629static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, 10647static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10630 struct snd_ctl_elem_value *ucontrol) 10648 struct snd_ctl_elem_value *ucontrol)
@@ -10633,13 +10651,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10633 long *valp = ucontrol->value.integer.value; 10651 long *valp = ucontrol->value.integer.value;
10634 int change; 10652 int change;
10635 10653
10636 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 10654 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10637 HDA_AMP_MUTE, 10655 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10638 valp ? 0 : HDA_AMP_MUTE);
10639 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10640 HDA_AMP_MUTE,
10641 valp ? 0 : HDA_AMP_MUTE);
10642
10643 if (change) 10656 if (change)
10644 alc262_fujitsu_automute(codec, 0); 10657 alc262_fujitsu_automute(codec, 0);
10645 return change; 10658 return change;
@@ -10674,10 +10687,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10674 long *valp = ucontrol->value.integer.value; 10687 long *valp = ucontrol->value.integer.value;
10675 int change; 10688 int change;
10676 10689
10677 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 10690 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10678 HDA_AMP_MUTE,
10679 valp ? 0 : HDA_AMP_MUTE);
10680
10681 if (change) 10691 if (change)
10682 alc262_lenovo_3000_automute(codec, 0); 10692 alc262_lenovo_3000_automute(codec, 0);
10683 return change; 10693 return change;
@@ -11848,12 +11858,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11848 long *valp = ucontrol->value.integer.value; 11858 long *valp = ucontrol->value.integer.value;
11849 int change; 11859 int change;
11850 11860
11851 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 11861 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11852 HDA_AMP_MUTE,
11853 valp[0] ? 0 : HDA_AMP_MUTE);
11854 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11855 HDA_AMP_MUTE,
11856 valp[1] ? 0 : HDA_AMP_MUTE);
11857 if (change) 11862 if (change)
11858 alc268_acer_automute(codec, 0); 11863 alc268_acer_automute(codec, 0);
11859 return change; 11864 return change;
@@ -12878,9 +12883,9 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12878 12883
12879static struct snd_kcontrol_new alc269_eeepc_mixer[] = { 12884static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12880 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 12885 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12881 HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 12886 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 12887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12883 HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 12888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12884 { } /* end */ 12889 { } /* end */
12885}; 12890};
12886 12891
@@ -15152,7 +15157,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15152 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), 15157 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15153 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), 15158 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15154 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ 15159 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15155 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), 15160 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15156 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), 15161 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15157 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), 15162 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15158 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), 15163 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 14f3c3e0f62d..456ef6ac12e4 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1590,8 +1590,6 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1590 /* SigmaTel reference board */ 1590 /* SigmaTel reference board */
1591 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1591 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1592 "DFI LanParty", STAC_REF), 1592 "DFI LanParty", STAC_REF),
1593 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
1594 "SigmaTel",STAC_9205_REF),
1595 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 1593 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1596 "DFI LanParty", STAC_REF), 1594 "DFI LanParty", STAC_REF),
1597 /* Dell laptops have BIOS problem */ 1595 /* Dell laptops have BIOS problem */
@@ -1811,6 +1809,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1811 "Dell Studio 1537", STAC_DELL_M6_DMIC), 1809 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1812 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, 1810 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1813 "Dell Studio 17", STAC_DELL_M6_DMIC), 1811 "Dell Studio 17", STAC_DELL_M6_DMIC),
1812 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1813 "Dell Studio 1555", STAC_DELL_M6_DMIC),
1814 {} /* terminator */ 1814 {} /* terminator */
1815}; 1815};
1816 1816
@@ -2266,7 +2266,7 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2266 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), 2266 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2267 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), 2267 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2268 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), 2268 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2269 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST), 2269 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
2270 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), 2270 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2271 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), 2271 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2272 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), 2272 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
@@ -2344,6 +2344,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2344 /* SigmaTel reference board */ 2344 /* SigmaTel reference board */
2345 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2345 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2346 "DFI LanParty", STAC_9205_REF), 2346 "DFI LanParty", STAC_9205_REF),
2347 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
2348 "SigmaTel", STAC_9205_REF),
2347 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 2349 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2348 "DFI LanParty", STAC_9205_REF), 2350 "DFI LanParty", STAC_9205_REF),
2349 /* Dell */ 2351 /* Dell */
@@ -2378,6 +2380,7 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2378 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, 2380 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2379 "Dell Vostro 1500", STAC_9205_DELL_M42), 2381 "Dell Vostro 1500", STAC_9205_DELL_M42),
2380 /* Gateway */ 2382 /* Gateway */
2383 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2381 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), 2384 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
2382 {} /* terminator */ 2385 {} /* terminator */
2383}; 2386};
@@ -4065,7 +4068,7 @@ static int stac92xx_add_jack(struct hda_codec *codec,
4065 jack->nid = nid; 4068 jack->nid = nid;
4066 jack->type = type; 4069 jack->type = type;
4067 4070
4068 sprintf(name, "%s at %s %s Jack", 4071 snprintf(name, sizeof(name), "%s at %s %s Jack",
4069 snd_hda_get_jack_type(def_conf), 4072 snd_hda_get_jack_type(def_conf),
4070 snd_hda_get_jack_connectivity(def_conf), 4073 snd_hda_get_jack_connectivity(def_conf),
4071 snd_hda_get_jack_location(def_conf)); 4074 snd_hda_get_jack_location(def_conf));
@@ -5642,6 +5645,13 @@ static int patch_stac927x(struct hda_codec *codec)
5642 /* GPIO2 High = Enable EAPD */ 5645 /* GPIO2 High = Enable EAPD */
5643 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; 5646 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
5644 spec->gpio_data = 0x04; 5647 spec->gpio_data = 0x04;
5648 switch (codec->subsystem_id) {
5649 case 0x1028022f:
5650 /* correct EAPD to be GPIO0 */
5651 spec->eapd_mask = spec->gpio_mask = 0x01;
5652 spec->gpio_dir = spec->gpio_data = 0x01;
5653 break;
5654 };
5645 spec->dmic_nids = stac927x_dmic_nids; 5655 spec->dmic_nids = stac927x_dmic_nids;
5646 spec->num_dmics = STAC927X_NUM_DMICS; 5656 spec->num_dmics = STAC927X_NUM_DMICS;
5647 5657
@@ -5854,6 +5864,8 @@ static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
5854}; 5864};
5855 5865
5856static struct snd_pci_quirk stac9872_cfg_tbl[] = { 5866static struct snd_pci_quirk stac9872_cfg_tbl[] = {
5867 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
5868 "Sony VAIO F/S", STAC_9872_VAIO),
5857 {} /* terminator */ 5869 {} /* terminator */
5858}; 5870};
5859 5871
@@ -5866,6 +5878,8 @@ static int patch_stac9872(struct hda_codec *codec)
5866 if (spec == NULL) 5878 if (spec == NULL)
5867 return -ENOMEM; 5879 return -ENOMEM;
5868 codec->spec = spec; 5880 codec->spec = spec;
5881 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
5882 spec->pin_nids = stac9872_pin_nids;
5869 5883
5870 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, 5884 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
5871 stac9872_models, 5885 stac9872_models,
@@ -5877,8 +5891,6 @@ static int patch_stac9872(struct hda_codec *codec)
5877 stac92xx_set_config_regs(codec, 5891 stac92xx_set_config_regs(codec,
5878 stac9872_brd_tbl[spec->board_config]); 5892 stac9872_brd_tbl[spec->board_config]);
5879 5893
5880 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
5881 spec->pin_nids = stac9872_pin_nids;
5882 spec->multiout.dac_nids = spec->dac_nids; 5894 spec->multiout.dac_nids = spec->dac_nids;
5883 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); 5895 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
5884 spec->adc_nids = stac9872_adc_nids; 5896 spec->adc_nids = stac9872_adc_nids;
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 8e004fb6961a..9008b4b013aa 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -210,7 +210,9 @@ struct via_spec {
210 /* capture */ 210 /* capture */
211 unsigned int num_adc_nids; 211 unsigned int num_adc_nids;
212 hda_nid_t *adc_nids; 212 hda_nid_t *adc_nids;
213 hda_nid_t mux_nids[3];
213 hda_nid_t dig_in_nid; 214 hda_nid_t dig_in_nid;
215 hda_nid_t dig_in_pin;
214 216
215 /* capture source */ 217 /* capture source */
216 const struct hda_input_mux *input_mux; 218 const struct hda_input_mux *input_mux;
@@ -319,6 +321,9 @@ static void via_auto_set_output_and_unmute(struct hda_codec *codec,
319 pin_type); 321 pin_type);
320 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 322 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
321 AMP_OUT_UNMUTE); 323 AMP_OUT_UNMUTE);
324 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
325 snd_hda_codec_write(codec, nid, 0,
326 AC_VERB_SET_EAPD_BTLENABLE, 0x02);
322} 327}
323 328
324 329
@@ -387,27 +392,12 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol,
387 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 392 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
388 struct via_spec *spec = codec->spec; 393 struct via_spec *spec = codec->spec;
389 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 394 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
390 unsigned int vendor_id = codec->vendor_id; 395
391 396 if (!spec->mux_nids[adc_idx])
392 /* AIW0 lydia 060801 add for correct sw0 input select */ 397 return -EINVAL;
393 if (IS_VT1708_VENDORID(vendor_id) && (adc_idx == 0)) 398 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
394 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, 399 spec->mux_nids[adc_idx],
395 0x18, &spec->cur_mux[adc_idx]); 400 &spec->cur_mux[adc_idx]);
396 else if ((IS_VT1709_10CH_VENDORID(vendor_id) ||
397 IS_VT1709_6CH_VENDORID(vendor_id)) && (adc_idx == 0))
398 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
399 0x19, &spec->cur_mux[adc_idx]);
400 else if ((IS_VT1708B_8CH_VENDORID(vendor_id) ||
401 IS_VT1708B_4CH_VENDORID(vendor_id)) && (adc_idx == 0))
402 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
403 0x17, &spec->cur_mux[adc_idx]);
404 else if (IS_VT1702_VENDORID(vendor_id) && (adc_idx == 0))
405 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
406 0x13, &spec->cur_mux[adc_idx]);
407 else
408 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
409 spec->adc_nids[adc_idx],
410 &spec->cur_mux[adc_idx]);
411} 401}
412 402
413static int via_independent_hp_info(struct snd_kcontrol *kcontrol, 403static int via_independent_hp_info(struct snd_kcontrol *kcontrol,
@@ -998,25 +988,11 @@ static int via_init(struct hda_codec *codec)
998 988
999 /* Lydia Add for EAPD enable */ 989 /* Lydia Add for EAPD enable */
1000 if (!spec->dig_in_nid) { /* No Digital In connection */ 990 if (!spec->dig_in_nid) { /* No Digital In connection */
1001 if (IS_VT1708_VENDORID(codec->vendor_id)) { 991 if (spec->dig_in_pin) {
1002 snd_hda_codec_write(codec, VT1708_DIGIN_PIN, 0, 992 snd_hda_codec_write(codec, spec->dig_in_pin, 0,
1003 AC_VERB_SET_PIN_WIDGET_CONTROL,
1004 PIN_OUT);
1005 snd_hda_codec_write(codec, VT1708_DIGIN_PIN, 0,
1006 AC_VERB_SET_EAPD_BTLENABLE, 0x02);
1007 } else if (IS_VT1709_10CH_VENDORID(codec->vendor_id) ||
1008 IS_VT1709_6CH_VENDORID(codec->vendor_id)) {
1009 snd_hda_codec_write(codec, VT1709_DIGIN_PIN, 0,
1010 AC_VERB_SET_PIN_WIDGET_CONTROL, 993 AC_VERB_SET_PIN_WIDGET_CONTROL,
1011 PIN_OUT); 994 PIN_OUT);
1012 snd_hda_codec_write(codec, VT1709_DIGIN_PIN, 0, 995 snd_hda_codec_write(codec, spec->dig_in_pin, 0,
1013 AC_VERB_SET_EAPD_BTLENABLE, 0x02);
1014 } else if (IS_VT1708B_8CH_VENDORID(codec->vendor_id) ||
1015 IS_VT1708B_4CH_VENDORID(codec->vendor_id)) {
1016 snd_hda_codec_write(codec, VT1708B_DIGIN_PIN, 0,
1017 AC_VERB_SET_PIN_WIDGET_CONTROL,
1018 PIN_OUT);
1019 snd_hda_codec_write(codec, VT1708B_DIGIN_PIN, 0,
1020 AC_VERB_SET_EAPD_BTLENABLE, 0x02); 996 AC_VERB_SET_EAPD_BTLENABLE, 0x02);
1021 } 997 }
1022 } else /* enable SPDIF-input pin */ 998 } else /* enable SPDIF-input pin */
@@ -1326,6 +1302,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec)
1326 1302
1327 if (spec->autocfg.dig_outs) 1303 if (spec->autocfg.dig_outs)
1328 spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; 1304 spec->multiout.dig_out_nid = VT1708_DIGOUT_NID;
1305 spec->dig_in_pin = VT1708_DIGIN_PIN;
1329 if (spec->autocfg.dig_in_pin) 1306 if (spec->autocfg.dig_in_pin)
1330 spec->dig_in_nid = VT1708_DIGIN_NID; 1307 spec->dig_in_nid = VT1708_DIGIN_NID;
1331 1308
@@ -1352,6 +1329,34 @@ static int via_auto_init(struct hda_codec *codec)
1352 return 0; 1329 return 0;
1353} 1330}
1354 1331
1332static int get_mux_nids(struct hda_codec *codec)
1333{
1334 struct via_spec *spec = codec->spec;
1335 hda_nid_t nid, conn[8];
1336 unsigned int type;
1337 int i, n;
1338
1339 for (i = 0; i < spec->num_adc_nids; i++) {
1340 nid = spec->adc_nids[i];
1341 while (nid) {
1342 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE)
1343 >> AC_WCAP_TYPE_SHIFT;
1344 if (type == AC_WID_PIN)
1345 break;
1346 n = snd_hda_get_connections(codec, nid, conn,
1347 ARRAY_SIZE(conn));
1348 if (n <= 0)
1349 break;
1350 if (n > 1) {
1351 spec->mux_nids[i] = nid;
1352 break;
1353 }
1354 nid = conn[0];
1355 }
1356 }
1357 return 0;
1358}
1359
1355static int patch_vt1708(struct hda_codec *codec) 1360static int patch_vt1708(struct hda_codec *codec)
1356{ 1361{
1357 struct via_spec *spec; 1362 struct via_spec *spec;
@@ -1799,6 +1804,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)
1799 1804
1800 if (spec->autocfg.dig_outs) 1805 if (spec->autocfg.dig_outs)
1801 spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; 1806 spec->multiout.dig_out_nid = VT1709_DIGOUT_NID;
1807 spec->dig_in_pin = VT1709_DIGIN_PIN;
1802 if (spec->autocfg.dig_in_pin) 1808 if (spec->autocfg.dig_in_pin)
1803 spec->dig_in_nid = VT1709_DIGIN_NID; 1809 spec->dig_in_nid = VT1709_DIGIN_NID;
1804 1810
@@ -1859,6 +1865,7 @@ static int patch_vt1709_10ch(struct hda_codec *codec)
1859 if (!spec->adc_nids && spec->input_mux) { 1865 if (!spec->adc_nids && spec->input_mux) {
1860 spec->adc_nids = vt1709_adc_nids; 1866 spec->adc_nids = vt1709_adc_nids;
1861 spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); 1867 spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids);
1868 get_mux_nids(codec);
1862 spec->mixers[spec->num_mixers] = vt1709_capture_mixer; 1869 spec->mixers[spec->num_mixers] = vt1709_capture_mixer;
1863 spec->num_mixers++; 1870 spec->num_mixers++;
1864 } 1871 }
@@ -1952,6 +1959,7 @@ static int patch_vt1709_6ch(struct hda_codec *codec)
1952 if (!spec->adc_nids && spec->input_mux) { 1959 if (!spec->adc_nids && spec->input_mux) {
1953 spec->adc_nids = vt1709_adc_nids; 1960 spec->adc_nids = vt1709_adc_nids;
1954 spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); 1961 spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids);
1962 get_mux_nids(codec);
1955 spec->mixers[spec->num_mixers] = vt1709_capture_mixer; 1963 spec->mixers[spec->num_mixers] = vt1709_capture_mixer;
1956 spec->num_mixers++; 1964 spec->num_mixers++;
1957 } 1965 }
@@ -2344,6 +2352,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)
2344 2352
2345 if (spec->autocfg.dig_outs) 2353 if (spec->autocfg.dig_outs)
2346 spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; 2354 spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID;
2355 spec->dig_in_pin = VT1708B_DIGIN_PIN;
2347 if (spec->autocfg.dig_in_pin) 2356 if (spec->autocfg.dig_in_pin)
2348 spec->dig_in_nid = VT1708B_DIGIN_NID; 2357 spec->dig_in_nid = VT1708B_DIGIN_NID;
2349 2358
@@ -2404,6 +2413,7 @@ static int patch_vt1708B_8ch(struct hda_codec *codec)
2404 if (!spec->adc_nids && spec->input_mux) { 2413 if (!spec->adc_nids && spec->input_mux) {
2405 spec->adc_nids = vt1708B_adc_nids; 2414 spec->adc_nids = vt1708B_adc_nids;
2406 spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); 2415 spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids);
2416 get_mux_nids(codec);
2407 spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; 2417 spec->mixers[spec->num_mixers] = vt1708B_capture_mixer;
2408 spec->num_mixers++; 2418 spec->num_mixers++;
2409 } 2419 }
@@ -2455,6 +2465,7 @@ static int patch_vt1708B_4ch(struct hda_codec *codec)
2455 if (!spec->adc_nids && spec->input_mux) { 2465 if (!spec->adc_nids && spec->input_mux) {
2456 spec->adc_nids = vt1708B_adc_nids; 2466 spec->adc_nids = vt1708B_adc_nids;
2457 spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); 2467 spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids);
2468 get_mux_nids(codec);
2458 spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; 2469 spec->mixers[spec->num_mixers] = vt1708B_capture_mixer;
2459 spec->num_mixers++; 2470 spec->num_mixers++;
2460 } 2471 }
@@ -2889,6 +2900,7 @@ static int patch_vt1708S(struct hda_codec *codec)
2889 if (!spec->adc_nids && spec->input_mux) { 2900 if (!spec->adc_nids && spec->input_mux) {
2890 spec->adc_nids = vt1708S_adc_nids; 2901 spec->adc_nids = vt1708S_adc_nids;
2891 spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids); 2902 spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids);
2903 get_mux_nids(codec);
2892 spec->mixers[spec->num_mixers] = vt1708S_capture_mixer; 2904 spec->mixers[spec->num_mixers] = vt1708S_capture_mixer;
2893 spec->num_mixers++; 2905 spec->num_mixers++;
2894 } 2906 }
@@ -3206,6 +3218,7 @@ static int patch_vt1702(struct hda_codec *codec)
3206 if (!spec->adc_nids && spec->input_mux) { 3218 if (!spec->adc_nids && spec->input_mux) {
3207 spec->adc_nids = vt1702_adc_nids; 3219 spec->adc_nids = vt1702_adc_nids;
3208 spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids); 3220 spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids);
3221 get_mux_nids(codec);
3209 spec->mixers[spec->num_mixers] = vt1702_capture_mixer; 3222 spec->mixers[spec->num_mixers] = vt1702_capture_mixer;
3210 spec->num_mixers++; 3223 spec->num_mixers++;
3211 } 3224 }
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 235a71e5ac8d..b5ca02e2038c 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -2197,9 +2197,12 @@ static int __init alsa_card_riptide_init(void)
2197 if (err < 0) 2197 if (err < 0)
2198 return err; 2198 return err;
2199#if defined(SUPPORT_JOYSTICK) 2199#if defined(SUPPORT_JOYSTICK)
2200 pci_register_driver(&joystick_driver); 2200 err = pci_register_driver(&joystick_driver);
2201 /* On failure unregister formerly registered audio driver */
2202 if (err < 0)
2203 pci_unregister_driver(&driver);
2201#endif 2204#endif
2202 return 0; 2205 return err;
2203} 2206}
2204 2207
2205static void __exit alsa_card_riptide_exit(void) 2208static void __exit alsa_card_riptide_exit(void)