All of lore.kernel.org
 help / color / mirror / Atom feed
* Support low power consumption for ALC3254
@ 2019-05-07  7:53 Kailang
  2019-05-07  8:39 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Kailang @ 2019-05-07  7:53 UTC (permalink / raw)
  To: Takashi Iwai (tiwai@suse.de); +Cc:  (alsa-devel@alsa-project.org)

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

Hi Takashi,

Chrome OS want to support low power consumption.
This patch will support low consumption.

Thanks.

BR,
Kailang

[-- Attachment #2: 0002-chrome-alc3254-power-save.patch --]
[-- Type: application/octet-stream, Size: 4505 bytes --]

From 07f2be32a4cbf2d6de06c5cd7fe7c0266b0512da Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Mon, 6 May 2019 15:09:42 +0800
Subject: [PATCH] ALSA: hda/realtek - Support low power consumption for ALC295

Enter to close more power control widgets at suspend.
Remove hp_pin check. Add the default pin 0x21 as headphone.
Supported low power consumption, it must to do depop procedure when headset jack was plugged or unplugged.
So, alc225_init() and alc225_shutup() must to run delay when headset jack was plugged or unplugged.
If depop procedure not run with delay, it will has a chance to let power consumption raise high.

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 1d0e0f2e6526..f1cdd467d4ab 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -119,6 +119,7 @@ struct alc_spec {
 	unsigned int no_depop_delay:1;
 	unsigned int done_hp_init:1;
 	unsigned int no_shutup_pins:1;
+	unsigned int ultra_low_power:1;
 
 	/* for PLL fix */
 	hda_nid_t pll_nid;
@@ -3268,9 +3269,7 @@ 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 (!hp_pin)
-		return;
-
+	hp_pin ? hp_pin : 0x21;
 	msleep(30);
 
 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
@@ -3280,25 +3279,31 @@ 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)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(85);
 
-	if (hp1_pin_sense)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(100);
 
 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
@@ -3311,11 +3316,7 @@ static void alc225_shutup(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp1_pin_sense, hp2_pin_sense;
 
-	if (!hp_pin) {
-		alc269_shutup(codec);
-		return;
-	}
-
+	hp_pin ? hp_pin : 0x21;
 	/* 3k pull low control for Headset jack. */
 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
 
@@ -3325,28 +3326,36 @@ static void alc225_shutup(struct hda_codec *codec)
 	if (hp1_pin_sense || hp2_pin_sense)
 		msleep(2);
 
-	if (hp1_pin_sense)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(85);
 
-	if (hp1_pin_sense)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(100);
 
 	alc_auto_setup_eapd(codec, false);
 	alc_shutup_pins(codec);
+	if (spec->ultra_low_power) {
+		msleep(50);
+		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
+		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
+		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
+		msleep(30);
+	}
 }
 
 static void alc_default_init(struct hda_codec *codec)
@@ -5525,6 +5534,9 @@ static void alc295_fixup_chromebook(struct hda_codec *codec,
 				    const struct hda_fixup *fix, int action)
 {
 	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		spec->ultra_low_power = true;
+		break;
 	case HDA_FIXUP_ACT_INIT:
 		switch (codec->core.vendor_id) {
 		case 0x10ec0295:

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Support low power consumption for ALC3254
  2019-05-07  7:53 Support low power consumption for ALC3254 Kailang
@ 2019-05-07  8:39 ` Takashi Iwai
  2019-05-07  9:07   ` Kailang
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2019-05-07  8:39 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Tue, 07 May 2019 09:53:24 +0200,
Kailang wrote:
> 
> Hi Takashi,
> 
> Chrome OS want to support low power consumption.
> This patch will support low consumption.

Looks mostly OK, but one question: why hp_pin isn't set?
That is, if the fixup sets up pin 0x21 as HP, the change about hp_pin
can be avoided, no?


thanks,

Takashi

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

* Re: Support low power consumption for ALC3254
  2019-05-07  8:39 ` Takashi Iwai
@ 2019-05-07  9:07   ` Kailang
  2019-05-07  9:15     ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Kailang @ 2019-05-07  9:07 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)

Hi Takashi,

I had sent other patch before.
Could it can apply?

> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Tuesday, May 7, 2019 4:40 PM
> To: Kailang <kailang@realtek.com>
> Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> Subject: Re: Support low power consumption for ALC3254
> 
> On Tue, 07 May 2019 09:53:24 +0200,
> Kailang wrote:
> >
> > Hi Takashi,
> >
> > Chrome OS want to support low power consumption.
> > This patch will support low consumption.
> 
> Looks mostly OK, but one question: why hp_pin isn't set?

If hp_pin not assigned, depop procedure must run.
So, if system doesn't have HP. It must assigned default 0x21 pin to run depop procedure.

> That is, if the fixup sets up pin 0x21 as HP, the change about hp_pin can be
> avoided, no?


Yes, it hp_pin = 0x21. It doesn't change hp_pin.
> 
> 
> thanks,
> 
> Takashi
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: Support low power consumption for ALC3254
  2019-05-07  9:07   ` Kailang
@ 2019-05-07  9:15     ` Takashi Iwai
  2019-05-07  9:23       ` Kailang
  2019-05-07  9:24       ` Takashi Iwai
  0 siblings, 2 replies; 7+ messages in thread
From: Takashi Iwai @ 2019-05-07  9:15 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Tue, 07 May 2019 11:07:14 +0200,
Kailang wrote:
> 
> Hi Takashi,
> 
> I had sent other patch before.
> Could it can apply?

Which patch, specifically?

> > -----Original Message-----
> > From: Takashi Iwai <tiwai@suse.de>
> > Sent: Tuesday, May 7, 2019 4:40 PM
> > To: Kailang <kailang@realtek.com>
> > Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> > Subject: Re: Support low power consumption for ALC3254
> > 
> > On Tue, 07 May 2019 09:53:24 +0200,
> > Kailang wrote:
> > >
> > > Hi Takashi,
> > >
> > > Chrome OS want to support low power consumption.
> > > This patch will support low consumption.
> > 
> > Looks mostly OK, but one question: why hp_pin isn't set?
> 
> If hp_pin not assigned, depop procedure must run.
> So, if system doesn't have HP. It must assigned default 0x21 pin to run depop procedure.

OK, point taken.  So it's not a headphone pin but other output pin
that requires the same depop workaround.

Now applied the patch.  Thanks.


Takashi

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

* Re: Support low power consumption for ALC3254
  2019-05-07  9:15     ` Takashi Iwai
@ 2019-05-07  9:23       ` Kailang
  2019-05-07  9:24       ` Takashi Iwai
  1 sibling, 0 replies; 7+ messages in thread
From: Kailang @ 2019-05-07  9:23 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)



> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Tuesday, May 7, 2019 5:15 PM
> To: Kailang <kailang@realtek.com>
> Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> Subject: Re: Support low power consumption for ALC3254
> 
> On Tue, 07 May 2019 11:07:14 +0200,
> Kailang wrote:
> >
> > Hi Takashi,
> >
> > I had sent other patch before.
> > Could it can apply?
> 
> Which patch, specifically?

I resent again.

> 
> > > -----Original Message-----
> > > From: Takashi Iwai <tiwai@suse.de>
> > > Sent: Tuesday, May 7, 2019 4:40 PM
> > > To: Kailang <kailang@realtek.com>
> > > Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> > > Subject: Re: Support low power consumption for ALC3254
> > >
> > > On Tue, 07 May 2019 09:53:24 +0200,
> > > Kailang wrote:
> > > >
> > > > Hi Takashi,
> > > >
> > > > Chrome OS want to support low power consumption.
> > > > This patch will support low consumption.
> > >
> > > Looks mostly OK, but one question: why hp_pin isn't set?
> >
> > If hp_pin not assigned, depop procedure must run.
> > So, if system doesn't have HP. It must assigned default 0x21 pin to run depop
> procedure.
> 
> OK, point taken.  So it's not a headphone pin but other output pin that
> requires the same depop workaround.

But machine without HP was very few. I don't find it until now.
> 
> Now applied the patch.  Thanks.
> 
> 
> Takashi
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: Support low power consumption for ALC3254
  2019-05-07  9:15     ` Takashi Iwai
  2019-05-07  9:23       ` Kailang
@ 2019-05-07  9:24       ` Takashi Iwai
  2019-05-07  9:28         ` Kailang
  1 sibling, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2019-05-07  9:24 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Tue, 07 May 2019 11:15:23 +0200,
Takashi Iwai wrote:
> 
> Now applied the patch.  Thanks.

Erm, the patch is utterly broken.  I fixed manually like below.
Please confirm that it's the right fix.


Takashi

===

From: Kailang Yang <kailang@realtek.com>
Subject: [PATCH] ALSA: hda/realtek - Support low power consumption for ALC295

Enter to close more power control widgets at suspend.
Remove hp_pin check. Add the default pin 0x21 as headphone.
Supported low power consumption, it must do depop procedure when
headset jack was plugged or unplugged.
So, alc225_init() and alc225_shutup() must run delay when headset
jack was plugged or unplugged.
If depop procedure not run with delay, it will have a chance to let
power consumption raise high.

[ A few compile fixes by tiwai ]

Fixes: 8983eb602af5 ("ALSA: hda/realtek - Move to ACT_INIT state")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 46 +++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d743f2b0e3cf..e733d323f1a7 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -119,6 +119,7 @@ struct alc_spec {
 	unsigned int no_depop_delay:1;
 	unsigned int done_hp_init:1;
 	unsigned int no_shutup_pins:1;
+	unsigned int ultra_low_power:1;
 
 	/* for PLL fix */
 	hda_nid_t pll_nid;
@@ -3269,8 +3270,7 @@ static void alc225_init(struct hda_codec *codec)
 	bool hp1_pin_sense, hp2_pin_sense;
 
 	if (!hp_pin)
-		return;
-
+		hp_pin = 0x21;
 	msleep(30);
 
 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
@@ -3280,25 +3280,31 @@ 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)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(85);
 
-	if (hp1_pin_sense)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(100);
 
 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
@@ -3311,11 +3317,8 @@ static void alc225_shutup(struct hda_codec *codec)
 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
 	bool hp1_pin_sense, hp2_pin_sense;
 
-	if (!hp_pin) {
-		alc269_shutup(codec);
-		return;
-	}
-
+	if (!hp_pin)
+		hp_pin = 0x21;
 	/* 3k pull low control for Headset jack. */
 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
 
@@ -3325,28 +3328,36 @@ static void alc225_shutup(struct hda_codec *codec)
 	if (hp1_pin_sense || hp2_pin_sense)
 		msleep(2);
 
-	if (hp1_pin_sense)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(85);
 
-	if (hp1_pin_sense)
+	if (hp1_pin_sense || spec->ultra_low_power)
 		snd_hda_codec_write(codec, hp_pin, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
 	if (hp2_pin_sense)
 		snd_hda_codec_write(codec, 0x16, 0,
 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
 
-	if (hp1_pin_sense || hp2_pin_sense)
+	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
 		msleep(100);
 
 	alc_auto_setup_eapd(codec, false);
 	alc_shutup_pins(codec);
+	if (spec->ultra_low_power) {
+		msleep(50);
+		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
+		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
+		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
+		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
+		msleep(30);
+	}
 }
 
 static void alc_default_init(struct hda_codec *codec)
@@ -5526,7 +5537,12 @@ static void alc_fixup_headset_jack(struct hda_codec *codec,
 static void alc295_fixup_chromebook(struct hda_codec *codec,
 				    const struct hda_fixup *fix, int action)
 {
+	struct alc_spec *spec = codec->spec;
+
 	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		spec->ultra_low_power = true;
+		break;
 	case HDA_FIXUP_ACT_INIT:
 		switch (codec->core.vendor_id) {
 		case 0x10ec0295:
-- 
2.16.4

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

* Re: Support low power consumption for ALC3254
  2019-05-07  9:24       ` Takashi Iwai
@ 2019-05-07  9:28         ` Kailang
  0 siblings, 0 replies; 7+ messages in thread
From: Kailang @ 2019-05-07  9:28 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)



> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Tuesday, May 7, 2019 5:24 PM
> To: Kailang <kailang@realtek.com>
> Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
> Subject: Re: Support low power consumption for ALC3254
> 
> On Tue, 07 May 2019 11:15:23 +0200,
> Takashi Iwai wrote:
> >
> > Now applied the patch.  Thanks.
> 
> Erm, the patch is utterly broken.  I fixed manually like below.
> Please confirm that it's the right fix.

Oh! Thanks a lot.
The patch is good.

> 
> 
> Takashi
> 
> ===
> 
> From: Kailang Yang <kailang@realtek.com>
> Subject: [PATCH] ALSA: hda/realtek - Support low power consumption for
> ALC295
> 
> Enter to close more power control widgets at suspend.
> Remove hp_pin check. Add the default pin 0x21 as headphone.
> Supported low power consumption, it must do depop procedure when headset
> jack was plugged or unplugged.
> So, alc225_init() and alc225_shutup() must run delay when headset jack was
> plugged or unplugged.
> If depop procedure not run with delay, it will have a chance to let power
> consumption raise high.
> 
> [ A few compile fixes by tiwai ]
> 
> Fixes: 8983eb602af5 ("ALSA: hda/realtek - Move to ACT_INIT state")
> Signed-off-by: Kailang Yang <kailang@realtek.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  sound/pci/hda/patch_realtek.c | 46
> +++++++++++++++++++++++++++++--------------
>  1 file changed, 31 insertions(+), 15 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index d743f2b0e3cf..e733d323f1a7 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -119,6 +119,7 @@ struct alc_spec {
>  	unsigned int no_depop_delay:1;
>  	unsigned int done_hp_init:1;
>  	unsigned int no_shutup_pins:1;
> +	unsigned int ultra_low_power:1;
> 
>  	/* for PLL fix */
>  	hda_nid_t pll_nid;
> @@ -3269,8 +3270,7 @@ static void alc225_init(struct hda_codec *codec)
>  	bool hp1_pin_sense, hp2_pin_sense;
> 
>  	if (!hp_pin)
> -		return;
> -
> +		hp_pin = 0x21;
>  	msleep(30);
> 
>  	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); @@ -3280,25
> +3280,31 @@ 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)
> +	if (hp1_pin_sense || spec->ultra_low_power)
>  		snd_hda_codec_write(codec, hp_pin, 0,
>  			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
>  	if (hp2_pin_sense)
>  		snd_hda_codec_write(codec, 0x16, 0,
>  			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
> 
> -	if (hp1_pin_sense || hp2_pin_sense)
> +	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
>  		msleep(85);
> 
> -	if (hp1_pin_sense)
> +	if (hp1_pin_sense || spec->ultra_low_power)
>  		snd_hda_codec_write(codec, hp_pin, 0,
>  			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
>  	if (hp2_pin_sense)
>  		snd_hda_codec_write(codec, 0x16, 0,
>  			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
> 
> -	if (hp1_pin_sense || hp2_pin_sense)
> +	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
>  		msleep(100);
> 
>  	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); @@ -3311,11 +3317,8 @@
> static void alc225_shutup(struct hda_codec *codec)
>  	hda_nid_t hp_pin = alc_get_hp_pin(spec);
>  	bool hp1_pin_sense, hp2_pin_sense;
> 
> -	if (!hp_pin) {
> -		alc269_shutup(codec);
> -		return;
> -	}
> -
> +	if (!hp_pin)
> +		hp_pin = 0x21;
>  	/* 3k pull low control for Headset jack. */
>  	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
> 
> @@ -3325,28 +3328,36 @@ static void alc225_shutup(struct hda_codec
> *codec)
>  	if (hp1_pin_sense || hp2_pin_sense)
>  		msleep(2);
> 
> -	if (hp1_pin_sense)
> +	if (hp1_pin_sense || spec->ultra_low_power)
>  		snd_hda_codec_write(codec, hp_pin, 0,
>  			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
>  	if (hp2_pin_sense)
>  		snd_hda_codec_write(codec, 0x16, 0,
>  			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
> 
> -	if (hp1_pin_sense || hp2_pin_sense)
> +	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
>  		msleep(85);
> 
> -	if (hp1_pin_sense)
> +	if (hp1_pin_sense || spec->ultra_low_power)
>  		snd_hda_codec_write(codec, hp_pin, 0,
>  			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
>  	if (hp2_pin_sense)
>  		snd_hda_codec_write(codec, 0x16, 0,
>  			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
> 
> -	if (hp1_pin_sense || hp2_pin_sense)
> +	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
>  		msleep(100);
> 
>  	alc_auto_setup_eapd(codec, false);
>  	alc_shutup_pins(codec);
> +	if (spec->ultra_low_power) {
> +		msleep(50);
> +		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
> +		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
> +		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
> +		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
> +		msleep(30);
> +	}
>  }
> 
>  static void alc_default_init(struct hda_codec *codec) @@ -5526,7 +5537,12
> @@ static void alc_fixup_headset_jack(struct hda_codec *codec,  static void
> alc295_fixup_chromebook(struct hda_codec *codec,
>  				    const struct hda_fixup *fix, int action)  {
> +	struct alc_spec *spec = codec->spec;
> +
>  	switch (action) {
> +	case HDA_FIXUP_ACT_PRE_PROBE:
> +		spec->ultra_low_power = true;
> +		break;
>  	case HDA_FIXUP_ACT_INIT:
>  		switch (codec->core.vendor_id) {
>  		case 0x10ec0295:
> --
> 2.16.4
> 
> 
> ------Please consider the environment before printing this e-mail.

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

end of thread, other threads:[~2019-05-07  9:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07  7:53 Support low power consumption for ALC3254 Kailang
2019-05-07  8:39 ` Takashi Iwai
2019-05-07  9:07   ` Kailang
2019-05-07  9:15     ` Takashi Iwai
2019-05-07  9:23       ` Kailang
2019-05-07  9:24       ` Takashi Iwai
2019-05-07  9:28         ` 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.