forked from Minki/linux
ASoC: kirkwood: Fix reference to PCM buffer address
The transition to the managed PCM buffers allowed the dynamically
buffer allocation, while the driver code still assumes the fixed
preallocation buffer and sets up the DMA stuff at the open call.
This needs to be moved to hw_params after the buffer allocation and
setup. Also, the reference to the buffer address has to be corrected
to runtime->dma_addr.
Fixes: b3c0ae75f5
("ASoC: kirkwood: Use managed DMA buffer allocation")
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210728112353.6675-6-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
827f3164aa
commit
bb6a40fc5a
@ -104,8 +104,6 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
|
||||
int err;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
|
||||
const struct mbus_dram_target_info *dram;
|
||||
unsigned long addr;
|
||||
|
||||
snd_soc_set_runtime_hwparams(substream, &kirkwood_dma_snd_hw);
|
||||
|
||||
@ -142,20 +140,14 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
|
||||
writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK);
|
||||
}
|
||||
|
||||
dram = mv_mbus_dram_info();
|
||||
addr = substream->dma_buffer.addr;
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
if (priv->substream_play)
|
||||
return -EBUSY;
|
||||
priv->substream_play = substream;
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_PLAYBACK_WIN, addr, dram);
|
||||
} else {
|
||||
if (priv->substream_rec)
|
||||
return -EBUSY;
|
||||
priv->substream_rec = substream;
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_RECORD_WIN, addr, dram);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -182,6 +174,23 @@ static int kirkwood_dma_close(struct snd_soc_component *component,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirkwood_dma_hw_params(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
|
||||
const struct mbus_dram_target_info *dram = mv_mbus_dram_info();
|
||||
unsigned long addr = substream->runtime->dma_addr;
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_PLAYBACK_WIN, addr, dram);
|
||||
else
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_RECORD_WIN, addr, dram);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirkwood_dma_prepare(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
@ -246,6 +255,7 @@ const struct snd_soc_component_driver kirkwood_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.open = kirkwood_dma_open,
|
||||
.close = kirkwood_dma_close,
|
||||
.hw_params = kirkwood_dma_hw_params,
|
||||
.prepare = kirkwood_dma_prepare,
|
||||
.pointer = kirkwood_dma_pointer,
|
||||
.pcm_construct = kirkwood_dma_new,
|
||||
|
Loading…
Reference in New Issue
Block a user