aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/sdp3430.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/sdp3430.c')
-rw-r--r--sound/soc/omap/sdp3430.c88
1 files changed, 10 insertions, 78 deletions
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 9f6a758029d1..4f1969de91a7 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -53,29 +53,8 @@ static int sdp3430_hw_params(struct snd_pcm_substream *substream,
53{ 53{
54 struct snd_soc_pcm_runtime *rtd = substream->private_data; 54 struct snd_soc_pcm_runtime *rtd = substream->private_data;
55 struct snd_soc_dai *codec_dai = rtd->codec_dai; 55 struct snd_soc_dai *codec_dai = rtd->codec_dai;
56 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
57 int ret; 56 int ret;
58 57
59 /* Set codec DAI configuration */
60 ret = snd_soc_dai_set_fmt(codec_dai,
61 SND_SOC_DAIFMT_I2S |
62 SND_SOC_DAIFMT_NB_NF |
63 SND_SOC_DAIFMT_CBM_CFM);
64 if (ret < 0) {
65 printk(KERN_ERR "can't set codec DAI configuration\n");
66 return ret;
67 }
68
69 /* Set cpu DAI configuration */
70 ret = snd_soc_dai_set_fmt(cpu_dai,
71 SND_SOC_DAIFMT_I2S |
72 SND_SOC_DAIFMT_NB_NF |
73 SND_SOC_DAIFMT_CBM_CFM);
74 if (ret < 0) {
75 printk(KERN_ERR "can't set cpu DAI configuration\n");
76 return ret;
77 }
78
79 /* Set the codec system clock for DAC and ADC */ 58 /* Set the codec system clock for DAC and ADC */
80 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000, 59 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
81 SND_SOC_CLOCK_IN); 60 SND_SOC_CLOCK_IN);
@@ -91,49 +70,6 @@ static struct snd_soc_ops sdp3430_ops = {
91 .hw_params = sdp3430_hw_params, 70 .hw_params = sdp3430_hw_params,
92}; 71};
93 72
94static int sdp3430_hw_voice_params(struct snd_pcm_substream *substream,
95 struct snd_pcm_hw_params *params)
96{
97 struct snd_soc_pcm_runtime *rtd = substream->private_data;
98 struct snd_soc_dai *codec_dai = rtd->codec_dai;
99 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
100 int ret;
101
102 /* Set codec DAI configuration */
103 ret = snd_soc_dai_set_fmt(codec_dai,
104 SND_SOC_DAIFMT_DSP_A |
105 SND_SOC_DAIFMT_IB_NF |
106 SND_SOC_DAIFMT_CBM_CFM);
107 if (ret) {
108 printk(KERN_ERR "can't set codec DAI configuration\n");
109 return ret;
110 }
111
112 /* Set cpu DAI configuration */
113 ret = snd_soc_dai_set_fmt(cpu_dai,
114 SND_SOC_DAIFMT_DSP_A |
115 SND_SOC_DAIFMT_IB_NF |
116 SND_SOC_DAIFMT_CBM_CFM);
117 if (ret < 0) {
118 printk(KERN_ERR "can't set cpu DAI configuration\n");
119 return ret;
120 }
121
122 /* Set the codec system clock for DAC and ADC */
123 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
124 SND_SOC_CLOCK_IN);
125 if (ret < 0) {
126 printk(KERN_ERR "can't set codec system clock\n");
127 return ret;
128 }
129
130 return 0;
131}
132
133static struct snd_soc_ops sdp3430_voice_ops = {
134 .hw_params = sdp3430_hw_voice_params,
135};
136
137/* Headset jack */ 73/* Headset jack */
138static struct snd_soc_jack hs_jack; 74static struct snd_soc_jack hs_jack;
139 75
@@ -193,15 +129,6 @@ static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
193 struct snd_soc_dapm_context *dapm = &codec->dapm; 129 struct snd_soc_dapm_context *dapm = &codec->dapm;
194 int ret; 130 int ret;
195 131
196 /* Add SDP3430 specific widgets */
197 ret = snd_soc_dapm_new_controls(dapm, sdp3430_twl4030_dapm_widgets,
198 ARRAY_SIZE(sdp3430_twl4030_dapm_widgets));
199 if (ret)
200 return ret;
201
202 /* Set up SDP3430 specific audio path audio_map */
203 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
204
205 /* SDP3430 connected pins */ 132 /* SDP3430 connected pins */
206 snd_soc_dapm_enable_pin(dapm, "Ext Mic"); 133 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
207 snd_soc_dapm_enable_pin(dapm, "Ext Spk"); 134 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
@@ -223,10 +150,6 @@ static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
223 snd_soc_dapm_nc_pin(dapm, "CARKITL"); 150 snd_soc_dapm_nc_pin(dapm, "CARKITL");
224 snd_soc_dapm_nc_pin(dapm, "CARKITR"); 151 snd_soc_dapm_nc_pin(dapm, "CARKITR");
225 152
226 ret = snd_soc_dapm_sync(dapm);
227 if (ret)
228 return ret;
229
230 /* Headset jack detection */ 153 /* Headset jack detection */
231 ret = snd_soc_jack_new(codec, "Headset Jack", 154 ret = snd_soc_jack_new(codec, "Headset Jack",
232 SND_JACK_HEADSET, &hs_jack); 155 SND_JACK_HEADSET, &hs_jack);
@@ -267,6 +190,8 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
267 .codec_dai_name = "twl4030-hifi", 190 .codec_dai_name = "twl4030-hifi",
268 .platform_name = "omap-pcm-audio", 191 .platform_name = "omap-pcm-audio",
269 .codec_name = "twl4030-codec", 192 .codec_name = "twl4030-codec",
193 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
194 SND_SOC_DAIFMT_CBM_CFM,
270 .init = sdp3430_twl4030_init, 195 .init = sdp3430_twl4030_init,
271 .ops = &sdp3430_ops, 196 .ops = &sdp3430_ops,
272 }, 197 },
@@ -277,8 +202,10 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
277 .codec_dai_name = "twl4030-voice", 202 .codec_dai_name = "twl4030-voice",
278 .platform_name = "omap-pcm-audio", 203 .platform_name = "omap-pcm-audio",
279 .codec_name = "twl4030-codec", 204 .codec_name = "twl4030-codec",
205 .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
206 SND_SOC_DAIFMT_CBM_CFM,
280 .init = sdp3430_twl4030_voice_init, 207 .init = sdp3430_twl4030_voice_init,
281 .ops = &sdp3430_voice_ops, 208 .ops = &sdp3430_ops,
282 }, 209 },
283}; 210};
284 211
@@ -287,6 +214,11 @@ static struct snd_soc_card snd_soc_sdp3430 = {
287 .name = "SDP3430", 214 .name = "SDP3430",
288 .dai_link = sdp3430_dai, 215 .dai_link = sdp3430_dai,
289 .num_links = ARRAY_SIZE(sdp3430_dai), 216 .num_links = ARRAY_SIZE(sdp3430_dai),
217
218 .dapm_widgets = sdp3430_twl4030_dapm_widgets,
219 .num_dapm_widgets = ARRAY_SIZE(sdp3430_twl4030_dapm_widgets),
220 .dapm_routes = audio_map,
221 .num_dapm_routes = ARRAY_SIZE(audio_map),
290}; 222};
291 223
292static struct platform_device *sdp3430_snd_device; 224static struct platform_device *sdp3430_snd_device;