headphone jack sense not enabled

Bug #1078704 reported by Israel Dahl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ALSA driver
Unknown
Medium
alsa-driver (Ubuntu)
Invalid
Undecided
Unassigned
pulseaudio (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

bug is present in Ubuntu 12.04 and Xubuntu 12.04 and Lubuntu 12.04.1 64bit
alsa-base 1.0.25+dfsg-0ubuntu1 on this machine (64 bit)
I except Ubuntu to automatically sense the presence of headphones and disable the speakers. This is not the case, the speakers and headphones play simultaneously. I must install gnome-alsamixer to manually set the jack sense. Alsa should have this enabled as the default setting. This seems as though it should be a very easy bug to fix, though.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: alsa-base 1.0.25+dfsg-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-32.51-generic 3.2.30
Uname: Linux 3.2.0-32-generic x86_64
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 2.0.1-0ubuntu14
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: love 1330 F.... pulseaudio
Card0.Amixer.info:
 Card hw:0 'nForce3'/'NVidia nForce3 with AD1981B at irq 21'
   Mixer name : 'Analog Devices AD1981B'
   Components : 'AC97a:41445374'
   Controls : 33
   Simple ctrls : 22
Date: Wed Nov 14 06:42:21 2012
InstallationMedia: Lubuntu 12.04 "Precise Pangolin" - Release amd64 (20120423)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_US:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: alsa-driver
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/30/2004
dmi.bios.vendor: Hewlett-Packard
dmi.bios.version: F.11
dmi.board.name: 08A0
dmi.board.vendor: Compal
dmi.board.version: 32.22
dmi.chassis.type: 10
dmi.chassis.vendor: Compal
dmi.modalias: dmi:bvnHewlett-Packard:bvrF.11:bd04/30/2004:svnHewlett-Packard:pnPresarioR3200(PF153UA#ABA):pvrF.11:rvnCompal:rn08A0:rvr32.22:cvnCompal:ct10:cvr:
dmi.product.name: Presario R3200 (PF153UA#ABA)
dmi.product.version: F.11
dmi.sys.vendor: Hewlett-Packard

Revision history for this message
In , Tobias Wolf (towolf) wrote :

Created attachment 52868
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

Revision history for this message
In , Tobias Wolf (towolf) wrote :

Created attachment 52869
pulseadui -vvvvvv gzipped

Revision history for this message
In , Tobias Wolf (towolf) wrote :

Have you had time to look at this yet, Maarten?

You've told me to poke you.

Revision history for this message
In , Colin Guthrie (launchpad-colin) wrote :

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.

Revision history for this message
In , Tobias Wolf (towolf) wrote :

Created attachment 58411
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.

Revision history for this message
In , Colin Guthrie (launchpad-colin) wrote :

Created attachment 58415
Plain version of alsa-info for better readability.

Revision history for this message
In , Colin Guthrie (launchpad-colin) wrote :

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.

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

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

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

Simple mixer control 'Headphone Jack Sense',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [on]

Simple mixer control 'Line Jack Sense',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]

ac97 does not provide any jack state to user space

ports:
  analog-output-headphones: Headphones (priority 9000, available: unknown)
   properties:

  analog-output-lfe-on-mono: LFE on Separate Mono Output (priority 4000, available: unknown)
   properties:

 active port: <analog-output-headphones>

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

did ac97 register 0x72 changes when you plug in / out the headphone ?

JACK SENSE/AUDIO INTERRUPT/STATUS REGISTER Index 0x72

cat /proc/asound/card0/codec97#0/ac97#0-0+regs

Revision history for this message
Israel Dahl (israeldahl) wrote :

I will have to check on this tomorrow... I assume it is registering, because after installing gnome-alsamixer I can check the "Headphone Jack Sense" and it will work. It was not enabled by default however. Thanks for the quick response

Revision history for this message
Israel Dahl (israeldahl) wrote :

without the headphone plugged in
0:72 = 0804

with the headphone plugged in
0:72 = 080c

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

pci subsytem id 103c:006d already in white list

00:06.0 Multimedia audio controller [0401]: NVIDIA Corporation nForce3 Audio [10de:00da] (rev a2)
 Subsystem: Hewlett-Packard Company Device [103c:006d]

http://git.kernel.org/?p=linux/kernel/git/tiwai/sound.git;a=commitdiff;h=128a46a55da81e563116e99e08e295fda41a145b;hp=b14e77e613a104c78ab455c0109b56cidab430de6

Revision history for this message
Israel Dahl (israeldahl) wrote :

Not sure what that means.... Does that mean there is no fix, it is already "fixed" since some devices need it off? Shouldn't the devices that need it off be specifically blacklisted, or is that not possible?

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

do you mean "alsactl restore" did not restore setting after reboot ? use alsactl store to save the setting

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

http://git.kernel.org/?p=linux/kernel/git/tiwai/sound.git;a=blob_plain;f=sound/pci/ac97/ac97_patch.c;h=66a3bc95fb844c3f1b311b227622aacbb680a50c;hb=833a493b7ed2eb8f9059338a0ebf06bebbb6ae93

your pci ssid already in whitelist

/* white list to enable HP jack-sense bits
 * (SS vendor << 16 | device)
 */
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);
}

Revision history for this message
Israel Dahl (israeldahl) wrote :

Ok, so it is in the whitelist already, well... for some reason the first time I used the headphones it blared through the speakers as well, so even though it is supposed to be whitelisted for jack sense that DID NOT occur. I had to manually turn on the headphone jack sense by using the program gnome-alsamixer and checking the headphone jack sense checkbox. I don't know what alsactl restore is at all, sorry. Once I have checked the headphone jack sense box in the gnome-alsamixer program the headphone jacksense remains in effect every time I use it. I had to enable it the very first time. Now it is enabled. It should be enabled by default (as new users might not know they can install a program to enable it)

Revision history for this message
In , Arun Raghavan (arunraghavan) wrote :

What needs to be done here? ALSA-side fix?

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

PCM Playback volume of a two channels AC97 Codec is just similar to the virtual master volume of HDA codec

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

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

Changed in alsa-driver:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Raymond (superquad-vortex2) wrote :

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

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

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=

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

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

Revision history for this message
In , Tobias Wolf (towolf) wrote :

Created attachment 118207
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, <email address hidden> 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
> <email address hidden> *
>
>
>
>
> --- /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.
>
>

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

(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

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

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

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

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

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

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

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

             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

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

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

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

> 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

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

> 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

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

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

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

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

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

Created attachment 118260
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

Changed in alsa-driver (Ubuntu):
status: New → Incomplete
Revision history for this message
In , Raymond (superquad-vortex2) wrote :

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

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

Created attachment 118276
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

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

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for reporting this bug to Ubuntu.
Ubuntu 12.04 (precise) reached end-of-life on April 28, 2017.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

We appreciate that this bug may be old and you might not be interested in discussing it any more. But if you are then please upgrade to the latest Ubuntu version and re-test.

Changed in pulseaudio (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Closed due to no response.

Changed in pulseaudio (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
In , Gitlab-migration (gitlab-migration) wrote :

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

Changed in alsa-driver:
status: Confirmed → Unknown
Changed in alsa-driver (Ubuntu):
status: Incomplete → Invalid
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.