aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/compress_offload.c13
-rw-r--r--sound/pci/hda/alc880_quirks.c17
-rw-r--r--sound/pci/hda/alc882_quirks.c15
-rw-r--r--sound/pci/hda/hda_intel.c6
-rw-r--r--sound/pci/hda/patch_conexant.c2
-rw-r--r--sound/pci/hda/patch_realtek.c58
-rw-r--r--sound/pci/hda/patch_sigmatel.c19
-rw-r--r--sound/pci/ymfpci/ymfpci.c21
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c21
-rw-r--r--sound/soc/codecs/sgtl5000.c17
-rw-r--r--sound/soc/codecs/tlv320aic32x4.c110
-rw-r--r--sound/soc/codecs/wm2000.c31
-rw-r--r--sound/soc/codecs/wm5100.c3
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c2
-rw-r--r--sound/soc/codecs/wm8996.c7
-rw-r--r--sound/soc/codecs/wm8996.h4
-rw-r--r--sound/soc/mxs/mxs-saif.c5
17 files changed, 213 insertions, 138 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index dac3633507c9..a68aed7fce02 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -441,19 +441,22 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
441 params = kmalloc(sizeof(*params), GFP_KERNEL); 441 params = kmalloc(sizeof(*params), GFP_KERNEL);
442 if (!params) 442 if (!params)
443 return -ENOMEM; 443 return -ENOMEM;
444 if (copy_from_user(params, (void __user *)arg, sizeof(*params))) 444 if (copy_from_user(params, (void __user *)arg, sizeof(*params))) {
445 return -EFAULT; 445 retval = -EFAULT;
446 goto out;
447 }
446 retval = snd_compr_allocate_buffer(stream, params); 448 retval = snd_compr_allocate_buffer(stream, params);
447 if (retval) { 449 if (retval) {
448 kfree(params); 450 retval = -ENOMEM;
449 return -ENOMEM; 451 goto out;
450 } 452 }
451 retval = stream->ops->set_params(stream, params); 453 retval = stream->ops->set_params(stream, params);
452 if (retval) 454 if (retval)
453 goto out; 455 goto out;
454 stream->runtime->state = SNDRV_PCM_STATE_SETUP; 456 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
455 } else 457 } else {
456 return -EPERM; 458 return -EPERM;
459 }
457out: 460out:
458 kfree(params); 461 kfree(params);
459 return retval; 462 return retval;
diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c
index 5b68435d195b..501501ef36a9 100644
--- a/sound/pci/hda/alc880_quirks.c
+++ b/sound/pci/hda/alc880_quirks.c
@@ -762,16 +762,22 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec,
762 /* Looks like the unsol event is incompatible with the standard 762 /* Looks like the unsol event is incompatible with the standard
763 * definition. 4bit tag is placed at 28 bit! 763 * definition. 4bit tag is placed at 28 bit!
764 */ 764 */
765 switch (res >> 28) { 765 res >>= 28;
766 switch (res) {
766 case ALC_MIC_EVENT: 767 case ALC_MIC_EVENT:
767 alc88x_simple_mic_automute(codec); 768 alc88x_simple_mic_automute(codec);
768 break; 769 break;
769 default: 770 default:
770 alc_sku_unsol_event(codec, res); 771 alc_exec_unsol_event(codec, res);
771 break; 772 break;
772 } 773 }
773} 774}
774 775
776static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
777{
778 alc_exec_unsol_event(codec, res >> 28);
779}
780
775static void alc880_uniwill_p53_setup(struct hda_codec *codec) 781static void alc880_uniwill_p53_setup(struct hda_codec *codec)
776{ 782{
777 struct alc_spec *spec = codec->spec; 783 struct alc_spec *spec = codec->spec;
@@ -800,10 +806,11 @@ static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
800 /* Looks like the unsol event is incompatible with the standard 806 /* Looks like the unsol event is incompatible with the standard
801 * definition. 4bit tag is placed at 28 bit! 807 * definition. 4bit tag is placed at 28 bit!
802 */ 808 */
803 if ((res >> 28) == ALC_DCVOL_EVENT) 809 res >>= 28;
810 if (res == ALC_DCVOL_EVENT)
804 alc880_uniwill_p53_dcvol_automute(codec); 811 alc880_uniwill_p53_dcvol_automute(codec);
805 else 812 else
806 alc_sku_unsol_event(codec, res); 813 alc_exec_unsol_event(codec, res);
807} 814}
808 815
809/* 816/*
@@ -1677,7 +1684,7 @@ static const struct alc_config_preset alc880_presets[] = {
1677 .channel_mode = alc880_lg_ch_modes, 1684 .channel_mode = alc880_lg_ch_modes,
1678 .need_dac_fix = 1, 1685 .need_dac_fix = 1,
1679 .input_mux = &alc880_lg_capture_source, 1686 .input_mux = &alc880_lg_capture_source,
1680 .unsol_event = alc_sku_unsol_event, 1687 .unsol_event = alc880_unsol_event,
1681 .setup = alc880_lg_setup, 1688 .setup = alc880_lg_setup,
1682 .init_hook = alc_hp_automute, 1689 .init_hook = alc_hp_automute,
1683#ifdef CONFIG_SND_HDA_POWER_SAVE 1690#ifdef CONFIG_SND_HDA_POWER_SAVE
diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c
index bdf0ed4ab3e2..bb364a53f546 100644
--- a/sound/pci/hda/alc882_quirks.c
+++ b/sound/pci/hda/alc882_quirks.c
@@ -730,6 +730,11 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
730 alc889A_mb31_automute(codec); 730 alc889A_mb31_automute(codec);
731} 731}
732 732
733static void alc882_unsol_event(struct hda_codec *codec, unsigned int res)
734{
735 alc_exec_unsol_event(codec, res >> 26);
736}
737
733/* 738/*
734 * configuration and preset 739 * configuration and preset
735 */ 740 */
@@ -775,7 +780,7 @@ static const struct alc_config_preset alc882_presets[] = {
775 .channel_mode = alc885_mba21_ch_modes, 780 .channel_mode = alc885_mba21_ch_modes,
776 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), 781 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
777 .input_mux = &alc882_capture_source, 782 .input_mux = &alc882_capture_source,
778 .unsol_event = alc_sku_unsol_event, 783 .unsol_event = alc882_unsol_event,
779 .setup = alc885_mba21_setup, 784 .setup = alc885_mba21_setup,
780 .init_hook = alc_hp_automute, 785 .init_hook = alc_hp_automute,
781 }, 786 },
@@ -791,7 +796,7 @@ static const struct alc_config_preset alc882_presets[] = {
791 .input_mux = &alc882_capture_source, 796 .input_mux = &alc882_capture_source,
792 .dig_out_nid = ALC882_DIGOUT_NID, 797 .dig_out_nid = ALC882_DIGOUT_NID,
793 .dig_in_nid = ALC882_DIGIN_NID, 798 .dig_in_nid = ALC882_DIGIN_NID,
794 .unsol_event = alc_sku_unsol_event, 799 .unsol_event = alc882_unsol_event,
795 .setup = alc885_mbp3_setup, 800 .setup = alc885_mbp3_setup,
796 .init_hook = alc_hp_automute, 801 .init_hook = alc_hp_automute,
797 }, 802 },
@@ -806,7 +811,7 @@ static const struct alc_config_preset alc882_presets[] = {
806 .input_mux = &mb5_capture_source, 811 .input_mux = &mb5_capture_source,
807 .dig_out_nid = ALC882_DIGOUT_NID, 812 .dig_out_nid = ALC882_DIGOUT_NID,
808 .dig_in_nid = ALC882_DIGIN_NID, 813 .dig_in_nid = ALC882_DIGIN_NID,
809 .unsol_event = alc_sku_unsol_event, 814 .unsol_event = alc882_unsol_event,
810 .setup = alc885_mb5_setup, 815 .setup = alc885_mb5_setup,
811 .init_hook = alc_hp_automute, 816 .init_hook = alc_hp_automute,
812 }, 817 },
@@ -821,7 +826,7 @@ static const struct alc_config_preset alc882_presets[] = {
821 .input_mux = &macmini3_capture_source, 826 .input_mux = &macmini3_capture_source,
822 .dig_out_nid = ALC882_DIGOUT_NID, 827 .dig_out_nid = ALC882_DIGOUT_NID,
823 .dig_in_nid = ALC882_DIGIN_NID, 828 .dig_in_nid = ALC882_DIGIN_NID,
824 .unsol_event = alc_sku_unsol_event, 829 .unsol_event = alc882_unsol_event,
825 .setup = alc885_macmini3_setup, 830 .setup = alc885_macmini3_setup,
826 .init_hook = alc_hp_automute, 831 .init_hook = alc_hp_automute,
827 }, 832 },
@@ -836,7 +841,7 @@ static const struct alc_config_preset alc882_presets[] = {
836 .input_mux = &alc889A_imac91_capture_source, 841 .input_mux = &alc889A_imac91_capture_source,
837 .dig_out_nid = ALC882_DIGOUT_NID, 842 .dig_out_nid = ALC882_DIGOUT_NID,
838 .dig_in_nid = ALC882_DIGIN_NID, 843 .dig_in_nid = ALC882_DIGIN_NID,
839 .unsol_event = alc_sku_unsol_event, 844 .unsol_event = alc882_unsol_event,
840 .setup = alc885_imac91_setup, 845 .setup = alc885_imac91_setup,
841 .init_hook = alc_hp_automute, 846 .init_hook = alc_hp_automute,
842 }, 847 },
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index fb35474c1203..95dfb6874941 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -469,6 +469,7 @@ struct azx {
469 unsigned int irq_pending_warned :1; 469 unsigned int irq_pending_warned :1;
470 unsigned int probing :1; /* codec probing phase */ 470 unsigned int probing :1; /* codec probing phase */
471 unsigned int snoop:1; 471 unsigned int snoop:1;
472 unsigned int align_buffer_size:1;
472 473
473 /* for debugging */ 474 /* for debugging */
474 unsigned int last_cmd[AZX_MAX_CODECS]; 475 unsigned int last_cmd[AZX_MAX_CODECS];
@@ -1690,7 +1691,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1690 runtime->hw.rates = hinfo->rates; 1691 runtime->hw.rates = hinfo->rates;
1691 snd_pcm_limit_hw_rates(runtime); 1692 snd_pcm_limit_hw_rates(runtime);
1692 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 1693 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
1693 if (align_buffer_size) 1694 if (chip->align_buffer_size)
1694 /* constrain buffer sizes to be multiple of 128 1695 /* constrain buffer sizes to be multiple of 128
1695 bytes. This is more efficient in terms of memory 1696 bytes. This is more efficient in terms of memory
1696 access but isn't required by the HDA spec and 1697 access but isn't required by the HDA spec and
@@ -2773,8 +2774,9 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2773 } 2774 }
2774 2775
2775 /* disable buffer size rounding to 128-byte multiples if supported */ 2776 /* disable buffer size rounding to 128-byte multiples if supported */
2777 chip->align_buffer_size = align_buffer_size;
2776 if (chip->driver_caps & AZX_DCAPS_BUFSIZE) 2778 if (chip->driver_caps & AZX_DCAPS_BUFSIZE)
2777 align_buffer_size = 0; 2779 chip->align_buffer_size = 0;
2778 2780
2779 /* allow 64bit DMA address if supported by H/W */ 2781 /* allow 64bit DMA address if supported by H/W */
2780 if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) 2782 if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 8a32a69c83c3..a7a5733aa4d2 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3027,7 +3027,7 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3027 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), 3027 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD),
3028 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), 3028 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
3029 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), 3029 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
3030 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 3030 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T510", CXT5066_AUTO),
3031 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520 & W520", CXT5066_AUTO), 3031 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520 & W520", CXT5066_AUTO),
3032 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD), 3032 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD),
3033 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD), 3033 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD),
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 5e82acf77c5a..0db1dc49382b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -185,7 +185,6 @@ struct alc_spec {
185 unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ 185 unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */
186 unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ 186 unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */
187 unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */ 187 unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */
188 unsigned int use_jack_tbl:1; /* 1 for model=auto */
189 188
190 /* auto-mute control */ 189 /* auto-mute control */
191 int automute_mode; 190 int automute_mode;
@@ -621,17 +620,10 @@ static void alc_mic_automute(struct hda_codec *codec)
621 alc_mux_select(codec, 0, spec->int_mic_idx, false); 620 alc_mux_select(codec, 0, spec->int_mic_idx, false);
622} 621}
623 622
624/* unsolicited event for HP jack sensing */ 623/* handle the specified unsol action (ALC_XXX_EVENT) */
625static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) 624static void alc_exec_unsol_event(struct hda_codec *codec, int action)
626{ 625{
627 struct alc_spec *spec = codec->spec; 626 switch (action) {
628 if (codec->vendor_id == 0x10ec0880)
629 res >>= 28;
630 else
631 res >>= 26;
632 if (spec->use_jack_tbl)
633 res = snd_hda_jack_get_action(codec, res);
634 switch (res) {
635 case ALC_HP_EVENT: 627 case ALC_HP_EVENT:
636 alc_hp_automute(codec); 628 alc_hp_automute(codec);
637 break; 629 break;
@@ -645,6 +637,17 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
645 snd_hda_jack_report_sync(codec); 637 snd_hda_jack_report_sync(codec);
646} 638}
647 639
640/* unsolicited event for HP jack sensing */
641static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
642{
643 if (codec->vendor_id == 0x10ec0880)
644 res >>= 28;
645 else
646 res >>= 26;
647 res = snd_hda_jack_get_action(codec, res);
648 alc_exec_unsol_event(codec, res);
649}
650
648/* call init functions of standard auto-mute helpers */ 651/* call init functions of standard auto-mute helpers */
649static void alc_inithook(struct hda_codec *codec) 652static void alc_inithook(struct hda_codec *codec)
650{ 653{
@@ -1883,7 +1886,7 @@ static const struct snd_kcontrol_new alc_beep_mixer[] = {
1883}; 1886};
1884#endif 1887#endif
1885 1888
1886static int alc_build_controls(struct hda_codec *codec) 1889static int __alc_build_controls(struct hda_codec *codec)
1887{ 1890{
1888 struct alc_spec *spec = codec->spec; 1891 struct alc_spec *spec = codec->spec;
1889 struct snd_kcontrol *kctl = NULL; 1892 struct snd_kcontrol *kctl = NULL;
@@ -2029,11 +2032,16 @@ static int alc_build_controls(struct hda_codec *codec)
2029 2032
2030 alc_free_kctls(codec); /* no longer needed */ 2033 alc_free_kctls(codec); /* no longer needed */
2031 2034
2032 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); 2035 return 0;
2036}
2037
2038static int alc_build_controls(struct hda_codec *codec)
2039{
2040 struct alc_spec *spec = codec->spec;
2041 int err = __alc_build_controls(codec);
2033 if (err < 0) 2042 if (err < 0)
2034 return err; 2043 return err;
2035 2044 return snd_hda_jack_add_kctls(codec, &spec->autocfg);
2036 return 0;
2037} 2045}
2038 2046
2039 2047
@@ -3233,7 +3241,7 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec,
3233 int i, err, noutputs; 3241 int i, err, noutputs;
3234 3242
3235 noutputs = cfg->line_outs; 3243 noutputs = cfg->line_outs;
3236 if (spec->multi_ios > 0) 3244 if (spec->multi_ios > 0 && cfg->line_outs < 3)
3237 noutputs += spec->multi_ios; 3245 noutputs += spec->multi_ios;
3238 3246
3239 for (i = 0; i < noutputs; i++) { 3247 for (i = 0; i < noutputs; i++) {
@@ -3904,7 +3912,6 @@ static void set_capture_mixer(struct hda_codec *codec)
3904static void alc_auto_init_std(struct hda_codec *codec) 3912static void alc_auto_init_std(struct hda_codec *codec)
3905{ 3913{
3906 struct alc_spec *spec = codec->spec; 3914 struct alc_spec *spec = codec->spec;
3907 spec->use_jack_tbl = 1;
3908 alc_auto_init_multi_out(codec); 3915 alc_auto_init_multi_out(codec);
3909 alc_auto_init_extra_out(codec); 3916 alc_auto_init_extra_out(codec);
3910 alc_auto_init_analog_input(codec); 3917 alc_auto_init_analog_input(codec);
@@ -4168,6 +4175,8 @@ static int patch_alc880(struct hda_codec *codec)
4168 codec->patch_ops = alc_patch_ops; 4175 codec->patch_ops = alc_patch_ops;
4169 if (board_config == ALC_MODEL_AUTO) 4176 if (board_config == ALC_MODEL_AUTO)
4170 spec->init_hook = alc_auto_init_std; 4177 spec->init_hook = alc_auto_init_std;
4178 else
4179 codec->patch_ops.build_controls = __alc_build_controls;
4171#ifdef CONFIG_SND_HDA_POWER_SAVE 4180#ifdef CONFIG_SND_HDA_POWER_SAVE
4172 if (!spec->loopback.amplist) 4181 if (!spec->loopback.amplist)
4173 spec->loopback.amplist = alc880_loopbacks; 4182 spec->loopback.amplist = alc880_loopbacks;
@@ -4297,6 +4306,8 @@ static int patch_alc260(struct hda_codec *codec)
4297 codec->patch_ops = alc_patch_ops; 4306 codec->patch_ops = alc_patch_ops;
4298 if (board_config == ALC_MODEL_AUTO) 4307 if (board_config == ALC_MODEL_AUTO)
4299 spec->init_hook = alc_auto_init_std; 4308 spec->init_hook = alc_auto_init_std;
4309 else
4310 codec->patch_ops.build_controls = __alc_build_controls;
4300 spec->shutup = alc_eapd_shutup; 4311 spec->shutup = alc_eapd_shutup;
4301#ifdef CONFIG_SND_HDA_POWER_SAVE 4312#ifdef CONFIG_SND_HDA_POWER_SAVE
4302 if (!spec->loopback.amplist) 4313 if (!spec->loopback.amplist)
@@ -4691,6 +4702,8 @@ static int patch_alc882(struct hda_codec *codec)
4691 codec->patch_ops = alc_patch_ops; 4702 codec->patch_ops = alc_patch_ops;
4692 if (board_config == ALC_MODEL_AUTO) 4703 if (board_config == ALC_MODEL_AUTO)
4693 spec->init_hook = alc_auto_init_std; 4704 spec->init_hook = alc_auto_init_std;
4705 else
4706 codec->patch_ops.build_controls = __alc_build_controls;
4694 4707
4695#ifdef CONFIG_SND_HDA_POWER_SAVE 4708#ifdef CONFIG_SND_HDA_POWER_SAVE
4696 if (!spec->loopback.amplist) 4709 if (!spec->loopback.amplist)
@@ -5573,6 +5586,7 @@ static const struct hda_amp_list alc861_loopbacks[] = {
5573/* Pin config fixes */ 5586/* Pin config fixes */
5574enum { 5587enum {
5575 PINFIX_FSC_AMILO_PI1505, 5588 PINFIX_FSC_AMILO_PI1505,
5589 PINFIX_ASUS_A6RP,
5576}; 5590};
5577 5591
5578static const struct alc_fixup alc861_fixups[] = { 5592static const struct alc_fixup alc861_fixups[] = {
@@ -5584,9 +5598,19 @@ static const struct alc_fixup alc861_fixups[] = {
5584 { } 5598 { }
5585 } 5599 }
5586 }, 5600 },
5601 [PINFIX_ASUS_A6RP] = {
5602 .type = ALC_FIXUP_VERBS,
5603 .v.verbs = (const struct hda_verb[]) {
5604 /* node 0x0f VREF seems controlling the master output */
5605 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
5606 { }
5607 },
5608 },
5587}; 5609};
5588 5610
5589static const struct snd_pci_quirk alc861_fixup_tbl[] = { 5611static const struct snd_pci_quirk alc861_fixup_tbl[] = {
5612 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", PINFIX_ASUS_A6RP),
5613 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", PINFIX_ASUS_A6RP),
5590 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), 5614 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
5591 {} 5615 {}
5592}; 5616};
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3556408d6ece..948f0be2f4f3 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1608,7 +1608,7 @@ static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, 1608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1609 "Alienware M17x", STAC_ALIENWARE_M17X), 1609 "Alienware M17x", STAC_ALIENWARE_M17X),
1610 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, 1610 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
1611 "Alienware M17x", STAC_ALIENWARE_M17X), 1611 "Alienware M17x R3", STAC_DELL_EQ),
1612 {} /* terminator */ 1612 {} /* terminator */
1613}; 1613};
1614 1614
@@ -4163,13 +4163,15 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
4163 return 1; 4163 return 1;
4164} 4164}
4165 4165
4166static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) 4166static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
4167{ 4167{
4168 int i; 4168 int i;
4169 for (i = 0; i < cfg->hp_outs; i++) 4169 for (i = 0; i < cfg->hp_outs; i++)
4170 if (cfg->hp_pins[i] == nid) 4170 if (cfg->hp_pins[i] == nid)
4171 return 1; /* nid is a HP-Out */ 4171 return 1; /* nid is a HP-Out */
4172 4172 for (i = 0; i < cfg->line_outs; i++)
4173 if (cfg->line_out_pins[i] == nid)
4174 return 1; /* nid is a line-Out */
4173 return 0; /* nid is not a HP-Out */ 4175 return 0; /* nid is not a HP-Out */
4174}; 4176};
4175 4177
@@ -4375,7 +4377,7 @@ static int stac92xx_init(struct hda_codec *codec)
4375 continue; 4377 continue;
4376 } 4378 }
4377 4379
4378 if (is_nid_hp_pin(cfg, nid)) 4380 if (is_nid_out_jack_pin(cfg, nid))
4379 continue; /* already has an unsol event */ 4381 continue; /* already has an unsol event */
4380 4382
4381 pinctl = snd_hda_codec_read(codec, nid, 0, 4383 pinctl = snd_hda_codec_read(codec, nid, 0,
@@ -4868,7 +4870,14 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
4868 /* BIOS bug: unfilled OEM string */ 4870 /* BIOS bug: unfilled OEM string */
4869 if (strstr(dev->name, "HP_Mute_LED_P_G")) { 4871 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
4870 set_hp_led_gpio(codec); 4872 set_hp_led_gpio(codec);
4871 spec->gpio_led_polarity = 1; 4873 switch (codec->subsystem_id) {
4874 case 0x103c148a:
4875 spec->gpio_led_polarity = 0;
4876 break;
4877 default:
4878 spec->gpio_led_polarity = 1;
4879 break;
4880 }
4872 return 1; 4881 return 1;
4873 } 4882 }
4874 } 4883 }
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index e57b89e8aa89..94ab728f5ca8 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -286,17 +286,22 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
286 snd_card_free(card); 286 snd_card_free(card);
287 return err; 287 return err;
288 } 288 }
289 if ((err = snd_ymfpci_pcm_4ch(chip, 2, NULL)) < 0) { 289 err = snd_ymfpci_mixer(chip, rear_switch[dev]);
290 if (err < 0) {
290 snd_card_free(card); 291 snd_card_free(card);
291 return err; 292 return err;
292 } 293 }
293 if ((err = snd_ymfpci_pcm2(chip, 3, NULL)) < 0) { 294 if (chip->ac97->ext_id & AC97_EI_SDAC) {
294 snd_card_free(card); 295 err = snd_ymfpci_pcm_4ch(chip, 2, NULL);
295 return err; 296 if (err < 0) {
296 } 297 snd_card_free(card);
297 if ((err = snd_ymfpci_mixer(chip, rear_switch[dev])) < 0) { 298 return err;
298 snd_card_free(card); 299 }
299 return err; 300 err = snd_ymfpci_pcm2(chip, 3, NULL);
301 if (err < 0) {
302 snd_card_free(card);
303 return err;
304 }
300 } 305 }
301 if ((err = snd_ymfpci_timer(chip, 0)) < 0) { 306 if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
302 snd_card_free(card); 307 snd_card_free(card);
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 03ee4e365311..12a9a2b03387 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -1614,6 +1614,14 @@ static int snd_ymfpci_put_dup4ch(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1614 return change; 1614 return change;
1615} 1615}
1616 1616
1617static struct snd_kcontrol_new snd_ymfpci_dup4ch __devinitdata = {
1618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1619 .name = "4ch Duplication",
1620 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
1621 .info = snd_ymfpci_info_dup4ch,
1622 .get = snd_ymfpci_get_dup4ch,
1623 .put = snd_ymfpci_put_dup4ch,
1624};
1617 1625
1618static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = { 1626static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = {
1619{ 1627{
@@ -1642,13 +1650,6 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
1642YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0), 1650YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
1643YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0), 1651YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
1644YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4), 1652YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
1645{
1646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1647 .name = "4ch Duplication",
1648 .info = snd_ymfpci_info_dup4ch,
1649 .get = snd_ymfpci_get_dup4ch,
1650 .put = snd_ymfpci_put_dup4ch,
1651},
1652}; 1653};
1653 1654
1654 1655
@@ -1838,6 +1839,12 @@ int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
1838 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0) 1839 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0)
1839 return err; 1840 return err;
1840 } 1841 }
1842 if (chip->ac97->ext_id & AC97_EI_SDAC) {
1843 kctl = snd_ctl_new1(&snd_ymfpci_dup4ch, chip);
1844 err = snd_ctl_add(chip->card, kctl);
1845 if (err < 0)
1846 return err;
1847 }
1841 1848
1842 /* add S/PDIF control */ 1849 /* add S/PDIF control */
1843 if (snd_BUG_ON(!chip->pcm_spdif)) 1850 if (snd_BUG_ON(!chip->pcm_spdif))
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index f8863ebb4304..7f4ba819a9f6 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -987,12 +987,12 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
987 /* restore regular registers */ 987 /* restore regular registers */
988 for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) { 988 for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) {
989 989
990 /* this regs depends on the others */ 990 /* These regs should restore in particular order */
991 if (reg == SGTL5000_CHIP_ANA_POWER || 991 if (reg == SGTL5000_CHIP_ANA_POWER ||
992 reg == SGTL5000_CHIP_CLK_CTRL || 992 reg == SGTL5000_CHIP_CLK_CTRL ||
993 reg == SGTL5000_CHIP_LINREG_CTRL || 993 reg == SGTL5000_CHIP_LINREG_CTRL ||
994 reg == SGTL5000_CHIP_LINE_OUT_CTRL || 994 reg == SGTL5000_CHIP_LINE_OUT_CTRL ||
995 reg == SGTL5000_CHIP_CLK_CTRL) 995 reg == SGTL5000_CHIP_REF_CTRL)
996 continue; 996 continue;
997 997
998 snd_soc_write(codec, reg, cache[reg]); 998 snd_soc_write(codec, reg, cache[reg]);
@@ -1003,8 +1003,17 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
1003 snd_soc_write(codec, reg, cache[reg]); 1003 snd_soc_write(codec, reg, cache[reg]);
1004 1004
1005 /* 1005 /*
1006 * restore power and other regs according 1006 * restore these regs according to the power setting sequence in
1007 * to set_power() and set_clock() 1007 * sgtl5000_set_power_regs() and clock setting sequence in
1008 * sgtl5000_set_clock().
1009 *
1010 * The order of restore is:
1011 * 1. SGTL5000_CHIP_CLK_CTRL MCLK_FREQ bits (1:0) should be restore after
1012 * SGTL5000_CHIP_ANA_POWER PLL bits set
1013 * 2. SGTL5000_CHIP_LINREG_CTRL should be set before
1014 * SGTL5000_CHIP_ANA_POWER LINREG_D restored
1015 * 3. SGTL5000_CHIP_REF_CTRL controls Analog Ground Voltage,
1016 * prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
1008 */ 1017 */
1009 snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, 1018 snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
1010 cache[SGTL5000_CHIP_LINREG_CTRL]); 1019 cache[SGTL5000_CHIP_LINREG_CTRL]);
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index eb401ef021fb..372b0b83bd9f 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -60,7 +60,6 @@ struct aic32x4_rate_divs {
60 60
61struct aic32x4_priv { 61struct aic32x4_priv {
62 u32 sysclk; 62 u32 sysclk;
63 s32 master;
64 u8 page_no; 63 u8 page_no;
65 void *control_data; 64 void *control_data;
66 u32 power_cfg; 65 u32 power_cfg;
@@ -369,7 +368,6 @@ static int aic32x4_set_dai_sysclk(struct snd_soc_dai *codec_dai,
369static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) 368static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
370{ 369{
371 struct snd_soc_codec *codec = codec_dai->codec; 370 struct snd_soc_codec *codec = codec_dai->codec;
372 struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
373 u8 iface_reg_1; 371 u8 iface_reg_1;
374 u8 iface_reg_2; 372 u8 iface_reg_2;
375 u8 iface_reg_3; 373 u8 iface_reg_3;
@@ -384,11 +382,9 @@ static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
384 /* set master/slave audio interface */ 382 /* set master/slave audio interface */
385 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 383 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
386 case SND_SOC_DAIFMT_CBM_CFM: 384 case SND_SOC_DAIFMT_CBM_CFM:
387 aic32x4->master = 1;
388 iface_reg_1 |= AIC32X4_BCLKMASTER | AIC32X4_WCLKMASTER; 385 iface_reg_1 |= AIC32X4_BCLKMASTER | AIC32X4_WCLKMASTER;
389 break; 386 break;
390 case SND_SOC_DAIFMT_CBS_CFS: 387 case SND_SOC_DAIFMT_CBS_CFS:
391 aic32x4->master = 0;
392 break; 388 break;
393 default: 389 default:
394 printk(KERN_ERR "aic32x4: invalid DAI master/slave interface\n"); 390 printk(KERN_ERR "aic32x4: invalid DAI master/slave interface\n");
@@ -526,64 +522,58 @@ static int aic32x4_mute(struct snd_soc_dai *dai, int mute)
526static int aic32x4_set_bias_level(struct snd_soc_codec *codec, 522static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
527 enum snd_soc_bias_level level) 523 enum snd_soc_bias_level level)
528{ 524{
529 struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
530
531 switch (level) { 525 switch (level) {
532 case SND_SOC_BIAS_ON: 526 case SND_SOC_BIAS_ON:
533 if (aic32x4->master) { 527 /* Switch on PLL */
534 /* Switch on PLL */ 528 snd_soc_update_bits(codec, AIC32X4_PLLPR,
535 snd_soc_update_bits(codec, AIC32X4_PLLPR, 529 AIC32X4_PLLEN, AIC32X4_PLLEN);
536 AIC32X4_PLLEN, AIC32X4_PLLEN); 530
537 531 /* Switch on NDAC Divider */
538 /* Switch on NDAC Divider */ 532 snd_soc_update_bits(codec, AIC32X4_NDAC,
539 snd_soc_update_bits(codec, AIC32X4_NDAC, 533 AIC32X4_NDACEN, AIC32X4_NDACEN);
540 AIC32X4_NDACEN, AIC32X4_NDACEN); 534
541 535 /* Switch on MDAC Divider */
542 /* Switch on MDAC Divider */ 536 snd_soc_update_bits(codec, AIC32X4_MDAC,
543 snd_soc_update_bits(codec, AIC32X4_MDAC, 537 AIC32X4_MDACEN, AIC32X4_MDACEN);
544 AIC32X4_MDACEN, AIC32X4_MDACEN); 538
545 539 /* Switch on NADC Divider */
546 /* Switch on NADC Divider */ 540 snd_soc_update_bits(codec, AIC32X4_NADC,
547 snd_soc_update_bits(codec, AIC32X4_NADC, 541 AIC32X4_NADCEN, AIC32X4_NADCEN);
548 AIC32X4_NADCEN, AIC32X4_NADCEN); 542
549 543 /* Switch on MADC Divider */
550 /* Switch on MADC Divider */ 544 snd_soc_update_bits(codec, AIC32X4_MADC,
551 snd_soc_update_bits(codec, AIC32X4_MADC, 545 AIC32X4_MADCEN, AIC32X4_MADCEN);
552 AIC32X4_MADCEN, AIC32X4_MADCEN); 546
553 547 /* Switch on BCLK_N Divider */
554 /* Switch on BCLK_N Divider */ 548 snd_soc_update_bits(codec, AIC32X4_BCLKN,
555 snd_soc_update_bits(codec, AIC32X4_BCLKN, 549 AIC32X4_BCLKEN, AIC32X4_BCLKEN);
556 AIC32X4_BCLKEN, AIC32X4_BCLKEN);
557 }
558 break; 550 break;
559 case SND_SOC_BIAS_PREPARE: 551 case SND_SOC_BIAS_PREPARE:
560 break; 552 break;
561 case SND_SOC_BIAS_STANDBY: 553 case SND_SOC_BIAS_STANDBY:
562 if (aic32x4->master) { 554 /* Switch off PLL */
563 /* Switch off PLL */ 555 snd_soc_update_bits(codec, AIC32X4_PLLPR,
564 snd_soc_update_bits(codec, AIC32X4_PLLPR, 556 AIC32X4_PLLEN, 0);
565 AIC32X4_PLLEN, 0); 557
566 558 /* Switch off NDAC Divider */
567 /* Switch off NDAC Divider */ 559 snd_soc_update_bits(codec, AIC32X4_NDAC,
568 snd_soc_update_bits(codec, AIC32X4_NDAC, 560 AIC32X4_NDACEN, 0);
569 AIC32X4_NDACEN, 0); 561
570 562 /* Switch off MDAC Divider */
571 /* Switch off MDAC Divider */ 563 snd_soc_update_bits(codec, AIC32X4_MDAC,
572 snd_soc_update_bits(codec, AIC32X4_MDAC, 564 AIC32X4_MDACEN, 0);
573 AIC32X4_MDACEN, 0); 565
574 566 /* Switch off NADC Divider */
575 /* Switch off NADC Divider */ 567 snd_soc_update_bits(codec, AIC32X4_NADC,
576 snd_soc_update_bits(codec, AIC32X4_NADC, 568 AIC32X4_NADCEN, 0);
577 AIC32X4_NADCEN, 0); 569
578 570 /* Switch off MADC Divider */
579 /* Switch off MADC Divider */ 571 snd_soc_update_bits(codec, AIC32X4_MADC,
580 snd_soc_update_bits(codec, AIC32X4_MADC, 572 AIC32X4_MADCEN, 0);
581 AIC32X4_MADCEN, 0); 573
582 574 /* Switch off BCLK_N Divider */
583 /* Switch off BCLK_N Divider */ 575 snd_soc_update_bits(codec, AIC32X4_BCLKN,
584 snd_soc_update_bits(codec, AIC32X4_BCLKN, 576 AIC32X4_BCLKEN, 0);
585 AIC32X4_BCLKEN, 0);
586 }
587 break; 577 break;
588 case SND_SOC_BIAS_OFF: 578 case SND_SOC_BIAS_OFF:
589 break; 579 break;
@@ -651,9 +641,11 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
651 if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) { 641 if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) {
652 snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE); 642 snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE);
653 } 643 }
654 if (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) { 644
655 snd_soc_write(codec, AIC32X4_LDOCTL, AIC32X4_LDOCTLEN); 645 tmp_reg = (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) ?
656 } 646 AIC32X4_LDOCTLEN : 0;
647 snd_soc_write(codec, AIC32X4_LDOCTL, tmp_reg);
648
657 tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE); 649 tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE);
658 if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) { 650 if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) {
659 tmp_reg |= AIC32X4_LDOIN_18_36; 651 tmp_reg |= AIC32X4_LDOIN_18_36;
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index c2880907fced..a75c3766aede 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -733,8 +733,9 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
733 struct wm2000_priv *wm2000; 733 struct wm2000_priv *wm2000;
734 struct wm2000_platform_data *pdata; 734 struct wm2000_platform_data *pdata;
735 const char *filename; 735 const char *filename;
736 const struct firmware *fw; 736 const struct firmware *fw = NULL;
737 int reg, ret; 737 int ret;
738 int reg;
738 u16 id; 739 u16 id;
739 740
740 wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), 741 wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv),
@@ -751,7 +752,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
751 ret = PTR_ERR(wm2000->regmap); 752 ret = PTR_ERR(wm2000->regmap);
752 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 753 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
753 ret); 754 ret);
754 goto err; 755 goto out;
755 } 756 }
756 757
757 /* Verify that this is a WM2000 */ 758 /* Verify that this is a WM2000 */
@@ -763,7 +764,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
763 if (id != 0x2000) { 764 if (id != 0x2000) {
764 dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); 765 dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id);
765 ret = -ENODEV; 766 ret = -ENODEV;
766 goto err_regmap; 767 goto out_regmap_exit;
767 } 768 }
768 769
769 reg = wm2000_read(i2c, WM2000_REG_REVISON); 770 reg = wm2000_read(i2c, WM2000_REG_REVISON);
@@ -782,7 +783,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
782 ret = request_firmware(&fw, filename, &i2c->dev); 783 ret = request_firmware(&fw, filename, &i2c->dev);
783 if (ret != 0) { 784 if (ret != 0) {
784 dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); 785 dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret);
785 goto err_regmap; 786 goto out_regmap_exit;
786 } 787 }
787 788
788 /* Pre-cook the concatenation of the register address onto the image */ 789 /* Pre-cook the concatenation of the register address onto the image */
@@ -793,15 +794,13 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
793 if (wm2000->anc_download == NULL) { 794 if (wm2000->anc_download == NULL) {
794 dev_err(&i2c->dev, "Out of memory\n"); 795 dev_err(&i2c->dev, "Out of memory\n");
795 ret = -ENOMEM; 796 ret = -ENOMEM;
796 goto err_fw; 797 goto out_regmap_exit;
797 } 798 }
798 799
799 wm2000->anc_download[0] = 0x80; 800 wm2000->anc_download[0] = 0x80;
800 wm2000->anc_download[1] = 0x00; 801 wm2000->anc_download[1] = 0x00;
801 memcpy(wm2000->anc_download + 2, fw->data, fw->size); 802 memcpy(wm2000->anc_download + 2, fw->data, fw->size);
802 803
803 release_firmware(fw);
804
805 wm2000->anc_eng_ena = 1; 804 wm2000->anc_eng_ena = 1;
806 wm2000->anc_active = 1; 805 wm2000->anc_active = 1;
807 wm2000->spk_ena = 1; 806 wm2000->spk_ena = 1;
@@ -809,18 +808,14 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
809 808
810 wm2000_reset(wm2000); 809 wm2000_reset(wm2000);
811 810
812 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, 811 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0);
813 NULL, 0); 812 if (!ret)
814 if (ret != 0) 813 goto out;
815 goto err_fw;
816 814
817 return 0; 815out_regmap_exit:
818
819err_fw:
820 release_firmware(fw);
821err_regmap:
822 regmap_exit(wm2000->regmap); 816 regmap_exit(wm2000->regmap);
823err: 817out:
818 release_firmware(fw);
824 return ret; 819 return ret;
825} 820}
826 821
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 8b24323d6b2c..66f0611e68b6 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1377,6 +1377,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
1377 1377
1378 switch (wm5100->rev) { 1378 switch (wm5100->rev) {
1379 case 0: 1379 case 0:
1380 regcache_cache_bypass(wm5100->regmap, true);
1380 snd_soc_write(codec, 0x11, 0x3); 1381 snd_soc_write(codec, 0x11, 0x3);
1381 snd_soc_write(codec, 0x203, 0xc); 1382 snd_soc_write(codec, 0x203, 0xc);
1382 snd_soc_write(codec, 0x206, 0); 1383 snd_soc_write(codec, 0x206, 0);
@@ -1392,6 +1393,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
1392 snd_soc_write(codec, 1393 snd_soc_write(codec,
1393 wm5100_reva_patches[i].reg, 1394 wm5100_reva_patches[i].reg,
1394 wm5100_reva_patches[i].val); 1395 wm5100_reva_patches[i].val);
1396 regcache_cache_bypass(wm5100->regmap, false);
1395 break; 1397 break;
1396 default: 1398 default:
1397 break; 1399 break;
@@ -1402,6 +1404,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
1402 break; 1404 break;
1403 1405
1404 case SND_SOC_BIAS_OFF: 1406 case SND_SOC_BIAS_OFF:
1407 regcache_cache_only(wm5100->regmap, true);
1405 if (wm5100->pdata.ldo_ena) 1408 if (wm5100->pdata.ldo_ena)
1406 gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0); 1409 gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
1407 regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies), 1410 regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
index 8d4ea43d40a3..40ac888faf3d 100644
--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -55,7 +55,7 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name,
55 return 0; 55 return 0;
56 56
57 if (fw->size < 32) { 57 if (fw->size < 32) {
58 dev_err(codec->dev, "%s: firmware too short (%d bytes)\n", 58 dev_err(codec->dev, "%s: firmware too short (%zd bytes)\n",
59 name, fw->size); 59 name, fw->size);
60 goto err; 60 goto err;
61 } 61 }
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index d8da10fe5b52..13aa2bdaa7d7 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -1120,7 +1120,8 @@ SND_SOC_DAPM_SUPPLY_S("SYSCLK", 1, WM8996_AIF_CLOCKING_1, 0, 0, NULL, 0),
1120SND_SOC_DAPM_SUPPLY_S("SYSDSPCLK", 2, WM8996_CLOCKING_1, 1, 0, NULL, 0), 1120SND_SOC_DAPM_SUPPLY_S("SYSDSPCLK", 2, WM8996_CLOCKING_1, 1, 0, NULL, 0),
1121SND_SOC_DAPM_SUPPLY_S("AIFCLK", 2, WM8996_CLOCKING_1, 2, 0, NULL, 0), 1121SND_SOC_DAPM_SUPPLY_S("AIFCLK", 2, WM8996_CLOCKING_1, 2, 0, NULL, 0),
1122SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event, 1122SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event,
1123 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 1123 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1124 SND_SOC_DAPM_POST_PMD),
1124SND_SOC_DAPM_SUPPLY("Bandgap", SND_SOC_NOPM, 0, 0, bg_event, 1125SND_SOC_DAPM_SUPPLY("Bandgap", SND_SOC_NOPM, 0, 0, bg_event,
1125 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 1126 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1126SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0), 1127SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0),
@@ -2007,6 +2008,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
2007 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); 2008 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
2008 int lfclk = 0; 2009 int lfclk = 0;
2009 int ratediv = 0; 2010 int ratediv = 0;
2011 int sync = WM8996_REG_SYNC;
2010 int src; 2012 int src;
2011 int old; 2013 int old;
2012 2014
@@ -2051,6 +2053,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
2051 case 32000: 2053 case 32000:
2052 case 32768: 2054 case 32768:
2053 lfclk = WM8996_LFCLK_ENA; 2055 lfclk = WM8996_LFCLK_ENA;
2056 sync = 0;
2054 break; 2057 break;
2055 default: 2058 default:
2056 dev_warn(codec->dev, "Unsupported clock rate %dHz\n", 2059 dev_warn(codec->dev, "Unsupported clock rate %dHz\n",
@@ -2064,6 +2067,8 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
2064 WM8996_SYSCLK_SRC_MASK | WM8996_SYSCLK_DIV_MASK, 2067 WM8996_SYSCLK_SRC_MASK | WM8996_SYSCLK_DIV_MASK,
2065 src << WM8996_SYSCLK_SRC_SHIFT | ratediv); 2068 src << WM8996_SYSCLK_SRC_SHIFT | ratediv);
2066 snd_soc_update_bits(codec, WM8996_CLOCKING_1, WM8996_LFCLK_ENA, lfclk); 2069 snd_soc_update_bits(codec, WM8996_CLOCKING_1, WM8996_LFCLK_ENA, lfclk);
2070 snd_soc_update_bits(codec, WM8996_CONTROL_INTERFACE_1,
2071 WM8996_REG_SYNC, sync);
2067 snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1, 2072 snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1,
2068 WM8996_SYSCLK_ENA, old); 2073 WM8996_SYSCLK_ENA, old);
2069 2074
diff --git a/sound/soc/codecs/wm8996.h b/sound/soc/codecs/wm8996.h
index 0fde643194ce..de9ac3e44aec 100644
--- a/sound/soc/codecs/wm8996.h
+++ b/sound/soc/codecs/wm8996.h
@@ -1567,6 +1567,10 @@ int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
1567/* 1567/*
1568 * R257 (0x101) - Control Interface (1) 1568 * R257 (0x101) - Control Interface (1)
1569 */ 1569 */
1570#define WM8996_REG_SYNC 0x8000 /* REG_SYNC */
1571#define WM8996_REG_SYNC_MASK 0x8000 /* REG_SYNC */
1572#define WM8996_REG_SYNC_SHIFT 15 /* REG_SYNC */
1573#define WM8996_REG_SYNC_WIDTH 1 /* REG_SYNC */
1570#define WM8996_AUTO_INC 0x0004 /* AUTO_INC */ 1574#define WM8996_AUTO_INC 0x0004 /* AUTO_INC */
1571#define WM8996_AUTO_INC_MASK 0x0004 /* AUTO_INC */ 1575#define WM8996_AUTO_INC_MASK 0x0004 /* AUTO_INC */
1572#define WM8996_AUTO_INC_SHIFT 2 /* AUTO_INC */ 1576#define WM8996_AUTO_INC_SHIFT 2 /* AUTO_INC */
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index dccfb37a9626..f204dbac11d4 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -124,6 +124,8 @@ static int mxs_saif_set_clk(struct mxs_saif *saif,
124 * 124 *
125 * If MCLK is not used, we just set saif clk to 512*fs. 125 * If MCLK is not used, we just set saif clk to 512*fs.
126 */ 126 */
127 clk_prepare_enable(master_saif->clk);
128
127 if (master_saif->mclk_in_use) { 129 if (master_saif->mclk_in_use) {
128 if (mclk % 32 == 0) { 130 if (mclk % 32 == 0) {
129 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE; 131 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
@@ -133,6 +135,7 @@ static int mxs_saif_set_clk(struct mxs_saif *saif,
133 ret = clk_set_rate(master_saif->clk, 384 * rate); 135 ret = clk_set_rate(master_saif->clk, 384 * rate);
134 } else { 136 } else {
135 /* SAIF MCLK should be either 32x or 48x */ 137 /* SAIF MCLK should be either 32x or 48x */
138 clk_disable_unprepare(master_saif->clk);
136 return -EINVAL; 139 return -EINVAL;
137 } 140 }
138 } else { 141 } else {
@@ -140,6 +143,8 @@ static int mxs_saif_set_clk(struct mxs_saif *saif,
140 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE; 143 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
141 } 144 }
142 145
146 clk_disable_unprepare(master_saif->clk);
147
143 if (ret) 148 if (ret)
144 return ret; 149 return ret;
145 150