Skip to content

Commit b5f4f02

Browse files
committed
ASoC: soc-pcm: Preserve hw parameters from components in dpcm_runtime_setup_fe
Component drivers can prepare snd_pcm_hardware struct based on the hardware capabilities which information should not be discarded. Only touch the rates, channels_max and formats if they were left to 0, otherwise keep the provided configuration intact for the parameter cross checking decision. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent b250b54 commit b5f4f02

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

sound/soc/soc-pcm.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,13 +1738,21 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
17381738
struct snd_pcm_hardware *hw = &runtime->hw;
17391739
struct snd_soc_dai *dai;
17401740
int stream = substream->stream;
1741-
u64 formats = hw->formats;
17421741
int i;
17431742

1744-
soc_pcm_hw_init(hw);
1745-
1746-
if (formats)
1747-
hw->formats &= formats;
1743+
/*
1744+
* Initialize only pcm hardware patameters that has not been initialized
1745+
* and preserve the configuration which might have been provided by
1746+
* component drivers
1747+
*/
1748+
if (!hw->rates)
1749+
hw->rates = UINT_MAX;
1750+
if (!hw->rate_max)
1751+
hw->rate_max = UINT_MAX;
1752+
if (!hw->channels_max)
1753+
hw->channels_max = UINT_MAX;
1754+
if (!hw->formats)
1755+
hw->formats = ULLONG_MAX;
17481756

17491757
for_each_rtd_cpu_dais(fe, i, dai) {
17501758
const struct snd_soc_pcm_stream *cpu_stream;

0 commit comments

Comments
 (0)