Skip to content

Commit

Permalink
ASoC: amd: Fix reference to PCM buffer address
Browse files Browse the repository at this point in the history
PCM buffers might be allocated dynamically when the buffer
preallocation failed or a larger buffer is requested, and it's not
guaranteed that substream->dma_buffer points to the actually used
buffer.  The driver needs to refer to substream->runtime->dma_addr
instead for the buffer address.

Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
tiwai authored and broonie committed Aug 2, 2021
1 parent 1d25684 commit 8b5d953
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sound/soc/amd/acp-pcm-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component,

acp_set_sram_bank_state(rtd->acp_mmio, 0, true);
/* Save for runtime private data */
rtd->dma_addr = substream->dma_buffer.addr;
rtd->dma_addr = runtime->dma_addr;
rtd->order = get_order(size);

/* Fill the page table entries in ACP SRAM */
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/amd/raven/acp3x-pcm-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component,
pr_err("pinfo failed\n");
}
size = params_buffer_bytes(params);
rtd->dma_addr = substream->dma_buffer.addr;
rtd->dma_addr = substream->runtime->dma_addr;
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
config_acp3x_dma(rtd, substream->stream);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/amd/renoir/acp3x-pdm-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
return -EINVAL;
size = params_buffer_bytes(params);
period_bytes = params_period_bytes(params);
rtd->dma_addr = substream->dma_buffer.addr;
rtd->dma_addr = substream->runtime->dma_addr;
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
config_acp_dma(rtd, substream->stream);
init_pdm_ring_buffer(MEM_WINDOW_START, size, period_bytes,
Expand Down

0 comments on commit 8b5d953

Please sign in to comment.