[W230SS, VIA VT1802, Green Headphone Out, Front] No sound after suspend/resume

Bug #1313904 reported by Kiril on 2014-04-28
86
This bug affects 16 people
Affects Status Importance Assigned to Milestone
ALSA driver
Unknown
Unknown
alsa-driver (Ubuntu)
Undecided
Unassigned

Bug Description

No sound in headphones jack after suspend/resume.
But sound in headphones jack is OK after cold boot.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: alsa-base 1.0.25+dfsg-0ubuntu4
Uname: Linux 3.15.0-031500rc2-generic x86_64
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: mik 2139 F.... pulseaudio
 /dev/snd/controlC1: mik 2139 F.... pulseaudio
CurrentDesktop: Unity
Date: Mon Apr 28 23:20:59 2014
InstallationDate: Installed on 2014-04-26 (2 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
PackageArchitecture: all
SourcePackage: alsa-driver
Symptom: audio
Symptom_AlsaPlaybackTest: ALSA playback test through plughw:PCH failed
Symptom_Card: Вбудоване аудіо - HDA Intel PCH
Symptom_DevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: mik 2139 F.... pulseaudio
 /dev/snd/controlC1: mik 2139 F.... pulseaudio
Symptom_Jack: Green Headphone Out, Front
Symptom_Type: No sound at all
Title: [W230SS, VIA VT1802, Green Headphone Out, Front] No sound at all
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 02/11/2014
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 4.6.5
dmi.board.asset.tag: Tag 12345
dmi.board.name: W230SS
dmi.board.vendor: Notebook
dmi.board.version: Not Applicable
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 9
dmi.chassis.vendor: Notebook
dmi.chassis.version: N/A
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr4.6.5:bd02/11/2014:svnNotebook:pnW230SS:pvrNotApplicable:rvnNotebook:rnW230SS:rvrNotApplicable:cvnNotebook:ct9:cvrN/A:
dmi.product.name: W230SS
dmi.product.version: Not Applicable
dmi.sys.vendor: Notebook
mtime.conffile..etc.modprobe.d.alsa.base.conf: 2014-04-28T23:13:10.065027

Kiril (kiril-mik-os) wrote :
Raymond (superquad-vortex2) wrote :

driver should not use same audio output for device 0 and device 2

independent headphone should be disabled on notebook by default

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

Kiril (kiril-mik-os) wrote :

Hi Raymond, could you explain what I have to to? Independent headphone is disabled in alsamixer and I can't enable it.

Raymond (superquad-vortex2) wrote :

for desktop line out and headphone connected to different audio output nodes 0x03 and 0x04

this allow you to play different audio to line out and headphone

but this feature usually should be disabled for notebook

you need to file an upstream bug report to fix this bug in the indep_hp_possible function which should return false when there is no internal mic since some notebook have line out, headphone and Mic jack to support 5.1 or only enabled when headphone at extra front and line out at ext rear

the workaround is use hint to disable the indep_hp=0

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio.txt

    8.103549] sound hdaudioC1D0: autoconfig: line_outs=1 (0x24/0x0/0x0/0x0/0x0) type:speaker
[ 8.103552] sound hdaudioC1D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 8.103554] sound hdaudioC1D0: hp_outs=1 (0x25/0x0/0x0/0x0/0x0)
[ 8.103556] sound hdaudioC1D0: mono: mono_out=0x0
[ 8.103557] sound hdaudioC1D0: inputs:
[ 8.103559] sound hdaudioC1D0: Internal Mic=0x30
[ 8.103561] sound hdaudioC1D0: Mic=0x2b

Kiril (kiril-mik-os) wrote :

This device is a laptop. I tried workaround: I created a patch (tried both 1 and 0 value):
[codec]
0x11068446 0x15582300 0

[hint]
indep_hp = 0

It was succesfully loaded:

[ 11.334195] snd_hda_intel 0000:00:03.0: Applying patch firmware 'clevo'

But there are still no sound in headphones jack. When value is 0 there are also no sound in speakers.
I also dumped alsa-info for the state when audio is ok. See attached file.

Raymond (superquad-vortex2) wrote :

you have two hda controllers

seem hint apply to card 0

