diff options
Diffstat (limited to 'sound/soc/pxa/poodle.c')
-rw-r--r-- | sound/soc/pxa/poodle.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index c5f36e0eab58..da3ae4316cf2 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
@@ -23,7 +23,6 @@ | |||
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> |
@@ -31,7 +30,6 @@ | |||
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-pcm.h" | ||
35 | #include "pxa2xx-i2s.h" | 33 | #include "pxa2xx-i2s.h" |
36 | 34 | ||
37 | #define POODLE_HP 1 | 35 | #define POODLE_HP 1 |
@@ -47,6 +45,8 @@ static int poodle_spk_func; | |||
47 | 45 | ||
48 | static void poodle_ext_control(struct snd_soc_codec *codec) | 46 | static void poodle_ext_control(struct snd_soc_codec *codec) |
49 | { | 47 | { |
48 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
49 | |||
50 | /* set up jack connection */ | 50 | /* set up jack connection */ |
51 | if (poodle_jack_func == POODLE_HP) { | 51 | if (poodle_jack_func == POODLE_HP) { |
52 | /* set = unmute headphone */ | 52 | /* set = unmute headphone */ |
@@ -54,32 +54,37 @@ static void poodle_ext_control(struct snd_soc_codec *codec) | |||
54 | POODLE_LOCOMO_GPIO_MUTE_L, 1); | 54 | POODLE_LOCOMO_GPIO_MUTE_L, 1); |
55 | locomo_gpio_write(&poodle_locomo_device.dev, | 55 | locomo_gpio_write(&poodle_locomo_device.dev, |
56 | POODLE_LOCOMO_GPIO_MUTE_R, 1); | 56 | POODLE_LOCOMO_GPIO_MUTE_R, 1); |
57 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 57 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); |
58 | } else { | 58 | } else { |
59 | locomo_gpio_write(&poodle_locomo_device.dev, | 59 | locomo_gpio_write(&poodle_locomo_device.dev, |
60 | POODLE_LOCOMO_GPIO_MUTE_L, 0); | 60 | POODLE_LOCOMO_GPIO_MUTE_L, 0); |
61 | locomo_gpio_write(&poodle_locomo_device.dev, | 61 | locomo_gpio_write(&poodle_locomo_device.dev, |
62 | POODLE_LOCOMO_GPIO_MUTE_R, 0); | 62 | POODLE_LOCOMO_GPIO_MUTE_R, 0); |
63 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 63 | snd_soc_dapm_disable_pin(dapm, "Headphone Jack"); |
64 | } | 64 | } |
65 | 65 | ||
66 | /* set the enpoints to their new connetion states */ | 66 | /* set the enpoints to their new connetion states */ |
67 | if (poodle_spk_func == POODLE_SPK_ON) | 67 | if (poodle_spk_func == POODLE_SPK_ON) |
68 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); | 68 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); |
69 | else | 69 | else |
70 | snd_soc_dapm_disable_pin(codec, "Ext Spk"); | 70 | snd_soc_dapm_disable_pin(dapm, "Ext Spk"); |
71 | 71 | ||
72 | /* signal a DAPM event */ | 72 | /* signal a DAPM event */ |
73 | snd_soc_dapm_sync(codec); | 73 | snd_soc_dapm_sync(dapm); |
74 | } | 74 | } |
75 | 75 | ||
76 | static int poodle_startup(struct snd_pcm_substream *substream) | 76 | static int poodle_startup(struct snd_pcm_substream *substream) |
77 | { | 77 | { |
78 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 78 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
79 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 79 | struct snd_soc_codec *codec = rtd->codec; |
80 | |||
81 | mutex_lock(&codec->mutex); | ||
80 | 82 | ||
81 | /* check the jack status at stream startup */ | 83 | /* check the jack status at stream startup */ |
82 | poodle_ext_control(codec); | 84 | poodle_ext_control(codec); |
85 | |||
86 | mutex_unlock(&codec->mutex); | ||
87 | |||
83 | return 0; | 88 | return 0; |
84 | } | 89 | } |
85 | 90 | ||
@@ -97,8 +102,8 @@ static int poodle_hw_params(struct snd_pcm_substream *substream, | |||
97 | struct snd_pcm_hw_params *params) | 102 | struct snd_pcm_hw_params *params) |
98 | { | 103 | { |
99 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 104 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
100 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 105 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
101 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 106 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
102 | unsigned int clk = 0; | 107 | unsigned int clk = 0; |
103 | int ret = 0; | 108 | int ret = 0; |
104 | 109 | ||
@@ -129,7 +134,7 @@ static int poodle_hw_params(struct snd_pcm_substream *substream, | |||
129 | return ret; | 134 | return ret; |
130 | 135 | ||
131 | /* set the codec system clock for DAC and ADC */ | 136 | /* set the codec system clock for DAC and ADC */ |
132 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, clk, | 137 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, |
133 | SND_SOC_CLOCK_IN); | 138 | SND_SOC_CLOCK_IN); |
134 | if (ret < 0) | 139 | if (ret < 0) |
135 | return ret; | 140 | return ret; |
@@ -237,13 +242,15 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = { | |||
237 | /* | 242 | /* |
238 | * 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 |
239 | */ | 244 | */ |
240 | static int poodle_wm8731_init(struct snd_soc_codec *codec) | 245 | static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
241 | { | 246 | { |
247 | struct snd_soc_codec *codec = rtd->codec; | ||
248 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
242 | int err; | 249 | int err; |
243 | 250 | ||
244 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); | 251 | snd_soc_dapm_nc_pin(dapm, "LLINEIN"); |
245 | snd_soc_dapm_nc_pin(codec, "RLINEIN"); | 252 | snd_soc_dapm_nc_pin(dapm, "RLINEIN"); |
246 | snd_soc_dapm_enable_pin(codec, "MICIN"); | 253 | snd_soc_dapm_enable_pin(dapm, "MICIN"); |
247 | 254 | ||
248 | /* Add poodle specific controls */ | 255 | /* Add poodle specific controls */ |
249 | err = snd_soc_add_controls(codec, wm8731_poodle_controls, | 256 | err = snd_soc_add_controls(codec, wm8731_poodle_controls, |
@@ -252,13 +259,13 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) | |||
252 | return err; | 259 | return err; |
253 | 260 | ||
254 | /* Add poodle specific widgets */ | 261 | /* Add poodle specific widgets */ |
255 | snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, | 262 | snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets, |
256 | ARRAY_SIZE(wm8731_dapm_widgets)); | 263 | ARRAY_SIZE(wm8731_dapm_widgets)); |
257 | 264 | ||
258 | /* Set up poodle specific audio path audio_map */ | 265 | /* Set up poodle specific audio path audio_map */ |
259 | 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)); |
260 | 267 | ||
261 | snd_soc_dapm_sync(codec); | 268 | snd_soc_dapm_sync(dapm); |
262 | return 0; | 269 | return 0; |
263 | } | 270 | } |
264 | 271 | ||
@@ -266,8 +273,10 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) | |||
266 | static struct snd_soc_dai_link poodle_dai = { | 273 | static struct snd_soc_dai_link poodle_dai = { |
267 | .name = "WM8731", | 274 | .name = "WM8731", |
268 | .stream_name = "WM8731", | 275 | .stream_name = "WM8731", |
269 | .cpu_dai = &pxa_i2s_dai, | 276 | .cpu_dai_name = "pxa2xx-i2s", |
270 | .codec_dai = &wm8731_dai, | 277 | .codec_dai_name = "wm8731-hifi", |
278 | .platform_name = "pxa-pcm-audio", | ||
279 | .codec_name = "wm8731.0-001b", | ||
271 | .init = poodle_wm8731_init, | 280 | .init = poodle_wm8731_init, |
272 | .ops = &poodle_ops, | 281 | .ops = &poodle_ops, |
273 | }; | 282 | }; |
@@ -275,15 +284,9 @@ static struct snd_soc_dai_link poodle_dai = { | |||
275 | /* poodle audio machine driver */ | 284 | /* poodle audio machine driver */ |
276 | static struct snd_soc_card snd_soc_poodle = { | 285 | static struct snd_soc_card snd_soc_poodle = { |
277 | .name = "Poodle", | 286 | .name = "Poodle", |
278 | .platform = &pxa2xx_soc_platform, | ||
279 | .dai_link = &poodle_dai, | 287 | .dai_link = &poodle_dai, |
280 | .num_links = 1, | 288 | .num_links = 1, |
281 | }; | 289 | .owner = THIS_MODULE, |
282 | |||
283 | /* poodle audio subsystem */ | ||
284 | static struct snd_soc_device poodle_snd_devdata = { | ||
285 | .card = &snd_soc_poodle, | ||
286 | .codec_dev = &soc_codec_dev_wm8731, | ||
287 | }; | 290 | }; |
288 | 291 | ||
289 | static struct platform_device *poodle_snd_device; | 292 | static struct platform_device *poodle_snd_device; |
@@ -307,8 +310,7 @@ static int __init poodle_init(void) | |||
307 | if (!poodle_snd_device) | 310 | if (!poodle_snd_device) |
308 | return -ENOMEM; | 311 | return -ENOMEM; |
309 | 312 | ||
310 | platform_set_drvdata(poodle_snd_device, &poodle_snd_devdata); | 313 | platform_set_drvdata(poodle_snd_device, &snd_soc_poodle); |
311 | poodle_snd_devdata.dev = &poodle_snd_device->dev; | ||
312 | ret = platform_device_add(poodle_snd_device); | 314 | ret = platform_device_add(poodle_snd_device); |
313 | 315 | ||
314 | if (ret) | 316 | if (ret) |