diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 76 |
1 files changed, 74 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 895113ee3857..6a6436a54f07 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -651,15 +651,51 @@ static void alc_exec_unsol_event(struct hda_codec *codec, int action) | |||
651 | snd_hda_jack_report_sync(codec); | 651 | snd_hda_jack_report_sync(codec); |
652 | } | 652 | } |
653 | 653 | ||
654 | /* update the master volume per volume-knob's unsol event */ | ||
655 | static void alc_update_knob_master(struct hda_codec *codec, hda_nid_t nid) | ||
656 | { | ||
657 | unsigned int val; | ||
658 | struct snd_kcontrol *kctl; | ||
659 | struct snd_ctl_elem_value *uctl; | ||
660 | |||
661 | kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); | ||
662 | if (!kctl) | ||
663 | return; | ||
664 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | ||
665 | if (!uctl) | ||
666 | return; | ||
667 | val = snd_hda_codec_read(codec, nid, 0, | ||
668 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | ||
669 | val &= HDA_AMP_VOLMASK; | ||
670 | uctl->value.integer.value[0] = val; | ||
671 | uctl->value.integer.value[1] = val; | ||
672 | kctl->put(kctl, uctl); | ||
673 | kfree(uctl); | ||
674 | } | ||
675 | |||
654 | /* unsolicited event for HP jack sensing */ | 676 | /* unsolicited event for HP jack sensing */ |
655 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 677 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
656 | { | 678 | { |
679 | int action; | ||
680 | |||
657 | if (codec->vendor_id == 0x10ec0880) | 681 | if (codec->vendor_id == 0x10ec0880) |
658 | res >>= 28; | 682 | res >>= 28; |
659 | else | 683 | else |
660 | res >>= 26; | 684 | res >>= 26; |
661 | res = snd_hda_jack_get_action(codec, res); | 685 | action = snd_hda_jack_get_action(codec, res); |
662 | alc_exec_unsol_event(codec, res); | 686 | if (res == ALC_DCVOL_EVENT) { |
687 | /* Execute the dc-vol event here as it requires the NID | ||
688 | * but we don't pass NID to alc_exec_unsol_event(). | ||
689 | * Once when we convert all static quirks to the auto-parser, | ||
690 | * this can be integerated into there. | ||
691 | */ | ||
692 | struct hda_jack_tbl *jack; | ||
693 | jack = snd_hda_jack_tbl_get_from_tag(codec, res); | ||
694 | if (jack) | ||
695 | alc_update_knob_master(codec, jack->nid); | ||
696 | return; | ||
697 | } | ||
698 | alc_exec_unsol_event(codec, action); | ||
663 | } | 699 | } |
664 | 700 | ||
665 | /* call init functions of standard auto-mute helpers */ | 701 | /* call init functions of standard auto-mute helpers */ |
@@ -4408,8 +4444,18 @@ enum { | |||
4408 | ALC880_FIXUP_W810, | 4444 | ALC880_FIXUP_W810, |
4409 | ALC880_FIXUP_EAPD_COEF, | 4445 | ALC880_FIXUP_EAPD_COEF, |
4410 | ALC880_FIXUP_TCL_S700, | 4446 | ALC880_FIXUP_TCL_S700, |
4447 | ALC880_FIXUP_VOL_KNOB, | ||
4448 | ALC880_FIXUP_FUJITSU, | ||
4411 | }; | 4449 | }; |
4412 | 4450 | ||
4451 | /* enable the volume-knob widget support on NID 0x21 */ | ||
4452 | static void alc880_fixup_vol_knob(struct hda_codec *codec, | ||
4453 | const struct alc_fixup *fix, int action) | ||
4454 | { | ||
4455 | if (action == ALC_FIXUP_ACT_PROBE) | ||
4456 | snd_hda_jack_detect_enable(codec, 0x21, ALC_DCVOL_EVENT); | ||
4457 | } | ||
4458 | |||
4413 | static const struct alc_fixup alc880_fixups[] = { | 4459 | static const struct alc_fixup alc880_fixups[] = { |
4414 | [ALC880_FIXUP_GPIO2] = { | 4460 | [ALC880_FIXUP_GPIO2] = { |
4415 | .type = ALC_FIXUP_VERBS, | 4461 | .type = ALC_FIXUP_VERBS, |
@@ -4465,6 +4511,30 @@ static const struct alc_fixup alc880_fixups[] = { | |||
4465 | .chained = true, | 4511 | .chained = true, |
4466 | .chain_id = ALC880_FIXUP_GPIO2, | 4512 | .chain_id = ALC880_FIXUP_GPIO2, |
4467 | }, | 4513 | }, |
4514 | [ALC880_FIXUP_VOL_KNOB] = { | ||
4515 | .type = ALC_FIXUP_FUNC, | ||
4516 | .v.func = alc880_fixup_vol_knob, | ||
4517 | }, | ||
4518 | [ALC880_FIXUP_FUJITSU] = { | ||
4519 | /* override all pins as BIOS on old Amilo is broken */ | ||
4520 | .type = ALC_FIXUP_PINS, | ||
4521 | .v.pins = (const struct alc_pincfg[]) { | ||
4522 | { 0x14, 0x0121411f }, /* HP */ | ||
4523 | { 0x15, 0x99030120 }, /* speaker */ | ||
4524 | { 0x16, 0x99030130 }, /* bass speaker */ | ||
4525 | { 0x17, 0x411111f0 }, /* N/A */ | ||
4526 | { 0x18, 0x411111f0 }, /* N/A */ | ||
4527 | { 0x19, 0x01a19950 }, /* mic-in */ | ||
4528 | { 0x1a, 0x411111f0 }, /* N/A */ | ||
4529 | { 0x1b, 0x411111f0 }, /* N/A */ | ||
4530 | { 0x1c, 0x411111f0 }, /* N/A */ | ||
4531 | { 0x1d, 0x411111f0 }, /* N/A */ | ||
4532 | { 0x1e, 0x01454140 }, /* SPDIF out */ | ||
4533 | { } | ||
4534 | }, | ||
4535 | .chained = true, | ||
4536 | .chain_id = ALC880_FIXUP_VOL_KNOB, | ||
4537 | }, | ||
4468 | }; | 4538 | }; |
4469 | 4539 | ||
4470 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { | 4540 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { |
@@ -4472,6 +4542,8 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = { | |||
4472 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF), | 4542 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF), |
4473 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), | 4543 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), |
4474 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), | 4544 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), |
4545 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), | ||
4546 | SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU), | ||
4475 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), | 4547 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), |
4476 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), | 4548 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), |
4477 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), | 4549 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), |