Post by Deucher, Alexander-----Original Message-----
Sent: Friday, September 19, 2014 9:39 AM
To: Deucher, Alexander; Takashi Iwai
Subject: Re: [alsa-devel] Radeon unconnected HDMI eats samples at 280 kHz
Post by Deucher, AlexanderPost by David HenningssonPost by Takashi IwaiPost by David HenningssonWell, if jack detection (get pin sense) works, there is.
Does it react if we turn off the HDMI output via xrandr, too?
I'm not sure whether we need reprogram things in that case, though...
xrandr correctly reports that "HDMI-0" is disconnected.
I'm not sure how to turn the HDMI output via xrandr, but I tried "xrandr
--output HDMI-0 --off" and it made no difference in either xrandr
output, nor in codec/eld output.
What I'm thinking is that it could be that the monitor_present is
indicating the presence of my DVI monitor, as some cards are capable of
outputting HDMI audio on their DVI outputs (through a passive DVI-
HDMI
Post by David Henningssonadapter). This is just a guess though.
I'm not that familiar with the audio side, but on there are registers on the
gpu side that will change what is reported to the audio side as far as I can tell.
Post by Deucher, Alexanderhttp://lists.freedesktop.org/archives/dri-devel/2014-
September/068544.html
Post by Deucher, Alexanderpatch 5/5 is probably the most relevant for this discussion. It explicitly
clears the audio enable bit when the display is disabled which should cascade
down to the audio side if I understand correctly. If not, I think playing with
the AZ_HOT_PLUG_CONTROL registers in that patch set can probably sort it
out.
Thanks for the attention and the patches!
I compiled a 3.17-rc4 kernel plus the five patches. (I usually run the
Ubuntu 3.13 kernel).
http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-next-3.18-wip
Thanks, will try this later. In this case, would you expect me to take
the entire kernel from the drm-next-3.18-wip branch, or mix it somehow
with a 3.17 kernel?
Post by Deucher, AlexanderWith this I saw that the jack reported "unplugged" when booting without
an HDMI monitor, and that when the HDMI monitor was connected and got
video output, the jack was now reported to be plugged in.
However, when I unplugged the monitor, the jack was still reported to be
plugged in.
Did you also run xrandr --output <output> --off?
Not that exact command, but I tried "Detect displays" (in the system
settings dialog) to see if that helped. Also xrandr showed the HDMI-0
display as disconnected.
Post by Deucher, AlexanderThe audio pins are not tied to a specific output (e.g., there can be multiple HDMI or DP ports on a system), so they are not directly tied to a hotplug pin. I think the gpu driver has to set the appropriate bits in this register to have the changes reflected in the audio driver.
In my case, I have one HDMI, one VGA and one DVI. But there is only one
pin on the audio side. So the question here is whether the DVI output is
audio capable, and if that could possibly cause confusion here, or if
one would expect the pin to always map to the HDMI output?
Post by Deucher, AlexanderI also tried running a get_pin_sense verb manually and it still reported
to be plugged in.
Also, I think it was the third time I plugged the monitor in, I got some
type of GPU hang (see attached log). It never recovered by itself so I
had to use SysRq to reboot the computer.
Post by Deucher, AlexanderI'm just not familiar enough with the azalia hw to know exactly how it's
supposed to interact with the audio side.
Well, feel free to ask questions if you think we can answer them :-)
The bits that say PIN*_JACK_DETECTION_ENABLE and
PIN*_UNSOLICITED_RESPONSE_ENABLE sounds like things that should be
turned on all the time so we can properly get unsol jack detection
events when the monitor is plugged or unplugged. Unless the
PIN*_JACK_DETECTION_ENABLE actually represents the current state rather
than the detection capability. But that's just guesses, as I assume the
specs are not released?
I'm not familiar enough with the audio side, but here is some information about the bits in that register.
Thanks!
Post by Deucher, AlexanderHopefully someone more familiar with the audio side can help out.
PIN*_JACK_DETECTION_ENABLE
If PIN0_JACK_DETECTION_ENABLE is 1, changing PIN0_AUDIO_ENABLED will produce jack connection and disconnection status changes in pin0 accordingly.
00 - setting PIN0_AUDIO_ENABLED does not set pin0 PRESENCE_DETECT
01 - setting PIN0_AUDIO_ENABLED sets pin0 PRESENCE_DETECT
Ok, we definitely need this enabled.
Post by Deucher, AlexanderPIN*_UNSOLICITED_RESPONSE_ENABLE
For PIN0, If 1, when AUDIO_ENABLED changes, an unsolicited response with payload UNSOLICITED_RESPONSE_PAYLOAD will be sent.
00 - changing AUDIO_ENABLED does not produce an unsolicited response
01 - changing AUDIO_ENABLED produces an unsolicited response
Ok, we need this enabled too.
Note: to make sure both plug and unplug events are delivered, these two
should probably remain enabled even when the monitor is disconnected.
There is a risk that setting these to zero when also setting
AUDIO_ENABLED to zero could cause either event not to trigger on the
audio side.
Post by Deucher, AlexanderCODEC_HOT_PLUG_ENABLE
If 1, changing AUDIO_ENABLED sets STATE_CHANGE_STATUS.
00 - changing AUDIO_ENABLED does not set STATE_CHANGE_STATUS
01 - changing AUDIO_ENABLED sets STATE_CHANGE_STATUS
This probably refer to audio controller register STATESTS, because
that's the only thing labelled "State change status" in the HDA spec. I
think this should be enabled too, but it's possible that it's only
relevant if the audio device is in a power down state.
Post by Deucher, AlexanderPIN*_AUDIO_ENABLED
Set to 1 by the driver if an HDMI TV able to take channel pair 0,1 for PIN0 (or 2,3 for PIN1, etc.) is connected, set to 0 if not.
00 - disabled
01 - enabled
AUDIO_ENABLED
Set to 1 by the driver when an Audio Enabled HDMI TV is connected, set to 0 when it is disconnected. Zeroed by the driver during mode change to disable audio temporarily in order to avoid noise. The software changes on this bit are used by the CODEC hardware to emulate hot plugging-unplugging of the audio-enabled HDMI TV.
00 - disabled
01 - enabled
If audio_enabled quickly changes to off and then on when there is a mode
change, it might make sense to *not* wake up the audio driver in this
case, as I assume that the audio capabilities on the HDMI TV will not
change just because the video mode changes.
To sum up, what the audio driver needs is PRESENCE_DETECT to correctly
correspond to whether something is plugged in or not. And we need an
unsolicited event when PRESENCE_DETECT changes.
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic