diff options
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r-- | sound/soc/pxa/corgi.c | 25 | ||||
-rw-r--r-- | sound/soc/pxa/e740_wm9705.c | 26 | ||||
-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 | 21 | ||||
-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 | 27 | ||||
-rw-r--r-- | sound/soc/pxa/pxa-ssp.c | 148 | ||||
-rw-r--r-- | sound/soc/pxa/pxa-ssp.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.c | 45 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.c | 89 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-pcm.c | 45 | ||||
-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/spitz.c | 62 | ||||
-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 |
23 files changed, 339 insertions, 548 deletions
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index fefe1a57f31a..11c6a495f970 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
@@ -99,7 +99,7 @@ static void corgi_ext_control(struct snd_soc_codec *codec) | |||
99 | static int corgi_startup(struct snd_pcm_substream *substream) | 99 | static int corgi_startup(struct snd_pcm_substream *substream) |
100 | { | 100 | { |
101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
102 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 102 | struct snd_soc_codec *codec = rtd->codec; |
103 | 103 | ||
104 | /* check the jack status at stream startup */ | 104 | /* check the jack status at stream startup */ |
105 | corgi_ext_control(codec); | 105 | corgi_ext_control(codec); |
@@ -118,8 +118,8 @@ static int corgi_hw_params(struct snd_pcm_substream *substream, | |||
118 | struct snd_pcm_hw_params *params) | 118 | struct snd_pcm_hw_params *params) |
119 | { | 119 | { |
120 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 120 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
121 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 121 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
122 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 122 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
123 | unsigned int clk = 0; | 123 | unsigned int clk = 0; |
124 | int ret = 0; | 124 | int ret = 0; |
125 | 125 | ||
@@ -272,8 +272,9 @@ static const struct snd_kcontrol_new wm8731_corgi_controls[] = { | |||
272 | /* | 272 | /* |
273 | * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device | 273 | * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device |
274 | */ | 274 | */ |
275 | static int corgi_wm8731_init(struct snd_soc_codec *codec) | 275 | static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
276 | { | 276 | { |
277 | struct snd_soc_codec *codec = rtd->codec; | ||
277 | int err; | 278 | int err; |
278 | 279 | ||
279 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); | 280 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); |
@@ -300,8 +301,10 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec) | |||
300 | static struct snd_soc_dai_link corgi_dai = { | 301 | static struct snd_soc_dai_link corgi_dai = { |
301 | .name = "WM8731", | 302 | .name = "WM8731", |
302 | .stream_name = "WM8731", | 303 | .stream_name = "WM8731", |
303 | .cpu_dai = &pxa_i2s_dai, | 304 | .cpu_dai_name = "pxa-is2-dai", |
304 | .codec_dai = &wm8731_dai, | 305 | .codec_dai_name = "wm8731-hifi", |
306 | .platform_name = "pxa-pcm-audio", | ||
307 | .codec_name = "wm8731-codec-0.001a", | ||
305 | .init = corgi_wm8731_init, | 308 | .init = corgi_wm8731_init, |
306 | .ops = &corgi_ops, | 309 | .ops = &corgi_ops, |
307 | }; | 310 | }; |
@@ -309,17 +312,10 @@ static struct snd_soc_dai_link corgi_dai = { | |||
309 | /* corgi audio machine driver */ | 312 | /* corgi audio machine driver */ |
310 | static struct snd_soc_card snd_soc_corgi = { | 313 | static struct snd_soc_card snd_soc_corgi = { |
311 | .name = "Corgi", | 314 | .name = "Corgi", |
312 | .platform = &pxa2xx_soc_platform, | ||
313 | .dai_link = &corgi_dai, | 315 | .dai_link = &corgi_dai, |
314 | .num_links = 1, | 316 | .num_links = 1, |
315 | }; | 317 | }; |
316 | 318 | ||
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; | 319 | static struct platform_device *corgi_snd_device; |
324 | 320 | ||
325 | static int __init corgi_init(void) | 321 | static int __init corgi_init(void) |
@@ -334,8 +330,7 @@ static int __init corgi_init(void) | |||
334 | if (!corgi_snd_device) | 330 | if (!corgi_snd_device) |
335 | return -ENOMEM; | 331 | return -ENOMEM; |
336 | 332 | ||
337 | platform_set_drvdata(corgi_snd_device, &corgi_snd_devdata); | 333 | 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); | 334 | ret = platform_device_add(corgi_snd_device); |
340 | 335 | ||
341 | if (ret) | 336 | if (ret) |
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 7cd2f89d7b10..f614607b2055 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) |
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..7046128b2a4c 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c | |||
@@ -39,29 +39,27 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
39 | { | 39 | { |
40 | .name = "AC97", | 40 | .name = "AC97", |
41 | .stream_name = "AC97 HiFi", | 41 | .stream_name = "AC97 HiFi", |
42 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI], | 42 | .cpu_dai_name = "pxa-ac97.0", |
43 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI], | 43 | .codec_dai_name = "wm9712-hifi", |
44 | .platform_name = "pxa-pcm-audio", | ||
45 | .codec_name = "wm9712-codec", | ||
44 | }, | 46 | }, |
45 | { | 47 | { |
46 | .name = "AC97 Aux", | 48 | .name = "AC97 Aux", |
47 | .stream_name = "AC97 Aux", | 49 | .stream_name = "AC97 Aux", |
48 | .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX], | 50 | .cpu_dai_name = "pxa-ac97.1", |
49 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX], | 51 | .codec_dai_name ="wm9712-aux", |
52 | .platform_name = "pxa-pcm-audio", | ||
53 | .codec_name = "wm9712-codec", | ||
50 | }, | 54 | }, |
51 | }; | 55 | }; |
52 | 56 | ||
53 | static struct snd_soc_card em_x270 = { | 57 | static struct snd_soc_card em_x270 = { |
54 | .name = "EM-X270", | 58 | .name = "EM-X270", |
55 | .platform = &pxa2xx_soc_platform, | ||
56 | .dai_link = em_x270_dai, | 59 | .dai_link = em_x270_dai, |
57 | .num_links = ARRAY_SIZE(em_x270_dai), | 60 | .num_links = ARRAY_SIZE(em_x270_dai), |
58 | }; | 61 | }; |
59 | 62 | ||
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; | 63 | static struct platform_device *em_x270_snd_device; |
66 | 64 | ||
67 | static int __init em_x270_init(void) | 65 | static int __init em_x270_init(void) |
@@ -76,8 +74,7 @@ static int __init em_x270_init(void) | |||
76 | if (!em_x270_snd_device) | 74 | if (!em_x270_snd_device) |
77 | return -ENOMEM; | 75 | return -ENOMEM; |
78 | 76 | ||
79 | platform_set_drvdata(em_x270_snd_device, &em_x270_snd_devdata); | 77 | 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); | 78 | ret = platform_device_add(em_x270_snd_device); |
82 | 79 | ||
83 | if (ret) | 80 | if (ret) |
diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c index 405587a01160..03765fc5ac74 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 = "pxa-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..608bc3dd835f 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 = "pxa-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..3ba5a962ecb8 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 | ||
@@ -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 = "pxa-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..99d80e85621c 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -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,7 +460,7 @@ 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; |
470 | u32 sscr1; | 466 | u32 sscr1; |
@@ -555,11 +551,9 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
555 | */ | 551 | */ |
556 | static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | 552 | static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, |
557 | struct snd_pcm_hw_params *params, | 553 | struct snd_pcm_hw_params *params, |
558 | struct snd_soc_dai *dai) | 554 | struct snd_soc_dai *cpu_dai) |
559 | { | 555 | { |
560 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 556 | 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; | 557 | struct ssp_device *ssp = priv->ssp; |
564 | int chn = params_channels(params); | 558 | int chn = params_channels(params); |
565 | u32 sscr0; | 559 | u32 sscr0; |
@@ -568,7 +562,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
568 | int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; | 562 | int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; |
569 | struct pxa2xx_pcm_dma_params *dma_data; | 563 | struct pxa2xx_pcm_dma_params *dma_data; |
570 | 564 | ||
571 | dma_data = snd_soc_dai_get_dma_data(dai, substream); | 565 | dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); |
572 | 566 | ||
573 | /* generate correct DMA params */ | 567 | /* generate correct DMA params */ |
574 | kfree(dma_data); | 568 | kfree(dma_data); |
@@ -581,7 +575,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
581 | ((chn == 2) && (ttsa != 1)) || (width == 32), | 575 | ((chn == 2) && (ttsa != 1)) || (width == 32), |
582 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 576 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
583 | 577 | ||
584 | snd_soc_dai_set_dma_data(dai, substream, dma_data); | 578 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); |
585 | 579 | ||
586 | /* we can only change the settings if the port is not in use */ | 580 | /* we can only change the settings if the port is not in use */ |
587 | if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) | 581 | if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) |
@@ -668,12 +662,10 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
668 | } | 662 | } |
669 | 663 | ||
670 | static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | 664 | static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, |
671 | struct snd_soc_dai *dai) | 665 | struct snd_soc_dai *cpu_dai) |
672 | { | 666 | { |
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; | 667 | int ret = 0; |
676 | struct ssp_priv *priv = cpu_dai->private_data; | 668 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); |
677 | struct ssp_device *ssp = priv->ssp; | 669 | struct ssp_device *ssp = priv->ssp; |
678 | int val; | 670 | int val; |
679 | 671 | ||
@@ -729,8 +721,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | |||
729 | return ret; | 721 | return ret; |
730 | } | 722 | } |
731 | 723 | ||
732 | static int pxa_ssp_probe(struct platform_device *pdev, | 724 | static int pxa_ssp_probe(struct snd_soc_dai *dai) |
733 | struct snd_soc_dai *dai) | ||
734 | { | 725 | { |
735 | struct ssp_priv *priv; | 726 | struct ssp_priv *priv; |
736 | int ret; | 727 | int ret; |
@@ -746,7 +737,7 @@ static int pxa_ssp_probe(struct platform_device *pdev, | |||
746 | } | 737 | } |
747 | 738 | ||
748 | priv->dai_fmt = (unsigned int) -1; | 739 | priv->dai_fmt = (unsigned int) -1; |
749 | dai->private_data = priv; | 740 | snd_soc_dai_set_drvdata(dai, priv); |
750 | 741 | ||
751 | return 0; | 742 | return 0; |
752 | 743 | ||
@@ -755,11 +746,12 @@ err_priv: | |||
755 | return ret; | 746 | return ret; |
756 | } | 747 | } |
757 | 748 | ||
758 | static void pxa_ssp_remove(struct platform_device *pdev, | 749 | static int pxa_ssp_remove(struct snd_soc_dai *dai) |
759 | struct snd_soc_dai *dai) | ||
760 | { | 750 | { |
761 | struct ssp_priv *priv = dai->private_data; | 751 | struct ssp_priv *priv = snd_soc_dai_get_drvdata(dai); |
752 | |||
762 | pxa_ssp_free(priv->ssp); | 753 | pxa_ssp_free(priv->ssp); |
754 | return 0; | ||
763 | } | 755 | } |
764 | 756 | ||
765 | #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ | 757 | #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ |
@@ -784,10 +776,7 @@ static struct snd_soc_dai_ops pxa_ssp_dai_ops = { | |||
784 | .set_tristate = pxa_ssp_set_dai_tristate, | 776 | .set_tristate = pxa_ssp_set_dai_tristate, |
785 | }; | 777 | }; |
786 | 778 | ||
787 | struct snd_soc_dai pxa_ssp_dai[] = { | 779 | static struct snd_soc_dai_driver pxa_ssp_dai = { |
788 | { | ||
789 | .name = "pxa2xx-ssp1", | ||
790 | .id = 0, | ||
791 | .probe = pxa_ssp_probe, | 780 | .probe = pxa_ssp_probe, |
792 | .remove = pxa_ssp_remove, | 781 | .remove = pxa_ssp_remove, |
793 | .suspend = pxa_ssp_suspend, | 782 | .suspend = pxa_ssp_suspend, |
@@ -805,81 +794,38 @@ struct snd_soc_dai pxa_ssp_dai[] = { | |||
805 | .formats = PXA_SSP_FORMATS, | 794 | .formats = PXA_SSP_FORMATS, |
806 | }, | 795 | }, |
807 | .ops = &pxa_ssp_dai_ops, | 796 | .ops = &pxa_ssp_dai_ops, |
797 | }; | ||
798 | |||
799 | static __devinit int asoc_ssp_probe(struct platform_device *pdev) | ||
800 | { | ||
801 | return snd_soc_register_dai(&pdev->dev, &pxa_ssp_dai); | ||
802 | } | ||
803 | |||
804 | static int __devexit asoc_ssp_remove(struct platform_device *pdev) | ||
805 | { | ||
806 | snd_soc_unregister_dai(&pdev->dev); | ||
807 | return 0; | ||
808 | } | ||
809 | |||
810 | static struct platform_driver asoc_ssp_driver = { | ||
811 | .driver = { | ||
812 | .name = "pxa-ssp-dai", | ||
813 | .owner = THIS_MODULE, | ||
808 | }, | 814 | }, |
809 | { .name = "pxa2xx-ssp2", | 815 | |
810 | .id = 1, | 816 | .probe = asoc_ssp_probe, |
811 | .probe = pxa_ssp_probe, | 817 | .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 | }; | 818 | }; |
872 | EXPORT_SYMBOL_GPL(pxa_ssp_dai); | ||
873 | 819 | ||
874 | static int __init pxa_ssp_init(void) | 820 | static int __init pxa_ssp_init(void) |
875 | { | 821 | { |
876 | return snd_soc_register_dais(pxa_ssp_dai, ARRAY_SIZE(pxa_ssp_dai)); | 822 | return platform_driver_register(&asoc_ssp_driver); |
877 | } | 823 | } |
878 | module_init(pxa_ssp_init); | 824 | module_init(pxa_ssp_init); |
879 | 825 | ||
880 | static void __exit pxa_ssp_exit(void) | 826 | static void __exit pxa_ssp_exit(void) |
881 | { | 827 | { |
882 | snd_soc_unregister_dais(pxa_ssp_dai, ARRAY_SIZE(pxa_ssp_dai)); | 828 | platform_driver_unregister(&asoc_ssp_driver); |
883 | } | 829 | } |
884 | module_exit(pxa_ssp_exit); | 830 | module_exit(pxa_ssp_exit); |
885 | 831 | ||
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..9c2bafa112ad 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -104,24 +104,21 @@ static int pxa2xx_ac97_resume(struct snd_soc_dai *dai) | |||
104 | #define pxa2xx_ac97_resume NULL | 104 | #define pxa2xx_ac97_resume NULL |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | static int pxa2xx_ac97_probe(struct platform_device *pdev, | 107 | static int pxa2xx_ac97_probe(struct snd_soc_dai *dai) |
108 | struct snd_soc_dai *dai) | ||
109 | { | 108 | { |
110 | return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev)); | 109 | return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev)); |
111 | } | 110 | } |
112 | 111 | ||
113 | static void pxa2xx_ac97_remove(struct platform_device *pdev, | 112 | static int pxa2xx_ac97_remove(struct snd_soc_dai *dai) |
114 | struct snd_soc_dai *dai) | ||
115 | { | 113 | { |
116 | pxa2xx_ac97_hw_remove(to_platform_device(dai->dev)); | 114 | pxa2xx_ac97_hw_remove(to_platform_device(dai->dev)); |
115 | return 0; | ||
117 | } | 116 | } |
118 | 117 | ||
119 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | 118 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, |
120 | struct snd_pcm_hw_params *params, | 119 | struct snd_pcm_hw_params *params, |
121 | struct snd_soc_dai *dai) | 120 | struct snd_soc_dai *cpu_dai) |
122 | { | 121 | { |
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; | 122 | struct pxa2xx_pcm_dma_params *dma_data; |
126 | 123 | ||
127 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 124 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -136,10 +133,8 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | |||
136 | 133 | ||
137 | static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, | 134 | static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, |
138 | struct snd_pcm_hw_params *params, | 135 | struct snd_pcm_hw_params *params, |
139 | struct snd_soc_dai *dai) | 136 | struct snd_soc_dai *cpu_dai) |
140 | { | 137 | { |
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; | 138 | struct pxa2xx_pcm_dma_params *dma_data; |
144 | 139 | ||
145 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 140 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -154,11 +149,8 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, | |||
154 | 149 | ||
155 | static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, | 150 | static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, |
156 | struct snd_pcm_hw_params *params, | 151 | struct snd_pcm_hw_params *params, |
157 | struct snd_soc_dai *dai) | 152 | struct snd_soc_dai *cpu_dai) |
158 | { | 153 | { |
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) | 154 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
163 | return -ENODEV; | 155 | return -ENODEV; |
164 | else | 156 | else |
@@ -188,10 +180,9 @@ static struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = { | |||
188 | * There is only 1 physical AC97 interface for pxa2xx, but it | 180 | * 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. | 181 | * has extra fifo's that can be used for aux DACs and ADCs. |
190 | */ | 182 | */ |
191 | struct snd_soc_dai pxa_ac97_dai[] = { | 183 | static struct snd_soc_dai_driver pxa_ac97_dai[] = { |
192 | { | 184 | { |
193 | .name = "pxa2xx-ac97", | 185 | .name = "pxa2xx-ac97", |
194 | .id = 0, | ||
195 | .ac97_control = 1, | 186 | .ac97_control = 1, |
196 | .probe = pxa2xx_ac97_probe, | 187 | .probe = pxa2xx_ac97_probe, |
197 | .remove = pxa2xx_ac97_remove, | 188 | .remove = pxa2xx_ac97_remove, |
@@ -213,7 +204,6 @@ struct snd_soc_dai pxa_ac97_dai[] = { | |||
213 | }, | 204 | }, |
214 | { | 205 | { |
215 | .name = "pxa2xx-ac97-aux", | 206 | .name = "pxa2xx-ac97-aux", |
216 | .id = 1, | ||
217 | .ac97_control = 1, | 207 | .ac97_control = 1, |
218 | .playback = { | 208 | .playback = { |
219 | .stream_name = "AC97 Aux Playback", | 209 | .stream_name = "AC97 Aux Playback", |
@@ -231,7 +221,6 @@ struct snd_soc_dai pxa_ac97_dai[] = { | |||
231 | }, | 221 | }, |
232 | { | 222 | { |
233 | .name = "pxa2xx-ac97-mic", | 223 | .name = "pxa2xx-ac97-mic", |
234 | .id = 2, | ||
235 | .ac97_control = 1, | 224 | .ac97_control = 1, |
236 | .capture = { | 225 | .capture = { |
237 | .stream_name = "AC97 Mic Capture", | 226 | .stream_name = "AC97 Mic Capture", |
@@ -243,36 +232,26 @@ struct snd_soc_dai pxa_ac97_dai[] = { | |||
243 | }, | 232 | }, |
244 | }; | 233 | }; |
245 | 234 | ||
246 | EXPORT_SYMBOL_GPL(pxa_ac97_dai); | ||
247 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | 235 | EXPORT_SYMBOL_GPL(soc_ac97_ops); |
248 | 236 | ||
249 | static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev) | 237 | static __devinit int pxa2xx_ac97_dev_probe(struct platform_device *pdev) |
250 | { | 238 | { |
251 | int i; | 239 | 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"); | 240 | dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); |
256 | return -ENXIO; | 241 | return -ENXIO; |
257 | } | 242 | } |
258 | 243 | ||
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 | 244 | /* 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 | 245 | * driver to do interesting things with the clocking to get us up |
267 | * and running. | 246 | * and running. |
268 | */ | 247 | */ |
269 | return snd_soc_register_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai)); | 248 | return snd_soc_register_dais(&pdev->dev, pxa_ac97_dai, |
249 | ARRAY_SIZE(pxa_ac97_dai)); | ||
270 | } | 250 | } |
271 | 251 | ||
272 | static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev) | 252 | static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev) |
273 | { | 253 | { |
274 | snd_soc_unregister_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai)); | 254 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(pxa_ac97_dai)); |
275 | |||
276 | return 0; | 255 | return 0; |
277 | } | 256 | } |
278 | 257 | ||
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..3b473b200a8f 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -80,6 +80,7 @@ struct pxa_i2s_port { | |||
80 | }; | 80 | }; |
81 | static struct pxa_i2s_port pxa_i2s; | 81 | static struct pxa_i2s_port pxa_i2s; |
82 | static struct clk *clk_i2s; | 82 | static struct clk *clk_i2s; |
83 | static int clk_ena = 0; | ||
83 | 84 | ||
84 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { | 85 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { |
85 | .name = "I2S PCM Stereo out", | 86 | .name = "I2S PCM Stereo out", |
@@ -101,7 +102,7 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream, | |||
101 | struct snd_soc_dai *dai) | 102 | struct snd_soc_dai *dai) |
102 | { | 103 | { |
103 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 104 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
104 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 105 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
105 | 106 | ||
106 | if (IS_ERR(clk_i2s)) | 107 | if (IS_ERR(clk_i2s)) |
107 | return PTR_ERR(clk_i2s); | 108 | return PTR_ERR(clk_i2s); |
@@ -162,13 +163,11 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
162 | struct snd_pcm_hw_params *params, | 163 | struct snd_pcm_hw_params *params, |
163 | struct snd_soc_dai *dai) | 164 | struct snd_soc_dai *dai) |
164 | { | 165 | { |
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; | 166 | struct pxa2xx_pcm_dma_params *dma_data; |
168 | 167 | ||
169 | BUG_ON(IS_ERR(clk_i2s)); | 168 | BUG_ON(IS_ERR(clk_i2s)); |
170 | clk_enable(clk_i2s); | 169 | clk_enable(clk_i2s); |
171 | dai->private_data = dai; | 170 | clk_ena = 1; |
172 | pxa_i2s_wait(); | 171 | pxa_i2s_wait(); |
173 | 172 | ||
174 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 173 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -176,7 +175,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
176 | else | 175 | else |
177 | dma_data = &pxa2xx_i2s_pcm_stereo_in; | 176 | dma_data = &pxa2xx_i2s_pcm_stereo_in; |
178 | 177 | ||
179 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | 178 | snd_soc_dai_set_dma_data(dai, substream, dma_data); |
180 | 179 | ||
181 | /* is port used by another stream */ | 180 | /* is port used by another stream */ |
182 | if (!(SACR0 & SACR0_ENB)) { | 181 | if (!(SACR0 & SACR0_ENB)) { |
@@ -259,9 +258,9 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream, | |||
259 | if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) { | 258 | if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) { |
260 | SACR0 &= ~SACR0_ENB; | 259 | SACR0 &= ~SACR0_ENB; |
261 | pxa_i2s_wait(); | 260 | pxa_i2s_wait(); |
262 | if (dai->private_data != NULL) { | 261 | if (clk_ena) { |
263 | clk_disable(clk_i2s); | 262 | clk_disable(clk_i2s); |
264 | dai->private_data = NULL; | 263 | clk_ena = 0; |
265 | } | 264 | } |
266 | } | 265 | } |
267 | } | 266 | } |
@@ -300,6 +299,35 @@ static int pxa2xx_i2s_resume(struct snd_soc_dai *dai) | |||
300 | #define pxa2xx_i2s_resume NULL | 299 | #define pxa2xx_i2s_resume NULL |
301 | #endif | 300 | #endif |
302 | 301 | ||
302 | static int pxa2xx_i2s_probe(struct snd_soc_dai *dai) | ||
303 | { | ||
304 | clk_i2s = clk_get(dai->dev, "I2SCLK"); | ||
305 | if (IS_ERR(clk_i2s)) | ||
306 | return PTR_ERR(clk_i2s); | ||
307 | |||
308 | /* | ||
309 | * PXA Developer's Manual: | ||
310 | * If SACR0[ENB] is toggled in the middle of a normal operation, | ||
311 | * the SACR0[RST] bit must also be set and cleared to reset all | ||
312 | * I2S controller registers. | ||
313 | */ | ||
314 | SACR0 = SACR0_RST; | ||
315 | SACR0 = 0; | ||
316 | /* Make sure RPL and REC are disabled */ | ||
317 | SACR1 = SACR1_DRPL | SACR1_DREC; | ||
318 | /* Along with FIFO servicing */ | ||
319 | SAIMR &= ~(SAIMR_RFS | SAIMR_TFS); | ||
320 | |||
321 | return 0; | ||
322 | } | ||
323 | |||
324 | static int pxa2xx_i2s_remove(struct snd_soc_dai *dai) | ||
325 | { | ||
326 | clk_put(clk_i2s); | ||
327 | clk_i2s = ERR_PTR(-ENOENT); | ||
328 | return 0; | ||
329 | } | ||
330 | |||
303 | #define PXA2XX_I2S_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ | 331 | #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 | \ | 332 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ |
305 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) | 333 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) |
@@ -313,9 +341,9 @@ static struct snd_soc_dai_ops pxa_i2s_dai_ops = { | |||
313 | .set_sysclk = pxa2xx_i2s_set_dai_sysclk, | 341 | .set_sysclk = pxa2xx_i2s_set_dai_sysclk, |
314 | }; | 342 | }; |
315 | 343 | ||
316 | struct snd_soc_dai pxa_i2s_dai = { | 344 | static struct snd_soc_dai_driver pxa_i2s_dai = { |
317 | .name = "pxa2xx-i2s", | 345 | .probe = pxa2xx_i2s_probe, |
318 | .id = 0, | 346 | .remove = pxa2xx_i2s_remove, |
319 | .suspend = pxa2xx_i2s_suspend, | 347 | .suspend = pxa2xx_i2s_suspend, |
320 | .resume = pxa2xx_i2s_resume, | 348 | .resume = pxa2xx_i2s_resume, |
321 | .playback = { | 349 | .playback = { |
@@ -332,49 +360,20 @@ struct snd_soc_dai pxa_i2s_dai = { | |||
332 | .symmetric_rates = 1, | 360 | .symmetric_rates = 1, |
333 | }; | 361 | }; |
334 | 362 | ||
335 | EXPORT_SYMBOL_GPL(pxa_i2s_dai); | 363 | static int pxa2xx_i2s_drv_probe(struct platform_device *pdev) |
336 | |||
337 | static int pxa2xx_i2s_probe(struct platform_device *dev) | ||
338 | { | 364 | { |
339 | int ret; | 365 | 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 | } | 366 | } |
366 | 367 | ||
367 | static int __devexit pxa2xx_i2s_remove(struct platform_device *dev) | 368 | static int __devexit pxa2xx_i2s_drv_remove(struct platform_device *pdev) |
368 | { | 369 | { |
369 | snd_soc_unregister_dai(&pxa_i2s_dai); | 370 | snd_soc_unregister_dai(&pdev->dev); |
370 | clk_put(clk_i2s); | ||
371 | clk_i2s = ERR_PTR(-ENOENT); | ||
372 | return 0; | 371 | return 0; |
373 | } | 372 | } |
374 | 373 | ||
375 | static struct platform_driver pxa2xx_i2s_driver = { | 374 | static struct platform_driver pxa2xx_i2s_driver = { |
376 | .probe = pxa2xx_i2s_probe, | 375 | .probe = pxa2xx_i2s_drv_probe, |
377 | .remove = __devexit_p(pxa2xx_i2s_remove), | 376 | .remove = __devexit_p(pxa2xx_i2s_drv_remove), |
378 | 377 | ||
379 | .driver = { | 378 | .driver = { |
380 | .name = "pxa2xx-i2s", | 379 | .name = "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..5127044acfec 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c | |||
@@ -28,7 +28,7 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
28 | struct pxa2xx_pcm_dma_params *dma; | 28 | struct pxa2xx_pcm_dma_params *dma; |
29 | int ret; | 29 | int ret; |
30 | 30 | ||
31 | dma = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 31 | dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
32 | 32 | ||
33 | /* return if this is a bufferless transfer e.g. | 33 | /* return if this is a bufferless transfer e.g. |
34 | * codec <--> BT codec or GSM modem -- lg FIXME */ | 34 | * codec <--> BT codec or GSM modem -- lg FIXME */ |
@@ -95,14 +95,14 @@ static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
95 | if (!card->dev->coherent_dma_mask) | 95 | if (!card->dev->coherent_dma_mask) |
96 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 96 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
97 | 97 | ||
98 | if (dai->playback.channels_min) { | 98 | if (dai->driver->playback.channels_min) { |
99 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, | 99 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, |
100 | SNDRV_PCM_STREAM_PLAYBACK); | 100 | SNDRV_PCM_STREAM_PLAYBACK); |
101 | if (ret) | 101 | if (ret) |
102 | goto out; | 102 | goto out; |
103 | } | 103 | } |
104 | 104 | ||
105 | if (dai->capture.channels_min) { | 105 | if (dai->driver->capture.channels_min) { |
106 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, | 106 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, |
107 | SNDRV_PCM_STREAM_CAPTURE); | 107 | SNDRV_PCM_STREAM_CAPTURE); |
108 | if (ret) | 108 | if (ret) |
@@ -112,25 +112,44 @@ static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
112 | return ret; | 112 | return ret; |
113 | } | 113 | } |
114 | 114 | ||
115 | struct snd_soc_platform pxa2xx_soc_platform = { | 115 | static struct snd_soc_platform_driver pxa2xx_soc_platform = { |
116 | .name = "pxa2xx-audio", | 116 | .ops = &pxa2xx_pcm_ops, |
117 | .pcm_ops = &pxa2xx_pcm_ops, | ||
118 | .pcm_new = pxa2xx_soc_pcm_new, | 117 | .pcm_new = pxa2xx_soc_pcm_new, |
119 | .pcm_free = pxa2xx_pcm_free_dma_buffers, | 118 | .pcm_free = pxa2xx_pcm_free_dma_buffers, |
120 | }; | 119 | }; |
121 | EXPORT_SYMBOL_GPL(pxa2xx_soc_platform); | ||
122 | 120 | ||
123 | static int __init pxa2xx_soc_platform_init(void) | 121 | static int __devinit pxa2xx_soc_platform_probe(struct platform_device *pdev) |
124 | { | 122 | { |
125 | return snd_soc_register_platform(&pxa2xx_soc_platform); | 123 | return snd_soc_register_platform(&pdev->dev, &pxa2xx_soc_platform); |
126 | } | 124 | } |
127 | module_init(pxa2xx_soc_platform_init); | ||
128 | 125 | ||
129 | static void __exit pxa2xx_soc_platform_exit(void) | 126 | static int __devexit pxa2xx_soc_platform_remove(struct platform_device *pdev) |
130 | { | 127 | { |
131 | snd_soc_unregister_platform(&pxa2xx_soc_platform); | 128 | snd_soc_unregister_platform(&pdev->dev); |
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static struct platform_driver pxa_pcm_driver = { | ||
133 | .driver = { | ||
134 | .name = "pxa-pcm-audio", | ||
135 | .owner = THIS_MODULE, | ||
136 | }, | ||
137 | |||
138 | .probe = pxa2xx_soc_platform_probe, | ||
139 | .remove = __devexit_p(pxa2xx_soc_platform_remove), | ||
140 | }; | ||
141 | |||
142 | static int __init snd_pxa_pcm_init(void) | ||
143 | { | ||
144 | return platform_driver_register(&pxa_pcm_driver); | ||
145 | } | ||
146 | module_init(snd_pxa_pcm_init); | ||
147 | |||
148 | static void __exit snd_pxa_pcm_exit(void) | ||
149 | { | ||
150 | platform_driver_unregister(&pxa_pcm_driver); | ||
132 | } | 151 | } |
133 | module_exit(pxa2xx_soc_platform_exit); | 152 | module_exit(snd_pxa_pcm_exit); |
134 | 153 | ||
135 | MODULE_AUTHOR("Nicolas Pitre"); | 154 | MODULE_AUTHOR("Nicolas Pitre"); |
136 | MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); | 155 | 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/spitz.c b/sound/soc/pxa/spitz.c index 1941a357e8c4..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,49 +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 | /* | ||
332 | * FIXME: This is a temporary bodge to avoid cross-tree merge issues. | ||
333 | * New drivers should register the wm8750 I2C device in the machine | ||
334 | * setup code (under arch/arm for ARM systems). | ||
335 | */ | ||
336 | static int wm8750_i2c_register(void) | ||
337 | { | ||
338 | struct i2c_board_info info; | ||
339 | struct i2c_adapter *adapter; | ||
340 | struct i2c_client *client; | ||
341 | |||
342 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
343 | info.addr = 0x1b; | ||
344 | strlcpy(info.type, "wm8750", I2C_NAME_SIZE); | ||
345 | |||
346 | adapter = i2c_get_adapter(0); | ||
347 | if (!adapter) { | ||
348 | printk(KERN_ERR "can't get i2c adapter 0\n"); | ||
349 | return -ENODEV; | ||
350 | } | ||
351 | |||
352 | client = i2c_new_device(adapter, &info); | ||
353 | i2c_put_adapter(adapter); | ||
354 | if (!client) { | ||
355 | printk(KERN_ERR "can't add i2c device at 0x%x\n", | ||
356 | (unsigned int)info.addr); | ||
357 | return -ENODEV; | ||
358 | } | ||
359 | |||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static struct platform_device *spitz_snd_device; | 326 | static struct platform_device *spitz_snd_device; |
364 | 327 | ||
365 | static int __init spitz_init(void) | 328 | static int __init spitz_init(void) |
@@ -369,16 +332,11 @@ static int __init spitz_init(void) | |||
369 | if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) | 332 | if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) |
370 | return -ENODEV; | 333 | return -ENODEV; |
371 | 334 | ||
372 | ret = wm8750_i2c_setup(); | ||
373 | if (ret != 0) | ||
374 | return ret; | ||
375 | |||
376 | spitz_snd_device = platform_device_alloc("soc-audio", -1); | 335 | spitz_snd_device = platform_device_alloc("soc-audio", -1); |
377 | if (!spitz_snd_device) | 336 | if (!spitz_snd_device) |
378 | return -ENOMEM; | 337 | return -ENOMEM; |
379 | 338 | ||
380 | platform_set_drvdata(spitz_snd_device, &spitz_snd_devdata); | 339 | platform_set_drvdata(spitz_snd_device, &snd_soc_spitz); |
381 | spitz_snd_devdata.dev = &spitz_snd_device->dev; | ||
382 | ret = platform_device_add(spitz_snd_device); | 340 | ret = platform_device_add(spitz_snd_device); |
383 | 341 | ||
384 | if (ret) | 342 | if (ret) |
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..704f74b56ab6 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 = "pxa-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) |