summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-02-04 08:52:04 +0900
committerMark Brown <broonie@kernel.org>2021-02-12 12:36:45 +0000
commitdebc71f26cdbd45798c63b0dcdabdea93d2f6870 (patch)
treeab15ff0be3840fb88c36440d39b53ecfa1a760f6 /sound/soc
parent6cb56a4549e9e2e0f7f67b99cb1887c0e803245a (diff)
ASoC: soc-pcm: add soc_pcm_hw_update_format()
We have soc_pcm_hw_update_xxx() now. This patch creates same function for format. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/87pn1g90oa.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-pcm.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 23d6709a295d..b7c90da1820e 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -480,6 +480,7 @@ static void soc_pcm_hw_init(struct snd_pcm_hardware *hw)
hw->rate_max = UINT_MAX;
hw->channels_min = 0;
hw->channels_max = UINT_MAX;
+ hw->formats = ULLONG_MAX;
}
static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw,
@@ -502,6 +503,12 @@ static void soc_pcm_hw_update_chan(struct snd_pcm_hardware *hw,
hw->channels_max = min(hw->channels_max, p->channels_max);
}
+static void soc_pcm_hw_update_format(struct snd_pcm_hardware *hw,
+ struct snd_soc_pcm_stream *p)
+{
+ hw->formats &= p->formats;
+}
+
/**
* snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
* @rtd: ASoC PCM runtime
@@ -519,7 +526,6 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_pcm_stream *codec_stream;
struct snd_soc_pcm_stream *cpu_stream;
unsigned int cpu_chan_min = 0, cpu_chan_max = UINT_MAX;
- u64 formats = ULLONG_MAX;
int i;
soc_pcm_hw_init(hw);
@@ -540,7 +546,7 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
soc_pcm_hw_update_chan(hw, cpu_stream);
soc_pcm_hw_update_rate(hw, cpu_stream);
- formats &= cpu_stream->formats;
+ soc_pcm_hw_update_format(hw, cpu_stream);
}
cpu_chan_min = hw->channels_min;
cpu_chan_max = hw->channels_max;
@@ -561,7 +567,7 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
soc_pcm_hw_update_chan(hw, codec_stream);
soc_pcm_hw_update_rate(hw, codec_stream);
- formats &= codec_stream->formats;
+ soc_pcm_hw_update_format(hw, codec_stream);
}
/* Verify both a valid CPU DAI and a valid CODEC DAI were found */
@@ -578,9 +584,6 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
hw->channels_max = cpu_chan_max;
}
- /* finally find a intersection between CODECs and CPUs */
- hw->formats = formats;
-
return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_runtime_calc_hw);
@@ -1568,7 +1571,7 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
codec_stream = snd_soc_dai_get_pcm_stream(dai, stream);
- hw->formats &= codec_stream->formats;
+ soc_pcm_hw_update_format(hw, codec_stream);
}
}
}