Commit 39fa84e9 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Simplify EAPD control in patch_realtek.c

Look through the known NIDs that may have EAPD capabilities and turn
on/off them appropriately instead of checking the individual vendor ids.

This will also avoid the forgotten entries of newly added codec ids
in future.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6d86b4fb
...@@ -1366,28 +1366,12 @@ static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) ...@@ -1366,28 +1366,12 @@ static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
{ {
/* We currently only handle front, HP */ /* We currently only handle front, HP */
switch (codec->vendor_id) { static hda_nid_t pins[] = {
case 0x10ec0260: 0x0f, 0x10, 0x14, 0x15, 0
set_eapd(codec, 0x0f, on); };
set_eapd(codec, 0x10, on); hda_nid_t *p;
break; for (p = pins; *p; p++)
case 0x10ec0262: set_eapd(codec, *p, on);
case 0x10ec0267:
case 0x10ec0268:
case 0x10ec0269:
case 0x10ec0270:
case 0x10ec0272:
case 0x10ec0660:
case 0x10ec0662:
case 0x10ec0663:
case 0x10ec0665:
case 0x10ec0862:
case 0x10ec0889:
case 0x10ec0892:
set_eapd(codec, 0x14, on);
set_eapd(codec, 0x15, on);
break;
}
} }
/* generic shutup callback; /* generic shutup callback;
...@@ -1403,6 +1387,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) ...@@ -1403,6 +1387,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
{ {
unsigned int tmp; unsigned int tmp;
alc_auto_setup_eapd(codec, true);
switch (type) { switch (type) {
case ALC_INIT_GPIO1: case ALC_INIT_GPIO1:
snd_hda_sequence_write(codec, alc_gpio1_init_verbs); snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
...@@ -1414,7 +1399,6 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) ...@@ -1414,7 +1399,6 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
snd_hda_sequence_write(codec, alc_gpio3_init_verbs); snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
break; break;
case ALC_INIT_DEFAULT: case ALC_INIT_DEFAULT:
alc_auto_setup_eapd(codec, true);
switch (codec->vendor_id) { switch (codec->vendor_id) {
case 0x10ec0260: case 0x10ec0260:
snd_hda_codec_write(codec, 0x1a, 0, snd_hda_codec_write(codec, 0x1a, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment