Re: [PATCH] Allow passing platform_data to devices attached to AC97 bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
> At Tue, 21 Jul 2009 15:53:23 +0100,
>
> Mark Brown wrote:
> > On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
> > > Marek Vasut wrote:
> > > >  	int ret;
> > > > +	pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
> > >
> > > Use the get function.
> >
> > There's no such function in mainline right now.  However, apropos of
> > something else I submitted a patch adding that to the driver core - it's
> > been merged for 2.6.32 but won't be available in ALSA until after the
> > next merge window.  The function is dev_get_platdata().
>
> Ah, right.  This can be fixed later, then.
>
> > > Also, at the next time, add Russell or linux-arm to Cc so that he
> > > knows at least that a file in arch/arm will be changed.
> >
> > Ideally split things into two separate patches.
>
> Agreed.
>
>
> Takashi

And one more patch to convert the mainstone accelerated touch driver to use 
platform_data.
From c75defb486f199d4bc9ead3245032ca2c0d298c9 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@xxxxxxxxx>
Date: Tue, 21 Jul 2009 20:12:23 +0200
Subject: [PATCH] Convert the mainstone accelerated touch driver to use platform_data

Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx>
---
 arch/arm/mach-pxa/mainstone.c                |   10 ++++++++++
 arch/arm/mach-pxa/palmld.c                   |    9 ++++++++-
 arch/arm/mach-pxa/palmt5.c                   |    9 ++++++++-
 arch/arm/mach-pxa/palmtx.c                   |    9 ++++++++-
 drivers/input/touchscreen/mainstone-wm97xx.c |   26 ++++++++++++++++----------
 include/linux/wm97xx.h                       |    3 ++-
 6 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index a4eeae3..b116927 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -27,6 +27,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/pwm_backlight.h>
 #include <linux/smc91x.h>
+#include <linux/wm97xx.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -284,11 +285,20 @@ static void mst_audio_resume(void *priv)
 	MST_MSCWR2 &= mst_audio_suspend_mask | ~MST_MSCWR2_AC97_SPKROFF;
 }
 
