System76 galu1: Inverted Internal microphone (phase inversion)

Bug #1227148 reported by Jason Gerard DeRose
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
alsa-driver (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

As per this meta-bug:
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1002978

The System76 Galago UltraPro (galu1) has inverted stereo mics. We didn't catch this in our testing as (interestingly) there is no cancellation effect when the mic is set at the default gain level of "Unamplified", and apparently no one happened to turn the gain up during testing =)

Another interesting thing is that there is likewise no cancellation effect up to maybe 15% gain (by slider position in UI). Up to this max working gain level, the audio sounds perfect. But if I increase the gain just one tick more (right arrow while gain slider is focused), there is then complete cancellation... all you get are weird popping sounds now and then.

However, if I put the gain at 100% and then turn off either the right or left channel in alsamixer, the audio sounds fine, which suggests typical phase inversion. But the fact that it works at lower volume levels doesn't really make sense, so I expect there is some other quirkiness that might need to be addressed also.

I'll do more digging.

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: alsa-base 1.0.25+dfsg-0ubuntu4
ProcVersionSignature: Ubuntu 3.8.0-30.44-generic 3.8.13.6
Uname: Linux 3.8.0-30-generic x86_64
ApportVersion: 2.9.2-0ubuntu8.3
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: jderose 1542 F.... pulseaudio
 /dev/snd/pcmC1D0c: jderose 1542 F...m pulseaudio
 /dev/snd/controlC0: jderose 1542 F.... pulseaudio
Date: Wed Sep 18 07:32:08 2013
InstallationDate: Installed on 2013-09-18 (0 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: alsa-driver
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 07/09/2013
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 4.6.5
dmi.board.asset.tag: Tag 12345
dmi.board.name: Galago UltraPro
dmi.board.vendor: System76, Inc.
dmi.board.version: galu1
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 9
dmi.chassis.vendor: System76, Inc,
dmi.chassis.version: galu1
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr4.6.5:bd07/09/2013:svnSystem76,Inc.:pnGalagoUltraPro:pvrgalu1:rvnSystem76,Inc.:rnGalagoUltraPro:rvrgalu1:cvnSystem76,Inc,:ct9:cvrgalu1:
dmi.product.name: Galago UltraPro
dmi.product.version: galu1
dmi.sys.vendor: System76, Inc.

Revision history for this message
Jason Gerard DeRose (jderose) wrote :
Revision history for this message
Jason Gerard DeRose (jderose) wrote :
Revision history for this message
Jason Gerard DeRose (jderose) wrote :
Revision history for this message
Raymond (superquad-vortex2) wrote :

It is strange that Mic boost control is at node 0x2b since wcaps does not support Amp-in

however dB range of capture volume control is -16.5 to 30 dB

Node 0x10 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Control: name="Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Device: name="VT1802 Analog", type="Audio", device=0
  Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals: [0x1e 0x1e]
  Converter: stream=4, channel=0
  SDI-Select: 0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x1e

Node 0x2b [Pin Complex] wcaps 0x400481: Stereo
  Control: name="Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Mic Jack", index=0, device=0
  Pincap 0x00002324: IN Detect
    Vref caps: HIZ 50 100
  Pin Default 0x01a190f0: [Jack] Mic at Ext Rear
    Conn = 1/8, Color = Pink
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x21: IN VREF_50
  Unsolicited: tag=02, enabled=1
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x30 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Control: name="Internal Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Internal Mic Phantom Jack", index=0, device=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals: [0x00 0x03]
  Pincap 0x00000020: IN
  Pin Default 0x90a601f0: [Fixed] Mic at Int N/A
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Revision history for this message
Raymond (superquad-vortex2) wrote :

do you mean that you want to limit the dBmax to 0 instead of 30 ?

Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
   Amp-In vals: [0x1e 0x1e]

Revision history for this message
David Henningsson (diwic) wrote :

Very interesting. However, I think you should first try doing a stereo recording (e g with audacity) to verify that this is actually the case. If there is phase inversion, you should be able to see large values at the highest gain, and you should be able to listen to one channel at a time and verify.

But it does not really sound like phase inversion to me. I'm curious about the dmic component that you're using, to the extent that you can and want to be open about it. This might be a long shot, but...maybe it just can't handle the high boost correctly (i e some type of power/current problem?), and we need to limit the boost in the kernel to compensate?

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Gotcha... guess I jumped the gun on the "phase inversion" :P

I attached a screen shot that shows the strange waveform I get in Audacity when at 100% gain.

I'm waiting to hear back from our ODM on the exact dmics used, and hopefully I'll get some other useful info as well.

This is new territory for me, so forgive me if this is a goofy question, but how are these dmic dependent gain parameters typically provided? Is this something that should be provided in, say, the ACPI tables, or is this typically hard-coded in the drivers? How is this handled in the Windows world?

Revision history for this message
Raymond (superquad-vortex2) wrote :

seem strange to have "PCM Loopback Playback Volume" and "Mic Playback Volume" at same index but 0x2a, 0x2b and 0x29 are input pin complexes

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

Node 0x14 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals: [0x00 0x00] [0x80 0x80]
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 2
     0x34 0x21
Node 0x15 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals: [0x00 0x00] [0x80 0x80]
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 2
     0x35 0x21

Node 0x34 [Audio Selector] wcaps 0x300501: Stereo
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 2
     0x08* 0x09
Node 0x35 [Audio Selector] wcaps 0x300501: Stereo
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 2
     0x08 0x09*

Node 0x08 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Speaker 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: [0x21 0x21]
  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="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: [0x21 0x21]
  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

Revision history for this message
Raymond (superquad-vortex2) wrote :

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: [0x00 0x00]
  Pincap 0x00010050: OUT EAPD Balanced
  EAPD 0x3: BALANCED EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x14* 0x3e

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

if there is "Mic playback volume" control , this mean that there must be a path from mic pin to the output pin

Revision history for this message
Raymond (superquad-vortex2) wrote :
Download full text (6.6 KiB)

The name should be "Internal Mic Boost Capture Volume" instead of "Internal Mic Boost Volume" since node 0x30 is only connected to [Audio Input] and there is no audio path from node 0x30 to output pins

capabilities should be cvolume instead of volume

Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume penum
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 3 [100%] [36.00dB]

Node 0x30 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Control: name="Internal Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Internal Mic Phantom Jack", index=0, device=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals: [0x00 0x03]
  Pincap 0x00000020: IN
  Pin Default 0x90a601f0: [Fixed] Mic at Int N/A
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x1e [Audio Selector] wcaps 0x300501: Stereo
  Control: name="Input Source", index=0, device=0
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 5
     0x2b 0x2a 0x29 0x21 0x30*

Node 0x10 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Control: name="Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Device: name="VT1802 Analog", type="Audio", device=0
  Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals: [0x1e 0x1e]
  Converter: stream=4, channel=0
  SDI-Select: 0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x1e
Node 0x1f [Audio Selector] wcaps 0x300501: Stereo
  Control: name="Input Source", index=1, device=0
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 5
     0x2b 0x2a 0x29 0x21 0x30*
Node 0x20 [Vendor Defined Widget] wcaps 0xf00000: Mono
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="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
Node 0x22 [Beep Generator Widget] wcaps 0x70040c: Mono Amp-Out
  Amp-Out caps: ofs=0x0a, nsteps=0x12, stepsize=0x05, mute=1
  Amp-Out vals: [0x00]
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
Node 0x23 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x24 [Pin Complex] wcaps 0x40050d: Stereo Amp-Out
  Control: name="Speaker Pla...

Read more...

Revision history for this message
David Henningsson (diwic) wrote :

> This is new territory for me, so forgive me if this is a goofy question, but how are these dmic dependent gain parameters
> typically provided? Is this something that should be provided in, say, the ACPI tables, or is this typically hard-coded in the drivers?
> How is this handled in the Windows world?

Given my limited knowledge, so take this with a grain of salt: I'd say that the most common is that BIOS sets this up somehow, if there's something that needs to be configured, because this makes WHQL Testing easier. But it is not uncommon for the windows 3rd party drivers (provided by Via, Realtek, Conexant etc) to mess around with these things as well.

Revision history for this message
Raymond (superquad-vortex2) wrote :

how did you perform the recording test ? ( through pulseaudio or using hw:0 )

you have to provide pulseaudio verbose log if you perform record through pulseaudio

you have to provide output of alsa-info.sh or amixer instead of screen shot as your screen shot does not provide dB value of the internal mic (just percentage)

does pulseaudio assume same dB range for all input path ?

Revision history for this message
Raymond (superquad-vortex2) wrote :

to verify that there node 0x3e is a hidden widget

use hda-verb to get the widget cap and check the return value to find out node 0x3e is [audio mixer]/[audio selector] or not exist

send: NID=0x3e, VERB=0xf00(get_parameters), PARM=0x9(audio_wid_cap)

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Raymond, thanks for all your detailed help! I'm totally new to ALSA debugging, so it's taken me a bit to digest what you've already posted, but here is the output from hda-verb:

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

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

Revision history for this message
Raymond (superquad-vortex2) wrote :

7.3.4.6 Audio Widget Capabilities The Audio Capabilities control returns a set of bit fields describing the audio capabilities of the widget.

Parameter ID: 09h
Response Format:

23:20 Type
10 Power Cntrl
8 Conn List
0 Channel count

Figure 86. Audio Widget Capabilities Response Format

Table 138. Widget Type

2h Audio Mixer

nid = 0x3e, verb = 0xf00, param = 0x9
 value = 0x200500

http://mailman.alsa-project.org/pipermail/alsa-devel/2012-November/056634.html

The 0x3e is a stereo to mono mixer, connecting to 0x1c.

seem the widget 0x3e is audio mixer Wridget with power control and connection list

try to find out the connection list of node 0x3e

and widget cap of node 0x3d

7.3.4.11 Connection List Length Returns the length of the connection list for the widget.
 Parameter ID: 0Eh
Response Format:

31:8 7 6:0
Reserved Long Form Connection List Length

 Figure 92. Connection List Length Response Format

Long Form indicates whether the items in the connection list are long form or short form as described in Section 7.1.2.
 Connection List Length is an integer indicating the number of items in the connection list. If Connection List Length is 1, there is only one hard-wired input possible, which is read from the Connection List, and there is no Connection Select Control (see Section 7.3.3.2

Revision history for this message
Raymond (superquad-vortex2) wrote :

send: NID=0x3e, VERB=0xf00(get_parameters), PARM=0xe(connect_len)

send: NID=0x3e, VERB=0xf02(get_connect_list), PARM=0x0

Revision history for this message
Raymond (superquad-vortex2) wrote :

is this widget similar to

http://git.kernel.org/cgit/linux/kernel/git/tiwai/hda-emu.git/plain/codecs/vt1812-clevo-b5130m?id=HEAD

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

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in alsa-driver (Ubuntu):
status: New → Confirmed
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

This release of Ubuntu is no longer receiving maintenance updates. If this is still an issue on a maintained version of Ubuntu please let us know.

Changed in alsa-driver (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for alsa-driver (Ubuntu) because there has been no activity for 60 days.]

Changed in alsa-driver (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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