Bug 42353 - Mistreats headphone port with dysfunctional ALSA Master volume on ICH7
Summary: Mistreats headphone port with dysfunctional ALSA Master volume on ICH7
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Maarten Bosmans
QA Contact: pulseaudio-bugs
URL:
Whiteboard: triaged
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-28 13:46 UTC by Tobias Wolf
Modified: 2018-07-30 10:23 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
ALSA info gzipped (3.99 KB, application/x-gzip)
2011-10-28 13:46 UTC, Tobias Wolf
Details
pulseadui -vvvvvv gzipped (16.58 KB, application/x-gzip)
2011-10-28 13:47 UTC, Tobias Wolf
Details
pacmd ls (29.92 KB, text/plain)
2012-03-13 18:16 UTC, Tobias Wolf
Details
Plain version of alsa-info for better readability. (19.97 KB, text/plain)
2012-03-13 19:01 UTC, Colin Guthrie
Details
attachment-25654-0.html (2.52 KB, text/html)
2015-09-11 07:51 UTC, Tobias Wolf
Details
ad1981b - add jack detect kctl (2.49 KB, text/plain)
2015-09-14 09:16 UTC, Raymond
Details
patch for ac97 codec with HP, Line Out and Speaker (1.24 KB, patch)
2015-09-15 02:37 UTC, Raymond
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Wolf 2011-10-28 13:46:29 UTC
Created attachment 52868 [details]
ALSA info gzipped

I basically have a generic Dell box with integrated ICH7 audio

 0 [ICH7           ]: ICH4 - Intel ICH7
                      Intel ICH7 with AD1981B at irq 23


When I plug my headphones into the front, in alsamixer only the Headphone slider has an effect, Master does nothing to change volume.

Now Pulseaudio somehow merges these (even if flatvol is off) and the whole range of Headphone is compressed into the low range and it gets painful very quickly.

No idea if this is ALSA bug or not. Please advise and forward accordingly.

ALSA info and pulseaudio verbose output attached
Comment 1 Tobias Wolf 2011-10-28 13:47:08 UTC
Created attachment 52869 [details]
pulseadui -vvvvvv gzipped
Comment 2 Tobias Wolf 2012-01-24 12:04:14 UTC
Have you had time to look at this yet, Maarten?

You've told me to poke you.
Comment 3 Colin Guthrie 2012-03-13 17:57:51 UTC
I think this is expected behaviour...

Can you attach output of "pacmd ls"?

Normally I'd expect a "Headphones" port to be available for your Sink. With the jack detection capabilities added in PA 2.0, this port will hopefully now be activated automatically when a jack is plugged in. In older versions you have to enable the port manually in pavucontrol or another mixer when you plug in a jack.
Comment 4 Tobias Wolf 2012-03-13 18:16:43 UTC
Created attachment 58411 [details]
pacmd ls

Attached »pacmd ls«. (Note I have an Apple Monitor with USB audio too)

It’s not expected behaviour that when I use my volume buttons that only the two lowest ticks give me a range between threshold-of-hearing and thresold-of-pain, is it?

 |0---xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|

0 nothing, x == pain

I don’t have a headphone port. It’s not there. And on IRC mkbosman told me he had the same problem and to open this bug.
Comment 5 Colin Guthrie 2012-03-13 19:01:19 UTC
Created attachment 58415 [details]
Plain version of alsa-info for better readability.
Comment 6 Colin Guthrie 2012-03-13 19:10:31 UTC
You appear to have two Headphone related ports available along with a couple others:
 * Headphones / Amplifier
 * Headphones / No Amplifier


ports:
	analog-output-headphones;output-amplifier-on: Headphones / Amplifier (priority 9010, available: unknown)
				
	analog-output-headphones;output-amplifier-off: Headphones / No Amplifier (priority 9000, available: unknown)
				
	analog-output-lfe-on-mono;output-amplifier-on: LFE on Separate Mono Output / Amplifier (priority 4010, available: unknown)
				
	analog-output-lfe-on-mono;output-amplifier-off: LFE on Separate Mono Output / No Amplifier (priority 4000, available: unknown)
				

What is interesting is that you do not have any "Analog Speakers" ports listed. I think we're addressing this shortly in PA master having spoken to David (I can tell you're using Ubuntu from the patches), so this is good, but I'm not sure why Master is getting adjusted here... I'd have expected the two headphone ports to adjust Headphones and Line respectively.