+static struct wm97xx_touch_pdata mainstone_touch_pdata = {
+	.irq_gpio	= 4,
+};
+
+static struct wm97xx_pdata mainstone_wm97xx_pdata = {
+	.touch_pdata	= &palmtx_touch_pdata,
+};
+
 static pxa2xx_audio_ops_t mst_audio_ops = {
 	.startup	= mst_audio_startup,
 	.shutdown	= mst_audio_shutdown,
 	.suspend	= mst_audio_suspend,
 	.resume		= mst_audio_resume,
+	.codec_pdata	= { &mainstone_wm97xx_pdata, },
 };
 
 static struct resource flash_resources[] = {
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index bcf5b46..e7af187 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -406,7 +406,7 @@ static struct platform_device power_supply = {
 };
 
 /******************************************************************************
- * WM97xx audio, battery
+ * WM97xx audio, touchscreen, battery
  ******************************************************************************/
 static struct wm97xx_batt_pdata palmld_batt_pdata = {
 	.batt_aux	= WM97XX_AUX_ID3,
@@ -422,8 +422,15 @@ static struct wm97xx_batt_pdata palmld_batt_pdata = {
 	.batt_name	= "main-batt",
 };
 
+static struct wm97xx_touch_pdata palmld_touch_pdata = {
+	.irq_gpio	= GPIO_NR_PALMLD_WM9712_IRQ,
+	.pen_int	= 1,
+	.variant	= WM97xx_WM1613,
+};
+
 static struct wm97xx_pdata palmld_wm97xx_pdata = {
 	.batt_pdata	= &palmld_batt_pdata,
+	.touch_pdata	= &palmld_touch_pdata,
 };
 
 static pxa2xx_audio_ops_t palmld_ac97_pdata = {
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 3e8b21d..3863cb9 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -317,7 +317,7 @@ static struct platform_device power_supply = {
 };
 
 /******************************************************************************
- * WM97xx audio, battery
+ * WM97xx audio, touchscreen, battery
  ******************************************************************************/
 static struct wm97xx_batt_pdata palmt5_batt_pdata = {
 	.batt_aux	= WM97XX_AUX_ID3,
@@ -333,8 +333,15 @@ static struct wm97xx_batt_pdata palmt5_batt_pdata = {
 	.batt_name	= "main-batt",
 };
 
+static struct wm97xx_touch_pdata palmt5_touch_pdata = {
+	.irq_gpio	= GPIO_NR_PALMT5_WM9712_IRQ,
+	.pen_int	= 1,
+	.variant	= WM97xx_WM1613,
+};
+
 static struct wm97xx_pdata palmt5_wm97xx_pdata = {
 	.batt_pdata	= &palmt5_batt_pdata,
+	.touch_pdata	= &palmt5_touch_pdata,
 };
 
 static pxa2xx_audio_ops_t palmt5_ac97_pdata = {
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 554b3da..9009bd6 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -340,7 +340,7 @@ static struct platform_device power_supply = {
 };
 
 /******************************************************************************
- * WM97xx audio, battery
+ * WM97xx audio, touchscreen, battery
  ******************************************************************************/
 static struct wm97xx_batt_pdata palmtx_batt_pdata = {
 	.batt_aux	= WM97XX_AUX_ID3,
@@ -356,8 +356,15 @@ static struct wm97xx_batt_pdata palmtx_batt_pdata = {
 	.batt_name	= "main-batt",
 };
 
+static struct wm97xx_touch_pdata palmtx_touch_pdata = {
+	.irq_gpio	= GPIO_NR_PALMTX_WM9712_IRQ,
+	.pen_int	= 1,
+	.variant	= WM97xx_WM1613,
+};
+
 static struct wm97xx_pdata palmtx_wm97xx_pdata = {
 	.batt_pdata	= &palmtx_batt_pdata,
+	.touch_pdata	= &palmtx_touch_pdata,
 };
 
 static pxa2xx_audio_ops_t palmtx_ac97_pdata = {
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c
index e000ab3..96bedd3 100644
--- a/drivers/input/touchscreen/mainstone-wm97xx.c
+++ b/drivers/input/touchscreen/mainstone-wm97xx.c
@@ -194,16 +194,6 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
 		 "mainstone accelerated touchscreen driver, %d samples/sec\n",
 		 cinfo[sp_idx].speed);
 
-	/* IRQ driven touchscreen is used on Palm hardware */
-	if (machine_is_palmt5() || machine_is_palmtx() || machine_is_palmld()) {
-		pen_int = 1;
-		irq = 27;
-		/* There is some obscure mutant of WM9712 interbred with WM9713
-		 * used on Palm HW */
-		wm->variant = WM97xx_WM1613;
-	} else if (machine_is_mainstone() && pen_int)
-		irq = 4;
-
 	if (irq) {
 		ret = gpio_request(irq, "Touchscreen IRQ");
 		if (ret)
@@ -280,6 +270,22 @@ static struct wm97xx_mach_ops mainstone_mach_ops = {
 static int mainstone_wm97xx_probe(struct platform_device *pdev)
 {
 	struct wm97xx *wm = platform_get_drvdata(pdev);
+	struct wm97xx_touch_pdata *pdata = pdev->dev.platform_data;
+
+	if (pdata) {
+		if (pdata->irq_gpio)
+			irq = pdata->irq_gpio;
+		if (pdata->cont_rate)
+			cont_rate = pdata->cont_rate;
+		if (pdata->pen_int)
+			pen_int = pdata->pen_int;
+		if (pdata->pressure)
+			pressure = pdata->pressure;
+		if (pdata->ac97_touch_slot)
+			ac97_touch_slot = pdata->ac97_touch_slot;
+		if (pdata->variant)
+			wm->variant = pdata->variant;
+	}
 
 	return wm97xx_register_mach_ops(wm, &mainstone_mach_ops);
 }
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 746edfa..0c71c63 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -309,7 +309,8 @@ struct wm97xx_batt_pdata {
 
 struct wm97xx_touch_pdata {
 	int	irq;
-	bool	irq_inverted;
+	int	irq_gpio;	/* this is for mainstone and palm */
+	int	variant;
 
 	int	cont_rate;
 	int	pen_int;
-- 
1.6.3.3

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux