Bug 75151 - Headphone jack does not works after suspend/resume
Summary: Headphone jack does not works after suspend/resume
Status: NEEDINFO
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: Jaroslav Kysela
URL: https://bugs.launchpad.net/ubuntu/+so...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-30 11:51 UTC by Kyrylo Mikos
Modified: 2016-05-05 13:57 UTC (History)
17 users (show)

See Also:
Kernel Version: 3.15.6
Subsystem:
Regression: No
Bisected commit-id:


Attachments
alsa info (39.07 KB, text/plain)
2014-04-30 11:51 UTC, Kyrylo Mikos
Details
lspci (11.24 KB, application/octet-stream)
2014-04-30 11:52 UTC, Kyrylo Mikos
Details
Case 1: after cold boot. (38.47 KB, application/octet-stream)
2014-05-01 07:51 UTC, Kyrylo Mikos
Details
Case 2: after suspend/resume. (38.79 KB, application/octet-stream)
2014-05-01 07:51 UTC, Kyrylo Mikos
Details
Case 3: after warm reboot (38.71 KB, application/octet-stream)
2014-05-01 07:52 UTC, Kyrylo Mikos
Details

Description Kyrylo Mikos 2014-04-30 11:51:36 UTC
Created attachment 134431 [details]
alsa info

Front headphone jack does not works, mic jack works fine.

Laptop: Clevo W230
Audio hardware: VIA VT18xx
indep_hp should be disabled at this hardware

ubuntu-bug: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1313904
Comment 1 Kyrylo Mikos 2014-04-30 11:52:04 UTC
Created attachment 134441 [details]
lspci
Comment 2 Kyrylo Mikos 2014-04-30 11:56:01 UTC
The problem can be fixed with next alsa-patch:
[codec]
0x11068446 0x15582300 0

[hint]
indep_hp = no
Comment 3 Takashi Iwai 2014-04-30 12:12:13 UTC
What do you mean "front headphone jack does not work"?  How was it tested?
Please give alsa-info.sh outputs of both working and non-working cases.
Comment 4 Raymond 2014-04-30 13:49:59 UTC
driver shoud not assign same dac to device 0 and device 2


Node 0x08 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="VT1802 Analog", type="Audio", device=0
  Device: name="VT1802 Alt Analog", type="Audio", device=2
  Amp-Out caps: ofs=0x2a, nsteps=0x2a, stepsize=0x05, mute=0
  Amp-Out vals:  [0x28 0x28]
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 5 Raymond 2014-05-01 04:46:39 UTC
==> lo_type=2, wired=1, mio=1, badness=0x0
multi_outs = 25/0/0/0 : 8/0/0/0 (type HP)
  out path: depth=4 :08:35:15:25
spk_outs = 24/0/0/0 : 9/0/0/0
  spk path: depth=4 :09:34:14:24
  mix path: depth=4 :08:21:15:25
  mix path: depth=4 :08:21:14:24
==> Best config: lo_type=2, wired=1, mio=1
multi_outs = 25/0/0/0 : 8/0/0/0 (type HP)
  out path: depth=4 :08:35:15:25
spk_outs = 24/0/0/0 : 9/0/0/0
  spk path: depth=4 :09:34:14:24
  mix path: depth=4 :08:21:15:25
  mix path: depth=4 :08:21:14:24


the evaluation path was not full tested when type HP return zero badness

(type speaker) is not even tested

the badness should not be zero since HP cannot be placed in multi outs to support independent headphone
Comment 6 Kyrylo Mikos 2014-05-01 07:50:52 UTC
I made 3 testes with next results:
1. After cold boot I hear low-frequency noice before (and after) booting the kernel (probably EFI initialize codec properly) and headphone out works fine.
2. After sleep/resume there are not such noice and headphones out stops working.
3. After warm reboot there are also no such noice (EFI does not reinit codec?) and headphones out does not works. Attaching alsa-info outputs for all 3 cases.
Comment 7 Kyrylo Mikos 2014-05-01 07:51:21 UTC
Created attachment 134521 [details]
Case 1: after cold boot.
Comment 8 Kyrylo Mikos 2014-05-01 07:51:52 UTC
Created attachment 134531 [details]
Case 2: after suspend/resume.
Comment 9 Kyrylo Mikos 2014-05-01 07:52:13 UTC
Created attachment 134541 [details]
Case 3: after warm reboot
Comment 10 Raymond 2014-05-01 12:08:02 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=ef4da45828603df57e5e21b8aa21a66ce309f79b

