All of lore.kernel.org
 help / color / mirror / Atom feed
* ALC700 headphone no sound issue
@ 2018-12-05  8:18 Kailang
  2018-12-05  9:49 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Kailang @ 2018-12-05  8:18 UTC (permalink / raw)
  To: Takashi Iwai (tiwai@suse.de); +Cc:  (alsa-devel@alsa-project.org)

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

Hi Takashi,

In Intel ENG board with ALC700. It had headphone no sound issue.
If it plugged headphone or headset into the jack, then do the reboot, it will have a chance to cause headphone no sound.
It just need to run the headphone mode procedure after boot time.
The issue will be fixed.
It also suitable for ALC234 ALC274 and ALC294.

BR,
Kailang

[-- Attachment #2: 0001-intel-alc700-hp-issue.patch --]
[-- Type: application/octet-stream, Size: 2287 bytes --]

From fcea669bc15ecba085b49efb65d67fbc8025c1f6 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Tue, 27 Nov 2018 15:54:07 +0800
Subject: [PATCH] ALSA: hda/realtek - Fixed headphone issue for ALC700

If it plugged headphone or headset into the jack, then
do the reboot, it will have a chance to cause headphone no sound.
It just need to run the headphone mode procedure after boot time.
The issue will be fixed.
It also suitable for ALC234 ALC274 and ALC294.

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 e66da22..edd308b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7190,6 +7190,33 @@ static void alc269_fill_coef(struct hda_codec *codec)
 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
 }
 
+static void alc294_hp_init(struct hda_codec *codec)
+{
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
+	int i, val;
+
+	snd_hda_codec_write(codec, hp_pin, 0,
+			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+
+	msleep(100);
+
+	snd_hda_codec_write(codec, hp_pin, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);
+	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000);
+
+	val = alc_read_coefex_idx(codec, 0x58, 0x01);
+	for (i = 0; i < 20 && val & 0x0080; i++) {
+		msleep(50);
+		val = alc_read_coefex_idx(codec, 0x58, 0x01);
+	}
+
+	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
+	msleep(50);
+}
+
 /*
  */
 static int patch_alc269(struct hda_codec *codec)
@@ -7315,6 +7342,7 @@ static int patch_alc269(struct hda_codec *codec)
 		spec->codec_variant = ALC269_TYPE_ALC294;
 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
+		alc294_hp_init(codec);
 		break;
 	case 0x10ec0700:
 	case 0x10ec0701:
@@ -7322,6 +7350,7 @@ static int patch_alc269(struct hda_codec *codec)
 		spec->codec_variant = ALC269_TYPE_ALC700;
 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
+		alc294_hp_init(codec);
 		break;
 
 	}

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



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

* Re: ALC700 headphone no sound issue
  2018-12-05  8:18 ALC700 headphone no sound issue Kailang
@ 2018-12-05  9:49 ` Takashi Iwai
  2018-12-05  9:54   ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2018-12-05  9:49 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Wed, 05 Dec 2018 09:18:52 +0100,
Kailang wrote:
> 
> Hi Takashi,
> 
> In Intel ENG board with ALC700. It had headphone no sound issue.
> If it plugged headphone or headset into the jack, then do the reboot, it will have a chance to cause headphone no sound.
> It just need to run the headphone mode procedure after boot time.
> The issue will be fixed.
> It also suitable for ALC234 ALC274 and ALC294.

Does this correspond to the HDA_FIXUP_ACT_INIT part of the patch?

BTW, some changes in the patch don't look good, unfortunately.
Namely...

> +static void alc_headset_btn_unsol_event(struct hda_codec *codec,
> +				unsigned int res)
> +{
> +	struct hda_jack_tbl *jack;
> +	int report = 0;
> +
> +	jack = snd_hda_jack_tbl_get(codec, 0x55);
> +	report = SND_JACK_HEADSET;
> +	if (jack->nid == 0x55) {

Here essentially means that it always goes to this if-path, because
jack object is exactly what you queried for NID 0x55.

> +		if (res & (7 << 13))
> +			report |= SND_JACK_BTN_0;
....
> +		report |= report & jack->type;
> +		snd_jack_report(jack->jack, report);

So eventually snd_jack_report() is always invoked at each unsol event
no matter what event actually is.


thanks,

Takashi

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

* Re: ALC700 headphone no sound issue
  2018-12-05  9:49 ` Takashi Iwai
