Skip to content

Conversation

popcornmix
Copy link
Collaborator

This allows HBR audio passthough on a Pi 4 (e.g. DTS-HD and TrueHD)

A patch to alsa-lib is also required as it doesn't format status bits correctly for HBR.
LibreELEC/LibreELEC.tv@c70f34d

With this, and a suitable alsa vc4_hdmi.conf file, an app like kodi can output HBR passthrough.

@pelwell
Copy link
Contributor

pelwell commented Jul 9, 2020

Looks good to me.

switch(samplerate)
{
case 8000:
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to replace these magic MAI_FMT numbers here (and below) with proper defines in vc4_regs.h

mai_audio_format = 2; /* PCM mode */
if (vc4_hdmi->audio.iec_status[0] & IEC958_AES0_NONAUDIO &&
vc4_hdmi->audio.channels == 8)
mai_audio_format = 200; /* HBR mode */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proper defines in vc4_regs.h instead of magic number here and below would be nice

@HiassofT
Copy link
Contributor

HiassofT commented Jul 9, 2020

BTW: feel free to remove "TEST" in my "TEST drm/vc4: enable HBR MAI format on HBR streams" commit message - this seems to work fine :-)

popcornmix and others added 7 commits July 10, 2020 11:50
The hardware uses this for generating the right audio
data island packets when using formats other than PCM

Signed-off-by: Dom Cobley <[email protected]>
Although vc4 get an IEC958 formatted stream passed in from userspace
the driver needs the info from the channel status bits to properly
set up the hardware, eg for HBR passthrough.

Add iec958 controls so the channel status bits can be passed in
from userspace.

Signed-off-by: Matthias Reichl <[email protected]>
Configuring HDMI audio registers in prepare allows us to take
IEC958 bits into account which are set by the alsa hook after
the hw_params call.

Signed-off-by: Matthias Reichl <[email protected]>
This was a workaround for bugs in hardware on earlier Pi models
and wasn't totally successful.

It makes audio quality worse on a Pi4 at the higher sample rates

Signed-off-by: Dom Cobley <[email protected]>
Without this bit set, HDMI_MAI_FORMAT doesn't pick up
the format and samplerate from DVP_CFG_MAI0_FMT and you
can't get HDMI_HDMI_13_AUDIO_STATUS_1 to indicate HBR mode

Signed-off-by: Dom Cobley <[email protected]>
Without this set, DVP_CFG_MAI0_CTL indicates occasional
DLATE errors when configured to 8 channel 192kHz

Signed-off-by: Dom Cobley <[email protected]>
@popcornmix
Copy link
Collaborator Author

Updated to address comments.

@HiassofT
Copy link
Contributor

Thanks, looks good to me!

@pelwell pelwell merged commit 3c860a6 into raspberrypi:rpi-5.4.y Jul 10, 2020
@pelwell
Copy link
Contributor

pelwell commented Jul 10, 2020

Thanks, all.

@popcornmix popcornmix deleted the vc4_hbr branch July 10, 2020 14:02
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 13, 2020
kernel: vc4_hdmi: Support HBR audio
See: raspberrypi/linux#3717

kernel: OV7251 overlay and defconfig
See: raspberrypi/linux#3714

kernel: Imx290 & unicam v4l2-compliance fixes
See: raspberrypi/linux#3712

kernel: Enhances the DAC+ driver to control the optional headphone amplifier
See: raspberrypi/linux#3711

kernel: OV9281 driver and overlay
See: raspberrypi/linux#3709

kernel: dtoverlays: Fixup imx219 and imx477 overlays due to parsing failures
See: raspberrypi/linux#3706

kernel: FKMS: max refresh rate and blocking 1366x768
See: raspberrypi/linux#3704

kernel: Fix lockups and IRQ jitter on multicore RasPis
See: raspberrypi/linux#3703

kernel: dts: Further simplify firmware clocks
See: raspberrypi/linux#3609

kernel: configs: Add CAN_EMS_USB=m
See: raspberrypi/linux#3716

kernel: configs: Enable CONFIG_BLK_DEV_NVME=m

kernel: ARM: dts: Make bcm2711 dts more like 5.7

firmware: arm_loader: Don't enable the ARM USB IRQ
See: raspberrypi/linux#3703

firmware: hdmi: Remove M2MC/BVB min turbo clock request
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 13, 2020
kernel: vc4_hdmi: Support HBR audio
See: raspberrypi/linux#3717

kernel: OV7251 overlay and defconfig
See: raspberrypi/linux#3714

kernel: Imx290 & unicam v4l2-compliance fixes
See: raspberrypi/linux#3712

kernel: Enhances the DAC+ driver to control the optional headphone amplifier
See: raspberrypi/linux#3711

kernel: OV9281 driver and overlay
See: raspberrypi/linux#3709

kernel: dtoverlays: Fixup imx219 and imx477 overlays due to parsing failures
See: raspberrypi/linux#3706

kernel: FKMS: max refresh rate and blocking 1366x768
See: raspberrypi/linux#3704

kernel: Fix lockups and IRQ jitter on multicore RasPis
See: raspberrypi/linux#3703

kernel: dts: Further simplify firmware clocks
See: raspberrypi/linux#3609

kernel: configs: Add CAN_EMS_USB=m
See: raspberrypi/linux#3716

kernel: configs: Enable CONFIG_BLK_DEV_NVME=m

kernel: ARM: dts: Make bcm2711 dts more like 5.7

firmware: arm_loader: Don't enable the ARM USB IRQ
See: raspberrypi/linux#3703

firmware: hdmi: Remove M2MC/BVB min turbo clock request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants