aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-04 10:51:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-04 10:51:43 -0400
commitb2409fb6a49d1f633a8fc488e48043da7d3fd6a7 (patch)
treef2e76570fe81901ed0b64f6c1c815fe4abcc87ea /sound
parent6b1506c66809ddf6afd17e330db2999c878b5d90 (diff)
parent6bcbf64ace40d6833622d85701218a8bb7a4f207 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (24 commits) ALSA: hda/realtek - Skip invalid digital out pins ALSA: hda/sigmatel - Automatically retrieve digital I/O widgets ALSA: hda - Remove unused variables ALSA: hda/realtek - Don't create alt-stream for capture when unnecessary ALSA: hda - Add support for 92HD65 / 92HD66 family of codecs ALSA: hda - Disable power-widget control for IDT 92HD83/93 as default ALSA: hda - Check NO_PRESENCE pincfg default bit ASoC: Ensure we always delay for WM8962 FLL when starting from SYSCLK ASoC: Ensure the WM8962 oscillator and PLLs start up disabled ASoC: Ensure WM8962 PLL registers are reset ALSA: intel8x0 - Fix inclusion of kvm_para.h ALSA: hda_hwdep: Fix possible buffer overflow ASoC: Fix return value of wm5100_gpio_direction_out() ASoC: WM8904: Set `invert' bit for Capture Switch ASoC: Leave input audio data bit length settings untouched in wm8711_set_dai_fmt ASoC: wm8711: Fix wrong mask for setting input audio data bit length select ALSA: intel8x0: Improve performance in virtual environment ALSA: hdspm - Enable all firmware ranges for PCI MADI/AES cards ALSA: hdsp - Correct HDSP_VERSION_BIT constant, thus partly fixing RPM detection ALSA: hdspm - Fix MADI channel format in the status ioctl ...
Diffstat (limited to 'sound')
-rw-r--r--sound/core/hwdep.c9
-rw-r--r--sound/pci/hda/hda_hwdep.c2
-rw-r--r--sound/pci/hda/hda_local.h4
-rw-r--r--sound/pci/hda/patch_hdmi.c5
-rw-r--r--sound/pci/hda/patch_realtek.c23
-rw-r--r--sound/pci/hda/patch_sigmatel.c67
-rw-r--r--sound/pci/hda/patch_via.c5
-rw-r--r--sound/pci/intel8x0.c29
-rw-r--r--sound/pci/rme9652/hdsp.c2
-rw-r--r--sound/pci/rme9652/hdspm.c42
-rw-r--r--sound/soc/codecs/tlv320aic23.c1
-rw-r--r--sound/soc/codecs/tlv320aic3x.c1
-rw-r--r--sound/soc/codecs/wm5100.c12
-rw-r--r--sound/soc/codecs/wm8711.c4
-rw-r--r--sound/soc/codecs/wm8904.c2
-rw-r--r--sound/soc/codecs/wm8940.c2
-rw-r--r--sound/soc/codecs/wm8962.c30
17 files changed, 145 insertions, 95 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index a70ee7f1ed98..031e215b6dde 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -272,7 +272,14 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,
272 if (get_user(device, (int __user *)arg)) 272 if (get_user(device, (int __user *)arg))
273 return -EFAULT; 273 return -EFAULT;
274 mutex_lock(&register_mutex); 274 mutex_lock(&register_mutex);
275 device = device < 0 ? 0 : device + 1; 275
276 if (device < 0)
277 device = 0;
278 else if (device < SNDRV_MINOR_HWDEPS)
279 device++;
280 else
281 device = SNDRV_MINOR_HWDEPS;
282
276 while (device < SNDRV_MINOR_HWDEPS) { 283 while (device < SNDRV_MINOR_HWDEPS) {
277 if (snd_hwdep_search(card, device)) 284 if (snd_hwdep_search(card, device))
278 break; 285 break;
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 72e5885007cc..7e7d0788ddcf 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -756,8 +756,6 @@ static int get_line_from_fw(char *buf, int size, struct firmware *fw)
756 } 756 }
757 if (!fw->size) 757 if (!fw->size)
758 return 0; 758 return 0;
759 if (size < fw->size)
760 size = fw->size;
761 759
762 for (len = 0; len < fw->size; len++) { 760 for (len = 0; len < fw->size; len++) {
763 if (!*p) 761 if (!*p)
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 81e12c0ed0a2..79f49e2e8cbc 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -442,6 +442,8 @@ struct auto_pin_cfg {
442 (cfg & AC_DEFCFG_SEQUENCE) 442 (cfg & AC_DEFCFG_SEQUENCE)
443#define get_defcfg_device(cfg) \ 443#define get_defcfg_device(cfg) \
444 ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT) 444 ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT)
445#define get_defcfg_misc(cfg) \
446 ((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT)
445 447
446/* bit-flags for snd_hda_parse_pin_def_config() behavior */ 448/* bit-flags for snd_hda_parse_pin_def_config() behavior */
447#define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */ 449#define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
@@ -509,6 +511,8 @@ int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
509static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) 511static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
510{ 512{
511 return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && 513 return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
514 !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) &
515 AC_DEFCFG_MISC_NO_PRESENCE)) &&
512 (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); 516 (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
513} 517}
514 518
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 342540128fb8..aac3bfacda3f 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1006,7 +1006,6 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
1006 unsigned int caps, config; 1006 unsigned int caps, config;
1007 int pin_idx; 1007 int pin_idx;
1008 struct hdmi_spec_per_pin *per_pin; 1008 struct hdmi_spec_per_pin *per_pin;
1009 struct hdmi_eld *eld;
1010 int err; 1009 int err;
1011 1010
1012 caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP); 1011 caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP);
@@ -1023,7 +1022,6 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
1023 1022
1024 pin_idx = spec->num_pins; 1023 pin_idx = spec->num_pins;
1025 per_pin = &spec->pins[pin_idx]; 1024 per_pin = &spec->pins[pin_idx];
1026 eld = &per_pin->sink_eld;
1027 1025
1028 per_pin->pin_nid = pin_nid; 1026 per_pin->pin_nid = pin_nid;
1029 1027
@@ -1576,7 +1574,7 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1576 struct snd_pcm_substream *substream) 1574 struct snd_pcm_substream *substream)
1577{ 1575{
1578 int chs; 1576 int chs;
1579 unsigned int dataDCC1, dataDCC2, channel_id; 1577 unsigned int dataDCC2, channel_id;
1580 int i; 1578 int i;
1581 struct hdmi_spec *spec = codec->spec; 1579 struct hdmi_spec *spec = codec->spec;
1582 struct hda_spdif_out *spdif = 1580 struct hda_spdif_out *spdif =
@@ -1586,7 +1584,6 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1586 1584
1587 chs = substream->runtime->channels; 1585 chs = substream->runtime->channels;
1588 1586
1589 dataDCC1 = AC_DIG1_ENABLE | AC_DIG1_COPYRIGHT;
1590 dataDCC2 = 0x2; 1587 dataDCC2 = 0x2;
1591 1588
1592 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ 1589 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8f93b97559a5..80d6add8a620 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1604,27 +1604,29 @@ static void alc_auto_init_digital(struct hda_codec *codec)
1604static void alc_auto_parse_digital(struct hda_codec *codec) 1604static void alc_auto_parse_digital(struct hda_codec *codec)
1605{ 1605{
1606 struct alc_spec *spec = codec->spec; 1606 struct alc_spec *spec = codec->spec;
1607 int i, err; 1607 int i, err, nums;
1608 hda_nid_t dig_nid; 1608 hda_nid_t dig_nid;
1609 1609
1610 /* support multiple SPDIFs; the secondary is set up as a slave */ 1610 /* support multiple SPDIFs; the secondary is set up as a slave */
1611 nums = 0;
1611 for (i = 0; i < spec->autocfg.dig_outs; i++) { 1612 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1612 hda_nid_t conn[4]; 1613 hda_nid_t conn[4];
1613 err = snd_hda_get_connections(codec, 1614 err = snd_hda_get_connections(codec,
1614 spec->autocfg.dig_out_pins[i], 1615 spec->autocfg.dig_out_pins[i],
1615 conn, ARRAY_SIZE(conn)); 1616 conn, ARRAY_SIZE(conn));
1616 if (err < 0) 1617 if (err <= 0)
1617 continue; 1618 continue;
1618 dig_nid = conn[0]; /* assume the first element is audio-out */ 1619 dig_nid = conn[0]; /* assume the first element is audio-out */
1619 if (!i) { 1620 if (!nums) {
1620 spec->multiout.dig_out_nid = dig_nid; 1621 spec->multiout.dig_out_nid = dig_nid;
1621 spec->dig_out_type = spec->autocfg.dig_out_type[0]; 1622 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1622 } else { 1623 } else {
1623 spec->multiout.slave_dig_outs = spec->slave_dig_outs; 1624 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1624 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) 1625 if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1625 break; 1626 break;
1626 spec->slave_dig_outs[i - 1] = dig_nid; 1627 spec->slave_dig_outs[nums - 1] = dig_nid;
1627 } 1628 }
1629 nums++;
1628 } 1630 }
1629 1631
1630 if (spec->autocfg.dig_in_pin) { 1632 if (spec->autocfg.dig_in_pin) {
@@ -2270,6 +2272,7 @@ static int alc_build_pcms(struct hda_codec *codec)
2270 struct alc_spec *spec = codec->spec; 2272 struct alc_spec *spec = codec->spec;
2271 struct hda_pcm *info = spec->pcm_rec; 2273 struct hda_pcm *info = spec->pcm_rec;
2272 const struct hda_pcm_stream *p; 2274 const struct hda_pcm_stream *p;
2275 bool have_multi_adcs;
2273 int i; 2276 int i;
2274 2277
2275 codec->num_pcms = 1; 2278 codec->num_pcms = 1;
@@ -2348,8 +2351,11 @@ static int alc_build_pcms(struct hda_codec *codec)
2348 /* If the use of more than one ADC is requested for the current 2351 /* If the use of more than one ADC is requested for the current
2349 * model, configure a second analog capture-only PCM. 2352 * model, configure a second analog capture-only PCM.
2350 */ 2353 */
2354 have_multi_adcs = (spec->num_adc_nids > 1) &&
2355 !spec->dyn_adc_switch && !spec->auto_mic &&
2356 (!spec->input_mux || spec->input_mux->num_items > 1);
2351 /* Additional Analaog capture for index #2 */ 2357 /* Additional Analaog capture for index #2 */
2352 if (spec->alt_dac_nid || spec->num_adc_nids > 1) { 2358 if (spec->alt_dac_nid || have_multi_adcs) {
2353 codec->num_pcms = 3; 2359 codec->num_pcms = 3;
2354 info = spec->pcm_rec + 2; 2360 info = spec->pcm_rec + 2;
2355 info->name = spec->stream_name_analog; 2361 info->name = spec->stream_name_analog;
@@ -2365,7 +2371,7 @@ static int alc_build_pcms(struct hda_codec *codec)
2365 alc_pcm_null_stream; 2371 alc_pcm_null_stream;
2366 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; 2372 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2367 } 2373 }
2368 if (spec->num_adc_nids > 1) { 2374 if (have_multi_adcs) {
2369 p = spec->stream_analog_alt_capture; 2375 p = spec->stream_analog_alt_capture;
2370 if (!p) 2376 if (!p)
2371 p = &alc_pcm_analog_alt_capture; 2377 p = &alc_pcm_analog_alt_capture;
@@ -2657,7 +2663,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec)
2657 hda_nid_t *adc_nids = spec->private_adc_nids; 2663 hda_nid_t *adc_nids = spec->private_adc_nids;
2658 hda_nid_t *cap_nids = spec->private_capsrc_nids; 2664 hda_nid_t *cap_nids = spec->private_capsrc_nids;
2659 int max_nums = ARRAY_SIZE(spec->private_adc_nids); 2665 int max_nums = ARRAY_SIZE(spec->private_adc_nids);
2660 bool indep_capsrc = false;
2661 int i, nums = 0; 2666 int i, nums = 0;
2662 2667
2663 nid = codec->start_nid; 2668 nid = codec->start_nid;
@@ -2679,13 +2684,11 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec)
2679 break; 2684 break;
2680 if (type == AC_WID_AUD_SEL) { 2685 if (type == AC_WID_AUD_SEL) {
2681 cap_nids[nums] = src; 2686 cap_nids[nums] = src;
2682 indep_capsrc = true;
2683 break; 2687 break;
2684 } 2688 }
2685 n = snd_hda_get_conn_list(codec, src, &list); 2689 n = snd_hda_get_conn_list(codec, src, &list);
2686 if (n > 1) { 2690 if (n > 1) {
2687 cap_nids[nums] = src; 2691 cap_nids[nums] = src;
2688 indep_capsrc = true;
2689 break; 2692 break;
2690 } else if (n != 1) 2693 } else if (n != 1)
2691 break; 2694 break;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 59a52a430f24..de4c36027cbe 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3791,9 +3791,10 @@ static int is_dual_headphones(struct hda_codec *codec)
3791} 3791}
3792 3792
3793 3793
3794static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) 3794static int stac92xx_parse_auto_config(struct hda_codec *codec)
3795{ 3795{
3796 struct sigmatel_spec *spec = codec->spec; 3796 struct sigmatel_spec *spec = codec->spec;
3797 hda_nid_t dig_out = 0, dig_in = 0;
3797 int hp_swap = 0; 3798 int hp_swap = 0;
3798 int i, err; 3799 int i, err;
3799 3800
@@ -3976,6 +3977,22 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3976 if (spec->multiout.max_channels > 2) 3977 if (spec->multiout.max_channels > 2)
3977 spec->surr_switch = 1; 3978 spec->surr_switch = 1;
3978 3979
3980 /* find digital out and in converters */
3981 for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) {
3982 unsigned int wid_caps = get_wcaps(codec, i);
3983 if (wid_caps & AC_WCAP_DIGITAL) {
3984 switch (get_wcaps_type(wid_caps)) {
3985 case AC_WID_AUD_OUT:
3986 if (!dig_out)
3987 dig_out = i;
3988 break;
3989 case AC_WID_AUD_IN:
3990 if (!dig_in)
3991 dig_in = i;
3992 break;
3993 }
3994 }
3995 }
3979 if (spec->autocfg.dig_outs) 3996 if (spec->autocfg.dig_outs)
3980 spec->multiout.dig_out_nid = dig_out; 3997 spec->multiout.dig_out_nid = dig_out;
3981 if (dig_in && spec->autocfg.dig_in_pin) 3998 if (dig_in && spec->autocfg.dig_in_pin)
@@ -5279,7 +5296,7 @@ static int patch_stac925x(struct hda_codec *codec)
5279 spec->capvols = stac925x_capvols; 5296 spec->capvols = stac925x_capvols;
5280 spec->capsws = stac925x_capsws; 5297 spec->capsws = stac925x_capsws;
5281 5298
5282 err = stac92xx_parse_auto_config(codec, 0x8, 0x7); 5299 err = stac92xx_parse_auto_config(codec);
5283 if (!err) { 5300 if (!err) {
5284 if (spec->board_config < 0) { 5301 if (spec->board_config < 0) {
5285 printk(KERN_WARNING "hda_codec: No auto-config is " 5302 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -5420,7 +5437,7 @@ again:
5420 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); 5437 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
5421 spec->pwr_nids = stac92hd73xx_pwr_nids; 5438 spec->pwr_nids = stac92hd73xx_pwr_nids;
5422 5439
5423 err = stac92xx_parse_auto_config(codec, 0x25, 0x27); 5440 err = stac92xx_parse_auto_config(codec);
5424 5441
5425 if (!err) { 5442 if (!err) {
5426 if (spec->board_config < 0) { 5443 if (spec->board_config < 0) {
@@ -5629,26 +5646,8 @@ again:
5629 stac92xx_set_config_regs(codec, 5646 stac92xx_set_config_regs(codec,
5630 stac92hd83xxx_brd_tbl[spec->board_config]); 5647 stac92hd83xxx_brd_tbl[spec->board_config]);
5631 5648
5632 switch (codec->vendor_id) { 5649 if (spec->board_config != STAC_92HD83XXX_PWR_REF)
5633 case 0x111d76d1:
5634 case 0x111d76d9:
5635 case 0x111d76df:
5636 case 0x111d76e5:
5637 case 0x111d7666:
5638 case 0x111d7667:
5639 case 0x111d7668:
5640 case 0x111d7669:
5641 case 0x111d76e3:
5642 case 0x111d7604:
5643 case 0x111d76d4:
5644 case 0x111d7605:
5645 case 0x111d76d5:
5646 case 0x111d76e7:
5647 if (spec->board_config == STAC_92HD83XXX_PWR_REF)
5648 break;
5649 spec->num_pwrs = 0; 5650 spec->num_pwrs = 0;
5650 break;
5651 }
5652 5651
5653 codec->patch_ops = stac92xx_patch_ops; 5652 codec->patch_ops = stac92xx_patch_ops;
5654 5653
@@ -5675,7 +5674,7 @@ again:
5675 } 5674 }
5676#endif 5675#endif
5677 5676
5678 err = stac92xx_parse_auto_config(codec, 0x1d, 0); 5677 err = stac92xx_parse_auto_config(codec);
5679 if (!err) { 5678 if (!err) {
5680 if (spec->board_config < 0) { 5679 if (spec->board_config < 0) {
5681 printk(KERN_WARNING "hda_codec: No auto-config is " 5680 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -5996,7 +5995,7 @@ again:
5996 5995
5997 spec->multiout.dac_nids = spec->dac_nids; 5996 spec->multiout.dac_nids = spec->dac_nids;
5998 5997
5999 err = stac92xx_parse_auto_config(codec, 0x21, 0); 5998 err = stac92xx_parse_auto_config(codec);
6000 if (!err) { 5999 if (!err) {
6001 if (spec->board_config < 0) { 6000 if (spec->board_config < 0) {
6002 printk(KERN_WARNING "hda_codec: No auto-config is " 6001 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6105,7 +6104,7 @@ static int patch_stac922x(struct hda_codec *codec)
6105 6104
6106 spec->multiout.dac_nids = spec->dac_nids; 6105 spec->multiout.dac_nids = spec->dac_nids;
6107 6106
6108 err = stac92xx_parse_auto_config(codec, 0x08, 0x09); 6107 err = stac92xx_parse_auto_config(codec);
6109 if (!err) { 6108 if (!err) {
6110 if (spec->board_config < 0) { 6109 if (spec->board_config < 0) {
6111 printk(KERN_WARNING "hda_codec: No auto-config is " 6110 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6230,7 +6229,7 @@ static int patch_stac927x(struct hda_codec *codec)
6230 spec->aloopback_shift = 0; 6229 spec->aloopback_shift = 0;
6231 spec->eapd_switch = 1; 6230 spec->eapd_switch = 1;
6232 6231
6233 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 6232 err = stac92xx_parse_auto_config(codec);
6234 if (!err) { 6233 if (!err) {
6235 if (spec->board_config < 0) { 6234 if (spec->board_config < 0) {
6236 printk(KERN_WARNING "hda_codec: No auto-config is " 6235 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6355,7 +6354,7 @@ static int patch_stac9205(struct hda_codec *codec)
6355 break; 6354 break;
6356 } 6355 }
6357 6356
6358 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); 6357 err = stac92xx_parse_auto_config(codec);
6359 if (!err) { 6358 if (!err) {
6360 if (spec->board_config < 0) { 6359 if (spec->board_config < 0) {
6361 printk(KERN_WARNING "hda_codec: No auto-config is " 6360 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6460,7 +6459,7 @@ static int patch_stac9872(struct hda_codec *codec)
6460 spec->capvols = stac9872_capvols; 6459 spec->capvols = stac9872_capvols;
6461 spec->capsws = stac9872_capsws; 6460 spec->capsws = stac9872_capsws;
6462 6461
6463 err = stac92xx_parse_auto_config(codec, 0x10, 0x12); 6462 err = stac92xx_parse_auto_config(codec);
6464 if (err < 0) { 6463 if (err < 0) {
6465 stac92xx_free(codec); 6464 stac92xx_free(codec);
6466 return -EINVAL; 6465 return -EINVAL;
@@ -6565,6 +6564,18 @@ static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6565 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, 6564 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
6566 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, 6565 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
6567 { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, 6566 { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
6567 { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
6568 { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
6569 { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
6570 { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
6571 { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
6572 { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
6573 { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
6574 { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
6575 { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
6576 { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
6577 { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
6578 { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
6568 {} /* terminator */ 6579 {} /* terminator */
6569}; 6580};
6570 6581
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 417d62ad3b96..0b020a93a8ed 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -3700,13 +3700,8 @@ static const struct hda_verb vt1812_init_verbs[] = {
3700static void set_widgets_power_state_vt1812(struct hda_codec *codec) 3700static void set_widgets_power_state_vt1812(struct hda_codec *codec)
3701{ 3701{
3702 struct via_spec *spec = codec->spec; 3702 struct via_spec *spec = codec->spec;
3703 int imux_is_smixer =
3704 snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
3705 unsigned int parm; 3703 unsigned int parm;
3706 unsigned int present; 3704 unsigned int present;
3707 /* MUX10 (1eh) = stereo mixer */
3708 imux_is_smixer =
3709 snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
3710 /* inputs */ 3705 /* inputs */
3711 /* PW 5/6/7 (29h/2ah/2bh) */ 3706 /* PW 5/6/7 (29h/2ah/2bh) */
3712 parm = AC_PWRST_D3; 3707 parm = AC_PWRST_D3;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 6a5b387b97fd..45b2055f5a76 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -42,6 +42,12 @@
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <asm/cacheflush.h> 43#include <asm/cacheflush.h>
44 44
45#ifdef CONFIG_KVM_GUEST
46#include <linux/kvm_para.h>
47#else
48#define kvm_para_available() (0)
49#endif
50
45MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); 51MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
46MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7012; Ali 5455"); 52MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7012; Ali 5455");
47MODULE_LICENSE("GPL"); 53MODULE_LICENSE("GPL");
@@ -77,6 +83,7 @@ static int buggy_semaphore;
77static int buggy_irq = -1; /* auto-check */ 83static int buggy_irq = -1; /* auto-check */
78static int xbox; 84static int xbox;
79static int spdif_aclink = -1; 85static int spdif_aclink = -1;
86static int inside_vm = -1;
80 87
81module_param(index, int, 0444); 88module_param(index, int, 0444);
82MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard."); 89MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard.");
@@ -94,6 +101,8 @@ module_param(xbox, bool, 0444);
94MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection."); 101MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection.");
95module_param(spdif_aclink, int, 0444); 102module_param(spdif_aclink, int, 0444);
96MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); 103MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
104module_param(inside_vm, bool, 0444);
105MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization.");
97 106
98/* just for backward compatibility */ 107/* just for backward compatibility */
99static int enable; 108static int enable;
@@ -400,6 +409,7 @@ struct intel8x0 {
400 unsigned buggy_irq: 1; /* workaround for buggy mobos */ 409 unsigned buggy_irq: 1; /* workaround for buggy mobos */
401 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ 410 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */
402 unsigned buggy_semaphore: 1; /* workaround for buggy codec semaphore */ 411 unsigned buggy_semaphore: 1; /* workaround for buggy codec semaphore */
412 unsigned inside_vm: 1; /* enable VM optimization */
403 413
404 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ 414 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */
405 unsigned int sdm_saved; /* SDM reg value */ 415 unsigned int sdm_saved; /* SDM reg value */
@@ -1065,8 +1075,11 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs
1065 udelay(10); 1075 udelay(10);
1066 continue; 1076 continue;
1067 } 1077 }
1068 if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && 1078 if (civ != igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV))
1069 ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) 1079 continue;
1080 if (chip->inside_vm)
1081 break;
1082 if (ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb))
1070 break; 1083 break;
1071 } while (timeout--); 1084 } while (timeout--);
1072 ptr = ichdev->last_pos; 1085 ptr = ichdev->last_pos;
@@ -2984,6 +2997,10 @@ static int __devinit snd_intel8x0_create(struct snd_card *card,
2984 if (xbox) 2997 if (xbox)
2985 chip->xbox = 1; 2998 chip->xbox = 1;
2986 2999
3000 chip->inside_vm = inside_vm;
3001 if (inside_vm)
3002 printk(KERN_INFO "intel8x0: enable KVM optimization\n");
3003
2987 if (pci->vendor == PCI_VENDOR_ID_INTEL && 3004 if (pci->vendor == PCI_VENDOR_ID_INTEL &&
2988 pci->device == PCI_DEVICE_ID_INTEL_440MX) 3005 pci->device == PCI_DEVICE_ID_INTEL_440MX)
2989 chip->fix_nocache = 1; /* enable workaround */ 3006 chip->fix_nocache = 1; /* enable workaround */
@@ -3226,6 +3243,14 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
3226 buggy_irq = 0; 3243 buggy_irq = 0;
3227 } 3244 }
3228 3245
3246 if (inside_vm < 0) {
3247 /* detect KVM and Parallels virtual environments */
3248 inside_vm = kvm_para_available();
3249#if defined(__i386__) || defined(__x86_64__)
3250 inside_vm = inside_vm || boot_cpu_has(X86_FEATURE_HYPERVISOR);
3251#endif
3252 }
3253
3229 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, 3254 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
3230 &chip)) < 0) { 3255 &chip)) < 0) {
3231 snd_card_free(card); 3256 snd_card_free(card);
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 1c6d1e1c27c1..f74220292254 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -151,7 +151,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
151#define HDSP_PROGRAM 0x020 151#define HDSP_PROGRAM 0x020
152#define HDSP_CONFIG_MODE_0 0x040 152#define HDSP_CONFIG_MODE_0 0x040
153#define HDSP_CONFIG_MODE_1 0x080 153#define HDSP_CONFIG_MODE_1 0x080
154#define HDSP_VERSION_BIT 0x100 154#define HDSP_VERSION_BIT (0x100 | HDSP_S_LOAD)
155#define HDSP_BIGENDIAN_MODE 0x200 155#define HDSP_BIGENDIAN_MODE 0x200
156#define HDSP_RD_MULTIPLE 0x400 156#define HDSP_RD_MULTIPLE 0x400
157#define HDSP_9652_ENABLE_MIXER 0x800 157#define HDSP_9652_ENABLE_MIXER 0x800
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 6e2f7ef7ddb1..15a6c3b9bc9a 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -520,16 +520,9 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
520#define HDSPM_DMA_AREA_BYTES (HDSPM_MAX_CHANNELS * HDSPM_CHANNEL_BUFFER_BYTES) 520#define HDSPM_DMA_AREA_BYTES (HDSPM_MAX_CHANNELS * HDSPM_CHANNEL_BUFFER_BYTES)
521#define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024) 521#define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024)
522 522
523/* revisions >= 230 indicate AES32 card */
524#define HDSPM_MADI_ANCIENT_REV 204
525#define HDSPM_MADI_OLD_REV 207
526#define HDSPM_MADI_REV 210
527#define HDSPM_RAYDAT_REV 211 523#define HDSPM_RAYDAT_REV 211
528#define HDSPM_AIO_REV 212 524#define HDSPM_AIO_REV 212
529#define HDSPM_MADIFACE_REV 213 525#define HDSPM_MADIFACE_REV 213
530#define HDSPM_AES_REV 240
531#define HDSPM_AES32_REV 234
532#define HDSPM_AES32_OLD_REV 233
533 526
534/* speed factor modes */ 527/* speed factor modes */
535#define HDSPM_SPEED_SINGLE 0 528#define HDSPM_SPEED_SINGLE 0
@@ -6253,7 +6246,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6253 status.card_specific.madi.madi_input = 6246 status.card_specific.madi.madi_input =
6254 (statusregister & HDSPM_AB_int) ? 1 : 0; 6247 (statusregister & HDSPM_AB_int) ? 1 : 0;
6255 status.card_specific.madi.channel_format = 6248 status.card_specific.madi.channel_format =
6256 (statusregister & HDSPM_TX_64ch) ? 1 : 0; 6249 (statusregister & HDSPM_RX_64ch) ? 1 : 0;
6257 /* TODO: Mac driver sets it when f_s>48kHz */ 6250 /* TODO: Mac driver sets it when f_s>48kHz */
6258 status.card_specific.madi.frame_format = 0; 6251 status.card_specific.madi.frame_format = 0;
6259 6252
@@ -6503,13 +6496,6 @@ static int __devinit snd_hdspm_create(struct snd_card *card,
6503 strcpy(card->driver, "HDSPM"); 6496 strcpy(card->driver, "HDSPM");
6504 6497
6505 switch (hdspm->firmware_rev) { 6498 switch (hdspm->firmware_rev) {
6506 case HDSPM_MADI_REV:
6507 case HDSPM_MADI_OLD_REV:
6508 case HDSPM_MADI_ANCIENT_REV:
6509 hdspm->io_type = MADI;
6510 hdspm->card_name = "RME MADI";
6511 hdspm->midiPorts = 3;
6512 break;
6513 case HDSPM_RAYDAT_REV: 6499 case HDSPM_RAYDAT_REV:
6514 hdspm->io_type = RayDAT; 6500 hdspm->io_type = RayDAT;
6515 hdspm->card_name = "RME RayDAT"; 6501 hdspm->card_name = "RME RayDAT";
@@ -6525,17 +6511,25 @@ static int __devinit snd_hdspm_create(struct snd_card *card,
6525 hdspm->card_name = "RME MADIface"; 6511 hdspm->card_name = "RME MADIface";
6526 hdspm->midiPorts = 1; 6512 hdspm->midiPorts = 1;
6527 break; 6513 break;
6528 case HDSPM_AES_REV:
6529 case HDSPM_AES32_REV:
6530 case HDSPM_AES32_OLD_REV:
6531 hdspm->io_type = AES32;
6532 hdspm->card_name = "RME AES32";
6533 hdspm->midiPorts = 2;
6534 break;
6535 default: 6514 default:
6536 snd_printk(KERN_ERR "HDSPM: unknown firmware revision %x\n", 6515 if ((hdspm->firmware_rev == 0xf0) ||
6516 ((hdspm->firmware_rev >= 0xe6) &&
6517 (hdspm->firmware_rev <= 0xea))) {
6518 hdspm->io_type = AES32;
6519 hdspm->card_name = "RME AES32";
6520 hdspm->midiPorts = 2;
6521 } else if ((hdspm->firmware_rev == 0xd5) ||
6522 ((hdspm->firmware_rev >= 0xc8) &&
6523 (hdspm->firmware_rev <= 0xcf))) {
6524 hdspm->io_type = MADI;
6525 hdspm->card_name = "RME MADI";
6526 hdspm->midiPorts = 3;
6527 } else {
6528 snd_printk(KERN_ERR
6529 "HDSPM: unknown firmware revision %x\n",
6537 hdspm->firmware_rev); 6530 hdspm->firmware_rev);
6538 return -ENODEV; 6531 return -ENODEV;
6532 }
6539 } 6533 }
6540 6534
6541 err = pci_enable_device(pci); 6535 err = pci_enable_device(pci);
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index ab27dbcd1262..336de8f69a02 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -430,6 +430,7 @@ static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai,
430 iface_reg |= TLV320AIC23_MS_MASTER; 430 iface_reg |= TLV320AIC23_MS_MASTER;
431 break; 431 break;
432 case SND_SOC_DAIFMT_CBS_CFS: 432 case SND_SOC_DAIFMT_CBS_CFS:
433 iface_reg &= ~TLV320AIC23_MS_MASTER;
433 break; 434 break;
434 default: 435 default:
435 return -EINVAL; 436 return -EINVAL;
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 7a49390bc30d..87d5ef188e29 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1023,6 +1023,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,
1023 break; 1023 break;
1024 case SND_SOC_DAIFMT_CBS_CFS: 1024 case SND_SOC_DAIFMT_CBS_CFS:
1025 aic3x->master = 0; 1025 aic3x->master = 0;
1026 iface_areg &= ~(BIT_CLK_MASTER | WORD_CLK_MASTER);
1026 break; 1027 break;
1027 default: 1028 default:
1028 return -EINVAL; 1029 return -EINVAL;
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 5d88c99aaea6..42d9039a49e9 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -2361,13 +2361,17 @@ static int wm5100_gpio_direction_out(struct gpio_chip *chip,
2361{ 2361{
2362 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); 2362 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
2363 struct snd_soc_codec *codec = wm5100->codec; 2363 struct snd_soc_codec *codec = wm5100->codec;
2364 int val; 2364 int val, ret;
2365 2365
2366 val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT); 2366 val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT);
2367 2367
2368 return snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, 2368 ret = snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset,
2369 WM5100_GP1_FN_MASK | WM5100_GP1_DIR | 2369 WM5100_GP1_FN_MASK | WM5100_GP1_DIR |
2370 WM5100_GP1_LVL, val); 2370 WM5100_GP1_LVL, val);
2371 if (ret < 0)
2372 return ret;
2373 else
2374 return 0;
2371} 2375}
2372 2376
2373static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset) 2377static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset)
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 8d0347cf0e9a..076bdb9930a1 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -151,7 +151,7 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream,
151{ 151{
152 struct snd_soc_codec *codec = dai->codec; 152 struct snd_soc_codec *codec = dai->codec;
153 struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec); 153 struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
154 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfffc; 154 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfff3;
155 int i = get_coeff(wm8711->sysclk, params_rate(params)); 155 int i = get_coeff(wm8711->sysclk, params_rate(params));
156 u16 srate = (coeff_div[i].sr << 2) | 156 u16 srate = (coeff_div[i].sr << 2) |
157 (coeff_div[i].bosr << 1) | coeff_div[i].usb; 157 (coeff_div[i].bosr << 1) | coeff_div[i].usb;
@@ -232,7 +232,7 @@ static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai,
232 unsigned int fmt) 232 unsigned int fmt)
233{ 233{
234 struct snd_soc_codec *codec = codec_dai->codec; 234 struct snd_soc_codec *codec = codec_dai->codec;
235 u16 iface = 0; 235 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0x000c;
236 236
237 /* set master/slave audio interface */ 237 /* set master/slave audio interface */
238 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 238 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 9fc8f4c0a9a9..285ef87e6704 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -867,7 +867,7 @@ SOC_ENUM("Right Capture Mode", rin_mode),
867SOC_DOUBLE_R("Capture Volume", WM8904_ANALOGUE_LEFT_INPUT_0, 867SOC_DOUBLE_R("Capture Volume", WM8904_ANALOGUE_LEFT_INPUT_0,
868 WM8904_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0), 868 WM8904_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0),
869SOC_DOUBLE_R("Capture Switch", WM8904_ANALOGUE_LEFT_INPUT_0, 869SOC_DOUBLE_R("Capture Switch", WM8904_ANALOGUE_LEFT_INPUT_0,
870 WM8904_ANALOGUE_RIGHT_INPUT_0, 7, 1, 0), 870 WM8904_ANALOGUE_RIGHT_INPUT_0, 7, 1, 1),
871 871
872SOC_SINGLE("High Pass Filter Switch", WM8904_ADC_DIGITAL_0, 4, 1, 0), 872SOC_SINGLE("High Pass Filter Switch", WM8904_ADC_DIGITAL_0, 4, 1, 0),
873SOC_ENUM("High Pass Filter Mode", hpf_mode), 873SOC_ENUM("High Pass Filter Mode", hpf_mode),
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index dc5cb3150857..de9ec9b8b7d9 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -621,7 +621,7 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
621 621
622 switch (div_id) { 622 switch (div_id) {
623 case WM8940_BCLKDIV: 623 case WM8940_BCLKDIV:
624 reg = snd_soc_read(codec, WM8940_CLOCK) & 0xFFEF3; 624 reg = snd_soc_read(codec, WM8940_CLOCK) & 0xFFE3;
625 ret = snd_soc_write(codec, WM8940_CLOCK, reg | (div << 2)); 625 ret = snd_soc_write(codec, WM8940_CLOCK, reg | (div << 2));
626 break; 626 break;
627 case WM8940_MCLKDIV: 627 case WM8940_MCLKDIV:
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index f60dfa16545e..91d3c6dbeba3 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1961,7 +1961,13 @@ static int wm8962_readable_register(struct snd_soc_codec *codec, unsigned int re
1961 1961
1962static int wm8962_reset(struct snd_soc_codec *codec) 1962static int wm8962_reset(struct snd_soc_codec *codec)
1963{ 1963{
1964 return snd_soc_write(codec, WM8962_SOFTWARE_RESET, 0x6243); 1964 int ret;
1965
1966 ret = snd_soc_write(codec, WM8962_SOFTWARE_RESET, 0x6243);
1967 if (ret != 0)
1968 return ret;
1969
1970 return snd_soc_write(codec, WM8962_PLL_SOFTWARE_RESET, 0);
1965} 1971}
1966 1972
1967static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); 1973static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0);
@@ -2360,15 +2366,14 @@ static int sysclk_event(struct snd_soc_dapm_widget *w,
2360 2366
2361 snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1, 2367 snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1,
2362 WM8962_FLL_ENA, WM8962_FLL_ENA); 2368 WM8962_FLL_ENA, WM8962_FLL_ENA);
2363 if (wm8962->irq) { 2369
2364 timeout = msecs_to_jiffies(5); 2370 timeout = msecs_to_jiffies(5);
2365 timeout = wait_for_completion_timeout(&wm8962->fll_lock, 2371 timeout = wait_for_completion_timeout(&wm8962->fll_lock,
2366 timeout); 2372 timeout);
2367 2373
2368 if (timeout == 0) 2374 if (wm8962->irq && timeout == 0)
2369 dev_err(codec->dev, 2375 dev_err(codec->dev,
2370 "Timed out starting FLL\n"); 2376 "Timed out starting FLL\n");
2371 }
2372 } 2377 }
2373 break; 2378 break;
2374 2379
@@ -4029,6 +4034,11 @@ static int wm8962_probe(struct snd_soc_codec *codec)
4029 snd_soc_update_bits(codec, WM8962_CLOCKING2, 4034 snd_soc_update_bits(codec, WM8962_CLOCKING2,
4030 WM8962_CLKREG_OVD, WM8962_CLKREG_OVD); 4035 WM8962_CLKREG_OVD, WM8962_CLKREG_OVD);
4031 4036
4037 /* Ensure that the oscillator and PLLs are disabled */
4038 snd_soc_update_bits(codec, WM8962_PLL2,
4039 WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA,
4040 0);
4041
4032 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); 4042 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4033 4043
4034 if (pdata) { 4044 if (pdata) {