Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>
Link: https://patch.msgid.link/20251029073600.13624-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Peter Ujfalusi and committed by
Mark Brown
6d34b66f 7a381e37

+21 -13
+21 -13
sound/soc/soc-pcm.c
··· 570 570 soc_pcm_set_msb(substream, cpu_bits); 571 571 } 572 572 573 - static void soc_pcm_hw_init(struct snd_pcm_hardware *hw) 573 + static void soc_pcm_hw_init(struct snd_pcm_hardware *hw, bool force) 574 574 { 575 - hw->rates = UINT_MAX; 576 - hw->rate_min = 0; 577 - hw->rate_max = UINT_MAX; 578 - hw->channels_min = 0; 579 - hw->channels_max = UINT_MAX; 580 - hw->formats = ULLONG_MAX; 575 + if (force) { 576 + hw->rates = UINT_MAX; 577 + hw->rate_min = 0; 578 + hw->rate_max = UINT_MAX; 579 + hw->channels_min = 0; 580 + hw->channels_max = UINT_MAX; 581 + hw->formats = ULLONG_MAX; 582 + } else { 583 + /* Preserve initialized parameters */ 584 + if (!hw->rates) 585 + hw->rates = UINT_MAX; 586 + if (!hw->rate_max) 587 + hw->rate_max = UINT_MAX; 588 + if (!hw->channels_max) 589 + hw->channels_max = UINT_MAX; 590 + if (!hw->formats) 591 + hw->formats = ULLONG_MAX; 592 + } 581 593 } 582 594 583 595 static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw, ··· 638 626 unsigned int cpu_chan_min = 0, cpu_chan_max = UINT_MAX; 639 627 int i; 640 628 641 - soc_pcm_hw_init(hw); 629 + soc_pcm_hw_init(hw, true); 642 630 643 631 /* first calculate min/max only for CPUs in the DAI link */ 644 632 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { ··· 1750 1738 struct snd_pcm_hardware *hw = &runtime->hw; 1751 1739 struct snd_soc_dai *dai; 1752 1740 int stream = substream->stream; 1753 - u64 formats = hw->formats; 1754 1741 int i; 1755 1742 1756 - soc_pcm_hw_init(hw); 1757 - 1758 - if (formats) 1759 - hw->formats &= formats; 1743 + soc_pcm_hw_init(hw, false); 1760 1744 1761 1745 for_each_rtd_cpu_dais(fe, i, dai) { 1762 1746 const struct snd_soc_pcm_stream *cpu_stream;