Ultimately, this basically boils down to writing a profile for the hardware. I'd have hoped the default profiles would have sufficed and perhaps it still can once the speakers port comes in.

For more info on writing profiles see:
http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles

I've CC'ed David to get his input here.
Comment 7 David Henningsson 2012-03-13 22:34:29 UTC
> in alsamixer only the Headphone slider has an effect, Master does nothing to change volume

That's an ALSA driver bug. Unfortunately I don't know how to fix AC'97s.

> What is interesting is that you do not have any "Analog Speakers" ports listed.

There does not seem to be any kcontrols indicating that you have speakers, therefore no "Analog Speakers" port. 

It seems to me that if "Master" controls the speaker but not the headphones, "Master" should be renamed to "Speaker".
Comment 8 Arun Raghavan 2013-11-22 10:20:09 UTC
What needs to be done here? ALSA-side fix?
Comment 9 Raymond 2013-11-23 12:34:36 UTC
PCM Playback volume of a two channels AC97 Codec is just similar to the virtual master volume of HDA codec
Comment 10 Raymond 2013-11-25 00:51:57 UTC

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1078704/comments/5


without the headphone plugged in
 0:72 = 0804

with the headphone plugged in
 0:72 = 080c


it is possible to add Jack detection support on some AC97 codec
Comment 11 Raymond 2015-09-10 05:24:17 UTC
MASTER VOLUME REGISTER  Index 0x02

 This register controls the Line_Out volume controls for both stereo channels and the mute bit. Each volume subregister contains five bits, generating 32 volume levels with 31 steps of 1.5 dB each. Because AC ’97 defines 6-bit volume registers, to maintain compatibility whenever the D5 or D13 bits are set to 1, their respective lower five volume bits are automatically set to 1 by the codec logic. On readback, all lower five bits read 1s whenever these bits are set to 1. Refer to Table 12 for examples.  



HEADPHONE VOLUME REGISTER  Index 0x04 
This register controls the headphone volume controls for both stereo channels and the mute bit. Each volume subregister contains five bits, generating 32 volume levels with 31 steps of 1.5 dB each. Because AC ’97 defines 6-bit volume registers, to maintain compatibility, whenever the D5 or D13 bits are set to 1, their respective lower five volume bits are automatically set to 1 by the codec logic. On readback, all lower five bits read 1s whenever these bits are set to 1. Refer to Table 12 for examples.  


this is quite different from those virtual master of hda codecs
Comment 12 Raymond 2015-09-11 01:51:32 UTC
pulseaudio dB range (-127.5,+12) is incorrect 



662|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-output-headphones (Headphones), direction=1, priority=90, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=31, min_dB=-127.5, max_dB=12

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Element Master, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Element Master Mono, direction=1, switch=2, volume=2, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x7ffffffffffff, n_channels=1, override_map=no

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Element Headphone, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=4, required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Element PCM, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Element External Amplifier, direction=1, switch=4, volume=0, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x0, n_channels=0, override_map=no

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Option on (output-amplifier-on/Amplifier) index=1, priority=10

(   0.662|   0.000) D: [pulseaudio] alsa-mixer.c: Option off (output-amplifier-off/No Amplifier) index=0, priority=0

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Front Headphone, alsa_name='Front Headphone Jack', detection unavailable

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Front Headphone Phantom, alsa_name='Front Headphone Phantom Jack', detection unavailable

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Headphone, alsa_name='Headphone Jack', detection unavailable

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Headphone Phantom, alsa_name='Headphone Phantom Jack', detection unavailable

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Headphone Mic, alsa_name='Headphone Mic Jack', detection unavailable

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Setting output-amplifier-on (Amplifier) priority=10

(   0.663|   0.000) D: [pulseaudio] alsa-mixer.c: Setting output-amplifier-off (No Amplifier) priority=
Comment 13 Raymond 2015-09-11 03:57:24 UTC
  

--- /home/kingfisher/Desktop/alsa-info.no-hp.txt
+++ /home/kingfisher/Desktop/alsa-info.hp.txt

@@ -3,7 +3,7 @@

 !!ALSA Information Script v 0.4.64

 !!################################



-!!Script ran on: Fri Sep 11 02:28:42 UTC 2015
+!!Script ran on: Fri Sep 11 02:31:15 UTC 2015


 !!Linux Distribution

@@ -215,7 +215,7 @@
 0:6c = 0000
 0:6e = 0000
 0:70 = 0000
