Skip to contentSkip to conversation

Turn on power early to avoid something

PATCH Kailang 2 participants 7 messages Dec 30, 2022 – Jan 3, 2023 Sound

lore
Share & tools
lore

Kailang

author
#0 lore raw

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

From c26a3e5c625b3d6af8bb90b450b817ba55d2cc11 Mon Sep 17 00:00:00 2001
From: Yuchi Yang <[email protected]>
Date: Fri, 30 Dec 2022 15:22:25 +0800
Subject: [PATCH]ALSA: hda/realtek - Turn on power early

Turn on power early to avoid something.

sound/pci/hda/patch_realtek.c +16 -14
index 8a3e2fe42106..1184b7b53eec 100644
@@ -3463,6 +3463,15 @@ static void alc256_init(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp_pin_sense;
 
+	if (spec->ultra_low_power) {
+		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
+		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
+		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
+		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
+		msleep(30);
+	}
+
 	if (!hp_pin)
 		hp_pin = 0x21;
 
@@ -3474,14 +3483,6 @@ static void alc256_init(struct hda_codec *codec)
 		msleep(2);
 
 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
-	if (spec->ultra_low_power) {
-		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
-		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
-		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
-		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
-		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
-		msleep(30);
-	}
 
 	snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
@@ -3612,6 +3613,13 @@ static void alc225_init(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp1_pin_sense, hp2_pin_sense;
 
+	if (spec->ultra_low_power) {
+		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
+		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
+		msleep(30);
+	}
+
 	if (spec->codec_variant != ALC269_TYPE_ALC287)
 		/* required only at boot or S3 and S4 resume time */
 		if (!spec->done_hp_init ||
@@ -3632,12 +3640,6 @@ static void alc225_init(struct hda_codec *codec)
 		msleep(2);
 
 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
-	if (spec->ultra_low_power) {
-		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
-		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
-		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
-		msleep(30);
-	}
 
 	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
#1 lore raw
Quoted 7 lines · Kailang

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

Hmm, what is "something"? The description is way too ambiguous to judge whether the change is OK or not, unfortunately. Could you elaborate what exactly the change will fix?

Also, when you submit a patch from another person, please put your own Signed-off-by line. It's a legal requirement.

thanks,

Takashi

author
#2 lore raw
Quoted 19 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 4:05 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 7 lines · Kailang

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

Quoted 6 lines

Hmm, what is "something"? The description is way too ambiguous to judge whether the change is OK or not, unfortunately.
Could you elaborate what exactly the change will fix?

Also, when you submit a patch from another person, please put your own Signed-off-by line. It's a legal requirement.

[email protected] was my personal account.
Could I use this account?
Or I need use this account to mail patch to you.

Quoted 7 lines

thanks,

Takashi

------Please consider the environment before printing this e-mail.

#3 lore raw
Quoted 20 lines · Kailang
Quoted 20 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 4:05 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 7 lines · Kailang

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

Quoted 8 lines
Quoted 6 lines

Hmm, what is "something"? The description is way too ambiguous to judge whether the change is OK or not, unfortunately.
Could you elaborate what exactly the change will fix?

Also, when you submit a patch from another person, please put your own Signed-off-by line. It's a legal requirement.

[email protected] was my personal account.
Could I use this account?

Ah OK, then it's fine.

Quoted 1 line

Or I need use this account to mail patch to you.

It's not necessary, the sign-off is fine as long as it matches with the From address in the patch and it's yourself.

But we still need a better description of the patch text.

thanks,

Takashi

author
#4 lore raw

Add more description.

Quoted 45 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 5:16 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 20 lines · Kailang
Quoted 20 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 4:05 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 7 lines · Kailang

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

Quoted 8 lines
Quoted 6 lines

Hmm, what is "something"? The description is way too ambiguous to judge whether the change is OK or not, unfortunately. Could you elaborate what exactly the change will fix?

Also, when you submit a patch from another person, please put your own Signed-off-by line. It's a legal requirement.

[email protected] was my personal account.
Could I use this account?

Ah OK, then it's fine.

Quoted 1 line

Or I need use this account to mail patch to you.

It's not necessary, the sign-off is fine as long as it matches with the From address in the patch and it's yourself.

Quoted 8 lines

But we still need a better description of the patch text.

thanks,

Takashi

------Please consider the environment before printing this e-mail.

From c26a3e5c625b3d6af8bb90b450b817ba55d2cc11 Mon Sep 17 00:00:00 2001
From: Yuchi Yang <[email protected]>
Date: Fri, 30 Dec 2022 15:22:25 +0800
Subject: [PATCH]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.

sound/pci/hda/patch_realtek.c +16 -14
index 8a3e2fe42106..1184b7b53eec 100644
@@ -3463,6 +3463,15 @@ static void alc256_init(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp_pin_sense;
 
+	if (spec->ultra_low_power) {
+		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
+		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
+		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
+		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
+		msleep(30);
+	}
+
 	if (!hp_pin)
 		hp_pin = 0x21;
 
@@ -3474,14 +3483,6 @@ static void alc256_init(struct hda_codec *codec)
 		msleep(2);
 
 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
-	if (spec->ultra_low_power) {
-		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
-		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
-		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
-		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
-		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
-		msleep(30);
-	}
 
 	snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
@@ -3612,6 +3613,13 @@ static void alc225_init(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp1_pin_sense, hp2_pin_sense;
 
+	if (spec->ultra_low_power) {
+		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
+		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
+		msleep(30);
+	}
+
 	if (spec->codec_variant != ALC269_TYPE_ALC287)
 		/* required only at boot or S3 and S4 resume time */
 		if (!spec->done_hp_init ||
@@ -3632,12 +3640,6 @@ static void alc225_init(struct hda_codec *codec)
 		msleep(2);
 
 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
-	if (spec->ultra_low_power) {
-		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
-		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
-		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
-		msleep(30);
-	}
 
 	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
#5 lore raw
Quoted 2 lines · Kailang

Add more description.

OK, applied now. Thanks.

Takashi

Quoted 55 lines
Quoted 54 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 5:16 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 20 lines · Kailang
Quoted 20 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 4:05 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 7 lines · Kailang

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

Quoted 8 lines
Quoted 6 lines

Hmm, what is "something"? The description is way too ambiguous to judge whether the change is OK or not, unfortunately. Could you elaborate what exactly the change will fix?

Also, when you submit a patch from another person, please put your own Signed-off-by line. It's a legal requirement.

[email protected] was my personal account.
Could I use this account?

Ah OK, then it's fine.

Quoted 1 line

Or I need use this account to mail patch to you.

It's not necessary, the sign-off is fine as long as it matches with the From address in the patch and it's yourself.

But we still need a better description of the patch text.

thanks,

Takashi

------Please consider the environment before printing this e-mail.

author
#6 lore raw
In reply to Takashi Iwai

OK.

Re attach patch.

Quoted 25 lines

-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Friday, December 30, 2022 4:05 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: Turn on power early to avoid something

Quoted 7 lines · Kailang

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

Hmm, what is "something"? The description is way too ambiguous to judge whether the change is OK or not, unfortunately.
Could you elaborate what exactly the change will fix?

Also, when you submit a patch from another person, please put your own Signed-off-by line. It's a legal requirement.

Quoted 5 lines

thanks,

Takashi

------Please consider the environment before printing this e-mail.

From c26a3e5c625b3d6af8bb90b450b817ba55d2cc11 Mon Sep 17 00:00:00 2001
From: Yuchi Yang <[email protected]>
Date: Fri, 30 Dec 2022 15:22:25 +0800
Subject: [PATCH]ALSA: hda/realtek - Turn on power early

Turn on power early to avoid wrong state for power relation register. This can solve JD state issue when resume back.

sound/pci/hda/patch_realtek.c +16 -14
index 8a3e2fe42106..1184b7b53eec 100644
@@ -3463,6 +3463,15 @@ static void alc256_init(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp_pin_sense;
 
+	if (spec->ultra_low_power) {
+		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
+		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
+		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
+		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
+		msleep(30);
+	}
+
 	if (!hp_pin)
 		hp_pin = 0x21;
 
@@ -3474,14 +3483,6 @@ static void alc256_init(struct hda_codec *codec)
 		msleep(2);
 
 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
-	if (spec->ultra_low_power) {
-		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
-		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
-		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
-		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
-		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
-		msleep(30);
-	}
 
 	snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
@@ -3612,6 +3613,13 @@ static void alc225_init(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp1_pin_sense, hp2_pin_sense;
 
+	if (spec->ultra_low_power) {
+		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
+		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
+		msleep(30);
+	}
+
 	if (spec->codec_variant != ALC269_TYPE_ALC287)
 		/* required only at boot or S3 and S4 resume time */
 		if (!spec->done_hp_init ||
@@ -3632,12 +3640,6 @@ static void alc225_init(struct hda_codec *codec)
 		msleep(2);
 
 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
-	if (spec->ultra_low_power) {
-		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
-		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
-		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
-		msleep(30);
-	}
 
 	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,