your vt1802 seem different from those in Asus g75v

https://launchpadlibrarian.net/114798750/Card0.Codecs.codec.0.txt

analog mixer 0x21 seem connect to audio output 0x08


Node 0x21 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
  Control: name="Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Power states:  D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 3
     0x2b 0x2a 0x29
  In-driver Connection: 4
     0x2b 0x2a 0x29 0x08
Comment 11 Raymond 2014-05-01 14:08:37 UTC
http://bugzillafiles.novell.org/attachment.cgi?id=470256

The connection was used as  PCM loopback Playback Volume

Node 0x21 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
  Control: name="PCM Loopback Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="PCM Loopback Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Internal Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=2, ofs=0
  Control: name="Internal Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=2, ofs=0
  Control: name="Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Power states:  D0 D1 D2 D3
  Power: setting=D3, actual=D3
  Connection: 3
     0x2b 0x2a 0x29
Comment 12 Raymond 2014-05-01 14:32:38 UTC
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1244127/comments/15

any specific reason to hide node 0x3e 


sudo ./hda-verb /dev/snd/hwC0D0 0x3e 0xf00 0x9
00 0x9
nid = 0x3e, verb = 0xf00, param = 0x9
value = 0x200500

sudo ./hda-verb /dev/snd/hwC0D0 0x3e 0xf00 0xe
nid = 0x3e, verb = 0xf00, param = 0xe
value = 0x1

sudo ./hda-verb /dev/snd/hwC0D0 0x3e 0xf02 0x0
nid = 0x3e, verb = 0xf02, param = 0x0
value = 0x1c
Comment 13 Raymond 2014-05-01 15:06:06 UTC
DAC 0x08 was assigned to speaker ,0x09 was assigned to the headphone when the laptop has one speaker in the past

https://bugzilla.novell.com/show_bug.cgi?id=740118



Node 0x08 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Device: name="VT1802 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x2a, nsteps=0x2a, stepsize=0x05, mute=0
  Amp-Out vals:  [0x2a 0x2a]
  Converter: stream=5, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x09 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="VT1802 HP", type="Audio", device=2
  Amp-Out caps: ofs=0x2a, nsteps=0x2a, stepsize=0x05, mute=0
  Amp-Out vals:  [0x18 0x18]
  Converter: stream=5, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 14 Kyrylo Mikos 2014-05-01 15:11:51 UTC
Output for hda-verb is same:

sudo hda-verb /dev/snd/hwC1D0 0x3e 0xf00 0x9
nid = 0x3e, verb = 0xf00, param = 0x9
value = 0x200500

sudo hda-verb /dev/snd/hwC1D0 0x3e 0xf00 0xe
nid = 0x3e, verb = 0xf00, param = 0xe
value = 0x1

sudo hda-verb /dev/snd/hwC1D0 0x3e 0xf02 0x0
nid = 0x3e, verb = 0xf02, param = 0x0
value = 0x1c
Comment 15 Kyrylo Mikos 2014-05-01 17:45:30 UTC
So, I didn't familar with kernel sound module but I can test driver changes.
Or can you point me to the right way?
As far as I understand currently some pin/node/module is not powers up after suspend?
Comment 16 Raymond 2014-05-02 01:06:18 UTC
are you using latest driver ? node 0x3e still exist 

another problem is the function which set/clear EAPD does not keep the R/L Swap and Balanced bits

Pincap 0x00010050: OUT EAPD Balanced
  EAPD 0x3: BALANCED EAPD


Node 0x24 [Pin Complex] wcaps 0x40050d: Stereo Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Speaker Phantom Jack", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00010050: OUT EAPD Balanced
  EAPD 0x3: BALANCED EAPD
  Pin Default 0x901701f0: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x14* 0x3e
Comment 17 Raymond 2014-05-02 01:29:01 UTC
the fix should be at snd_hda_get_sub_nodes if the codec cannot provide the correct number of nodes in the codecs 

do your vt1802 return the correct count ?


int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
			  hda_nid_t *start_id)
{
	unsigned int parm;

	parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT);
	if (parm == -1)
		return 0;
	*start_id = (parm >> 16) & 0x7fff;
	return (int)(parm & 0x7fff);
}
Comment 18 Kyrylo Mikos 2014-05-02 07:21:23 UTC
Added debugging:
int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
			  hda_nid_t *start_id)
{
	unsigned int parm;

	parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT);
	printk("MIK: %d\n", codec->vendor_id);
	printk("MIK: parm = %d\n", parm);
	if (parm == -1)
		return 0;
	*start_id = (parm >> 16) & 0x7fff;
	printk("MIK: n = %d\n", (int)(parm & 0x7fff));
	return (int)(parm & 0x7fff);
}

The outptut (VIA is 285639750 = 0x11068446):
[    4.296094] MIK: 285639750
[    4.296096] MIK: parm = 65537
[    4.296097] MIK: n = 1
[    4.296181] MIK: 285639750
[    4.296182] MIK: parm = 524341
[    4.296183] MIK: n = 53

[    4.298110] MIK: -2138691577
[    4.298112] MIK: parm = 65537
[    4.298113] MIK: n = 1
[    4.298146] MIK: -2138691577
[    4.298147] MIK: parm = 131074
[    4.298148] MIK: n = 2
[    4.305379] MIK: -2138691577
[    4.305382] MIK: parm = 131079
[    4.305383] MIK: n = 7
[    4.305656] MIK: -2138691577
[    4.305658] MIK: parm = 131079
[    4.305659] MIK: n = 7
Comment 19 Kyrylo Mikos 2014-05-02 07:23:05 UTC
I am using ubuntu 14.04 kernel sources (3.13.9).
Comment 20 Raymond 2014-05-02 12:15:56 UTC
what is the values of codec->num_nodes ?

your output contain nodes 0x3c, but your output is 53 (0x35)


static int read_widget_caps(struct hda_codec *codec, hda_nid_t fg_node)
{
	int i;
	hda_nid_t nid;

	codec->num_nodes = snd_hda_get_sub_nodes(codec, fg_node,
						 &codec->start_nid);
	codec->wcaps = kmalloc(codec->num_nodes * 4, GFP_KERNEL);
	if (!codec->wcaps)
		return -ENOMEM;
	nid = codec->start_nid;
	for (i = 0; i < codec->num_nodes; i++, nid++)
		codec->wcaps[i] = snd_hda_param_read(codec, nid,
						     AC_PAR_AUDIO_WIDGET_CAP);
	return 0;
}


Node 0x3e [Audio Mixer] wcaps 0x200500: Mono
   Power states: D0 D1 D2 D3
   Power: setting=D0, actual=D0
   Connection: 1
      0x1c

does  node 0x3d return any values when you use hda-verb to query widget type , connection list ,...


node 0x33 is a mono pin complex which need to connect through a downmix widget to accept the stereo signal from stereo audio output

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=d5266125fb439a5dfa4edd548d888fda47414ac5
Comment 21 Kyrylo Mikos 2014-05-02 13:00:01 UTC
Output for 0x3d:

sudo hda-verb /dev/snd/hwC1D0 0x3d 0xf00 0x9
nid = 0x3d, verb = 0xf00, param = 0x9
value = 0xf00000

sudo hda-verb /dev/snd/hwC1D0 0x3d 0xf00 0xe
nid = 0x3d, verb = 0xf00, param = 0xe
value = 0x0

sudo hda-verb /dev/snd/hwC1D0 0x3d 0xf02 0x0
nid = 0x3d, verb = 0xf02, param = 0x0
value = 0x0


Output for 0x3c:

sudo hda-verb /dev/snd/hwC1D0 0x3c 0xf00 0x9
nid = 0x3c, verb = 0xf00, param = 0x9
value = 0x300501

sudo hda-verb /dev/snd/hwC1D0 0x3c 0xf00 0xe
nid = 0x3c, verb = 0xf00, param = 0xe
value = 0x2

sudo hda-verb /dev/snd/hwC1D0 0x3c 0xf02 0x0
nid = 0x3c, verb = 0xf02, param = 0x0
value = 0x908

