aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-07-04 09:16:31 -0400
committerTakashi Iwai <tiwai@suse.de>2013-07-04 09:16:31 -0400
commitaa95d61b43e0fcb0b2ce68e5efa37174fd9e5cd3 (patch)
treeb9c8fb6ffa45102145e0d68aff2a8109ea1a6ba3 /sound/pci
parentf404627d27b27d79287dee7c6dba934790959ee3 (diff)
ALSA: hda - Remove static quirks for AD1882
Now the generic parser can work stably enough, we can get rid of the static quirks. Let's start from AD1882. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_analog.c384
1 files changed, 1 insertions, 383 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index a667256984fd..876d836ef742 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -4891,299 +4891,7 @@ static int patch_ad1884a(struct hda_codec *codec)
4891 * port-G - rear clfe-out (6stack) 4891 * port-G - rear clfe-out (6stack)
4892 */ 4892 */
4893 4893
4894#ifdef ENABLE_AD_STATIC_QUIRKS 4894static int patch_ad1882(struct hda_codec *codec)
4895static const hda_nid_t ad1882_dac_nids[3] = {
4896 0x04, 0x03, 0x05
4897};
4898
4899static const hda_nid_t ad1882_adc_nids[2] = {
4900 0x08, 0x09,
4901};
4902
4903static const hda_nid_t ad1882_capsrc_nids[2] = {
4904 0x0c, 0x0d,
4905};
4906
4907#define AD1882_SPDIF_OUT 0x02
4908
4909/* list: 0x11, 0x39, 0x3a, 0x18, 0x3c, 0x3b, 0x12, 0x20 */
4910static const struct hda_input_mux ad1882_capture_source = {
4911 .num_items = 5,
4912 .items = {
4913 { "Front Mic", 0x1 },
4914 { "Mic", 0x4 },
4915 { "Line", 0x2 },
4916 { "CD", 0x3 },
4917 { "Mix", 0x7 },
4918 },
4919};
4920
4921/* list: 0x11, 0x39, 0x3a, 0x3c, 0x18, 0x1f, 0x12, 0x20 */
4922static const struct hda_input_mux ad1882a_capture_source = {
4923 .num_items = 5,
4924 .items = {
4925 { "Front Mic", 0x1 },
4926 { "Mic", 0x4},
4927 { "Line", 0x2 },
4928 { "Digital Mic", 0x06 },
4929 { "Mix", 0x7 },
4930 },
4931};
4932
4933static const struct snd_kcontrol_new ad1882_base_mixers[] = {
4934 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
4935 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
4936 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
4937 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT),
4938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
4939 HDA_CODEC_MUTE("Front Playback Switch", 0x12, 0x0, HDA_OUTPUT),
4940 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
4941 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x13, 1, 0x0, HDA_OUTPUT),
4942
4943 HDA_CODEC_VOLUME("Mic Boost Volume", 0x3c, 0x0, HDA_OUTPUT),
4944 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x39, 0x0, HDA_OUTPUT),
4945 HDA_CODEC_VOLUME("Line-In Boost Volume", 0x3a, 0x0, HDA_OUTPUT),
4946 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
4947 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
4948 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT),
4949 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x0d, 0x0, HDA_OUTPUT),
4950 {
4951 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4952 /* The multiple "Capture Source" controls confuse alsamixer
4953 * So call somewhat different..
4954 */
4955 /* .name = "Capture Source", */
4956 .name = "Input Source",
4957 .count = 2,
4958 .info = ad198x_mux_enum_info,
4959 .get = ad198x_mux_enum_get,
4960 .put = ad198x_mux_enum_put,
4961 },
4962 /* SPDIF controls */
4963 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
4964 {
4965 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4966 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Source",
4967 /* identical with ad1983 */
4968 .info = ad1983_spdif_route_info,
4969 .get = ad1983_spdif_route_get,
4970 .put = ad1983_spdif_route_put,
4971 },
4972 { } /* end */
4973};
4974
4975static const struct snd_kcontrol_new ad1882_loopback_mixers[] = {
4976 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4977 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
4979 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT),
4980 HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x04, HDA_INPUT),
4981 HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT),
4982 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT),
4983 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT),
4984 { } /* end */
4985};
4986
4987static const struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
4988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4989 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT),
4991 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT),
4992 HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x01, HDA_INPUT),
4993 HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT),
4994 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT),
4995 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT),
4996 HDA_CODEC_VOLUME("Digital Mic Boost Volume", 0x1f, 0x0, HDA_INPUT),
4997 { } /* end */
4998};
4999
5000static const struct snd_kcontrol_new ad1882_3stack_mixers[] = {
5001 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5002 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT),
5003 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x17, 2, 0x0, HDA_OUTPUT),
5004 {
5005 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5006 .name = "Channel Mode",
5007 .info = ad198x_ch_mode_info,
5008 .get = ad198x_ch_mode_get,
5009 .put = ad198x_ch_mode_put,
5010 },
5011 { } /* end */
5012};
5013
5014/* simple auto-mute control for AD1882 3-stack board */
5015#define AD1882_HP_EVENT 0x01
5016
5017static void ad1882_3stack_automute(struct hda_codec *codec)
5018{
5019 bool mute = snd_hda_jack_detect(codec, 0x11);
5020 snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5021 mute ? 0 : PIN_OUT);
5022}
5023
5024static int ad1882_3stack_automute_init(struct hda_codec *codec)
5025{
5026 ad198x_init(codec);
5027 ad1882_3stack_automute(codec);
5028 return 0;
5029}
5030
5031static void ad1882_3stack_unsol_event(struct hda_codec *codec, unsigned int res)
5032{
5033 switch (res >> 26) {
5034 case AD1882_HP_EVENT:
5035 ad1882_3stack_automute(codec);
5036 break;
5037 }
5038}
5039
5040static const struct snd_kcontrol_new ad1882_6stack_mixers[] = {
5041 HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5042 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT),
5043 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x24, 2, 0x0, HDA_OUTPUT),
5044 { } /* end */
5045};
5046
5047static const struct hda_verb ad1882_ch2_init[] = {
5048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5049 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5050 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5051 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5052 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5053 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5054 { } /* end */
5055};
5056
5057static const struct hda_verb ad1882_ch4_init[] = {
5058 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5059 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5060 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5061 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5062 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5064 { } /* end */
5065};
5066
5067static const struct hda_verb ad1882_ch6_init[] = {
5068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5069 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5070 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5071 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5072 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5073 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5074 { } /* end */
5075};
5076
5077static const struct hda_channel_mode ad1882_modes[3] = {
5078 { 2, ad1882_ch2_init },
5079 { 4, ad1882_ch4_init },
5080 { 6, ad1882_ch6_init },
5081};
5082
5083/*
5084 * initialization verbs
5085 */
5086static const struct hda_verb ad1882_init_verbs[] = {
5087 /* DACs; mute as default */
5088 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5089 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5090 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5091 /* Port-A (HP) mixer */
5092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5094 /* Port-A pin */
5095 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5096 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5097 /* HP selector - select DAC2 */
5098 {0x37, AC_VERB_SET_CONNECT_SEL, 0x1},
5099 /* Port-D (Line-out) mixer */
5100 {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5101 {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5102 /* Port-D pin */
5103 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5104 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5105 /* Mono-out mixer */
5106 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5107 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5108 /* Mono-out pin */
5109 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5110 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5111 /* Port-B (front mic) pin */
5112 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5113 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5114 {0x39, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, /* boost */
5115 /* Port-C (line-in) pin */
5116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5118 {0x3a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, /* boost */
5119 /* Port-C mixer - mute as input */
5120 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5121 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5122 /* Port-E (mic-in) pin */
5123 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5124 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5125 {0x3c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, /* boost */
5126 /* Port-E mixer - mute as input */
5127 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5128 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5129 /* Port-F (surround) */
5130 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5131 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5132 /* Port-G (CLFE) */
5133 {0x24, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5135 /* Analog mixer; mute as default */
5136 /* list: 0x39, 0x3a, 0x11, 0x12, 0x3c, 0x3b, 0x18, 0x1a */
5137 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5138 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5139 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5140 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5141 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5142 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
5143 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
5144 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
5145 /* Analog Mix output amp */
5146 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */
5147 /* SPDIF output selector */
5148 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
5149 {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */
5150 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
5151 { } /* end */
5152};
5153
5154static const struct hda_verb ad1882_3stack_automute_verbs[] = {
5155 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1882_HP_EVENT},
5156 { } /* end */
5157};
5158
5159#ifdef CONFIG_PM
5160static const struct hda_amp_list ad1882_loopbacks[] = {
5161 { 0x20, HDA_INPUT, 0 }, /* Front Mic */
5162 { 0x20, HDA_INPUT, 1 }, /* Mic */
5163 { 0x20, HDA_INPUT, 4 }, /* Line */
5164 { 0x20, HDA_INPUT, 6 }, /* CD */
5165 { } /* end */
5166};
5167#endif
5168
5169/* models */
5170enum {
5171 AD1882_AUTO,
5172 AD1882_3STACK,
5173 AD1882_6STACK,
5174 AD1882_3STACK_AUTOMUTE,
5175 AD1882_MODELS
5176};
5177
5178static const char * const ad1882_models[AD1986A_MODELS] = {
5179 [AD1882_AUTO] = "auto",
5180 [AD1882_3STACK] = "3stack",
5181 [AD1882_6STACK] = "6stack",
5182 [AD1882_3STACK_AUTOMUTE] = "3stack-automute",
5183};
5184#endif /* ENABLE_AD_STATIC_QUIRKS */
5185
5186static int ad1882_parse_auto_config(struct hda_codec *codec)
5187{ 4895{
5188 struct ad198x_spec *spec; 4896 struct ad198x_spec *spec;
5189 int err; 4897 int err;
@@ -5210,96 +4918,6 @@ static int ad1882_parse_auto_config(struct hda_codec *codec)
5210 return err; 4918 return err;
5211} 4919}
5212 4920
5213#ifdef ENABLE_AD_STATIC_QUIRKS
5214static int patch_ad1882(struct hda_codec *codec)
5215{
5216 struct ad198x_spec *spec;
5217 int err, board_config;
5218
5219 board_config = snd_hda_check_board_config(codec, AD1882_MODELS,
5220 ad1882_models, NULL);
5221 if (board_config < 0) {
5222 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5223 codec->chip_name);
5224 board_config = AD1882_AUTO;
5225 }
5226
5227 if (board_config == AD1882_AUTO)
5228 return ad1882_parse_auto_config(codec);
5229
5230 err = alloc_ad_spec(codec);
5231 if (err < 0)
5232 return err;
5233 spec = codec->spec;
5234
5235 err = snd_hda_attach_beep_device(codec, 0x10);
5236 if (err < 0) {
5237 ad198x_free(codec);
5238 return err;
5239 }
5240 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
5241
5242 spec->multiout.max_channels = 6;
5243 spec->multiout.num_dacs = 3;
5244 spec->multiout.dac_nids = ad1882_dac_nids;
5245 spec->multiout.dig_out_nid = AD1882_SPDIF_OUT;
5246 spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids);
5247 spec->adc_nids = ad1882_adc_nids;
5248 spec->capsrc_nids = ad1882_capsrc_nids;
5249 if (codec->vendor_id == 0x11d41882)
5250 spec->input_mux = &ad1882_capture_source;
5251 else
5252 spec->input_mux = &ad1882a_capture_source;
5253 spec->num_mixers = 2;
5254 spec->mixers[0] = ad1882_base_mixers;
5255 if (codec->vendor_id == 0x11d41882)
5256 spec->mixers[1] = ad1882_loopback_mixers;
5257 else
5258 spec->mixers[1] = ad1882a_loopback_mixers;
5259 spec->num_init_verbs = 1;
5260 spec->init_verbs[0] = ad1882_init_verbs;
5261 spec->spdif_route = 0;
5262#ifdef CONFIG_PM
5263 spec->loopback.amplist = ad1882_loopbacks;
5264#endif
5265 spec->vmaster_nid = 0x04;
5266
5267 codec->patch_ops = ad198x_patch_ops;
5268
5269 /* override some parameters */
5270 switch (board_config) {
5271 default:
5272 case AD1882_3STACK:
5273 case AD1882_3STACK_AUTOMUTE:
5274 spec->num_mixers = 3;
5275 spec->mixers[2] = ad1882_3stack_mixers;
5276 spec->channel_mode = ad1882_modes;
5277 spec->num_channel_mode = ARRAY_SIZE(ad1882_modes);
5278 spec->need_dac_fix = 1;
5279 spec->multiout.max_channels = 2;
5280 spec->multiout.num_dacs = 1;
5281 if (board_config != AD1882_3STACK) {
5282 spec->init_verbs[spec->num_init_verbs++] =
5283 ad1882_3stack_automute_verbs;
5284 codec->patch_ops.unsol_event = ad1882_3stack_unsol_event;
5285 codec->patch_ops.init = ad1882_3stack_automute_init;
5286 }
5287 break;
5288 case AD1882_6STACK:
5289 spec->num_mixers = 3;
5290 spec->mixers[2] = ad1882_6stack_mixers;
5291 break;
5292 }
5293
5294 codec->no_trigger_sense = 1;
5295 codec->no_sticky_stream = 1;
5296
5297 return 0;
5298}
5299#else /* ENABLE_AD_STATIC_QUIRKS */
5300#define patch_ad1882 ad1882_parse_auto_config
5301#endif /* ENABLE_AD_STATIC_QUIRKS */
5302
5303 4921
5304/* 4922/*
5305 * patch entries 4923 * patch entries