diff options
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r-- | sound/soc/pxa/Kconfig | 18 | ||||
-rw-r--r-- | sound/soc/pxa/Makefile | 4 | ||||
-rw-r--r-- | sound/soc/pxa/corgi.c | 28 | ||||
-rw-r--r-- | sound/soc/pxa/e740_wm9705.c | 29 | ||||
-rw-r--r-- | sound/soc/pxa/e750_wm9705.c | 26 | ||||
-rw-r--r-- | sound/soc/pxa/e800_wm9712.c | 26 | ||||
-rw-r--r-- | sound/soc/pxa/em-x270.c | 22 | ||||
-rw-r--r-- | sound/soc/pxa/imote2.c | 20 | ||||
-rw-r--r-- | sound/soc/pxa/magician.c | 35 | ||||
-rw-r--r-- | sound/soc/pxa/mioa701_wm9713.c | 33 | ||||
-rw-r--r-- | sound/soc/pxa/palm27x.c | 27 | ||||
-rw-r--r-- | sound/soc/pxa/poodle.c | 29 | ||||
-rw-r--r-- | sound/soc/pxa/pxa-ssp.c | 174 | ||||
-rw-r--r-- | sound/soc/pxa/pxa-ssp.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.c | 46 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.c | 91 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-pcm.c | 46 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-pcm.h | 19 | ||||
-rw-r--r-- | sound/soc/pxa/raumfeld.c | 114 | ||||
-rw-r--r-- | sound/soc/pxa/saarb.c | 200 | ||||
-rw-r--r-- | sound/soc/pxa/spitz.c | 26 | ||||
-rw-r--r-- | sound/soc/pxa/tavorevb3.c | 200 | ||||
-rw-r--r-- | sound/soc/pxa/tosa.c | 27 | ||||
-rw-r--r-- | sound/soc/pxa/z2.c | 26 | ||||
-rw-r--r-- | sound/soc/pxa/zylonite.c | 40 |
27 files changed, 784 insertions, 528 deletions
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index e30c8325f35e..37f191bbfdd9 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -117,6 +117,24 @@ config SND_PXA2XX_SOC_PALM27X | |||
117 | Say Y if you want to add support for SoC audio on | 117 | Say Y if you want to add support for SoC audio on |
118 | Palm T|X, T5, E2 or LifeDrive handheld computer. | 118 | Palm T|X, T5, E2 or LifeDrive handheld computer. |
119 | 119 | ||
120 | config SND_SOC_SAARB | ||
121 | tristate "SoC Audio support for Marvell Saarb" | ||
122 | depends on SND_PXA2XX_SOC && MACH_SAARB | ||
123 | select SND_PXA_SOC_SSP | ||
124 | select SND_SOC_88PM860X | ||
125 | help | ||
126 | Say Y if you want to add support for SoC audio on the | ||
127 | Marvell Saarb reference platform. | ||
128 | |||
129 | config SND_SOC_TAVOREVB3 | ||
130 | tristate "SoC Audio support for Marvell Tavor EVB3" | ||
131 | depends on SND_PXA2XX_SOC && MACH_TAVOREVB3 | ||
132 | select SND_PXA_SOC_SSP | ||
133 | select SND_SOC_88PM860X | ||
134 | help | ||
135 | Say Y if you want to add support for SoC audio on the | ||
136 | Marvell Saarb reference platform. | ||
137 | |||
120 | config SND_SOC_ZYLONITE | 138 | config SND_SOC_ZYLONITE |
121 | tristate "SoC Audio support for Marvell Zylonite" | 139 | tristate "SoC Audio support for Marvell Zylonite" |
122 | depends on SND_PXA2XX_SOC && MACH_ZYLONITE | 140 | depends on SND_PXA2XX_SOC && MACH_ZYLONITE |
diff --git a/sound/soc/pxa/Makefile b/sound/soc/pxa/Makefile index caa03d8f4789..07660165ec8d 100644 --- a/sound/soc/pxa/Makefile +++ b/sound/soc/pxa/Makefile | |||
@@ -19,6 +19,8 @@ snd-soc-e800-objs := e800_wm9712.o | |||
19 | snd-soc-spitz-objs := spitz.o | 19 | snd-soc-spitz-objs := spitz.o |
20 | snd-soc-em-x270-objs := em-x270.o | 20 | snd-soc-em-x270-objs := em-x270.o |
21 | snd-soc-palm27x-objs := palm27x.o | 21 | snd-soc-palm27x-objs := palm27x.o |
22 | snd-soc-saarb-objs := saarb.o | ||
23 | snd-soc-tavorevb3-objs := tavorevb3.o | ||
22 | snd-soc-zylonite-objs := zylonite.o | 24 | snd-soc-zylonite-objs := zylonite.o |
23 | snd-soc-magician-objs := magician.o | 25 | snd-soc-magician-objs := magician.o |
24 | snd-soc-mioa701-objs := mioa701_wm9713.o | 26 | snd-soc-mioa701-objs := mioa701_wm9713.o |
@@ -38,6 +40,8 @@ obj-$(CONFIG_SND_PXA2XX_SOC_PALM27X) += snd-soc-palm27x.o | |||
38 | obj-$(CONFIG_SND_PXA2XX_SOC_MAGICIAN) += snd-soc-magician.o | 40 | obj-$(CONFIG_SND_PXA2XX_SOC_MAGICIAN) += snd-soc-magician.o |
39 | obj-$(CONFIG_SND_PXA2XX_SOC_MIOA701) += snd-soc-mioa701.o | 41 | obj-$(CONFIG_SND_PXA2XX_SOC_MIOA701) += snd-soc-mioa701.o |
40 | obj-$(CONFIG_SND_PXA2XX_SOC_Z2) += snd-soc-z2.o | 42 | obj-$(CONFIG_SND_PXA2XX_SOC_Z2) += snd-soc-z2.o |
43 | obj-$(CONFIG_SND_SOC_SAARB) += snd-soc-saarb.o | ||
44 | obj-$(CONFIG_SND_SOC_TAVOREVB3) += snd-soc-tavorevb3.o | ||
41 | obj-$(CONFIG_SND_SOC_ZYLONITE) += snd-soc-zylonite.o | 45 | obj-$(CONFIG_SND_SOC_ZYLONITE) += snd-soc-zylonite.o |
42 | obj-$(CONFIG_SND_PXA2XX_SOC_IMOTE2) += snd-soc-imote2.o | 46 | obj-$(CONFIG_SND_PXA2XX_SOC_IMOTE2) += snd-soc-imote2.o |
43 | obj-$(CONFIG_SND_SOC_RAUMFELD) += snd-soc-raumfeld.o | 47 | obj-$(CONFIG_SND_SOC_RAUMFELD) += snd-soc-raumfeld.o |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index fefe1a57f31a..97e9423615c9 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <mach/audio.h> | 30 | #include <mach/audio.h> |
31 | 31 | ||
32 | #include "../codecs/wm8731.h" | 32 | #include "../codecs/wm8731.h" |
33 | #include "pxa2xx-pcm.h" | ||
34 | #include "pxa2xx-i2s.h" | 33 | #include "pxa2xx-i2s.h" |
35 | 34 | ||
36 | #define CORGI_HP 0 | 35 | #define CORGI_HP 0 |
@@ -99,7 +98,7 @@ static void corgi_ext_control(struct snd_soc_codec *codec) | |||
99 | static int corgi_startup(struct snd_pcm_substream *substream) | 98 | static int corgi_startup(struct snd_pcm_substream *substream) |
100 | { | 99 | { |
101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
102 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 101 | struct snd_soc_codec *codec = rtd->codec; |
103 | 102 | ||
104 | /* check the jack status at stream startup */ | 103 | /* check the jack status at stream startup */ |
105 | corgi_ext_control(codec); | 104 | corgi_ext_control(codec); |
@@ -118,8 +117,8 @@ static int corgi_hw_params(struct snd_pcm_substream *substream, | |||
118 | struct snd_pcm_hw_params *params) | 117 | struct snd_pcm_hw_params *params) |
119 | { | 118 | { |
120 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 119 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
121 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 120 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
122 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 121 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
123 | unsigned int clk = 0; | 122 | unsigned int clk = 0; |
124 | int ret = 0; | 123 | int ret = 0; |
125 | 124 | ||
@@ -150,7 +149,7 @@ static int corgi_hw_params(struct snd_pcm_substream *substream, | |||
150 | return ret; | 149 | return ret; |
151 | 150 | ||
152 | /* set the codec system clock for DAC and ADC */ | 151 | /* set the codec system clock for DAC and ADC */ |
153 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, clk, | 152 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, |
154 | SND_SOC_CLOCK_IN); | 153 | SND_SOC_CLOCK_IN); |
155 | if (ret < 0) | 154 | if (ret < 0) |
156 | return ret; | 155 | return ret; |
@@ -272,8 +271,9 @@ static const struct snd_kcontrol_new wm8731_corgi_controls[] = { | |||
272 | /* | 271 | /* |
273 | * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device | 272 | * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device |
274 | */ | 273 | */ |
275 | static int corgi_wm8731_init(struct snd_soc_codec *codec) | 274 | static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
276 | { | 275 | { |
276 | struct snd_soc_codec *codec = rtd->codec; | ||
277 | int err; | 277 | int err; |
278 | 278 | ||
279 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); | 279 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); |
@@ -300,8 +300,10 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec) | |||
300 | static struct snd_soc_dai_link corgi_dai = { | 300 | static struct snd_soc_dai_link corgi_dai = { |
301 | .name = "WM8731", | 301 | .name = "WM8731", |
302 | .stream_name = "WM8731", | 302 | .stream_name = "WM8731", |
303 | .cpu_dai = &pxa_i2s_dai, | 303 | .cpu_dai_name = "pxa-is2-dai", |
304 | .codec_dai = &wm8731_dai, | 304 | .codec_dai_name = "wm8731-hifi", |
305 | .platform_name = "pxa-pcm-audio", | ||
306 | .codec_name = "wm8731-codec-0.001a", | ||
305 | .init = corgi_wm8731_init, | 307 | .init = corgi_wm8731_init, |
306 | .ops = &corgi_ops, | 308 | .ops = &corgi_ops, |
307 | }; | 309 | }; |
@@ -309,17 +311,10 @@ static struct snd_soc_dai_link corgi_dai = { | |||
309 | /* corgi audio machine driver */ | 311 | /* corgi audio machine driver */ |
310 | static struct snd_soc_card snd_soc_corgi = { | 312 | static struct snd_soc_card snd_soc_corgi = { |
311 | .name = "Corgi", | 313 | .name = "Corgi", |
312 | .platform = &pxa2xx_soc_platform, | ||
313 | .dai_link = &corgi_dai, | 314 | .dai_link = &corgi_dai, |
314 | .num_links = 1, | 315 | .num_links = 1, |
315 | }; | 316 | }; |
316 | 317 | ||
317 | /* corgi audio subsystem */ | ||
318 | static struct snd_soc_device corgi_snd_devdata = { | ||
319 | .card = &snd_soc_corgi, | ||
320 | .codec_dev = &soc_codec_dev_wm8731, | ||
321 | }; | ||
322 | |||
323 | static struct platform_device *corgi_snd_device; | 318 | static struct platform_device *corgi_snd_device; |
324 | 319 | ||
325 | static int __init corgi_init(void) | 320 | static int __init corgi_init(void) |
@@ -334,8 +329,7 @@ static int __init corgi_init(void) | |||
334 | if (!corgi_snd_device) | 329 | if (!corgi_snd_device) |
335 | return -ENOMEM; | 330 | return -ENOMEM; |
336 | 331 | ||
337 | platform_set_drvdata(corgi_snd_device, &corgi_snd_devdata); | 332 | platform_set_drvdata(corgi_snd_device, &snd_soc_corgi); |
338 | corgi_snd_devdata.dev = &corgi_snd_device->dev; | ||
339 | ret = platform_device_add(corgi_snd_device); | 333 | ret = platform_device_add(corgi_snd_device); |
340 | 334 | ||
341 | if (ret) | 335 | if (ret) |
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 7cd2f89d7b10..c82cedb602fd 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
25 | 25 | ||
26 | #include "../codecs/wm9705.h" | 26 | #include "../codecs/wm9705.h" |
27 | #include "pxa2xx-pcm.h" | ||
28 | #include "pxa2xx-ac97.h" | 27 | #include "pxa2xx-ac97.h" |
29 | 28 | ||
30 | 29 | ||
@@ -90,8 +89,10 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
90 | {"Mic Amp", NULL, "Mic (Internal)"}, | 89 | {"Mic Amp", NULL, "Mic (Internal)"}, |
91 | }; | 90 | }; |
92 | 91 | ||
93 | static int e740_ac97_init(struct snd_soc_codec *codec) | 92 | static int e740_ac97_init(struct snd_soc_pcm_runtime *rtd) |
94 | { | 93 | { |
94 | struct snd_soc_codec *codec = rtd->codec; | ||
95 | |||
95 | snd_soc_dapm_nc_pin(codec, "HPOUTL"); | 96 | snd_soc_dapm_nc_pin(codec, "HPOUTL"); |
96 | snd_soc_dapm_nc_pin(codec, "HPOUTR"); | 97 | snd_soc_dapm_nc_pin(codec, "HPOUTR"); |
97 | snd_soc_dapm_nc_pin(codec, "PHONE"); | 98 | snd_soc_dapm_nc_pin(codec, "PHONE"); |
@@ -116,30 +117,28 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
116 | { | 117 | { |
117 | .name = "AC97", | 118 | .name = "AC97", |
118 | .stream_name = "AC97 HiFi", | 119 | .stream_name = "AC97 HiFi", |
119 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 120 | .cpu_dai_name = "pxa-ac97.0", |
120 | .codec_dai = &wm9705_dai[WM9705_DAI_AC97_HIFI], | 121 | .codec_dai_name = "wm9705-hifi", |
122 | .platform_name = "pxa-pcm-audio", | ||
123 | .codec_name = "wm9705-codec", | ||
121 | .init = e740_ac97_init, | 124 | .init = e740_ac97_init, |
122 | }, | 125 | }, |
123 | { | 126 | { |
124 | .name = "AC97 Aux", | 127 | .name = "AC97 Aux", |
125 | .stream_name = "AC97 Aux", | 128 | .stream_name = "AC97 Aux", |
126 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 129 | .cpu_dai_name = "pxa-ac97.1", |
127 | .codec_dai = &wm9705_dai[WM9705_DAI_AC97_AUX], | 130 | .codec_dai_name = "wm9705-aux", |
131 | .platform_name = "pxa-pcm-audio", | ||
132 | .codec_name = "wm9705-codec", | ||
128 | }, | 133 | }, |
129 | }; | 134 | }; |
130 | 135 | ||
131 | static struct snd_soc_card e740 = { | 136 | static struct snd_soc_card e740 = { |
132 | .name = "Toshiba e740", | 137 | .name = "Toshiba e740", |
133 | .platform = &pxa2xx_soc_platform, | ||
134 | .dai_link = e740_dai, | 138 | .dai_link = e740_dai, |
135 | .num_links = ARRAY_SIZE(e740_dai), | 139 | .num_links = ARRAY_SIZE(e740_dai), |
136 | }; | 140 | }; |
137 | 141 | ||
138 | static struct snd_soc_device e740_snd_devdata = { | ||
139 | .card = &e740, | ||
140 | .codec_dev = &soc_codec_dev_wm9705, | ||
141 | }; | ||
142 | |||
143 | static struct platform_device *e740_snd_device; | 142 | static struct platform_device *e740_snd_device; |
144 | 143 | ||
145 | static int __init e740_init(void) | 144 | static int __init e740_init(void) |
@@ -178,8 +177,7 @@ static int __init e740_init(void) | |||
178 | goto free_apwr_gpio; | 177 | goto free_apwr_gpio; |
179 | } | 178 | } |
180 | 179 | ||
181 | platform_set_drvdata(e740_snd_device, &e740_snd_devdata); | 180 | platform_set_drvdata(e740_snd_device, &e740); |
182 | e740_snd_devdata.dev = &e740_snd_device->dev; | ||
183 | ret = platform_device_add(e740_snd_device); | 181 | ret = platform_device_add(e740_snd_device); |
184 | 182 | ||
185 | if (!ret) | 183 | if (!ret) |
@@ -200,6 +198,9 @@ free_mic_amp_gpio: | |||
200 | static void __exit e740_exit(void) | 198 | static void __exit e740_exit(void) |
201 | { | 199 | { |
202 | platform_device_unregister(e740_snd_device); | 200 | platform_device_unregister(e740_snd_device); |
201 | gpio_free(GPIO_E740_WM9705_nAVDD2); | ||
202 | gpio_free(GPIO_E740_AMP_ON); | ||
203 | gpio_free(GPIO_E740_MIC_ON); | ||
203 | } | 204 | } |
204 | 205 | ||
205 | module_init(e740_init); | 206 | module_init(e740_init); |
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 8dceccc5e059..4c143803a75e 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
25 | 25 | ||
26 | #include "../codecs/wm9705.h" | 26 | #include "../codecs/wm9705.h" |
27 | #include "pxa2xx-pcm.h" | ||
28 | #include "pxa2xx-ac97.h" | 27 | #include "pxa2xx-ac97.h" |
29 | 28 | ||
30 | static int e750_spk_amp_event(struct snd_soc_dapm_widget *w, | 29 | static int e750_spk_amp_event(struct snd_soc_dapm_widget *w, |
@@ -72,8 +71,10 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
72 | {"MIC1", NULL, "Mic (Internal)"}, | 71 | {"MIC1", NULL, "Mic (Internal)"}, |
73 | }; | 72 | }; |
74 | 73 | ||
75 | static int e750_ac97_init(struct snd_soc_codec *codec) | 74 | static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd) |
76 | { | 75 | { |
76 | struct snd_soc_codec *codec = rtd->codec; | ||
77 | |||
77 | snd_soc_dapm_nc_pin(codec, "LOUT"); | 78 | snd_soc_dapm_nc_pin(codec, "LOUT"); |
78 | snd_soc_dapm_nc_pin(codec, "ROUT"); | 79 | snd_soc_dapm_nc_pin(codec, "ROUT"); |
79 | snd_soc_dapm_nc_pin(codec, "PHONE"); | 80 | snd_soc_dapm_nc_pin(codec, "PHONE"); |
@@ -98,31 +99,29 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
98 | { | 99 | { |
99 | .name = "AC97", | 100 | .name = "AC97", |
100 | .stream_name = "AC97 HiFi", | 101 | .stream_name = "AC97 HiFi", |
101 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 102 | .cpu_dai_name = "pxa-ac97.0", |
102 | .codec_dai = &wm9705_dai[WM9705_DAI_AC97_HIFI], | 103 | .codec_dai_name = "wm9705-hifi", |
104 | .platform_name = "pxa-pcm-audio", | ||
105 | .codec_name = "wm9705-codec", | ||
103 | .init = e750_ac97_init, | 106 | .init = e750_ac97_init, |
104 | /* use ops to check startup state */ | 107 | /* use ops to check startup state */ |
105 | }, | 108 | }, |
106 | { | 109 | { |
107 | .name = "AC97 Aux", | 110 | .name = "AC97 Aux", |
108 | .stream_name = "AC97 Aux", | 111 | .stream_name = "AC97 Aux", |
109 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 112 | .cpu_dai_name = "pxa-ac97.1", |
110 | .codec_dai = &wm9705_dai[WM9705_DAI_AC97_AUX], | 113 | .codec_dai_name ="wm9705-aux", |
114 | .platform_name = "pxa-pcm-audio", | ||
115 | .codec_name = "wm9705-codec", | ||
111 | }, | 116 | }, |
112 | }; | 117 | }; |
113 | 118 | ||
114 | static struct snd_soc_card e750 = { | 119 | static struct snd_soc_card e750 = { |
115 | .name = "Toshiba e750", | 120 | .name = "Toshiba e750", |
116 | .platform = &pxa2xx_soc_platform, | ||
117 | .dai_link = e750_dai, | 121 | .dai_link = e750_dai, |
118 | .num_links = ARRAY_SIZE(e750_dai), | 122 | .num_links = ARRAY_SIZE(e750_dai), |
119 | }; | 123 | }; |
120 | 124 | ||
121 | static struct snd_soc_device e750_snd_devdata = { | ||
122 | .card = &e750, | ||
123 | .codec_dev = &soc_codec_dev_wm9705, | ||
124 | }; | ||
125 | |||
126 | static struct platform_device *e750_snd_device; | 125 | static struct platform_device *e750_snd_device; |
127 | 126 | ||
128 | static int __init e750_init(void) | 127 | static int __init e750_init(void) |
@@ -154,8 +153,7 @@ static int __init e750_init(void) | |||
154 | goto free_spk_amp_gpio; | 153 | goto free_spk_amp_gpio; |
155 | } | 154 | } |
156 | 155 | ||
157 | platform_set_drvdata(e750_snd_device, &e750_snd_devdata); | 156 | platform_set_drvdata(e750_snd_device, &e750); |
158 | e750_snd_devdata.dev = &e750_snd_device->dev; | ||
159 | ret = platform_device_add(e750_snd_device); | 157 | ret = platform_device_add(e750_snd_device); |
160 | 158 | ||
161 | if (!ret) | 159 | if (!ret) |
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index bc019cdce429..d42e5fe832c5 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <mach/eseries-gpio.h> | 23 | #include <mach/eseries-gpio.h> |
24 | 24 | ||
25 | #include "../codecs/wm9712.h" | 25 | #include "../codecs/wm9712.h" |
26 | #include "pxa2xx-pcm.h" | ||
27 | #include "pxa2xx-ac97.h" | 26 | #include "pxa2xx-ac97.h" |
28 | 27 | ||
29 | static int e800_spk_amp_event(struct snd_soc_dapm_widget *w, | 28 | static int e800_spk_amp_event(struct snd_soc_dapm_widget *w, |
@@ -73,8 +72,10 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
73 | {"MIC2", NULL, "Mic (Internal2)"}, | 72 | {"MIC2", NULL, "Mic (Internal2)"}, |
74 | }; | 73 | }; |
75 | 74 | ||
76 | static int e800_ac97_init(struct snd_soc_codec *codec) | 75 | static int e800_ac97_init(struct snd_soc_pcm_runtime *rtd) |
77 | { | 76 | { |
77 | struct snd_soc_codec *codec = rtd->codec; | ||
78 | |||
78 | snd_soc_dapm_new_controls(codec, e800_dapm_widgets, | 79 | snd_soc_dapm_new_controls(codec, e800_dapm_widgets, |
79 | ARRAY_SIZE(e800_dapm_widgets)); | 80 | ARRAY_SIZE(e800_dapm_widgets)); |
80 | 81 | ||
@@ -88,30 +89,28 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
88 | { | 89 | { |
89 | .name = "AC97", | 90 | .name = "AC97", |
90 | .stream_name = "AC97 HiFi", | 91 | .stream_name = "AC97 HiFi", |
91 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 92 | .cpu_dai_name = "pxa-ac97.0", |
92 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI], | 93 | .codec_dai_name = "wm9712-hifi", |
94 | .platform_name = "pxa-pcm-audio", | ||
95 | .codec_name = "wm9712-codec", | ||
93 | .init = e800_ac97_init, | 96 | .init = e800_ac97_init, |
94 | }, | 97 | }, |
95 | { | 98 | { |
96 | .name = "AC97 Aux", | 99 | .name = "AC97 Aux", |
97 | .stream_name = "AC97 Aux", | 100 | .stream_name = "AC97 Aux", |
98 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 101 | .cpu_dai_name = "pxa-ac97.1", |
99 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX], | 102 | .codec_dai_name ="wm9712-aux", |
103 | .platform_name = "pxa-pcm-audio", | ||
104 | .codec_name = "wm9712-codec", | ||
100 | }, | 105 | }, |
101 | }; | 106 | }; |
102 | 107 | ||
103 | static struct snd_soc_card e800 = { | 108 | static struct snd_soc_card e800 = { |
104 | .name = "Toshiba e800", | 109 | .name = "Toshiba e800", |
105 | .platform = &pxa2xx_soc_platform, | ||
106 | .dai_link = e800_dai, | 110 | .dai_link = e800_dai, |
107 | .num_links = ARRAY_SIZE(e800_dai), | 111 | .num_links = ARRAY_SIZE(e800_dai), |
108 | }; | 112 | }; |
109 | 113 | ||
110 | static struct snd_soc_device e800_snd_devdata = { | ||
111 | .card = &e800, | ||
112 | .codec_dev = &soc_codec_dev_wm9712, | ||
113 | }; | ||
114 | |||
115 | static struct platform_device *e800_snd_device; | 114 | static struct platform_device *e800_snd_device; |
116 | 115 | ||
117 | static int __init e800_init(void) | 116 | static int __init e800_init(void) |
@@ -141,8 +140,7 @@ static int __init e800_init(void) | |||
141 | if (!e800_snd_device) | 140 | if (!e800_snd_device) |
142 | return -ENOMEM; | 141 | return -ENOMEM; |
143 | 142 | ||
144 | platform_set_drvdata(e800_snd_device, &e800_snd_devdata); | 143 | platform_set_drvdata(e800_snd_device, &e800); |
145 | e800_snd_devdata.dev = &e800_snd_device->dev; | ||
146 | ret = platform_device_add(e800_snd_device); | 144 | ret = platform_device_add(e800_snd_device); |
147 | 145 | ||
148 | if (!ret) | 146 | if (!ret) |
diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index f4756e4025fd..eadf9d351a04 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c | |||
@@ -32,36 +32,33 @@ | |||
32 | #include <mach/audio.h> | 32 | #include <mach/audio.h> |
33 | 33 | ||
34 | #include "../codecs/wm9712.h" | 34 | #include "../codecs/wm9712.h" |
35 | #include "pxa2xx-pcm.h" | ||
36 | #include "pxa2xx-ac97.h" | 35 | #include "pxa2xx-ac97.h" |
37 | 36 | ||
38 | static struct snd_soc_dai_link em_x270_dai[] = { | 37 | static struct snd_soc_dai_link em_x270_dai[] = { |
39 | { | 38 | { |
40 | .name = "AC97", | 39 | .name = "AC97", |
41 | .stream_name = "AC97 HiFi", | 40 | .stream_name = "AC97 HiFi", |
42 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 41 | .cpu_dai_name = "pxa-ac97.0", |
43 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI], | 42 | .codec_dai_name = "wm9712-hifi", |
43 | .platform_name = "pxa-pcm-audio", | ||
44 | .codec_name = "wm9712-codec", | ||
44 | }, | 45 | }, |
45 | { | 46 | { |
46 | .name = "AC97 Aux", | 47 | .name = "AC97 Aux", |
47 | .stream_name = "AC97 Aux", | 48 | .stream_name = "AC97 Aux", |
48 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 49 | .cpu_dai_name = "pxa-ac97.1", |
49 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX], | 50 | .codec_dai_name ="wm9712-aux", |
51 | .platform_name = "pxa-pcm-audio", | ||
52 | .codec_name = "wm9712-codec", | ||
50 | }, | 53 | }, |
51 | }; | 54 | }; |
52 | 55 | ||
53 | static struct snd_soc_card em_x270 = { | 56 | static struct snd_soc_card em_x270 = { |
54 | .name = "EM-X270", | 57 | .name = "EM-X270", |
55 | .platform = &pxa2xx_soc_platform, | ||
56 | .dai_link = em_x270_dai, | 58 | .dai_link = em_x270_dai, |
57 | .num_links = ARRAY_SIZE(em_x270_dai), | 59 | .num_links = ARRAY_SIZE(em_x270_dai), |
58 | }; | 60 | }; |
59 | 61 | ||
60 | static struct snd_soc_device em_x270_snd_devdata = { | ||
61 | .card = &em_x270, | ||
62 | .codec_dev = &soc_codec_dev_wm9712, | ||
63 | }; | ||
64 | |||
65 | static struct platform_device *em_x270_snd_device; | 62 | static struct platform_device *em_x270_snd_device; |
66 | 63 | ||
67 | static int __init em_x270_init(void) | 64 | static int __init em_x270_init(void) |
@@ -76,8 +73,7 @@ static int __init em_x270_init(void) | |||
76 | if (!em_x270_snd_device) | 73 | if (!em_x270_snd_device) |
77 | return -ENOMEM; | 74 | return -ENOMEM; |
78 | 75 | ||
79 | platform_set_drvdata(em_x270_snd_device, &em_x270_snd_devdata); | 76 | platform_set_drvdata(em_x270_snd_device, &em_x270); |
80 | em_x270_snd_devdata.dev = &em_x270_snd_device->dev; | ||
81 | ret = platform_device_add(em_x270_snd_device); | 77 | ret = platform_device_add(em_x270_snd_device); |
82 | 78 | ||
83 | if (ret) | 79 | if (ret) |
diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c index 405587a01160..154fc6f23438 100644 --- a/sound/soc/pxa/imote2.c +++ b/sound/soc/pxa/imote2.c | |||
@@ -6,14 +6,13 @@ | |||
6 | 6 | ||
7 | #include "../codecs/wm8940.h" | 7 | #include "../codecs/wm8940.h" |
8 | #include "pxa2xx-i2s.h" | 8 | #include "pxa2xx-i2s.h" |
9 | #include "pxa2xx-pcm.h" | ||
10 | 9 | ||
11 | static int imote2_asoc_hw_params(struct snd_pcm_substream *substream, | 10 | static int imote2_asoc_hw_params(struct snd_pcm_substream *substream, |
12 | struct snd_pcm_hw_params *params) | 11 | struct snd_pcm_hw_params *params) |
13 | { | 12 | { |
14 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 13 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
15 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 14 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
16 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 15 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
17 | unsigned int clk = 0; | 16 | unsigned int clk = 0; |
18 | int ret; | 17 | int ret; |
19 | 18 | ||
@@ -64,23 +63,19 @@ static struct snd_soc_ops imote2_asoc_ops = { | |||
64 | static struct snd_soc_dai_link imote2_dai = { | 63 | static struct snd_soc_dai_link imote2_dai = { |
65 | .name = "WM8940", | 64 | .name = "WM8940", |
66 | .stream_name = "WM8940", | 65 | .stream_name = "WM8940", |
67 | .cpu_dai = &pxa_i2s_dai, | 66 | .cpu_dai_name = "pxa2xx-i2s", |
68 | .codec_dai = &wm8940_dai, | 67 | .codec_dai_name = "wm8940-hifi", |
68 | .platform_name = "pxa-pcm-audio", | ||
69 | .codec_name = "wm8940-codec.0-0034", | ||
69 | .ops = &imote2_asoc_ops, | 70 | .ops = &imote2_asoc_ops, |
70 | }; | 71 | }; |
71 | 72 | ||
72 | static struct snd_soc_card snd_soc_imote2 = { | 73 | static struct snd_soc_card snd_soc_imote2 = { |
73 | .name = "Imote2", | 74 | .name = "Imote2", |
74 | .platform = &pxa2xx_soc_platform, | ||
75 | .dai_link = &imote2_dai, | 75 | .dai_link = &imote2_dai, |
76 | .num_links = 1, | 76 | .num_links = 1, |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static struct snd_soc_device imote2_snd_devdata = { | ||
80 | .card = &snd_soc_imote2, | ||
81 | .codec_dev = &soc_codec_dev_wm8940, | ||
82 | }; | ||
83 | |||
84 | static struct platform_device *imote2_snd_device; | 79 | static struct platform_device *imote2_snd_device; |
85 | 80 | ||
86 | static int __init imote2_asoc_init(void) | 81 | static int __init imote2_asoc_init(void) |
@@ -93,8 +88,7 @@ static int __init imote2_asoc_init(void) | |||
93 | if (!imote2_snd_device) | 88 | if (!imote2_snd_device) |
94 | return -ENOMEM; | 89 | return -ENOMEM; |
95 | 90 | ||
96 | platform_set_drvdata(imote2_snd_device, &imote2_snd_devdata); | 91 | platform_set_drvdata(imote2_snd_device, &snd_soc_imote2); |
97 | imote2_snd_devdata.dev = &imote2_snd_device->dev; | ||
98 | ret = platform_device_add(imote2_snd_device); | 92 | ret = platform_device_add(imote2_snd_device); |
99 | if (ret) | 93 | if (ret) |
100 | platform_device_put(imote2_snd_device); | 94 | platform_device_put(imote2_snd_device); |
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c index 4c8d99a8d386..b8207ced4072 100644 --- a/sound/soc/pxa/magician.c +++ b/sound/soc/pxa/magician.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <mach/magician.h> | 32 | #include <mach/magician.h> |
33 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
34 | #include "../codecs/uda1380.h" | 34 | #include "../codecs/uda1380.h" |
35 | #include "pxa2xx-pcm.h" | ||
36 | #include "pxa2xx-i2s.h" | 35 | #include "pxa2xx-i2s.h" |
37 | #include "pxa-ssp.h" | 36 | #include "pxa-ssp.h" |
38 | 37 | ||
@@ -71,7 +70,7 @@ static void magician_ext_control(struct snd_soc_codec *codec) | |||
71 | static int magician_startup(struct snd_pcm_substream *substream) | 70 | static int magician_startup(struct snd_pcm_substream *substream) |
72 | { | 71 | { |
73 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 72 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
74 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 73 | struct snd_soc_codec *codec = rtd->codec; |
75 | 74 | ||
76 | /* check the jack status at stream startup */ | 75 | /* check the jack status at stream startup */ |
77 | magician_ext_control(codec); | 76 | magician_ext_control(codec); |
@@ -86,8 +85,8 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream, | |||
86 | struct snd_pcm_hw_params *params) | 85 | struct snd_pcm_hw_params *params) |
87 | { | 86 | { |
88 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 87 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
89 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 88 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
90 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 89 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
91 | unsigned int acps, acds, width, rate; | 90 | unsigned int acps, acds, width, rate; |
92 | unsigned int div4 = PXA_SSP_CLK_SCDB_4; | 91 | unsigned int div4 = PXA_SSP_CLK_SCDB_4; |
93 | int ret = 0; | 92 | int ret = 0; |
@@ -227,8 +226,8 @@ static int magician_capture_hw_params(struct snd_pcm_substream *substream, | |||
227 | struct snd_pcm_hw_params *params) | 226 | struct snd_pcm_hw_params *params) |
228 | { | 227 | { |
229 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 228 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
230 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 229 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
231 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 230 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
232 | int ret = 0; | 231 | int ret = 0; |
233 | 232 | ||
234 | /* set codec DAI configuration */ | 233 | /* set codec DAI configuration */ |
@@ -393,8 +392,9 @@ static const struct snd_kcontrol_new uda1380_magician_controls[] = { | |||
393 | /* | 392 | /* |
394 | * Logic for a uda1380 as connected on a HTC Magician | 393 | * Logic for a uda1380 as connected on a HTC Magician |
395 | */ | 394 | */ |
396 | static int magician_uda1380_init(struct snd_soc_codec *codec) | 395 | static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd) |
397 | { | 396 | { |
397 | struct snd_soc_codec *codec = rtd->codec; | ||
398 | int err; | 398 | int err; |
399 | 399 | ||
400 | /* NC codec pins */ | 400 | /* NC codec pins */ |
@@ -427,16 +427,20 @@ static struct snd_soc_dai_link magician_dai[] = { | |||
427 | { | 427 | { |
428 | .name = "uda1380", | 428 | .name = "uda1380", |
429 | .stream_name = "UDA1380 Playback", | 429 | .stream_name = "UDA1380 Playback", |
430 | .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP1], | 430 | .cpu_dai_name = "pxa-ssp-dai.0", |
431 | .codec_dai = &uda1380_dai[UDA1380_DAI_PLAYBACK], | 431 | .codec_dai_name = "uda1380-hifi-playback", |
432 | .platform_name = "pxa-pcm-audio", | ||
433 | .codec_name = "uda1380-codec.0-0018", | ||
432 | .init = magician_uda1380_init, | 434 | .init = magician_uda1380_init, |
433 | .ops = &magician_playback_ops, | 435 | .ops = &magician_playback_ops, |
434 | }, | 436 | }, |
435 | { | 437 | { |
436 | .name = "uda1380", | 438 | .name = "uda1380", |
437 | .stream_name = "UDA1380 Capture", | 439 | .stream_name = "UDA1380 Capture", |
438 | .cpu_dai = &pxa_i2s_dai, | 440 | .cpu_dai_name = "pxa2xx-i2s", |
439 | .codec_dai = &uda1380_dai[UDA1380_DAI_CAPTURE], | 441 | .codec_dai_name = "uda1380-hifi-capture", |
442 | .platform_name = "pxa-pcm-audio", | ||
443 | .codec_name = "uda1380-codec.0-0018", | ||
440 | .ops = &magician_capture_ops, | 444 | .ops = &magician_capture_ops, |
441 | } | 445 | } |
442 | }; | 446 | }; |
@@ -446,13 +450,7 @@ static struct snd_soc_card snd_soc_card_magician = { | |||
446 | .name = "Magician", | 450 | .name = "Magician", |
447 | .dai_link = magician_dai, | 451 | .dai_link = magician_dai, |
448 | .num_links = ARRAY_SIZE(magician_dai), | 452 | .num_links = ARRAY_SIZE(magician_dai), |
449 | .platform = &pxa2xx_soc_platform, | ||
450 | }; | ||
451 | 453 | ||
452 | /* magician audio subsystem */ | ||
453 | static struct snd_soc_device magician_snd_devdata = { | ||
454 | .card = &snd_soc_card_magician, | ||
455 | .codec_dev = &soc_codec_dev_uda1380, | ||
456 | }; | 454 | }; |
457 | 455 | ||
458 | static struct platform_device *magician_snd_device; | 456 | static struct platform_device *magician_snd_device; |
@@ -514,8 +512,7 @@ static int __init magician_init(void) | |||
514 | goto err_pdev; | 512 | goto err_pdev; |
515 | } | 513 | } |
516 | 514 | ||
517 | platform_set_drvdata(magician_snd_device, &magician_snd_devdata); | 515 | platform_set_drvdata(magician_snd_device, &snd_soc_card_magician); |
518 | magician_snd_devdata.dev = &magician_snd_device->dev; | ||
519 | ret = platform_device_add(magician_snd_device); | 516 | ret = platform_device_add(magician_snd_device); |
520 | if (ret) { | 517 | if (ret) { |
521 | platform_device_put(magician_snd_device); | 518 | platform_device_put(magician_snd_device); |
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 19eda8bbfdaf..f284cc54bc80 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c | |||
@@ -54,7 +54,6 @@ | |||
54 | #include <sound/initval.h> | 54 | #include <sound/initval.h> |
55 | #include <sound/ac97_codec.h> | 55 | #include <sound/ac97_codec.h> |
56 | 56 | ||
57 | #include "pxa2xx-pcm.h" | ||
58 | #include "pxa2xx-ac97.h" | 57 | #include "pxa2xx-ac97.h" |
59 | #include "../codecs/wm9713.h" | 58 | #include "../codecs/wm9713.h" |
60 | 59 | ||
@@ -128,8 +127,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
128 | {"Rear Speaker", NULL, "SPKR"}, | 127 | {"Rear Speaker", NULL, "SPKR"}, |
129 | }; | 128 | }; |
130 | 129 | ||
131 | static int mioa701_wm9713_init(struct snd_soc_codec *codec) | 130 | static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd) |
132 | { | 131 | { |
132 | struct snd_soc_codec *codec = rtd->codec; | ||
133 | unsigned short reg; | 133 | unsigned short reg; |
134 | 134 | ||
135 | /* Add mioa701 specific widgets */ | 135 | /* Add mioa701 specific widgets */ |
@@ -139,12 +139,12 @@ static int mioa701_wm9713_init(struct snd_soc_codec *codec) | |||
139 | snd_soc_dapm_add_routes(codec, ARRAY_AND_SIZE(audio_map)); | 139 | snd_soc_dapm_add_routes(codec, ARRAY_AND_SIZE(audio_map)); |
140 | 140 | ||
141 | /* Prepare GPIO8 for rear speaker amplifier */ | 141 | /* Prepare GPIO8 for rear speaker amplifier */ |
142 | reg = codec->read(codec, AC97_GPIO_CFG); | 142 | reg = codec->driver->read(codec, AC97_GPIO_CFG); |
143 | codec->write(codec, AC97_GPIO_CFG, reg | 0x0100); | 143 | codec->driver->write(codec, AC97_GPIO_CFG, reg | 0x0100); |
144 | 144 | ||
145 | /* Prepare MIC input */ | 145 | /* Prepare MIC input */ |
146 | reg = codec->read(codec, AC97_3D_CONTROL); | 146 | reg = codec->driver->read(codec, AC97_3D_CONTROL); |
147 | codec->write(codec, AC97_3D_CONTROL, reg | 0xc000); | 147 | codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000); |
148 | 148 | ||
149 | snd_soc_dapm_enable_pin(codec, "Front Speaker"); | 149 | snd_soc_dapm_enable_pin(codec, "Front Speaker"); |
150 | snd_soc_dapm_enable_pin(codec, "Rear Speaker"); | 150 | snd_soc_dapm_enable_pin(codec, "Rear Speaker"); |
@@ -162,32 +162,30 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
162 | { | 162 | { |
163 | .name = "AC97", | 163 | .name = "AC97", |
164 | .stream_name = "AC97 HiFi", | 164 | .stream_name = "AC97 HiFi", |
165 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 165 | .cpu_dai_name = "pxa-ac97.0", |
166 | .codec_dai = &wm9713_dai[WM9713_DAI_AC97_HIFI], | 166 | .codec_dai_name = "wm9713-hifi", |
167 | .codec_name = "wm9713-codec", | ||
167 | .init = mioa701_wm9713_init, | 168 | .init = mioa701_wm9713_init, |
169 | .platform_name = "pxa-pcm-audio", | ||
168 | .ops = &mioa701_ops, | 170 | .ops = &mioa701_ops, |
169 | }, | 171 | }, |
170 | { | 172 | { |
171 | .name = "AC97 Aux", | 173 | .name = "AC97 Aux", |
172 | .stream_name = "AC97 Aux", | 174 | .stream_name = "AC97 Aux", |
173 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 175 | .cpu_dai_name = "pxa-ac97.1", |
174 | .codec_dai = &wm9713_dai[WM9713_DAI_AC97_AUX], | 176 | .codec_dai_name ="wm9713-aux", |
177 | .codec_name = "wm9713-codec", | ||
178 | .platform_name = "pxa-pcm-audio", | ||
175 | .ops = &mioa701_ops, | 179 | .ops = &mioa701_ops, |
176 | }, | 180 | }, |
177 | }; | 181 | }; |
178 | 182 | ||
179 | static struct snd_soc_card mioa701 = { | 183 | static struct snd_soc_card mioa701 = { |
180 | .name = "MioA701", | 184 | .name = "MioA701", |
181 | .platform = &pxa2xx_soc_platform, | ||
182 | .dai_link = mioa701_dai, | 185 | .dai_link = mioa701_dai, |
183 | .num_links = ARRAY_SIZE(mioa701_dai), | 186 | .num_links = ARRAY_SIZE(mioa701_dai), |
184 | }; | 187 | }; |
185 | 188 | ||
186 | static struct snd_soc_device mioa701_snd_devdata = { | ||
187 | .card = &mioa701, | ||
188 | .codec_dev = &soc_codec_dev_wm9713, | ||
189 | }; | ||
190 | |||
191 | static struct platform_device *mioa701_snd_device; | 189 | static struct platform_device *mioa701_snd_device; |
192 | 190 | ||
193 | static int mioa701_wm9713_probe(struct platform_device *pdev) | 191 | static int mioa701_wm9713_probe(struct platform_device *pdev) |
@@ -205,8 +203,7 @@ static int mioa701_wm9713_probe(struct platform_device *pdev) | |||
205 | if (!mioa701_snd_device) | 203 | if (!mioa701_snd_device) |
206 | return -ENOMEM; | 204 | return -ENOMEM; |
207 | 205 | ||
208 | platform_set_drvdata(mioa701_snd_device, &mioa701_snd_devdata); | 206 | platform_set_drvdata(mioa701_snd_device, &mioa701); |
209 | mioa701_snd_devdata.dev = &mioa701_snd_device->dev; | ||
210 | 207 | ||
211 | ret = platform_device_add(mioa701_snd_device); | 208 | ret = platform_device_add(mioa701_snd_device); |
212 | if (!ret) | 209 | if (!ret) |
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 1f96e3227be5..13f6d485d571 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <mach/palmasoc.h> | 29 | #include <mach/palmasoc.h> |
30 | 30 | ||
31 | #include "../codecs/wm9712.h" | 31 | #include "../codecs/wm9712.h" |
32 | #include "pxa2xx-pcm.h" | ||
33 | #include "pxa2xx-ac97.h" | 32 | #include "pxa2xx-ac97.h" |
34 | 33 | ||
35 | static struct snd_soc_jack hs_jack; | 34 | static struct snd_soc_jack hs_jack; |
@@ -75,8 +74,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
75 | 74 | ||
76 | static struct snd_soc_card palm27x_asoc; | 75 | static struct snd_soc_card palm27x_asoc; |
77 | 76 | ||
78 | static int palm27x_ac97_init(struct snd_soc_codec *codec) | 77 | static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd) |
79 | { | 78 | { |
79 | struct snd_soc_codec *codec = rtd->codec; | ||
80 | int err; | 80 | int err; |
81 | 81 | ||
82 | /* add palm27x specific widgets */ | 82 | /* add palm27x specific widgets */ |
@@ -112,7 +112,7 @@ static int palm27x_ac97_init(struct snd_soc_codec *codec) | |||
112 | return err; | 112 | return err; |
113 | 113 | ||
114 | /* Jack detection API stuff */ | 114 | /* Jack detection API stuff */ |
115 | err = snd_soc_jack_new(&palm27x_asoc, "Headphone Jack", | 115 | err = snd_soc_jack_new(codec, "Headphone Jack", |
116 | SND_JACK_HEADPHONE, &hs_jack); | 116 | SND_JACK_HEADPHONE, &hs_jack); |
117 | if (err) | 117 | if (err) |
118 | return err; | 118 | return err; |
@@ -132,30 +132,28 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
132 | { | 132 | { |
133 | .name = "AC97 HiFi", | 133 | .name = "AC97 HiFi", |
134 | .stream_name = "AC97 HiFi", | 134 | .stream_name = "AC97 HiFi", |
135 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 135 | .cpu_dai_name = "pxa-ac97.0", |
136 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI], | 136 | .codec_dai_name = "wm9712-hifi", |
137 | .codec_name = "wm9712-codec", | ||
138 | .platform_name = "pxa-pcm-audio", | ||
137 | .init = palm27x_ac97_init, | 139 | .init = palm27x_ac97_init, |
138 | }, | 140 | }, |
139 | { | 141 | { |
140 | .name = "AC97 Aux", | 142 | .name = "AC97 Aux", |
141 | .stream_name = "AC97 Aux", | 143 | .stream_name = "AC97 Aux", |
142 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 144 | .cpu_dai_name = "pxa-ac97.1", |
143 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX], | 145 | .codec_dai_name = "wm9712-aux", |
146 | .codec_name = "wm9712-codec", | ||
147 | .platform_name = "pxa-pcm-audio", | ||
144 | }, | 148 | }, |
145 | }; | 149 | }; |
146 | 150 | ||
147 | static struct snd_soc_card palm27x_asoc = { | 151 | static struct snd_soc_card palm27x_asoc = { |
148 | .name = "Palm/PXA27x", | 152 | .name = "Palm/PXA27x", |
149 | .platform = &pxa2xx_soc_platform, | ||
150 | .dai_link = palm27x_dai, | 153 | .dai_link = palm27x_dai, |
151 | .num_links = ARRAY_SIZE(palm27x_dai), | 154 | .num_links = ARRAY_SIZE(palm27x_dai), |
152 | }; | 155 | }; |
153 | 156 | ||
154 | static struct snd_soc_device palm27x_snd_devdata = { | ||
155 | .card = &palm27x_asoc, | ||
156 | .codec_dev = &soc_codec_dev_wm9712, | ||
157 | }; | ||
158 | |||
159 | static struct platform_device *palm27x_snd_device; | 157 | static struct platform_device *palm27x_snd_device; |
160 | 158 | ||
161 | static int palm27x_asoc_probe(struct platform_device *pdev) | 159 | static int palm27x_asoc_probe(struct platform_device *pdev) |
@@ -178,8 +176,7 @@ static int palm27x_asoc_probe(struct platform_device *pdev) | |||
178 | if (!palm27x_snd_device) | 176 | if (!palm27x_snd_device) |
179 | return -ENOMEM; | 177 | return -ENOMEM; |
180 | 178 | ||
181 | platform_set_drvdata(palm27x_snd_device, &palm27x_snd_devdata); | 179 | platform_set_drvdata(palm27x_snd_device, &palm27x_asoc); |
182 | palm27x_snd_devdata.dev = &palm27x_snd_device->dev; | ||
183 | ret = platform_device_add(palm27x_snd_device); | 180 | ret = platform_device_add(palm27x_snd_device); |
184 | 181 | ||
185 | if (ret != 0) | 182 | if (ret != 0) |
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index c5f36e0eab58..af84ee9c5e11 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <mach/audio.h> | 31 | #include <mach/audio.h> |
32 | 32 | ||
33 | #include "../codecs/wm8731.h" | 33 | #include "../codecs/wm8731.h" |
34 | #include "pxa2xx-pcm.h" | ||
35 | #include "pxa2xx-i2s.h" | 34 | #include "pxa2xx-i2s.h" |
36 | 35 | ||
37 | #define POODLE_HP 1 | 36 | #define POODLE_HP 1 |
@@ -76,7 +75,7 @@ static void poodle_ext_control(struct snd_soc_codec *codec) | |||
76 | static int poodle_startup(struct snd_pcm_substream *substream) | 75 | static int poodle_startup(struct snd_pcm_substream *substream) |
77 | { | 76 | { |
78 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 77 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
79 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 78 | struct snd_soc_codec *codec = rtd->codec; |
80 | 79 | ||
81 | /* check the jack status at stream startup */ | 80 | /* check the jack status at stream startup */ |
82 | poodle_ext_control(codec); | 81 | poodle_ext_control(codec); |
@@ -97,8 +96,8 @@ static int poodle_hw_params(struct snd_pcm_substream *substream, | |||
97 | struct snd_pcm_hw_params *params) | 96 | struct snd_pcm_hw_params *params) |
98 | { | 97 | { |
99 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 98 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
100 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 99 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
101 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 100 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
102 | unsigned int clk = 0; | 101 | unsigned int clk = 0; |
103 | int ret = 0; | 102 | int ret = 0; |
104 | 103 | ||
@@ -129,7 +128,7 @@ static int poodle_hw_params(struct snd_pcm_substream *substream, | |||
129 | return ret; | 128 | return ret; |
130 | 129 | ||
131 | /* set the codec system clock for DAC and ADC */ | 130 | /* set the codec system clock for DAC and ADC */ |
132 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, clk, | 131 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, |
133 | SND_SOC_CLOCK_IN); | 132 | SND_SOC_CLOCK_IN); |
134 | if (ret < 0) | 133 | if (ret < 0) |
135 | return ret; | 134 | return ret; |
@@ -237,8 +236,9 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = { | |||
237 | /* | 236 | /* |
238 | * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device | 237 | * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device |
239 | */ | 238 | */ |
240 | static int poodle_wm8731_init(struct snd_soc_codec *codec) | 239 | static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
241 | { | 240 | { |
241 | struct snd_soc_codec *codec = rtd->codec; | ||
242 | int err; | 242 | int err; |
243 | 243 | ||
244 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); | 244 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); |
@@ -266,8 +266,10 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) | |||
266 | static struct snd_soc_dai_link poodle_dai = { | 266 | static struct snd_soc_dai_link poodle_dai = { |
267 | .name = "WM8731", | 267 | .name = "WM8731", |
268 | .stream_name = "WM8731", | 268 | .stream_name = "WM8731", |
269 | .cpu_dai = &pxa_i2s_dai, | 269 | .cpu_dai_name = "pxa2xx-i2s", |
270 | .codec_dai = &wm8731_dai, | 270 | .codec_dai_name = "wm8731-hifi", |
271 | .platform_name = "pxa-pcm-audio", | ||
272 | .codec_name = "wm8731-codec.0-001a", | ||
271 | .init = poodle_wm8731_init, | 273 | .init = poodle_wm8731_init, |
272 | .ops = &poodle_ops, | 274 | .ops = &poodle_ops, |
273 | }; | 275 | }; |
@@ -275,15 +277,9 @@ static struct snd_soc_dai_link poodle_dai = { | |||
275 | /* poodle audio machine driver */ | 277 | /* poodle audio machine driver */ |
276 | static struct snd_soc_card snd_soc_poodle = { | 278 | static struct snd_soc_card snd_soc_poodle = { |
277 | .name = "Poodle", | 279 | .name = "Poodle", |
278 | .platform = &pxa2xx_soc_platform, | ||
279 | .dai_link = &poodle_dai, | 280 | .dai_link = &poodle_dai, |
280 | .num_links = 1, | 281 | .num_links = 1, |
281 | }; | 282 | .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 | }; | 283 | }; |
288 | 284 | ||
289 | static struct platform_device *poodle_snd_device; | 285 | static struct platform_device *poodle_snd_device; |
@@ -307,8 +303,7 @@ static int __init poodle_init(void) | |||
307 | if (!poodle_snd_device) | 303 | if (!poodle_snd_device) |
308 | return -ENOMEM; | 304 | return -ENOMEM; |
309 | 305 | ||
310 | platform_set_drvdata(poodle_snd_device, &poodle_snd_devdata); | 306 | 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); | 307 | ret = platform_device_add(poodle_snd_device); |
313 | 308 | ||
314 | if (ret) | 309 | if (ret) |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index a1fd23e0e3d0..b439eee462cb 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <mach/audio.h> | 35 | #include <mach/audio.h> |
36 | #include <plat/ssp.h> | 36 | #include <plat/ssp.h> |
37 | 37 | ||
38 | #include "pxa2xx-pcm.h" | 38 | #include "../../arm/pxa2xx-pcm.h" |
39 | #include "pxa-ssp.h" | 39 | #include "pxa-ssp.h" |
40 | 40 | ||
41 | /* | 41 | /* |
@@ -108,11 +108,9 @@ pxa_ssp_get_dma_params(struct ssp_device *ssp, int width4, int out) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | static int pxa_ssp_startup(struct snd_pcm_substream *substream, | 110 | static int pxa_ssp_startup(struct snd_pcm_substream *substream, |
111 | struct snd_soc_dai *dai) | 111 | struct snd_soc_dai *cpu_dai) |
112 | { | 112 | { |
113 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 113 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
114 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
115 | struct ssp_priv *priv = cpu_dai->private_data; | ||
116 | struct ssp_device *ssp = priv->ssp; | 114 | struct ssp_device *ssp = priv->ssp; |
117 | int ret = 0; | 115 | int ret = 0; |
118 | 116 | ||
@@ -128,11 +126,9 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream, | |||
128 | } | 126 | } |
129 | 127 | ||
130 | static void pxa_ssp_shutdown(struct snd_pcm_substream *substream, | 128 | static void pxa_ssp_shutdown(struct snd_pcm_substream *substream, |
131 | struct snd_soc_dai *dai) | 129 | struct snd_soc_dai *cpu_dai) |
132 | { | 130 | { |
133 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 131 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
134 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
135 | struct ssp_priv *priv = cpu_dai->private_data; | ||
136 | struct ssp_device *ssp = priv->ssp; | 132 | struct ssp_device *ssp = priv->ssp; |
137 | 133 | ||
138 | if (!cpu_dai->active) { | 134 | if (!cpu_dai->active) { |
@@ -148,7 +144,7 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream, | |||
148 | 144 | ||
149 | static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai) | 145 | static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai) |
150 | { | 146 | { |
151 | struct ssp_priv *priv = cpu_dai->private_data; | 147 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
152 | struct ssp_device *ssp = priv->ssp; | 148 | struct ssp_device *ssp = priv->ssp; |
153 | 149 | ||
154 | if (!cpu_dai->active) | 150 | if (!cpu_dai->active) |
@@ -166,7 +162,7 @@ static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai) | |||
166 | 162 | ||
167 | static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai) | 163 | static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai) |
168 | { | 164 | { |
169 | struct ssp_priv *priv = cpu_dai->private_data; | 165 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
170 | struct ssp_device *ssp = priv->ssp; | 166 | struct ssp_device *ssp = priv->ssp; |
171 | uint32_t sssr = SSSR_ROR | SSSR_TUR | SSSR_BCE; | 167 | uint32_t sssr = SSSR_ROR | SSSR_TUR | SSSR_BCE; |
172 | 168 | ||
@@ -230,7 +226,7 @@ static u32 pxa_ssp_get_scr(struct ssp_device *ssp) | |||
230 | static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | 226 | static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, |
231 | int clk_id, unsigned int freq, int dir) | 227 | int clk_id, unsigned int freq, int dir) |
232 | { | 228 | { |
233 | struct ssp_priv *priv = cpu_dai->private_data; | 229 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
234 | struct ssp_device *ssp = priv->ssp; | 230 | struct ssp_device *ssp = priv->ssp; |
235 | int val; | 231 | int val; |
236 | 232 | ||
@@ -287,7 +283,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
287 | static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, | 283 | static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, |
288 | int div_id, int div) | 284 | int div_id, int div) |
289 | { | 285 | { |
290 | struct ssp_priv *priv = cpu_dai->private_data; | 286 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
291 | struct ssp_device *ssp = priv->ssp; | 287 | struct ssp_device *ssp = priv->ssp; |
292 | int val; | 288 | int val; |
293 | 289 | ||
@@ -338,7 +334,7 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, | |||
338 | static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id, | 334 | static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id, |
339 | int source, unsigned int freq_in, unsigned int freq_out) | 335 | int source, unsigned int freq_in, unsigned int freq_out) |
340 | { | 336 | { |
341 | struct ssp_priv *priv = cpu_dai->private_data; | 337 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
342 | struct ssp_device *ssp = priv->ssp; | 338 | struct ssp_device *ssp = priv->ssp; |
343 | u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70; | 339 | u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70; |
344 | 340 | ||
@@ -407,7 +403,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id, | |||
407 | static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | 403 | static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, |
408 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) | 404 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) |
409 | { | 405 | { |
410 | struct ssp_priv *priv = cpu_dai->private_data; | 406 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
411 | struct ssp_device *ssp = priv->ssp; | 407 | struct ssp_device *ssp = priv->ssp; |
412 | u32 sscr0; | 408 | u32 sscr0; |
413 | 409 | ||
@@ -442,7 +438,7 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | |||
442 | static int pxa_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai, | 438 | static int pxa_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai, |
443 | int tristate) | 439 | int tristate) |
444 | { | 440 | { |
445 | struct ssp_priv *priv = cpu_dai->private_data; | 441 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
446 | struct ssp_device *ssp = priv->ssp; | 442 | struct ssp_device *ssp = priv->ssp; |
447 | u32 sscr1; | 443 | u32 sscr1; |
448 | 444 | ||
@@ -464,11 +460,9 @@ static int pxa_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai, | |||
464 | static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 460 | static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
465 | unsigned int fmt) | 461 | unsigned int fmt) |
466 | { | 462 | { |
467 | struct ssp_priv *priv = cpu_dai->private_data; | 463 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
468 | struct ssp_device *ssp = priv->ssp; | 464 | struct ssp_device *ssp = priv->ssp; |
469 | u32 sscr0; | 465 | u32 sscr0, sscr1, sspsp, scfr; |
470 | u32 sscr1; | ||
471 | u32 sspsp; | ||
472 | 466 | ||
473 | /* check if we need to change anything at all */ | 467 | /* check if we need to change anything at all */ |
474 | if (priv->dai_fmt == fmt) | 468 | if (priv->dai_fmt == fmt) |
@@ -483,16 +477,16 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
483 | 477 | ||
484 | /* reset port settings */ | 478 | /* reset port settings */ |
485 | sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & | 479 | sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & |
486 | (SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS); | 480 | ~(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS); |
487 | sscr1 = SSCR1_RxTresh(8) | SSCR1_TxTresh(7); | 481 | sscr1 = SSCR1_RxTresh(8) | SSCR1_TxTresh(7); |
488 | sspsp = 0; | 482 | sspsp = 0; |
489 | 483 | ||
490 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 484 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
491 | case SND_SOC_DAIFMT_CBM_CFM: | 485 | case SND_SOC_DAIFMT_CBM_CFM: |
492 | sscr1 |= SSCR1_SCLKDIR | SSCR1_SFRMDIR; | 486 | sscr1 |= SSCR1_SCLKDIR | SSCR1_SFRMDIR | SSCR1_SCFR; |
493 | break; | 487 | break; |
494 | case SND_SOC_DAIFMT_CBM_CFS: | 488 | case SND_SOC_DAIFMT_CBM_CFS: |
495 | sscr1 |= SSCR1_SCLKDIR; | 489 | sscr1 |= SSCR1_SCLKDIR | SSCR1_SCFR; |
496 | break; | 490 | break; |
497 | case SND_SOC_DAIFMT_CBS_CFS: | 491 | case SND_SOC_DAIFMT_CBS_CFS: |
498 | break; | 492 | break; |
@@ -538,6 +532,17 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
538 | pxa_ssp_write_reg(ssp, SSCR1, sscr1); | 532 | pxa_ssp_write_reg(ssp, SSCR1, sscr1); |
539 | pxa_ssp_write_reg(ssp, SSPSP, sspsp); | 533 | pxa_ssp_write_reg(ssp, SSPSP, sspsp); |
540 | 534 | ||
535 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | ||
536 | case SND_SOC_DAIFMT_CBM_CFM: | ||
537 | case SND_SOC_DAIFMT_CBM_CFS: | ||
538 | scfr = pxa_ssp_read_reg(ssp, SSCR1) | SSCR1_SCFR; | ||
539 | pxa_ssp_write_reg(ssp, SSCR1, scfr); | ||
540 | |||
541 | while (pxa_ssp_read_reg(ssp, SSSR) & SSSR_BSY) | ||
542 | cpu_relax(); | ||
543 | break; | ||
544 | } | ||
545 | |||
541 | dump_registers(ssp); | 546 | dump_registers(ssp); |
542 | 547 | ||
543 | /* Since we are configuring the timings for the format by hand | 548 | /* Since we are configuring the timings for the format by hand |
@@ -555,11 +560,9 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
555 | */ | 560 | */ |
556 | static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | 561 | static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, |
557 | struct snd_pcm_hw_params *params, | 562 | struct snd_pcm_hw_params *params, |
558 | struct snd_soc_dai *dai) | 563 | struct snd_soc_dai *cpu_dai) |
559 | { | 564 | { |
560 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 565 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
561 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
562 | struct ssp_priv *priv = cpu_dai->private_data; | ||
563 | struct ssp_device *ssp = priv->ssp; | 566 | struct ssp_device *ssp = priv->ssp; |
564 | int chn = params_channels(params); | 567 | int chn = params_channels(params); |
565 | u32 sscr0; | 568 | u32 sscr0; |
@@ -568,7 +571,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
568 | int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; | 571 | int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; |
569 | struct pxa2xx_pcm_dma_params *dma_data; | 572 | struct pxa2xx_pcm_dma_params *dma_data; |
570 | 573 | ||
571 | dma_data = snd_soc_dai_get_dma_data(dai, substream); | 574 | dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); |
572 | 575 | ||
573 | /* generate correct DMA params */ | 576 | /* generate correct DMA params */ |
574 | kfree(dma_data); | 577 | kfree(dma_data); |
@@ -581,7 +584,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
581 | ((chn == 2) && (ttsa != 1)) || (width == 32), | 584 | ((chn == 2) && (ttsa != 1)) || (width == 32), |
582 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 585 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
583 | 586 | ||
584 | snd_soc_dai_set_dma_data(dai, substream, dma_data); | 587 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); |
585 | 588 | ||
586 | /* we can only change the settings if the port is not in use */ | 589 | /* we can only change the settings if the port is not in use */ |
587 | if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) | 590 | if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) |
@@ -589,10 +592,8 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
589 | 592 | ||
590 | /* clear selected SSP bits */ | 593 | /* clear selected SSP bits */ |
591 | sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & ~(SSCR0_DSS | SSCR0_EDSS); | 594 | sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & ~(SSCR0_DSS | SSCR0_EDSS); |
592 | pxa_ssp_write_reg(ssp, SSCR0, sscr0); | ||
593 | 595 | ||
594 | /* bit size */ | 596 | /* bit size */ |
595 | sscr0 = pxa_ssp_read_reg(ssp, SSCR0); | ||
596 | switch (params_format(params)) { | 597 | switch (params_format(params)) { |
597 | case SNDRV_PCM_FORMAT_S16_LE: | 598 | case SNDRV_PCM_FORMAT_S16_LE: |
598 | #ifdef CONFIG_PXA3xx | 599 | #ifdef CONFIG_PXA3xx |
@@ -668,12 +669,10 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
668 | } | 669 | } |
669 | 670 | ||
670 | static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | 671 | static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, |
671 | struct snd_soc_dai *dai) | 672 | struct snd_soc_dai *cpu_dai) |
672 | { | 673 | { |
673 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
674 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
675 | int ret = 0; | 674 | int ret = 0; |
676 | struct ssp_priv *priv = cpu_dai->private_data; | 675 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
677 | struct ssp_device *ssp = priv->ssp; | 676 | struct ssp_device *ssp = priv->ssp; |
678 | int val; | 677 | int val; |
679 | 678 | ||
@@ -729,8 +728,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | |||
729 | return ret; | 728 | return ret; |
730 | } | 729 | } |
731 | 730 | ||
732 | static int pxa_ssp_probe(struct platform_device *pdev, | 731 | static int pxa_ssp_probe(struct snd_soc_dai *dai) |
733 | struct snd_soc_dai *dai) | ||
734 | { | 732 | { |
735 | struct ssp_priv *priv; | 733 | struct ssp_priv *priv; |
736 | int ret; | 734 | int ret; |
@@ -746,7 +744,7 @@ static int pxa_ssp_probe(struct platform_device *pdev, | |||
746 | } | 744 | } |
747 | 745 | ||
748 | priv->dai_fmt = (unsigned int) -1; | 746 | priv->dai_fmt = (unsigned int) -1; |
749 | dai->private_data = priv; | 747 | snd_soc_dai_set_drvdata(dai, priv); |
750 | 748 | ||
751 | return 0; | 749 | return 0; |
752 | 750 | ||
@@ -755,11 +753,13 @@ err_priv: | |||
755 | return ret; | 753 | return ret; |
756 | } | 754 | } |
757 | 755 | ||
758 | static void pxa_ssp_remove(struct platform_device *pdev, | 756 | static int pxa_ssp_remove(struct snd_soc_dai *dai) |
759 | struct snd_soc_dai *dai) | ||
760 | { | 757 | { |
761 | struct ssp_priv *priv = dai->private_data; | 758 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(dai); |
759 | |||
762 | pxa_ssp_free(priv->ssp); | 760 | pxa_ssp_free(priv->ssp); |
761 | kfree(priv); | ||
762 | return 0; | ||
763 | } | 763 | } |
764 | 764 | ||
765 | #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ | 765 | #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ |
@@ -784,10 +784,7 @@ static struct snd_soc_dai_ops pxa_ssp_dai_ops = { | |||
784 | .set_tristate = pxa_ssp_set_dai_tristate, | 784 | .set_tristate = pxa_ssp_set_dai_tristate, |
785 | }; | 785 | }; |
786 | 786 | ||
787 | struct snd_soc_dai pxa_ssp_dai[] = { | 787 | static struct snd_soc_dai_driver pxa_ssp_dai = { |
788 | { | ||
789 | .name = "pxa2xx-ssp1", | ||
790 | .id = 0, | ||
791 | .probe = pxa_ssp_probe, | 788 | .probe = pxa_ssp_probe, |
792 | .remove = pxa_ssp_remove, | 789 | .remove = pxa_ssp_remove, |
793 | .suspend = pxa_ssp_suspend, | 790 | .suspend = pxa_ssp_suspend, |
@@ -805,81 +802,38 @@ struct snd_soc_dai pxa_ssp_dai[] = { | |||
805 | .formats = PXA_SSP_FORMATS, | 802 | .formats = PXA_SSP_FORMATS, |
806 | }, | 803 | }, |
807 | .ops = &pxa_ssp_dai_ops, | 804 | .ops = &pxa_ssp_dai_ops, |
805 | }; | ||
806 | |||
807 | static __devinit int asoc_ssp_probe(struct platform_device *pdev) | ||
808 | { | ||
809 | return snd_soc_register_dai(&pdev->dev, &pxa_ssp_dai); | ||
810 | } | ||
811 | |||
812 | static int __devexit asoc_ssp_remove(struct platform_device *pdev) | ||
813 | { | ||
814 | snd_soc_unregister_dai(&pdev->dev); | ||
815 | return 0; | ||
816 | } | ||
817 | |||
818 | static struct platform_driver asoc_ssp_driver = { | ||
819 | .driver = { | ||
820 | .name = "pxa-ssp-dai", | ||
821 | .owner = THIS_MODULE, | ||
808 | }, | 822 | }, |
809 | { .name = "pxa2xx-ssp2", | 823 | |
810 | .id = 1, | 824 | .probe = asoc_ssp_probe, |
811 | .probe = pxa_ssp_probe, | 825 | .remove = __devexit_p(asoc_ssp_remove), |
812 | .remove = pxa_ssp_remove, | ||
813 | .suspend = pxa_ssp_suspend, | ||
814 | .resume = pxa_ssp_resume, | ||
815 | .playback = { | ||
816 | .channels_min = 1, | ||
817 | .channels_max = 8, | ||
818 | .rates = PXA_SSP_RATES, | ||
819 | .formats = PXA_SSP_FORMATS, | ||
820 | }, | ||
821 | .capture = { | ||
822 | .channels_min = 1, | ||
823 | .channels_max = 8, | ||
824 | .rates = PXA_SSP_RATES, | ||
825 | .formats = PXA_SSP_FORMATS, | ||
826 | }, | ||
827 | .ops = &pxa_ssp_dai_ops, | ||
828 | }, | ||
829 | { | ||
830 | .name = "pxa2xx-ssp3", | ||
831 | .id = 2, | ||
832 | .probe = pxa_ssp_probe, | ||
833 | .remove = pxa_ssp_remove, | ||
834 | .suspend = pxa_ssp_suspend, | ||
835 | .resume = pxa_ssp_resume, | ||
836 | .playback = { | ||
837 | .channels_min = 1, | ||
838 | .channels_max = 8, | ||
839 | .rates = PXA_SSP_RATES, | ||
840 | .formats = PXA_SSP_FORMATS, | ||
841 | }, | ||
842 | .capture = { | ||
843 | .channels_min = 1, | ||
844 | .channels_max = 8, | ||
845 | .rates = PXA_SSP_RATES, | ||
846 | .formats = PXA_SSP_FORMATS, | ||
847 | }, | ||
848 | .ops = &pxa_ssp_dai_ops, | ||
849 | }, | ||
850 | { | ||
851 | .name = "pxa2xx-ssp4", | ||
852 | .id = 3, | ||
853 | .probe = pxa_ssp_probe, | ||
854 | .remove = pxa_ssp_remove, | ||
855 | .suspend = pxa_ssp_suspend, | ||
856 | .resume = pxa_ssp_resume, | ||
857 | .playback = { | ||
858 | .channels_min = 1, | ||
859 | .channels_max = 8, | ||
860 | .rates = PXA_SSP_RATES, | ||
861 | .formats = PXA_SSP_FORMATS, | ||
862 | }, | ||
863 | .capture = { | ||
864 | .channels_min = 1, | ||
865 | .channels_max = 8, | ||
866 | .rates = PXA_SSP_RATES, | ||
867 | .formats = PXA_SSP_FORMATS, | ||
868 | }, | ||
869 | .ops = &pxa_ssp_dai_ops, | ||
870 | }, | ||
871 | }; | 826 | }; |
872 | EXPORT_SYMBOL_GPL(pxa_ssp_dai); | ||
873 | 827 | ||
874 | static int __init pxa_ssp_init(void) | 828 | static int __init pxa_ssp_init(void) |
875 | { | 829 | { |
876 | return snd_soc_register_dais(pxa_ssp_dai, ARRAY_SIZE(pxa_ssp_dai)); | 830 | return platform_driver_register(&asoc_ssp_driver); |
877 | } | 831 | } |
878 | module_init(pxa_ssp_init); | 832 | module_init(pxa_ssp_init); |
879 | 833 | ||
880 | static void __exit pxa_ssp_exit(void) | 834 | static void __exit pxa_ssp_exit(void) |
881 | { | 835 | { |
882 | snd_soc_unregister_dais(pxa_ssp_dai, ARRAY_SIZE(pxa_ssp_dai)); | 836 | platform_driver_unregister(&asoc_ssp_driver); |
883 | } | 837 | } |
884 | module_exit(pxa_ssp_exit); | 838 | module_exit(pxa_ssp_exit); |
885 | 839 | ||
diff --git a/sound/soc/pxa/pxa-ssp.h b/sound/soc/pxa/pxa-ssp.h index 91deadd55675..bc79da221c0d 100644 --- a/sound/soc/pxa/pxa-ssp.h +++ b/sound/soc/pxa/pxa-ssp.h | |||
@@ -42,6 +42,4 @@ | |||
42 | 42 | ||
43 | #define PXA_SSP_PLL_OUT 0 | 43 | #define PXA_SSP_PLL_OUT 0 |
44 | 44 | ||
45 | extern struct snd_soc_dai pxa_ssp_dai[4]; | ||
46 | |||
47 | #endif | 45 | #endif |
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index d314115e3dd7..ac51c6d25c42 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <mach/dma.h> | 24 | #include <mach/dma.h> |
25 | #include <mach/audio.h> | 25 | #include <mach/audio.h> |
26 | 26 | ||
27 | #include "pxa2xx-pcm.h" | ||
28 | #include "pxa2xx-ac97.h" | 27 | #include "pxa2xx-ac97.h" |
29 | 28 | ||
30 | static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97) | 29 | static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97) |
@@ -104,24 +103,21 @@ static int pxa2xx_ac97_resume(struct snd_soc_dai *dai) | |||
104 | #define pxa2xx_ac97_resume NULL | 103 | #define pxa2xx_ac97_resume NULL |
105 | #endif | 104 | #endif |
106 | 105 | ||
107 | static int pxa2xx_ac97_probe(struct platform_device *pdev, | 106 | static int pxa2xx_ac97_probe(struct snd_soc_dai *dai) |
108 | struct snd_soc_dai *dai) | ||
109 | { | 107 | { |
110 | return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev)); | 108 | return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev)); |
111 | } | 109 | } |
112 | 110 | ||
113 | static void pxa2xx_ac97_remove(struct platform_device *pdev, | 111 | static int pxa2xx_ac97_remove(struct snd_soc_dai *dai) |
114 | struct snd_soc_dai *dai) | ||
115 | { | 112 | { |
116 | pxa2xx_ac97_hw_remove(to_platform_device(dai->dev)); | 113 | pxa2xx_ac97_hw_remove(to_platform_device(dai->dev)); |
114 | return 0; | ||
117 | } | 115 | } |
118 | 116 | ||
119 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | 117 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, |
120 | struct snd_pcm_hw_params *params, | 118 | struct snd_pcm_hw_params *params, |
121 | struct snd_soc_dai *dai) | 119 | struct snd_soc_dai *cpu_dai) |
122 | { | 120 | { |
123 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
124 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
125 | struct pxa2xx_pcm_dma_params *dma_data; | 121 | struct pxa2xx_pcm_dma_params *dma_data; |
126 | 122 | ||
127 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 123 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -136,10 +132,8 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | |||
136 | 132 | ||
137 | static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, | 133 | static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, |
138 | struct snd_pcm_hw_params *params, | 134 | struct snd_pcm_hw_params *params, |
139 | struct snd_soc_dai *dai) | 135 | struct snd_soc_dai *cpu_dai) |
140 | { | 136 | { |
141 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
142 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
143 | struct pxa2xx_pcm_dma_params *dma_data; | 137 | struct pxa2xx_pcm_dma_params *dma_data; |
144 | 138 | ||
145 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 139 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -154,11 +148,8 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, | |||
154 | 148 | ||
155 | static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, | 149 | static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, |
156 | struct snd_pcm_hw_params *params, | 150 | struct snd_pcm_hw_params *params, |
157 | struct snd_soc_dai *dai) | 151 | struct snd_soc_dai *cpu_dai) |
158 | { | 152 | { |
159 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
160 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
161 | |||
162 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 153 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
163 | return -ENODEV; | 154 | return -ENODEV; |
164 | else | 155 | else |
@@ -188,10 +179,9 @@ static struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = { | |||
188 | * There is only 1 physical AC97 interface for pxa2xx, but it | 179 | * There is only 1 physical AC97 interface for pxa2xx, but it |
189 | * has extra fifo's that can be used for aux DACs and ADCs. | 180 | * has extra fifo's that can be used for aux DACs and ADCs. |
190 | */ | 181 | */ |
191 | struct snd_soc_dai pxa_ac97_dai[] = { | 182 | static struct snd_soc_dai_driver pxa_ac97_dai[] = { |
192 | { | 183 | { |
193 | .name = "pxa2xx-ac97", | 184 | .name = "pxa2xx-ac97", |
194 | .id = 0, | ||
195 | .ac97_control = 1, | 185 | .ac97_control = 1, |
196 | .probe = pxa2xx_ac97_probe, | 186 | .probe = pxa2xx_ac97_probe, |
197 | .remove = pxa2xx_ac97_remove, | 187 | .remove = pxa2xx_ac97_remove, |
@@ -213,7 +203,6 @@ struct snd_soc_dai pxa_ac97_dai[] = { | |||
213 | }, | 203 | }, |
214 | { | 204 | { |
215 | .name = "pxa2xx-ac97-aux", | 205 | .name = "pxa2xx-ac97-aux", |
216 | .id = 1, | ||
217 | .ac97_control = 1, | 206 | .ac97_control = 1, |
218 | .playback = { | 207 | .playback = { |
219 | .stream_name = "AC97 Aux Playback", | 208 | .stream_name = "AC97 Aux Playback", |
@@ -231,7 +220,6 @@ struct snd_soc_dai pxa_ac97_dai[] = { | |||
231 | }, | 220 | }, |
232 | { | 221 | { |
233 | .name = "pxa2xx-ac97-mic", | 222 | .name = "pxa2xx-ac97-mic", |
234 | .id = 2, | ||
235 | .ac97_control = 1, | 223 | .ac97_control = 1, |
236 | .capture = { | 224 | .capture = { |
237 | .stream_name = "AC97 Mic Capture", | 225 | .stream_name = "AC97 Mic Capture", |
@@ -243,36 +231,26 @@ struct snd_soc_dai pxa_ac97_dai[] = { | |||
243 | }, | 231 | }, |
244 | }; | 232 | }; |
245 | 233 | ||
246 | EXPORT_SYMBOL_GPL(pxa_ac97_dai); | ||
247 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | 234 | EXPORT_SYMBOL_GPL(soc_ac97_ops); |
248 | 235 | ||
249 | static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev) | 236 | static __devinit int pxa2xx_ac97_dev_probe(struct platform_device *pdev) |
250 | { | 237 | { |
251 | int i; | 238 | if (pdev->id != -1) { |
252 | pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; | ||
253 | |||
254 | if (pdev->id >= 0) { | ||
255 | dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); | 239 | dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); |
256 | return -ENXIO; | 240 | return -ENXIO; |
257 | } | 241 | } |
258 | 242 | ||
259 | for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++) { | ||
260 | pxa_ac97_dai[i].dev = &pdev->dev; | ||
261 | if (pdata && pdata->codec_pdata[0]) | ||
262 | pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata[0]; | ||
263 | } | ||
264 | |||
265 | /* Punt most of the init to the SoC probe; we may need the machine | 243 | /* Punt most of the init to the SoC probe; we may need the machine |
266 | * driver to do interesting things with the clocking to get us up | 244 | * driver to do interesting things with the clocking to get us up |
267 | * and running. | 245 | * and running. |
268 | */ | 246 | */ |
269 | return snd_soc_register_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai)); | 247 | return snd_soc_register_dais(&pdev->dev, pxa_ac97_dai, |
248 | ARRAY_SIZE(pxa_ac97_dai)); | ||
270 | } | 249 | } |
271 | 250 | ||
272 | static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev) | 251 | static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev) |
273 | { | 252 | { |
274 | snd_soc_unregister_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai)); | 253 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(pxa_ac97_dai)); |
275 | |||
276 | return 0; | 254 | return 0; |
277 | } | 255 | } |
278 | 256 | ||
diff --git a/sound/soc/pxa/pxa2xx-ac97.h b/sound/soc/pxa/pxa2xx-ac97.h index e390de8edcd4..eda891e6f31b 100644 --- a/sound/soc/pxa/pxa2xx-ac97.h +++ b/sound/soc/pxa/pxa2xx-ac97.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #define PXA2XX_DAI_AC97_AUX 1 | 14 | #define PXA2XX_DAI_AC97_AUX 1 |
15 | #define PXA2XX_DAI_AC97_MIC 2 | 15 | #define PXA2XX_DAI_AC97_MIC 2 |
16 | 16 | ||
17 | extern struct snd_soc_dai pxa_ac97_dai[3]; | ||
18 | |||
19 | /* platform data */ | 17 | /* platform data */ |
20 | extern struct snd_ac97_bus_ops pxa2xx_ac97_ops; | 18 | extern struct snd_ac97_bus_ops pxa2xx_ac97_ops; |
21 | 19 | ||
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index c1a5275721e4..11be5952a506 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/dma.h> | 27 | #include <mach/dma.h> |
28 | #include <mach/audio.h> | 28 | #include <mach/audio.h> |
29 | 29 | ||
30 | #include "pxa2xx-pcm.h" | ||
31 | #include "pxa2xx-i2s.h" | 30 | #include "pxa2xx-i2s.h" |
32 | 31 | ||
33 | /* | 32 | /* |
@@ -80,6 +79,7 @@ struct pxa_i2s_port { | |||
80 | }; | 79 | }; |
81 | static struct pxa_i2s_port pxa_i2s; | 80 | static struct pxa_i2s_port pxa_i2s; |
82 | static struct clk *clk_i2s; | 81 | static struct clk *clk_i2s; |
82 | static int clk_ena = 0; | ||
83 | 83 | ||
84 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { | 84 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { |
85 | .name = "I2S PCM Stereo out", | 85 | .name = "I2S PCM Stereo out", |
@@ -101,7 +101,7 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream, | |||
101 | struct snd_soc_dai *dai) | 101 | struct snd_soc_dai *dai) |
102 | { | 102 | { |
103 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 103 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
104 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 104 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
105 | 105 | ||
106 | if (IS_ERR(clk_i2s)) | 106 | if (IS_ERR(clk_i2s)) |
107 | return PTR_ERR(clk_i2s); | 107 | return PTR_ERR(clk_i2s); |
@@ -162,13 +162,11 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
162 | struct snd_pcm_hw_params *params, | 162 | struct snd_pcm_hw_params *params, |
163 | struct snd_soc_dai *dai) | 163 | struct snd_soc_dai *dai) |
164 | { | 164 | { |
165 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
166 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
167 | struct pxa2xx_pcm_dma_params *dma_data; | 165 | struct pxa2xx_pcm_dma_params *dma_data; |
168 | 166 | ||
169 | BUG_ON(IS_ERR(clk_i2s)); | 167 | BUG_ON(IS_ERR(clk_i2s)); |
170 | clk_enable(clk_i2s); | 168 | clk_enable(clk_i2s); |
171 | dai->private_data = dai; | 169 | clk_ena = 1; |
172 | pxa_i2s_wait(); | 170 | pxa_i2s_wait(); |
173 | 171 | ||
174 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 172 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -176,7 +174,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
176 | else | 174 | else |
177 | dma_data = &pxa2xx_i2s_pcm_stereo_in; | 175 | dma_data = &pxa2xx_i2s_pcm_stereo_in; |
178 | 176 | ||
179 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | 177 | snd_soc_dai_set_dma_data(dai, substream, dma_data); |
180 | 178 | ||
181 | /* is port used by another stream */ | 179 | /* is port used by another stream */ |
182 | if (!(SACR0 & SACR0_ENB)) { | 180 | if (!(SACR0 & SACR0_ENB)) { |
@@ -259,9 +257,9 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream, | |||
259 | if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) { | 257 | if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) { |
260 | SACR0 &= ~SACR0_ENB; | 258 | SACR0 &= ~SACR0_ENB; |
261 | pxa_i2s_wait(); | 259 | pxa_i2s_wait(); |
262 | if (dai->private_data != NULL) { | 260 | if (clk_ena) { |
263 | clk_disable(clk_i2s); | 261 | clk_disable(clk_i2s); |
264 | dai->private_data = NULL; | 262 | clk_ena = 0; |
265 | } | 263 | } |
266 | } | 264 | } |
267 | } | 265 | } |
@@ -300,6 +298,35 @@ static int pxa2xx_i2s_resume(struct snd_soc_dai *dai) | |||
300 | #define pxa2xx_i2s_resume NULL | 298 | #define pxa2xx_i2s_resume NULL |
301 | #endif | 299 | #endif |
302 | 300 | ||
301 | static int pxa2xx_i2s_probe(struct snd_soc_dai *dai) | ||
302 | { | ||
303 | clk_i2s = clk_get(dai->dev, "I2SCLK"); | ||
304 | if (IS_ERR(clk_i2s)) | ||
305 | return PTR_ERR(clk_i2s); | ||
306 | |||
307 | /* | ||
308 | * PXA Developer's Manual: | ||
309 | * If SACR0[ENB] is toggled in the middle of a normal operation, | ||
310 | * the SACR0[RST] bit must also be set and cleared to reset all | ||
311 | * I2S controller registers. | ||
312 | */ | ||
313 | SACR0 = SACR0_RST; | ||
314 | SACR0 = 0; | ||
315 | /* Make sure RPL and REC are disabled */ | ||
316 | SACR1 = SACR1_DRPL | SACR1_DREC; | ||
317 | /* Along with FIFO servicing */ | ||
318 | SAIMR &= ~(SAIMR_RFS | SAIMR_TFS); | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | static int pxa2xx_i2s_remove(struct snd_soc_dai *dai) | ||
324 | { | ||
325 | clk_put(clk_i2s); | ||
326 | clk_i2s = ERR_PTR(-ENOENT); | ||
327 | return 0; | ||
328 | } | ||
329 | |||
303 | #define PXA2XX_I2S_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ | 330 | #define PXA2XX_I2S_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ |
304 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ | 331 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ |
305 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) | 332 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) |
@@ -313,9 +340,9 @@ static struct snd_soc_dai_ops pxa_i2s_dai_ops = { | |||
313 | .set_sysclk = pxa2xx_i2s_set_dai_sysclk, | 340 | .set_sysclk = pxa2xx_i2s_set_dai_sysclk, |
314 | }; | 341 | }; |
315 | 342 | ||
316 | struct snd_soc_dai pxa_i2s_dai = { | 343 | static struct snd_soc_dai_driver pxa_i2s_dai = { |
317 | .name = "pxa2xx-i2s", | 344 | .probe = pxa2xx_i2s_probe, |
318 | .id = 0, | 345 | .remove = pxa2xx_i2s_remove, |
319 | .suspend = pxa2xx_i2s_suspend, | 346 | .suspend = pxa2xx_i2s_suspend, |
320 | .resume = pxa2xx_i2s_resume, | 347 | .resume = pxa2xx_i2s_resume, |
321 | .playback = { | 348 | .playback = { |
@@ -332,49 +359,20 @@ struct snd_soc_dai pxa_i2s_dai = { | |||
332 | .symmetric_rates = 1, | 359 | .symmetric_rates = 1, |
333 | }; | 360 | }; |
334 | 361 | ||
335 | EXPORT_SYMBOL_GPL(pxa_i2s_dai); | 362 | static int pxa2xx_i2s_drv_probe(struct platform_device *pdev) |
336 | |||
337 | static int pxa2xx_i2s_probe(struct platform_device *dev) | ||
338 | { | 363 | { |
339 | int ret; | 364 | return snd_soc_register_dai(&pdev->dev, &pxa_i2s_dai); |
340 | |||
341 | clk_i2s = clk_get(&dev->dev, "I2SCLK"); | ||
342 | if (IS_ERR(clk_i2s)) | ||
343 | return PTR_ERR(clk_i2s); | ||
344 | |||
345 | pxa_i2s_dai.dev = &dev->dev; | ||
346 | pxa_i2s_dai.private_data = NULL; | ||
347 | ret = snd_soc_register_dai(&pxa_i2s_dai); | ||
348 | if (ret != 0) | ||
349 | clk_put(clk_i2s); | ||
350 | |||
351 | /* | ||
352 | * PXA Developer's Manual: | ||
353 | * If SACR0[ENB] is toggled in the middle of a normal operation, | ||
354 | * the SACR0[RST] bit must also be set and cleared to reset all | ||
355 | * I2S controller registers. | ||
356 | */ | ||
357 | SACR0 = SACR0_RST; | ||
358 | SACR0 = 0; | ||
359 | /* Make sure RPL and REC are disabled */ | ||
360 | SACR1 = SACR1_DRPL | SACR1_DREC; | ||
361 | /* Along with FIFO servicing */ | ||
362 | SAIMR &= ~(SAIMR_RFS | SAIMR_TFS); | ||
363 | |||
364 | return ret; | ||
365 | } | 365 | } |
366 | 366 | ||
367 | static int __devexit pxa2xx_i2s_remove(struct platform_device *dev) | 367 | static int __devexit pxa2xx_i2s_drv_remove(struct platform_device *pdev) |
368 | { | 368 | { |
369 | snd_soc_unregister_dai(&pxa_i2s_dai); | 369 | snd_soc_unregister_dai(&pdev->dev); |
370 | clk_put(clk_i2s); | ||
371 | clk_i2s = ERR_PTR(-ENOENT); | ||
372 | return 0; | 370 | return 0; |
373 | } | 371 | } |
374 | 372 | ||
375 | static struct platform_driver pxa2xx_i2s_driver = { | 373 | static struct platform_driver pxa2xx_i2s_driver = { |
376 | .probe = pxa2xx_i2s_probe, | 374 | .probe = pxa2xx_i2s_drv_probe, |
377 | .remove = __devexit_p(pxa2xx_i2s_remove), | 375 | .remove = __devexit_p(pxa2xx_i2s_drv_remove), |
378 | 376 | ||
379 | .driver = { | 377 | .driver = { |
380 | .name = "pxa2xx-i2s", | 378 | .name = "pxa2xx-i2s", |
@@ -400,3 +398,4 @@ module_exit(pxa2xx_i2s_exit); | |||
400 | MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk"); | 398 | MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk"); |
401 | MODULE_DESCRIPTION("pxa2xx I2S SoC Interface"); | 399 | MODULE_DESCRIPTION("pxa2xx I2S SoC Interface"); |
402 | MODULE_LICENSE("GPL"); | 400 | MODULE_LICENSE("GPL"); |
401 | MODULE_ALIAS("platform:pxa2xx-i2s"); | ||
diff --git a/sound/soc/pxa/pxa2xx-i2s.h b/sound/soc/pxa/pxa2xx-i2s.h index e2def441153e..070f3c6059fe 100644 --- a/sound/soc/pxa/pxa2xx-i2s.h +++ b/sound/soc/pxa/pxa2xx-i2s.h | |||
@@ -15,6 +15,4 @@ | |||
15 | /* I2S clock */ | 15 | /* I2S clock */ |
16 | #define PXA2XX_I2S_SYSCLK 0 | 16 | #define PXA2XX_I2S_SYSCLK 0 |
17 | 17 | ||
18 | extern struct snd_soc_dai pxa_i2s_dai; | ||
19 | |||
20 | #endif | 18 | #endif |
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index adc7e6f15f93..02fb66416ddc 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
17 | #include <sound/pxa2xx-lib.h> | 17 | #include <sound/pxa2xx-lib.h> |
18 | 18 | ||
19 | #include "pxa2xx-pcm.h" | ||
20 | #include "../../arm/pxa2xx-pcm.h" | 19 | #include "../../arm/pxa2xx-pcm.h" |
21 | 20 | ||
22 | static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, | 21 | static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, |
@@ -28,7 +27,7 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
28 | struct pxa2xx_pcm_dma_params *dma; | 27 | struct pxa2xx_pcm_dma_params *dma; |
29 | int ret; | 28 | int ret; |
30 | 29 | ||
31 | dma = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 30 | dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
32 | 31 | ||
33 | /* return if this is a bufferless transfer e.g. | 32 | /* return if this is a bufferless transfer e.g. |
34 | * codec <--> BT codec or GSM modem -- lg FIXME */ | 33 | * codec <--> BT codec or GSM modem -- lg FIXME */ |
@@ -95,14 +94,14 @@ static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
95 | if (!card->dev->coherent_dma_mask) | 94 | if (!card->dev->coherent_dma_mask) |
96 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 95 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
97 | 96 | ||
98 | if (dai->playback.channels_min) { | 97 | if (dai->driver->playback.channels_min) { |
99 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, | 98 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, |
100 | SNDRV_PCM_STREAM_PLAYBACK); | 99 | SNDRV_PCM_STREAM_PLAYBACK); |
101 | if (ret) | 100 | if (ret) |
102 | goto out; | 101 | goto out; |
103 | } | 102 | } |
104 | 103 | ||
105 | if (dai->capture.channels_min) { | 104 | if (dai->driver->capture.channels_min) { |
106 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, | 105 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, |
107 | SNDRV_PCM_STREAM_CAPTURE); | 106 | SNDRV_PCM_STREAM_CAPTURE); |
108 | if (ret) | 107 | if (ret) |
@@ -112,25 +111,44 @@ static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
112 | return ret; | 111 | return ret; |
113 | } | 112 | } |
114 | 113 | ||
115 | struct snd_soc_platform pxa2xx_soc_platform = { | 114 | static struct snd_soc_platform_driver pxa2xx_soc_platform = { |
116 | .name = "pxa2xx-audio", | 115 | .ops = &pxa2xx_pcm_ops, |
117 | .pcm_ops = &pxa2xx_pcm_ops, | ||
118 | .pcm_new = pxa2xx_soc_pcm_new, | 116 | .pcm_new = pxa2xx_soc_pcm_new, |
119 | .pcm_free = pxa2xx_pcm_free_dma_buffers, | 117 | .pcm_free = pxa2xx_pcm_free_dma_buffers, |
120 | }; | 118 | }; |
121 | EXPORT_SYMBOL_GPL(pxa2xx_soc_platform); | ||
122 | 119 | ||
123 | static int __init pxa2xx_soc_platform_init(void) | 120 | static int __devinit pxa2xx_soc_platform_probe(struct platform_device *pdev) |
124 | { | 121 | { |
125 | return snd_soc_register_platform(&pxa2xx_soc_platform); | 122 | return snd_soc_register_platform(&pdev->dev, &pxa2xx_soc_platform); |
126 | } | 123 | } |
127 | module_init(pxa2xx_soc_platform_init); | ||
128 | 124 | ||
129 | static void __exit pxa2xx_soc_platform_exit(void) | 125 | static int __devexit pxa2xx_soc_platform_remove(struct platform_device *pdev) |
130 | { | 126 | { |
131 | snd_soc_unregister_platform(&pxa2xx_soc_platform); | 127 | snd_soc_unregister_platform(&pdev->dev); |
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static struct platform_driver pxa_pcm_driver = { | ||
132 | .driver = { | ||
133 | .name = "pxa-pcm-audio", | ||
134 | .owner = THIS_MODULE, | ||
135 | }, | ||
136 | |||
137 | .probe = pxa2xx_soc_platform_probe, | ||
138 | .remove = __devexit_p(pxa2xx_soc_platform_remove), | ||
139 | }; | ||
140 | |||
141 | static int __init snd_pxa_pcm_init(void) | ||
142 | { | ||
143 | return platform_driver_register(&pxa_pcm_driver); | ||
144 | } | ||
145 | module_init(snd_pxa_pcm_init); | ||
146 | |||
147 | static void __exit snd_pxa_pcm_exit(void) | ||
148 | { | ||
149 | platform_driver_unregister(&pxa_pcm_driver); | ||
132 | } | 150 | } |
133 | module_exit(pxa2xx_soc_platform_exit); | 151 | module_exit(snd_pxa_pcm_exit); |
134 | 152 | ||
135 | MODULE_AUTHOR("Nicolas Pitre"); | 153 | MODULE_AUTHOR("Nicolas Pitre"); |
136 | MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); | 154 | MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); |
diff --git a/sound/soc/pxa/pxa2xx-pcm.h b/sound/soc/pxa/pxa2xx-pcm.h deleted file mode 100644 index 60c3b20aeeb4..000000000000 --- a/sound/soc/pxa/pxa2xx-pcm.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * linux/sound/arm/pxa2xx-pcm.h -- ALSA PCM interface for the Intel PXA2xx chip | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Nov 30, 2004 | ||
6 | * Copyright: MontaVista Software, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef _PXA2XX_PCM_H | ||
14 | #define _PXA2XX_PCM_H | ||
15 | |||
16 | /* platform data */ | ||
17 | extern struct snd_soc_platform pxa2xx_soc_platform; | ||
18 | |||
19 | #endif | ||
diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c index 7e3f41696c41..2cda82bc5d2e 100644 --- a/sound/soc/pxa/raumfeld.c +++ b/sound/soc/pxa/raumfeld.c | |||
@@ -26,9 +26,6 @@ | |||
26 | 26 | ||
27 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
28 | 28 | ||
29 | #include "../codecs/cs4270.h" | ||
30 | #include "../codecs/ak4104.h" | ||
31 | #include "pxa2xx-pcm.h" | ||
32 | #include "pxa-ssp.h" | 29 | #include "pxa-ssp.h" |
33 | 30 | ||
34 | #define GPIO_SPDIF_RESET (38) | 31 | #define GPIO_SPDIF_RESET (38) |
@@ -71,7 +68,7 @@ static void raumfeld_enable_audio(bool en) | |||
71 | static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream) | 68 | static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream) |
72 | { | 69 | { |
73 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 70 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
74 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 71 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
75 | 72 | ||
76 | /* set freq to 0 to enable all possible codec sample rates */ | 73 | /* set freq to 0 to enable all possible codec sample rates */ |
77 | return snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); | 74 | return snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); |
@@ -80,7 +77,7 @@ static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream) | |||
80 | static void raumfeld_cs4270_shutdown(struct snd_pcm_substream *substream) | 77 | static void raumfeld_cs4270_shutdown(struct snd_pcm_substream *substream) |
81 | { | 78 | { |
82 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 79 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
83 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 80 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
84 | 81 | ||
85 | /* set freq to 0 to enable all possible codec sample rates */ | 82 | /* set freq to 0 to enable all possible codec sample rates */ |
86 | snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); | 83 | snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); |
@@ -90,8 +87,8 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream, | |||
90 | struct snd_pcm_hw_params *params) | 87 | struct snd_pcm_hw_params *params) |
91 | { | 88 | { |
92 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 89 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
93 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 90 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
94 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 91 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
95 | unsigned int fmt, clk = 0; | 92 | unsigned int fmt, clk = 0; |
96 | int ret = 0; | 93 | int ret = 0; |
97 | 94 | ||
@@ -167,32 +164,14 @@ static int raumfeld_line_resume(struct platform_device *pdev) | |||
167 | return 0; | 164 | return 0; |
168 | } | 165 | } |
169 | 166 | ||
170 | static struct snd_soc_dai_link raumfeld_line_dai = { | ||
171 | .name = "CS4270", | ||
172 | .stream_name = "CS4270", | ||
173 | .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP1], | ||
174 | .codec_dai = &cs4270_dai, | ||
175 | .ops = &raumfeld_cs4270_ops, | ||
176 | }; | ||
177 | |||
178 | static struct snd_soc_card snd_soc_line_raumfeld = { | ||
179 | .name = "Raumfeld analog", | ||
180 | .platform = &pxa2xx_soc_platform, | ||
181 | .dai_link = &raumfeld_line_dai, | ||
182 | .suspend_post = raumfeld_line_suspend, | ||
183 | .resume_pre = raumfeld_line_resume, | ||
184 | .num_links = 1, | ||
185 | }; | ||
186 | |||
187 | |||
188 | /* AK4104 */ | 167 | /* AK4104 */ |
189 | 168 | ||
190 | static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream, | 169 | static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream, |
191 | struct snd_pcm_hw_params *params) | 170 | struct snd_pcm_hw_params *params) |
192 | { | 171 | { |
193 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 172 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
194 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 173 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
195 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 174 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
196 | int fmt, ret = 0, clk = 0; | 175 | int fmt, ret = 0, clk = 0; |
197 | 176 | ||
198 | switch (params_rate(params)) { | 177 | switch (params_rate(params)) { |
@@ -247,34 +226,35 @@ static struct snd_soc_ops raumfeld_ak4104_ops = { | |||
247 | .hw_params = raumfeld_ak4104_hw_params, | 226 | .hw_params = raumfeld_ak4104_hw_params, |
248 | }; | 227 | }; |
249 | 228 | ||
250 | static struct snd_soc_dai_link raumfeld_spdif_dai = { | 229 | static struct snd_soc_dai_link raumfeld_dai[] = { |
230 | { | ||
251 | .name = "ak4104", | 231 | .name = "ak4104", |
252 | .stream_name = "Playback", | 232 | .stream_name = "Playback", |
253 | .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP2], | 233 | .cpu_dai_name = "pxa-ssp-dai.1", |
254 | .codec_dai = &ak4104_dai, | 234 | .codec_dai_name = "ak4104-hifi", |
235 | .platform_name = "pxa-pcm-audio", | ||
255 | .ops = &raumfeld_ak4104_ops, | 236 | .ops = &raumfeld_ak4104_ops, |
256 | }; | 237 | .codec_name = "ak4104-codec.0", |
257 | 238 | }, | |
258 | static struct snd_soc_card snd_soc_spdif_raumfeld = { | 239 | { |
259 | .name = "Raumfeld S/PDIF", | 240 | .name = "CS4270", |
260 | .platform = &pxa2xx_soc_platform, | 241 | .stream_name = "CS4270", |
261 | .dai_link = &raumfeld_spdif_dai, | 242 | .cpu_dai_name = "pxa-ssp-dai.0", |
262 | .num_links = 1 | 243 | .platform_name = "pxa-pcm-audio", |
263 | }; | 244 | .codec_dai_name = "cs4270-hifi", |
264 | 245 | .codec_name = "cs4270-codec.0-0048", | |
265 | /* raumfeld_audio audio subsystem */ | 246 | .ops = &raumfeld_cs4270_ops, |
266 | static struct snd_soc_device raumfeld_line_devdata = { | 247 | },}; |
267 | .card = &snd_soc_line_raumfeld, | ||
268 | .codec_dev = &soc_codec_device_cs4270, | ||
269 | }; | ||
270 | 248 | ||
271 | static struct snd_soc_device raumfeld_spdif_devdata = { | 249 | static struct snd_soc_card snd_soc_raumfeld = { |
272 | .card = &snd_soc_spdif_raumfeld, | 250 | .name = "Raumfeld", |
273 | .codec_dev = &soc_codec_device_ak4104, | 251 | .dai_link = raumfeld_dai, |
252 | .suspend_post = raumfeld_line_suspend, | ||
253 | .resume_pre = raumfeld_line_resume, | ||
254 | .num_links = ARRAY_SIZE(raumfeld_dai), | ||
274 | }; | 255 | }; |
275 | 256 | ||
276 | static struct platform_device *raumfeld_audio_line_device; | 257 | static struct platform_device *raumfeld_audio_device; |
277 | static struct platform_device *raumfeld_audio_spdif_device; | ||
278 | 258 | ||
279 | static int __init raumfeld_audio_init(void) | 259 | static int __init raumfeld_audio_init(void) |
280 | { | 260 | { |
@@ -292,38 +272,19 @@ static int __init raumfeld_audio_init(void) | |||
292 | 272 | ||
293 | set_max9485_clk(MAX9485_MCLK_FREQ_122880); | 273 | set_max9485_clk(MAX9485_MCLK_FREQ_122880); |
294 | 274 | ||
295 | /* LINE */ | 275 | /* Register LINE and SPDIF */ |
296 | raumfeld_audio_line_device = platform_device_alloc("soc-audio", 0); | 276 | raumfeld_audio_device = platform_device_alloc("soc-audio", 0); |
297 | if (!raumfeld_audio_line_device) | 277 | if (!raumfeld_audio_device) |
298 | return -ENOMEM; | 278 | return -ENOMEM; |
299 | 279 | ||
300 | platform_set_drvdata(raumfeld_audio_line_device, | 280 | platform_set_drvdata(raumfeld_audio_device, |
301 | &raumfeld_line_devdata); | 281 | &snd_soc_raumfeld); |
302 | raumfeld_line_devdata.dev = &raumfeld_audio_line_device->dev; | 282 | ret = platform_device_add(raumfeld_audio_device); |
303 | ret = platform_device_add(raumfeld_audio_line_device); | ||
304 | if (ret) | ||
305 | platform_device_put(raumfeld_audio_line_device); | ||
306 | 283 | ||
307 | /* no S/PDIF on Speakers */ | 284 | /* no S/PDIF on Speakers */ |
308 | if (machine_is_raumfeld_speaker()) | 285 | if (machine_is_raumfeld_speaker()) |
309 | return ret; | 286 | return ret; |
310 | 287 | ||
311 | /* S/PDIF */ | ||
312 | raumfeld_audio_spdif_device = platform_device_alloc("soc-audio", 1); | ||
313 | if (!raumfeld_audio_spdif_device) { | ||
314 | platform_device_put(raumfeld_audio_line_device); | ||
315 | return -ENOMEM; | ||
316 | } | ||
317 | |||
318 | platform_set_drvdata(raumfeld_audio_spdif_device, | ||
319 | &raumfeld_spdif_devdata); | ||
320 | raumfeld_spdif_devdata.dev = &raumfeld_audio_spdif_device->dev; | ||
321 | ret = platform_device_add(raumfeld_audio_spdif_device); | ||
322 | if (ret) { | ||
323 | platform_device_put(raumfeld_audio_line_device); | ||
324 | platform_device_put(raumfeld_audio_spdif_device); | ||
325 | } | ||
326 | |||
327 | raumfeld_enable_audio(true); | 288 | raumfeld_enable_audio(true); |
328 | 289 | ||
329 | return ret; | 290 | return ret; |
@@ -333,10 +294,7 @@ static void __exit raumfeld_audio_exit(void) | |||
333 | { | 294 | { |
334 | raumfeld_enable_audio(false); | 295 | raumfeld_enable_audio(false); |
335 | 296 | ||
336 | platform_device_unregister(raumfeld_audio_line_device); | 297 | platform_device_unregister(raumfeld_audio_device); |
337 | |||
338 | if (machine_is_raumfeld_connector()) | ||
339 | platform_device_unregister(raumfeld_audio_spdif_device); | ||
340 | 298 | ||
341 | i2c_unregister_device(max9486_client); | 299 | i2c_unregister_device(max9486_client); |
342 | 300 | ||
diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c new file mode 100644 index 000000000000..d63cb474b4e1 --- /dev/null +++ b/sound/soc/pxa/saarb.c | |||
@@ -0,0 +1,200 @@ | |||
1 | /* | ||
2 | * saarb.c -- SoC audio for saarb | ||
3 | * | ||
4 | * Copyright (C) 2010 Marvell International Ltd. | ||
5 | * Haojian Zhuang <haojian.zhuang@marvell.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/clk.h> | ||
16 | #include <linux/i2c.h> | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/pcm_params.h> | ||
20 | #include <sound/soc.h> | ||
21 | #include <sound/soc-dapm.h> | ||
22 | #include <sound/jack.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | |||
26 | #include "../codecs/88pm860x-codec.h" | ||
27 | #include "pxa-ssp.h" | ||
28 | |||
29 | static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd); | ||
30 | |||
31 | static struct platform_device *saarb_snd_device; | ||
32 | |||
33 | static struct snd_soc_jack hs_jack, mic_jack; | ||
34 | |||
35 | static struct snd_soc_jack_pin hs_jack_pins[] = { | ||
36 | { .pin = "Headset Stereophone", .mask = SND_JACK_HEADPHONE, }, | ||
37 | }; | ||
38 | |||
39 | static struct snd_soc_jack_pin mic_jack_pins[] = { | ||
40 | { .pin = "Headset Mic 2", .mask = SND_JACK_MICROPHONE, }, | ||
41 | }; | ||
42 | |||
43 | /* saarb machine dapm widgets */ | ||
44 | static const struct snd_soc_dapm_widget saarb_dapm_widgets[] = { | ||
45 | SND_SOC_DAPM_HP("Headphone Stereophone", NULL), | ||
46 | SND_SOC_DAPM_LINE("Lineout Out 1", NULL), | ||
47 | SND_SOC_DAPM_LINE("Lineout Out 2", NULL), | ||
48 | SND_SOC_DAPM_SPK("Ext Speaker", NULL), | ||
49 | SND_SOC_DAPM_MIC("Ext Mic 1", NULL), | ||
50 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
51 | SND_SOC_DAPM_MIC("Ext Mic 3", NULL), | ||
52 | }; | ||
53 | |||
54 | /* saarb machine audio map */ | ||
55 | static const struct snd_soc_dapm_route audio_map[] = { | ||
56 | {"Headset Stereophone", NULL, "HS1"}, | ||
57 | {"Headset Stereophone", NULL, "HS2"}, | ||
58 | |||
59 | {"Ext Speaker", NULL, "LSP"}, | ||
60 | {"Ext Speaker", NULL, "LSN"}, | ||
61 | |||
62 | {"Lineout Out 1", NULL, "LINEOUT1"}, | ||
63 | {"Lineout Out 2", NULL, "LINEOUT2"}, | ||
64 | |||
65 | {"MIC1P", NULL, "Mic1 Bias"}, | ||
66 | {"MIC1N", NULL, "Mic1 Bias"}, | ||
67 | {"Mic1 Bias", NULL, "Ext Mic 1"}, | ||
68 | |||
69 | {"MIC2P", NULL, "Mic1 Bias"}, | ||
70 | {"MIC2N", NULL, "Mic1 Bias"}, | ||
71 | {"Mic1 Bias", NULL, "Headset Mic 2"}, | ||
72 | |||
73 | {"MIC3P", NULL, "Mic3 Bias"}, | ||
74 | {"MIC3N", NULL, "Mic3 Bias"}, | ||
75 | {"Mic3 Bias", NULL, "Ext Mic 3"}, | ||
76 | }; | ||
77 | |||
78 | static int saarb_i2s_hw_params(struct snd_pcm_substream *substream, | ||
79 | struct snd_pcm_hw_params *params) | ||
80 | { | ||
81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
82 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
83 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
84 | int width = snd_pcm_format_physical_width(params_format(params)); | ||
85 | int ret; | ||
86 | |||
87 | ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_NET_PLL, 0, | ||
88 | PM860X_CLK_DIR_OUT); | ||
89 | if (ret < 0) | ||
90 | return ret; | ||
91 | |||
92 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, 0, PM860X_CLK_DIR_OUT); | ||
93 | if (ret < 0) | ||
94 | return ret; | ||
95 | |||
96 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | ||
97 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
98 | if (ret < 0) | ||
99 | return ret; | ||
100 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
101 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
102 | if (ret < 0) | ||
103 | return ret; | ||
104 | |||
105 | ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); | ||
106 | |||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | static struct snd_soc_ops saarb_i2s_ops = { | ||
111 | .hw_params = saarb_i2s_hw_params, | ||
112 | }; | ||
113 | |||
114 | static struct snd_soc_dai_link saarb_dai[] = { | ||
115 | { | ||
116 | .name = "88PM860x I2S", | ||
117 | .stream_name = "I2S Audio", | ||
118 | .cpu_dai_name = "pxa-ssp-dai.1", | ||
119 | .codec_dai_name = "88pm860x-i2s", | ||
120 | .platform_name = "pxa-pcm-audio", | ||
121 | .codec_name = "88pm860x-codec", | ||
122 | .init = saarb_pm860x_init, | ||
123 | .ops = &saarb_i2s_ops, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | static struct snd_soc_card snd_soc_card_saarb = { | ||
128 | .name = "Saarb", | ||
129 | .dai_link = saarb_dai, | ||
130 | .num_links = ARRAY_SIZE(saarb_dai), | ||
131 | }; | ||
132 | |||
133 | static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd) | ||
134 | { | ||
135 | struct snd_soc_codec *codec = rtd->codec; | ||
136 | int ret; | ||
137 | |||
138 | snd_soc_dapm_new_controls(codec, saarb_dapm_widgets, | ||
139 | ARRAY_SIZE(saarb_dapm_widgets)); | ||
140 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | ||
141 | |||
142 | /* connected pins */ | ||
143 | snd_soc_dapm_enable_pin(codec, "Ext Speaker"); | ||
144 | snd_soc_dapm_enable_pin(codec, "Ext Mic 1"); | ||
145 | snd_soc_dapm_enable_pin(codec, "Ext Mic 3"); | ||
146 | snd_soc_dapm_disable_pin(codec, "Headset Mic 2"); | ||
147 | snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); | ||
148 | |||
149 | ret = snd_soc_dapm_sync(codec); | ||
150 | if (ret) | ||
151 | return ret; | ||
152 | |||
153 | /* Headset jack detection */ | ||
154 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE | ||
155 | | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, | ||
156 | &hs_jack); | ||
157 | snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), | ||
158 | hs_jack_pins); | ||
159 | snd_soc_jack_new(codec, "Microphone Jack", SND_JACK_MICROPHONE, | ||
160 | &mic_jack); | ||
161 | snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), | ||
162 | mic_jack_pins); | ||
163 | |||
164 | /* headphone, microphone detection & headset short detection */ | ||
165 | pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE, | ||
166 | SND_JACK_BTN_0, SND_JACK_BTN_1, SND_JACK_BTN_2); | ||
167 | pm860x_mic_jack_detect(codec, &hs_jack, SND_JACK_MICROPHONE); | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int __init saarb_init(void) | ||
172 | { | ||
173 | int ret; | ||
174 | |||
175 | if (!machine_is_saarb()) | ||
176 | return -ENODEV; | ||
177 | saarb_snd_device = platform_device_alloc("soc-audio", -1); | ||
178 | if (!saarb_snd_device) | ||
179 | return -ENOMEM; | ||
180 | |||
181 | platform_set_drvdata(saarb_snd_device, &snd_soc_card_saarb); | ||
182 | |||
183 | ret = platform_device_add(saarb_snd_device); | ||
184 | if (ret) | ||
185 | platform_device_put(saarb_snd_device); | ||
186 | |||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | static void __exit saarb_exit(void) | ||
191 | { | ||
192 | platform_device_unregister(saarb_snd_device); | ||
193 | } | ||
194 | |||
195 | module_init(saarb_init); | ||
196 | module_exit(saarb_exit); | ||
197 | |||
198 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | ||
199 | MODULE_DESCRIPTION("ALSA SoC 88PM860x Saarb"); | ||
200 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index d256f5f313b5..f470f360f4dd 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
29 | #include <mach/spitz.h> | 29 | #include <mach/spitz.h> |
30 | #include "../codecs/wm8750.h" | 30 | #include "../codecs/wm8750.h" |
31 | #include "pxa2xx-pcm.h" | ||
32 | #include "pxa2xx-i2s.h" | 31 | #include "pxa2xx-i2s.h" |
33 | 32 | ||
34 | #define SPITZ_HP 0 | 33 | #define SPITZ_HP 0 |
@@ -107,7 +106,7 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
107 | static int spitz_startup(struct snd_pcm_substream *substream) | 106 | static int spitz_startup(struct snd_pcm_substream *substream) |
108 | { | 107 | { |
109 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 108 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
110 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 109 | struct snd_soc_codec *codec = rtd->codec; |
111 | 110 | ||
112 | /* check the jack status at stream startup */ | 111 | /* check the jack status at stream startup */ |
113 | spitz_ext_control(codec); | 112 | spitz_ext_control(codec); |
@@ -118,8 +117,8 @@ static int spitz_hw_params(struct snd_pcm_substream *substream, | |||
118 | struct snd_pcm_hw_params *params) | 117 | struct snd_pcm_hw_params *params) |
119 | { | 118 | { |
120 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 119 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
121 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 120 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
122 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 121 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
123 | unsigned int clk = 0; | 122 | unsigned int clk = 0; |
124 | int ret = 0; | 123 | int ret = 0; |
125 | 124 | ||
@@ -274,8 +273,9 @@ static const struct snd_kcontrol_new wm8750_spitz_controls[] = { | |||
274 | /* | 273 | /* |
275 | * Logic for a wm8750 as connected on a Sharp SL-Cxx00 Device | 274 | * Logic for a wm8750 as connected on a Sharp SL-Cxx00 Device |
276 | */ | 275 | */ |
277 | static int spitz_wm8750_init(struct snd_soc_codec *codec) | 276 | static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) |
278 | { | 277 | { |
278 | struct snd_soc_codec *codec = rtd->codec; | ||
279 | int err; | 279 | int err; |
280 | 280 | ||
281 | /* NC codec pins */ | 281 | /* NC codec pins */ |
@@ -308,8 +308,10 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec) | |||
308 | static struct snd_soc_dai_link spitz_dai = { | 308 | static struct snd_soc_dai_link spitz_dai = { |
309 | .name = "wm8750", | 309 | .name = "wm8750", |
310 | .stream_name = "WM8750", | 310 | .stream_name = "WM8750", |
311 | .cpu_dai = &pxa_i2s_dai, | 311 | .cpu_dai_name = "pxa-is2", |
312 | .codec_dai = &wm8750_dai, | 312 | .codec_dai_name = "wm8750-hifi", |
313 | .platform_name = "pxa-pcm-audio", | ||
314 | .codec_name = "wm8750-codec.0-001a", | ||
313 | .init = spitz_wm8750_init, | 315 | .init = spitz_wm8750_init, |
314 | .ops = &spitz_ops, | 316 | .ops = &spitz_ops, |
315 | }; | 317 | }; |
@@ -317,17 +319,10 @@ static struct snd_soc_dai_link spitz_dai = { | |||
317 | /* spitz audio machine driver */ | 319 | /* spitz audio machine driver */ |
318 | static struct snd_soc_card snd_soc_spitz = { | 320 | static struct snd_soc_card snd_soc_spitz = { |
319 | .name = "Spitz", | 321 | .name = "Spitz", |
320 | .platform = &pxa2xx_soc_platform, | ||
321 | .dai_link = &spitz_dai, | 322 | .dai_link = &spitz_dai, |
322 | .num_links = 1, | 323 | .num_links = 1, |
323 | }; | 324 | }; |
324 | 325 | ||
325 | /* spitz audio subsystem */ | ||
326 | static struct snd_soc_device spitz_snd_devdata = { | ||
327 | .card = &snd_soc_spitz, | ||
328 | .codec_dev = &soc_codec_dev_wm8750, | ||
329 | }; | ||
330 | |||
331 | static struct platform_device *spitz_snd_device; | 326 | static struct platform_device *spitz_snd_device; |
332 | 327 | ||
333 | static int __init spitz_init(void) | 328 | static int __init spitz_init(void) |
@@ -341,8 +336,7 @@ static int __init spitz_init(void) | |||
341 | if (!spitz_snd_device) | 336 | if (!spitz_snd_device) |
342 | return -ENOMEM; | 337 | return -ENOMEM; |
343 | 338 | ||
344 | platform_set_drvdata(spitz_snd_device, &spitz_snd_devdata); | 339 | platform_set_drvdata(spitz_snd_device, &snd_soc_spitz); |
345 | spitz_snd_devdata.dev = &spitz_snd_device->dev; | ||
346 | ret = platform_device_add(spitz_snd_device); | 340 | ret = platform_device_add(spitz_snd_device); |
347 | 341 | ||
348 | if (ret) | 342 | if (ret) |
diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c new file mode 100644 index 000000000000..248c283fc4df --- /dev/null +++ b/sound/soc/pxa/tavorevb3.c | |||
@@ -0,0 +1,200 @@ | |||
1 | /* | ||
2 | * tavorevb3.c -- SoC audio for Tavor EVB3 | ||
3 | * | ||
4 | * Copyright (C) 2010 Marvell International Ltd. | ||
5 | * Haojian Zhuang <haojian.zhuang@marvell.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/clk.h> | ||
16 | #include <linux/i2c.h> | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/pcm_params.h> | ||
20 | #include <sound/soc.h> | ||
21 | #include <sound/soc-dapm.h> | ||
22 | #include <sound/jack.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | |||
26 | #include "../codecs/88pm860x-codec.h" | ||
27 | #include "pxa-ssp.h" | ||
28 | |||
29 | static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd); | ||
30 | |||
31 | static struct platform_device *evb3_snd_device; | ||
32 | |||
33 | static struct snd_soc_jack hs_jack, mic_jack; | ||
34 | |||
35 | static struct snd_soc_jack_pin hs_jack_pins[] = { | ||
36 | { .pin = "Headset Stereophone", .mask = SND_JACK_HEADPHONE, }, | ||
37 | }; | ||
38 | |||
39 | static struct snd_soc_jack_pin mic_jack_pins[] = { | ||
40 | { .pin = "Headset Mic 2", .mask = SND_JACK_MICROPHONE, }, | ||
41 | }; | ||
42 | |||
43 | /* tavorevb3 machine dapm widgets */ | ||
44 | static const struct snd_soc_dapm_widget evb3_dapm_widgets[] = { | ||
45 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | ||
46 | SND_SOC_DAPM_LINE("Lineout Out 1", NULL), | ||
47 | SND_SOC_DAPM_LINE("Lineout Out 2", NULL), | ||
48 | SND_SOC_DAPM_SPK("Ext Speaker", NULL), | ||
49 | SND_SOC_DAPM_MIC("Ext Mic 1", NULL), | ||
50 | SND_SOC_DAPM_MIC("Headset Mic 2", NULL), | ||
51 | SND_SOC_DAPM_MIC("Ext Mic 3", NULL), | ||
52 | }; | ||
53 | |||
54 | /* tavorevb3 machine audio map */ | ||
55 | static const struct snd_soc_dapm_route audio_map[] = { | ||
56 | {"Headset Stereophone", NULL, "HS1"}, | ||
57 | {"Headset Stereophone", NULL, "HS2"}, | ||
58 | |||
59 | {"Ext Speaker", NULL, "LSP"}, | ||
60 | {"Ext Speaker", NULL, "LSN"}, | ||
61 | |||
62 | {"Lineout Out 1", NULL, "LINEOUT1"}, | ||
63 | {"Lineout Out 2", NULL, "LINEOUT2"}, | ||
64 | |||
65 | {"MIC1P", NULL, "Mic1 Bias"}, | ||
66 | {"MIC1N", NULL, "Mic1 Bias"}, | ||
67 | {"Mic1 Bias", NULL, "Ext Mic 1"}, | ||
68 | |||
69 | {"MIC2P", NULL, "Mic1 Bias"}, | ||
70 | {"MIC2N", NULL, "Mic1 Bias"}, | ||
71 | {"Mic1 Bias", NULL, "Headset Mic 2"}, | ||
72 | |||
73 | {"MIC3P", NULL, "Mic3 Bias"}, | ||
74 | {"MIC3N", NULL, "Mic3 Bias"}, | ||
75 | {"Mic3 Bias", NULL, "Ext Mic 3"}, | ||
76 | }; | ||
77 | |||
78 | static int evb3_i2s_hw_params(struct snd_pcm_substream *substream, | ||
79 | struct snd_pcm_hw_params *params) | ||
80 | { | ||
81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
82 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
83 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
84 | int width = snd_pcm_format_physical_width(params_format(params)); | ||
85 | int ret; | ||
86 | |||
87 | ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_NET_PLL, 0, | ||
88 | PM860X_CLK_DIR_OUT); | ||
89 | if (ret < 0) | ||
90 | return ret; | ||
91 | |||
92 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, 0, PM860X_CLK_DIR_OUT); | ||
93 | if (ret < 0) | ||
94 | return ret; | ||
95 | |||
96 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | ||
97 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
98 | if (ret < 0) | ||
99 | return ret; | ||
100 | |||
101 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
102 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
103 | if (ret < 0) | ||
104 | return ret; | ||
105 | |||
106 | ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); | ||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | static struct snd_soc_ops evb3_i2s_ops = { | ||
111 | .hw_params = evb3_i2s_hw_params, | ||
112 | }; | ||
113 | |||
114 | static struct snd_soc_dai_link evb3_dai[] = { | ||
115 | { | ||
116 | .name = "88PM860x I2S", | ||
117 | .stream_name = "I2S Audio", | ||
118 | .cpu_dai_name = "pxa-ssp-dai.1", | ||
119 | .codec_dai_name = "88pm860x-i2s", | ||
120 | .platform_name = "pxa-pcm-audio", | ||
121 | .codec_name = "88pm860x-codec", | ||
122 | .init = evb3_pm860x_init, | ||
123 | .ops = &evb3_i2s_ops, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | static struct snd_soc_card snd_soc_card_evb3 = { | ||
128 | .name = "Tavor EVB3", | ||
129 | .dai_link = evb3_dai, | ||
130 | .num_links = ARRAY_SIZE(evb3_dai), | ||
131 | }; | ||
132 | |||
133 | static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd) | ||
134 | { | ||
135 | struct snd_soc_codec *codec = rtd->codec; | ||
136 | int ret; | ||
137 | |||
138 | snd_soc_dapm_new_controls(codec, evb3_dapm_widgets, | ||
139 | ARRAY_SIZE(evb3_dapm_widgets)); | ||
140 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | ||
141 | |||
142 | /* connected pins */ | ||
143 | snd_soc_dapm_enable_pin(codec, "Ext Speaker"); | ||
144 | snd_soc_dapm_enable_pin(codec, "Ext Mic 1"); | ||
145 | snd_soc_dapm_enable_pin(codec, "Ext Mic 3"); | ||
146 | snd_soc_dapm_disable_pin(codec, "Headset Mic 2"); | ||
147 | snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); | ||
148 | |||
149 | ret = snd_soc_dapm_sync(codec); | ||
150 | if (ret) | ||
151 | return ret; | ||
152 | |||
153 | /* Headset jack detection */ | ||
154 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE | ||
155 | | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, | ||
156 | &hs_jack); | ||
157 | snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), | ||
158 | hs_jack_pins); | ||
159 | snd_soc_jack_new(codec, "Microphone Jack", SND_JACK_MICROPHONE, | ||
160 | &mic_jack); | ||
161 | snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), | ||
162 | mic_jack_pins); | ||
163 | |||
164 | /* headphone, microphone detection & headset short detection */ | ||
165 | pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE, | ||
166 | SND_JACK_BTN_0, SND_JACK_BTN_1, SND_JACK_BTN_2); | ||
167 | pm860x_mic_jack_detect(codec, &hs_jack, SND_JACK_MICROPHONE); | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int __init tavorevb3_init(void) | ||
172 | { | ||
173 | int ret; | ||
174 | |||
175 | if (!machine_is_tavorevb3()) | ||
176 | return -ENODEV; | ||
177 | evb3_snd_device = platform_device_alloc("soc-audio", -1); | ||
178 | if (!evb3_snd_device) | ||
179 | return -ENOMEM; | ||
180 | |||
181 | platform_set_drvdata(evb3_snd_device, &snd_soc_card_evb3); | ||
182 | |||
183 | ret = platform_device_add(evb3_snd_device); | ||
184 | if (ret) | ||
185 | platform_device_put(evb3_snd_device); | ||
186 | |||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | static void __exit tavorevb3_exit(void) | ||
191 | { | ||
192 | platform_device_unregister(evb3_snd_device); | ||
193 | } | ||
194 | |||
195 | module_init(tavorevb3_init); | ||
196 | module_exit(tavorevb3_exit); | ||
197 | |||
198 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | ||
199 | MODULE_DESCRIPTION("ALSA SoC 88PM860x Tavor EVB3"); | ||
200 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index dbbd3e9d1637..a3bfb2e8b70f 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <mach/audio.h> | 33 | #include <mach/audio.h> |
34 | 34 | ||
35 | #include "../codecs/wm9712.h" | 35 | #include "../codecs/wm9712.h" |
36 | #include "pxa2xx-pcm.h" | ||
37 | #include "pxa2xx-ac97.h" | 36 | #include "pxa2xx-ac97.h" |
38 | 37 | ||
39 | static struct snd_soc_card tosa; | 38 | static struct snd_soc_card tosa; |
@@ -80,7 +79,7 @@ static void tosa_ext_control(struct snd_soc_codec *codec) | |||
80 | static int tosa_startup(struct snd_pcm_substream *substream) | 79 | static int tosa_startup(struct snd_pcm_substream *substream) |
81 | { | 80 | { |
82 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
83 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 82 | struct snd_soc_codec *codec = rtd->card->codec; |
84 | 83 | ||
85 | /* check the jack status at stream startup */ | 84 | /* check the jack status at stream startup */ |
86 | tosa_ext_control(codec); | 85 | tosa_ext_control(codec); |
@@ -184,8 +183,9 @@ static const struct snd_kcontrol_new tosa_controls[] = { | |||
184 | tosa_set_spk), | 183 | tosa_set_spk), |
185 | }; | 184 | }; |
186 | 185 | ||
187 | static int tosa_ac97_init(struct snd_soc_codec *codec) | 186 | static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd) |
188 | { | 187 | { |
188 | struct snd_soc_codec *codec = rtd->codec; | ||
189 | int err; | 189 | int err; |
190 | 190 | ||
191 | snd_soc_dapm_nc_pin(codec, "OUT3"); | 191 | snd_soc_dapm_nc_pin(codec, "OUT3"); |
@@ -212,16 +212,20 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
212 | { | 212 | { |
213 | .name = "AC97", | 213 | .name = "AC97", |
214 | .stream_name = "AC97 HiFi", | 214 | .stream_name = "AC97 HiFi", |
215 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 215 | .cpu_dai_name = "pxa-ac97.0", |
216 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI], | 216 | .codec_dai_name = "wm9712-hifi", |
217 | .platform_name = "pxa-pcm-audio", | ||
218 | .codec_name = "wm9712-codec", | ||
217 | .init = tosa_ac97_init, | 219 | .init = tosa_ac97_init, |
218 | .ops = &tosa_ops, | 220 | .ops = &tosa_ops, |
219 | }, | 221 | }, |
220 | { | 222 | { |
221 | .name = "AC97 Aux", | 223 | .name = "AC97 Aux", |
222 | .stream_name = "AC97 Aux", | 224 | .stream_name = "AC97 Aux", |
223 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 225 | .cpu_dai_name = "pxa-ac97.1", |
224 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX], | 226 | .codec_dai_name = "wm9712-aux", |
227 | .platform_name = "pxa-pcm-audio", | ||
228 | .codec_name = "wm9712-codec", | ||
225 | .ops = &tosa_ops, | 229 | .ops = &tosa_ops, |
226 | }, | 230 | }, |
227 | }; | 231 | }; |
@@ -248,18 +252,12 @@ static int tosa_remove(struct platform_device *dev) | |||
248 | 252 | ||
249 | static struct snd_soc_card tosa = { | 253 | static struct snd_soc_card tosa = { |
250 | .name = "Tosa", | 254 | .name = "Tosa", |
251 | .platform = &pxa2xx_soc_platform, | ||
252 | .dai_link = tosa_dai, | 255 | .dai_link = tosa_dai, |
253 | .num_links = ARRAY_SIZE(tosa_dai), | 256 | .num_links = ARRAY_SIZE(tosa_dai), |
254 | .probe = tosa_probe, | 257 | .probe = tosa_probe, |
255 | .remove = tosa_remove, | 258 | .remove = tosa_remove, |
256 | }; | 259 | }; |
257 | 260 | ||
258 | static struct snd_soc_device tosa_snd_devdata = { | ||
259 | .card = &tosa, | ||
260 | .codec_dev = &soc_codec_dev_wm9712, | ||
261 | }; | ||
262 | |||
263 | static struct platform_device *tosa_snd_device; | 261 | static struct platform_device *tosa_snd_device; |
264 | 262 | ||
265 | static int __init tosa_init(void) | 263 | static int __init tosa_init(void) |
@@ -275,8 +273,7 @@ static int __init tosa_init(void) | |||
275 | goto err_alloc; | 273 | goto err_alloc; |
276 | } | 274 | } |
277 | 275 | ||
278 | platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata); | 276 | platform_set_drvdata(tosa_snd_device, &tosa); |
279 | tosa_snd_devdata.dev = &tosa_snd_device->dev; | ||
280 | ret = platform_device_add(tosa_snd_device); | 277 | ret = platform_device_add(tosa_snd_device); |
281 | 278 | ||
282 | if (!ret) | 279 | if (!ret) |
diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c index 4e4d2fa8ddc5..4cc841b44182 100644 --- a/sound/soc/pxa/z2.c +++ b/sound/soc/pxa/z2.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <mach/z2.h> | 30 | #include <mach/z2.h> |
31 | 31 | ||
32 | #include "../codecs/wm8750.h" | 32 | #include "../codecs/wm8750.h" |
33 | #include "pxa2xx-pcm.h" | ||
34 | #include "pxa2xx-i2s.h" | 33 | #include "pxa2xx-i2s.h" |
35 | 34 | ||
36 | static struct snd_soc_card snd_soc_z2; | 35 | static struct snd_soc_card snd_soc_z2; |
@@ -39,8 +38,8 @@ static int z2_hw_params(struct snd_pcm_substream *substream, | |||
39 | struct snd_pcm_hw_params *params) | 38 | struct snd_pcm_hw_params *params) |
40 | { | 39 | { |
41 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 40 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
42 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 41 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
43 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 42 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
44 | unsigned int clk = 0; | 43 | unsigned int clk = 0; |
45 | int ret = 0; | 44 | int ret = 0; |
46 | 45 | ||
@@ -138,8 +137,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
138 | /* | 137 | /* |
139 | * Logic for a wm8750 as connected on a Z2 Device | 138 | * Logic for a wm8750 as connected on a Z2 Device |
140 | */ | 139 | */ |
141 | static int z2_wm8750_init(struct snd_soc_codec *codec) | 140 | static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) |
142 | { | 141 | { |
142 | struct snd_soc_codec *codec = rtd->codec; | ||
143 | int ret; | 143 | int ret; |
144 | 144 | ||
145 | /* NC codec pins */ | 145 | /* NC codec pins */ |
@@ -160,7 +160,7 @@ static int z2_wm8750_init(struct snd_soc_codec *codec) | |||
160 | goto err; | 160 | goto err; |
161 | 161 | ||
162 | /* Jack detection API stuff */ | 162 | /* Jack detection API stuff */ |
163 | ret = snd_soc_jack_new(&snd_soc_z2, "Headset Jack", SND_JACK_HEADSET, | 163 | ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, |
164 | &hs_jack); | 164 | &hs_jack); |
165 | if (ret) | 165 | if (ret) |
166 | goto err; | 166 | goto err; |
@@ -189,8 +189,10 @@ static struct snd_soc_ops z2_ops = { | |||
189 | static struct snd_soc_dai_link z2_dai = { | 189 | static struct snd_soc_dai_link z2_dai = { |
190 | .name = "wm8750", | 190 | .name = "wm8750", |
191 | .stream_name = "WM8750", | 191 | .stream_name = "WM8750", |
192 | .cpu_dai = &pxa_i2s_dai, | 192 | .cpu_dai_name = "pxa2xx-i2s", |
193 | .codec_dai = &wm8750_dai, | 193 | .codec_dai_name = "wm8750-hifi", |
194 | .platform_name = "pxa-pcm-audio", | ||
195 | .codec_name = "wm8750-codec.0-001a", | ||
194 | .init = z2_wm8750_init, | 196 | .init = z2_wm8750_init, |
195 | .ops = &z2_ops, | 197 | .ops = &z2_ops, |
196 | }; | 198 | }; |
@@ -198,17 +200,10 @@ static struct snd_soc_dai_link z2_dai = { | |||
198 | /* z2 audio machine driver */ | 200 | /* z2 audio machine driver */ |
199 | static struct snd_soc_card snd_soc_z2 = { | 201 | static struct snd_soc_card snd_soc_z2 = { |
200 | .name = "Z2", | 202 | .name = "Z2", |
201 | .platform = &pxa2xx_soc_platform, | ||
202 | .dai_link = &z2_dai, | 203 | .dai_link = &z2_dai, |
203 | .num_links = 1, | 204 | .num_links = 1, |
204 | }; | 205 | }; |
205 | 206 | ||
206 | /* z2 audio subsystem */ | ||
207 | static struct snd_soc_device z2_snd_devdata = { | ||
208 | .card = &snd_soc_z2, | ||
209 | .codec_dev = &soc_codec_dev_wm8750, | ||
210 | }; | ||
211 | |||
212 | static struct platform_device *z2_snd_device; | 207 | static struct platform_device *z2_snd_device; |
213 | 208 | ||
214 | static int __init z2_init(void) | 209 | static int __init z2_init(void) |
@@ -222,8 +217,7 @@ static int __init z2_init(void) | |||
222 | if (!z2_snd_device) | 217 | if (!z2_snd_device) |
223 | return -ENOMEM; | 218 | return -ENOMEM; |
224 | 219 | ||
225 | platform_set_drvdata(z2_snd_device, &z2_snd_devdata); | 220 | platform_set_drvdata(z2_snd_device, &snd_soc_z2); |
226 | z2_snd_devdata.dev = &z2_snd_device->dev; | ||
227 | ret = platform_device_add(z2_snd_device); | 221 | ret = platform_device_add(z2_snd_device); |
228 | 222 | ||
229 | if (ret) | 223 | if (ret) |
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c index dd678ae24398..d27e05af7759 100644 --- a/sound/soc/pxa/zylonite.c +++ b/sound/soc/pxa/zylonite.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <sound/soc-dapm.h> | 23 | #include <sound/soc-dapm.h> |
24 | 24 | ||
25 | #include "../codecs/wm9713.h" | 25 | #include "../codecs/wm9713.h" |
26 | #include "pxa2xx-pcm.h" | ||
27 | #include "pxa2xx-ac97.h" | 26 | #include "pxa2xx-ac97.h" |
28 | #include "pxa-ssp.h" | 27 | #include "pxa-ssp.h" |
29 | 28 | ||
@@ -71,10 +70,12 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
71 | { "Multiactor", NULL, "SPKR" }, | 70 | { "Multiactor", NULL, "SPKR" }, |
72 | }; | 71 | }; |
73 | 72 | ||
74 | static int zylonite_wm9713_init(struct snd_soc_codec *codec) | 73 | static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd) |
75 | { | 74 | { |
75 | struct snd_soc_codec *codec = rtd->codec; | ||
76 | |||
76 | if (clk_pout) | 77 | if (clk_pout) |
77 | snd_soc_dai_set_pll(&codec->dai[0], 0, 0, | 78 | snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, |
78 | clk_get_rate(pout), 0); | 79 | clk_get_rate(pout), 0); |
79 | 80 | ||
80 | snd_soc_dapm_new_controls(codec, zylonite_dapm_widgets, | 81 | snd_soc_dapm_new_controls(codec, zylonite_dapm_widgets, |
@@ -94,8 +95,8 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream, | |||
94 | struct snd_pcm_hw_params *params) | 95 | struct snd_pcm_hw_params *params) |
95 | { | 96 | { |
96 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 97 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
97 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 98 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
98 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 99 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
99 | unsigned int pll_out = 0; | 100 | unsigned int pll_out = 0; |
100 | unsigned int wm9713_div = 0; | 101 | unsigned int wm9713_div = 0; |
101 | int ret = 0; | 102 | int ret = 0; |
@@ -163,21 +164,27 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
163 | { | 164 | { |
164 | .name = "AC97", | 165 | .name = "AC97", |
165 | .stream_name = "AC97 HiFi", | 166 | .stream_name = "AC97 HiFi", |
166 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 167 | .codec_name = "wm9713-codec", |
167 | .codec_dai = &wm9713_dai[WM9713_DAI_AC97_HIFI], | 168 | .platform_name = "pxa-pcm-audio", |
169 | .cpu_dai_name = "pxa-ac97.0", | ||
170 | .codec_name = "wm9713-hifi", | ||
168 | .init = zylonite_wm9713_init, | 171 | .init = zylonite_wm9713_init, |
169 | }, | 172 | }, |
170 | { | 173 | { |
171 | .name = "AC97 Aux", | 174 | .name = "AC97 Aux", |
172 | .stream_name = "AC97 Aux", | 175 | .stream_name = "AC97 Aux", |
173 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 176 | .codec_name = "wm9713-codec", |
174 | .codec_dai = &wm9713_dai[WM9713_DAI_AC97_AUX], | 177 | .platform_name = "pxa-pcm-audio", |
178 | .cpu_dai_name = "pxa-ac97.1", | ||
179 | .codec_name = "wm9713-aux", | ||
175 | }, | 180 | }, |
176 | { | 181 | { |
177 | .name = "WM9713 Voice", | 182 | .name = "WM9713 Voice", |
178 | .stream_name = "WM9713 Voice", | 183 | .stream_name = "WM9713 Voice", |
179 | .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP3], | 184 | .codec_name = "wm9713-codec", |
180 | .codec_dai = &wm9713_dai[WM9713_DAI_PCM_VOICE], | 185 | .platform_name = "pxa-pcm-audio", |
186 | .cpu_dai_name = "pxa-ssp-dai.2", | ||
187 | .codec_name = "wm9713-voice", | ||
181 | .ops = &zylonite_voice_ops, | 188 | .ops = &zylonite_voice_ops, |
182 | }, | 189 | }, |
183 | }; | 190 | }; |
@@ -248,14 +255,9 @@ static struct snd_soc_card zylonite = { | |||
248 | .remove = &zylonite_remove, | 255 | .remove = &zylonite_remove, |
249 | .suspend_post = &zylonite_suspend_post, | 256 | .suspend_post = &zylonite_suspend_post, |
250 | .resume_pre = &zylonite_resume_pre, | 257 | .resume_pre = &zylonite_resume_pre, |
251 | .platform = &pxa2xx_soc_platform, | ||
252 | .dai_link = zylonite_dai, | 258 | .dai_link = zylonite_dai, |
253 | .num_links = ARRAY_SIZE(zylonite_dai), | 259 | .num_links = ARRAY_SIZE(zylonite_dai), |
254 | }; | 260 | .owner = THIS_MODULE, |
255 | |||
256 | static struct snd_soc_device zylonite_snd_ac97_devdata = { | ||
257 | .card = &zylonite, | ||
258 | .codec_dev = &soc_codec_dev_wm9713, | ||
259 | }; | 261 | }; |
260 | 262 | ||
261 | static struct platform_device *zylonite_snd_ac97_device; | 263 | static struct platform_device *zylonite_snd_ac97_device; |
@@ -268,9 +270,7 @@ static int __init zylonite_init(void) | |||
268 | if (!zylonite_snd_ac97_device) | 270 | if (!zylonite_snd_ac97_device) |
269 | return -ENOMEM; | 271 | return -ENOMEM; |
270 | 272 | ||
271 | platform_set_drvdata(zylonite_snd_ac97_device, | 273 | platform_set_drvdata(zylonite_snd_ac97_device, &zylonite); |
272 | &zylonite_snd_ac97_devdata); | ||
273 | zylonite_snd_ac97_devdata.dev = &zylonite_snd_ac97_device->dev; | ||
274 | 274 | ||
275 | ret = platform_device_add(zylonite_snd_ac97_device); | 275 | ret = platform_device_add(zylonite_snd_ac97_device); |
276 | if (ret != 0) | 276 | if (ret != 0) |