-0:72 = 1804
+0:72 = 180c
 0:74 = 1001
 0:76 = 2010
 0:78 = 0000


JACK SENSE/AUDIO INTERRUPT/STATUS REGISTER  Index 0x72 
Reg No.  Name  D15  D14  D13 D12  D11 D10 D9 D8  D7  D6  D5  D4  D3  D2  D1  D0

0x72  Jack Sense  X  X  X  JS MT2   JS MT1  JS MT0 JS1 EQB  JS0 EQB  JS1 TMR JS0 TMR JS1 MD JS0 MD JS1 ST JS0 ST JS1 INT JS0 INT

All register bits are read/write except for JS0ST and JS1ST, which are read-only.  
All registers are not shown, and bits containing an X are assumed to be reserved. 


Table 41. Jack Sense Mute Select—JSMT [2:0] Ref  JS1 Headphone  JS0 LINE_OUT JSMT2  JSMT1  JSMT0 HP_OUT  LINE_OUT  MONO_OUT  
Notes  0 OUT (0) OUT (0) 0 0 0 ACTIVE ACTIVE ACTIVE JS0 and JS1 ignored. 


16 OUT (0) OUT (0) 1 0 0 FMUTE FMUTE ACTIVE JS0 mutes Mono; JS1 no mute action. 
17 OUT (0) IN (1) 1 0 0 FMUTE ACTIVE FMUTE   
18 IN (1) OUT (0) 1 0 0 ACTIVE FMUTE ACTIVE  
19  IN (1)  IN (1)  1  0 0 ACTIVE  ACTIVE  FMUTE
Comment 14 Tobias Wolf 2015-09-11 07:51:58 UTC
Created attachment 118207 [details]
attachment-25654-0.html

Just for the record, the reporter (me) doesn't have access to that PC
anymore.
On 11 Sep 2015 05:57, <bugzilla-daemon@freedesktop.org> wrote:

> *Comment # 13 <https://bugs.freedesktop.org/show_bug.cgi?id=42353#c13> on
> bug 42353 <https://bugs.freedesktop.org/show_bug.cgi?id=42353> from Raymond
> <superquad.vortex2@gmail.com> *
>
>
>
>
> --- /home/kingfisher/Desktop/alsa-info.no-hp.txt
> +++ /home/kingfisher/Desktop/alsa-info.hp.txt
>
> @@ -3,7 +3,7 @@
>
>  !!ALSA Information Script v 0.4.64
>
>  !!################################
>
>
>
> -!!Script ran on: Fri Sep 11 02:28:42 UTC 2015
> +!!Script ran on: Fri Sep 11 02:31:15 UTC 2015
>
>
>  !!Linux Distribution
>
> @@ -215,7 +215,7 @@
>  0:6c = 0000
>  0:6e = 0000
>  0:70 = 0000
> -0:72 = 1804
> +0:72 = 180c
>  0:74 = 1001
>  0:76 = 2010
>  0:78 = 0000
>
>
> JACK SENSE/AUDIO INTERRUPT/STATUS REGISTER  Index 0x72
> Reg No.  Name  D15  D14  D13 D12  D11 D10 D9 D8  D7  D6  D5  D4  D3  D2  D1  D0
>
> 0x72  Jack Sense  X  X  X  JS MT2   JS MT1  JS MT0 JS1 EQB  JS0 EQB  JS1 TMR
> JS0 TMR JS1 MD JS0 MD JS1 ST JS0 ST JS1 INT JS0 INT
>
> All register bits are read/write except for JS0ST and JS1ST, which are
> read-only.
> All registers are not shown, and bits containing an X are assumed to be
> reserved.
>
>
> Table 41. Jack Sense Mute Select—JSMT [2:0] Ref  JS1 Headphone  JS0 LINE_OUT
> JSMT2  JSMT1  JSMT0 HP_OUT  LINE_OUT  MONO_OUT
> Notes  0 OUT (0) OUT (0) 0 0 0 ACTIVE ACTIVE ACTIVE JS0 and JS1 ignored.
>
>
> 16 OUT (0) OUT (0) 1 0 0 FMUTE FMUTE ACTIVE JS0 mutes Mono; JS1 no mute action.
> 17 OUT (0) IN (1) 1 0 0 FMUTE ACTIVE FMUTE
> 18 IN (1) OUT (0) 1 0 0 ACTIVE FMUTE ACTIVE
> 19  IN (1)  IN (1)  1  0 0 ACTIVE  ACTIVE  FMUTE
>
> ------------------------------
> You are receiving this mail because:
>
>    - You reported the bug.
>
>
Comment 15 Raymond 2015-09-11 11:48:30 UTC
(In reply to Arun Raghavan from comment #8)
> What needs to be done here? ALSA-side fix?



https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/893210

it is unlikely fix in alsa driver as pulseaudio expect jack detection kctl 

although js0 ST or js1 ST of ac97 register 0x72 of ad1981b may reflect hp status


it is not clear how and when to check the change in jack state by timer or interrept
Comment 16 Raymond 2015-09-11 12:56:39 UTC
Table 40. Bit Mnemonic JS0 Interrupt Function JS1 TMR  JS0 TMR JS1 MD JS0 MD JS1 ST  JS0 ST JS1 INT JS0 INT 0x0000 

JS1INT  JS0ST  JS1ST  JS0MD  JS1MD  JS0TMR  JS1TMR  JS0EQB  JS1EQB  JSMT [2:0]  

JS0INT  
This bit indicates that Pin JS0 has generated an interrupt. This bit remains set until the software services the JS0 interrupt, that is, JS0 ISR should clear this bit by writing a 0 to it. The interrupt to the system is an OR combination of this bit and JS1INT. The actual interrupt implementation is selected by the INTS bit (Register 0x76). It is also possible to generate a software system interrupt by writing a 1 to this bit.  

Js1 Interrupt 
This bit indicates that Pin JS1 has generated an interrupt. This bit remains set until the software services the JS1 interrupt, that is, JS1 ISR should clear this bit by writing a 0 to it. See the JS0INT description for details.  

JS0 State 
This bit always reports the logic state of the JS0 pin.  

JS1 State 
This bit always reports the logic state of the JS1 pin.  

JS0 Mode 
This bit selects the operation mode for the JS0 pin. 0 = Jack sense mode (default). 1 = Interrupt mode.  

JS1 Mode 
This bit selects the operation mode for the JS1 pin. 0 = Jack sense mode (default). 1 = Interrupt mode.  

JS0 Timer Enable
If this bit is set to 1, JS0 must be high for >278 ms to be recognized.  

JS1 Timer Enable
If this bit is set to 1, JS1 must be high for >278 ms to be recognized.  


 JS0 EQ Bypass Enable 
This bit enables JS0 to control the EQ bypass. When this bit is set to 1, JS0 = 1 causes the EQ to be bypassed. 
 
JS1 EQ Bypass Enable 
This bit enables JS1 to control the EQ bypass. When this bit is set to 1, JS1 = 1 causes the EQ to be bypassed.  

JS Mute Enable Selector 

These three bits select and enable the jack sense muting action (see Table 41
Comment 17 Raymond 2015-09-11 13:23:32 UTC
static const struct snd_kcontrol_new snd_ac97_ad1981x_jack_sense[] = {
	AC97_SINGLE("Headphone Jack Sense", AC97_AD_JACK_SPDIF, 11, 1, 0),
	AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0),
};

these two controls only change JSMT2 and JSMT1


you need bit 2 and  bit3 of AC97_AD_JACK_SPDIF for JS0 ST and JS1 ST

create hp jack kctl similar to

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/oxygen?id=435feac648cab190990aa0bf9355f77d1f082db3

the point is when do the driver call snd_jack_report by interrupt or timer
Comment 18 Raymond 2015-09-11 13:52:15 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-headphones.conf

you need to remove Element Master from analog-output-headphones.conf since master is used by line out jack

[Element Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
Comment 19 Raymond 2015-09-11 15:50:52 UTC
             device.vendor.name = "Intel Corporation"
                device.product.id = "27de"
                device.product.name = "OptiPlex GX620"
                device.form_factor = "internal"
                device.string = "front:0"
                device.buffering.buffer_size = "65536"
                device.buffering.fragment_size = "65536"
                device.access_mode = "mmap+timer"
                device.profile.name = "analog-stereo"
                device.profile.description = "Analogue Stereo"
                device.description = "Built-in Audio Analogue Stereo"
                alsa.mixer_name = "Analog Devices AD1981B"
                alsa.components = "AC97a:41445374"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        Ports:
                analog-output-headphones;output-amplifier-on: Headphones / Amplifier (priority: 9010)
                analog-output-headphones;output-amplifier-off: Headphones / No Amplifier (priority: 9000)

        Active Port: analog-output-headphones;output-amplifier-off


the port is different from those  ac97 codec in virtualbox 4.x or those ac97 codec without headphone volume control
Comment 20 Raymond 2015-09-13 01:58:38 UTC
ftp://ftp.alsa-project.org/pub/manuals/intel/

refer to ac97 2.1/2.3 specification

Figure 16.   AC ‘97 Mixer Functional Diagram

master volume control line out
headphone volume control hp
master mono volume control mono out
Comment 21 Raymond 2015-09-13 09:34:31 UTC
> so how can I get pactl list sinks to include:

>analog-output-lfe-on-mono;output-amplifier-on: LFE on Separate Mono Output / Amplifier (priority: 4010)
>analog-output-lfe-on-mono;output-amplifier-off: LFE on Separate Mono Output / No Amplifier (priority: 4000)

do you mean the internal speaker is using mono out, you have to ask pulseaudio developer ?


http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer?id=9e4229cfe03d441a01a0f1bd02972936048ae85d
Comment 22 Raymond 2015-09-13 15:09:49 UTC
> I just booted from ubuntu-12.04.5-desktop-amd64.iso, played a music file, opened alsamixer, and discovered that; changing Master M volume independently changed the internal speaker volume. In 14.04 Master M is muted by default, unmuting and raising the volume has no effect.

You have to turn off headphone jack sense and line jack sense controls to set mute enable selector JSMT[2:0] to 0

http://cgit.freedesktop.org/pulseaudio/pulseaudio/patch/src/modules/alsa/mixer/paths?id=ba0203c4c0938fd646cf559456e3d691fc889029

you have to send email to the author if  you think it is a regression of this patch
Comment 23 Raymond 2015-09-14 01:54:59 UTC
Hi, I am also trying to get internal speakers to work on Dell OptiPlex GX620 (model no.: DCCY). External speakers work, however internal speakers are not even listed in PulseAudio Volume Control (and there is no sound). The internal speakers worked on previous OS (Windows XP).

do you mean your desktop have stereo internal speakers since ad1981b only has three output

line out
hp
mono out

and your dell gx520 seem have hp at front and line out at rear




Small error on my part: I have OptiPlex GX520, not GX620. Should be similar though. Attaching my alsa-info.

https://launchpadlibrarian.net/217865539/alsa-info.txt.TO94irU7Fb

0:72 = 0800
0:74 = 1001
0:76 = 2010
0:78 = 0000
0:7a = 0000
0:7c = 4144
0:7e = 5374



js1 st and js0 st seem to be clear , mono out is not muted by FMUTE
Comment 24 Raymond 2015-09-14 06:14:18 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer?id=052316e4195cc01c6b13ce9e21724cb7c25aad82

as desktop speaker.conf has beem merged


if your desktop speaker use mono out playback volume/switch

you have to add element master mono to speaker.conf
Comment 25 Raymond 2015-09-14 09:16:18 UTC
Created attachment 118260 [details]
ad1981b - add jack detect kctl

This patch still lack the interrupt to call ad198x_handle_hp_jack() and ad198x_handle_lo_jack() when hp or line out is plugged
Comment 26 Raymond 2015-09-15 01:08:05 UTC
you will also need to schedule the driver to call ad198x_handle_hp_jack and ad198x_handle_lo_jack in intel8x0.c periodically similar to hda vt1708 codec


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_via.c?id=187d333edc0a8e1bb507900ce89853ffe3bd2c84
Comment 27 Raymond 2015-09-15 02:37:08 UTC
Created attachment 118276 [details] [review]
patch for ac97 codec with HP, Line Out and Speaker

For AC97 codec which

Line Out use Master Playback Volume
Headphone use Headphone Playback Volume
Speaker use Master Mono Playback Volume
Comment 28 Raymond 2015-09-15 15:36:06 UTC
SERIAL CONFIGURATION REGISTER  Index 0x74 

D4

INTS  Interrupt Mode Select This bit selects the JS interrupt implementation path.  
0 = Bit 0 Slot 12 (modem interrupt). 
 1 = Slot 6 valid bit (MIC ADC interrupt).






2.2.9 GLOB_STA—Global Status Register (Audio—D30:F2) I/O Address: Default Value: Lockable: Bit 31:30Reserved. NABMBAR + 30h


GPI Status Change Interrupt (GSCI) — R/WC. 
0 =Software clears this bit by writing a 1 to it. 
1 =This bit reflects the state of bit 0 in slot 12, and is set when bit 0 of slot 12 is set. This indicates that one of the GPI’s changed state, and that the new values are available in slot 12. This bit is not affected by AC ‘97 Audio Function D3HOT to D0 Reset.
Comment 29 Raymond 2015-09-16 01:31:25 UTC
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1078704

however ad1981b is also used in notebook or desktop

this mean that you need to differentitate desktop and notebook 

most likely you need pulseaudio to adjust the element in speaker path in alsa-mixer.c if notebook use master for the speaker
Comment 30 Raymond 2015-09-16 01:31:39 UTC
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1078704

however ad1981b is also used in notebook or desktop

this mean that you need to differentitate desktop and notebook 

most likely you need pulseaudio to adjust the element in speaker path in alsa-mixer.c if notebook use master for the speaker
Comment 31 Raymond 2015-09-17 01:27:20 UTC
only those in whitelist call snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11);


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/ac97/ac97_patch.c

static unsigned int ad1981_jacks_whitelist[] = {
	0x0e11005a, /* HP nc4000/4010 */
	0x103c0890, /* HP nc6000 */
	0x103c0938, /* HP nc4220 */
	0x103c099c, /* HP nx6110 */
	0x103c0944, /* HP nc6220 */
	0x103c0934, /* HP nc8220 */
	0x103c006d, /* HP nx9105 */
	0x103c300d, /* HP Compaq dc5100 SFF(PT003AW) */
	0x17340088, /* FSC Scenic-W */
	0 /* end */
};

static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97)
{
	if (check_list(ac97, ad1981_jacks_whitelist))
		/* enable headphone jack sense */
		snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11);
}
Comment 32 Raymond 2015-09-17 04:40:58 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output.conf.common

another problem is external amplifier defined in 


[Element External Amplifier]
switch = select

[Option External Amplifier:on]
name = output-amplifier-on
priority = 10

[Option External Amplifier:off]
name = output-amplifier-off
priority = 0


you have to determine it affect which output paths
Comment 33 Raymond 2015-09-17 23:50:42 UTC
	if (check_list(ac97, ad1981_jacks_blacklist))
 		return 0;
+	if (ac97->subsystem_vendor == 0x1028 &&
+	    ac97->subsystem_device == 0x01ad) {

+		snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Line Out Playback");
+		snd_ac97_rename_vol_ctl(ac97, "Master Mono Playback",
+									"Speaker Playback");
+	}
 	return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
 				    ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
 }
Comment 34 Raymond 2015-09-18 23:26:25 UTC
post the output of

cat /proc/asound/card0/intel8x0


check whether bit 0 of the global status of your ich controller change when you enable js interrupt by set js1 mode of ac97 registers using echo
Comment 35 Raymond 2015-09-19 09:31:54 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/Procfile.txt

AC97 Codec Information
----------------------

card*/codec97#*/ac97#?-?
	Shows the general information of this AC97 codec chip, such as
	name, capabilities, set up.

card*/codec97#0/ac97#?-?+regs
	Shows the AC97 register dump.  Useful for debugging.

	When CONFIG_SND_DEBUG is enabled, you can write to this file for
	changing an AC97 register directly.  Pass two hex numbers.
	For example,

	# echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs
Comment 36 Raymond 2015-09-20 01:29:17 UTC
0:72 = 1804
0:74 = 1001
0:76 = 2010


cat /proc/asound/card0/intel8x0
 Intel8x0

Global control : 0xc0000002
 Global status : 0x00700100
 SDM : 0x00000008
 AC'97 codecs ready : primary
 AC'97 codecs SDIN : 0 0 0


card*/codec97#0/ac97#?-?+regs
  Shows the AC97 register dump. Useful for debugging.

 recompile alsa driver with CONFIG_SND_DEBUG is enabled, you can write to this file for
  changing an AC97 register directly. 

Pass two hex numbers.
  For example,

 # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs

this change master playback volume register


with headphone unplugged

set js1 mode bit of ac97 register 0x72

echo 72 1824 > /proc/asound/card0/codec97#0/ac97#0-0+regs

plug headphone 

cat /proc/asound/card0/intel8x0

check bit 0 of global status is set or not

repeat the test with line out by set js0 mode

if gpi bit of global status was set after jack is plugged

we need to add a check of this bit  in snd_intel8x0_interrupt and call those ad198x_handle_jp_jack
Comment 37 GitLab Migration User 2018-07-30 10:23:48 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/393.


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.