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

Side by Side Diff: sound/soc/pxa/poodle.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/palm27x.c ('k') | sound/soc/pxa/pxa-ssp.c » ('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 * poodle.c -- SoC audio for Poodle 2 * poodle.c -- SoC audio for Poodle
3 * 3 *
4 * Copyright 2005 Wolfson Microelectronics PLC. 4 * Copyright 2005 Wolfson Microelectronics PLC.
5 * Copyright 2005 Openedhand Ltd. 5 * Copyright 2005 Openedhand Ltd.
6 * 6 *
7 * Authors: Liam Girdwood <lrg@slimlogic.co.uk> 7 * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
8 * Richard Purdie <richard@openedhand.com> 8 * Richard Purdie <richard@openedhand.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your 12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version. 13 * option) any later version.
14 * 14 *
15 */ 15 */
16 16
17 #include <linux/module.h> 17 #include <linux/module.h>
18 #include <linux/moduleparam.h> 18 #include <linux/moduleparam.h>
19 #include <linux/timer.h> 19 #include <linux/timer.h>
20 #include <linux/i2c.h> 20 #include <linux/i2c.h>
21 #include <linux/interrupt.h> 21 #include <linux/interrupt.h>
22 #include <linux/platform_device.h> 22 #include <linux/platform_device.h>
23 #include <sound/core.h> 23 #include <sound/core.h>
24 #include <sound/pcm.h> 24 #include <sound/pcm.h>
25 #include <sound/soc.h> 25 #include <sound/soc.h>
26 #include <sound/soc-dapm.h>
27 26
28 #include <asm/mach-types.h> 27 #include <asm/mach-types.h>
29 #include <asm/hardware/locomo.h> 28 #include <asm/hardware/locomo.h>
30 #include <mach/poodle.h> 29 #include <mach/poodle.h>
31 #include <mach/audio.h> 30 #include <mach/audio.h>
32 31
33 #include "../codecs/wm8731.h" 32 #include "../codecs/wm8731.h"
34 #include "pxa2xx-i2s.h" 33 #include "pxa2xx-i2s.h"
35 34
36 #define POODLE_HP 1 35 #define POODLE_HP 1
37 #define POODLE_HP_OFF 0 36 #define POODLE_HP_OFF 0
38 #define POODLE_SPK_ON 1 37 #define POODLE_SPK_ON 1
39 #define POODLE_SPK_OFF 0 38 #define POODLE_SPK_OFF 0
40 39
41 /* audio clock in Hz - rounded from 12.235MHz */ 40 /* audio clock in Hz - rounded from 12.235MHz */
42 #define POODLE_AUDIO_CLOCK 12288000 41 #define POODLE_AUDIO_CLOCK 12288000
43 42
44 static int poodle_jack_func; 43 static int poodle_jack_func;
45 static int poodle_spk_func; 44 static int poodle_spk_func;
46 45
47 static void poodle_ext_control(struct snd_soc_codec *codec) 46 static void poodle_ext_control(struct snd_soc_codec *codec)
48 { 47 {
48 struct snd_soc_dapm_context *dapm = &codec->dapm;
49
49 /* set up jack connection */ 50 /* set up jack connection */
50 if (poodle_jack_func == POODLE_HP) { 51 if (poodle_jack_func == POODLE_HP) {
51 /* set = unmute headphone */ 52 /* set = unmute headphone */
52 locomo_gpio_write(&poodle_locomo_device.dev, 53 locomo_gpio_write(&poodle_locomo_device.dev,
53 POODLE_LOCOMO_GPIO_MUTE_L, 1); 54 POODLE_LOCOMO_GPIO_MUTE_L, 1);
54 locomo_gpio_write(&poodle_locomo_device.dev, 55 locomo_gpio_write(&poodle_locomo_device.dev,
55 POODLE_LOCOMO_GPIO_MUTE_R, 1); 56 POODLE_LOCOMO_GPIO_MUTE_R, 1);
56 » » snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 57 » » snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
57 } else { 58 } else {
58 locomo_gpio_write(&poodle_locomo_device.dev, 59 locomo_gpio_write(&poodle_locomo_device.dev,
59 POODLE_LOCOMO_GPIO_MUTE_L, 0); 60 POODLE_LOCOMO_GPIO_MUTE_L, 0);
60 locomo_gpio_write(&poodle_locomo_device.dev, 61 locomo_gpio_write(&poodle_locomo_device.dev,
61 POODLE_LOCOMO_GPIO_MUTE_R, 0); 62 POODLE_LOCOMO_GPIO_MUTE_R, 0);
62 » » snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 63 » » snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
63 } 64 }
64 65
65 /* set the enpoints to their new connetion states */ 66 /* set the enpoints to their new connetion states */
66 if (poodle_spk_func == POODLE_SPK_ON) 67 if (poodle_spk_func == POODLE_SPK_ON)
67 » » snd_soc_dapm_enable_pin(codec, "Ext Spk"); 68 » » snd_soc_dapm_enable_pin(dapm, "Ext Spk");
68 else 69 else
69 » » snd_soc_dapm_disable_pin(codec, "Ext Spk"); 70 » » snd_soc_dapm_disable_pin(dapm, "Ext Spk");
70 71
71 /* signal a DAPM event */ 72 /* signal a DAPM event */
72 » snd_soc_dapm_sync(codec); 73 » snd_soc_dapm_sync(dapm);
73 } 74 }
74 75
75 static int poodle_startup(struct snd_pcm_substream *substream) 76 static int poodle_startup(struct snd_pcm_substream *substream)
76 { 77 {
77 struct snd_soc_pcm_runtime *rtd = substream->private_data; 78 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_codec *codec = rtd->codec; 79 struct snd_soc_codec *codec = rtd->codec;
79 80
80 mutex_lock(&codec->mutex); 81 mutex_lock(&codec->mutex);
81 82
82 /* check the jack status at stream startup */ 83 /* check the jack status at stream startup */
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 SOC_ENUM_EXT("Speaker Function", poodle_enum[1], poodle_get_spk, 238 SOC_ENUM_EXT("Speaker Function", poodle_enum[1], poodle_get_spk,
238 poodle_set_spk), 239 poodle_set_spk),
239 }; 240 };
240 241
241 /* 242 /*
242 * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device 243 * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device
243 */ 244 */
244 static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) 245 static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd)
245 { 246 {
246 struct snd_soc_codec *codec = rtd->codec; 247 struct snd_soc_codec *codec = rtd->codec;
248 struct snd_soc_dapm_context *dapm = &codec->dapm;
247 int err; 249 int err;
248 250
249 » snd_soc_dapm_nc_pin(codec, "LLINEIN"); 251 » snd_soc_dapm_nc_pin(dapm, "LLINEIN");
250 » snd_soc_dapm_nc_pin(codec, "RLINEIN"); 252 » snd_soc_dapm_nc_pin(dapm, "RLINEIN");
251 » snd_soc_dapm_enable_pin(codec, "MICIN"); 253 » snd_soc_dapm_enable_pin(dapm, "MICIN");
252 254
253 /* Add poodle specific controls */ 255 /* Add poodle specific controls */
254 err = snd_soc_add_controls(codec, wm8731_poodle_controls, 256 err = snd_soc_add_controls(codec, wm8731_poodle_controls,
255 ARRAY_SIZE(wm8731_poodle_controls)); 257 ARRAY_SIZE(wm8731_poodle_controls));
256 if (err < 0) 258 if (err < 0)
257 return err; 259 return err;
258 260
259 /* Add poodle specific widgets */ 261 /* Add poodle specific widgets */
260 » snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 262 » snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
261 ARRAY_SIZE(wm8731_dapm_widgets)); 263 ARRAY_SIZE(wm8731_dapm_widgets));
262 264
263 /* Set up poodle specific audio path audio_map */ 265 /* Set up poodle specific audio path audio_map */
264 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 266 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
265 267
266 » snd_soc_dapm_sync(codec); 268 » snd_soc_dapm_sync(dapm);
267 return 0; 269 return 0;
268 } 270 }
269 271
270 /* poodle digital audio interface glue - connects codec <--> CPU */ 272 /* poodle digital audio interface glue - connects codec <--> CPU */
271 static struct snd_soc_dai_link poodle_dai = { 273 static struct snd_soc_dai_link poodle_dai = {
272 .name = "WM8731", 274 .name = "WM8731",
273 .stream_name = "WM8731", 275 .stream_name = "WM8731",
274 .cpu_dai_name = "pxa2xx-i2s", 276 .cpu_dai_name = "pxa2xx-i2s",
275 .codec_dai_name = "wm8731-hifi", 277 .codec_dai_name = "wm8731-hifi",
276 .platform_name = "pxa-pcm-audio", 278 .platform_name = "pxa-pcm-audio",
277 » .codec_name = "wm8731-codec.0-001a", 279 » .codec_name = "wm8731-codec.0-001b",
278 .init = poodle_wm8731_init, 280 .init = poodle_wm8731_init,
279 .ops = &poodle_ops, 281 .ops = &poodle_ops,
280 }; 282 };
281 283
282 /* poodle audio machine driver */ 284 /* poodle audio machine driver */
283 static struct snd_soc_card snd_soc_poodle = { 285 static struct snd_soc_card snd_soc_poodle = {
284 .name = "Poodle", 286 .name = "Poodle",
285 .dai_link = &poodle_dai, 287 .dai_link = &poodle_dai,
286 .num_links = 1, 288 .num_links = 1,
287 .owner = THIS_MODULE, 289 .owner = THIS_MODULE,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 platform_device_unregister(poodle_snd_device); 324 platform_device_unregister(poodle_snd_device);
323 } 325 }
324 326
325 module_init(poodle_init); 327 module_init(poodle_init);
326 module_exit(poodle_exit); 328 module_exit(poodle_exit);
327 329
328 /* Module information */ 330 /* Module information */
329 MODULE_AUTHOR("Richard Purdie"); 331 MODULE_AUTHOR("Richard Purdie");
330 MODULE_DESCRIPTION("ALSA SoC Poodle"); 332 MODULE_DESCRIPTION("ALSA SoC Poodle");
331 MODULE_LICENSE("GPL"); 333 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/pxa/palm27x.c ('k') | sound/soc/pxa/pxa-ssp.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698