Skip to contentSkip to conversation

General fix for Palm27x aSoC driver

PATCH Applied Marek Vasut 4 participants 20 messages Apr 12, 2009 – Apr 19, 2009

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 General fix for Palm27x aSoC driver

Hi,

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.

Please consider applying, it's against Russells tree. If Eric wants to merge it, I can remake it.

Thanks.

From 0b12db7ca6b45bd3fd74a89c58a754a30dd84960 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Sun, 12 Apr 2009 18:50:01 +0200
Subject: [PATCH] General fix for Palm27x aSoC driver

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.

---
 arch/arm/mach-pxa/include/mach/palmasoc.h |    7 +---
 arch/arm/mach-pxa/palmld.c                |   43 ++++++++++++++++++++++++--
 arch/arm/mach-pxa/palmt5.c                |   43 ++++++++++++++++++++++++--
 arch/arm/mach-pxa/palmtx.c                |   48 ++++++++++++++++++++++++++++-
 sound/soc/pxa/palm27x.c                   |   27 ++++++++++++++--
 5 files changed, 151 insertions(+), 17 deletions(-)
arch/arm/mach-pxa/include/mach/palmasoc.h +1 -6
index 6c4b1f7..58afb30 100644
@@ -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
arch/arm/mach-pxa/palmld.c +40 -3

73 lines not on this page · raw message

arch/arm/mach-pxa/palmt5.c +40 -3

73 lines not on this page · raw message

arch/arm/mach-pxa/palmtx.c +47 -1

72 lines not on this page · raw message

sound/soc/pxa/palm27x.c +23 -4
index 48a73f6..44fcc4e 100644
@@ -200,7 +200,7 @@ 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;
 
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void)
 		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;
@@ -245,16 +249,31 @@ err_alloc:
 	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);
Signature · 1 line
1.6.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 492

Quoted 4 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +4 -0
+static struct platform_device palmld_pxa2xx_pcm = {
+	.name = "pxa2xx-pcm",
+	.id   = -1,
+};

This should follow the pattern that everything else uses with the struct platform_device in devices.c and board files triggering registration of that.

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 500

Quoted 7 lines
arch/arm/mach-pxa/palmld.c +7 -0
+static struct platform_device palmld_pxa2xx_ac97 = {
+	.name = "pxa2xx-ac97",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_ac97_pdata,
+	},
+};

No, use pxa_set_ac97_info().

Quoted 1 line

+static struct platform_device palmld_wm9712_codec = {

No, the WM9712 is not a platform device.

#2 lore raw
Quoted 9 lines · On Sunday 12 of April 2009 19:06:26 Mark Brown wrote:

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 492

Quoted 4 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +4 -0
+static struct platform_device palmld_pxa2xx_pcm = {
+	.name = "pxa2xx-pcm",
+	.id   = -1,
+};

This should follow the pattern that everything else uses with the struct platform_device in devices.c and board files triggering registration of that.

Half of the platforms use static struct, half use struct. Probably someone should send a huge patch to make it consistent. I'd like to have it consistent at least inside the platform file.

Quoted 10 lines

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 500

Quoted 8 lines
arch/arm/mach-pxa/palmld.c +7 -0
+static struct platform_device palmld_pxa2xx_ac97 = {
+	.name = "pxa2xx-ac97",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_ac97_pdata,
+	},
+};

No, use pxa_set_ac97_info().

How?

Quoted 4 lines
Quoted 2 lines

+static struct platform_device palmld_wm9712_codec = {

No, the WM9712 is not a platform device.

#3 lore raw
Quoted 25 lines · On Sunday 12 of April 2009 19:20:15 Marek Vasut wrote:
Quoted 9 lines · On Sunday 12 of April 2009 19:06:26 Mark Brown wrote:

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 492

Quoted 4 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +4 -0
+static struct platform_device palmld_pxa2xx_pcm = {
+	.name = "pxa2xx-pcm",
+	.id   = -1,
+};

This should follow the pattern that everything else uses with the struct platform_device in devices.c and board files triggering registration of that.

Half of the platforms use static struct, half use struct. Probably someone should send a huge patch to make it consistent. I'd like to have it consistent at least inside the platform file.

Quoted 9 lines

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 500

Quoted 7 lines
arch/arm/mach-pxa/palmld.c +7 -0
+static struct platform_device palmld_pxa2xx_ac97 = {
+	.name = "pxa2xx-ac97",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_ac97_pdata,
+	},
+};

No, use pxa_set_ac97_info().

Quoted 5 lines

How?

Quoted 3 lines
Quoted 1 line

+static struct platform_device palmld_wm9712_codec = {

No, the WM9712 is not a platform device.

btw mio_a701 uses it the same way ... why can I ? Why was the mio code merged then?

maintainer
#4 lore raw
Quoted 2 lines · Marek Vasut

btw mio_a701 uses it the same way ... why can I ? Why was the mio code merged then?

The pxa_set_ac97_info() was introduced in 2008, June the 10th.
The original mio code was submitted in early 2008, in March I think. Do you see now why ?

And that code was recently amended by Eric Miao, because it has not evolved with the introduction of pxa_set_ac97_info() as it should had (blame me). The part of code you're talking about is now gone.

Cheers.

--
Robert

#5 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut
Quoted 3 lines · On Sunday 12 of April 2009 19:20:15 Marek Vasut wrote:

On Sunday 12 of April 2009 19:06:26 Mark Brown wrote:j

Quoted 1 line

No, the WM9712 is not a platform device.

btw mio_a701 uses it the same way ... why can I ? Why was the mio code merged then?

mio_a701 is buggy, the device should be removed from there. I didn't review that code so didn't have a chance to notice that the device was there.

#6 lore raw
In reply to Marek Vasut
Quoted 11 lines · Marek Vasut
Quoted 5 lines · On Sunday 12 of April 2009 19:06:26 Mark Brown wrote:
Quoted 1 line

+static struct platform_device palmld_pxa2xx_pcm = {

This should follow the pattern that everything else uses with the struct platform_device in devices.c and board files triggering registration of that.

Half of the platforms use static struct, half use struct. Probably someone should send a huge patch to make it consistent. I'd like to have it consistent at least inside the platform file.

The general rule is that if it's a part of the CPU it should go in devices.c - things that aren't doing that are mostly just waiting for cleanup.

Quoted 11 lines
Quoted 9 lines

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 500

Quoted 7 lines
arch/arm/mach-pxa/palmld.c +7 -0
+static struct platform_device palmld_pxa2xx_ac97 = {
+	.name = "pxa2xx-ac97",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_ac97_pdata,
+	},
+};

No, use pxa_set_ac97_info().

How?

Pass the platform data as the argument. This will currently involve merging the two different platform data structures that we have right now.

#7 lore raw
Quoted 26 lines · On Sunday 12 of April 2009 19:58:00 Mark Brown wrote:
Quoted 10 lines · Marek Vasut
Quoted 5 lines · On Sunday 12 of April 2009 19:06:26 Mark Brown wrote:
Quoted 1 line

+static struct platform_device palmld_pxa2xx_pcm = {

This should follow the pattern that everything else uses with the struct platform_device in devices.c and board files triggering registration of that.

Half of the platforms use static struct, half use struct. Probably someone should send a huge patch to make it consistent. I'd like to have it consistent at least inside the platform file.

The general rule is that if it's a part of the CPU it should go in devices.c - things that aren't doing that are mostly just waiting for cleanup.

Quoted 10 lines
Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+static struct platform_device palmld_pxa2xx_ac97 = {
+	.name = "pxa2xx-ac97",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_ac97_pdata,
+	},
+};

No, use pxa_set_ac97_info().

Quoted 5 lines
Quoted 1 line

How?

Pass the platform data as the argument. This will currently involve merging the two different platform data structures that we have right now.

OK, I see, thanks :-) Will you be happier with this patch then ?

From 664a33dff40b27e53cd4b4532e80efc99f4720f0 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Sun, 12 Apr 2009 20:47:45 +0200
Subject: [PATCH] General fix for Palm27x aSoC driver

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.

---
 arch/arm/mach-pxa/include/mach/palmasoc.h |    7 +------
 arch/arm/mach-pxa/palmld.c                |   20 +++++++++++++++++---
 arch/arm/mach-pxa/palmt5.c                |   20 +++++++++++++++++---
 arch/arm/mach-pxa/palmtx.c                |   25 ++++++++++++++++++++++++-
 sound/soc/pxa/palm27x.c                   |   27 +++++++++++++++++++++++----
 5 files changed, 82 insertions(+), 17 deletions(-)
