[PATCH] drm/tegra: sor: Support for audio over HDMI

Thierry Reding thierry.reding at gmail.com
Tue Dec 4 13:08:19 UTC 2018


On Tue, Dec 04, 2018 at 02:09:07PM +0300, Dmitry Osipenko wrote:
> On 03.12.2018 18:36, Thierry Reding wrote:
> > From: Thierry Reding <treding at nvidia.com>
> > 
> > This code is very similar to the audio over HDMI support on older chips.
> > Interoperation with the audio codec is done via a pair of codec scratch
> > registers and an interrupt that is raised at the SOR when the codec has
> > written those registers.
> > 
> > Signed-off-by: Thierry Reding <treding at nvidia.com>
> > ---
> 
> Do you have any plans to implement integration with the sound
> subsystem? Indeed, there is HDMI audio configuration code for older
> chips in the Tegra's DRM driver that was added years ago.. but IIUC
> it's a kinda "dead code" without the integration.

The integration all lives in sound/pci/hda/hda_tegra.c for the HDA
controller driver and sound/pci/hda/patch_hdmi.c for the HDMI codec
driver. The way that this works is that the HDMI codec driver writes
information about the audio format to so-called scratch registers via
HDA verbs. These HDA verbs are accessible in the SORs (or the HDMI on
older Tegra) which basically represent the HDMI codec. Writes to these
registers are detected and an interrupt is raised in the SOR (or HDMI)
controller, upon which the interrupt handler will configure the output
as needed for playback (i.e. program some registers, send out audio
infoframe, ...).

From a userspace point of view you can simply access the HDMI codec as
an ALSA sound card. For example I use the speaker-test utility (from
alsa-utils) to test output like this:

	$ speaker-test -D hw:0,8 -c -F S16_LE -r 48000 -t sine -f 250 -l 1

The same code that works from Tegra30 to Tegra210 also works on Tegra186
and Tegra194, though I have patches (which I plan to send out later
today) which add the HDA_CODEC_ENTRY entries as well as the necessary
device tree nodes to make all this work.

Does that clarify things?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20181204/45db1760/attachment-0001.sig>


More information about the dri-devel mailing list