imx-audmix.c (815b55e1101f074e737c084e996d086dcb454399) imx-audmix.c (bf101022487091032fd8102c835b1157b8283c43)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2017 NXP
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *

--- 66 unchanged lines hidden (view full) ---

75{
76 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
77 struct device *dev = rtd->card->dev;
78 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
79 unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
80 u32 channels = params_channels(params);
81 int ret, dir;
82
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2017 NXP
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *

--- 66 unchanged lines hidden (view full) ---

75{
76 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
77 struct device *dev = rtd->card->dev;
78 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
79 unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
80 u32 channels = params_channels(params);
81 int ret, dir;
82
83 /* For playback the AUDMIX is slave, and for record is master */
84 fmt |= tx ? SND_SOC_DAIFMT_CBS_CFS : SND_SOC_DAIFMT_CBM_CFM;
83 /* For playback the AUDMIX is consumer, and for record is provider */
84 fmt |= tx ? SND_SOC_DAIFMT_CBC_CFC : SND_SOC_DAIFMT_CBP_CFP;
85 dir = tx ? SND_SOC_CLOCK_OUT : SND_SOC_CLOCK_IN;
86
87 /* set DAI configuration */
88 ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
89 if (ret) {
90 dev_err(dev, "failed to set cpu dai fmt: %d\n", ret);
91 return ret;
92 }

--- 23 unchanged lines hidden (view full) ---

116 struct device *dev = rtd->card->dev;
117 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
118 unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
119 int ret;
120
121 if (!tx)
122 return 0;
123
85 dir = tx ? SND_SOC_CLOCK_OUT : SND_SOC_CLOCK_IN;
86
87 /* set DAI configuration */
88 ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
89 if (ret) {
90 dev_err(dev, "failed to set cpu dai fmt: %d\n", ret);
91 return ret;
92 }

--- 23 unchanged lines hidden (view full) ---

116 struct device *dev = rtd->card->dev;
117 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
118 unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
119 int ret;
120
121 if (!tx)
122 return 0;
123
124 /* For playback the AUDMIX is slave */
125 fmt |= SND_SOC_DAIFMT_CBM_CFM;
124 /* For playback the AUDMIX is consumer */
125 fmt |= SND_SOC_DAIFMT_CBP_CFP;
126
127 /* set AUDMIX DAI configuration */
128 ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
129 if (ret)
130 dev_err(dev, "failed to set AUDMIX DAI fmt: %d\n", ret);
131
132 return ret;
133}

--- 221 unchanged lines hidden ---
126
127 /* set AUDMIX DAI configuration */
128 ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
129 if (ret)
130 dev_err(dev, "failed to set AUDMIX DAI fmt: %d\n", ret);
131
132 return ret;
133}

--- 221 unchanged lines hidden ---