aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-01-01 11:16:15 -0500
committerMark Brown <broonie@kernel.org>2015-01-06 12:34:27 -0500
commitbc6a5d649bda56c579853bfe710db88bf38da522 (patch)
tree742bdf4117a395add8a783219de35b37d4a7fff5
parent734890a6c99ee81b935164963c03fc8bbf3f821b (diff)
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>
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 6f1916b71815..6e6fce6a14ba 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -36,7 +36,7 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
36 struct snd_soc_dai *codec_dai = rtd->codec_dai; 36 struct snd_soc_dai *codec_dai = rtd->codec_dai;
37 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 37 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
38 unsigned int rate = params_rate(params); 38 unsigned int rate = params_rate(params);
39 u32 dai_format, mclk; 39 u32 mclk;
40 int ret; 40 int ret;
41 41
42 /* sgtl5000 does not support 512*rate when in 96000 fs */ 42 /* 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,
65 return ret; 65 return ret;
66 } 66 }
67 67
68 /* set codec to slave mode */
69 dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
70 SND_SOC_DAIFMT_CBS_CFS;
71
72 /* set codec DAI configuration */
73 ret = snd_soc_dai_set_fmt(codec_dai, dai_format);
74 if (ret) {
75 dev_err(codec_dai->dev, "Failed to set dai format to %08x\n",
76 dai_format);
77 return ret;
78 }
79
80 /* set cpu DAI configuration */
81 ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
82 if (ret) {
83 dev_err(cpu_dai->dev, "Failed to set dai format to %08x\n",
84 dai_format);
85 return ret;
86 }
87
88 return 0; 68 return 0;
89} 69}
90 70
@@ -92,17 +72,22 @@ static struct snd_soc_ops mxs_sgtl5000_hifi_ops = {
92 .hw_params = mxs_sgtl5000_hw_params, 72 .hw_params = mxs_sgtl5000_hw_params,
93}; 73};
94 74
75#define MXS_SGTL5000_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
76 SND_SOC_DAIFMT_CBS_CFS)
77
95static struct snd_soc_dai_link mxs_sgtl5000_dai[] = { 78static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
96 { 79 {
97 .name = "HiFi Tx", 80 .name = "HiFi Tx",
98 .stream_name = "HiFi Playback", 81 .stream_name = "HiFi Playback",
99 .codec_dai_name = "sgtl5000", 82 .codec_dai_name = "sgtl5000",
83 .dai_fmt = MXS_SGTL5000_DAI_FMT,
100 .ops = &mxs_sgtl5000_hifi_ops, 84 .ops = &mxs_sgtl5000_hifi_ops,
101 .playback_only = true, 85 .playback_only = true,
102 }, { 86 }, {
103 .name = "HiFi Rx", 87 .name = "HiFi Rx",
104 .stream_name = "HiFi Capture", 88 .stream_name = "HiFi Capture",
105 .codec_dai_name = "sgtl5000", 89 .codec_dai_name = "sgtl5000",
90 .dai_fmt = MXS_SGTL5000_DAI_FMT,
106 .ops = &mxs_sgtl5000_hifi_ops, 91 .ops = &mxs_sgtl5000_hifi_ops,
107 .capture_only = true, 92 .capture_only = true,
108 }, 93 },