@ 2018-12-05  9:54   ` Takashi Iwai
  2018-12-05  9:58     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2018-12-05  9:54 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Wed, 05 Dec 2018 10:49:56 +0100,
Takashi Iwai wrote:
> 
> On Wed, 05 Dec 2018 09:18:52 +0100,
> Kailang wrote:
> > 
> > Hi Takashi,
> > 
> > In Intel ENG board with ALC700. It had headphone no sound issue.
> > If it plugged headphone or headset into the jack, then do the reboot, it will have a chance to cause headphone no sound.
> > It just need to run the headphone mode procedure after boot time.
> > The issue will be fixed.
> > It also suitable for ALC234 ALC274 and ALC294.
> 
> Does this correspond to the HDA_FIXUP_ACT_INIT part of the patch?

Bah, scratch that, I looked into a wrong patch (what you've sent
before).  Now checking the right one.

Sorry for the noise.


Takashi

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

* Re: ALC700 headphone no sound issue
  2018-12-05  9:54   ` Takashi Iwai
@ 2018-12-05  9:58     ` Takashi Iwai
  2018-12-07  7:19       ` Kailang
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2018-12-05  9:58 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Wed, 05 Dec 2018 10:54:21 +0100,
Takashi Iwai wrote:
> 
> On Wed, 05 Dec 2018 10:49:56 +0100,
> Takashi Iwai wrote:
> > 
> > On Wed, 05 Dec 2018 09:18:52 +0100,
> > Kailang wrote:
> > > 
> > > Hi Takashi,
> > > 
> > > In Intel ENG board with ALC700. It had headphone no sound issue.
> > > If it plugged headphone or headset into the jack, then do the reboot, it will have a chance to cause headphone no sound.
> > > It just need to run the headphone mode procedure after boot time.
> > > The issue will be fixed.
> > > It also suitable for ALC234 ALC274 and ALC294.
> > 
> > Does this correspond to the HDA_FIXUP_ACT_INIT part of the patch?
> 
> Bah, scratch that, I looked into a wrong patch (what you've sent
> before).  Now checking the right one.

OK, now reviewed.

The change looks mostly OK, but a couple of things:

- hp_pin is not guaranteed to be present;
  it should check the case of hp_pin=0, too

- Please give some comment to the function, otherwise it's really
  mystery without answer.
  You can just put the text in the patch description there.


Could you fix these and resubmit?  Thanks!


Takashi

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

* Re: ALC700 headphone no sound issue
  2018-12-05  9:58     ` Takashi Iwai
@ 2018-12-07  7:19       ` Kailang
  2018-12-07  9:19         ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Kailang @ 2018-12-07  7:19 UTC (permalink / raw)
  To: Takashi Iwai; +Cc:  (alsa-devel@alsa-project.org)

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

Hi Takashi,

I regenerate the patch as attach.
Thanks.

BR,
Kailang

-----Original Message-----
From: Takashi Iwai <tiwai@suse.de> 
Sent: Wednesday, December 5, 2018 5:58 PM
To: Kailang <kailang@realtek.com>
Cc: (alsa-devel@alsa-project.org) <alsa-devel@alsa-project.org>
Subject: Re: ALC700 headphone no sound issue

