aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/patch_realtek.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 929552797368..596ea2f12cf6 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5180,8 +5180,24 @@ static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5180#ifdef CONFIG_SND_HDA_INPUT_BEEP 5180#ifdef CONFIG_SND_HDA_INPUT_BEEP
5181#define set_beep_amp(spec, nid, idx, dir) \ 5181#define set_beep_amp(spec, nid, idx, dir) \
5182 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) 5182 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5183
5184static struct snd_pci_quirk beep_white_list[] = {
5185 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5186 {}
5187};
5188
5189static inline int has_cdefine_beep(struct hda_codec *codec)
5190{
5191 struct alc_spec *spec = codec->spec;
5192 const struct snd_pci_quirk *q;
5193 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5194 if (q)
5195 return q->value;
5196 return spec->cdefine.enable_pcbeep;
5197}
5183#else 5198#else
5184#define set_beep_amp(spec, nid, idx, dir) /* NOP */ 5199#define set_beep_amp(spec, nid, idx, dir) /* NOP */
5200#define has_cdefine_beep(codec) 0
5185#endif 5201#endif
5186 5202
5187/* 5203/*
@@ -10566,7 +10582,7 @@ static int patch_alc882(struct hda_codec *codec)
10566 } 10582 }
10567 } 10583 }
10568 10584
10569 if (spec->cdefine.enable_pcbeep) { 10585 if (has_cdefine_beep(codec)) {
10570 err = snd_hda_attach_beep_device(codec, 0x1); 10586 err = snd_hda_attach_beep_device(codec, 0x1);
10571 if (err < 0) { 10587 if (err < 0) {
10572 alc_free(codec); 10588 alc_free(codec);
@@ -10621,7 +10637,7 @@ static int patch_alc882(struct hda_codec *codec)
10621 10637
10622 set_capture_mixer(codec); 10638 set_capture_mixer(codec);
10623 10639
10624 if (spec->cdefine.enable_pcbeep) 10640 if (has_cdefine_beep(codec))
10625 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 10641 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10626 10642
10627 if (board_config == ALC882_AUTO) 10643 if (board_config == ALC882_AUTO)
@@ -12437,7 +12453,7 @@ static int patch_alc262(struct hda_codec *codec)
12437 } 12453 }
12438 } 12454 }
12439 12455
12440 if (!spec->no_analog && spec->cdefine.enable_pcbeep) { 12456 if (!spec->no_analog && has_cdefine_beep(codec)) {
12441 err = snd_hda_attach_beep_device(codec, 0x1); 12457 err = snd_hda_attach_beep_device(codec, 0x1);
12442 if (err < 0) { 12458 if (err < 0) {
12443 alc_free(codec); 12459 alc_free(codec);
@@ -12488,7 +12504,7 @@ static int patch_alc262(struct hda_codec *codec)
12488 } 12504 }
12489 if (!spec->cap_mixer && !spec->no_analog) 12505 if (!spec->cap_mixer && !spec->no_analog)
12490 set_capture_mixer(codec); 12506 set_capture_mixer(codec);
12491 if (!spec->no_analog && spec->cdefine.enable_pcbeep) 12507 if (!spec->no_analog && has_cdefine_beep(codec))
12492 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 12508 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12493 12509
12494 spec->vmaster_nid = 0x0c; 12510 spec->vmaster_nid = 0x0c;
@@ -14460,7 +14476,7 @@ static int patch_alc269(struct hda_codec *codec)
14460 } 14476 }
14461 } 14477 }
14462 14478
14463 if (spec->cdefine.enable_pcbeep) { 14479 if (has_cdefine_beep(codec)) {
14464 err = snd_hda_attach_beep_device(codec, 0x1); 14480 err = snd_hda_attach_beep_device(codec, 0x1);
14465 if (err < 0) { 14481 if (err < 0) {
14466 alc_free(codec); 14482 alc_free(codec);
@@ -14498,7 +14514,7 @@ static int patch_alc269(struct hda_codec *codec)
14498 14514
14499 if (!spec->cap_mixer) 14515 if (!spec->cap_mixer)
14500 set_capture_mixer(codec); 14516 set_capture_mixer(codec);
14501 if (spec->cdefine.enable_pcbeep) 14517 if (has_cdefine_beep(codec))
14502 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 14518 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14503 14519
14504 if (board_config == ALC269_AUTO) 14520 if (board_config == ALC269_AUTO)
@@ -18695,7 +18711,7 @@ static int patch_alc662(struct hda_codec *codec)
18695 } 18711 }
18696 } 18712 }
18697 18713
18698 if (spec->cdefine.enable_pcbeep) { 18714 if (has_cdefine_beep(codec)) {
18699 err = snd_hda_attach_beep_device(codec, 0x1); 18715 err = snd_hda_attach_beep_device(codec, 0x1);
18700 if (err < 0) { 18716 if (err < 0) {
18701 alc_free(codec); 18717 alc_free(codec);
@@ -18722,7 +18738,7 @@ static int patch_alc662(struct hda_codec *codec)
18722 if (!spec->cap_mixer) 18738 if (!spec->cap_mixer)
18723 set_capture_mixer(codec); 18739 set_capture_mixer(codec);
18724 18740
18725 if (spec->cdefine.enable_pcbeep) { 18741 if (has_cdefine_beep(codec)) {
18726 switch (codec->vendor_id) { 18742 switch (codec->vendor_id) {
18727 case 0x10ec0662: 18743 case 0x10ec0662:
18728 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 18744 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);