diff options
-rw-r--r-- | Documentation/sound/alsa/HD-Audio-Models.txt | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 40 |
2 files changed, 42 insertions, 1 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index a92bba816843..16dfe57f1731 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -74,7 +74,8 @@ CMI9880 | |||
74 | 74 | ||
75 | AD1882 / AD1882A | 75 | AD1882 / AD1882A |
76 | ================ | 76 | ================ |
77 | 3stack 3-stack mode (default) | 77 | 3stack 3-stack mode |
78 | 3stack-automute 3-stack with automute front HP (default) | ||
78 | 6stack 6-stack mode | 79 | 6stack 6-stack mode |
79 | 80 | ||
80 | AD1884A / AD1883 / AD1984A / AD1984B | 81 | AD1884A / AD1883 / AD1984A / AD1984B |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 0208fa121e5a..21218853366d 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -4814,6 +4814,32 @@ static const struct snd_kcontrol_new ad1882_3stack_mixers[] = { | |||
4814 | { } /* end */ | 4814 | { } /* end */ |
4815 | }; | 4815 | }; |
4816 | 4816 | ||
4817 | /* simple auto-mute control for AD1882 3-stack board */ | ||
4818 | #define AD1882_HP_EVENT 0x01 | ||
4819 | |||
4820 | static void ad1882_3stack_automute(struct hda_codec *codec) | ||
4821 | { | ||
4822 | bool mute = snd_hda_jack_detect(codec, 0x11); | ||
4823 | snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4824 | mute ? 0 : PIN_OUT); | ||
4825 | } | ||
4826 | |||
4827 | static int ad1882_3stack_automute_init(struct hda_codec *codec) | ||
4828 | { | ||
4829 | ad198x_init(codec); | ||
4830 | ad1882_3stack_automute(codec); | ||
4831 | return 0; | ||
4832 | } | ||
4833 | |||
4834 | static void ad1882_3stack_unsol_event(struct hda_codec *codec, unsigned int res) | ||
4835 | { | ||
4836 | switch (res >> 26) { | ||
4837 | case AD1882_HP_EVENT: | ||
4838 | ad1882_3stack_automute(codec); | ||
4839 | break; | ||
4840 | } | ||
4841 | } | ||
4842 | |||
4817 | static const struct snd_kcontrol_new ad1882_6stack_mixers[] = { | 4843 | static const struct snd_kcontrol_new ad1882_6stack_mixers[] = { |
4818 | HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT), | 4844 | HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
4819 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT), | 4845 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT), |
@@ -4928,6 +4954,11 @@ static const struct hda_verb ad1882_init_verbs[] = { | |||
4928 | { } /* end */ | 4954 | { } /* end */ |
4929 | }; | 4955 | }; |
4930 | 4956 | ||
4957 | static const struct hda_verb ad1882_3stack_automute_verbs[] = { | ||
4958 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1882_HP_EVENT}, | ||
4959 | { } /* end */ | ||
4960 | }; | ||
4961 | |||
4931 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4962 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4932 | static const struct hda_amp_list ad1882_loopbacks[] = { | 4963 | static const struct hda_amp_list ad1882_loopbacks[] = { |
4933 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ | 4964 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ |
@@ -4942,12 +4973,14 @@ static const struct hda_amp_list ad1882_loopbacks[] = { | |||
4942 | enum { | 4973 | enum { |
4943 | AD1882_3STACK, | 4974 | AD1882_3STACK, |
4944 | AD1882_6STACK, | 4975 | AD1882_6STACK, |
4976 | AD1882_3STACK_AUTOMUTE, | ||
4945 | AD1882_MODELS | 4977 | AD1882_MODELS |
4946 | }; | 4978 | }; |
4947 | 4979 | ||
4948 | static const char * const ad1882_models[AD1986A_MODELS] = { | 4980 | static const char * const ad1882_models[AD1986A_MODELS] = { |
4949 | [AD1882_3STACK] = "3stack", | 4981 | [AD1882_3STACK] = "3stack", |
4950 | [AD1882_6STACK] = "6stack", | 4982 | [AD1882_6STACK] = "6stack", |
4983 | [AD1882_3STACK_AUTOMUTE] = "3stack-automute", | ||
4951 | }; | 4984 | }; |
4952 | 4985 | ||
4953 | 4986 | ||
@@ -5002,6 +5035,7 @@ static int patch_ad1882(struct hda_codec *codec) | |||
5002 | switch (board_config) { | 5035 | switch (board_config) { |
5003 | default: | 5036 | default: |
5004 | case AD1882_3STACK: | 5037 | case AD1882_3STACK: |
5038 | case AD1882_3STACK_AUTOMUTE: | ||
5005 | spec->num_mixers = 3; | 5039 | spec->num_mixers = 3; |
5006 | spec->mixers[2] = ad1882_3stack_mixers; | 5040 | spec->mixers[2] = ad1882_3stack_mixers; |
5007 | spec->channel_mode = ad1882_modes; | 5041 | spec->channel_mode = ad1882_modes; |
@@ -5009,6 +5043,12 @@ static int patch_ad1882(struct hda_codec *codec) | |||
5009 | spec->need_dac_fix = 1; | 5043 | spec->need_dac_fix = 1; |
5010 | spec->multiout.max_channels = 2; | 5044 | spec->multiout.max_channels = 2; |
5011 | spec->multiout.num_dacs = 1; | 5045 | spec->multiout.num_dacs = 1; |
5046 | if (board_config != AD1882_3STACK) { | ||
5047 | spec->init_verbs[spec->num_init_verbs++] = | ||
5048 | ad1882_3stack_automute_verbs; | ||
5049 | codec->patch_ops.unsol_event = ad1882_3stack_unsol_event; | ||
5050 | codec->patch_ops.init = ad1882_3stack_automute_init; | ||
5051 | } | ||
5012 | break; | 5052 | break; |
5013 | case AD1882_6STACK: | 5053 | case AD1882_6STACK: |
5014 | spec->num_mixers = 3; | 5054 | spec->num_mixers = 3; |