aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-01-01 11:16:27 -0500
committerMark Brown <broonie@kernel.org>2015-01-06 12:34:31 -0500
commit7a57ca2362a55c34b96d90539dd8b7cb6c1c09a1 (patch)
treed3cbd80af379318044f82152a136128e65ee28ba
parent10756c2770d7f4758e36d2a9e37ff2637001d610 (diff)
ASoC: smdk_wm8580: 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/samsung/smdk_wm8580.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c
index b1a519f83b29..17a2f717ec02 100644
--- a/sound/soc/samsung/smdk_wm8580.c
+++ b/sound/soc/samsung/smdk_wm8580.c
@@ -32,7 +32,6 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
32 struct snd_pcm_hw_params *params) 32 struct snd_pcm_hw_params *params)
33{ 33{
34 struct snd_soc_pcm_runtime *rtd = substream->private_data; 34 struct snd_soc_pcm_runtime *rtd = substream->private_data;
35 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
36 struct snd_soc_dai *codec_dai = rtd->codec_dai; 35 struct snd_soc_dai *codec_dai = rtd->codec_dai;
37 unsigned int pll_out; 36 unsigned int pll_out;
38 int bfs, rfs, ret; 37 int bfs, rfs, ret;
@@ -77,20 +76,6 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
77 } 76 }
78 pll_out = params_rate(params) * rfs; 77 pll_out = params_rate(params) * rfs;
79 78
80 /* Set the Codec DAI configuration */
81 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
82 | SND_SOC_DAIFMT_NB_NF
83 | SND_SOC_DAIFMT_CBM_CFM);
84 if (ret < 0)
85 return ret;
86
87 /* Set the AP DAI configuration */
88 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
89 | SND_SOC_DAIFMT_NB_NF
90 | SND_SOC_DAIFMT_CBM_CFM);
91 if (ret < 0)
92 return ret;
93
94 /* Set WM8580 to drive MCLK from its PLLA */ 79 /* Set WM8580 to drive MCLK from its PLLA */
95 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_MCLK, 80 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_MCLK,
96 WM8580_CLKSRC_PLLA); 81 WM8580_CLKSRC_PLLA);
@@ -168,6 +153,9 @@ enum {
168 SEC_PLAYBACK, 153 SEC_PLAYBACK,
169}; 154};
170 155
156#define SMDK_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
157 SND_SOC_DAIFMT_CBM_CFM)
158
171static struct snd_soc_dai_link smdk_dai[] = { 159static struct snd_soc_dai_link smdk_dai[] = {
172 [PRI_PLAYBACK] = { /* Primary Playback i/f */ 160 [PRI_PLAYBACK] = { /* Primary Playback i/f */
173 .name = "WM8580 PAIF RX", 161 .name = "WM8580 PAIF RX",
@@ -176,6 +164,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
176 .codec_dai_name = "wm8580-hifi-playback", 164 .codec_dai_name = "wm8580-hifi-playback",
177 .platform_name = "samsung-i2s.0", 165 .platform_name = "samsung-i2s.0",
178 .codec_name = "wm8580.0-001b", 166 .codec_name = "wm8580.0-001b",
167 .dai_fmt = SMDK_DAI_FMT,
179 .ops = &smdk_ops, 168 .ops = &smdk_ops,
180 }, 169 },
181 [PRI_CAPTURE] = { /* Primary Capture i/f */ 170 [PRI_CAPTURE] = { /* Primary Capture i/f */
@@ -185,6 +174,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
185 .codec_dai_name = "wm8580-hifi-capture", 174 .codec_dai_name = "wm8580-hifi-capture",
186 .platform_name = "samsung-i2s.0", 175 .platform_name = "samsung-i2s.0",
187 .codec_name = "wm8580.0-001b", 176 .codec_name = "wm8580.0-001b",
177 .dai_fmt = SMDK_DAI_FMT,
188 .init = smdk_wm8580_init_paiftx, 178 .init = smdk_wm8580_init_paiftx,
189 .ops = &smdk_ops, 179 .ops = &smdk_ops,
190 }, 180 },
@@ -195,6 +185,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
195 .codec_dai_name = "wm8580-hifi-playback", 185 .codec_dai_name = "wm8580-hifi-playback",
196 .platform_name = "samsung-i2s-sec", 186 .platform_name = "samsung-i2s-sec",
197 .codec_name = "wm8580.0-001b", 187 .codec_name = "wm8580.0-001b",
188 .dai_fmt = SMDK_DAI_FMT,
198 .ops = &smdk_ops, 189 .ops = &smdk_ops,
199 }, 190 },
200}; 191};