Commit 2e6b8363 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown

ASoC: intel: atom: Fix reference to PCM buffer address

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 address should be retrieved from runtime->dma_addr,
instead of substream->dma_buffer (and shouldn't use virt_to_phys).

Also, remove the line overriding runtime->dma_area superfluously,
which was already set up at the PCM buffer allocation.

Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210728112353.6675-3-tiwai@suse.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 926ef1a4
...@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream, ...@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,
snd_pcm_uframes_t period_size; snd_pcm_uframes_t period_size;
ssize_t periodbytes; ssize_t periodbytes;
ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream); ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
u32 buffer_addr = virt_to_phys(substream->dma_buffer.area); u32 buffer_addr = substream->runtime->dma_addr;
channels = substream->runtime->channels; channels = substream->runtime->channels;
period_size = substream->runtime->period_size; period_size = substream->runtime->period_size;
...@@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream, ...@@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
/* set codec params and inform SST driver the same */ /* set codec params and inform SST driver the same */
sst_fill_pcm_params(substream, &param); sst_fill_pcm_params(substream, &param);
sst_fill_alloc_params(substream, &alloc_params); sst_fill_alloc_params(substream, &alloc_params);
substream->runtime->dma_area = substream->dma_buffer.area;
str_params.sparams = param; str_params.sparams = param;
str_params.aparams = alloc_params; str_params.aparams = alloc_params;
str_params.codec = SST_CODEC_TYPE_PCM; str_params.codec = SST_CODEC_TYPE_PCM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment