diff options
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r-- | sound/pci/hda/patch_analog.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index a99e86d74278..e8003d99f0bf 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/mutex.h> | ||
27 | 26 | ||
28 | #include <sound/core.h> | 27 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 28 | #include "hda_codec.h" |
@@ -64,7 +63,6 @@ struct ad198x_spec { | |||
64 | /* PCM information */ | 63 | /* PCM information */ |
65 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ | 64 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
66 | 65 | ||
67 | struct mutex amp_mutex; /* PCM volume/mute control mutex */ | ||
68 | unsigned int spdif_route; | 66 | unsigned int spdif_route; |
69 | 67 | ||
70 | /* dynamic controls, init_verbs and input_mux */ | 68 | /* dynamic controls, init_verbs and input_mux */ |
@@ -1618,6 +1616,7 @@ static const char *ad1981_models[AD1981_MODELS] = { | |||
1618 | 1616 | ||
1619 | static struct snd_pci_quirk ad1981_cfg_tbl[] = { | 1617 | static struct snd_pci_quirk ad1981_cfg_tbl[] = { |
1620 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), | 1618 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), |
1619 | SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), | ||
1621 | /* All HP models */ | 1620 | /* All HP models */ |
1622 | SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), | 1621 | SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), |
1623 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), | 1622 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), |
@@ -2623,7 +2622,7 @@ static int ad1988_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
2623 | { | 2622 | { |
2624 | struct ad198x_spec *spec = codec->spec; | 2623 | struct ad198x_spec *spec = codec->spec; |
2625 | hda_nid_t nid; | 2624 | hda_nid_t nid; |
2626 | int idx, err; | 2625 | int i, idx, err; |
2627 | char name[32]; | 2626 | char name[32]; |
2628 | 2627 | ||
2629 | if (! pin) | 2628 | if (! pin) |
@@ -2631,16 +2630,26 @@ static int ad1988_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
2631 | 2630 | ||
2632 | idx = ad1988_pin_idx(pin); | 2631 | idx = ad1988_pin_idx(pin); |
2633 | nid = ad1988_idx_to_dac(codec, idx); | 2632 | nid = ad1988_idx_to_dac(codec, idx); |
2634 | /* specify the DAC as the extra output */ | 2633 | /* check whether the corresponding DAC was already taken */ |
2635 | if (! spec->multiout.hp_nid) | 2634 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
2636 | spec->multiout.hp_nid = nid; | 2635 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
2637 | else | 2636 | hda_nid_t dac = ad1988_idx_to_dac(codec, ad1988_pin_idx(pin)); |
2638 | spec->multiout.extra_out_nid[0] = nid; | 2637 | if (dac == nid) |
2639 | /* control HP volume/switch on the output mixer amp */ | 2638 | break; |
2640 | sprintf(name, "%s Playback Volume", pfx); | 2639 | } |
2641 | if ((err = add_control(spec, AD_CTL_WIDGET_VOL, name, | 2640 | if (i >= spec->autocfg.line_outs) { |
2642 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | 2641 | /* specify the DAC as the extra output */ |
2643 | return err; | 2642 | if (!spec->multiout.hp_nid) |
2643 | spec->multiout.hp_nid = nid; | ||
2644 | else | ||
2645 | spec->multiout.extra_out_nid[0] = nid; | ||
2646 | /* control HP volume/switch on the output mixer amp */ | ||
2647 | sprintf(name, "%s Playback Volume", pfx); | ||
2648 | err = add_control(spec, AD_CTL_WIDGET_VOL, name, | ||
2649 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
2650 | if (err < 0) | ||
2651 | return err; | ||
2652 | } | ||
2644 | nid = ad1988_mixer_nids[idx]; | 2653 | nid = ad1988_mixer_nids[idx]; |
2645 | sprintf(name, "%s Playback Switch", pfx); | 2654 | sprintf(name, "%s Playback Switch", pfx); |
2646 | if ((err = add_control(spec, AD_CTL_BIND_MUTE, name, | 2655 | if ((err = add_control(spec, AD_CTL_BIND_MUTE, name, |
@@ -3177,7 +3186,6 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3177 | if (spec == NULL) | 3186 | if (spec == NULL) |
3178 | return -ENOMEM; | 3187 | return -ENOMEM; |
3179 | 3188 | ||
3180 | mutex_init(&spec->amp_mutex); | ||
3181 | codec->spec = spec; | 3189 | codec->spec = spec; |
3182 | 3190 | ||
3183 | spec->multiout.max_channels = 2; | 3191 | spec->multiout.max_channels = 2; |
@@ -3847,7 +3855,6 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3847 | if (spec == NULL) | 3855 | if (spec == NULL) |
3848 | return -ENOMEM; | 3856 | return -ENOMEM; |
3849 | 3857 | ||
3850 | mutex_init(&spec->amp_mutex); | ||
3851 | codec->spec = spec; | 3858 | codec->spec = spec; |
3852 | 3859 | ||
3853 | spec->multiout.max_channels = 2; | 3860 | spec->multiout.max_channels = 2; |
@@ -4152,7 +4159,6 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4152 | if (spec == NULL) | 4159 | if (spec == NULL) |
4153 | return -ENOMEM; | 4160 | return -ENOMEM; |
4154 | 4161 | ||
4155 | mutex_init(&spec->amp_mutex); | ||
4156 | codec->spec = spec; | 4162 | codec->spec = spec; |
4157 | 4163 | ||
4158 | spec->multiout.max_channels = 6; | 4164 | spec->multiout.max_channels = 6; |