[alsa-devel] Headphone issues iMac 14.1 (A1418)

Takashi Iwai tiwai at suse.de
Tue Jan 9 15:39:47 CET 2018


On Tue, 09 Jan 2018 15:16:38 +0100,
Freaky wrote:
> 
> Hi Takashi,
> 
> what exactly do you need us to test?
> 
> Running just:
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA 0x06
> doesn't produce sound on the headphones.
> 
> After running
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_MASK 0x0e
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DIRECTION 0x0e
> 
> It starts producing sound.
> 
> After replugging sound is gone. Only have to run the first one again to
> have sound again, the other 2 are no longer required then.
> 
> Tried, after executing all 3 commands, to replug and then use
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA XX
> 
> where XX
> 0x00 doesn't work
> 0x01 doesn't work
> 0x02 doesn't work
> 0x04 works
> 0x06 works
> 0x08 doesn't work
> 
> What's also somewhat odd, we run X as a user (auto logon). If I switch to
> console before there was any audio playing and execute:
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA 0x06
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_MASK 0x0e
> hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DIRECTION 0x0e

Both headphone and speaker outputs are controlled with different amps,
so test them individually.

And, does GPIO mask and direction need to be 0x0e, not 0x06?

So, try at first:
 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_MASK 0x06
 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DIR 0x06
 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA 0x06

If this makes both speaker and headphone working, go to the next step.
Keep the following but change the data bits either 0x02 or 0x04:

 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_MASK 0x06
 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DIR 0x06
 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA 0x02

and test whether the headphone and/or the speaker works.

Again with 0x04,

 hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA 0x04

test whether the headphone and/or the speaker works.

You might need to adjust the whole GPIO setup at each time you
plug/unplug the jack.  Check /proc/asound/card0/codec#0 output whether
the GPIO values are kept as expected before testing.

If it's confirmed that both the GPIO bit 0x02 and 0x04 (or vice versa)
correspond to the headphone and the speaker amps, I can cook up the
patch to add quirk easily.


thanks,

Takashi

> and switch back, start playing audio, there's no sound on the headphone.
> I'll need to run them again. This might be related to pulseaudio however.
> Just running the first command again doesn't suffice in that case. After
> audio has been on the headphones once, in all my tests so far, only the
> first command does suffice to get it working again and the 0x04 value then
> also works.
> 
> Any other values, order of commands, etc. you'd like us to test?
> 
> Thanks for the help so far :).
> 
> Kind regards,
> 
> On Thu, Jan 4, 2018 at 5:35 PM, Takashi Iwai <tiwai at suse.de> wrote:
> 
> > On Thu, 04 Jan 2018 17:27:55 +0100,
> > Freaky wrote:
> > >
> > > Hi Takashi,
> > >
> > > we need it to get the headphone output working. Upon unplugging /
> > > replugging we need to check them again (they remain checked, but the
> > output
> > > stops working). The speaker output (onboard speakers) works fine and the
> > > script we run doesn't appear to have any effect on the speaker output at
> > > all.
> >
> > The alsa-info.sh output showed that GPIO[1] is also set, so I wonder
> > how and who sets it.  In anyway, could you check whether flipping any
> > such gpio bits turn on / off the headphone and the speaker outputs?
> > Try to toggle it while playing back, such as,
> >         hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA xxx
> > where xxx is the value to be written (0x00, 0x02, 0x04, 0x06, etc).
> >
> > > Currently use a python script generated by the HDA Analyzer script that
> > we
> > > run every 5 seconds from boot. Pasted the script below. We run it every 5
> > > seconds to ensure audio will work after replugging the headphones
> > (although
> > > it might incur a small delay then of course). I don't notice any hick-ups
> > > in audio playback because of the script firing every 5 seconds.
> > >
> > > There's no acpid running from which we could detect the plug event.
> > Using a
> > > system based on Fedora 24. Have watched dbus-monitor (--sytem), but see
> > no
> > > events there upon (un)plugging the headphones which we could use as
> > trigger.
> >
> > The headphone jack detection on HD-audio is usually done via HD-audio
> > codec unsolicited events.  You can check "Headphone Jack" ALSA control
> > element (e.g. watch the output of "amixer contents").
> >
> >
> > Takashi
> >
> [2  <text/html; UTF-8 (quoted-printable)>]
> 


More information about the Alsa-devel mailing list