Skip to content

Commit e0481a4

Browse files
committed
ASoC: soc-pcm: Allocate be_substream->runtime for compressed streams
With DPCM when compr is used on FE side, the BE is still running as 'normal' PCM. It is expected that the be_substream->runtime on the BE is not NULL, for example some codec drivers expect to have the substream->runtime valid, to store configuration for example. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent ec0e6c6 commit e0481a4

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

sound/soc/soc-pcm.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,8 @@ void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream,
16711671
}
16721672

16731673
__soc_pcm_close(be, be_substream);
1674+
if (fe->fe_compr)
1675+
kfree(be_substream->runtime);
16741676
be_substream->runtime = NULL;
16751677
be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
16761678
}
@@ -1718,7 +1720,16 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
17181720
dev_dbg(be->dev, "ASoC: open %s BE %s\n",
17191721
snd_pcm_direction_name(stream), be->dai_link->name);
17201722

1721-
be_substream->runtime = fe_substream->runtime;
1723+
if (!fe->fe_compr) {
1724+
be_substream->runtime = fe_substream->runtime;
1725+
} else {
1726+
be_substream->runtime = kzalloc(sizeof(*be_substream->runtime), GFP_KERNEL);
1727+
if (!be_substream->runtime) {
1728+
err = -ENOMEM;
1729+
goto unwind;
1730+
}
1731+
}
1732+
17221733
err = __soc_pcm_open(be, be_substream);
17231734
if (err < 0) {
17241735
be->dpcm[stream].users--;

0 commit comments

Comments
 (0)