dt-bindings: Document the dmas and dma-names properties for VC4 HDMI
Subsystems (6)
PATCH 1/3 dt-bindings: Document the dmas and dma-names properties for VC4 HDMI
From: Boris Brezillon <[email protected]>
These are optional, but necessary for HDMI audio support.
--- Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +3 -0
@@ -34,6 +34,9 @@ Optional properties for HDMI: - hpd-gpios: The GPIO pin for HDMI hotplug detect (if it doesn't appear as an interrupt/status bit in the HDMI controller itself). See bindings/pinctrl/brcm,bcm2835-gpio.txt +- dmas: Should contain one entry pointing to the DMA channel used to + transfer audio data +- dma-names: Should contain "audio-rx" Required properties for DPI: - compatible: Should be "brcm,bcm2835-dpi"
Signature · 1 line
2.11.0
PATCH 2/3 drm/vc4: Add HDMI audio support
The HDMI encoder IP embeds all needed blocks to output audio, with a custom DAI called MAI moving audio between the two parts of the HDMI core. This driver now exposes a sound card to let users stream audio to their display.
Using the hdmi-codec driver has been considered here, but MAI meant having to significantly rework hdmi-codec, and it would have left little shared code with the I2S mode anyway.
The encoder requires that the audio be SPDIF-formatted frames only, which alsalib will format-convert for us.
This patch is the combined work of Eric Anholt (initial register setup with a separate dmaengine driver and using simple-audio-card) and Boris Brezillon (moving it all into HDMI, massive debug to get it actually working), and which Eric has the permission to release.
--- drivers/gpu/drm/vc4/Kconfig | 4 + drivers/gpu/drm/vc4/vc4_hdmi.c | 494 ++++++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/vc4/vc4_regs.h | 107 ++++++++- 3 files changed, 603 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/Kconfig +4 -0
@@ -2,11 +2,15 @@ config DRM_VC4 tristate "Broadcom VC4 Graphics" depends on ARCH_BCM2835 || COMPILE_TEST depends on DRM + depends on SND && SND_SOC depends on COMMON_CLK select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER select DRM_PANEL + select SND_PCM + select SND_PCM_ELD + select SND_SOC_GENERIC_DMAENGINE_PCM select DRM_MIPI_DSI help Choose this option if you have a system that has a Broadcom
drivers/gpu/drm/vc4/vc4_hdmi.c +493 -1
565 lines not on this page · raw message
drivers/gpu/drm/vc4/vc4_regs.h +106 -1
130 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 3/3 ARM: dts: bcm283x: Add HDMI audio related properties
In reply to Eric AnholtFrom: Boris Brezillon <[email protected]>
Add the dmas and dma-names properties to support HDMI audio.
--- arch/arm/boot/dts/bcm283x.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +2 -0
@@ -491,6 +491,8 @@ clocks = <&clocks BCM2835_PLLH_PIX>, <&clocks BCM2835_CLOCK_HSM>; clock-names = "pixel", "hdmi"; + dmas = <&dma 17>; + dma-names = "audio-rx"; status = "disabled"; };
Signature · 1 line
2.11.0
Quoted 9 lines · Eric Anholt
From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/[email protected]>
These are optional, but necessary for HDMI audio support.
Signed-off-by Eric Anholt <[email protected]>--- Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt | 3 +++ 1 file changed, 3 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] drm/vc4: Add HDMI audio support
In reply to Eric AnholtHi Eric,
Quoted 47 lines · On Tue, 7 Feb 2017 13:07:02 -0800 Eric Anholt <[email protected]> wrote:
drivers/gpu/drm/vc4/vc4_hdmi.c +47
-0+static int vc4_hdmi_audio_init (struct vc4_hdmi *hdmi) +{ +struct snd_soc_dai_link *dai_link = &hdmi->audio.link; +struct snd_soc_card *card = &hdmi->audio.card; +struct device *dev = &hdmi->pdev->dev; +const __be32 *addr; +int ret; + +if (!of_find_property (dev->of_node,"dmas" ,NULL )) { +dev_warn (dev, +"'dmas' DT property is missing, no HDMI audio\n" ); +return 0 ; + } + +/* +* Get the physical address of VC4_HD_MAI_DATA. We need to retrieve +* the bus address specified in the DT, because the physical address +* (the one returned by platform_get_resource()) is not appropriate +* for DMA transfers. +* This VC/MMU should probably be exposed to avoid this kind of hacks. +*/ + addr =of_get_address (dev->of_node,1 ,NULL ,NULL ); + hdmi->audio.dma_data.addr =be32_to_cpup (addr) +VC4_HD_MAI_DATA ; + hdmi->audio.dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; + hdmi->audio.dma_data.maxburst =2 ; + + ret =devm_snd_dmaengine_pcm_register (dev, &pcm_conf,0 ); +if (ret) { +dev_err (dev,"Could not register PCM component: %d\n" , ret); +return ret; + } + + ret =devm_snd_soc_register_component (dev, &vc4_hdmi_audio_cpu_dai_comp, + &vc4_hdmi_audio_cpu_dai_drv,1 ); +if (ret) { +dev_err (dev,"Could not register CPU DAI: %d\n" , ret); +return ret; + } + +/* register codec and codec dai */ + ret =snd_soc_register_codec (dev, &vc4_hdmi_audio_codec_drv, + &vc4_hdmi_audio_codec_dai_drv,1 ); +if (ret) { +dev_err (dev,"Could not register codec: %d\n" , ret); +return ret; + } +
drivers/gpu/drm/vc4/vc4_hdmi.c static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { · line 1041
Quoted 10 lines
drivers/gpu/drm/vc4/vc4_hdmi.c +10
-0+ dai_link->name ="MAI" ; + dai_link->stream_name ="MAI PCM" ; + dai_link->codec_dai_name = vc4_hdmi_audio_codec_dai_drv.name; + dai_link->cpu_dai_name =dev_name (dev); + dai_link->codec_name =dev_name (dev); + dai_link->platform_name =dev_name (dev); + + card->dai_link = dai_link; + card->num_links =1 ; + card->name ="vc4-hdmi-audio" ;
I know I'm the one who chose this name, but maybe we should just change it for "vc4-hdmi", since audio is kind of implied here ;-).