Output for 0x35:

sudo hda-verb /dev/snd/hwC1D0 0x35 0xf00 0x9
nid = 0x35, verb = 0xf00, param = 0x9
value = 0x300501

sudo hda-verb /dev/snd/hwC1D0 0x35 0xf00 0xe
nid = 0x35, verb = 0xf00, param = 0xe
value = 0x2

sudo hda-verb /dev/snd/hwC1D0 0x35 0xf02 0x0
nid = 0x35, verb = 0xf02, param = 0x0
value = 0x908



Added debug code:

static int read_widget_caps(struct hda_codec *codec, hda_nid_t fg_node)
{
	int i;
	hda_nid_t nid;

	codec->num_nodes = snd_hda_get_sub_nodes(codec, fg_node,
						 &codec->start_nid);
	printk("MIK: codec->vendor_id = %d, codec->num_nodes = %d\n", codec->vendor_id, codec->num_nodes);
	codec->wcaps = kmalloc(codec->num_nodes * 4, GFP_KERNEL);
	if (!codec->wcaps)
		return -ENOMEM;
	nid = codec->start_nid;
	for (i = 0; i < codec->num_nodes; i++, nid++)
		codec->wcaps[i] = snd_hda_param_read(codec, nid,
						     AC_PAR_AUDIO_WIDGET_CAP);
	return 0;
}

Output from kernel module:

[    4.313834] MIK: codec->vendor_id = 285639750, codec->num_nodes = 53
[    4.318001] MIK: codec->vendor_id = -2138691577, codec->num_nodes = 2
[    4.332846] MIK: codec->vendor_id = -2138691577, codec->num_nodes = 7
Comment 22 Raymond 2014-06-04 00:42:40 UTC
the independent headphone allows headphone and multi out path can play different audio streams

this mean that headphone cannot be put at the multi out path

also low power mode power down any widgets on the unused audio path 

function indep_hp_possible in hda_generic.c should return false 


if (cfg->line_out_type == AUTO_PIN_HEADPHONE) 
      return false;


if the driver really want to support independent headphones on notebook 

speaker need to put in multi out path instead of headphone


==> lo_type=2, wired=1, mio=1, badness=0x0
multi_outs = 25/0/0/0 : 8/0/0/0 (type HP)
  out path: depth=4 :08:35:15:25
spk_outs = 24/0/0/0 : 9/0/0/0
  spk path: depth=4 :09:34:14:24
  mix path: depth=4 :08:21:15:25
  mix path: depth=4 :08:21:14:24
==> Best config: lo_type=2, wired=1, mio=1
multi_outs = 25/0/0/0 : 8/0/0/0 (type HP)
  out path: depth=4 :08:35:15:25
spk_outs = 24/0/0/0 : 9/0/0/0
  spk path: depth=4 :09:34:14:24
  mix path: depth=4 :08:21:15:25
  mix path: depth=4 :08:21:14:24
Comment 23 Raymond 2014-07-25 02:01:46 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_proc.c?id=e3303235209c0496b490e10ab131e72a9568c153

Node 0x08 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="VT1802 Analog", type="Audio", device=0
  Device: name="VT1802 Alt Analog", type="Audio", device=2

it is strange to have two devices using same nid
Comment 24 Kyrylo Mikos 2014-07-27 12:45:58 UTC
Marco and Unrud at launchpad have found solution for Windows: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1313904/comments/18

In the latest drivers clevo added InitHeadphone.exe executable which call InitHeadphone from hp.dll. After it headphone jack starts working.

Here is hp.dll: https://www.dropbox.com/s/orwxeca445id5o5/hp.dll
Comment 25 Raymond 2014-07-30 11:58:08 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_via.c?id=11890956e948e6ed1b3e4acc11b6879db6ace01b

it seem bug in set_widgets_power_state_vt2002P


Node 0x26 [Vendor Defined Widget] wcaps 0xf00000: Mono

and not all notebook use the mono pin node 0x33 

the logic seem power down subwoofer path when headphone is plugged

 	/* Mono Out */
 	present = snd_hda_jack_detect(codec, 0x26);
 
 	parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
-	/* PW15 (31h), MW8(17h), MUX8(3bh) */
-	snd_hda_codec_write(codec, 0x31, 0,
-			    AC_VERB_SET_POWER_STATE, parm);
-	snd_hda_codec_write(codec, 0x17, 0,
-			    AC_VERB_SET_POWER_STATE, parm);
-	snd_hda_codec_write(codec, 0x3b, 0,
-			    AC_VERB_SET_POWER_STATE, parm);
-
+	if (spec->codec_type == VT1802) {
+		/* PW15 (33h), MW8(1ch), MUX8(3ch) */
+		snd_hda_codec_write(codec, 0x33, 0,
+				    AC_VERB_SET_POWER_STATE, parm);
+		snd_hda_codec_write(codec, 0x1c, 0,
+				    AC_VERB_SET_POWER_STATE, parm);
+		snd_hda_codec_write(codec, 0x3c, 0,
+				    AC_VERB_SET_POWER_STATE, parm);
+	} else {
+
Comment 26 Raymond 2014-07-31 02:28:12 UTC
7.3.3.16 EAPD/BTL Enable 

BTL controls the output configuration of a Pin Widget which has indicated support for balanced I/O (bit 6, Pin Capabilities Parameter).  When this bit is 0, the output drivers are configured in normal, single-ended mode; when this bit is 1, they are configured in balanced mode.  Note that in balanced mode, the Pin Widget has twice as many pins as it does in normal mode; i.e., a stereo Pin Widget in balanced mode has four signal pins (in addition to Vref pins).  However, in both modes it must appear to software as a single Pin Widget.  The additional pins must be reserved to this purpose; thus, in a configuration supporting BTL outputs the additional pins may not be enumerated as a separate Pin Widget. 

Pincap 0x00010050: OUT EAPD Balanced
  EAPD 0x3: BALANCED EAPD


seem in balanced mode BUT the driver  always clear this bit


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/hda_proc.c

if (caps & AC_PINCAP_EAPD) {
		val = snd_hda_codec_read(codec, nid, 0,
					 AC_VERB_GET_EAPD_BTLENABLE, 0);
		snd_iprintf(buffer, "  EAPD 0x%x:", val);
		if (val & AC_EAPDBTL_BALANCED)
			snd_iprintf(buffer, " BALANCED");
		if (val & AC_EAPDBTL_EAPD)
			snd_iprintf(buffer, " EAPD");
		if (val & AC_EAPDBTL_LR_SWAP)
			snd_iprintf(buffer, " R/L");
		snd_iprintf(buffer, "\n");
	}


static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable)
{
	struct hda_gen_spec *spec = codec->spec;
	if (spec->own_eapd_ctl ||
	    !(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD))
		return;
	if (spec->keep_eapd_on && !enable)
		return;
	if (codec->inv_eapd)
		enable = !enable;
	snd_hda_codec_update_cache(codec, pin, 0,
				   AC_VERB_SET_EAPD_BTLENABLE,
				   enable ? 0x02 : 0x00);
}
Comment 27 Takashi Iwai 2014-08-05 11:50:38 UTC
(In reply to Raymond from comment #25)
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/
> pci/hda/patch_via.c?id=11890956e948e6ed1b3e4acc11b6879db6ace01b
> 
> it seem bug in set_widgets_power_state_vt2002P

It's irrelevant.  The whole set_widgets_power_state*() are disabled in the recent code.  See set_widgets_power_state() function.
Comment 28 Takashi Iwai 2014-08-05 11:59:02 UTC
(In reply to Raymond from comment #16)
> are you using latest driver ? node 0x3e still exist 

It's a known issue of some VIA codecs.  They hide such an analog loopback mixer widget by some reason (maybe to be compliant with Microsoft driver).  There is a workaround in patch_via.c to avoid confusion.

One known problem is that the power of 0x3e isn't controlled properly.  But this path isn't used actually, so it shouldn't be any serious problem.
Comment 29 Takashi Iwai 2014-08-05 12:16:31 UTC
(In reply to Raymond from comment #23)
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/
> pci/hda/hda_proc.c?id=e3303235209c0496b490e10ab131e72a9568c153
> 
> Node 0x08 [Audio Output] wcaps 0x41d: Stereo Amp-Out
>   Control: name="Headphone Playback Volume", index=0, device=0
>     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>   Device: name="VT1802 Analog", type="Audio", device=0
>   Device: name="VT1802 Alt Analog", type="Audio", device=2
> 
> it is strange to have two devices using same nid

This is normal.  The first one is the primary multi-channel PCM, and the headphone pin is included when "Independent HP" control is off.
Meanwhile, the latter one is the headphone-only PCM stream, and of course, it's also assigned to the headphone pin.
Comment 30 Takashi Iwai 2014-08-05 12:17:17 UTC
Is the old workaround, indep_hp = false hint, still effective with the recent kernel?  If so, it's the hint to take a look at.
Comment 31 Kyrylo Mikos 2014-08-05 12:46:29 UTC
Actually that workaround was just a fake. I didn't knew whole reproduction route when tried workaround. And it does nothing in both cases no sound in headphones. I tried it with latest kernel (3.15.6, commented line spec->gen.indep_hp = 1; in patch_via.c).

The correct bug description:
No sound in headphones jack after suspend/resume and even after soft reoboot.
Headphones jack works cirrectly only after cold boot.

The was was also reproducable in Windows (see https://bugzilla.kernel.org/show_bug.cgi?id=75151#c24).

I tried to make some changes in the kernel (changes was suggested by Raymond), you can read results at the launchpad: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1313904 (#22, #27-#44). But we did not reach any success.
Comment 32 Takashi Iwai 2014-08-05 13:16:36 UTC
OK, it relieved me; I've wondered why indep_hp had any influence on it.

As it hits on Windows, too, the problem is likely in the firmware, i.e. there can be some undocumented init sequences.

I'll try to ping VIA people who might have a better clue.
Comment 33 Raymond 2014-08-05 14:57:41 UTC
have you try

+ if (cfg->line_out_type == AUTO_PIN_HP_OUT)
 + return false;

this does not disable indep hp but just force driver put speaker in multiout and device 0 in speaker 's audio output and device 2 in headphone 's audio output 

actually notebook don't need independent hp
Comment 34 Kyrylo Mikos 2014-08-05 15:21:28 UTC
Yes, I do. Probably I forgot to reply about this. Currently running kernel with this change, same result after suspend/resume.
Comment 35 faulty 2014-08-13 02:57:45 UTC
(In reply to Kyrylo Mikos from comment #2)
> The problem can be fixed with next alsa-patch:
> [codec]
> 0x11068446 0x15582300 0
> 
> [hint]
> indep_hp = no

Sorry for asking a newbie question, any pointers on how to do this "alsa-patch"? I've having the same hardware and problem while running the latest Arch. I can't seems google anything relevant on performing "alsa-patch" :)
Comment 36 Takashi Iwai 2014-08-13 13:08:53 UTC
Or do you have ~/.pulse/* ?  It's the old config directory.
Comment 37 Takashi Iwai 2014-08-13 13:10:10 UTC
Sorry, a wrong bug.

About HD-audio early patching, read Documentation/sound/alsa/HD-Audio.txt.
Comment 38 Raymond 2014-08-13 16:48:05 UTC
in function
snd_hda_multi_out_analog_prepare,  




/* front */
	snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag,
				   0, format);
	if (!mout->no_share_stream &&
	    mout->hp_nid && mout->hp_nid != nids[HDA_FRONT])
		/* headphone out will just decode front left/right (stereo) */
		snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag,
					   0, format);


when independent HP switch is on , driver only  setup stream for hda_front DAC and those surround DAC s

 HP 's DAC is used by alt analog device exclusively


a normal independent headphone which allow multistreaming using front panel HP and rear panel line out won't share dac and volume control


it is a bug to allow independent headphone when HP and speaker share DAC and volume control  when  the subwoofer is using  the remain DAC and volume control for Asus G75

http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/vt1802-asus-g75?id=HEAD
Comment 39 Jeremy Rimpo 2014-09-05 19:25:24 UTC
I'm having a nearly identical issue on a Clevo P170SM-A laptop, though the (primary) sound card is a Realtek ALC892.

Once the computer has gone into a suspended state, the machine must be powered off - either via a full shutdown or a hibernate - to reactivate sound to the headphone jack. It does continue to correctly detect that headphones have been plugged into the jack.

I'm having this issue on the Fedora kernel-3.16.1-300.fc21.x86_64 - though it has been present at least as far back as 3.13.x.

Is there any further information I could give that might help debug this issue? Would additional alsa-info outputs be helpful?
Comment 40 Dimitri Livitz 2014-09-21 23:02:59 UTC
I can confirm all of the above issues on my Clevo W230SS, and using the VIA codec.
 
I am running arch linux with kernel version 3.16.3-1

I've had this issue since I got this laptop earlier this summer. 

To echo the reply above me, is there any additional information that I could provide, or anything I could test that would be helpful?
Comment 41 Tai Chi Minh Ralph Eastwood 2014-09-22 10:32:41 UTC
I have the Clevo W230SS and have the same issues as described using the VIA codec.  Would it be possible to do some investigation of this InitHeadphone to see how it re-enables it?
Comment 42 Raymond 2014-10-13 03:33:04 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_via.c?id=94c142a160d63edac0e1fca7848960dcf75dd2a9

if pinctl of hp changed to 0 in via_suspend, did the driver restore pin ctl after resume?
Comment 43 Kyrylo Mikos 2014-10-13 08:00:00 UTC
I already tried this one. I reverted the patch and the results was: pop noise appears but there are still no sound in headphones.
Comment 44 Dave Miller 2014-12-11 21:14:58 UTC
Here's another me-too using Xubuntu 14.04 on a Sager NP8268-S (Clevo P150SM-A) with a Realtek ALC892, with the same behavior noted above in comment #39, looking for a solution.
Comment 45 Raymond 2014-12-12 05:53:08 UTC
https://bugzilla.kernel.org/show_bug.cgi?id=87771

you may need to check whether all nodes and vendor coef are as same as before and after suspend
Comment 46 Tai Chi Minh Ralph Eastwood 2015-01-15 11:34:00 UTC
I tried the instructions on that bug thread, but I didn't get the coef dumped.  Is the coef dumping code specific to Realtek hardware?
Comment 47 Raymond 2015-01-16 08:16:28 UTC
it is quite clear the indepenent HP does not work as expected using hda-emu


when indepenent hp is on 

PCM 1 p 44100 2 16 

use audio output node 0x08

but 

PCM 0 p 44100 2 16

although the driver use node 0x09 but it also set channel stream id of node 0x08 to zero which is incorrect if headphone can be play indepenently
Comment 48 matima20 2015-01-19 11:56:00 UTC
Same here with Santech T55 ( Clevo W230SS ) on 3.18.2-2-ARCH, when suspended (or soft rebooted after suspend) headphones stop functioning.
Comment 49 Mike Gurin 2015-02-11 15:53:55 UTC
Same here with HP 15-r151nr notebook with Intel N3540 integrated HDA controller. Sometimes after suspend the jack stops working.
Comment 50 Kyrylo Mikos 2015-02-23 08:54:48 UTC
Just want to bump this.

Takashi Iwai, have you contacted with VIA guys? Any info about this bug. It is very annoting :(
Comment 51 Takashi Iwai 2015-02-23 09:31:51 UTC
Yes, they wrote that this is basically a BIOS firmware problem, i.e. outside the sound driver.  One could do something, but it's not about the HD-audio chip itself.
Comment 52 Kyrylo Mikos 2015-02-23 10:17:08 UTC
Aha, thanks. Also as I wrote above (https://bugzilla.kernel.org/show_bug.cgi?id=75151#c24), latest audio drivers for this laptop includes an executable which reenable headphones jack. I wonder if someone can create at least same hack for linux...
Comment 53 filipenteixeira 2015-03-12 09:44:34 UTC
Any news? I also have the same problem on a Clevo w230ss, and can supply any requested information
Comment 54 Unrud 2015-03-31 13:01:06 UTC
I made a tool to enable the amplifier:
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1313904/+attachment/4361090/+files/init-headphone_0.2.0_all.deb
It's a deb file for Ubuntu but you can extract the file /usr/sbin/init-headphone and use it on other distributions.
Comment 55 Dimitri Livitz 2015-04-01 05:21:40 UTC
(In reply to Unrud from comment #54)
> I made a tool to enable the amplifier:
> https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1313904/
> +attachment/4361090/+files/init-headphone_0.2.0_all.deb
> It's a deb file for Ubuntu but you can extract the file
> /usr/sbin/init-headphone and use it on other distributions.

I can confirm that this works under ArchLinux for the W230SS. 

Thank you so much! I can't believe it finally works. 

I had to modify the system name in the script, since my laptop is the same model but does not report W230SS as the name (Mythlogic Chaos 1313-A is reported instead).
Comment 56 matima20 2015-04-01 20:43:10 UTC
(In reply to Dimitri Livitz from comment #55)
> (In reply to Unrud from comment #54)
> > I made a tool to enable the amplifier:
> > https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1313904/
> > +attachment/4361090/+files/init-headphone_0.2.0_all.deb
> > It's a deb file for Ubuntu but you can extract the file
> > /usr/sbin/init-headphone and use it on other distributions.
> 
> I can confirm that this works under ArchLinux for the W230SS. 
> 
> Thank you so much! I can't believe it finally works. 
> 
> I had to modify the system name in the script, since my laptop is the same
> model but does not report W230SS as the name (Mythlogic Chaos 1313-A is
> reported instead).

Amazing! 

I've done a PKGBUILD and a systemd unit for Arch Linux,
now the script starts automatically at sleep resume!

https://github.com/ektor5/init-headphone/

Feel free to send pull request to improve it! :)
Comment 57 filipenteixeira 2015-04-30 22:59:12 UTC
Hey, I installed the fedora package (https://github.com/letitz/init-headphone) but my problem isn't fixed. If I try to run init-headphone manually I get this output: http://ur1.ca/k9wdk

Also, my /etc/default/grub looks like:
GRUB_CMDLINE_LINUX="acpi_enforce_resources=lax nouveau.modeset=0 rd.driver.blacklist=nouveau rhgb quiet"

(plus some other lines, of course)

What can I do?
Comment 58 filipenteixeira 2015-04-30 23:04:38 UTC
(In reply to filipenteixeira from comment #57)
> Hey, I installed the fedora package
> (https://github.com/letitz/init-headphone) but my problem isn't fixed. If I
> try to run init-headphone manually I get this output: http://ur1.ca/k9wdk
> 
> Also, my /etc/default/grub looks like:
> GRUB_CMDLINE_LINUX="acpi_enforce_resources=lax nouveau.modeset=0
> rd.driver.blacklist=nouveau rhgb quiet"
> 
> (plus some other lines, of course)
> 
> What can I do?

Sorry, I forgot, but running cat /proc/cmdline I get:
~ > cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-3.19.5-200.fc21.x86_64 root=UUID=fad5cf6e-ff73-4ca3-8313-b508ba18dec3 ro rhgb quiet LANG=en_GB.UTF-8 nouveau.modeset=0 rd.driver.blacklist=nouveau

Which does not include the acpi_enforce_resources=lax. What can be causing this?
Comment 59 Unrud 2015-05-01 08:46:43 UTC
(In reply to filipenteixeira from comment #58)
> Which does not include the acpi_enforce_resources=lax. What can be causing
> this?

Have you updated your grub.cfg?
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Comment 60 cono 2016-05-05 13:42:16 UTC
I have the same issue with my Eurocom Sky MX5.

And init-headphone helped me. But as suggested below, I fixed a bit init-headphone script to support my laptop (here is my merge request: https://github.com/letitz/init-headphone/pull/1)

Let me know if you need any details about my hardware to help to resolve this.
Comment 61 Unrud 2016-05-05 13:57:12 UTC
(In reply to cono from comment #60)
> I have the same issue with my Eurocom Sky MX5.
> 
> And init-headphone helped me. But as suggested below, I fixed a bit
> init-headphone script to support my laptop (here is my merge request:
> https://github.com/letitz/init-headphone/pull/1)
> 
> Let me know if you need any details about my hardware to help to resolve
> this.

Hi,

this is already fixed: https://github.com/Unrud/init-headphone
The Fedora package is not up to date.

Note You need to log in before you can comment on or make changes to this bug.