mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
ASoC: soc-pcm: add soc_pcm_update_symmetry()
Current soc-pcm has soc_pcm_has_symmetry() and using it as if (soc_pcm_has_symmetry(substream)) substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX; We want to share same operation as same function. This patch adds soc_pcm_update_symmetry() and pack above code in one function. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87ft15uob6.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
56e749ba75
commit
68cbc55737
1 changed files with 6 additions and 8 deletions
|
@ -410,7 +410,7 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
|
static void soc_pcm_update_symmetry(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||||
struct snd_soc_dai_link *link = rtd->dai_link;
|
struct snd_soc_dai_link *link = rtd->dai_link;
|
||||||
|
@ -427,7 +427,8 @@ static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
|
||||||
dai->driver->symmetric_channels ||
|
dai->driver->symmetric_channels ||
|
||||||
dai->driver->symmetric_sample_bits;
|
dai->driver->symmetric_sample_bits;
|
||||||
|
|
||||||
return symmetry;
|
if (symmetry)
|
||||||
|
substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
|
static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
|
||||||
|
@ -739,8 +740,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
|
||||||
/* Check that the codec and cpu DAIs are compatible */
|
/* Check that the codec and cpu DAIs are compatible */
|
||||||
soc_pcm_init_runtime_hw(substream);
|
soc_pcm_init_runtime_hw(substream);
|
||||||
|
|
||||||
if (soc_pcm_has_symmetry(substream))
|
soc_pcm_update_symmetry(substream);
|
||||||
runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX;
|
|
||||||
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
if (!runtime->hw.rates) {
|
if (!runtime->hw.rates) {
|
||||||
|
@ -1685,8 +1685,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* apply symmetry for FE */
|
/* apply symmetry for FE */
|
||||||
if (soc_pcm_has_symmetry(fe_substream))
|
soc_pcm_update_symmetry(fe_substream);
|
||||||
fe_substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX;
|
|
||||||
|
|
||||||
for_each_rtd_cpu_dais (fe, i, fe_cpu_dai) {
|
for_each_rtd_cpu_dais (fe, i, fe_cpu_dai) {
|
||||||
/* Symmetry only applies if we've got an active stream. */
|
/* Symmetry only applies if we've got an active stream. */
|
||||||
|
@ -1711,8 +1710,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
|
||||||
if (rtd->dai_link->be_hw_params_fixup)
|
if (rtd->dai_link->be_hw_params_fixup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (soc_pcm_has_symmetry(be_substream))
|
soc_pcm_update_symmetry(be_substream);
|
||||||
be_substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX;
|
|
||||||
|
|
||||||
/* Symmetry only applies if we've got an active stream. */
|
/* Symmetry only applies if we've got an active stream. */
|
||||||
for_each_rtd_dais(rtd, i, dai) {
|
for_each_rtd_dais(rtd, i, dai) {
|
||||||
|
|
Loading…
Reference in a new issue