Bug 73336

Summary: Clipping of line-in volume on Analog Devices codes due to an incorrect max_dB determination
Product: PulseAudio Reporter: mrj
Component: alsaAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugzilla.kernel.org/show_bug.cgi?id=68211
https://bugzilla.redhat.com/show_bug.cgi?id=1047204
Whiteboard:
i915 platform: i915 features:
Attachments: Output of alsa-info under Kernel 3.12.5
Output of "pactl list" on Kernel 3.12.5

Description mrj 2014-01-06 22:53:43 UTC
On a machine with HDA Intel Audio and an AD1988 codec (ASUS P5B board), running
Kernel 3.12.5 causes the line-in hardware volume to span its full 0-54 range over a Pulseaudio volume range of 0-20724, instead of being mapped to the full 0-65536 Pulseaudio volume range, as is the case when running Kernels 3.11.9 and earlier. This causes previously suitable line-in mixer volumes to clip severely.

The cause is a different max_dB determination under the two Kernel versions:

3.11.9:

[pulseaudio][modules/alsa/alsa-mixer.c:2789 pa_alsa_path_dump()] Path analog-input-linein (Line In), direction=2, priority=81, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=54, min_dB=-58.5, max_dB=22.5


3.12.5:

[pulseaudio][modules/alsa/alsa-mixer.c:2789 pa_alsa_path_dump()] Path analog-input-linein (Line In), direction=2, priority=81, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=54, min_dB=-58.5, max_dB=52.5

The 30dB difference in max_dB appears to be related to the "Line Boost Volume" control (0, 10dB, 20dB, 30dB) that's newly-exposed in Kernel 3.12 for Analog Devices codecs, which PA appears to not be taking account of.


Also unexpected on both Kernel versions: max_volume is reported as "3" for all microphone inputs on both Kernels, possibly reflecting the 3 boost settings rather than the correct 54 levels as reported for the line input. The mic max_dB calculations are however correct:

[pulseaudio][modules/alsa/alsa-mixer.c:2789 pa_alsa_path_dump()] Path analog-input-microphone-rear (Rear Microphone), direction=2, priority=82, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=3, min_dB=-58.5, max_dB=52.5
Comment 1 Raymond 2014-01-07 00:16:29 UTC
you have to post output of alsa-info.sh
Comment 2 mrj 2014-01-07 00:39:56 UTC
Created attachment 91572 [details]
Output of alsa-info under Kernel 3.12.5
Comment 3 Raymond 2014-01-07 01:37:56 UTC
which bios version do your P5B using ?

since my P5B does not have two Line in 

autoconfig: line_outs=4 (0x12/0x16/0x24/0x25/0x0) type:line
   speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
   hp_outs=1 (0x11/0x0/0x0/0x0/0x0)
   mono: mono_out=0x0
   dig-out=0x1b/0x0
   inputs:
     Front Mic=0x14
     Rear Mic=0x17
     Line=0x15
     Line=0x1a
     CD=0x18




this node is not line in 


Node 0x1a [Pin Complex] wcaps 0x400000: Mono
  Control: name="Line Phantom Jack", index=0, device=0
  Pincap 0x00000020: IN
  Pin Default 0x918711f0: [Fixed] Line In at Int Rear
    Conn = Analog, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
Comment 4 Raymond 2014-01-07 01:55:39 UTC
Node 0x11 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Front Headphone Phantom Jack", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense
    Vref caps: HIZ 50 GRD 80 100
  Pin Default 0x02214130: [Jack] HP Out at Ext Front
    Conn = 1/8, Color = Green
    DefAssociation = 0x3, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0xc0: OUT HP VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Connection: 1
     0x22

do your computer chassis have HDA Front audio panel which support jack detection ?


did you select the correct Front Audio Panel in BIOS Setup ?
Comment 5 Raymond 2014-01-07 01:59:05 UTC
post output of pactl list

do it show two line in ports ?

how do pulseaudio handle the volume range when line in and mic have different dB ranges ?
Comment 6 mrj 2014-01-08 12:13:20 UTC
Thank you for your interest.

In answer to your questions:

1. I'm on P5B BIOS 2001, which is two older than the latest 2104, which I tried using but had trouble booting, so reverted. The release comments between these don't mention the fixing of any audio issue.

2. I'm not sure what front audio my case supports. I don't make use of the front ports. It was set to AC97 in the BIOS. I've now changed it to "HD Audio", but there doesn't seem to be any differences. The "Phantom" inputs are still there.

3. Output of "pactl list" is attached. There's only one line-in for the on-board audio. The third source is the line-in of my TV card.

4. The mapping between the PA volume and the ALSA Capture volume is different for the line and mic inputs. Below is a table showing these mappings. The left column is generated after running

pacmd 'set-source-port alsa_input.pci-0000_00_1b.0.analog-stereo analog-input-linein'

while the right is generated after

pacmd 'set-source-port alsa_input.pci-0000_00_1b.0.analog-stereo analog-input-microphone-rear'

Note that while the line input saturates, the mic doesn't, but has a weird hump in the middle.

This is on Kernel 3.12.5. I haven't tried 3.11.9.

  LINE             MIC
    0, 0            0, 0
 1000, 0         1000, 0
 2000, 1         2000, 1
 3000,13         3000,13
 4000,25         4000,20
 5000,25         5000,25
 6000,29         6000,29
 7000,32         7000,32
 8000,37         8000,35
 9000,39         9000,37
10000,41        10000,39
11000,41        11000,41
12000,42        12000,42
13000,44        13000,37
14000,45        14000,39
15000,47        15000,40
16000,48        16000,41
17000,49        17000,42
18000,51        18000,36
19000,52        19000,39
20000,52        20000,39
21000,53        21000,40
22000,54        22000,41
23000,54        23000,41
24000,54        24000,42
25000,54        25000,36
26000,54        26000,36
27000,54        27000,38
28000,54        28000,38
29000,54        29000,39
30000,54        30000,39
31000,54        31000,40
32000,54        32000,40
33000,54        33000,41
34000,54        34000,42
35000,54        35000,42
36000,54        36000,43
37000,54        37000,43
38000,54        38000,44
39000,54        39000,44
40000,54        40000,44
41000,54        41000,45
42000,54        42000,45
43000,54        43000,46
44000,54        44000,46
45000,54        45000,47
46000,54        46000,47
47000,54        47000,47
48000,54        48000,48
49000,54        49000,48
50000,54        50000,48
51000,54        51000,49
52000,54        52000,49
53000,54        53000,49
54000,54        54000,50
55000,54        55000,50
56000,54        56000,50
57000,54        57000,51
58000,54        58000,51
59000,54        59000,51
60000,54        60000,52
61000,54        61000,52
62000,54        62000,52
63000,54        63000,53
64000,54        64000,53
65000,54        65000,53
66000,54        66000,53
Comment 7 mrj 2014-01-08 12:17:04 UTC
Created attachment 91662 [details]
Output of "pactl list" on Kernel 3.12.5
Comment 8 mrj 2014-01-08 12:54:27 UTC
Here's the same PA volume to ALSA volume mapping under 3.11.9. Line and mic are identically monotonic.

   LINE            MIC
    0, 0            0, 0
 1000, 0         1000, 0
 2000, 0         2000, 0
 3000, 0         3000, 0
 4000, 5         4000, 5
 5000, 9         5000, 9
 6000,12         6000,12 
 7000,15         7000,15 
 8000,17         8000,17 
 9000,19         9000,19 
10000,21        10000,21 
11000,23        11000,23 
12000,24        12000,24 
13000,25        13000,25 
14000,27        14000,27 
15000,28        15000,28 
16000,29        16000,29 
17000,30        17000,30 
18000,31        18000,31 
19000,32        19000,32 
20000,33        20000,33 
21000,34        21000,34 
22000,35        22000,35 
23000,35        23000,35 
24000,36        24000,36 
25000,37        25000,37 
26000,37        26000,37 
27000,38        27000,38 
28000,39        28000,39 
29000,39        29000,39 
30000,40        30000,40 
31000,40        31000,40 
32000,41        32000,41 
33000,42        33000,42 
34000,42        34000,42 
35000,43        35000,43 
36000,43        36000,43 
37000,44        37000,44 
38000,44        38000,44 
39000,44        39000,44 
40000,45        40000,45 
41000,45        41000,45 
42000,46        42000,46 
43000,46        43000,46 
44000,47        44000,47 
45000,47        45000,47 
46000,47        46000,47 
47000,48        47000,48 
48000,48        48000,48 
49000,48        49000,48 
50000,49        50000,49 
51000,49        51000,49 
52000,49        52000,49 
53000,50        53000,50 
54000,50        54000,50 
55000,50        55000,50 
56000,51        56000,51 
57000,51        57000,51 
58000,51        58000,51 
59000,52        59000,52 
60000,52        60000,52 
61000,52        61000,52 
62000,53        62000,53 
63000,53        63000,53 
64000,53        64000,53 
65000,53        65000,53 
66000,54        66000,54 

Note that the 3.12.5 mapping in Comment 6 is slightly wrong because I didn't know PA commands were asynchronous, and that a delay was needed before the hardware volume was read. (The hint was that the top volume of 54 wasn't used.) The correct table is:

  LINE             MIC
    0, 0            0, 0
 1000, 1         1000, 1
 2000,13         2000,13
 3000,20         3000,20
 4000,25         4000,25
 5000,29         5000,29
 6000,32         6000,32
 7000,35         7000,35
 8000,37         8000,37
 9000,39         9000,39
10000,41        10000,41
11000,42        11000,42
12000,44        12000,37
13000,45        13000,39
14000,47        14000,40
15000,48        15000,41
16000,49        16000,42
17000,50        17000,36
18000,51        18000,37
19000,52        19000,39
20000,53        20000,40
21000,54        21000,40
22000,54        22000,41
23000,54        23000,42
24000,54        24000,36
25000,54        25000,36
26000,54        26000,37
27000,54        27000,38
28000,54        28000,39
29000,54        29000,39
30000,54        30000,40
31000,54        31000,40
32000,54        32000,41
33000,54        33000,42
34000,54        34000,42
35000,54        35000,43
36000,54        36000,43
37000,54        37000,44
38000,54        38000,44
39000,54        39000,44
40000,54        40000,45
41000,54        41000,45
42000,54        42000,46
43000,54        43000,46
44000,54        44000,47
45000,54        45000,47
46000,54        46000,47
47000,54        47000,48
48000,54        48000,48
49000,54        49000,48
50000,54        50000,49
51000,54        51000,49
52000,54        52000,49
53000,54        53000,50
54000,54        54000,50
55000,54        55000,50
56000,54        56000,51
57000,54        57000,51
58000,54        58000,51
59000,54        59000,52
60000,54        60000,52
61000,54        61000,52
62000,54        62000,53
63000,54        63000,53
64000,54        64000,53
65000,54        65000,53
66000,54        66000,54
Comment 9 GitLab Migration User 2018-07-30 10:09:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/240.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.