/sys/class/sound/hwC1D0/init_pin_configs:
0x24 0x901701f0
0x25 0x022140f0
0x28 0x422140f0
0x29 0x50a701f0
0x2a 0x418130f8
0x2b 0x01a190f0
0x2d 0x474410f0
0x30 0x90a601f0
0x33 0x501701f0

/sys/class/sound/hwC1D0/driver_pin_configs:

/sys/class/sound/hwC1D0/user_pin_configs:

/sys/class/sound/hwC1D0/init_verbs:

/sys/class/sound/hwC1D0/hints:

Raymond (superquad-vortex2) wrote :

your patch apply to card 0 instead of card 1

index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
 jackpoll_ms : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
 patch : clevo,(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
 position_fix : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
 power_save : 0
 power_save_controller : Y
 probe_mask : -1,-1,-1,-1,-1,-

Kiril (kiril-mik-os) wrote :

I played a bit more time with indep_hp, but looks like it does not fix the problem. Screenshots from alsamixer: http://imgur.com/goorPt5,pDmikVT
Tried the utility from your link but it crashes: http://pastebin.com/CCbLuQnf

Raymond (superquad-vortex2) wrote :

the independent headphone control and device 2 would not be created if you disable it by hint or revert this patch

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_via.c?id=139611705ad5ce7b35b8b7957c5ca406deb3ff9b

your screen capture indicate that your hint apply to wrong controller

Kiril (kiril-mik-os) wrote :

Finally got it works, thank you! To achive this I had to add a comma to kernel module parameters:

    options snd-hda-intel patch=,clevo

Big thanks to you.

Kiril (kiril-mik-os) wrote :

The patch file for my laptop.

Kiril (kiril-mik-os) wrote :

Raymond, there are another issue remaining: headphone jack stops working after sleep.
alsa-info-ok.txt is a dump in case everthing works fine
alsa-info-not-ok.txt is a dumo after sleep where speakers works fine and headphones jack does not produce any sound.

Kiril (kiril-mik-os) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in alsa-driver (Ubuntu):
status: New → Confirmed
unrud (unrud) wrote :

For me the sound always works after a cold start (maybe newer BIOS?)
But after standby the headphone jack stops working until next cold start (reboot doesn't help).

On W230ST everything works fine and the hardware is nearly identical.

Marco Chiappetta (mardurhack) wrote :

Hi Kiril,

I am also interested in this bug because I had the same problem also on Windows (and I'm thinking of installing Ubuntu as well). The same problem (no sound from headphones after waking up from sleep mode) is present in Windows 8/8.1 and the solution is simply to install the Hotkey control center from Clevo (it's in the drivers page, latest version is 6.0100 or 8.0100 respectively for Win7 and Win8).

After doing some research I identified the root of a possible solution in the file initHeadphones.exe (which, unfortunately, is not present in the latest version). You can find my story here: http://superuser.com/questions/784110/audio-from-headphones-is-muted-after-screen-is-locked-or-sleep-mode-windows-8-1

Hope you can make something out of it (I can't test at the moment since I can't tinker too much with the laptop).

unrud (unrud) wrote :

Hi Marco,

I downloaded the Hotkey app from Clevo and InitHeadphone.exe is still present. All it does is calling the function InitHeadphone from hp.dll.

If you don't like the Hotkey app, I guess you can also fix the problem (on windows!) by saving hp.dll, uninstalling the Hotkey app and then schedule an new task "On machine unlock" with a command like rundll32 "c:\path\to\hp.dll,InitHeadphone"

Kiril (kiril-mik-os) wrote :

Hi Urund,

You are correct, after more investigation I came to same conclusion. It is described at kernel.org: https://bugzilla.kernel.org/show_bug.cgi?id=75151
I have posted alsa logs there.
And about InitHeadphone: this is cool, solution for windows is found, and maybe someone could make research in hp.dll to prepare solution for linux...

unrud (unrud) wrote :

I've compared the schematics of w230st and w230ss from the service manuals and the codec is exactly the same, but the w230ss has an additional chip between the codec and the headphone jack. The manual says that it's an pre-amp but doesn't mention the exact model. The pre-amp is connected to the SMBus, I guess it needs initialization after standby.

The service manual also has photos of the motherboard, unfortunately they are low-res and it's not possible to identify the chip.

Raymond (superquad-vortex2) wrote :

the alternative way is add back node 0x3e and 0x3d by reverting this patch and fix codec->um_nodes

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=ef4da45828603df57e5e21b8aa21a66ce309f79b

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);

/* hardcode codec->num_nodes to 55 for vt1802 */

   if (codec->id = 0x11068446)
       codec->num_nodes =55;

 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;
}

unrud (unrud) wrote :

Hi Kiril,

maybe you can update the title / description of the bug report, that way anybody knows what's what without reading all the comments.

Kiril (kiril-mik-os) wrote :

Done.

description: updated
summary: - [W230SS, VIA VT1802, Green Headphone Out, Front] No sound after fresh
- boot
+ [W230SS, VIA VT1802, Green Headphone Out, Front] No sound after
+ suspend/resume
unrud (unrud) wrote :

I tried to investigate the preamplifier chip further but run into another bug.
I'm not able to access the SMBus. When I execute "modprobe i2c-i801", the following appears in the kernel log:

[...] ACPI Warning: SystemIO range 0x000000000000f040-0x000000000000f05f conflicts with OpRegion 0x000000000000f040-0x000000000000f04f (\_SB_.PCI0.SBUS.SMBI) (20140214/utaddress-258)
[...] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver

I tried mainline kernel 3.15.6 but the problem is still present. Only found this: http://askubuntu.com/questions/449102/ubuntu-12-04-loading-i801-i2c-driver

unrud (unrud) wrote :

The SMBus module is working now, I had to add acpi_enforce_resources=lax to the kernel boot parameters.

Got some information about the pre-amplifier here: https://biosmods.wordpress.com/w230ss-np7338/comment-page-4/#comments

I think we're stuck until we get more information about that chip.

Kiril (kiril-mik-os) wrote :

@Raymond
Checked this. reverted ef4da45828603df57e5e21b8aa21a66ce309f79b and changed read_widget_caps to:
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);
 if (codec->vendor_id == 0x11068446)
  codec->num_nodes = 55;
 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;
}

The issue remains. I used 3.15.6 sources.

Raymond (superquad-vortex2) wrote :

can you post the output of alsa-info.sh

did node 0x3d and node 0x3e appear in the codec info after the patch ?

Kiril (kiril-mik-os) wrote :

http://www.alsa-project.org/db/?f=8bf5e7e3e08ab40609f2508ce1875fabbe475ee5

No, I see only connection to 0x3e, but there are no nodes 0x3d, 0x3e

Raymond (superquad-vortex2) wrote :

 can you add snd_printk to print / find out whether it can read wcaps 0x200500 from node 0x3e after changing codec->num_nodes ?

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);

Kiril (kiril-mik-os) wrote :

 for (i = 0; i < codec->num_nodes; i++, nid++) {
  codec->wcaps[i] = snd_hda_param_read(codec, nid,
           AC_PAR_AUDIO_WIDGET_CAP);
  printk("MIK: nid = %d, wcaps = %d\n", nid, codec->wcaps[i]);
 }

Result:

[ 7.491195] MIK: nid = 62, wcaps = 2098432 (62 = 0x3e, 2098432 = 0x200500)

Full log: http://pastebin.com/LbghKFg5

Raymond (superquad-vortex2) wrote :

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

it is because nodes is read from codec again in print_codec_info()

need to fix this value

nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid);
 if (! nid || nodes < 0) {
  snd_iprintf(buffer, "Invalid AFG subtree\n");
  snd_hda_power_down(codec);
  return;
 }

 print_gpio(buffer, codec, codec->afg);
 if (codec->proc_widget_hook)
  codec->proc_widget_hook(buffer, codec, codec->afg);

 for (i = 0; i < nodes; i++, nid++) {
  unsigned int wid_caps =
   snd_hda_param_read(codec, nid,
        AC_PAR_AUDIO_WIDGET_CAP);

Raymond (superquad-vortex2) wrote :

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;

/* this mean we need to fix the return value param when codec is vt1802 and nid is functional group */

  return (int)(parm & 0x7fff);
 }

Kiril (kiril-mik-os) wrote :

Done:
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;
 if (codec->vendor_id == 0x11068446)
  return 55;
 return (int)(parm & 0x7fff);
}