arch/arm/mach-pxa/include/mach/palmasoc.h +1 -6
index 6c4b1f7..58afb30 100644
@@ -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
arch/arm/mach-pxa/palmld.c +17 -3
index 8587477..3c1b564 100644
@@ -38,6 +38,8 @@
 #include <mach/pxa27x_keypad.h>
 #include <mach/palmasoc.h>
 
+#include <sound/pxa2xx-lib.h>
+
 #include "generic.h"
 #include "devices.h"
 
@@ -476,10 +478,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 struct pxa2xx_ac97_platform_data palmld_ac97_pdata = {
+	.reset_gpio	= 95,
+};
+
+static struct platform_device palmld_asoc = {
+	.name = "palm27x-asoc",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_asoc_pdata,
+	},
+};
+
 /******************************************************************************
  * Framebuffer
  ******************************************************************************/
@@ -516,6 +530,7 @@ static struct platform_device *devices[] __initdata = {
 	&palmld_backlight,
 	&palmld_leds,
 	&power_supply,
+	&palmld_asoc,
 };
 
 static struct map_desc palmld_io_desc[] __initdata = {
@@ -545,11 +560,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));
 }
arch/arm/mach-pxa/palmt5.c +17 -3
index 9f591cf..c732d76 100644
@@ -41,6 +41,8 @@
 #include <mach/udc.h>
 #include <mach/palmasoc.h>
 
+#include <sound/pxa2xx-lib.h>
+
 #include "generic.h"
 #include "devices.h"
 
@@ -420,10 +422,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 struct pxa2xx_ac97_platform_data palmt5_ac97_pdata = {
+	.reset_gpio	= 95,
+};
+
+static struct platform_device palmt5_asoc = {
+	.name = "palm27x-asoc",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmt5_asoc_pdata,
+	},
+};
+
 /******************************************************************************
  * Framebuffer
  ******************************************************************************/
@@ -459,6 +473,7 @@ static struct platform_device *devices[] __initdata = {
 #endif
 	&palmt5_backlight,
 	&power_supply,
+	&palmt5_asoc,
 };
 
 /* setup udc GPIOs initial state */
@@ -477,12 +492,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));
 }
 
arch/arm/mach-pxa/palmtx.c +24 -1
index 540cd69..ca6aa61 100644
@@ -40,6 +40,9 @@
 #include <mach/irda.h>
 #include <mach/pxa27x_keypad.h>
 #include <mach/udc.h>
+#include <mach/palmasoc.h>
+
+#include <sound/pxa2xx-lib.h>
 
 #include "generic.h"
 #include "devices.h"
@@ -434,6 +437,25 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = {
 };
 
 /******************************************************************************
+ * aSoC audio
+ ******************************************************************************/
+static struct palm27x_asoc_info palmtx_asoc_pdata = {
+	.jack_gpio	= GPIO_NR_PALMTX_EARPHONE_DETECT,
+};
+
+static struct pxa2xx_ac97_platform_data palmtx_ac97_pdata = {
+	.reset_gpio	= 95,
+};
+
+static struct platform_device palmtx_asoc = {
+	.name = "palm27x-asoc",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmtx_asoc_pdata,
+	},
+};
+
+/******************************************************************************
  * Framebuffer
  ******************************************************************************/
 static struct pxafb_mode_info palmtx_lcd_modes[] = {
@@ -468,6 +490,7 @@ static struct platform_device *devices[] __initdata = {
 #endif
 	&palmtx_backlight,
 	&power_supply,
+	&palmtx_asoc,
 };
 
 static struct map_desc palmtx_io_desc[] __initdata = {
@@ -502,8 +525,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);
sound/soc/pxa/palm27x.c +23 -4
index 48a73f6..44fcc4e 100644
@@ -200,7 +200,7 @@ 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;
 
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void)
 		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;
@@ -245,16 +249,31 @@ err_alloc:
 	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);
Signature · 1 line
1.6.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#8 lore raw
Quoted 27 lines · On Sunday 12 of April 2009 20:51:19 Marek Vasut wrote:
Quoted 26 lines · On Sunday 12 of April 2009 19:58:00 Mark Brown wrote:
Quoted 10 lines · Marek Vasut
Quoted 5 lines · On Sunday 12 of April 2009 19:06:26 Mark Brown wrote:
Quoted 1 line

