[PATCH v3 18/28] drm/vc4: hdmi: Pass the CPU physical address of MAI_DATA to the DMA engine
From: Andrea della Porta
Date: Mon Nov 23 2026 - 09:55:38 EST
The address of the DMA slave is handed to the DMA engine through the
dma_slave_config, where it is meant to be a CPU physical address that
the DMA controller driver translates into its own view of the bus. The
driver instead reads the untranslated address out of its reg property,
which only happens to be what the BCM2835 DMA controller expects because
the DMA engine driver used the address verbatim.
Now that the DMA engine driver translates slave addresses itself, use the
CPU physical address of the register resource and drop the comment
describing the old workaround.
Signed-off-by: Andrea della Porta <andrea.porta@xxxxxxxx>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 2cc46036f11d..9dc1a67aa7fd 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -47,7 +47,6 @@
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/of.h>
-#include <linux/of_address.h>
#include <linux/pm_runtime.h>
#include <linux/rational.h>
#include <linux/reset.h>
@@ -2288,7 +2287,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
struct snd_soc_dai_link *dai_link = &vc4_hdmi->audio.link;
struct snd_soc_card *card = &vc4_hdmi->audio.card;
struct device *dev = &vc4_hdmi->pdev->dev;
- const __be32 *addr;
+ struct resource *res;
int index, len;
int ret;
@@ -2324,22 +2323,19 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
}
/*
- * 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.
+ * Get the physical address of VC4_HD_MAI_DATA. The DMA engine
+ * translates it into the address its controller has to use.
*/
index = of_property_match_string(dev->of_node, "reg-names", "hd");
/* Before BCM2711, we don't have a named register range */
if (index < 0)
index = 1;
- addr = of_get_address(dev->of_node, index, NULL, NULL);
- if (!addr)
+ res = platform_get_resource(vc4_hdmi->pdev, IORESOURCE_MEM, index);
+ if (!res)
return -EINVAL;
- vc4_hdmi->audio.dma_data.addr = be32_to_cpup(addr) + mai_data->offset;
+ vc4_hdmi->audio.dma_data.addr = res->start + mai_data->offset;
vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
vc4_hdmi->audio.dma_data.maxburst = 2;
--
2.51.0