Skip to content

Commit

Permalink
drm/vc4: Use phys addresses for slave DMA config
Browse files Browse the repository at this point in the history
Slave addresses for DMA are meant to be supplied as physical addresses
(contrary to what struct snd_dmaengine_dai_dma_data does).

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
pelwell authored and popcornmix committed Jun 17, 2024
1 parent 3c57a98 commit fbd8b3f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions drivers/gpu/drm/vc4/vc4_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2744,7 +2744,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
struct snd_soc_card *card = &vc4_hdmi->audio.card;
struct device *dev = &vc4_hdmi->pdev->dev;
struct platform_device *codec_pdev;
const __be32 *addr;
struct resource *iomem;
int index, len;
int ret;

Expand Down Expand Up @@ -2780,22 +2780,17 @@ 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.
*/
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)
iomem = platform_get_resource(vc4_hdmi->pdev, IORESOURCE_MEM, index);
if (!iomem)
return -EINVAL;

vc4_hdmi->audio.dma_data.addr = be32_to_cpup(addr) + mai_data->offset;
vc4_hdmi->audio.dma_data.addr = iomem->start + mai_data->offset;
vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
vc4_hdmi->audio.dma_data.maxburst = 2;

Expand Down

0 comments on commit fbd8b3f

Please sign in to comment.