+static struct platform_device palmld_pxa2xx_pcm = {

This should follow the pattern that everything else uses with the struct platform_device in devices.c and board files triggering registration of that.

Half of the platforms use static struct, half use struct. Probably someone should send a huge patch to make it consistent. I'd like to have it consistent at least inside the platform file.

The general rule is that if it's a part of the CPU it should go in devices.c - things that aren't doing that are mostly just waiting for cleanup.

Quoted 10 lines
Quoted 9 lines

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 495

Quoted 7 lines
arch/arm/mach-pxa/palmld.c +7 -0
+static struct platform_device palmld_pxa2xx_ac97 = {
+	.name = "pxa2xx-ac97",
+	.id   = -1,
+	.dev  = {
+		.platform_data = &palmld_ac97_pdata,
+	},
+};

No, use pxa_set_ac97_info().

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

How?

Pass the platform data as the argument. This will currently involve merging the two different platform data structures that we have right now.

OK, I see, thanks :-) Will you be happier with this patch then ?

So is it ok this way ? I'd be glad to fix the problem ASAP.

#9 lore raw
In reply to Marek Vasut

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 487

Quoted 3 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +3 -0
+static struct pxa2xx_ac97_platform_data palmld_ac97_pdata = {
+	.reset_gpio	= 95,
+};

The type of this will need changing to reflect the patch that got merged for this but other than that minor point this approach is fine.

#10 lore raw
Quoted 7 lines · On Tuesday 14 of April 2009 21:50:36 Mark Brown wrote:

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 487

Quoted 3 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +3 -0
+static struct pxa2xx_ac97_platform_data palmld_ac97_pdata = {
+	.reset_gpio	= 95,
+};

The type of this will need changing to reflect the patch that got merged for this but other than that minor point this approach is fine.

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ? Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

Thanks

#11 lore raw
Quoted 9 lines · Marek Vasut
Quoted 7 lines · On Tuesday 14 of April 2009 21:50:36 Mark Brown wrote:

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 487

Quoted 3 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +3 -0
+static struct pxa2xx_ac97_platform_data palmld_ac97_pdata = {
+   .reset_gpio     = 95,
+};

The type of this will need changing to reflect the patch that got merged for this but other than that minor point this approach is fine.

Quoted 4 lines

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ? Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

Sorry, late on this. The changes to the platform part look OK to me, and some minor things you may have another look:

sound/soc/pxa/palm27x.c static struct snd_soc_device palm27x_snd_devdata = { · line 203

Quoted 3 lines
sound/soc/pxa/palm27x.c +1 -1
-static int __init palm27x_asoc_init(void)
+static int palm27x_asoc_probe(struct platform_device *pdev)

__devinit

sound/soc/pxa/palm27x.c static int __init palm27x_asoc_init(void) · line 214

Quoted 11 lines

{

sound/soc/pxa/palm27x.c +4 -0
 	int ret;
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void)
 		machine_is_palmld()))
 		return -ENODEV;
 
+	if (pdev->dev.platform_data)
+		palm27x_ep_gpio = ((struct palm27x_asoc_info *)
+			(pdev->dev.platform_data))->jack_gpio;
+

This is not so readable, I'd prefer to introduce a variable for the 'struct palm27x_asoc_info *' pointer.

sound/soc/pxa/palm27x.c static int __init palm27x_asoc_init(void) · line 217

Quoted 3 lines
sound/soc/pxa/palm27x.c +0 -0
 	ret = gpio_request(palm27x_ep_gpio, "Headphone Jack");
 	if (ret)
 		return ret;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#12 lore raw
Quoted 14 lines · On Wednesday 15 of April 2009 04:23:49 Eric Miao wrote:
Quoted 9 lines · Marek Vasut
Quoted 7 lines · On Tuesday 14 of April 2009 21:50:36 Mark Brown wrote:

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 487

Quoted 3 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +3 -0
+static struct pxa2xx_ac97_platform_data palmld_ac97_pdata = {
+   .reset_gpio     = 95,
+};

The type of this will need changing to reflect the patch that got merged for this but other than that minor point this approach is fine.

Quoted 3 lines

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ? Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

Quoted 7 lines

Sorry, late on this. The changes to the platform part look OK to me,

and some minor things you may have another look:

