aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/sdp4430.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/sdp4430.c')
-rw-r--r--sound/soc/omap/sdp4430.c86
1 files changed, 75 insertions, 11 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 03d9fa4192f..175ba9a04ed 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -33,6 +33,7 @@
33#include <plat/hardware.h> 33#include <plat/hardware.h>
34#include <plat/mux.h> 34#include <plat/mux.h>
35 35
36#include "omap-dmic.h"
36#include "omap-mcpdm.h" 37#include "omap-mcpdm.h"
37#include "omap-pcm.h" 38#include "omap-pcm.h"
38#include "../codecs/twl6040.h" 39#include "../codecs/twl6040.h"
@@ -67,6 +68,32 @@ static struct snd_soc_ops sdp4430_ops = {
67 .hw_params = sdp4430_hw_params, 68 .hw_params = sdp4430_hw_params,
68}; 69};
69 70
71static int sdp4430_dmic_hw_params(struct snd_pcm_substream *substream,
72 struct snd_pcm_hw_params *params)
73{
74 struct snd_soc_pcm_runtime *rtd = substream->private_data;
75 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
76 int ret = 0;
77
78 ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_SYSCLK_PAD_CLKS,
79 19200000, SND_SOC_CLOCK_IN);
80 if (ret < 0) {
81 printk(KERN_ERR "can't set DMIC cpu system clock\n");
82 return ret;
83 }
84 ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_ABE_DMIC_CLK, 2400000,
85 SND_SOC_CLOCK_OUT);
86 if (ret < 0) {
87 printk(KERN_ERR "can't set DMIC output clock\n");
88 return ret;
89 }
90 return 0;
91}
92
93static struct snd_soc_ops sdp4430_dmic_ops = {
94 .hw_params = sdp4430_dmic_hw_params,
95};
96
70/* Headset jack */ 97/* Headset jack */
71static struct snd_soc_jack hs_jack; 98static struct snd_soc_jack hs_jack;
72 99
@@ -148,23 +175,60 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
148 return ret; 175 return ret;
149} 176}
150 177
178static const struct snd_soc_dapm_widget sdp4430_dmic_dapm_widgets[] = {
179 SND_SOC_DAPM_MIC("Digital Mic", NULL),
180};
181
182static const struct snd_soc_dapm_route dmic_audio_map[] = {
183 {"DMic", NULL, "Digital Mic1 Bias"},
184 {"Digital Mic1 Bias", NULL, "Digital Mic"},
185};
186
187static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd)
188{
189 struct snd_soc_codec *codec = rtd->codec;
190 struct snd_soc_dapm_context *dapm = &codec->dapm;
191 int ret;
192
193 ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets,
194 ARRAY_SIZE(sdp4430_dmic_dapm_widgets));
195 if (ret)
196 return ret;
197
198 return snd_soc_dapm_add_routes(dapm, dmic_audio_map,
199 ARRAY_SIZE(dmic_audio_map));
200}
201
151/* Digital audio interface glue - connects codec <--> CPU */ 202/* Digital audio interface glue - connects codec <--> CPU */
152static struct snd_soc_dai_link sdp4430_dai = { 203static struct snd_soc_dai_link sdp4430_dai[] = {
153 .name = "TWL6040", 204 {
154 .stream_name = "TWL6040", 205 .name = "TWL6040",
155 .cpu_dai_name = "omap-mcpdm", 206 .stream_name = "TWL6040",
156 .codec_dai_name = "twl6040-legacy", 207 .cpu_dai_name = "omap-mcpdm",
157 .platform_name = "omap-pcm-audio", 208 .codec_dai_name = "twl6040-legacy",
158 .codec_name = "twl6040-codec", 209 .platform_name = "omap-pcm-audio",
159 .init = sdp4430_twl6040_init, 210 .codec_name = "twl6040-codec",
160 .ops = &sdp4430_ops, 211 .init = sdp4430_twl6040_init,
212 .ops = &sdp4430_ops,
213 },
214 {
215 .name = "DMIC",
216 .stream_name = "DMIC Capture",
217 .cpu_dai_name = "omap-dmic",
218 .codec_dai_name = "dmic-hifi",
219 .platform_name = "omap-pcm-audio",
220 .codec_name = "dmic-codec",
221 .init = sdp4430_dmic_init,
222 .ops = &sdp4430_dmic_ops,
223 },
161}; 224};
162 225
163/* Audio machine driver */ 226/* Audio machine driver */
164static struct snd_soc_card snd_soc_sdp4430 = { 227static struct snd_soc_card snd_soc_sdp4430 = {
165 .name = "SDP4430", 228 .name = "SDP4430",
166 .dai_link = &sdp4430_dai, 229 .owner = THIS_MODULE,
167 .num_links = 1, 230 .dai_link = sdp4430_dai,
231 .num_links = ARRAY_SIZE(sdp4430_dai),
168 232
169 .dapm_widgets = sdp4430_twl6040_dapm_widgets, 233 .dapm_widgets = sdp4430_twl6040_dapm_widgets,
170 .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets), 234 .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets),