forked from Minki/linux
ASoC: mxs-sgtl5000: Use static DAI format setup
Set the dai_fmt field in the dai_link struct instead of manually calling snd_soc_dai_fmt(). This makes the code cleaner and shorter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
734890a6c9
commit
bc6a5d649b
@ -36,7 +36,7 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
unsigned int rate = params_rate(params);
|
||||
u32 dai_format, mclk;
|
||||
u32 mclk;
|
||||
int ret;
|
||||
|
||||
/* sgtl5000 does not support 512*rate when in 96000 fs */
|
||||
@ -65,26 +65,6 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set codec to slave mode */
|
||||
dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, dai_format);
|
||||
if (ret) {
|
||||
dev_err(codec_dai->dev, "Failed to set dai format to %08x\n",
|
||||
dai_format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
|
||||
if (ret) {
|
||||
dev_err(cpu_dai->dev, "Failed to set dai format to %08x\n",
|
||||
dai_format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,17 +72,22 @@ static struct snd_soc_ops mxs_sgtl5000_hifi_ops = {
|
||||
.hw_params = mxs_sgtl5000_hw_params,
|
||||
};
|
||||
|
||||
#define MXS_SGTL5000_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
|
||||
SND_SOC_DAIFMT_CBS_CFS)
|
||||
|
||||
static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
|
||||
{
|
||||
.name = "HiFi Tx",
|
||||
.stream_name = "HiFi Playback",
|
||||
.codec_dai_name = "sgtl5000",
|
||||
.dai_fmt = MXS_SGTL5000_DAI_FMT,
|
||||
.ops = &mxs_sgtl5000_hifi_ops,
|
||||
.playback_only = true,
|
||||
}, {
|
||||
.name = "HiFi Rx",
|
||||
.stream_name = "HiFi Capture",
|
||||
.codec_dai_name = "sgtl5000",
|
||||
.dai_fmt = MXS_SGTL5000_DAI_FMT,
|
||||
.ops = &mxs_sgtl5000_hifi_ops,
|
||||
.capture_only = true,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user