On Wed, 05 Dec 2018 10:54:21 +0100,
Takashi Iwai wrote:
> 
> On Wed, 05 Dec 2018 10:49:56 +0100,
> Takashi Iwai wrote:
> > 
> > On Wed, 05 Dec 2018 09:18:52 +0100,
> > Kailang wrote:
> > > 
> > > Hi Takashi,
> > > 
> > > In Intel ENG board with ALC700. It had headphone no sound issue.
> > > If it plugged headphone or headset into the jack, then do the reboot, it will have a chance to cause headphone no sound.
> > > It just need to run the headphone mode procedure after boot time.
> > > The issue will be fixed.
> > > It also suitable for ALC234 ALC274 and ALC294.
> > 
> > Does this correspond to the HDA_FIXUP_ACT_INIT part of the patch?
> 
> Bah, scratch that, I looked into a wrong patch (what you've sent 
> before).  Now checking the right one.

OK, now reviewed.

The change looks mostly OK, but a couple of things:

- hp_pin is not guaranteed to be present;
  it should check the case of hp_pin=0, too

- Please give some comment to the function, otherwise it's really
  mystery without answer.
  You can just put the text in the patch description there.


Could you fix these and resubmit?  Thanks!


Takashi

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

[-- Attachment #2: 0002-intel-alc700-hp-issue.patch --]
[-- Type: application/octet-stream, Size: 2477 bytes --]

From 32dafe645ed5ea83b807505f05ebfae47ea0e387 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Fri, 7 Dec 2018 15:14:59 +0800
Subject: [PATCH] ALSA: hda/realtek - Fixed headphone issue for ALC700

If it plugged headphone or headset into the jack, then
do the reboot, it will have a chance to cause headphone no sound.
It just need to run the headphone mode procedure after boot time.
The issue will be fixed.
It also suitable for ALC234 ALC274 and ALC294.

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 bb40624..8933441 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7224,6 +7224,37 @@ static void alc269_fill_coef(struct hda_codec *codec)
 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
 }
 
+static void alc294_hp_init(struct hda_codec *codec)
+{
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
+	int i, val;
+
+	if (!hp_pin)
+		return;
+
+	snd_hda_codec_write(codec, hp_pin, 0,
+			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+
+	msleep(100);
+
+	snd_hda_codec_write(codec, hp_pin, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
+	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
+
+	/* Wait for depop procedure finish  */
+	val = alc_read_coefex_idx(codec, 0x58, 0x01);
+	for (i = 0; i < 20 && val & 0x0080; i++) {
+		msleep(50);
+		val = alc_read_coefex_idx(codec, 0x58, 0x01);
+	}
+	/* Set HP depop to auto mode */
+	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
+	msleep(50);
+}
+
 /*
  */
 static int patch_alc269(struct hda_codec *codec)
@@ -7349,6 +7380,7 @@ static int patch_alc269(struct hda_codec *codec)
 		spec->codec_variant = ALC269_TYPE_ALC294;
 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
+		alc294_hp_init(codec);
 		break;
 	case 0x10ec0300:
 		spec->codec_variant = ALC269_TYPE_ALC300;
@@ -7360,6 +7392,7 @@ static int patch_alc269(struct hda_codec *codec)
 		spec->codec_variant = ALC269_TYPE_ALC700;
 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
+		alc294_hp_init(codec);
 		break;
 
 	}

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



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

* Re: ALC700 headphone no sound issue
  2018-12-07  7:19       ` Kailang
@ 2018-12-07  9:19         ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2018-12-07  9:19 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Fri, 07 Dec 2018 08:19:56 +0100,
Kailang wrote:
> 
> Hi Takashi,
> 
> I regenerate the patch as attach.
> Thanks.
> 
> BR,
> Kailang

Thanks, applied now.


Takashi

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

end of thread, other threads:[~2018-12-07  9:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05  8:18 ALC700 headphone no sound issue Kailang
2018-12-05  9:49 ` Takashi Iwai
2018-12-05  9:54   ` Takashi Iwai
2018-12-05  9:58     ` Takashi Iwai
2018-12-07  7:19       ` Kailang
2018-12-07  9:19         ` Takashi Iwai

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.