Here is new alsa-info with 0x3e: http://www.alsa-project.org/db/?f=7c253b9d2d1dbec0d060a43e074fc9190150db3f

But after suspend/resume there are still no sound in headphone jack.

Raymond (superquad-vortex2) wrote :

ode 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

the two devices cannot share headphone audio output

when multistreaming playback,

alt analog device can play another audio stream for the headphone while analog device play audio stream on line out

did you disable independent headphone since it is a bug in hda_generic to allow independent headphone when HP nid was put in multiout.dac ?

HP should be put into multiout.hp

Raymond (superquad-vortex2) wrote :

http://www.intel.com/support/motherboards/desktop/sb/CS-034206.htm

 for desktop, those rear panel line out jacks output support multi channel playback and the front panel headphone can support multi streaming on some hda codec

Kiril (kiril-mik-os) wrote :

Disabled independent HP by commenting the line in patch_via.c:
//spec->gen.indep_hp = 1;

Headphones does not works after resume.
alsa-info before suspend: http://www.alsa-project.org/db/?f=c7f2d491818afda332e303228f893447e71f37e8
alsa-info after resume: http://www.alsa-project.org/db/?f=75c3f86d7a1a3c65b0851d402dfa4186b7f15bb0

Raymond (superquad-vortex2) wrote :
Download full text (3.9 KiB)

http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/vt1802-asus-u30s?id=HEAD

compare with this notebook, device 0 nid is using speaker 's audio output and device 2 is using headphone 's audio output

seem spec->gen.indep_hp = 1 is not enough to force the driver to use speaker audio output by device 0

=> 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

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

you need to change

static bool indep_hp_possible(struct hda_codec *codec)
{
 struct hda_gen_spec *spec = codec->spec;
 struct auto_pin_cfg *cfg = &spec->autocfg;
 struct nid_path *path;
 int i, idx;

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

 if (cfg->line_out_type == AUTO_PIN_HP_OUT)
  idx = spec->out_paths[0];

http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/tree/codecs/vt1802-asus-g75?id=HEAD

but it is strange that there are two volume controls in same node when it has headphone, speaker and subwoofer

Node 0x08 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Front Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  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
  Amp-Out caps: ofs=0x2a, nsteps=0x2a, stepsize=0x05, mute=0
  Amp-Out vals: [0x22 0x22]
  Converter: stream=8, 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="Surround Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x2a, nsteps=0x2a, stepsize=0x05, mute=0
  Amp-Out vals: [0x1d 0x1d]
  Converter: stream=8, channel=2
  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

in your case , it is strange that balanced is set in eapd

EAPD 0x3: BALANCED EAPD

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 m...

Read more...

Raymond (superquad-vortex2) wrote :

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_via.c?id=11890956e948e6ed1b3e4acc11b6879db6ace01b

there is a bug in set_widgets_power_state_vt2002P

node 0x26 does not support Jack detect

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

  /* 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);

Marco Chiappetta (mardurhack) wrote :

Thanks a ton for your efforts guys. I really hope you can figure out what is wrong (wish I could actively help but I can only test). In the meanwhile I've been playing around with a tool that remaps the various jacks (e.g. mic can become line-out). You can find it here: https://launchpad.net/~diwic/+archive/ubuntu/hda, it is now part of the package alsa-tools-gui. I wasn't able to get the mic jack to work as line-out/headphones but I managed to "crash" the speakers by trying to override them. I don't know anything about codecs nor circuits but maybe you can find a workaround using this tool?

Again, thanks for your help.

Raymond (superquad-vortex2) wrote :

NO, not all HDA codec allow you to change Mic Jack into the headphone jack, usually the notebook have utilialized the volume controls of the 4 or 6 channels codec and don't have any spare dac or amp for the extra headphone

http://voices.canonical.com/david.henningsson/2011/11/29/turn-your-mic-jack-into-a-headphone-jack/

Marco Chiappetta (mardurhack) wrote :

Oh ok, then it has just been a (failed) desperate attempt. :) Thanks for the explanation.

uzi3k (uzi3k) wrote :

Has anyone found a workaround for this?

slibuntu (stuohy1) wrote :

No updates? Is there any way I can help diagnose this issue?

unrud (unrud) wrote :

I wrote a driver.
Only tested on Ubuntu 14.10.
After installation a restart is required.

Kiril (kiril-mik-os) wrote :

Interesting thing. Tested on 14.04.02 (added "print(i2c_bus_name)" line for debug):

$ uname -a
Linux mik-laptop-origin 3.16.0-31-generic #43~14.04.1-Ubuntu SMP Tue Mar 10 20:13:38 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ sudo init-headphone
[sudo] password for mik:
i915 gmbus ssc
i915 gmbus vga
i915 gmbus panel
i915 gmbus dpc
i915 gmbus dpb
i915 gmbus dpd
DPDDC-A
DPDDC-C
Can't find i2c bus. Make sure that all required modules are loaded.

Faulty Lee (faulty-lee) wrote :

@unrud, thanks for the work. I've extracted the files and just testing out init-headphone on my Arch Linux (Linux 3.19.2-1-ARCH #1 SMP PREEMPT Wed Mar 18 16:21:02 CET 2015 x86_64 GNU/Linux
)

I get the same issue as @Kiril
i915 gmbus ssc
i915 gmbus vga
i915 gmbus panel
i915 gmbus dpc
i915 gmbus dpb
i915 gmbus dpd
DPDDC-A
DPDDC-C
nouveau-0000:01:00.0-0
nouveau-0000:01:00.0-1
nouveau-0000:01:00.0-2
nouveau-0000:01:00.0-5
nouveau-0000:01:00.0-6
nouveau-0000:01:00.0-7
nouveau-0000:01:00.0-8
nouveau-0000:01:00.0-9
nouveau-0000:01:00.0-26
nouveau-0000:01:00.0-27
nouveau-0000:01:00.0-28
nouveau-0000:01:00.0-29
Can't find i2c bus. Make sure that all required modules are loaded.

Though I've not tried "acpi_enforce_resources=lax" as Arch Wiki actually said it's dangerous. I'll try it out when I'm free later tonight

unrud (unrud) wrote :

@Kiril:
Make sure that your kernel is loaded with acpi_enforce_resources=lax. Check "cat /proc/cmdline".
Check the output of "lsmod" and make sure that the modules i2c-i801 and i2c-dev are loaded.
If they are unload i2c-i801 with "sudo rmmod i2c-i801" and load it again "sudo modprobe i2c-i801". Then check "dmesg" for errors.

@Faulty Lee:
You need "acpi_enforce_resources=lax" or the i2c-i801 module will not work.

Kiril (kiril-mik-os) wrote :

Oops, missed kernel parameter. The deb package didn't adds it on 14.04. After adding it by hands it works! Wow, cool.
One more thing: I think this script should run also at boot.

unrud (unrud) wrote :

@Kiril:
That's strange, I tested it on 14.04 and it works for me.
The packaged adds the file /etc/default/grub.d/init-headphone.cfg. That should add the boot parameter.

Kiril (kiril-mik-os) wrote :

After cmall research I figgured out what was wrong: my grub was install from another linux system and regenerating ubuntu's config does nothing. After running grub-install it finally works. Big thanks to you!

unrud (unrud) wrote :

New version:
  * Add Upstart script to run program on boot
  * Make program more verbose

The program output is now very verbose. If the script doesn't work, just run "sudo init-headphone" and it should say what's wrong.

Kiril (kiril-mik-os) wrote :

Nice. Thank you!

Maharifu (mail-lmcarvalho) wrote :

Almost 1 year after buying my laptop I can finally suspend and still have sound!! Thank you. :D

BTW, I'm running the script manually, on Arch Linux.

Can Kavaklıoğlu (eposta) wrote :

Thanks for great work. I would like to report another system this fix is working on.

Debian on Monster Huma H3

Apparently Multicom Xishan W230S is sold in Turkey under Monster Huma H3. You need to change the first line of the script to

SUPPORTED_SYSTEM_PRODUCT_NAMES = ["W230SS", "HUMA H3"]

unrud (unrud) wrote :

New version of init-headphone that also supports Vivid:

https://github.com/Unrud/init-headphone-ubuntu/releases

uzi3k (uzi3k) wrote :

This still seems to be an issue on 16.04

Ugnius (rykien) wrote :
Download full text (3.7 KiB)

Also having the issue on a fresh 16.04.1. init-headphone 0.11 gets EBUSY on the first write to SMBus (modified to print out errno, diff below). Used to work on 15.04-15.10 on the same laptop.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

$ sudo init-headphone-errno
INFO:root:Version: 0.11
INFO:root:Trying to add module to the kernel: i2c_dev
INFO:root:Trying to add module to the kernel: i2c_i801
DEBUG:root:Available i2c busses: ['i915 gmbus ssc', 'i915 gmbus vga', 'i915 gmbus panel', 'i915 gmbus dpc', 'i915 gmbus dpb', 'i915 gmbus dpd', 'DPDDC-A', 'SMBus I801 adapter at f040']
DEBUG:root:Supported i2c bus names: ['SMBus I801 adapter']
DEBUG:root:Selected i2c bus: SMBus I801 adapter at f040
INFO:SMBus:Opening I2C bus: /dev/i2c-7
INFO:SMBus:Setting I2C slave address: 115
INFO:SMBus:Writing byte data on I2C bus: (device_cmd: 0xa, value: 0x41)
ERROR:SMBus:Can't transfer data on I2C bus [EBUSY]
INFO:SMBus:Closing I2C bus
ERROR:root:Operation failed
DEBUG:root:Exception occurred:
Traceback (most recent call last):
  File "/usr/sbin/init-headphone-errno", line 329, in <module>
    main()
  File "/usr/sbin/init-headphone-errno", line 315, in main
    init()
  File "/usr/sbin/init-headphone-errno", line 247, in init
    set_effect(DEFAULT_EFFECT)
  File "/usr/sbin/init-headphone-errno", line 263, in set_effect
    DATA_ENABLE_OUTPUT)
  File "/usr/sbin/init-headphone-errno", line 241, in write_data_to_device
    write_prolog(i2c_bus)
  File "/usr/sbin/init-headphone-errno", line 232, in write_prolog
    i2c_bus.write_byte_data(0x0a, 0x41)
  File "/usr/sbin/init-headphone-errno", line 149, in write_byte_data
    self.__access(I2C_SMBUS_WRITE, device_cmd, I2C_SMBUS_BYTE_DATA, data)
  File "/usr/sbin/init-headphone-errno", line 141, in __access
    raise RuntimeError("Can't transfer data on I2C bus [{}]".format(e))
RuntimeError: Can't transfer data on I2C bus [EBUSY]

$ sudo i2cdetect 7
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-7.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

$ diff -u /usr/sbin/init-headphone /usr/sbin/init-headphone-errno
--- /usr/sbin/init-headphone 2016-05-08 10:27:04.000000000 +0300
+++ /usr/sbin/init-headphone-errno 2016-10-21 16:58:45.292881695 +0300
@@ -82,6 +82,12 @@
                 ("size", ctypes.c_uint),
                 ("data", ctypes.POINTER(i2c_smbus_data))]

+_errno = ctypes.cdll.LoadLibrary("libc.so.6").__errno_location
+_errno.restype = ctypes.POINTER(ctypes.c_int)
+
+def get_errno():
+ import errno
+ return errno.errorcode[_errno()[0]]

 class SMBus(object):
     def __init__(self, path):
@@ -129,9 +13...

Read more...

unrud (unrud) wrote :

@rykien:
Seems like a bug in the driver for the SMBus controller. i2cdetect should show the headphone amplifier at address 0x73.
I've tested init-headphone with Ubuntu 16.04.1 (you have to add the acpi_enforce_resources=lax boot parameter!) and 16.10 live images without problems. Maybe the bug was introduced in an update.

Ugnius (rykien) wrote :

@unrud:
Thanks for the tests. Also tested on 16.04.1 live - interestingly, the devices seem to be on /dev/i2c-9 there.

However, I think even SMBus isn't at fault. Digging through the logs I noticed I forgot to check the dmesg logs - seems like sometimes the BIOS touches the amp for some reason:

[ 6.980350] i801_smbus 0000:00:1f.3: BIOS is accessing SMBus registers
[ 6.980358] i801_smbus 0000:00:1f.3: Driver SMBus register access inhibited

The issue is rather random (sometimes stays even after a restart, sometimes doesn't appear after sleep), but it appears that when BIOS stays away, init-headphone works.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.