diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-11-25 01:35:21 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-11-25 10:37:37 -0500 |
commit | 5c0d7bb797a975691ca8bbc38e53da03c6e151bb (patch) | |
tree | 56165fd73ee41b8353670d49bd53ae24bf854931 /sound/soc/pxa/tosa.c | |
parent | 4451582f7e9fc2860b289aca60a6065286439bb8 (diff) |
ASoC: tosa: move gpio probing to machine callbacks
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/pxa/tosa.c')
-rw-r--r-- | sound/soc/pxa/tosa.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 9d9be5a14d14..48242b32a28b 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
@@ -230,10 +230,32 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
230 | }, | 230 | }, |
231 | }; | 231 | }; |
232 | 232 | ||
233 | static int tosa_probe(struct platform_device *dev) | ||
234 | { | ||
235 | int ret; | ||
236 | |||
237 | ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack"); | ||
238 | if (ret) | ||
239 | return ret; | ||
240 | ret = gpio_direction_output(TOSA_GPIO_L_MUTE, 0); | ||
241 | if (ret) | ||
242 | gpio_free(TOSA_GPIO_L_MUTE); | ||
243 | |||
244 | return ret; | ||
245 | } | ||
246 | |||
247 | static int tosa_remove(struct platform_device *dev) | ||
248 | { | ||
249 | gpio_free(TOSA_GPIO_L_MUTE); | ||
250 | return 0; | ||
251 | } | ||
252 | |||
233 | static struct snd_soc_card tosa = { | 253 | static struct snd_soc_card tosa = { |
234 | .name = "Tosa", | 254 | .name = "Tosa", |
235 | .dai_link = tosa_dai, | 255 | .dai_link = tosa_dai, |
236 | .num_links = ARRAY_SIZE(tosa_dai), | 256 | .num_links = ARRAY_SIZE(tosa_dai), |
257 | .probe = tosa_probe, | ||
258 | .remove = tosa_remove, | ||
237 | }; | 259 | }; |
238 | 260 | ||
239 | static struct snd_soc_device tosa_snd_devdata = { | 261 | static struct snd_soc_device tosa_snd_devdata = { |
@@ -251,11 +273,6 @@ static int __init tosa_init(void) | |||
251 | if (!machine_is_tosa()) | 273 | if (!machine_is_tosa()) |
252 | return -ENODEV; | 274 | return -ENODEV; |
253 | 275 | ||
254 | ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack"); | ||
255 | if (ret) | ||
256 | return ret; | ||
257 | gpio_direction_output(TOSA_GPIO_L_MUTE, 0); | ||
258 | |||
259 | tosa_snd_device = platform_device_alloc("soc-audio", -1); | 276 | tosa_snd_device = platform_device_alloc("soc-audio", -1); |
260 | if (!tosa_snd_device) { | 277 | if (!tosa_snd_device) { |
261 | ret = -ENOMEM; | 278 | ret = -ENOMEM; |
@@ -272,15 +289,12 @@ static int __init tosa_init(void) | |||
272 | platform_device_put(tosa_snd_device); | 289 | platform_device_put(tosa_snd_device); |
273 | 290 | ||
274 | err_alloc: | 291 | err_alloc: |
275 | gpio_free(TOSA_GPIO_L_MUTE); | ||
276 | |||
277 | return ret; | 292 | return ret; |
278 | } | 293 | } |
279 | 294 | ||
280 | static void __exit tosa_exit(void) | 295 | static void __exit tosa_exit(void) |
281 | { | 296 | { |
282 | platform_device_unregister(tosa_snd_device); | 297 | platform_device_unregister(tosa_snd_device); |
283 | gpio_free(TOSA_GPIO_L_MUTE); | ||
284 | } | 298 | } |
285 | 299 | ||
286 | module_init(tosa_init); | 300 | module_init(tosa_init); |