Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: sound/soc/pxa/zylonite.c

Issue 6577007: CHROMIUM: ASoC: Import entire upstream ASoC tree (Closed)
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sound/soc/pxa/z2.c ('k') | sound/soc/s3c24xx/Kconfig » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * zylonite.c -- SoC audio for Zylonite 2 * zylonite.c -- SoC audio for Zylonite
3 * 3 *
4 * Copyright 2008 Wolfson Microelectronics PLC. 4 * Copyright 2008 Wolfson Microelectronics PLC.
5 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 5 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the 9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version. 10 * License, or (at your option) any later version.
11 * 11 *
12 */ 12 */
13 13
14 #include <linux/module.h> 14 #include <linux/module.h>
15 #include <linux/moduleparam.h> 15 #include <linux/moduleparam.h>
16 #include <linux/device.h> 16 #include <linux/device.h>
17 #include <linux/clk.h> 17 #include <linux/clk.h>
18 #include <linux/i2c.h> 18 #include <linux/i2c.h>
19 #include <sound/core.h> 19 #include <sound/core.h>
20 #include <sound/pcm.h> 20 #include <sound/pcm.h>
21 #include <sound/pcm_params.h> 21 #include <sound/pcm_params.h>
22 #include <sound/soc.h> 22 #include <sound/soc.h>
23 #include <sound/soc-dapm.h>
24 23
25 #include "../codecs/wm9713.h" 24 #include "../codecs/wm9713.h"
26 #include "pxa2xx-ac97.h" 25 #include "pxa2xx-ac97.h"
27 #include "pxa-ssp.h" 26 #include "pxa-ssp.h"
28 27
29 /* 28 /*
30 * There is a physical switch SW15 on the board which changes the MCLK 29 * There is a physical switch SW15 on the board which changes the MCLK
31 * for the WM9713 between the standard AC97 master clock and the 30 * for the WM9713 between the standard AC97 master clock and the
32 * output of the CLK_POUT signal from the PXA. 31 * output of the CLK_POUT signal from the PXA.
33 */ 32 */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 { "Mic Bias", NULL, "Handset Microphone" }, 65 { "Mic Bias", NULL, "Handset Microphone" },
67 66
68 /* Multiactor differentially connected over SPKL/SPKR */ 67 /* Multiactor differentially connected over SPKL/SPKR */
69 { "Multiactor", NULL, "SPKL" }, 68 { "Multiactor", NULL, "SPKL" },
70 { "Multiactor", NULL, "SPKR" }, 69 { "Multiactor", NULL, "SPKR" },
71 }; 70 };
72 71
73 static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd) 72 static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd)
74 { 73 {
75 struct snd_soc_codec *codec = rtd->codec; 74 struct snd_soc_codec *codec = rtd->codec;
75 struct snd_soc_dapm_context *dapm = &codec->dapm;
76 76
77 if (clk_pout) 77 if (clk_pout)
78 snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, 78 snd_soc_dai_set_pll(rtd->codec_dai, 0, 0,
79 clk_get_rate(pout), 0); 79 clk_get_rate(pout), 0);
80 80
81 » snd_soc_dapm_new_controls(codec, zylonite_dapm_widgets, 81 » snd_soc_dapm_new_controls(dapm, zylonite_dapm_widgets,
82 ARRAY_SIZE(zylonite_dapm_widgets)); 82 ARRAY_SIZE(zylonite_dapm_widgets));
83 83
84 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 84 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
85 85
86 /* Static setup for now */ 86 /* Static setup for now */
87 » snd_soc_dapm_enable_pin(codec, "Headphone"); 87 » snd_soc_dapm_enable_pin(dapm, "Headphone");
88 » snd_soc_dapm_enable_pin(codec, "Headset Earpiece"); 88 » snd_soc_dapm_enable_pin(dapm, "Headset Earpiece");
89 89
90 » snd_soc_dapm_sync(codec); 90 » snd_soc_dapm_sync(dapm);
91 return 0; 91 return 0;
92 } 92 }
93 93
94 static int zylonite_voice_hw_params(struct snd_pcm_substream *substream, 94 static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
95 struct snd_pcm_hw_params *params) 95 struct snd_pcm_hw_params *params)
96 { 96 {
97 struct snd_soc_pcm_runtime *rtd = substream->private_data; 97 struct snd_soc_pcm_runtime *rtd = substream->private_data;
98 struct snd_soc_dai *codec_dai = rtd->codec_dai; 98 struct snd_soc_dai *codec_dai = rtd->codec_dai;
99 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 99 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
100 unsigned int pll_out = 0; 100 unsigned int pll_out = 0;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 .name = "WM9713 Voice", 182 .name = "WM9713 Voice",
183 .stream_name = "WM9713 Voice", 183 .stream_name = "WM9713 Voice",
184 .codec_name = "wm9713-codec", 184 .codec_name = "wm9713-codec",
185 .platform_name = "pxa-pcm-audio", 185 .platform_name = "pxa-pcm-audio",
186 .cpu_dai_name = "pxa-ssp-dai.2", 186 .cpu_dai_name = "pxa-ssp-dai.2",
187 .codec_name = "wm9713-voice", 187 .codec_name = "wm9713-voice",
188 .ops = &zylonite_voice_ops, 188 .ops = &zylonite_voice_ops,
189 }, 189 },
190 }; 190 };
191 191
192 static int zylonite_probe(struct platform_device *pdev) 192 static int zylonite_probe(struct snd_soc_card *card)
193 { 193 {
194 int ret; 194 int ret;
195 195
196 if (clk_pout) { 196 if (clk_pout) {
197 pout = clk_get(NULL, "CLK_POUT"); 197 pout = clk_get(NULL, "CLK_POUT");
198 if (IS_ERR(pout)) { 198 if (IS_ERR(pout)) {
199 dev_err(&pdev->dev, "Unable to obtain CLK_POUT: %ld\n", 199 dev_err(&pdev->dev, "Unable to obtain CLK_POUT: %ld\n",
200 PTR_ERR(pout)); 200 PTR_ERR(pout));
201 return PTR_ERR(pout); 201 return PTR_ERR(pout);
202 } 202 }
203 203
204 ret = clk_enable(pout); 204 ret = clk_enable(pout);
205 if (ret != 0) { 205 if (ret != 0) {
206 dev_err(&pdev->dev, "Unable to enable CLK_POUT: %d\n", 206 dev_err(&pdev->dev, "Unable to enable CLK_POUT: %d\n",
207 ret); 207 ret);
208 clk_put(pout); 208 clk_put(pout);
209 return ret; 209 return ret;
210 } 210 }
211 211
212 dev_dbg(&pdev->dev, "MCLK enabled at %luHz\n", 212 dev_dbg(&pdev->dev, "MCLK enabled at %luHz\n",
213 clk_get_rate(pout)); 213 clk_get_rate(pout));
214 } 214 }
215 215
216 return 0; 216 return 0;
217 } 217 }
218 218
219 static int zylonite_remove(struct platform_device *pdev) 219 static int zylonite_remove(struct snd_soc_card *card)
220 { 220 {
221 if (clk_pout) { 221 if (clk_pout) {
222 clk_disable(pout); 222 clk_disable(pout);
223 clk_put(pout); 223 clk_put(pout);
224 } 224 }
225 225
226 return 0; 226 return 0;
227 } 227 }
228 228
229 static int zylonite_suspend_post(struct platform_device *pdev, 229 static int zylonite_suspend_post(struct snd_soc_card *card)
230 » » » » pm_message_t state)
231 { 230 {
232 if (clk_pout) 231 if (clk_pout)
233 clk_disable(pout); 232 clk_disable(pout);
234 233
235 return 0; 234 return 0;
236 } 235 }
237 236
238 static int zylonite_resume_pre(struct platform_device *pdev) 237 static int zylonite_resume_pre(struct snd_soc_card *card)
239 { 238 {
240 int ret = 0; 239 int ret = 0;
241 240
242 if (clk_pout) { 241 if (clk_pout) {
243 ret = clk_enable(pout); 242 ret = clk_enable(pout);
244 if (ret != 0) 243 if (ret != 0)
245 dev_err(&pdev->dev, "Unable to enable CLK_POUT: %d\n", 244 dev_err(&pdev->dev, "Unable to enable CLK_POUT: %d\n",
246 ret); 245 ret);
247 } 246 }
248 247
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 { 282 {
284 platform_device_unregister(zylonite_snd_ac97_device); 283 platform_device_unregister(zylonite_snd_ac97_device);
285 } 284 }
286 285
287 module_init(zylonite_init); 286 module_init(zylonite_init);
288 module_exit(zylonite_exit); 287 module_exit(zylonite_exit);
289 288
290 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 289 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
291 MODULE_DESCRIPTION("ALSA SoC WM9713 Zylonite"); 290 MODULE_DESCRIPTION("ALSA SoC WM9713 Zylonite");
292 MODULE_LICENSE("GPL"); 291 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/pxa/z2.c ('k') | sound/soc/s3c24xx/Kconfig » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698