mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
Mark Brown
parent
7a381e373a
commit
6d34b66fb7
@@ -570,14 +570,26 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
|
|||||||
soc_pcm_set_msb(substream, cpu_bits);
|
soc_pcm_set_msb(substream, cpu_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void soc_pcm_hw_init(struct snd_pcm_hardware *hw)
|
static void soc_pcm_hw_init(struct snd_pcm_hardware *hw, bool force)
|
||||||
{
|
{
|
||||||
hw->rates = UINT_MAX;
|
if (force) {
|
||||||
hw->rate_min = 0;
|
hw->rates = UINT_MAX;
|
||||||
hw->rate_max = UINT_MAX;
|
hw->rate_min = 0;
|
||||||
hw->channels_min = 0;
|
hw->rate_max = UINT_MAX;
|
||||||
hw->channels_max = UINT_MAX;
|
hw->channels_min = 0;
|
||||||
hw->formats = ULLONG_MAX;
|
hw->channels_max = UINT_MAX;
|
||||||
|
hw->formats = ULLONG_MAX;
|
||||||
|
} else {
|
||||||
|
/* Preserve initialized parameters */
|
||||||
|
if (!hw->rates)
|
||||||
|
hw->rates = UINT_MAX;
|
||||||
|
if (!hw->rate_max)
|
||||||
|
hw->rate_max = UINT_MAX;
|
||||||
|
if (!hw->channels_max)
|
||||||
|
hw->channels_max = UINT_MAX;
|
||||||
|
if (!hw->formats)
|
||||||
|
hw->formats = ULLONG_MAX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw,
|
static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw,
|
||||||
@@ -626,7 +638,7 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
|
|||||||
unsigned int cpu_chan_min = 0, cpu_chan_max = UINT_MAX;
|
unsigned int cpu_chan_min = 0, cpu_chan_max = UINT_MAX;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
soc_pcm_hw_init(hw);
|
soc_pcm_hw_init(hw, true);
|
||||||
|
|
||||||
/* first calculate min/max only for CPUs in the DAI link */
|
/* first calculate min/max only for CPUs in the DAI link */
|
||||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||||
@@ -1738,13 +1750,9 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
|
|||||||
struct snd_pcm_hardware *hw = &runtime->hw;
|
struct snd_pcm_hardware *hw = &runtime->hw;
|
||||||
struct snd_soc_dai *dai;
|
struct snd_soc_dai *dai;
|
||||||
int stream = substream->stream;
|
int stream = substream->stream;
|
||||||
u64 formats = hw->formats;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
soc_pcm_hw_init(hw);
|
soc_pcm_hw_init(hw, false);
|
||||||
|
|
||||||
if (formats)
|
|
||||||
hw->formats &= formats;
|
|
||||||
|
|
||||||
for_each_rtd_cpu_dais(fe, i, dai) {
|
for_each_rtd_cpu_dais(fe, i, dai) {
|
||||||
const struct snd_soc_pcm_stream *cpu_stream;
|
const struct snd_soc_pcm_stream *cpu_stream;
|
||||||
|
|||||||
Reference in New Issue
Block a user