aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2012-05-21 15:39:42 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-05-21 15:39:42 -0400
commit0ad8c6a22d03a1598f7cc6585c65354dadca62ad (patch)
tree1507deef3d55d5f3c71b2f76924fe1f6c6211905 /sound
parent8527f8e2934683e53405fbe876a4e6f4a0c46eb8 (diff)
parent76e10d158efb6d4516018846f60c2ab5501900bc (diff)
Merge tag 'v3.4' with SCSI updates, needed for subsequent firewire-sbp2 changes
Linux 3.4
Diffstat (limited to 'sound')
-rw-r--r--sound/core/vmaster.c1
-rw-r--r--sound/isa/sscape.c6
-rw-r--r--sound/last.c2
-rw-r--r--sound/oss/msnd_pinnacle.c8
-rw-r--r--sound/pci/Kconfig4
-rw-r--r--sound/pci/asihpi/hpi_internal.h4
-rw-r--r--sound/pci/asihpi/hpios.c10
-rw-r--r--sound/pci/echoaudio/echoaudio_dsp.c2
-rw-r--r--sound/pci/hda/hda_codec.c4
-rw-r--r--sound/pci/hda/hda_codec.h3
-rw-r--r--sound/pci/hda/hda_eld.c6
-rw-r--r--sound/pci/hda/hda_intel.c20
-rw-r--r--sound/pci/hda/hda_proc.c13
-rw-r--r--sound/pci/hda/patch_conexant.c143
-rw-r--r--sound/pci/hda/patch_hdmi.c9
-rw-r--r--sound/pci/hda/patch_realtek.c102
-rw-r--r--sound/pci/hda/patch_sigmatel.c11
-rw-r--r--sound/pci/rme9652/hdsp.c1
-rw-r--r--sound/soc/blackfin/bf5xx-ssm2602.c2
-rw-r--r--sound/soc/codecs/Kconfig3
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/cs42l73.c18
-rw-r--r--sound/soc/codecs/sgtl5000.c25
-rw-r--r--sound/soc/codecs/tlv320aic23.c4
-rw-r--r--sound/soc/codecs/twl6040.c3
-rw-r--r--sound/soc/codecs/wm8350.c11
-rw-r--r--sound/soc/codecs/wm8994.c276
-rw-r--r--sound/soc/codecs/wm_hubs.c15
-rw-r--r--sound/soc/imx/imx-audmux.c5
-rw-r--r--sound/soc/omap/Kconfig2
-rw-r--r--sound/soc/omap/omap-pcm.c4
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c1
-rw-r--r--sound/soc/samsung/s3c2412-i2s.c2
-rw-r--r--sound/soc/sh/fsi.c7
-rw-r--r--sound/soc/sh/migor.c2
-rw-r--r--sound/soc/soc-core.c9
-rw-r--r--sound/soc/soc-dapm.c2
-rw-r--r--sound/soc/tegra/tegra_i2s.c6
-rw-r--r--sound/soc/tegra/tegra_spdif.c4
39 files changed, 517 insertions, 235 deletions
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index 14a286a7bf2b..857586135d18 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -419,6 +419,7 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master);
419 * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control 419 * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control
420 * @kcontrol: vmaster kctl element 420 * @kcontrol: vmaster kctl element
421 * @hook: the hook function 421 * @hook: the hook function
422 * @private_data: the private_data pointer to be saved
422 * 423 *
423 * Adds the given hook to the vmaster control element so that it's called 424 * Adds the given hook to the vmaster control element so that it's called
424 * at each time when the value is changed. 425 * at each time when the value is changed.
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index b4a6aa960f4b..8490f59709bb 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1019,13 +1019,15 @@ static int __devinit create_sscape(int dev, struct snd_card *card)
1019 irq_cfg = get_irq_config(sscape->type, irq[dev]); 1019 irq_cfg = get_irq_config(sscape->type, irq[dev]);
1020 if (irq_cfg == INVALID_IRQ) { 1020 if (irq_cfg == INVALID_IRQ) {
1021 snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); 1021 snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]);
1022 return -ENXIO; 1022 err = -ENXIO;
1023 goto _release_dma;
1023 } 1024 }
1024 1025
1025 mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]); 1026 mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]);
1026 if (mpu_irq_cfg == INVALID_IRQ) { 1027 if (mpu_irq_cfg == INVALID_IRQ) {
1027 snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); 1028 snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]);
1028 return -ENXIO; 1029 err = -ENXIO;
1030 goto _release_dma;
1029 } 1031 }
1030 1032
1031 /* 1033 /*
diff --git a/sound/last.c b/sound/last.c
index bdd0857b8871..7ffc182e0844 100644
--- a/sound/last.c
+++ b/sound/last.c
@@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void)
38 return 0; 38 return 0;
39} 39}
40 40
41__initcall(alsa_sound_last_init); 41late_initcall_sync(alsa_sound_last_init);
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index 2c79d60a725f..536c4c0514d3 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -1294,6 +1294,8 @@ static int __init calibrate_adc(WORD srate)
1294 1294
1295static int upload_dsp_code(void) 1295static int upload_dsp_code(void)
1296{ 1296{
1297 int ret = 0;
1298
1297 msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); 1299 msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
1298#ifndef HAVE_DSPCODEH 1300#ifndef HAVE_DSPCODEH
1299 INITCODESIZE = mod_firmware_load(INITCODEFILE, &INITCODE); 1301 INITCODESIZE = mod_firmware_load(INITCODEFILE, &INITCODE);
@@ -1312,7 +1314,8 @@ static int upload_dsp_code(void)
1312 memcpy_toio(dev.base, PERMCODE, PERMCODESIZE); 1314 memcpy_toio(dev.base, PERMCODE, PERMCODESIZE);
1313 if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) { 1315 if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) {
1314 printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n"); 1316 printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n");
1315 return -ENODEV; 1317 ret = -ENODEV;
1318 goto out;
1316 } 1319 }
1317#ifdef HAVE_DSPCODEH 1320#ifdef HAVE_DSPCODEH
1318 printk(KERN_INFO LOGNAME ": DSP firmware uploaded (resident)\n"); 1321 printk(KERN_INFO LOGNAME ": DSP firmware uploaded (resident)\n");
@@ -1320,12 +1323,13 @@ static int upload_dsp_code(void)
1320 printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n"); 1323 printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n");
1321#endif 1324#endif
1322 1325
1326out:
1323#ifndef HAVE_DSPCODEH 1327#ifndef HAVE_DSPCODEH
1324 vfree(INITCODE); 1328 vfree(INITCODE);
1325 vfree(PERMCODE); 1329 vfree(PERMCODE);
1326#endif 1330#endif
1327 1331
1328 return 0; 1332 return ret;
1329} 1333}
1330 1334
1331#ifdef MSND_CLASSIC 1335#ifdef MSND_CLASSIC
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 88168044375f..5ca0939e4223 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -2,8 +2,8 @@
2 2
3config SND_TEA575X 3config SND_TEA575X
4 tristate 4 tristate
5 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 5 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO
6 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 6 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO
7 7
8menuconfig SND_PCI 8menuconfig SND_PCI
9 bool "PCI sound devices" 9 bool "PCI sound devices"
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index 8c63200cf339..bc86cb726d79 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
42If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and 42If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
43HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle. 43HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
44*/ 44*/
45int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, 45u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
46 /**< memory handle */ 46 /**< memory handle */
47 u32 size, /**< Size in bytes to allocate */ 47 u32 size, /**< Size in bytes to allocate */
48 struct pci_dev *p_os_reference 48 struct pci_dev *p_os_reference
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index 87f4385fe8c7..5ef4fe964366 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -39,11 +39,11 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
39 39
40} 40}
41 41
42/** Allocated an area of locked memory for bus master DMA operations. 42/** Allocate an area of locked memory for bus master DMA operations.
43 43
44On error, return -ENOMEM, and *pMemArea.size = 0 44If allocation fails, return 1, and *pMemArea.size = 0
45*/ 45*/
46int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size, 46u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
47 struct pci_dev *pdev) 47 struct pci_dev *pdev)
48{ 48{
49 /*?? any benefit in using managed dmam_alloc_coherent? */ 49 /*?? any benefit in using managed dmam_alloc_coherent? */
@@ -62,7 +62,7 @@ int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
62 HPI_DEBUG_LOG(WARNING, 62 HPI_DEBUG_LOG(WARNING,
63 "failed to allocate %d bytes locked memory\n", size); 63 "failed to allocate %d bytes locked memory\n", size);
64 p_mem_area->size = 0; 64 p_mem_area->size = 0;
65 return -ENOMEM; 65 return 1;
66 } 66 }
67} 67}
68 68
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c
index 64417a733220..d8c670c9d62c 100644
--- a/sound/pci/echoaudio/echoaudio_dsp.c
+++ b/sound/pci/echoaudio/echoaudio_dsp.c
@@ -475,7 +475,7 @@ static int load_firmware(struct echoaudio *chip)
475 const struct firmware *fw; 475 const struct firmware *fw;
476 int box_type, err; 476 int box_type, err;
477 477
478 if (snd_BUG_ON(!chip->dsp_code_to_load || !chip->comm_page)) 478 if (snd_BUG_ON(!chip->comm_page))
479 return -EPERM; 479 return -EPERM;
480 480
481 /* See if the ASIC is present and working - only if the DSP is already loaded */ 481 /* See if the ASIC is present and working - only if the DSP is already loaded */
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 7a8fcc4c15f8..841475cc13b6 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -5444,10 +5444,6 @@ int snd_hda_suspend(struct hda_bus *bus)
5444 list_for_each_entry(codec, &bus->codec_list, list) { 5444 list_for_each_entry(codec, &bus->codec_list, list) {
5445 if (hda_codec_is_power_on(codec)) 5445 if (hda_codec_is_power_on(codec))
5446 hda_call_codec_suspend(codec); 5446 hda_call_codec_suspend(codec);
5447 else /* forcibly change the power to D3 even if not used */
5448 hda_set_power_state(codec,
5449 codec->afg ? codec->afg : codec->mfg,
5450 AC_PWRST_D3);
5451 if (codec->patch_ops.post_suspend) 5447 if (codec->patch_ops.post_suspend)
5452 codec->patch_ops.post_suspend(codec); 5448 codec->patch_ops.post_suspend(codec);
5453 } 5449 }
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 9a9f372e1be4..56b4f74c0b13 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -851,6 +851,9 @@ struct hda_codec {
851 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 851 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
852 * (e.g. Conexant codecs) 852 * (e.g. Conexant codecs)
853 */ 853 */
854 unsigned int single_adc_amp:1; /* adc in-amp takes no index
855 * (e.g. CX20549 codec)
856 */
854 unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ 857 unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */
855 unsigned int pins_shutup:1; /* pins are shut up */ 858 unsigned int pins_shutup:1; /* pins are shut up */
856 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ 859 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index b58b4b1687fa..4c054f4486b9 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -418,7 +418,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a)
418 else 418 else
419 buf2[0] = '\0'; 419 buf2[0] = '\0';
420 420
421 printk(KERN_INFO "HDMI: supports coding type %s:" 421 _snd_printd(SND_PR_VERBOSE, "HDMI: supports coding type %s:"
422 " channels = %d, rates =%s%s\n", 422 " channels = %d, rates =%s%s\n",
423 cea_audio_coding_type_names[a->format], 423 cea_audio_coding_type_names[a->format],
424 a->channels, 424 a->channels,
@@ -442,14 +442,14 @@ void snd_hdmi_show_eld(struct hdmi_eld *e)
442{ 442{
443 int i; 443 int i;
444 444
445 printk(KERN_INFO "HDMI: detected monitor %s at connection type %s\n", 445 _snd_printd(SND_PR_VERBOSE, "HDMI: detected monitor %s at connection type %s\n",
446 e->monitor_name, 446 e->monitor_name,
447 eld_connection_type_names[e->conn_type]); 447 eld_connection_type_names[e->conn_type]);
448 448
449 if (e->spk_alloc) { 449 if (e->spk_alloc) {
450 char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; 450 char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];
451 snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); 451 snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
452 printk(KERN_INFO "HDMI: available speakers:%s\n", buf); 452 _snd_printd(SND_PR_VERBOSE, "HDMI: available speakers:%s\n", buf);
453 } 453 }
454 454
455 for (i = 0; i < e->sad_count; i++) 455 for (i = 0; i < e->sad_count; i++)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index c19e71a94e1b..1f350522bed4 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -783,11 +783,13 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
783{ 783{
784 struct azx *chip = bus->private_data; 784 struct azx *chip = bus->private_data;
785 unsigned long timeout; 785 unsigned long timeout;
786 unsigned long loopcounter;
786 int do_poll = 0; 787 int do_poll = 0;
787 788
788 again: 789 again:
789 timeout = jiffies + msecs_to_jiffies(1000); 790 timeout = jiffies + msecs_to_jiffies(1000);
790 for (;;) { 791
792 for (loopcounter = 0;; loopcounter++) {
791 if (chip->polling_mode || do_poll) { 793 if (chip->polling_mode || do_poll) {
792 spin_lock_irq(&chip->reg_lock); 794 spin_lock_irq(&chip->reg_lock);
793 azx_update_rirb(chip); 795 azx_update_rirb(chip);
@@ -803,7 +805,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
803 } 805 }
804 if (time_after(jiffies, timeout)) 806 if (time_after(jiffies, timeout))
805 break; 807 break;
806 if (bus->needs_damn_long_delay) 808 if (bus->needs_damn_long_delay || loopcounter > 3000)
807 msleep(2); /* temporary workaround */ 809 msleep(2); /* temporary workaround */
808 else { 810 else {
809 udelay(10); 811 udelay(10);
@@ -2351,6 +2353,17 @@ static void azx_power_notify(struct hda_bus *bus)
2351 * power management 2353 * power management
2352 */ 2354 */
2353 2355
2356static int snd_hda_codecs_inuse(struct hda_bus *bus)
2357{
2358 struct hda_codec *codec;
2359
2360 list_for_each_entry(codec, &bus->codec_list, list) {
2361 if (snd_hda_codec_needs_resume(codec))
2362 return 1;
2363 }
2364 return 0;
2365}
2366
2354static int azx_suspend(struct pci_dev *pci, pm_message_t state) 2367static int azx_suspend(struct pci_dev *pci, pm_message_t state)
2355{ 2368{
2356 struct snd_card *card = pci_get_drvdata(pci); 2369 struct snd_card *card = pci_get_drvdata(pci);
@@ -2397,7 +2410,8 @@ static int azx_resume(struct pci_dev *pci)
2397 return -EIO; 2410 return -EIO;
2398 azx_init_pci(chip); 2411 azx_init_pci(chip);
2399 2412
2400 azx_init_chip(chip, 1); 2413 if (snd_hda_codecs_inuse(chip->bus))
2414 azx_init_chip(chip, 1);
2401 2415
2402 snd_hda_resume(chip->bus); 2416 snd_hda_resume(chip->bus);
2403 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2417 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 254ab5204603..e59e2f059b6e 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -651,9 +651,16 @@ static void print_codec_info(struct snd_info_entry *entry,
651 snd_iprintf(buffer, " Amp-In caps: "); 651 snd_iprintf(buffer, " Amp-In caps: ");
652 print_amp_caps(buffer, codec, nid, HDA_INPUT); 652 print_amp_caps(buffer, codec, nid, HDA_INPUT);
653 snd_iprintf(buffer, " Amp-In vals: "); 653 snd_iprintf(buffer, " Amp-In vals: ");
654 print_amp_vals(buffer, codec, nid, HDA_INPUT, 654 if (wid_type == AC_WID_PIN ||
655 wid_caps & AC_WCAP_STEREO, 655 (codec->single_adc_amp &&
656 wid_type == AC_WID_PIN ? 1 : conn_len); 656 wid_type == AC_WID_AUD_IN))
657 print_amp_vals(buffer, codec, nid, HDA_INPUT,
658 wid_caps & AC_WCAP_STEREO,
659 1);
660 else
661 print_amp_vals(buffer, codec, nid, HDA_INPUT,
662 wid_caps & AC_WCAP_STEREO,
663 conn_len);
657 } 664 }
658 if (wid_caps & AC_WCAP_OUT_AMP) { 665 if (wid_caps & AC_WCAP_OUT_AMP) {
659 snd_iprintf(buffer, " Amp-Out caps: "); 666 snd_iprintf(buffer, " Amp-Out caps: ");
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 8c6523bbc797..d906c5b74cf0 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -141,7 +141,6 @@ struct conexant_spec {
141 unsigned int hp_laptop:1; 141 unsigned int hp_laptop:1;
142 unsigned int asus:1; 142 unsigned int asus:1;
143 unsigned int pin_eapd_ctrls:1; 143 unsigned int pin_eapd_ctrls:1;
144 unsigned int single_adc_amp:1;
145 144
146 unsigned int adc_switching:1; 145 unsigned int adc_switching:1;
147 146
@@ -687,27 +686,26 @@ static const struct hda_channel_mode cxt5045_modes[1] = {
687static const struct hda_input_mux cxt5045_capture_source = { 686static const struct hda_input_mux cxt5045_capture_source = {
688 .num_items = 2, 687 .num_items = 2,
689 .items = { 688 .items = {
690 { "IntMic", 0x1 }, 689 { "Internal Mic", 0x1 },
691 { "ExtMic", 0x2 }, 690 { "Mic", 0x2 },
692 } 691 }
693}; 692};
694 693
695static const struct hda_input_mux cxt5045_capture_source_benq = { 694static const struct hda_input_mux cxt5045_capture_source_benq = {
696 .num_items = 5, 695 .num_items = 4,
697 .items = { 696 .items = {
698 { "IntMic", 0x1 }, 697 { "Internal Mic", 0x1 },
699 { "ExtMic", 0x2 }, 698 { "Mic", 0x2 },
700 { "LineIn", 0x3 }, 699 { "Line", 0x3 },
701 { "CD", 0x4 }, 700 { "Mixer", 0x0 },
702 { "Mixer", 0x0 },
703 } 701 }
704}; 702};
705 703
706static const struct hda_input_mux cxt5045_capture_source_hp530 = { 704static const struct hda_input_mux cxt5045_capture_source_hp530 = {
707 .num_items = 2, 705 .num_items = 2,
708 .items = { 706 .items = {
709 { "ExtMic", 0x1 }, 707 { "Mic", 0x1 },
710 { "IntMic", 0x2 }, 708 { "Internal Mic", 0x2 },
711 } 709 }
712}; 710};
713 711
@@ -798,10 +796,8 @@ static void cxt5045_hp_unsol_event(struct hda_codec *codec,
798} 796}
799 797
800static const struct snd_kcontrol_new cxt5045_mixers[] = { 798static const struct snd_kcontrol_new cxt5045_mixers[] = {
801 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), 799 HDA_CODEC_VOLUME("Capture Volume", 0x1a, 0x00, HDA_INPUT),
802 HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), 800 HDA_CODEC_MUTE("Capture Switch", 0x1a, 0x0, HDA_INPUT),
803 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x02, HDA_INPUT),
804 HDA_CODEC_MUTE("Mic Capture Switch", 0x1a, 0x02, HDA_INPUT),
805 HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), 801 HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT),
806 HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), 802 HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT),
807 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x1, HDA_INPUT), 803 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x1, HDA_INPUT),
@@ -822,27 +818,15 @@ static const struct snd_kcontrol_new cxt5045_mixers[] = {
822}; 818};
823 819
824static const struct snd_kcontrol_new cxt5045_benq_mixers[] = { 820static const struct snd_kcontrol_new cxt5045_benq_mixers[] = {
825 HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT), 821 HDA_CODEC_VOLUME("Line Playback Volume", 0x17, 0x3, HDA_INPUT),
826 HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT), 822 HDA_CODEC_MUTE("Line Playback Switch", 0x17, 0x3, HDA_INPUT),
827 HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT),
828 HDA_CODEC_MUTE("CD Playback Switch", 0x17, 0x4, HDA_INPUT),
829
830 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT),
831 HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT),
832 HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT),
833 HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT),
834
835 HDA_CODEC_VOLUME("Mixer Capture Volume", 0x1a, 0x0, HDA_INPUT),
836 HDA_CODEC_MUTE("Mixer Capture Switch", 0x1a, 0x0, HDA_INPUT),
837 823
838 {} 824 {}
839}; 825};
840 826
841static const struct snd_kcontrol_new cxt5045_mixers_hp530[] = { 827static const struct snd_kcontrol_new cxt5045_mixers_hp530[] = {
842 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), 828 HDA_CODEC_VOLUME("Capture Volume", 0x1a, 0x00, HDA_INPUT),
843 HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), 829 HDA_CODEC_MUTE("Capture Switch", 0x1a, 0x0, HDA_INPUT),
844 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x01, HDA_INPUT),
845 HDA_CODEC_MUTE("Mic Capture Switch", 0x1a, 0x01, HDA_INPUT),
846 HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), 830 HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT),
847 HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), 831 HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT),
848 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x2, HDA_INPUT), 832 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x2, HDA_INPUT),
@@ -946,10 +930,10 @@ static const struct snd_kcontrol_new cxt5045_test_mixer[] = {
946 /* Output controls */ 930 /* Output controls */
947 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT), 931 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT),
948 HDA_CODEC_MUTE("Speaker Playback Switch", 0x10, 0x0, HDA_OUTPUT), 932 HDA_CODEC_MUTE("Speaker Playback Switch", 0x10, 0x0, HDA_OUTPUT),
949 HDA_CODEC_VOLUME("Node 11 Playback Volume", 0x11, 0x0, HDA_OUTPUT), 933 HDA_CODEC_VOLUME("HP-OUT Playback Volume", 0x11, 0x0, HDA_OUTPUT),
950 HDA_CODEC_MUTE("Node 11 Playback Switch", 0x11, 0x0, HDA_OUTPUT), 934 HDA_CODEC_MUTE("HP-OUT Playback Switch", 0x11, 0x0, HDA_OUTPUT),
951 HDA_CODEC_VOLUME("Node 12 Playback Volume", 0x12, 0x0, HDA_OUTPUT), 935 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x12, 0x0, HDA_OUTPUT),
952 HDA_CODEC_MUTE("Node 12 Playback Switch", 0x12, 0x0, HDA_OUTPUT), 936 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x12, 0x0, HDA_OUTPUT),
953 937
954 /* Modes for retasking pin widgets */ 938 /* Modes for retasking pin widgets */
955 CXT_PIN_MODE("HP-OUT pin mode", 0x11, CXT_PIN_DIR_INOUT), 939 CXT_PIN_MODE("HP-OUT pin mode", 0x11, CXT_PIN_DIR_INOUT),
@@ -960,16 +944,16 @@ static const struct snd_kcontrol_new cxt5045_test_mixer[] = {
960 944
961 /* Loopback mixer controls */ 945 /* Loopback mixer controls */
962 946
963 HDA_CODEC_VOLUME("Mixer-1 Volume", 0x17, 0x0, HDA_INPUT), 947 HDA_CODEC_VOLUME("PCM Volume", 0x17, 0x0, HDA_INPUT),
964 HDA_CODEC_MUTE("Mixer-1 Switch", 0x17, 0x0, HDA_INPUT), 948 HDA_CODEC_MUTE("PCM Switch", 0x17, 0x0, HDA_INPUT),
965 HDA_CODEC_VOLUME("Mixer-2 Volume", 0x17, 0x1, HDA_INPUT), 949 HDA_CODEC_VOLUME("MIC1 pin Volume", 0x17, 0x1, HDA_INPUT),
966 HDA_CODEC_MUTE("Mixer-2 Switch", 0x17, 0x1, HDA_INPUT), 950 HDA_CODEC_MUTE("MIC1 pin Switch", 0x17, 0x1, HDA_INPUT),
967 HDA_CODEC_VOLUME("Mixer-3 Volume", 0x17, 0x2, HDA_INPUT), 951 HDA_CODEC_VOLUME("LINE1 pin Volume", 0x17, 0x2, HDA_INPUT),
968 HDA_CODEC_MUTE("Mixer-3 Switch", 0x17, 0x2, HDA_INPUT), 952 HDA_CODEC_MUTE("LINE1 pin Switch", 0x17, 0x2, HDA_INPUT),
969 HDA_CODEC_VOLUME("Mixer-4 Volume", 0x17, 0x3, HDA_INPUT), 953 HDA_CODEC_VOLUME("HP-OUT pin Volume", 0x17, 0x3, HDA_INPUT),
970 HDA_CODEC_MUTE("Mixer-4 Switch", 0x17, 0x3, HDA_INPUT), 954 HDA_CODEC_MUTE("HP-OUT pin Switch", 0x17, 0x3, HDA_INPUT),
971 HDA_CODEC_VOLUME("Mixer-5 Volume", 0x17, 0x4, HDA_INPUT), 955 HDA_CODEC_VOLUME("CD pin Volume", 0x17, 0x4, HDA_INPUT),
972 HDA_CODEC_MUTE("Mixer-5 Switch", 0x17, 0x4, HDA_INPUT), 956 HDA_CODEC_MUTE("CD pin Switch", 0x17, 0x4, HDA_INPUT),
973 { 957 {
974 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 958 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
975 .name = "Input Source", 959 .name = "Input Source",
@@ -978,16 +962,8 @@ static const struct snd_kcontrol_new cxt5045_test_mixer[] = {
978 .put = conexant_mux_enum_put, 962 .put = conexant_mux_enum_put,
979 }, 963 },
980 /* Audio input controls */ 964 /* Audio input controls */
981 HDA_CODEC_VOLUME("Input-1 Volume", 0x1a, 0x0, HDA_INPUT), 965 HDA_CODEC_VOLUME("Capture Volume", 0x1a, 0x0, HDA_INPUT),
982 HDA_CODEC_MUTE("Input-1 Switch", 0x1a, 0x0, HDA_INPUT), 966 HDA_CODEC_MUTE("Capture Switch", 0x1a, 0x0, HDA_INPUT),
983 HDA_CODEC_VOLUME("Input-2 Volume", 0x1a, 0x1, HDA_INPUT),
984 HDA_CODEC_MUTE("Input-2 Switch", 0x1a, 0x1, HDA_INPUT),
985 HDA_CODEC_VOLUME("Input-3 Volume", 0x1a, 0x2, HDA_INPUT),
986 HDA_CODEC_MUTE("Input-3 Switch", 0x1a, 0x2, HDA_INPUT),
987 HDA_CODEC_VOLUME("Input-4 Volume", 0x1a, 0x3, HDA_INPUT),
988 HDA_CODEC_MUTE("Input-4 Switch", 0x1a, 0x3, HDA_INPUT),
989 HDA_CODEC_VOLUME("Input-5 Volume", 0x1a, 0x4, HDA_INPUT),
990 HDA_CODEC_MUTE("Input-5 Switch", 0x1a, 0x4, HDA_INPUT),
991 { } /* end */ 967 { } /* end */
992}; 968};
993 969
@@ -1009,10 +985,6 @@ static const struct hda_verb cxt5045_test_init_verbs[] = {
1009 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 985 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1010 {0x18, AC_VERB_SET_DIGI_CONVERT_1, 0}, 986 {0x18, AC_VERB_SET_DIGI_CONVERT_1, 0},
1011 987
1012 /* Start with output sum widgets muted and their output gains at min */
1013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1014 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1015
1016 /* Unmute retasking pin widget output buffers since the default 988 /* Unmute retasking pin widget output buffers since the default
1017 * state appears to be output. As the pin mode is changed by the 989 * state appears to be output. As the pin mode is changed by the
1018 * user the pin mode control will take care of enabling the pin's 990 * user the pin mode control will take care of enabling the pin's
@@ -1027,11 +999,11 @@ static const struct hda_verb cxt5045_test_init_verbs[] = {
1027 /* Set ADC connection select to match default mixer setting (mic1 999 /* Set ADC connection select to match default mixer setting (mic1
1028 * pin) 1000 * pin)
1029 */ 1001 */
1030 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, 1002 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1031 {0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, 1003 {0x17, AC_VERB_SET_CONNECT_SEL, 0x01},
1032 1004
1033 /* Mute all inputs to mixer widget (even unconnected ones) */ 1005 /* Mute all inputs to mixer widget (even unconnected ones) */
1034 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* Mixer pin */ 1006 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* Mixer */
1035 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* Mic1 pin */ 1007 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* Mic1 pin */
1036 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* Line pin */ 1008 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* Line pin */
1037 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* HP pin */ 1009 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* HP pin */
@@ -1110,7 +1082,7 @@ static int patch_cxt5045(struct hda_codec *codec)
1110 if (!spec) 1082 if (!spec)
1111 return -ENOMEM; 1083 return -ENOMEM;
1112 codec->spec = spec; 1084 codec->spec = spec;
1113 codec->pin_amp_workaround = 1; 1085 codec->single_adc_amp = 1;
1114 1086
1115 spec->multiout.max_channels = 2; 1087 spec->multiout.max_channels = 2;
1116 spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids); 1088 spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids);
@@ -3999,9 +3971,14 @@ static void cx_auto_init_output(struct hda_codec *codec)
3999 int i; 3971 int i;
4000 3972
4001 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); 3973 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids);
4002 for (i = 0; i < cfg->hp_outs; i++) 3974 for (i = 0; i < cfg->hp_outs; i++) {
3975 unsigned int val = PIN_OUT;
3976 if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) &
3977 AC_PINCAP_HP_DRV)
3978 val |= AC_PINCTL_HP_EN;
4003 snd_hda_codec_write(codec, cfg->hp_pins[i], 0, 3979 snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
4004 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); 3980 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
3981 }
4005 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); 3982 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins);
4006 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); 3983 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins);
4007 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); 3984 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins);
@@ -4220,7 +4197,7 @@ static int cx_auto_add_capture_volume(struct hda_codec *codec, hda_nid_t nid,
4220 int idx = get_input_connection(codec, adc_nid, nid); 4197 int idx = get_input_connection(codec, adc_nid, nid);
4221 if (idx < 0) 4198 if (idx < 0)
4222 continue; 4199 continue;
4223 if (spec->single_adc_amp) 4200 if (codec->single_adc_amp)
4224 idx = 0; 4201 idx = 0;
4225 return cx_auto_add_volume_idx(codec, label, pfx, 4202 return cx_auto_add_volume_idx(codec, label, pfx,
4226 cidx, adc_nid, HDA_INPUT, idx); 4203 cidx, adc_nid, HDA_INPUT, idx);
@@ -4275,7 +4252,7 @@ static int cx_auto_build_input_controls(struct hda_codec *codec)
4275 if (cidx < 0) 4252 if (cidx < 0)
4276 continue; 4253 continue;
4277 input_conn[i] = spec->imux_info[i].adc; 4254 input_conn[i] = spec->imux_info[i].adc;
4278 if (!spec->single_adc_amp) 4255 if (!codec->single_adc_amp)
4279 input_conn[i] |= cidx << 8; 4256 input_conn[i] |= cidx << 8;
4280 if (i > 0 && input_conn[i] != input_conn[0]) 4257 if (i > 0 && input_conn[i] != input_conn[0])
4281 multi_connection = 1; 4258 multi_connection = 1;
@@ -4419,8 +4396,10 @@ static void apply_pin_fixup(struct hda_codec *codec,
4419 4396
4420enum { 4397enum {
4421 CXT_PINCFG_LENOVO_X200, 4398 CXT_PINCFG_LENOVO_X200,
4399 CXT_PINCFG_LENOVO_TP410,
4422}; 4400};
4423 4401
4402/* ThinkPad X200 & co with cxt5051 */
4424static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { 4403static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
4425 { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 4404 { 0x16, 0x042140ff }, /* HP (seq# overridden) */
4426 { 0x17, 0x21a11000 }, /* dock-mic */ 4405 { 0x17, 0x21a11000 }, /* dock-mic */
@@ -4429,15 +4408,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
4429 {} 4408 {}
4430}; 4409};
4431 4410
4411/* ThinkPad 410/420/510/520, X201 & co with cxt5066 */
4412static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = {
4413 { 0x19, 0x042110ff }, /* HP (seq# overridden) */
4414 { 0x1a, 0x21a190f0 }, /* dock-mic */
4415 { 0x1c, 0x212140ff }, /* dock-HP */
4416 {}
4417};
4418
4432static const struct cxt_pincfg *cxt_pincfg_tbl[] = { 4419static const struct cxt_pincfg *cxt_pincfg_tbl[] = {
4433 [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, 4420 [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200,
4421 [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410,
4434}; 4422};
4435 4423
4436static const struct snd_pci_quirk cxt_fixups[] = { 4424static const struct snd_pci_quirk cxt5051_fixups[] = {
4437 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), 4425 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
4438 {} 4426 {}
4439}; 4427};
4440 4428
4429static const struct snd_pci_quirk cxt5066_fixups[] = {
4430 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
4431 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410),
4432 SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410),
4433 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
4434 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
4435 {}
4436};
4437
4441/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches 4438/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
4442 * can be created (bko#42825) 4439 * can be created (bko#42825)
4443 */ 4440 */
@@ -4466,19 +4463,21 @@ static int patch_conexant_auto(struct hda_codec *codec)
4466 if (!spec) 4463 if (!spec)
4467 return -ENOMEM; 4464 return -ENOMEM;
4468 codec->spec = spec; 4465 codec->spec = spec;
4469 codec->pin_amp_workaround = 1;
4470 4466
4471 switch (codec->vendor_id) { 4467 switch (codec->vendor_id) {
4472 case 0x14f15045: 4468 case 0x14f15045:
4473 spec->single_adc_amp = 1; 4469 codec->single_adc_amp = 1;
4474 break; 4470 break;
4475 case 0x14f15051: 4471 case 0x14f15051:
4476 add_cx5051_fake_mutes(codec); 4472 add_cx5051_fake_mutes(codec);
4473 codec->pin_amp_workaround = 1;
4474 apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl);
4477 break; 4475 break;
4476 default:
4477 codec->pin_amp_workaround = 1;
4478 apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl);
4478 } 4479 }
4479 4480
4480 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
4481
4482 /* Show mute-led control only on HP laptops 4481 /* Show mute-led control only on HP laptops
4483 * This is a sort of white-list: on HP laptops, EAPD corresponds 4482 * This is a sort of white-list: on HP laptops, EAPD corresponds
4484 * only to the mute-LED without actualy amp function. Meanwhile, 4483 * only to the mute-LED without actualy amp function. Meanwhile,
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 540cd13f7f15..83f345f3c961 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -757,8 +757,6 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
757 struct hdmi_spec *spec = codec->spec; 757 struct hdmi_spec *spec = codec->spec;
758 int tag = res >> AC_UNSOL_RES_TAG_SHIFT; 758 int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
759 int pin_nid; 759 int pin_nid;
760 int pd = !!(res & AC_UNSOL_RES_PD);
761 int eldv = !!(res & AC_UNSOL_RES_ELDV);
762 int pin_idx; 760 int pin_idx;
763 struct hda_jack_tbl *jack; 761 struct hda_jack_tbl *jack;
764 762
@@ -768,9 +766,10 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
768 pin_nid = jack->nid; 766 pin_nid = jack->nid;
769 jack->jack_dirty = 1; 767 jack->jack_dirty = 1;
770 768
771 printk(KERN_INFO 769 _snd_printd(SND_PR_VERBOSE,
772 "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 770 "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
773 codec->addr, pin_nid, pd, eldv); 771 codec->addr, pin_nid,
772 !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV));
774 773
775 pin_idx = pin_nid_to_pin_index(spec, pin_nid); 774 pin_idx = pin_nid_to_pin_index(spec, pin_nid);
776 if (pin_idx < 0) 775 if (pin_idx < 0)
@@ -992,7 +991,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
992 if (eld->monitor_present) 991 if (eld->monitor_present)
993 eld_valid = !!(present & AC_PINSENSE_ELDV); 992 eld_valid = !!(present & AC_PINSENSE_ELDV);
994 993
995 printk(KERN_INFO 994 _snd_printd(SND_PR_VERBOSE,
996 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 995 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
997 codec->addr, pin_nid, eld->monitor_present, eld_valid); 996 codec->addr, pin_nid, eld->monitor_present, eld_valid);
998 997
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9917e55d6f11..7810913d07a0 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1445,6 +1445,13 @@ enum {
1445 ALC_FIXUP_ACT_BUILD, 1445 ALC_FIXUP_ACT_BUILD,
1446}; 1446};
1447 1447
1448static void alc_apply_pincfgs(struct hda_codec *codec,
1449 const struct alc_pincfg *cfg)
1450{
1451 for (; cfg->nid; cfg++)
1452 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1453}
1454
1448static void alc_apply_fixup(struct hda_codec *codec, int action) 1455static void alc_apply_fixup(struct hda_codec *codec, int action)
1449{ 1456{
1450 struct alc_spec *spec = codec->spec; 1457 struct alc_spec *spec = codec->spec;
@@ -1478,9 +1485,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action)
1478 snd_printdd(KERN_INFO "hda_codec: %s: " 1485 snd_printdd(KERN_INFO "hda_codec: %s: "
1479 "Apply pincfg for %s\n", 1486 "Apply pincfg for %s\n",
1480 codec->chip_name, modelname); 1487 codec->chip_name, modelname);
1481 for (; cfg->nid; cfg++) 1488 alc_apply_pincfgs(codec, cfg);
1482 snd_hda_codec_set_pincfg(codec, cfg->nid,
1483 cfg->val);
1484 break; 1489 break;
1485 case ALC_FIXUP_VERBS: 1490 case ALC_FIXUP_VERBS:
1486 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) 1491 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
@@ -3398,8 +3403,10 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3398 for (;;) { 3403 for (;;) {
3399 badness = fill_and_eval_dacs(codec, fill_hardwired, 3404 badness = fill_and_eval_dacs(codec, fill_hardwired,
3400 fill_mio_first); 3405 fill_mio_first);
3401 if (badness < 0) 3406 if (badness < 0) {
3407 kfree(best_cfg);
3402 return badness; 3408 return badness;
3409 }
3403 debug_badness("==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n", 3410 debug_badness("==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n",
3404 cfg->line_out_type, fill_hardwired, fill_mio_first, 3411 cfg->line_out_type, fill_hardwired, fill_mio_first,
3405 badness); 3412 badness);
@@ -3434,7 +3441,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3434 cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; 3441 cfg->line_out_type = AUTO_PIN_SPEAKER_OUT;
3435 fill_hardwired = true; 3442 fill_hardwired = true;
3436 continue; 3443 continue;
3437 } 3444 }
3438 if (cfg->hp_outs > 0 && 3445 if (cfg->hp_outs > 0 &&
3439 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { 3446 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
3440 cfg->speaker_outs = cfg->line_outs; 3447 cfg->speaker_outs = cfg->line_outs;
@@ -3448,7 +3455,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3448 cfg->line_out_type = AUTO_PIN_HP_OUT; 3455 cfg->line_out_type = AUTO_PIN_HP_OUT;
3449 fill_hardwired = true; 3456 fill_hardwired = true;
3450 continue; 3457 continue;
3451 } 3458 }
3452 break; 3459 break;
3453 } 3460 }
3454 3461
@@ -4423,7 +4430,7 @@ static int alc_parse_auto_config(struct hda_codec *codec,
4423static int alc880_parse_auto_config(struct hda_codec *codec) 4430static int alc880_parse_auto_config(struct hda_codec *codec)
4424{ 4431{
4425 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 4432 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4426 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; 4433 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
4427 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); 4434 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
4428} 4435}
4429 4436
@@ -4859,6 +4866,7 @@ enum {
4859 ALC260_FIXUP_GPIO1_TOGGLE, 4866 ALC260_FIXUP_GPIO1_TOGGLE,
4860 ALC260_FIXUP_REPLACER, 4867 ALC260_FIXUP_REPLACER,
4861 ALC260_FIXUP_HP_B1900, 4868 ALC260_FIXUP_HP_B1900,
4869 ALC260_FIXUP_KN1,
4862}; 4870};
4863 4871
4864static void alc260_gpio1_automute(struct hda_codec *codec) 4872static void alc260_gpio1_automute(struct hda_codec *codec)
@@ -4886,6 +4894,36 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
4886 } 4894 }
4887} 4895}
4888 4896
4897static void alc260_fixup_kn1(struct hda_codec *codec,
4898 const struct alc_fixup *fix, int action)
4899{
4900 struct alc_spec *spec = codec->spec;
4901 static const struct alc_pincfg pincfgs[] = {
4902 { 0x0f, 0x02214000 }, /* HP/speaker */
4903 { 0x12, 0x90a60160 }, /* int mic */
4904 { 0x13, 0x02a19000 }, /* ext mic */
4905 { 0x18, 0x01446000 }, /* SPDIF out */
4906 /* disable bogus I/O pins */
4907 { 0x10, 0x411111f0 },
4908 { 0x11, 0x411111f0 },
4909 { 0x14, 0x411111f0 },
4910 { 0x15, 0x411111f0 },
4911 { 0x16, 0x411111f0 },
4912 { 0x17, 0x411111f0 },
4913 { 0x19, 0x411111f0 },
4914 { }
4915 };
4916
4917 switch (action) {
4918 case ALC_FIXUP_ACT_PRE_PROBE:
4919 alc_apply_pincfgs(codec, pincfgs);
4920 break;
4921 case ALC_FIXUP_ACT_PROBE:
4922 spec->init_amp = ALC_INIT_NONE;
4923 break;
4924 }
4925}
4926
4889static const struct alc_fixup alc260_fixups[] = { 4927static const struct alc_fixup alc260_fixups[] = {
4890 [ALC260_FIXUP_HP_DC5750] = { 4928 [ALC260_FIXUP_HP_DC5750] = {
4891 .type = ALC_FIXUP_PINS, 4929 .type = ALC_FIXUP_PINS,
@@ -4936,7 +4974,11 @@ static const struct alc_fixup alc260_fixups[] = {
4936 .v.func = alc260_fixup_gpio1_toggle, 4974 .v.func = alc260_fixup_gpio1_toggle,
4937 .chained = true, 4975 .chained = true,
4938 .chain_id = ALC260_FIXUP_COEF, 4976 .chain_id = ALC260_FIXUP_COEF,
4939 } 4977 },
4978 [ALC260_FIXUP_KN1] = {
4979 .type = ALC_FIXUP_FUNC,
4980 .v.func = alc260_fixup_kn1,
4981 },
4940}; 4982};
4941 4983
4942static const struct snd_pci_quirk alc260_fixup_tbl[] = { 4984static const struct snd_pci_quirk alc260_fixup_tbl[] = {
@@ -4946,6 +4988,7 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = {
4946 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), 4988 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
4947 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), 4989 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
4948 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), 4990 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
4991 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
4949 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), 4992 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
4950 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), 4993 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
4951 {} 4994 {}
@@ -5269,7 +5312,9 @@ static const struct alc_fixup alc882_fixups[] = {
5269 { 0x16, 0x99130111 }, /* CLFE speaker */ 5312 { 0x16, 0x99130111 }, /* CLFE speaker */
5270 { 0x17, 0x99130112 }, /* surround speaker */ 5313 { 0x17, 0x99130112 }, /* surround speaker */
5271 { } 5314 { }
5272 } 5315 },
5316 .chained = true,
5317 .chain_id = ALC882_FIXUP_GPIO1,
5273 }, 5318 },
5274 [ALC882_FIXUP_ACER_ASPIRE_8930G] = { 5319 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
5275 .type = ALC_FIXUP_PINS, 5320 .type = ALC_FIXUP_PINS,
@@ -5312,7 +5357,9 @@ static const struct alc_fixup alc882_fixups[] = {
5312 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, 5357 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
5313 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, 5358 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
5314 { } 5359 { }
5315 } 5360 },
5361 .chained = true,
5362 .chain_id = ALC882_FIXUP_GPIO1,
5316 }, 5363 },
5317 [ALC885_FIXUP_MACPRO_GPIO] = { 5364 [ALC885_FIXUP_MACPRO_GPIO] = {
5318 .type = ALC_FIXUP_FUNC, 5365 .type = ALC_FIXUP_FUNC,
@@ -5358,7 +5405,10 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5358 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", 5405 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
5359 ALC882_FIXUP_ACER_ASPIRE_4930G), 5406 ALC882_FIXUP_ACER_ASPIRE_4930G),
5360 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), 5407 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
5408 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
5409 ALC882_FIXUP_ACER_ASPIRE_4930G),
5361 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), 5410 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
5411 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
5362 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), 5412 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
5363 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), 5413 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5364 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), 5414 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
@@ -5384,11 +5434,13 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5384 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), 5434 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
5385 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), 5435 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
5386 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), 5436 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
5437 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
5387 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), 5438 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
5388 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), 5439 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
5389 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), 5440 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
5390 5441
5391 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), 5442 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
5443 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
5392 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 5444 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5393 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD), 5445 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD),
5394 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), 5446 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
@@ -5399,6 +5451,13 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5399 {} 5451 {}
5400}; 5452};
5401 5453
5454static const struct alc_model_fixup alc882_fixup_models[] = {
5455 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
5456 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
5457 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
5458 {}
5459};
5460
5402/* 5461/*
5403 * BIOS auto configuration 5462 * BIOS auto configuration
5404 */ 5463 */
@@ -5439,7 +5498,8 @@ static int patch_alc882(struct hda_codec *codec)
5439 if (err < 0) 5498 if (err < 0)
5440 goto error; 5499 goto error;
5441 5500
5442 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); 5501 alc_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
5502 alc882_fixups);
5443 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); 5503 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5444 5504
5445 alc_auto_parse_customize_define(codec); 5505 alc_auto_parse_customize_define(codec);
@@ -5581,13 +5641,13 @@ static int patch_alc262(struct hda_codec *codec)
5581 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); 5641 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
5582 } 5642 }
5583#endif 5643#endif
5584 alc_auto_parse_customize_define(codec);
5585
5586 alc_fix_pll_init(codec, 0x20, 0x0a, 10); 5644 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
5587 5645
5588 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); 5646 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
5589 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); 5647 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5590 5648
5649 alc_auto_parse_customize_define(codec);
5650
5591 /* automatic parse from the BIOS config */ 5651 /* automatic parse from the BIOS config */
5592 err = alc262_parse_auto_config(codec); 5652 err = alc262_parse_auto_config(codec);
5593 if (err < 0) 5653 if (err < 0)
@@ -6052,6 +6112,7 @@ static const struct alc_fixup alc269_fixups[] = {
6052 6112
6053static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6113static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6054 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), 6114 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
6115 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
6055 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 6116 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
6056 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), 6117 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
6057 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), 6118 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
@@ -6079,7 +6140,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6079 * Basically the device should work as is without the fixup table. 6140 * Basically the device should work as is without the fixup table.
6080 * If BIOS doesn't give a proper info, enable the corresponding 6141 * If BIOS doesn't give a proper info, enable the corresponding
6081 * fixup entry. 6142 * fixup entry.
6082 */ 6143 */
6083 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 6144 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6084 ALC269_FIXUP_AMIC), 6145 ALC269_FIXUP_AMIC),
6085 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), 6146 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
@@ -6191,8 +6252,6 @@ static int patch_alc269(struct hda_codec *codec)
6191 6252
6192 spec->mixer_nid = 0x0b; 6253 spec->mixer_nid = 0x0b;
6193 6254
6194 alc_auto_parse_customize_define(codec);
6195
6196 err = alc_codec_rename_from_preset(codec); 6255 err = alc_codec_rename_from_preset(codec);
6197 if (err < 0) 6256 if (err < 0)
6198 goto error; 6257 goto error;
@@ -6225,6 +6284,8 @@ static int patch_alc269(struct hda_codec *codec)
6225 alc269_fixup_tbl, alc269_fixups); 6284 alc269_fixup_tbl, alc269_fixups);
6226 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); 6285 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
6227 6286
6287 alc_auto_parse_customize_define(codec);
6288
6228 /* automatic parse from the BIOS config */ 6289 /* automatic parse from the BIOS config */
6229 err = alc269_parse_auto_config(codec); 6290 err = alc269_parse_auto_config(codec);
6230 if (err < 0) 6291 if (err < 0)
@@ -6296,7 +6357,7 @@ static void alc_fixup_no_jack_detect(struct hda_codec *codec,
6296{ 6357{
6297 if (action == ALC_FIXUP_ACT_PRE_PROBE) 6358 if (action == ALC_FIXUP_ACT_PRE_PROBE)
6298 codec->no_jack_detect = 1; 6359 codec->no_jack_detect = 1;
6299} 6360}
6300 6361
6301static const struct alc_fixup alc861_fixups[] = { 6362static const struct alc_fixup alc861_fixups[] = {
6302 [ALC861_FIXUP_FSC_AMILO_PI1505] = { 6363 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
@@ -6714,7 +6775,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6714 * Basically the device should work as is without the fixup table. 6775 * Basically the device should work as is without the fixup table.
6715 * If BIOS doesn't give a proper info, enable the corresponding 6776 * If BIOS doesn't give a proper info, enable the corresponding
6716 * fixup entry. 6777 * fixup entry.
6717 */ 6778 */
6718 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), 6779 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
6719 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), 6780 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
6720 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), 6781 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
@@ -6801,8 +6862,6 @@ static int patch_alc662(struct hda_codec *codec)
6801 /* handle multiple HPs as is */ 6862 /* handle multiple HPs as is */
6802 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; 6863 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6803 6864
6804 alc_auto_parse_customize_define(codec);
6805
6806 alc_fix_pll_init(codec, 0x20, 0x04, 15); 6865 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6807 6866
6808 err = alc_codec_rename_from_preset(codec); 6867 err = alc_codec_rename_from_preset(codec);
@@ -6819,6 +6878,9 @@ static int patch_alc662(struct hda_codec *codec)
6819 alc_pick_fixup(codec, alc662_fixup_models, 6878 alc_pick_fixup(codec, alc662_fixup_models,
6820 alc662_fixup_tbl, alc662_fixups); 6879 alc662_fixup_tbl, alc662_fixups);
6821 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); 6880 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
6881
6882 alc_auto_parse_customize_define(codec);
6883
6822 /* automatic parse from the BIOS config */ 6884 /* automatic parse from the BIOS config */
6823 err = alc662_parse_auto_config(codec); 6885 err = alc662_parse_auto_config(codec);
6824 if (err < 0) 6886 if (err < 0)
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 33a9946b492c..2cb1e08f962a 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4415,9 +4415,9 @@ static int stac92xx_init(struct hda_codec *codec)
4415 def_conf = get_defcfg_connect(def_conf); 4415 def_conf = get_defcfg_connect(def_conf);
4416 /* skip any ports that don't have jacks since presence 4416 /* skip any ports that don't have jacks since presence
4417 * detection is useless */ 4417 * detection is useless */
4418 if (def_conf != AC_JACK_PORT_COMPLEX) { 4418 if (def_conf != AC_JACK_PORT_NONE &&
4419 if (def_conf != AC_JACK_PORT_NONE) 4419 !is_jack_detectable(codec, nid)) {
4420 stac_toggle_power_map(codec, nid, 1); 4420 stac_toggle_power_map(codec, nid, 1);
4421 continue; 4421 continue;
4422 } 4422 }
4423 if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) { 4423 if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) {
@@ -5063,12 +5063,11 @@ static void stac92xx_update_led_status(struct hda_codec *codec, int enabled)
5063 if (spec->gpio_led_polarity) 5063 if (spec->gpio_led_polarity)
5064 muted = !muted; 5064 muted = !muted;
5065 5065
5066 /*polarity defines *not* muted state level*/
5067 if (!spec->vref_mute_led_nid) { 5066 if (!spec->vref_mute_led_nid) {
5068 if (muted) 5067 if (muted)
5069 spec->gpio_data &= ~spec->gpio_led; /* orange */ 5068 spec->gpio_data |= spec->gpio_led;
5070 else 5069 else
5071 spec->gpio_data |= spec->gpio_led; /* white */ 5070 spec->gpio_data &= ~spec->gpio_led;
5072 stac_gpio_set(codec, spec->gpio_mask, 5071 stac_gpio_set(codec, spec->gpio_mask,
5073 spec->gpio_dir, spec->gpio_data); 5072 spec->gpio_dir, spec->gpio_data);
5074 } else { 5073 } else {
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index b68cdec03b9e..0b2aea2ce172 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -5170,6 +5170,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
5170 strcpy(hw->name, "HDSP hwdep interface"); 5170 strcpy(hw->name, "HDSP hwdep interface");
5171 5171
5172 hw->ops.ioctl = snd_hdsp_hwdep_ioctl; 5172 hw->ops.ioctl = snd_hdsp_hwdep_ioctl;
5173 hw->ops.ioctl_compat = snd_hdsp_hwdep_ioctl;
5173 5174
5174 return 0; 5175 return 0;
5175} 5176}
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c
index df3ac73f8778..b39ad356b92b 100644
--- a/sound/soc/blackfin/bf5xx-ssm2602.c
+++ b/sound/soc/blackfin/bf5xx-ssm2602.c
@@ -99,6 +99,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
99 .platform_name = "bfin-i2s-pcm-audio", 99 .platform_name = "bfin-i2s-pcm-audio",
100 .codec_name = "ssm2602.0-001b", 100 .codec_name = "ssm2602.0-001b",
101 .ops = &bf5xx_ssm2602_ops, 101 .ops = &bf5xx_ssm2602_ops,
102 .dai_fmt = BF5XX_SSM2602_DAIFMT,
102 }, 103 },
103 { 104 {
104 .name = "ssm2602", 105 .name = "ssm2602",
@@ -108,6 +109,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
108 .platform_name = "bfin-i2s-pcm-audio", 109 .platform_name = "bfin-i2s-pcm-audio",
109 .codec_name = "ssm2602.0-001b", 110 .codec_name = "ssm2602.0-001b",
110 .ops = &bf5xx_ssm2602_ops, 111 .ops = &bf5xx_ssm2602_ops,
112 .dai_fmt = BF5XX_SSM2602_DAIFMT,
111 }, 113 },
112}; 114};
113 115
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 6508e8b790bb..59d8efaa17e9 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -57,7 +57,7 @@ config SND_SOC_ALL_CODECS
57 select SND_SOC_TPA6130A2 if I2C 57 select SND_SOC_TPA6130A2 if I2C
58 select SND_SOC_TLV320DAC33 if I2C 58 select SND_SOC_TLV320DAC33 if I2C
59 select SND_SOC_TWL4030 if TWL4030_CORE 59 select SND_SOC_TWL4030 if TWL4030_CORE
60 select SND_SOC_TWL6040 if TWL4030_CORE 60 select SND_SOC_TWL6040 if TWL6040_CORE
61 select SND_SOC_UDA134X 61 select SND_SOC_UDA134X
62 select SND_SOC_UDA1380 if I2C 62 select SND_SOC_UDA1380 if I2C
63 select SND_SOC_WL1273 if MFD_WL1273_CORE 63 select SND_SOC_WL1273 if MFD_WL1273_CORE
@@ -276,7 +276,6 @@ config SND_SOC_TWL4030
276 tristate 276 tristate
277 277
278config SND_SOC_TWL6040 278config SND_SOC_TWL6040
279 select TWL6040_CORE
280 tristate 279 tristate
281 280
282config SND_SOC_UDA134X 281config SND_SOC_UDA134X
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index f8e10ced244a..b3e24f289421 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -140,7 +140,7 @@
140 * min : 0xFE : -115.0 dB 140 * min : 0xFE : -115.0 dB
141 * mute: 0xFF 141 * mute: 0xFF
142 */ 142 */
143static const DECLARE_TLV_DB_SCALE(out_tlv, -11500, 50, 1); 143static const DECLARE_TLV_DB_SCALE(out_tlv, -11550, 50, 1);
144 144
145static const struct snd_kcontrol_new ak4642_snd_controls[] = { 145static const struct snd_kcontrol_new ak4642_snd_controls[] = {
146 146
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 78979b3e0e95..3686417f5ea5 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -568,22 +568,22 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = {
568 attn_tlv), 568 attn_tlv),
569 569
570 SOC_SINGLE_TLV("SPK-IP Mono Volume", 570 SOC_SINGLE_TLV("SPK-IP Mono Volume",
571 CS42L73_SPKMIPMA, 0, 0x3E, 1, attn_tlv), 571 CS42L73_SPKMIPMA, 0, 0x3F, 1, attn_tlv),
572 SOC_SINGLE_TLV("SPK-XSP Mono Volume", 572 SOC_SINGLE_TLV("SPK-XSP Mono Volume",
573 CS42L73_SPKMXSPA, 0, 0x3E, 1, attn_tlv), 573 CS42L73_SPKMXSPA, 0, 0x3F, 1, attn_tlv),
574 SOC_SINGLE_TLV("SPK-ASP Mono Volume", 574 SOC_SINGLE_TLV("SPK-ASP Mono Volume",
575 CS42L73_SPKMASPA, 0, 0x3E, 1, attn_tlv), 575 CS42L73_SPKMASPA, 0, 0x3F, 1, attn_tlv),
576 SOC_SINGLE_TLV("SPK-VSP Mono Volume", 576 SOC_SINGLE_TLV("SPK-VSP Mono Volume",
577 CS42L73_SPKMVSPMA, 0, 0x3E, 1, attn_tlv), 577 CS42L73_SPKMVSPMA, 0, 0x3F, 1, attn_tlv),
578 578
579 SOC_SINGLE_TLV("ESL-IP Mono Volume", 579 SOC_SINGLE_TLV("ESL-IP Mono Volume",
580 CS42L73_ESLMIPMA, 0, 0x3E, 1, attn_tlv), 580 CS42L73_ESLMIPMA, 0, 0x3F, 1, attn_tlv),
581 SOC_SINGLE_TLV("ESL-XSP Mono Volume", 581 SOC_SINGLE_TLV("ESL-XSP Mono Volume",
582 CS42L73_ESLMXSPA, 0, 0x3E, 1, attn_tlv), 582 CS42L73_ESLMXSPA, 0, 0x3F, 1, attn_tlv),
583 SOC_SINGLE_TLV("ESL-ASP Mono Volume", 583 SOC_SINGLE_TLV("ESL-ASP Mono Volume",
584 CS42L73_ESLMASPA, 0, 0x3E, 1, attn_tlv), 584 CS42L73_ESLMASPA, 0, 0x3F, 1, attn_tlv),
585 SOC_SINGLE_TLV("ESL-VSP Mono Volume", 585 SOC_SINGLE_TLV("ESL-VSP Mono Volume",
586 CS42L73_ESLMVSPMA, 0, 0x3E, 1, attn_tlv), 586 CS42L73_ESLMVSPMA, 0, 0x3F, 1, attn_tlv),
587 587
588 SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum), 588 SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum),
589 589
@@ -929,6 +929,8 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq)
929 929
930 /* MCLKX -> MCLK */ 930 /* MCLKX -> MCLK */
931 mclkx_coeff = cs42l73_get_mclkx_coeff(freq); 931 mclkx_coeff = cs42l73_get_mclkx_coeff(freq);
932 if (mclkx_coeff < 0)
933 return mclkx_coeff;
932 934
933 mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / 935 mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx /
934 cs42l73_mclkx_coeffs[mclkx_coeff].ratio; 936 cs42l73_mclkx_coeffs[mclkx_coeff].ratio;
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index d1926266fe00..8e92fb88ed09 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -143,11 +143,11 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w,
143} 143}
144 144
145/* 145/*
146 * using codec assist to small pop, hp_powerup or lineout_powerup 146 * As manual described, ADC/DAC only works when VAG powerup,
147 * should stay setting until vag_powerup is fully ramped down, 147 * So enabled VAG before ADC/DAC up.
148 * vag fully ramped down require 400ms. 148 * In power down case, we need wait 400ms when vag fully ramped down.
149 */ 149 */
150static int small_pop_event(struct snd_soc_dapm_widget *w, 150static int power_vag_event(struct snd_soc_dapm_widget *w,
151 struct snd_kcontrol *kcontrol, int event) 151 struct snd_kcontrol *kcontrol, int event)
152{ 152{
153 switch (event) { 153 switch (event) {
@@ -156,7 +156,7 @@ static int small_pop_event(struct snd_soc_dapm_widget *w,
156 SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); 156 SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);
157 break; 157 break;
158 158
159 case SND_SOC_DAPM_PRE_PMD: 159 case SND_SOC_DAPM_POST_PMD:
160 snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, 160 snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
161 SGTL5000_VAG_POWERUP, 0); 161 SGTL5000_VAG_POWERUP, 0);
162 msleep(400); 162 msleep(400);
@@ -201,12 +201,8 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = {
201 mic_bias_event, 201 mic_bias_event,
202 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 202 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
203 203
204 SND_SOC_DAPM_PGA_E("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0, 204 SND_SOC_DAPM_PGA("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0),
205 small_pop_event, 205 SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0),
206 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
207 SND_SOC_DAPM_PGA_E("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0,
208 small_pop_event,
209 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
210 206
211 SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), 207 SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux),
212 SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), 208 SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux),
@@ -221,8 +217,11 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = {
221 0, SGTL5000_CHIP_DIG_POWER, 217 0, SGTL5000_CHIP_DIG_POWER,
222 1, 0), 218 1, 0),
223 219
224 SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), 220 SND_SOC_DAPM_SUPPLY("VAG_POWER", SGTL5000_CHIP_ANA_POWER, 7, 0,
221 power_vag_event,
222 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
225 223
224 SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0),
226 SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), 225 SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0),
227}; 226};
228 227
@@ -231,9 +230,11 @@ static const struct snd_soc_dapm_route sgtl5000_dapm_routes[] = {
231 {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ 230 {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */
232 {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ 231 {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */
233 232
233 {"ADC", NULL, "VAG_POWER"},
234 {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ 234 {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */
235 {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ 235 {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */
236 236
237 {"DAC", NULL, "VAG_POWER"},
237 {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ 238 {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */
238 {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ 239 {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */
239 {"LO", NULL, "DAC"}, /* dac --> line_out */ 240 {"LO", NULL, "DAC"}, /* dac --> line_out */
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 16d55f91a653..df1e07ffac32 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -472,7 +472,7 @@ static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai,
472static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, 472static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
473 enum snd_soc_bias_level level) 473 enum snd_soc_bias_level level)
474{ 474{
475 u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0xff7f; 475 u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0x17f;
476 476
477 switch (level) { 477 switch (level) {
478 case SND_SOC_BIAS_ON: 478 case SND_SOC_BIAS_ON:
@@ -491,7 +491,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
491 case SND_SOC_BIAS_OFF: 491 case SND_SOC_BIAS_OFF:
492 /* everything off, dac mute, inactive */ 492 /* everything off, dac mute, inactive */
493 snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); 493 snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0);
494 snd_soc_write(codec, TLV320AIC23_PWR, 0xffff); 494 snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff);
495 break; 495 break;
496 } 496 }
497 codec->dapm.bias_level = level; 497 codec->dapm.bias_level = level;
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 2d8c6b825e57..dc7509b9d53a 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -26,7 +26,6 @@
26#include <linux/pm.h> 26#include <linux/pm.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/i2c/twl.h>
30#include <linux/mfd/twl6040.h> 29#include <linux/mfd/twl6040.h>
31 30
32#include <sound/core.h> 31#include <sound/core.h>
@@ -1528,7 +1527,7 @@ static int twl6040_resume(struct snd_soc_codec *codec)
1528static int twl6040_probe(struct snd_soc_codec *codec) 1527static int twl6040_probe(struct snd_soc_codec *codec)
1529{ 1528{
1530 struct twl6040_data *priv; 1529 struct twl6040_data *priv;
1531 struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); 1530 struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev);
1532 struct platform_device *pdev = container_of(codec->dev, 1531 struct platform_device *pdev = container_of(codec->dev,
1533 struct platform_device, dev); 1532 struct platform_device, dev);
1534 int ret = 0; 1533 int ret = 0;
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 8c4c9591ec05..aa12c6b6beeb 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -60,7 +60,7 @@ struct wm8350_jack_data {
60}; 60};
61 61
62struct wm8350_data { 62struct wm8350_data {
63 struct snd_soc_codec codec; 63 struct wm8350 *wm8350;
64 struct wm8350_output out1; 64 struct wm8350_output out1;
65 struct wm8350_output out2; 65 struct wm8350_output out2;
66 struct wm8350_jack_data hpl; 66 struct wm8350_jack_data hpl;
@@ -1309,7 +1309,7 @@ static void wm8350_hp_work(struct wm8350_data *priv,
1309 struct wm8350_jack_data *jack, 1309 struct wm8350_jack_data *jack,
1310 u16 mask) 1310 u16 mask)
1311{ 1311{
1312 struct wm8350 *wm8350 = priv->codec.control_data; 1312 struct wm8350 *wm8350 = priv->wm8350;
1313 u16 reg; 1313 u16 reg;
1314 int report; 1314 int report;
1315 1315
@@ -1342,7 +1342,7 @@ static void wm8350_hpr_work(struct work_struct *work)
1342static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) 1342static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
1343{ 1343{
1344 struct wm8350_data *priv = data; 1344 struct wm8350_data *priv = data;
1345 struct wm8350 *wm8350 = priv->codec.control_data; 1345 struct wm8350 *wm8350 = priv->wm8350;
1346 struct wm8350_jack_data *jack = NULL; 1346 struct wm8350_jack_data *jack = NULL;
1347 1347
1348 switch (irq - wm8350->irq_base) { 1348 switch (irq - wm8350->irq_base) {
@@ -1427,7 +1427,7 @@ EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect);
1427static irqreturn_t wm8350_mic_handler(int irq, void *data) 1427static irqreturn_t wm8350_mic_handler(int irq, void *data)
1428{ 1428{
1429 struct wm8350_data *priv = data; 1429 struct wm8350_data *priv = data;
1430 struct wm8350 *wm8350 = priv->codec.control_data; 1430 struct wm8350 *wm8350 = priv->wm8350;
1431 u16 reg; 1431 u16 reg;
1432 int report = 0; 1432 int report = 0;
1433 1433
@@ -1536,6 +1536,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1536 return -ENOMEM; 1536 return -ENOMEM;
1537 snd_soc_codec_set_drvdata(codec, priv); 1537 snd_soc_codec_set_drvdata(codec, priv);
1538 1538
1539 priv->wm8350 = wm8350;
1540
1539 for (i = 0; i < ARRAY_SIZE(supply_names); i++) 1541 for (i = 0; i < ARRAY_SIZE(supply_names); i++)
1540 priv->supplies[i].supply = supply_names[i]; 1542 priv->supplies[i].supply = supply_names[i];
1541 1543
@@ -1544,7 +1546,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1544 if (ret != 0) 1546 if (ret != 0)
1545 return ret; 1547 return ret;
1546 1548
1547 wm8350->codec.codec = codec;
1548 codec->control_data = wm8350; 1549 codec->control_data = wm8350;
1549 1550
1550 /* Put the codec into reset if it wasn't already */ 1551 /* Put the codec into reset if it wasn't already */
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 7c49642af052..2de12ebe43b5 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1000,61 +1000,170 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec)
1000 } 1000 }
1001} 1001}
1002 1002
1003static int late_enable_ev(struct snd_soc_dapm_widget *w, 1003static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1004 struct snd_kcontrol *kcontrol, int event) 1004 struct snd_kcontrol *kcontrol, int event)
1005{ 1005{
1006 struct snd_soc_codec *codec = w->codec; 1006 struct snd_soc_codec *codec = w->codec;
1007 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 1007 struct wm8994 *control = codec->control_data;
1008 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
1009 int dac;
1010 int adc;
1011 int val;
1012
1013 switch (control->type) {
1014 case WM8994:
1015 case WM8958:
1016 mask |= WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA;
1017 break;
1018 default:
1019 break;
1020 }
1008 1021
1009 switch (event) { 1022 switch (event) {
1010 case SND_SOC_DAPM_PRE_PMU: 1023 case SND_SOC_DAPM_PRE_PMU:
1011 if (wm8994->aif1clk_enable) { 1024 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1);
1012 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1025 if ((val & WM8994_AIF1ADCL_SRC) &&
1013 WM8994_AIF1CLK_ENA_MASK, 1026 (val & WM8994_AIF1ADCR_SRC))
1014 WM8994_AIF1CLK_ENA); 1027 adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA;
1015 wm8994->aif1clk_enable = 0; 1028 else if (!(val & WM8994_AIF1ADCL_SRC) &&
1016 } 1029 !(val & WM8994_AIF1ADCR_SRC))
1017 if (wm8994->aif2clk_enable) { 1030 adc = WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA;
1018 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1031 else
1019 WM8994_AIF2CLK_ENA_MASK, 1032 adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA |
1020 WM8994_AIF2CLK_ENA); 1033 WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA;
1021 wm8994->aif2clk_enable = 0; 1034
1022 } 1035 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_2);
1036 if ((val & WM8994_AIF1DACL_SRC) &&
1037 (val & WM8994_AIF1DACR_SRC))
1038 dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA;
1039 else if (!(val & WM8994_AIF1DACL_SRC) &&
1040 !(val & WM8994_AIF1DACR_SRC))
1041 dac = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA;
1042 else
1043 dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA |
1044 WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA;
1045
1046 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
1047 mask, adc);
1048 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1049 mask, dac);
1050 snd_soc_update_bits(codec, WM8994_CLOCKING_1,
1051 WM8994_AIF1DSPCLK_ENA |
1052 WM8994_SYSDSPCLK_ENA,
1053 WM8994_AIF1DSPCLK_ENA |
1054 WM8994_SYSDSPCLK_ENA);
1055 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, mask,
1056 WM8994_AIF1ADC1R_ENA |
1057 WM8994_AIF1ADC1L_ENA |
1058 WM8994_AIF1ADC2R_ENA |
1059 WM8994_AIF1ADC2L_ENA);
1060 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, mask,
1061 WM8994_AIF1DAC1R_ENA |
1062 WM8994_AIF1DAC1L_ENA |
1063 WM8994_AIF1DAC2R_ENA |
1064 WM8994_AIF1DAC2L_ENA);
1023 break; 1065 break;
1024 }
1025 1066
1026 /* We may also have postponed startup of DSP, handle that. */ 1067 case SND_SOC_DAPM_PRE_PMD:
1027 wm8958_aif_ev(w, kcontrol, event); 1068 case SND_SOC_DAPM_POST_PMD:
1069 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1070 mask, 0);
1071 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
1072 mask, 0);
1073
1074 val = snd_soc_read(codec, WM8994_CLOCKING_1);
1075 if (val & WM8994_AIF2DSPCLK_ENA)
1076 val = WM8994_SYSDSPCLK_ENA;
1077 else
1078 val = 0;
1079 snd_soc_update_bits(codec, WM8994_CLOCKING_1,
1080 WM8994_SYSDSPCLK_ENA |
1081 WM8994_AIF1DSPCLK_ENA, val);
1082 break;
1083 }
1028 1084
1029 return 0; 1085 return 0;
1030} 1086}
1031 1087
1032static int late_disable_ev(struct snd_soc_dapm_widget *w, 1088static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1033 struct snd_kcontrol *kcontrol, int event) 1089 struct snd_kcontrol *kcontrol, int event)
1034{ 1090{
1035 struct snd_soc_codec *codec = w->codec; 1091 struct snd_soc_codec *codec = w->codec;
1036 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 1092 int dac;
1093 int adc;
1094 int val;
1037 1095
1038 switch (event) { 1096 switch (event) {
1097 case SND_SOC_DAPM_PRE_PMU:
1098 val = snd_soc_read(codec, WM8994_AIF2_CONTROL_1);
1099 if ((val & WM8994_AIF2ADCL_SRC) &&
1100 (val & WM8994_AIF2ADCR_SRC))
1101 adc = WM8994_AIF2ADCR_ENA;
1102 else if (!(val & WM8994_AIF2ADCL_SRC) &&
1103 !(val & WM8994_AIF2ADCR_SRC))
1104 adc = WM8994_AIF2ADCL_ENA;
1105 else
1106 adc = WM8994_AIF2ADCL_ENA | WM8994_AIF2ADCR_ENA;
1107
1108
1109 val = snd_soc_read(codec, WM8994_AIF2_CONTROL_2);
1110 if ((val & WM8994_AIF2DACL_SRC) &&
1111 (val & WM8994_AIF2DACR_SRC))
1112 dac = WM8994_AIF2DACR_ENA;
1113 else if (!(val & WM8994_AIF2DACL_SRC) &&
1114 !(val & WM8994_AIF2DACR_SRC))
1115 dac = WM8994_AIF2DACL_ENA;
1116 else
1117 dac = WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA;
1118
1119 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
1120 WM8994_AIF2ADCL_ENA |
1121 WM8994_AIF2ADCR_ENA, adc);
1122 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1123 WM8994_AIF2DACL_ENA |
1124 WM8994_AIF2DACR_ENA, dac);
1125 snd_soc_update_bits(codec, WM8994_CLOCKING_1,
1126 WM8994_AIF2DSPCLK_ENA |
1127 WM8994_SYSDSPCLK_ENA,
1128 WM8994_AIF2DSPCLK_ENA |
1129 WM8994_SYSDSPCLK_ENA);
1130 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
1131 WM8994_AIF2ADCL_ENA |
1132 WM8994_AIF2ADCR_ENA,
1133 WM8994_AIF2ADCL_ENA |
1134 WM8994_AIF2ADCR_ENA);
1135 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1136 WM8994_AIF2DACL_ENA |
1137 WM8994_AIF2DACR_ENA,
1138 WM8994_AIF2DACL_ENA |
1139 WM8994_AIF2DACR_ENA);
1140 break;
1141
1142 case SND_SOC_DAPM_PRE_PMD:
1039 case SND_SOC_DAPM_POST_PMD: 1143 case SND_SOC_DAPM_POST_PMD:
1040 if (wm8994->aif1clk_disable) { 1144 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1041 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1145 WM8994_AIF2DACL_ENA |
1042 WM8994_AIF1CLK_ENA_MASK, 0); 1146 WM8994_AIF2DACR_ENA, 0);
1043 wm8994->aif1clk_disable = 0; 1147 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
1044 } 1148 WM8994_AIF2ADCL_ENA |
1045 if (wm8994->aif2clk_disable) { 1149 WM8994_AIF2ADCR_ENA, 0);
1046 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1150
1047 WM8994_AIF2CLK_ENA_MASK, 0); 1151 val = snd_soc_read(codec, WM8994_CLOCKING_1);
1048 wm8994->aif2clk_disable = 0; 1152 if (val & WM8994_AIF1DSPCLK_ENA)
1049 } 1153 val = WM8994_SYSDSPCLK_ENA;
1154 else
1155 val = 0;
1156 snd_soc_update_bits(codec, WM8994_CLOCKING_1,
1157 WM8994_SYSDSPCLK_ENA |
1158 WM8994_AIF2DSPCLK_ENA, val);
1050 break; 1159 break;
1051 } 1160 }
1052 1161
1053 return 0; 1162 return 0;
1054} 1163}
1055 1164
1056static int aif1clk_ev(struct snd_soc_dapm_widget *w, 1165static int aif1clk_late_ev(struct snd_soc_dapm_widget *w,
1057 struct snd_kcontrol *kcontrol, int event) 1166 struct snd_kcontrol *kcontrol, int event)
1058{ 1167{
1059 struct snd_soc_codec *codec = w->codec; 1168 struct snd_soc_codec *codec = w->codec;
1060 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 1169 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
@@ -1071,8 +1180,8 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1071 return 0; 1180 return 0;
1072} 1181}
1073 1182
1074static int aif2clk_ev(struct snd_soc_dapm_widget *w, 1183static int aif2clk_late_ev(struct snd_soc_dapm_widget *w,
1075 struct snd_kcontrol *kcontrol, int event) 1184 struct snd_kcontrol *kcontrol, int event)
1076{ 1185{
1077 struct snd_soc_codec *codec = w->codec; 1186 struct snd_soc_codec *codec = w->codec;
1078 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 1187 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
@@ -1089,6 +1198,63 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1089 return 0; 1198 return 0;
1090} 1199}
1091 1200
1201static int late_enable_ev(struct snd_soc_dapm_widget *w,
1202 struct snd_kcontrol *kcontrol, int event)
1203{
1204 struct snd_soc_codec *codec = w->codec;
1205 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1206
1207 switch (event) {
1208 case SND_SOC_DAPM_PRE_PMU:
1209 if (wm8994->aif1clk_enable) {
1210 aif1clk_ev(w, kcontrol, event);
1211 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1212 WM8994_AIF1CLK_ENA_MASK,
1213 WM8994_AIF1CLK_ENA);
1214 wm8994->aif1clk_enable = 0;
1215 }
1216 if (wm8994->aif2clk_enable) {
1217 aif2clk_ev(w, kcontrol, event);
1218 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1219 WM8994_AIF2CLK_ENA_MASK,
1220 WM8994_AIF2CLK_ENA);
1221 wm8994->aif2clk_enable = 0;
1222 }
1223 break;
1224 }
1225
1226 /* We may also have postponed startup of DSP, handle that. */
1227 wm8958_aif_ev(w, kcontrol, event);
1228
1229 return 0;
1230}
1231
1232static int late_disable_ev(struct snd_soc_dapm_widget *w,
1233 struct snd_kcontrol *kcontrol, int event)
1234{
1235 struct snd_soc_codec *codec = w->codec;
1236 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1237
1238 switch (event) {
1239 case SND_SOC_DAPM_POST_PMD:
1240 if (wm8994->aif1clk_disable) {
1241 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1242 WM8994_AIF1CLK_ENA_MASK, 0);
1243 aif1clk_ev(w, kcontrol, event);
1244 wm8994->aif1clk_disable = 0;
1245 }
1246 if (wm8994->aif2clk_disable) {
1247 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1248 WM8994_AIF2CLK_ENA_MASK, 0);
1249 aif2clk_ev(w, kcontrol, event);
1250 wm8994->aif2clk_disable = 0;
1251 }
1252 break;
1253 }
1254
1255 return 0;
1256}
1257
1092static int adc_mux_ev(struct snd_soc_dapm_widget *w, 1258static int adc_mux_ev(struct snd_soc_dapm_widget *w,
1093 struct snd_kcontrol *kcontrol, int event) 1259 struct snd_kcontrol *kcontrol, int event)
1094{ 1260{
@@ -1385,9 +1551,9 @@ static const struct snd_kcontrol_new aif2dacr_src_mux =
1385 SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); 1551 SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum);
1386 1552
1387static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = { 1553static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = {
1388SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_ev, 1554SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_late_ev,
1389 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 1555 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1390SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_ev, 1556SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_late_ev,
1391 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 1557 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1392 1558
1393SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, 1559SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0,
@@ -1416,8 +1582,10 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev)
1416}; 1582};
1417 1583
1418static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { 1584static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = {
1419SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), 1585SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev,
1420SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), 1586 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
1587SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev,
1588 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
1421SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0), 1589SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0),
1422SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0, 1590SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0,
1423 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)), 1591 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)),
@@ -1470,30 +1638,30 @@ SND_SOC_DAPM_SUPPLY("VMID", SND_SOC_NOPM, 0, 0, vmid_event,
1470SND_SOC_DAPM_SUPPLY("CLK_SYS", SND_SOC_NOPM, 0, 0, clk_sys_event, 1638SND_SOC_DAPM_SUPPLY("CLK_SYS", SND_SOC_NOPM, 0, 0, clk_sys_event,
1471 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 1639 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1472 1640
1473SND_SOC_DAPM_SUPPLY("DSP1CLK", WM8994_CLOCKING_1, 3, 0, NULL, 0), 1641SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM, 3, 0, NULL, 0),
1474SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), 1642SND_SOC_DAPM_SUPPLY("DSP2CLK", SND_SOC_NOPM, 2, 0, NULL, 0),
1475SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), 1643SND_SOC_DAPM_SUPPLY("DSPINTCLK", SND_SOC_NOPM, 1, 0, NULL, 0),
1476 1644
1477SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, 1645SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL,
1478 0, WM8994_POWER_MANAGEMENT_4, 9, 0), 1646 0, SND_SOC_NOPM, 9, 0),
1479SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, 1647SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL,
1480 0, WM8994_POWER_MANAGEMENT_4, 8, 0), 1648 0, SND_SOC_NOPM, 8, 0),
1481SND_SOC_DAPM_AIF_IN_E("AIF1DAC1L", NULL, 0, 1649SND_SOC_DAPM_AIF_IN_E("AIF1DAC1L", NULL, 0,
1482 WM8994_POWER_MANAGEMENT_5, 9, 0, wm8958_aif_ev, 1650 SND_SOC_NOPM, 9, 0, wm8958_aif_ev,
1483 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 1651 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
1484SND_SOC_DAPM_AIF_IN_E("AIF1DAC1R", NULL, 0, 1652SND_SOC_DAPM_AIF_IN_E("AIF1DAC1R", NULL, 0,
1485 WM8994_POWER_MANAGEMENT_5, 8, 0, wm8958_aif_ev, 1653 SND_SOC_NOPM, 8, 0, wm8958_aif_ev,
1486 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 1654 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
1487 1655
1488SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL, 1656SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL,
1489 0, WM8994_POWER_MANAGEMENT_4, 11, 0), 1657 0, SND_SOC_NOPM, 11, 0),
1490SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL, 1658SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL,
1491 0, WM8994_POWER_MANAGEMENT_4, 10, 0), 1659 0, SND_SOC_NOPM, 10, 0),
1492SND_SOC_DAPM_AIF_IN_E("AIF1DAC2L", NULL, 0, 1660SND_SOC_DAPM_AIF_IN_E("AIF1DAC2L", NULL, 0,
1493 WM8994_POWER_MANAGEMENT_5, 11, 0, wm8958_aif_ev, 1661 SND_SOC_NOPM, 11, 0, wm8958_aif_ev,
1494 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 1662 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
1495SND_SOC_DAPM_AIF_IN_E("AIF1DAC2R", NULL, 0, 1663SND_SOC_DAPM_AIF_IN_E("AIF1DAC2R", NULL, 0,
1496 WM8994_POWER_MANAGEMENT_5, 10, 0, wm8958_aif_ev, 1664 SND_SOC_NOPM, 10, 0, wm8958_aif_ev,
1497 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 1665 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
1498 1666
1499SND_SOC_DAPM_MIXER("AIF1ADC1L Mixer", SND_SOC_NOPM, 0, 0, 1667SND_SOC_DAPM_MIXER("AIF1ADC1L Mixer", SND_SOC_NOPM, 0, 0,
@@ -1520,14 +1688,14 @@ SND_SOC_DAPM_MIXER("DAC1R Mixer", SND_SOC_NOPM, 0, 0,
1520 dac1r_mix, ARRAY_SIZE(dac1r_mix)), 1688 dac1r_mix, ARRAY_SIZE(dac1r_mix)),
1521 1689
1522SND_SOC_DAPM_AIF_OUT("AIF2ADCL", NULL, 0, 1690SND_SOC_DAPM_AIF_OUT("AIF2ADCL", NULL, 0,
1523 WM8994_POWER_MANAGEMENT_4, 13, 0), 1691 SND_SOC_NOPM, 13, 0),
1524SND_SOC_DAPM_AIF_OUT("AIF2ADCR", NULL, 0, 1692SND_SOC_DAPM_AIF_OUT("AIF2ADCR", NULL, 0,
1525 WM8994_POWER_MANAGEMENT_4, 12, 0), 1693 SND_SOC_NOPM, 12, 0),
1526SND_SOC_DAPM_AIF_IN_E("AIF2DACL", NULL, 0, 1694SND_SOC_DAPM_AIF_IN_E("AIF2DACL", NULL, 0,
1527 WM8994_POWER_MANAGEMENT_5, 13, 0, wm8958_aif_ev, 1695 SND_SOC_NOPM, 13, 0, wm8958_aif_ev,
1528 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 1696 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1529SND_SOC_DAPM_AIF_IN_E("AIF2DACR", NULL, 0, 1697SND_SOC_DAPM_AIF_IN_E("AIF2DACR", NULL, 0,
1530 WM8994_POWER_MANAGEMENT_5, 12, 0, wm8958_aif_ev, 1698 SND_SOC_NOPM, 12, 0, wm8958_aif_ev,
1531 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 1699 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1532 1700
1533SND_SOC_DAPM_AIF_IN("AIF1DACDAT", NULL, 0, SND_SOC_NOPM, 0, 0), 1701SND_SOC_DAPM_AIF_IN("AIF1DACDAT", NULL, 0, SND_SOC_NOPM, 0, 0),
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index f13f2886339c..6c028c470601 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -1035,7 +1035,7 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec,
1035 enum snd_soc_bias_level level) 1035 enum snd_soc_bias_level level)
1036{ 1036{
1037 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); 1037 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
1038 int val; 1038 int mask, val;
1039 1039
1040 switch (level) { 1040 switch (level) {
1041 case SND_SOC_BIAS_STANDBY: 1041 case SND_SOC_BIAS_STANDBY:
@@ -1047,6 +1047,13 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec,
1047 case SND_SOC_BIAS_ON: 1047 case SND_SOC_BIAS_ON:
1048 /* Turn off any unneded single ended outputs */ 1048 /* Turn off any unneded single ended outputs */
1049 val = 0; 1049 val = 0;
1050 mask = 0;
1051
1052 if (hubs->lineout1_se)
1053 mask |= WM8993_LINEOUT1N_ENA | WM8993_LINEOUT1P_ENA;
1054
1055 if (hubs->lineout2_se)
1056 mask |= WM8993_LINEOUT2N_ENA | WM8993_LINEOUT2P_ENA;
1050 1057
1051 if (hubs->lineout1_se && hubs->lineout1n_ena) 1058 if (hubs->lineout1_se && hubs->lineout1n_ena)
1052 val |= WM8993_LINEOUT1N_ENA; 1059 val |= WM8993_LINEOUT1N_ENA;
@@ -1061,11 +1068,7 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec,
1061 val |= WM8993_LINEOUT2P_ENA; 1068 val |= WM8993_LINEOUT2P_ENA;
1062 1069
1063 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_3, 1070 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_3,
1064 WM8993_LINEOUT1N_ENA | 1071 mask, val);
1065 WM8993_LINEOUT1P_ENA |
1066 WM8993_LINEOUT2N_ENA |
1067 WM8993_LINEOUT2P_ENA,
1068 val);
1069 1072
1070 /* Remove the input clamps */ 1073 /* Remove the input clamps */
1071 snd_soc_update_bits(codec, WM8993_INPUTS_CLAMP_REG, 1074 snd_soc_update_bits(codec, WM8993_INPUTS_CLAMP_REG,
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c
index 1765a197acb0..f23700359c67 100644
--- a/sound/soc/imx/imx-audmux.c
+++ b/sound/soc/imx/imx-audmux.c
@@ -73,6 +73,9 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
73 if (!buf) 73 if (!buf)
74 return -ENOMEM; 74 return -ENOMEM;
75 75
76 if (!audmux_base)
77 return -ENOSYS;
78
76 if (audmux_clk) 79 if (audmux_clk)
77 clk_prepare_enable(audmux_clk); 80 clk_prepare_enable(audmux_clk);
78 81
@@ -152,7 +155,7 @@ static void __init audmux_debugfs_init(void)
152 return; 155 return;
153 } 156 }
154 157
155 for (i = 1; i < 8; i++) { 158 for (i = 0; i < MX31_AUDMUX_PORT6_SSI_PINS_6 + 1; i++) {
156 snprintf(buf, sizeof(buf), "ssi%d", i); 159 snprintf(buf, sizeof(buf), "ssi%d", i);
157 if (!debugfs_create_file(buf, 0444, audmux_debugfs_root, 160 if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
158 (void *)i, &audmux_debugfs_fops)) 161 (void *)i, &audmux_debugfs_fops))
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index e00dd0b1139c..deafbfaacdbf 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -97,7 +97,7 @@ config SND_OMAP_SOC_SDP3430
97 97
98config SND_OMAP_SOC_OMAP_ABE_TWL6040 98config SND_OMAP_SOC_OMAP_ABE_TWL6040
99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" 99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec"
100 depends on TWL4030_CORE && SND_OMAP_SOC && ARCH_OMAP4 100 depends on TWL6040_CORE && SND_OMAP_SOC && ARCH_OMAP4
101 select SND_OMAP_SOC_DMIC 101 select SND_OMAP_SOC_DMIC
102 select SND_OMAP_SOC_MCPDM 102 select SND_OMAP_SOC_MCPDM
103 select SND_SOC_TWL6040 103 select SND_SOC_TWL6040
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index a59bd352d342..5a649da9122a 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -401,6 +401,10 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
401 } 401 }
402 402
403out: 403out:
404 /* free preallocated buffers in case of error */
405 if (ret)
406 omap_pcm_free_dma_buffers(pcm);
407
404 return ret; 408 return ret;
405} 409}
406 410
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 609abd51e55f..d08583790d23 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -17,6 +17,7 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/io.h>
20#include <sound/core.h> 21#include <sound/core.h>
21#include <sound/pcm.h> 22#include <sound/pcm.h>
22#include <sound/initval.h> 23#include <sound/initval.h>
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 72185078ddf8..79fbeea99d46 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -166,7 +166,7 @@ static struct snd_soc_dai_driver s3c2412_i2s_dai = {
166 166
167static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) 167static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev)
168{ 168{
169 return snd_soc_register_dai(&pdev->dev, &s3c2412_i2s_dai); 169 return s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai);
170} 170}
171 171
172static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) 172static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev)
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 378cc5b056d7..74ed2dffbffd 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1001,11 +1001,10 @@ static void fsi_dma_do_tasklet(unsigned long data)
1001 sg_dma_address(&sg) = buf; 1001 sg_dma_address(&sg) = buf;
1002 sg_dma_len(&sg) = len; 1002 sg_dma_len(&sg) = len;
1003 1003
1004 desc = chan->device->device_prep_slave_sg(chan, &sg, 1, dir, 1004 desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir,
1005 DMA_PREP_INTERRUPT | 1005 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
1006 DMA_CTRL_ACK);
1007 if (!desc) { 1006 if (!desc) {
1008 dev_err(dai->dev, "device_prep_slave_sg() fail\n"); 1007 dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n");
1009 return; 1008 return;
1010 } 1009 }
1011 1010
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c
index 9d9ad8d61c0a..8526e1edaf45 100644
--- a/sound/soc/sh/migor.c
+++ b/sound/soc/sh/migor.c
@@ -35,7 +35,7 @@ static unsigned long siumckb_recalc(struct clk *clk)
35 return codec_freq; 35 return codec_freq;
36} 36}
37 37
38static struct clk_ops siumckb_clk_ops = { 38static struct sh_clk_ops siumckb_clk_ops = {
39 .recalc = siumckb_recalc, 39 .recalc = siumckb_recalc,
40}; 40};
41 41
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e19c24ade414..c88d9741b9e7 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1081,6 +1081,8 @@ static int soc_probe_platform(struct snd_soc_card *card,
1081 snd_soc_dapm_new_controls(&platform->dapm, 1081 snd_soc_dapm_new_controls(&platform->dapm,
1082 driver->dapm_widgets, driver->num_dapm_widgets); 1082 driver->dapm_widgets, driver->num_dapm_widgets);
1083 1083
1084 platform->dapm.idle_bias_off = 1;
1085
1084 if (driver->probe) { 1086 if (driver->probe) {
1085 ret = driver->probe(platform); 1087 ret = driver->probe(platform);
1086 if (ret < 0) { 1088 if (ret < 0) {
@@ -3111,6 +3113,7 @@ int snd_soc_register_card(struct snd_soc_card *card)
3111 GFP_KERNEL); 3113 GFP_KERNEL);
3112 if (card->rtd == NULL) 3114 if (card->rtd == NULL)
3113 return -ENOMEM; 3115 return -ENOMEM;
3116 card->num_rtd = 0;
3114 card->rtd_aux = &card->rtd[card->num_links]; 3117 card->rtd_aux = &card->rtd[card->num_links];
3115 3118
3116 for (i = 0; i < card->num_links; i++) 3119 for (i = 0; i < card->num_links; i++)
@@ -3622,10 +3625,10 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3622 int i, ret; 3625 int i, ret;
3623 3626
3624 num_routes = of_property_count_strings(np, propname); 3627 num_routes = of_property_count_strings(np, propname);
3625 if (num_routes & 1) { 3628 if (num_routes < 0 || num_routes & 1) {
3626 dev_err(card->dev, 3629 dev_err(card->dev,
3627 "Property '%s's length is not even\n", 3630 "Property '%s' does not exist or its length is not even\n",
3628 propname); 3631 propname);
3629 return -EINVAL; 3632 return -EINVAL;
3630 } 3633 }
3631 num_routes /= 2; 3634 num_routes /= 2;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 5cbd2d7623b8..1bb6d4a63cd8 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -67,6 +67,7 @@ static int dapm_up_seq[] = {
67 [snd_soc_dapm_out_drv] = 10, 67 [snd_soc_dapm_out_drv] = 10,
68 [snd_soc_dapm_hp] = 10, 68 [snd_soc_dapm_hp] = 10,
69 [snd_soc_dapm_spk] = 10, 69 [snd_soc_dapm_spk] = 10,
70 [snd_soc_dapm_line] = 10,
70 [snd_soc_dapm_post] = 11, 71 [snd_soc_dapm_post] = 11,
71}; 72};
72 73
@@ -75,6 +76,7 @@ static int dapm_down_seq[] = {
75 [snd_soc_dapm_adc] = 1, 76 [snd_soc_dapm_adc] = 1,
76 [snd_soc_dapm_hp] = 2, 77 [snd_soc_dapm_hp] = 2,
77 [snd_soc_dapm_spk] = 2, 78 [snd_soc_dapm_spk] = 2,
79 [snd_soc_dapm_line] = 2,
78 [snd_soc_dapm_out_drv] = 2, 80 [snd_soc_dapm_out_drv] = 2,
79 [snd_soc_dapm_pga] = 4, 81 [snd_soc_dapm_pga] = 4,
80 [snd_soc_dapm_mixer_named_ctl] = 5, 82 [snd_soc_dapm_mixer_named_ctl] = 5,
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c
index 33509de52540..e53349912b2e 100644
--- a/sound/soc/tegra/tegra_i2s.c
+++ b/sound/soc/tegra/tegra_i2s.c
@@ -79,11 +79,15 @@ static int tegra_i2s_show(struct seq_file *s, void *unused)
79 struct tegra_i2s *i2s = s->private; 79 struct tegra_i2s *i2s = s->private;
80 int i; 80 int i;
81 81
82 clk_enable(i2s->clk_i2s);
83
82 for (i = 0; i < ARRAY_SIZE(regs); i++) { 84 for (i = 0; i < ARRAY_SIZE(regs); i++) {
83 u32 val = tegra_i2s_read(i2s, regs[i].offset); 85 u32 val = tegra_i2s_read(i2s, regs[i].offset);
84 seq_printf(s, "%s = %08x\n", regs[i].name, val); 86 seq_printf(s, "%s = %08x\n", regs[i].name, val);
85 } 87 }
86 88
89 clk_disable(i2s->clk_i2s);
90
87 return 0; 91 return 0;
88} 92}
89 93
@@ -112,7 +116,7 @@ static void tegra_i2s_debug_remove(struct tegra_i2s *i2s)
112 debugfs_remove(i2s->debug); 116 debugfs_remove(i2s->debug);
113} 117}
114#else 118#else
115static inline void tegra_i2s_debug_add(struct tegra_i2s *i2s, int id) 119static inline void tegra_i2s_debug_add(struct tegra_i2s *i2s)
116{ 120{
117} 121}
118 122
diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c
index 475428cf270e..9ff2c601445f 100644
--- a/sound/soc/tegra/tegra_spdif.c
+++ b/sound/soc/tegra/tegra_spdif.c
@@ -79,11 +79,15 @@ static int tegra_spdif_show(struct seq_file *s, void *unused)
79 struct tegra_spdif *spdif = s->private; 79 struct tegra_spdif *spdif = s->private;
80 int i; 80 int i;
81 81
82 clk_enable(spdif->clk_spdif_out);
83
82 for (i = 0; i < ARRAY_SIZE(regs); i++) { 84 for (i = 0; i < ARRAY_SIZE(regs); i++) {
83 u32 val = tegra_spdif_read(spdif, regs[i].offset); 85 u32 val = tegra_spdif_read(spdif, regs[i].offset);
84 seq_printf(s, "%s = %08x\n", regs[i].name, val); 86 seq_printf(s, "%s = %08x\n", regs[i].name, val);
85 } 87 }
86 88
89 clk_disable(spdif->clk_spdif_out);
90
87 return 0; 91 return 0;
88} 92}
89 93