Skip to content

Commit

Permalink
[ARM] pxa/palm27x: General fix for Palm27x aSoC driver
Browse files Browse the repository at this point in the history
Firstly, this patch makes the palm27x asoc driver a little more sane. Also,
since all affected devices use GPIO95 as AC97_nRESET, this patch sets that
properly. Affected are PalmT5, TX and LifeDrive.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
  • Loading branch information
Marek Vasut authored and Eric Miao committed Apr 19, 2009
1 parent cc8d273 commit e91fb91
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 17 deletions.
7 changes: 1 addition & 6 deletions arch/arm/mach-pxa/include/mach/palmasoc.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef _INCLUDE_PALMASOC_H_
#define _INCLUDE_PALMASOC_H_

struct palm27x_asoc_info {
int jack_gpio;
};

#ifdef CONFIG_SND_PXA2XX_SOC_PALM27X
void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data);
#else
static inline void palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) {}
#endif

#endif
18 changes: 15 additions & 3 deletions arch/arm/mach-pxa/palmld.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = {
/******************************************************************************
* aSoC audio
******************************************************************************/
static struct palm27x_asoc_info palm27x_asoc_pdata = {
static struct palm27x_asoc_info palmld_asoc_pdata = {
.jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT,
};

static pxa2xx_audio_ops_t palmld_ac97_pdata = {
.reset_gpio = 95,
};

static struct platform_device palmld_asoc = {
.name = "palm27x-asoc",
.id = -1,
.dev = {
.platform_data = &palmld_asoc_pdata,
},
};

/******************************************************************************
* Framebuffer
******************************************************************************/
Expand Down Expand Up @@ -544,6 +556,7 @@ static struct platform_device *devices[] __initdata = {
&palmld_backlight,
&palmld_leds,
&power_supply,
&palmld_asoc,
};

static struct map_desc palmld_io_desc[] __initdata = {
Expand Down Expand Up @@ -573,11 +586,10 @@ static void __init palmld_init(void)

set_pxa_fb_info(&palmld_lcd_screen);
pxa_set_mci_info(&palmld_mci_platform_data);
pxa_set_ac97_info(NULL);
pxa_set_ac97_info(&palmld_ac97_pdata);
pxa_set_ficp_info(&palmld_ficp_platform_data);
pxa_set_keypad_info(&palmld_keypad_platform_data);
wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
palm27x_asoc_set_pdata(&palm27x_asoc_pdata);

platform_add_devices(devices, ARRAY_SIZE(devices));
}
Expand Down
18 changes: 15 additions & 3 deletions arch/arm/mach-pxa/palmt5.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = {
/******************************************************************************
* aSoC audio
******************************************************************************/
static struct palm27x_asoc_info palm27x_asoc_pdata = {
static struct palm27x_asoc_info palmt5_asoc_pdata = {
.jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT,
};

static pxa2xx_audio_ops_t palmt5_ac97_pdata = {
.reset_gpio = 95,
};

static struct platform_device palmt5_asoc = {
.name = "palm27x-asoc",
.id = -1,
.dev = {
.platform_data = &palmt5_asoc_pdata,
},
};

/******************************************************************************
* Framebuffer
******************************************************************************/
Expand Down Expand Up @@ -486,6 +498,7 @@ static struct platform_device *devices[] __initdata = {
#endif
&palmt5_backlight,
&power_supply,
&palmt5_asoc,
};

/* setup udc GPIOs initial state */
Expand All @@ -504,12 +517,11 @@ static void __init palmt5_init(void)
set_pxa_fb_info(&palmt5_lcd_screen);
pxa_set_mci_info(&palmt5_mci_platform_data);
palmt5_udc_init();
pxa_set_ac97_info(&palmt5_ac97_pdata);
pxa_set_udc_info(&palmt5_udc_info);
pxa_set_ac97_info(NULL);
pxa_set_ficp_info(&palmt5_ficp_platform_data);
pxa_set_keypad_info(&palmt5_keypad_platform_data);
wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
palm27x_asoc_set_pdata(&palm27x_asoc_pdata);
platform_add_devices(devices, ARRAY_SIZE(devices));
}

Expand Down
23 changes: 22 additions & 1 deletion arch/arm/mach-pxa/palmtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <mach/irda.h>
#include <mach/pxa27x_keypad.h>
#include <mach/udc.h>
#include <mach/palmasoc.h>

#include "generic.h"
#include "devices.h"
Expand Down Expand Up @@ -433,6 +434,25 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = {
.batt_name = "main-batt",
};

/******************************************************************************
* aSoC audio
******************************************************************************/
static struct palm27x_asoc_info palmtx_asoc_pdata = {
.jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT,
};

static pxa2xx_audio_ops_t palmtx_ac97_pdata = {
.reset_gpio = 95,
};

static struct platform_device palmtx_asoc = {
.name = "palm27x-asoc",
.id = -1,
.dev = {
.platform_data = &palmtx_asoc_pdata,
},
};

/******************************************************************************
* Framebuffer
******************************************************************************/
Expand Down Expand Up @@ -495,6 +515,7 @@ static struct platform_device *devices[] __initdata = {
#endif
&palmtx_backlight,
&power_supply,
&palmtx_asoc,
};

static struct map_desc palmtx_io_desc[] __initdata = {
Expand Down Expand Up @@ -529,8 +550,8 @@ static void __init palmtx_init(void)
set_pxa_fb_info(&palmtx_lcd_screen);
pxa_set_mci_info(&palmtx_mci_platform_data);
palmtx_udc_init();
pxa_set_ac97_info(&palmtx_ac97_pdata);
pxa_set_udc_info(&palmtx_udc_info);
pxa_set_ac97_info(NULL);
pxa_set_ficp_info(&palmtx_ficp_platform_data);
pxa_set_keypad_info(&palmtx_keypad_platform_data);
wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
Expand Down
27 changes: 23 additions & 4 deletions sound/soc/pxa/palm27x.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,18 @@ static struct snd_soc_device palm27x_snd_devdata = {

static struct platform_device *palm27x_snd_device;

static int __init palm27x_asoc_init(void)
static int palm27x_asoc_probe(struct platform_device *pdev)
{
int ret;

if (!(machine_is_palmtx() || machine_is_palmt5() ||
machine_is_palmld()))
return -ENODEV;

if (pdev->dev.platform_data)
palm27x_ep_gpio = ((struct palm27x_asoc_info *)
(pdev->dev.platform_data))->jack_gpio;

ret = gpio_request(palm27x_ep_gpio, "Headphone Jack");
if (ret)
return ret;
Expand Down Expand Up @@ -245,16 +249,31 @@ static int __init palm27x_asoc_init(void)
return ret;
}

static void __exit palm27x_asoc_exit(void)
static int __devexit palm27x_asoc_remove(struct platform_device *pdev)
{
free_irq(gpio_to_irq(palm27x_ep_gpio), NULL);
gpio_free(palm27x_ep_gpio);
platform_device_unregister(palm27x_snd_device);
return 0;
}

void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data)
static struct platform_driver palm27x_wm9712_driver = {
.probe = palm27x_asoc_probe,
.remove = __devexit_p(palm27x_asoc_remove),
.driver = {
.name = "palm27x-asoc",
.owner = THIS_MODULE,
},
};

static int __init palm27x_asoc_init(void)
{
return platform_driver_register(&palm27x_wm9712_driver);
}

static void __exit palm27x_asoc_exit(void)
{
palm27x_ep_gpio = data->jack_gpio;
platform_driver_unregister(&palm27x_wm9712_driver);
}

module_init(palm27x_asoc_init);
Expand Down

0 comments on commit e91fb91

Please sign in to comment.