aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-08-13 05:09:35 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-15 05:50:05 -0400
commit1c86845268dc91fa6a53de9a4479b407cd4ee903 (patch)
tree3608ec89af42cf7b3b2c52ed5e4cd962f7d54ec9 /sound/pci/hda
parentc7561cd80469f2fe4a6be0984db57832ee7f2a3b (diff)
ALSA: hda - Add 3stack-automute model to AD1882 codec
Added a simple support of automute for the front HP jack to AD1882 stack model. Such an addition is basically an exception -- we really want to avoid the static quirk codes, but AD1882 parser isn't still ready for moving to the BIOS auto-parser yet. So, as a quick fix, I merged it for now. In near future, we really need the big clean up of patch_analog.c to move on to the auto-parser... Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_analog.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 0208fa121e5..21218853366 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
4820static 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
4827static int ad1882_3stack_automute_init(struct hda_codec *codec)
4828{
4829 ad198x_init(codec);
4830 ad1882_3stack_automute(codec);
4831 return 0;
4832}
4833
4834static 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
4817static const struct snd_kcontrol_new ad1882_6stack_mixers[] = { 4843static 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
4957static 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
4932static const struct hda_amp_list ad1882_loopbacks[] = { 4963static 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[] = {
4942enum { 4973enum {
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
4948static const char * const ad1882_models[AD1986A_MODELS] = { 4980static 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;