diff options
Diffstat (limited to 'sound/soc/pxa/pxa2xx-ac97.c')
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index f1059d999de6..ae956e3f4b9d 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -89,33 +89,6 @@ static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_mic_mono_in = { | |||
89 | .filter_data = &pxa2xx_ac97_pcm_aux_mic_mono_req, | 89 | .filter_data = &pxa2xx_ac97_pcm_aux_mic_mono_req, |
90 | }; | 90 | }; |
91 | 91 | ||
92 | #ifdef CONFIG_PM | ||
93 | static int pxa2xx_ac97_suspend(struct snd_soc_dai *dai) | ||
94 | { | ||
95 | return pxa2xx_ac97_hw_suspend(); | ||
96 | } | ||
97 | |||
98 | static int pxa2xx_ac97_resume(struct snd_soc_dai *dai) | ||
99 | { | ||
100 | return pxa2xx_ac97_hw_resume(); | ||
101 | } | ||
102 | |||
103 | #else | ||
104 | #define pxa2xx_ac97_suspend NULL | ||
105 | #define pxa2xx_ac97_resume NULL | ||
106 | #endif | ||
107 | |||
108 | static int pxa2xx_ac97_probe(struct snd_soc_dai *dai) | ||
109 | { | ||
110 | return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev)); | ||
111 | } | ||
112 | |||
113 | static int pxa2xx_ac97_remove(struct snd_soc_dai *dai) | ||
114 | { | ||
115 | pxa2xx_ac97_hw_remove(to_platform_device(dai->dev)); | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | 92 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, |
120 | struct snd_pcm_hw_params *params, | 93 | struct snd_pcm_hw_params *params, |
121 | struct snd_soc_dai *cpu_dai) | 94 | struct snd_soc_dai *cpu_dai) |
@@ -185,10 +158,6 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = { | |||
185 | { | 158 | { |
186 | .name = "pxa2xx-ac97", | 159 | .name = "pxa2xx-ac97", |
187 | .ac97_control = 1, | 160 | .ac97_control = 1, |
188 | .probe = pxa2xx_ac97_probe, | ||
189 | .remove = pxa2xx_ac97_remove, | ||
190 | .suspend = pxa2xx_ac97_suspend, | ||
191 | .resume = pxa2xx_ac97_resume, | ||
192 | .playback = { | 161 | .playback = { |
193 | .stream_name = "AC97 Playback", | 162 | .stream_name = "AC97 Playback", |
194 | .channels_min = 2, | 163 | .channels_min = 2, |
@@ -246,6 +215,12 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) | |||
246 | return -ENXIO; | 215 | return -ENXIO; |
247 | } | 216 | } |
248 | 217 | ||
218 | ret = pxa2xx_ac97_hw_probe(pdev); | ||
219 | if (ret) { | ||
220 | dev_err(&pdev->dev, "PXA2xx AC97 hw probe error (%d)\n", ret); | ||
221 | return ret; | ||
222 | } | ||
223 | |||
249 | ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops); | 224 | ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops); |
250 | if (ret != 0) | 225 | if (ret != 0) |
251 | return ret; | 226 | return ret; |
@@ -262,15 +237,34 @@ static int pxa2xx_ac97_dev_remove(struct platform_device *pdev) | |||
262 | { | 237 | { |
263 | snd_soc_unregister_component(&pdev->dev); | 238 | snd_soc_unregister_component(&pdev->dev); |
264 | snd_soc_set_ac97_ops(NULL); | 239 | snd_soc_set_ac97_ops(NULL); |
240 | pxa2xx_ac97_hw_remove(pdev); | ||
265 | return 0; | 241 | return 0; |
266 | } | 242 | } |
267 | 243 | ||
244 | #ifdef CONFIG_PM_SLEEP | ||
245 | static int pxa2xx_ac97_dev_suspend(struct device *dev) | ||
246 | { | ||
247 | return pxa2xx_ac97_hw_suspend(); | ||
248 | } | ||
249 | |||
250 | static int pxa2xx_ac97_dev_resume(struct device *dev) | ||
251 | { | ||
252 | return pxa2xx_ac97_hw_resume(); | ||
253 | } | ||
254 | |||
255 | static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, | ||
256 | pxa2xx_ac97_dev_suspend, pxa2xx_ac97_dev_resume); | ||
257 | #endif | ||
258 | |||
268 | static struct platform_driver pxa2xx_ac97_driver = { | 259 | static struct platform_driver pxa2xx_ac97_driver = { |
269 | .probe = pxa2xx_ac97_dev_probe, | 260 | .probe = pxa2xx_ac97_dev_probe, |
270 | .remove = pxa2xx_ac97_dev_remove, | 261 | .remove = pxa2xx_ac97_dev_remove, |
271 | .driver = { | 262 | .driver = { |
272 | .name = "pxa2xx-ac97", | 263 | .name = "pxa2xx-ac97", |
273 | .owner = THIS_MODULE, | 264 | .owner = THIS_MODULE, |
265 | #ifdef CONFIG_PM_SLEEP | ||
266 | .pm = &pxa2xx_ac97_pm_ops, | ||
267 | #endif | ||
274 | }, | 268 | }, |
275 | }; | 269 | }; |
276 | 270 | ||