sound/soc/pxa/palm27x.c static struct snd_soc_device palm27x_snd_devdata = { · line 203

Quoted 2 lines
sound/soc/pxa/palm27x.c +1 -1
-static int __init palm27x_asoc_init(void)
+static int palm27x_asoc_probe(struct platform_device *pdev)

__devinit

Thanks, true, will revise it later today and resend ...

Quoted 8 lines
Quoted 8 lines

{

sound/soc/pxa/palm27x.c +0 -0
 	int ret;
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void)
 		machine_is_palmld()))
 		return -ENODEV;
 
Quoted 7 lines

sound/soc/pxa/palm27x.c static int __init palm27x_asoc_init(void) · line 214

Quoted 4 lines
sound/soc/pxa/palm27x.c +4 -0
+	if (pdev->dev.platform_data)
+		palm27x_ep_gpio = ((struct palm27x_asoc_info *)
+			(pdev->dev.platform_data))->jack_gpio;
+

This is not so readable, I'd prefer to introduce a variable for the 'struct palm27x_asoc_info *' pointer.

Come on, we are not doing the kernel only for ub...u so this should be OK for everyone who can code in C. :-)

Quoted 4 lines

sound/soc/pxa/palm27x.c static int __init palm27x_asoc_init(void) · line 217

Quoted 4 lines
sound/soc/pxa/palm27x.c +0 -0
 	ret = gpio_request(palm27x_ep_gpio, "Headphone Jack");
 	if (ret)
 		return ret;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#13 lore raw
Quoted 40 lines · Marek Vasut
Quoted 14 lines · On Wednesday 15 of April 2009 04:23:49 Eric Miao wrote:
Quoted 9 lines · Marek Vasut
Quoted 7 lines · On Tuesday 14 of April 2009 21:50:36 Mark Brown wrote:

arch/arm/mach-pxa/palmld.c static struct wm97xx_batt_info wm97xx_batt_pdata = { · line 487

Quoted 3 lines · Marek Vasut
arch/arm/mach-pxa/palmld.c +3 -0
+static struct pxa2xx_ac97_platform_data palmld_ac97_pdata = {
+   .reset_gpio     = 95,
+};

The type of this will need changing to reflect the patch that got merged for this but other than that minor point this approach is fine.

Quoted 3 lines

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ? Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

Quoted 7 lines

Sorry, late on this. The changes to the platform part look OK to me,

and some minor things you may have another look:

sound/soc/pxa/palm27x.c static struct snd_soc_device palm27x_snd_devdata = { · line 203

Quoted 2 lines
sound/soc/pxa/palm27x.c +1 -1
-static int __init palm27x_asoc_init(void)
+static int palm27x_asoc_probe(struct platform_device *pdev)

__devinit

Thanks, true, will revise it later today and resend ...

Quoted 8 lines
Quoted 8 lines

 {
    int ret;

sound/soc/pxa/palm27x.c +0 -0
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void)
             machine_is_palmld()))
             return -ENODEV;
 
Quoted 7 lines

sound/soc/pxa/palm27x.c static int __init palm27x_asoc_init(void) · line 214

Quoted 4 lines
sound/soc/pxa/palm27x.c +4 -0
+   if (pdev->dev.platform_data)
+           palm27x_ep_gpio = ((struct palm27x_asoc_info *)
+                   (pdev->dev.platform_data))->jack_gpio;
+

This is not so readable, I'd prefer to introduce a variable for the 'struct palm27x_asoc_info *' pointer.

Quoted 3 lines

Come on, we are not doing the kernel only for ub...u so this should be OK for everyone who can code in C. :-)

Quoted 1 line

OK, I have to admit I'm sometimes a bit nitpicking. But when it comes to the time that your platform_data introduces more members other than jack_gpio, you may remember this thread :-)

Anyway, it's up to you. I don't want myself to be too captious.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
sound/soc/pxa/palm27x.c +0 -0
     ret = gpio_request(palm27x_ep_gpio, "Headphone Jack");
     if (ret)
             return ret;
Signature · 6 lines
Cheers
- eric
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#14 lore raw
In reply to Marek Vasut
Quoted 1 line · Marek Vasut

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ?

pxa2xx_audio_ops_t

Quoted 2 lines

Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

ARM.

#15 lore raw
Quoted 11 lines · Mark Brown
Quoted 1 line · Marek Vasut

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ?

pxa2xx_audio_ops_t

Quoted 2 lines

Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

ARM.

Marek,

Any update?

Signature · 2 lines
Cheers
- eric
#16 lore raw
Quoted 7 lines · On Thursday 16 of April 2009 04:43:27 Eric Miao wrote:
Quoted 6 lines · Mark Brown
Quoted 2 lines · Marek Vasut

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ?

