All of lore.kernel.org
 help / color / mirror / Atom feed
* Turn on power early to avoid something
@ 2022-12-30  7:54 Kailang
  2022-12-30  8:04 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Kailang @ 2022-12-30  7:54 UTC (permalink / raw)
  To: Takashi Iwai (tiwai@suse.de); +Cc:  (alsa-devel@alsa-project.org)

[-- Attachment #1: Type: text/plain, Size: 91 bytes --]

Hi Takashi,

It maybe can avoid something for early power up.

Many Thanks.
Kailang.

[-- Attachment #2: 0000-turn-on-power-early.patch --]
[-- Type: application/octet-stream, Size: 2435 bytes --]

From c26a3e5c625b3d6af8bb90b450b817ba55d2cc11 Mon Sep 17 00:00:00 2001
From: Yuchi Yang <yangyuchi66@gmail.com>
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.

Signed-off-by: Yuchi Yang <yangyuchi66@gmail.com>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8a3e2fe42106..1184b7b53eec 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -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,

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Turn on power early to avoid something
  2022-12-30  7:54 Turn on power early to avoid something Kailang
@ 2022-12-30  8:04 ` Takashi Iwai
  2022-12-30  8:14   ` Kailang
  2022-12-30  8:48   ` Kailang
  0 siblings, 2 replies; 7+ messages in thread
From: Takashi Iwai @ 2022-12-30  8:04 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Fri, 30 Dec 2022 08:54:01 +0100,
Kailang wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Turn on power early to avoid something
  2022-12-30  8:04 ` Takashi Iwai
@ 2022-12-30  8:14   ` Kailang
  2022-12-30  9:15     ` Takashi Iwai
  2022-12-30  8:48   ` Kailang
  1 sibling, 1 reply; 7+ messages in thread
From: Kailang @ 2022-12-30  8:14 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)



> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Friday, December 30, 2022 4:05 PM
> To: Kailang <kailang@realtek.com>
> Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> Subject: Re: Turn on power early to avoid something
> 
> On Fri, 30 Dec 2022 08:54:01 +0100,
> Kailang wrote:
> >
> > 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.
yangyuchi66@gmail.com was my personal account.
Could I use this account?
Or I need use this account to mail patch to you.
> 
> 
> thanks,
> 
> Takashi
> 
> ------Please consider the environment before printing this e-mail.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Turn on power early to avoid something
  2022-12-30  8:04 ` Takashi Iwai
  2022-12-30  8:14   ` Kailang
@ 2022-12-30  8:48   ` Kailang
  1 sibling, 0 replies; 7+ messages in thread
From: Kailang @ 2022-12-30  8:48 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

OK.

Re attach patch.

> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Friday, December 30, 2022 4:05 PM
> To: Kailang <kailang@realtek.com>
> Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> Subject: Re: Turn on power early to avoid something
> 
> On Fri, 30 Dec 2022 08:54:01 +0100,
> Kailang wrote:
> >
> > 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
> 
> ------Please consider the environment before printing this e-mail.

[-- Attachment #2: 0000-turn-on-power-early.patch --]
[-- Type: application/octet-stream, Size: 2513 bytes --]

From c26a3e5c625b3d6af8bb90b450b817ba55d2cc11 Mon Sep 17 00:00:00 2001
From: Yuchi Yang <yangyuchi66@gmail.com>
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.

Signed-off-by: Kailang Yang <kailang@realtek.com>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8a3e2fe42106..1184b7b53eec 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -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,

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Turn on power early to avoid something
  2022-12-30  8:14   ` Kailang
@ 2022-12-30  9:15     ` Takashi Iwai
  2023-01-03  6:51       ` Kailang
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2022-12-30  9:15 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Fri, 30 Dec 2022 09:14:16 +0100,
Kailang wrote:
> 
> 
> 
> > -----Original Message-----
> > From: Takashi Iwai <tiwai@suse.de>
> > Sent: Friday, December 30, 2022 4:05 PM
> > To: Kailang <kailang@realtek.com>
> > Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> > Subject: Re: Turn on power early to avoid something
> > 
> > On Fri, 30 Dec 2022 08:54:01 +0100,
> > Kailang wrote:
> > >
> > > 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.
> yangyuchi66@gmail.com was my personal account.
> Could I use this account?

Ah OK, then it's fine.

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Turn on power early to avoid something
  2022-12-30  9:15     ` Takashi Iwai
@ 2023-01-03  6:51       ` Kailang
  2023-01-03 15:13         ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Kailang @ 2023-01-03  6:51 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)

[-- Attachment #1: Type: text/plain, Size: 1696 bytes --]

Add more description.

> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Friday, December 30, 2022 5:16 PM
> To: Kailang <kailang@realtek.com>
> Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> Subject: Re: Turn on power early to avoid something
> 
> On Fri, 30 Dec 2022 09:14:16 +0100,
> Kailang wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Takashi Iwai <tiwai@suse.de>
> > > Sent: Friday, December 30, 2022 4:05 PM
> > > To: Kailang <kailang@realtek.com>
> > > Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> > > Subject: Re: Turn on power early to avoid something
> > >
> > > On Fri, 30 Dec 2022 08:54:01 +0100,
> > > Kailang wrote:
> > > >
> > > > 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.
> > yangyuchi66@gmail.com was my personal account.
> > Could I use this account?
> 
> Ah OK, then it's fine.
> 
> > 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.

[-- Attachment #2: 0000-turn-on-power-early.patch --]
[-- Type: application/octet-stream, Size: 2516 bytes --]

From c26a3e5c625b3d6af8bb90b450b817ba55d2cc11 Mon Sep 17 00:00:00 2001
From: Yuchi Yang <yangyuchi66@gmail.com>
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.

Signed-off-by: Yuchi Yang <yangyuchi66@gmail.com>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8a3e2fe42106..1184b7b53eec 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -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,

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Turn on power early to avoid something
  2023-01-03  6:51       ` Kailang
@ 2023-01-03 15:13         ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2023-01-03 15:13 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Tue, 03 Jan 2023 07:51:34 +0100,
Kailang wrote:
> 
> Add more description.

OK, applied now.  Thanks.


Takashi

> 
> > -----Original Message-----
> > From: Takashi Iwai <tiwai@suse.de>
> > Sent: Friday, December 30, 2022 5:16 PM
> > To: Kailang <kailang@realtek.com>
> > Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> > Subject: Re: Turn on power early to avoid something
> > 
> > On Fri, 30 Dec 2022 09:14:16 +0100,
> > Kailang wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Takashi Iwai <tiwai@suse.de>
> > > > Sent: Friday, December 30, 2022 4:05 PM
> > > > To: Kailang <kailang@realtek.com>
> > > > Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> > > > Subject: Re: Turn on power early to avoid something
> > > >
> > > > On Fri, 30 Dec 2022 08:54:01 +0100,
> > > > Kailang wrote:
> > > > >
> > > > > 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.
> > > yangyuchi66@gmail.com was my personal account.
> > > Could I use this account?
> > 
> > Ah OK, then it's fine.
> > 
> > > 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.
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-03 15:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30  7:54 Turn on power early to avoid something Kailang
2022-12-30  8:04 ` Takashi Iwai
2022-12-30  8:14   ` Kailang
2022-12-30  9:15     ` Takashi Iwai
2023-01-03  6:51       ` Kailang
2023-01-03 15:13         ` Takashi Iwai
2022-12-30  8:48   ` Kailang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.