aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c143
1 files changed, 92 insertions, 51 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 3c6f5b5161f0..c5216b58d218 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4808,21 +4808,6 @@ static const struct alc_model_fixup alc880_fixup_models[] = {
4808 4808
4809 4809
4810/* 4810/*
4811 * board setups
4812 */
4813#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4814#define alc_board_config \
4815 snd_hda_check_board_config
4816#define alc_board_codec_sid_config \
4817 snd_hda_check_board_codec_sid_config
4818#include "alc_quirks.c"
4819#else
4820#define alc_board_config(codec, nums, models, tbl) -1
4821#define alc_board_codec_sid_config(codec, nums, models, tbl) -1
4822#define setup_preset(codec, x) /* NOP */
4823#endif
4824
4825/*
4826 * OK, here we have finally the patch for ALC880 4811 * OK, here we have finally the patch for ALC880
4827 */ 4812 */
4828static int patch_alc880(struct hda_codec *codec) 4813static int patch_alc880(struct hda_codec *codec)
@@ -5091,6 +5076,8 @@ enum {
5091 ALC882_FIXUP_EAPD, 5076 ALC882_FIXUP_EAPD,
5092 ALC883_FIXUP_EAPD, 5077 ALC883_FIXUP_EAPD,
5093 ALC883_FIXUP_ACER_EAPD, 5078 ALC883_FIXUP_ACER_EAPD,
5079 ALC882_FIXUP_GPIO1,
5080 ALC882_FIXUP_GPIO2,
5094 ALC882_FIXUP_GPIO3, 5081 ALC882_FIXUP_GPIO3,
5095 ALC889_FIXUP_COEF, 5082 ALC889_FIXUP_COEF,
5096 ALC882_FIXUP_ASUS_W2JC, 5083 ALC882_FIXUP_ASUS_W2JC,
@@ -5099,6 +5086,8 @@ enum {
5099 ALC882_FIXUP_ASPIRE_8930G_VERBS, 5086 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5100 ALC885_FIXUP_MACPRO_GPIO, 5087 ALC885_FIXUP_MACPRO_GPIO,
5101 ALC889_FIXUP_DAC_ROUTE, 5088 ALC889_FIXUP_DAC_ROUTE,
5089 ALC889_FIXUP_MBP_VREF,
5090 ALC889_FIXUP_IMAC91_VREF,
5102}; 5091};
5103 5092
5104static void alc889_fixup_coef(struct hda_codec *codec, 5093static void alc889_fixup_coef(struct hda_codec *codec,
@@ -5169,6 +5158,51 @@ static void alc889_fixup_dac_route(struct hda_codec *codec,
5169 } 5158 }
5170} 5159}
5171 5160
5161/* Set VREF on HP pin */
5162static void alc889_fixup_mbp_vref(struct hda_codec *codec,
5163 const struct alc_fixup *fix, int action)
5164{
5165 struct alc_spec *spec = codec->spec;
5166 static hda_nid_t nids[2] = { 0x14, 0x15 };
5167 int i;
5168
5169 if (action != ALC_FIXUP_ACT_INIT)
5170 return;
5171 for (i = 0; i < ARRAY_SIZE(nids); i++) {
5172 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
5173 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
5174 continue;
5175 val = snd_hda_codec_read(codec, nids[i], 0,
5176 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
5177 val |= AC_PINCTL_VREF_80;
5178 snd_hda_codec_write(codec, nids[i], 0,
5179 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
5180 spec->keep_vref_in_automute = 1;
5181 break;
5182 }
5183}
5184
5185/* Set VREF on speaker pins on imac91 */
5186static void alc889_fixup_imac91_vref(struct hda_codec *codec,
5187 const struct alc_fixup *fix, int action)
5188{
5189 struct alc_spec *spec = codec->spec;
5190 static hda_nid_t nids[2] = { 0x18, 0x1a };
5191 int i;
5192
5193 if (action != ALC_FIXUP_ACT_INIT)
5194 return;
5195 for (i = 0; i < ARRAY_SIZE(nids); i++) {
5196 unsigned int val;
5197 val = snd_hda_codec_read(codec, nids[i], 0,
5198 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
5199 val |= AC_PINCTL_VREF_50;
5200 snd_hda_codec_write(codec, nids[i], 0,
5201 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
5202 }
5203 spec->keep_vref_in_automute = 1;
5204}
5205
5172static const struct alc_fixup alc882_fixups[] = { 5206static const struct alc_fixup alc882_fixups[] = {
5173 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 5207 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
5174 .type = ALC_FIXUP_PINS, 5208 .type = ALC_FIXUP_PINS,
@@ -5247,6 +5281,14 @@ static const struct alc_fixup alc882_fixups[] = {
5247 { } 5281 { }
5248 } 5282 }
5249 }, 5283 },
5284 [ALC882_FIXUP_GPIO1] = {
5285 .type = ALC_FIXUP_VERBS,
5286 .v.verbs = alc_gpio1_init_verbs,
5287 },
5288 [ALC882_FIXUP_GPIO2] = {
5289 .type = ALC_FIXUP_VERBS,
5290 .v.verbs = alc_gpio2_init_verbs,
5291 },
5250 [ALC882_FIXUP_GPIO3] = { 5292 [ALC882_FIXUP_GPIO3] = {
5251 .type = ALC_FIXUP_VERBS, 5293 .type = ALC_FIXUP_VERBS,
5252 .v.verbs = alc_gpio3_init_verbs, 5294 .v.verbs = alc_gpio3_init_verbs,
@@ -5320,6 +5362,18 @@ static const struct alc_fixup alc882_fixups[] = {
5320 .type = ALC_FIXUP_FUNC, 5362 .type = ALC_FIXUP_FUNC,
5321 .v.func = alc889_fixup_dac_route, 5363 .v.func = alc889_fixup_dac_route,
5322 }, 5364 },
5365 [ALC889_FIXUP_MBP_VREF] = {
5366 .type = ALC_FIXUP_FUNC,
5367 .v.func = alc889_fixup_mbp_vref,
5368 .chained = true,
5369 .chain_id = ALC882_FIXUP_GPIO1,
5370 },
5371 [ALC889_FIXUP_IMAC91_VREF] = {
5372 .type = ALC_FIXUP_FUNC,
5373 .v.func = alc889_fixup_imac91_vref,
5374 .chained = true,
5375 .chain_id = ALC882_FIXUP_GPIO1,
5376 },
5323}; 5377};
5324 5378
5325static const struct snd_pci_quirk alc882_fixup_tbl[] = { 5379static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -5353,11 +5407,26 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5353 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), 5407 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
5354 5408
5355 /* All Apple entries are in codec SSIDs */ 5409 /* All Apple entries are in codec SSIDs */
5410 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
5411 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
5412 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5356 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), 5413 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO),
5357 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), 5414 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
5358 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), 5415 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
5416 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
5417 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5359 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), 5418 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
5419 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF),
5420 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBP_VREF),
5421 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
5422 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5360 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), 5423 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
5424 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
5425 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
5426 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
5427 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
5428 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
5429 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
5361 5430
5362 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), 5431 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
5363 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 5432 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
@@ -5382,14 +5451,10 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
5382 5451
5383/* 5452/*
5384 */ 5453 */
5385#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
5386#include "alc882_quirks.c"
5387#endif
5388
5389static int patch_alc882(struct hda_codec *codec) 5454static int patch_alc882(struct hda_codec *codec)
5390{ 5455{
5391 struct alc_spec *spec; 5456 struct alc_spec *spec;
5392 int err, board_config; 5457 int err;
5393 5458
5394 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5459 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5395 if (spec == NULL) 5460 if (spec == NULL)
@@ -5413,36 +5478,15 @@ static int patch_alc882(struct hda_codec *codec)
5413 if (err < 0) 5478 if (err < 0)
5414 goto error; 5479 goto error;
5415 5480
5416 board_config = alc_board_config(codec, ALC882_MODEL_LAST, 5481 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
5417 alc882_models, NULL); 5482 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5418 if (board_config < 0)
5419 board_config = alc_board_codec_sid_config(codec,
5420 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
5421
5422 if (board_config < 0) {
5423 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5424 codec->chip_name);
5425 board_config = ALC_MODEL_AUTO;
5426 }
5427
5428 if (board_config == ALC_MODEL_AUTO) {
5429 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
5430 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5431 }
5432 5483
5433 alc_auto_parse_customize_define(codec); 5484 alc_auto_parse_customize_define(codec);
5434 5485
5435 if (board_config == ALC_MODEL_AUTO) { 5486 /* automatic parse from the BIOS config */
5436 /* automatic parse from the BIOS config */ 5487 err = alc882_parse_auto_config(codec);
5437 err = alc882_parse_auto_config(codec); 5488 if (err < 0)
5438 if (err < 0) 5489 goto error;
5439 goto error;
5440 }
5441
5442 if (board_config != ALC_MODEL_AUTO) {
5443 setup_preset(codec, &alc882_presets[board_config]);
5444 spec->vmaster_nid = 0x0c;
5445 }
5446 5490
5447 if (!spec->no_analog && !spec->adc_nids) { 5491 if (!spec->no_analog && !spec->adc_nids) {
5448 alc_auto_fill_adc_caps(codec); 5492 alc_auto_fill_adc_caps(codec);
@@ -5461,10 +5505,7 @@ static int patch_alc882(struct hda_codec *codec)
5461 } 5505 }
5462 5506
5463 codec->patch_ops = alc_patch_ops; 5507 codec->patch_ops = alc_patch_ops;
5464 if (board_config == ALC_MODEL_AUTO) 5508 spec->init_hook = alc_auto_init_std;
5465 spec->init_hook = alc_auto_init_std;
5466 else
5467 codec->patch_ops.build_controls = __alc_build_controls;
5468 5509
5469#ifdef CONFIG_SND_HDA_POWER_SAVE 5510#ifdef CONFIG_SND_HDA_POWER_SAVE
5470 if (!spec->loopback.amplist) 5511 if (!spec->loopback.amplist)