pxa2xx_audio_ops_t

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

ARM.

Marek,

Any update?

Sorry, LinuxEXPO takes place here so my sleep amount is reduced to about three hours a day ...

I'll try asap (I hope today), sorry for the delay.

#17 lore raw
Quoted 13 lines · On Thursday 16 of April 2009 06:45:17 Marek Vasut wrote:
Quoted 12 lines · On Thursday 16 of April 2009 04:43:27 Eric Miao wrote:
Quoted 10 lines · Mark Brown
Quoted 2 lines · Marek Vasut

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ?

pxa2xx_audio_ops_t

Quoted 2 lines

Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

ARM.

Quoted 8 lines
Quoted 3 lines

Marek,

Any update?

Sorry, LinuxEXPO takes place here so my sleep amount is reduced to about three hours a day ...

I'll try asap (I hope today), sorry for the delay.

Ok, this one should be fine with you

From bf32cbc4b2360773f878656018940c7203ae80c7 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Fri, 17 Apr 2009 11:37:35 +0200
Subject: [PATCH] General fix for Palm27x aSoC driver

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.

---
 arch/arm/mach-pxa/include/mach/palmasoc.h |    7 +------
 arch/arm/mach-pxa/palmld.c                |   18 +++++++++++++++---
 arch/arm/mach-pxa/palmt5.c                |   18 +++++++++++++++---
 arch/arm/mach-pxa/palmtx.c                |   23 ++++++++++++++++++++++-
 sound/soc/pxa/palm27x.c                   |   27 +++++++++++++++++++++++----
 5 files changed, 76 insertions(+), 17 deletions(-)
arch/arm/mach-pxa/include/mach/palmasoc.h +1 -6
index 6c4b1f7..58afb30 100644
@@ -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
arch/arm/mach-pxa/palmld.c +15 -3
index ecf5910..1cec180 100644
@@ -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
  ******************************************************************************/
@@ -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 = {
@@ -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));
 }
arch/arm/mach-pxa/palmt5.c +15 -3
index d7f8106..3066236 100644
@@ -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
  ******************************************************************************/
@@ -486,6 +498,7 @@ static struct platform_device *devices[] __initdata = {
 #endif
 	&palmt5_backlight,
 	&power_supply,
+	&palmt5_asoc,
 };
 
 /* setup udc GPIOs initial state */
@@ -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));
 }
 
arch/arm/mach-pxa/palmtx.c +22 -1
index 14393d0..e2d44b1 100644
@@ -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"
@@ -434,6 +435,25 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = {
 };
 
 /******************************************************************************
+ * 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
  ******************************************************************************/
 static struct pxafb_mode_info palmtx_lcd_modes[] = {
@@ -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 = {
@@ -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);
sound/soc/pxa/palm27x.c +23 -4
index 48a73f6..44fcc4e 100644
@@ -200,7 +200,7 @@ 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;
 
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void)
 		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;
@@ -245,16 +249,31 @@ err_alloc:
 	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);
Signature · 1 line
1.6.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#18 lore raw
Quoted 3 lines · On Friday 17 of April 2009 11:42:08 Marek Vasut wrote:
Quoted 2 lines · On Thursday 16 of April 2009 06:45:17 Marek Vasut wrote:
Quoted 1 line · On Thursday 16 of April 2009 04:43:27 Eric Miao wrote:

On Wed, Apr 15, 2009 at 4:21 PM, Mark Brown <[email protected]>

Quoted 13 lines · wrote:
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines · Marek Vasut
Quoted 2 lines

OK, shall I change it and resend (ps. to what if you dont mind telling me?) ?

pxa2xx_audio_ops_t

Quoted 2 lines

Also, do you want to push it through also tree or ARM tree ? I'm for the second option as it's more of a bugfix suitable for that tree.

ARM.

Marek,

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Any update?

Sorry, LinuxEXPO takes place here so my sleep amount is reduced to about three hours a day ...

I'll try asap (I hope today), sorry for the delay.

Ok, this one should be fine with you

Any update from your side?

Applied
#19 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Marek,

Any update?

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Sorry, LinuxEXPO takes place here so my sleep amount is reduced to about three hours a day ...

I'll try asap (I hope today), sorry for the delay.

Ok, this one should be fine with you

Any update from your side?

Applied, thanks.