diff options
-rw-r--r-- | arch/arm/mach-pxa/include/mach/palmasoc.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmld.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmt5.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmtx.c | 23 | ||||
-rw-r--r-- | sound/soc/pxa/palm27x.c | 27 |
5 files changed, 76 insertions, 17 deletions
diff --git a/arch/arm/mach-pxa/include/mach/palmasoc.h b/arch/arm/mach-pxa/include/mach/palmasoc.h index 6c4b1f7de20a..58afb30d5298 100644 --- a/arch/arm/mach-pxa/include/mach/palmasoc.h +++ b/arch/arm/mach-pxa/include/mach/palmasoc.h | |||
@@ -1,13 +1,8 @@ | |||
1 | #ifndef _INCLUDE_PALMASOC_H_ | 1 | #ifndef _INCLUDE_PALMASOC_H_ |
2 | #define _INCLUDE_PALMASOC_H_ | 2 | #define _INCLUDE_PALMASOC_H_ |
3 | |||
3 | struct palm27x_asoc_info { | 4 | struct palm27x_asoc_info { |
4 | int jack_gpio; | 5 | int jack_gpio; |
5 | }; | 6 | }; |
6 | 7 | ||
7 | #ifdef CONFIG_SND_PXA2XX_SOC_PALM27X | ||
8 | void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data); | ||
9 | #else | ||
10 | static inline void palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) {} | ||
11 | #endif | ||
12 | |||
13 | #endif | 8 | #endif |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index ecf5910e39d7..1cec1806f002 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -477,10 +477,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { | |||
477 | /****************************************************************************** | 477 | /****************************************************************************** |
478 | * aSoC audio | 478 | * aSoC audio |
479 | ******************************************************************************/ | 479 | ******************************************************************************/ |
480 | static struct palm27x_asoc_info palm27x_asoc_pdata = { | 480 | static struct palm27x_asoc_info palmld_asoc_pdata = { |
481 | .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT, | 481 | .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT, |
482 | }; | 482 | }; |
483 | 483 | ||
484 | static pxa2xx_audio_ops_t palmld_ac97_pdata = { | ||
485 | .reset_gpio = 95, | ||
486 | }; | ||
487 | |||
488 | static struct platform_device palmld_asoc = { | ||
489 | .name = "palm27x-asoc", | ||
490 | .id = -1, | ||
491 | .dev = { | ||
492 | .platform_data = &palmld_asoc_pdata, | ||
493 | }, | ||
494 | }; | ||
495 | |||
484 | /****************************************************************************** | 496 | /****************************************************************************** |
485 | * Framebuffer | 497 | * Framebuffer |
486 | ******************************************************************************/ | 498 | ******************************************************************************/ |
@@ -544,6 +556,7 @@ static struct platform_device *devices[] __initdata = { | |||
544 | &palmld_backlight, | 556 | &palmld_backlight, |
545 | &palmld_leds, | 557 | &palmld_leds, |
546 | &power_supply, | 558 | &power_supply, |
559 | &palmld_asoc, | ||
547 | }; | 560 | }; |
548 | 561 | ||
549 | static struct map_desc palmld_io_desc[] __initdata = { | 562 | static struct map_desc palmld_io_desc[] __initdata = { |
@@ -573,11 +586,10 @@ static void __init palmld_init(void) | |||
573 | 586 | ||
574 | set_pxa_fb_info(&palmld_lcd_screen); | 587 | set_pxa_fb_info(&palmld_lcd_screen); |
575 | pxa_set_mci_info(&palmld_mci_platform_data); | 588 | pxa_set_mci_info(&palmld_mci_platform_data); |
576 | pxa_set_ac97_info(NULL); | 589 | pxa_set_ac97_info(&palmld_ac97_pdata); |
577 | pxa_set_ficp_info(&palmld_ficp_platform_data); | 590 | pxa_set_ficp_info(&palmld_ficp_platform_data); |
578 | pxa_set_keypad_info(&palmld_keypad_platform_data); | 591 | pxa_set_keypad_info(&palmld_keypad_platform_data); |
579 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 592 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
580 | palm27x_asoc_set_pdata(&palm27x_asoc_pdata); | ||
581 | 593 | ||
582 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 594 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
583 | } | 595 | } |
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index d7f81068c613..30662363907b 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -420,10 +420,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { | |||
420 | /****************************************************************************** | 420 | /****************************************************************************** |
421 | * aSoC audio | 421 | * aSoC audio |
422 | ******************************************************************************/ | 422 | ******************************************************************************/ |
423 | static struct palm27x_asoc_info palm27x_asoc_pdata = { | 423 | static struct palm27x_asoc_info palmt5_asoc_pdata = { |
424 | .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, | 424 | .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, |
425 | }; | 425 | }; |
426 | 426 | ||
427 | static pxa2xx_audio_ops_t palmt5_ac97_pdata = { | ||
428 | .reset_gpio = 95, | ||
429 | }; | ||
430 | |||
431 | static struct platform_device palmt5_asoc = { | ||
432 | .name = "palm27x-asoc", | ||
433 | .id = -1, | ||
434 | .dev = { | ||
435 | .platform_data = &palmt5_asoc_pdata, | ||
436 | }, | ||
437 | }; | ||
438 | |||
427 | /****************************************************************************** | 439 | /****************************************************************************** |
428 | * Framebuffer | 440 | * Framebuffer |
429 | ******************************************************************************/ | 441 | ******************************************************************************/ |
@@ -486,6 +498,7 @@ static struct platform_device *devices[] __initdata = { | |||
486 | #endif | 498 | #endif |
487 | &palmt5_backlight, | 499 | &palmt5_backlight, |
488 | &power_supply, | 500 | &power_supply, |
501 | &palmt5_asoc, | ||
489 | }; | 502 | }; |
490 | 503 | ||
491 | /* setup udc GPIOs initial state */ | 504 | /* setup udc GPIOs initial state */ |
@@ -504,12 +517,11 @@ static void __init palmt5_init(void) | |||
504 | set_pxa_fb_info(&palmt5_lcd_screen); | 517 | set_pxa_fb_info(&palmt5_lcd_screen); |
505 | pxa_set_mci_info(&palmt5_mci_platform_data); | 518 | pxa_set_mci_info(&palmt5_mci_platform_data); |
506 | palmt5_udc_init(); | 519 | palmt5_udc_init(); |
520 | pxa_set_ac97_info(&palmt5_ac97_pdata); | ||
507 | pxa_set_udc_info(&palmt5_udc_info); | 521 | pxa_set_udc_info(&palmt5_udc_info); |
508 | pxa_set_ac97_info(NULL); | ||
509 | pxa_set_ficp_info(&palmt5_ficp_platform_data); | 522 | pxa_set_ficp_info(&palmt5_ficp_platform_data); |
510 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | 523 | pxa_set_keypad_info(&palmt5_keypad_platform_data); |
511 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 524 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
512 | palm27x_asoc_set_pdata(&palm27x_asoc_pdata); | ||
513 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 525 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
514 | } | 526 | } |
515 | 527 | ||
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index 14393d0ad8b8..e2d44b1a8a9b 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <mach/irda.h> | 40 | #include <mach/irda.h> |
41 | #include <mach/pxa27x_keypad.h> | 41 | #include <mach/pxa27x_keypad.h> |
42 | #include <mach/udc.h> | 42 | #include <mach/udc.h> |
43 | #include <mach/palmasoc.h> | ||
43 | 44 | ||
44 | #include "generic.h" | 45 | #include "generic.h" |
45 | #include "devices.h" | 46 | #include "devices.h" |
@@ -434,6 +435,25 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { | |||
434 | }; | 435 | }; |
435 | 436 | ||
436 | /****************************************************************************** | 437 | /****************************************************************************** |
438 | * aSoC audio | ||
439 | ******************************************************************************/ | ||
440 | static struct palm27x_asoc_info palmtx_asoc_pdata = { | ||
441 | .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT, | ||
442 | }; | ||
443 | |||
444 | static pxa2xx_audio_ops_t palmtx_ac97_pdata = { | ||
445 | .reset_gpio = 95, | ||
446 | }; | ||
447 | |||
448 | static struct platform_device palmtx_asoc = { | ||
449 | .name = "palm27x-asoc", | ||
450 | .id = -1, | ||
451 | .dev = { | ||
452 | .platform_data = &palmtx_asoc_pdata, | ||
453 | }, | ||
454 | }; | ||
455 | |||
456 | /****************************************************************************** | ||
437 | * Framebuffer | 457 | * Framebuffer |
438 | ******************************************************************************/ | 458 | ******************************************************************************/ |
439 | static struct pxafb_mode_info palmtx_lcd_modes[] = { | 459 | static struct pxafb_mode_info palmtx_lcd_modes[] = { |
@@ -495,6 +515,7 @@ static struct platform_device *devices[] __initdata = { | |||
495 | #endif | 515 | #endif |
496 | &palmtx_backlight, | 516 | &palmtx_backlight, |
497 | &power_supply, | 517 | &power_supply, |
518 | &palmtx_asoc, | ||
498 | }; | 519 | }; |
499 | 520 | ||
500 | static struct map_desc palmtx_io_desc[] __initdata = { | 521 | static struct map_desc palmtx_io_desc[] __initdata = { |
@@ -529,8 +550,8 @@ static void __init palmtx_init(void) | |||
529 | set_pxa_fb_info(&palmtx_lcd_screen); | 550 | set_pxa_fb_info(&palmtx_lcd_screen); |
530 | pxa_set_mci_info(&palmtx_mci_platform_data); | 551 | pxa_set_mci_info(&palmtx_mci_platform_data); |
531 | palmtx_udc_init(); | 552 | palmtx_udc_init(); |
553 | pxa_set_ac97_info(&palmtx_ac97_pdata); | ||
532 | pxa_set_udc_info(&palmtx_udc_info); | 554 | pxa_set_udc_info(&palmtx_udc_info); |
533 | pxa_set_ac97_info(NULL); | ||
534 | pxa_set_ficp_info(&palmtx_ficp_platform_data); | 555 | pxa_set_ficp_info(&palmtx_ficp_platform_data); |
535 | pxa_set_keypad_info(&palmtx_keypad_platform_data); | 556 | pxa_set_keypad_info(&palmtx_keypad_platform_data); |
536 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 557 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 48a73f64500b..44fcc4e01e08 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c | |||
@@ -200,7 +200,7 @@ static struct snd_soc_device palm27x_snd_devdata = { | |||
200 | 200 | ||
201 | static struct platform_device *palm27x_snd_device; | 201 | static struct platform_device *palm27x_snd_device; |
202 | 202 | ||
203 | static int __init palm27x_asoc_init(void) | 203 | static int palm27x_asoc_probe(struct platform_device *pdev) |
204 | { | 204 | { |
205 | int ret; | 205 | int ret; |
206 | 206 | ||
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void) | |||
208 | machine_is_palmld())) | 208 | machine_is_palmld())) |
209 | return -ENODEV; | 209 | return -ENODEV; |
210 | 210 | ||
211 | if (pdev->dev.platform_data) | ||
212 | palm27x_ep_gpio = ((struct palm27x_asoc_info *) | ||
213 | (pdev->dev.platform_data))->jack_gpio; | ||
214 | |||
211 | ret = gpio_request(palm27x_ep_gpio, "Headphone Jack"); | 215 | ret = gpio_request(palm27x_ep_gpio, "Headphone Jack"); |
212 | if (ret) | 216 | if (ret) |
213 | return ret; | 217 | return ret; |
@@ -245,16 +249,31 @@ err_alloc: | |||
245 | return ret; | 249 | return ret; |
246 | } | 250 | } |
247 | 251 | ||
248 | static void __exit palm27x_asoc_exit(void) | 252 | static int __devexit palm27x_asoc_remove(struct platform_device *pdev) |
249 | { | 253 | { |
250 | free_irq(gpio_to_irq(palm27x_ep_gpio), NULL); | 254 | free_irq(gpio_to_irq(palm27x_ep_gpio), NULL); |
251 | gpio_free(palm27x_ep_gpio); | 255 | gpio_free(palm27x_ep_gpio); |
252 | platform_device_unregister(palm27x_snd_device); | 256 | platform_device_unregister(palm27x_snd_device); |
257 | return 0; | ||
253 | } | 258 | } |
254 | 259 | ||
255 | void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) | 260 | static struct platform_driver palm27x_wm9712_driver = { |
261 | .probe = palm27x_asoc_probe, | ||
262 | .remove = __devexit_p(palm27x_asoc_remove), | ||
263 | .driver = { | ||
264 | .name = "palm27x-asoc", | ||
265 | .owner = THIS_MODULE, | ||
266 | }, | ||
267 | }; | ||
268 | |||
269 | static int __init palm27x_asoc_init(void) | ||
270 | { | ||
271 | return platform_driver_register(&palm27x_wm9712_driver); | ||
272 | } | ||
273 | |||
274 | static void __exit palm27x_asoc_exit(void) | ||
256 | { | 275 | { |
257 | palm27x_ep_gpio = data->jack_gpio; | 276 | platform_driver_unregister(&palm27x_wm9712_driver); |
258 | } | 277 | } |
259 | 278 | ||
260 | module_init(palm27x_asoc_init); | 279 | module_init(palm27x_asoc_init); |