Skip to content

Commit 1f68060

Browse files
Yuchi Yangtiwai
authored andcommitted
ALSA: hda/realtek - Turn on power early
Turn on power early to avoid wrong state for power relation register. This can earlier update JD state when resume back. Signed-off-by: Yuchi Yang <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 090ddad commit 1f68060

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3564,6 +3564,15 @@ static void alc256_init(struct hda_codec *codec)
35643564
hda_nid_t hp_pin = alc_get_hp_pin(spec);
35653565
bool hp_pin_sense;
35663566

3567+
if (spec->ultra_low_power) {
3568+
alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3569+
alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3570+
alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3571+
alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3572+
alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3573+
msleep(30);
3574+
}
3575+
35673576
if (!hp_pin)
35683577
hp_pin = 0x21;
35693578

@@ -3575,14 +3584,6 @@ static void alc256_init(struct hda_codec *codec)
35753584
msleep(2);
35763585

35773586
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3578-
if (spec->ultra_low_power) {
3579-
alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3580-
alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3581-
alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3582-
alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3583-
alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3584-
msleep(30);
3585-
}
35863587

35873588
snd_hda_codec_write(codec, hp_pin, 0,
35883589
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
@@ -3713,6 +3714,13 @@ static void alc225_init(struct hda_codec *codec)
37133714
hda_nid_t hp_pin = alc_get_hp_pin(spec);
37143715
bool hp1_pin_sense, hp2_pin_sense;
37153716

3717+
if (spec->ultra_low_power) {
3718+
alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3719+
alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3720+
alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3721+
msleep(30);
3722+
}
3723+
37163724
if (spec->codec_variant != ALC269_TYPE_ALC287 &&
37173725
spec->codec_variant != ALC269_TYPE_ALC245)
37183726
/* required only at boot or S3 and S4 resume time */
@@ -3734,12 +3742,6 @@ static void alc225_init(struct hda_codec *codec)
37343742
msleep(2);
37353743

37363744
alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3737-
if (spec->ultra_low_power) {
3738-
alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3739-
alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3740-
alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3741-
msleep(30);
3742-
}
37433745

37443746
if (hp1_pin_sense || spec->ultra_low_power)
37453747
snd_hda_codec_write(codec, hp_pin, 0,

0 commit comments

Comments
 (0)