Allow passing platform_data to devices attached to AC97 bus
Subsystems (7)
PATCH 1/1 Allow passing platform_data to devices attached to AC97 bus
Hi,
I managed to put together this patch with huge help from Mark. It allows passing platform_data to devices on ac97 bus and implements this for pxa2xx- ac97. Please consider applying.
From dc427c54f0fede86acb6e21b09908597b066f021 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...). This patch also adds this support into PXA2xx-AC97 driver as a reference implementation.
--- arch/arm/mach-pxa/include/mach/audio.h | 1 + include/sound/ac97_codec.h | 3 +++ include/sound/soc-dai.h | 1 + sound/arm/pxa2xx-ac97.c | 3 +++ sound/pci/ac97/ac97_codec.c | 7 +++++++ sound/soc/pxa/pxa2xx-ac97.c | 7 ++++++- sound/soc/soc-core.c | 5 ++++- 7 files changed, 25 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +1 -0
@@ -20,6 +20,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[4 ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -642,4 +642,7 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data); +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/arm/pxa2xx-ac97.c +3 -0
@@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id; ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +202,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[id], pdata->codec_pdata[id]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
sound/pci/ac97/ac97_codec.c +7 -0
@@ -1922,6 +1922,13 @@ static void ac97_device_release(struct device * dev) { } +/* add platform_data to the ac97 device */ +void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +EXPORT_SYMBOL_GPL (snd_ac97_dev_add_pdata); +/* register ac97 codec to bus */ static int snd_ac97_dev_register (struct snd_device *device) {
sound/soc/pxa/pxa2xx-ac97.c +6 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,13 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata + [pdev->id <0 ?0 : pdev->id]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
sound/soc/soc-core.c +4 -1
@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata; + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 21 Jul 2009 16:33:14 +0200,
include/sound/ac97_codec.h int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); · line 646
Quoted 11 lines · Marek Vasut
include/sound/ac97_codec.h +2
-0@@ -642,4 +642,7 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data);
The get/set accessors would be more consistent, I think. Also, such a small one can be inline function. We don't always need to grow exported symbols.
sound/arm/pxa2xx-ac97.c static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) · line 173
Quoted 9 lines
sound/arm/pxa2xx-ac97.c +1
-0@@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
Quoted 16 lines
sound/arm/pxa2xx-ac97.c +0
-0/* register ac97 codec to bus */ static int snd_ac97_dev_register (struct snd_device *device) {sound/soc/pxa/pxa2xx-ac97.c +1
-0@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
sound/soc/pxa/pxa2xx-ac97.c EXPORT_SYMBOL_GPL(soc_ac97_ops); · line 245
Quoted 4 lines
sound/soc/pxa/pxa2xx-ac97.c +1
-0@@ -241,9 +242,13 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
Use the get function.
sound/soc/soc-core.c int snd_soc_init_card(struct snd_soc_device *socdev) · line 1387
Quoted 13 lines
sound/soc/soc-core.c +3
-1@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata;
Use the set function.
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.
thanks,
Takashi
Quoted 6 lines · Takashi Iwai
sound/arm/pxa2xx-ac97.c static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) · line 173
Quoted 2 lines · Marek Vasut
sound/arm/pxa2xx-ac97.c +1
-0int 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().
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.
Ideally split things into two separate patches.
Robert Jarzmik
maintainerarch/arm/mach-pxa/include/mach/audio.h typedef struct { · line 23
Quoted 9 lines · Marek Vasut
arch/arm/mach-pxa/include/mach/audio.h +1
-0@@ -20,6 +20,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[4 ];
I don't understand where that '4' comes from. Would you explain ?
Quoted 14 lines
sound/arm/pxa2xx-ac97.c +2
-0@@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id; ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
sound/arm/pxa2xx-ac97.c static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) · line 205
Quoted 4 lines
sound/arm/pxa2xx-ac97.c +1
-0@@ -200,6 +202,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[id], pdata->codec_pdata[id]);
Is there something that grants that dev->id is lesser than 4 ?
Cheers.
Signature · 1 line
Robert
At Tue, 21 Jul 2009 15:53:23 +0100,
Quoted 9 lines · Mark Brown
Quoted 6 lines · Takashi Iwai
sound/arm/pxa2xx-ac97.c static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) · line 173
Quoted 2 lines · Marek Vasut
sound/arm/pxa2xx-ac97.c +1
-0int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;Use the get function.
Quoted 4 lines
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.
Quoted 4 lines
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.Ideally split things into two separate patches.
Agreed.
Takashi
At Tue, 21 Jul 2009 17:11:03 +0200,
Quoted 13 lines · Robert Jarzmik
arch/arm/mach-pxa/include/mach/audio.h typedef struct { · line 23
Quoted 9 lines · Marek Vasut
arch/arm/mach-pxa/include/mach/audio.h +1
-0@@ -20,6 +20,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[4 ];I don't understand where that '4' comes from. Would you explain ?
It's defacto-standard max of AC97 slots. But, yes, a magic number should be defined explicitly.
Takashi
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
Quoted 20 lines
At Tue, 21 Jul 2009 15:53:23 +0100,
Quoted 11 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Review
Quoted 2 lines · Marek Vasut
(quoted diff) +1
-0int 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.
Quoted 3 lines
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.
Quoted 6 lines
Quoted 1 line
Ideally split things into two separate patches.
Agreed.
Takashi
Ok, I split it in two, here's the one that adds necessary stuff to alsa.
From bb1d5481f2786a30133a8392c4e46170a1b8b615 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/2] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
--- include/sound/ac97_codec.h | 3 +++ include/sound/soc-dai.h | 1 + sound/pci/ac97/ac97_codec.c | 6 ++++++ sound/soc/soc-core.c | 5 ++++- 4 files changed, 14 insertions(+), 1 deletions(-)
include/sound/ac97_codec.h +3 -0
@@ -642,4 +642,7 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data); +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/pci/ac97/ac97_codec.c +6 -0
@@ -1922,6 +1922,12 @@ static void ac97_device_release(struct device * dev) { } +/* add platform_data to the ac97 device */ +inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +/* register ac97 codec to bus */ static int snd_ac97_dev_register (struct snd_device *device) {
sound/soc/soc-core.c +4 -1
@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata; + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
Quoted 20 lines
At Tue, 21 Jul 2009 15:53:23 +0100,
Quoted 11 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Review
Quoted 2 lines · Marek Vasut
(quoted diff) +1
-0int 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.
Quoted 3 lines
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.
Quoted 6 lines
Quoted 1 line
Ideally split things into two separate patches.
Agreed.
Takashi
And this patch adds changes to pxa2xx-ac97. Also, I fixed the magic constant.
From 97c0a179284cc8ea1419e1cd1857159bb9bc194b Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 2/2] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 3 +++ sound/soc/pxa/pxa2xx-ac97.c | 7 ++++++- 4 files changed, 15 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +3 -0
@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */
sound/arm/pxa2xx-ac97.c +3 -0
@@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id; ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +202,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[id], pdata->codec_pdata[id]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
sound/soc/pxa/pxa2xx-ac97.c +6 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,13 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata + [pdev->id <0 ?0 : pdev->id]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
Quoted 20 lines
At Tue, 21 Jul 2009 15:53:23 +0100,
Quoted 11 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Review
Quoted 2 lines · Marek Vasut
(quoted diff) +1
-0int 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.
Quoted 3 lines
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.
Quoted 6 lines
Quoted 1 line
Ideally split things into two separate patches.
Agreed.
Takashi
Also, another patch (depends on previous two). This one converts wm97xx driver to use supplied platform_data. This will have a follow-up patch that converts all the platforms to supply the platform_data properly.
From 833cb3050e05bc1a2ed3445533d5fe44188364e7 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 1/2] Convert WM97xx driver to use platform_data
This patch converts the wm97xx driver to use platform_data supplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it's platform_data and prepares a structure for touchscreen driver.
--- drivers/input/touchscreen/wm97xx-core.c | 3 +++ drivers/power/wm97xx_battery.c | 13 ++++--------- include/linux/wm97xx.h | 30 ++++++++++++++++++++++++++++++ include/linux/wm97xx_batt.h | 26 -------------------------- 4 files changed, 37 insertions(+), 35 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h
drivers/input/touchscreen/wm97xx-core.c +3 -0
@@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)static int wm97xx_probe (struct device *dev) {struct wm97xx *wm; +struct wm97xx_pdata *pdata = dev->platform_data;int ret =0 , id =0 ; wm =kzalloc (sizeof (struct wm97xx ),GFP_KERNEL );
@@ -658,6 +659,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; + wm->battery_dev->dev.platform_data = pdata->batt_pdata; ret =platform_device_add (wm->battery_dev);if (ret <0 ) goto batt_reg_err;
@@ -671,6 +673,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->touch_dev, wm); wm->touch_dev->dev.parent = dev; + wm->touch_dev->dev.platform_data = pdata->touch_pdata; ret =platform_device_add (wm->touch_dev);if (ret <0 ) goto touch_reg_err;
drivers/power/wm97xx_battery.c +4 -9
@@ -22,13 +22,12 @@#include <linux/spinlock.h> #include <linux/interrupt.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> static DEFINE_MUTEX (bat_lock);static struct work_struct bat_work;struct mutex work_lock;static int bat_status =POWER_SUPPLY_STATUS_UNKNOWN ; -static struct wm97xx_batt_info *pdata; +static struct wm97xx_batt_pdata *pdata;static enum power_supply_property *prop;static unsigned long wm97xx_read_bat (struct power_supply *bat_ps)
@@ -150,13 +149,15 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)int props =1 ;/* POWER_SUPPLY_PROP_PRESENT */ int i =0 ; + pdata = dev->dev.platform_data; +if (dev->id !=-1 )return -EINVAL ;mutex_init (&work_lock);if (!pdata) { -dev_err (&dev->dev,"Please use wm97xx_bat_set_pdata\n" ); +dev_err (&dev->dev,"No platform_data supplied\n" );return -EINVAL ; }
@@ -258,12 +259,6 @@ static void __exit wm97xx_bat_exit(void)platform_driver_unregister (&wm97xx_bat_driver); } -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) -{ - pdata = data; -} -EXPORT_SYMBOL_GPL (wm97xx_bat_set_pdata); -module_init (wm97xx_bat_init);module_exit (wm97xx_bat_exit);
include/linux/wm97xx.h +30 -0
@@ -293,6 +293,36 @@ struct wm97xx {u16 suspend_mode;/* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { +int batt_aux; +int temp_aux; +int charge_gpio; +int min_voltage; +int max_voltage; +int batt_div; +int batt_mult; +int temp_div; +int temp_mult; +int batt_tech; +char *batt_name; +}; + +struct wm97xx_touch_pdata { +int irq; +bool irq_inverted; + +int cont_rate; +int pen_int; +int pressure; +int ac97_touch_slot; + +}; + +struct wm97xx_pdata { +struct wm97xx_batt_pdata *batt_pdata;/* battery data */ +struct wm97xx_touch_pdata *touch_pdata; +}; +/* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status.
include/linux/wm97xx_batt.h deleted +0 -26
@@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { -int batt_aux; -int temp_aux; -int charge_gpio; -int min_voltage; -int max_voltage; -int batt_div; -int batt_mult; -int temp_div; -int temp_mult; -int batt_tech; -char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) {} -#endif - -#endif
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
Quoted 20 lines
At Tue, 21 Jul 2009 15:53:23 +0100,
Quoted 11 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Review
Quoted 2 lines · Marek Vasut
(quoted diff) +1
-0int 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.
Quoted 3 lines
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.
Quoted 6 lines
Quoted 1 line
Ideally split things into two separate patches.
Agreed.
Takashi
This is the follow-up patch. This will need ack from maintainers (me as I maintain most of the palm devices) and Robert (because of mio).
From 1f94c536e04743b090eb17b8d7298cae55c716a2 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 19:22:13 +0200
Subject: [PATCH 2/2] Convert all platforms to pass platform_data to wm97xx battery
--- arch/arm/mach-pxa/mioa701.c | 7 ++++++- arch/arm/mach-pxa/palmld.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmt5.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmte2.c | 20 ++++++++++++-------- arch/arm/mach-pxa/palmtx.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmz72.c | 20 ++++++++++++-------- arch/arm/mach-pxa/treo680.c | 1 - 7 files changed, 60 insertions(+), 45 deletions(-)
arch/arm/mach-pxa/mioa701.c +6 -1
@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h>
@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = { .batt_name = "mioa701_battery", }; +static struct wm97xx_pdata mioa701_wm97xx_pdata = { + .batt_pdata = &mioa701_battery_data, +}; +/* * Voltage regulation */
@@ -728,6 +732,7 @@ struct i2c_pxa_platform_data i2c_pdata = {static pxa2xx_audio_ops_t mioa701_ac97_info = { .reset_gpio =95 , + .codec_pdata = { &mioa701_wm97xx_pdata, }, };/*
arch/arm/mach-pxa/palmld.c +10 -9
@@ -22,7 +22,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/mtd/mtd.h>
@@ -406,9 +406,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmld_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -422,15 +422,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmld_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , +static struct wm97xx_pdata palmld_wm97xx_pdata = { + .batt_pdata = &palmld_batt_pdata, };static pxa2xx_audio_ops_t palmld_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmld_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmld_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , };static struct platform_device palmld_asoc = {
@@ -536,7 +538,6 @@ static void __init palmld_init(void)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);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmt5.c +10 -9
@@ -24,7 +24,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -317,9 +317,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmt5_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -333,15 +333,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmt5_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , +static struct wm97xx_pdata palmt5_wm97xx_pdata = { + .batt_pdata = &palmt5_batt_pdata, };static pxa2xx_audio_ops_t palmt5_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmt5_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmt5_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , };static struct platform_device palmt5_asoc = {
@@ -426,7 +428,6 @@ static void __init palmt5_init(void)pxa_set_ac97_info (&palmt5_ac97_pdata);pxa_set_ficp_info (&palmt5_ficp_platform_data);pxa_set_keypad_info (&palmt5_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmte2.c +12 -8
@@ -23,7 +23,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -290,9 +290,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmte2_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -306,9 +306,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmte2_wm97xx_pdata = { + .batt_pdata = &palmte2_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmte2_ac97_pdata = { + .codec_pdata = { &palmte2_wm97xx_pdata, }, +}; +static struct palm27x_asoc_info palmte2_asoc_pdata = { .jack_gpio =GPIO_NR_PALMTE2_EARPHONE_DETECT , };
@@ -376,9 +381,8 @@ static void __init palmte2_init(void)set_pxa_fb_info (&palmte2_lcd_screen);pxa_set_mci_info (&palmte2_mci_platform_data);palmte2_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmte2_ac97_pdata);pxa_set_ficp_info (&palmte2_ficp_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmtx.c +10 -9
@@ -25,7 +25,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/nand.h>
@@ -340,9 +340,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmtx_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -356,15 +356,17 @@ 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 struct wm97xx_pdata palmtx_wm97xx_pdata = { + .batt_pdata = &palmtx_batt_pdata, };static pxa2xx_audio_ops_t palmtx_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmtx_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmtx_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMTX_EARPHONE_DETECT , };static struct platform_device palmtx_asoc = {
@@ -538,7 +540,6 @@ static void __init palmtx_init(void)pxa_set_ac97_info (&palmtx_ac97_pdata);pxa_set_ficp_info (&palmtx_ficp_platform_data);pxa_set_keypad_info (&palmtx_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmz72.c +12 -8
@@ -27,7 +27,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -343,9 +343,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmz72_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -359,9 +359,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmz72_wm97xx_pdata = { + .batt_pdata = &palmz72_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmz72_ac97_pdata = { + .codec_pdata = { &palmz72_wm97xx_pdata, }, +}; +static struct platform_device palmz72_asoc = { .name ="palm27x-asoc" , .id =-1 ,
@@ -494,10 +499,9 @@ static void __init palmz72_init(void)set_pxa_fb_info (&palmz72_lcd_screen);pxa_set_mci_info (&palmz72_mci_platform_data);palmz72_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmz72_ac97_pdata);pxa_set_ficp_info (&palmz72_ficp_platform_data);pxa_set_keypad_info (&palmz72_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/treo680.c +0 -1
@@ -19,7 +19,6 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/w1-gpio.h>
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
Quoted 20 lines
At Tue, 21 Jul 2009 15:53:23 +0100,
Quoted 11 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Review
Quoted 2 lines · Marek Vasut
(quoted diff) +1
-0int 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.
Quoted 3 lines
Quoted 2 lines
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in
arch/armwill be changed.
Quoted 6 lines
Quoted 1 line
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 <[email protected]>
Date: Tue, 21 Jul 2009 20:12:23 +0200
Subject: [PATCH] Convert the mainstone accelerated touch driver to use platform_data
--- 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(-)
arch/arm/mach-pxa/mainstone.c +10 -0
@@ -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[] = {
arch/arm/mach-pxa/palmld.c +8 -1
@@ -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 = {
arch/arm/mach-pxa/palmt5.c +8 -1
@@ -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 = {
arch/arm/mach-pxa/palmtx.c +8 -1
@@ -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 = {
drivers/input/touchscreen/mainstone-wm97xx.c +16 -10
@@ -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); }
include/linux/wm97xx.h +2 -1
@@ -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;
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
include/linux/wm97xx.h struct wm97xx { · line 312
Quoted 5 lines · Marek Vasut
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
include/linux/wm97xx.h +3
-0+struct wm97xx_touch_pdata { +int irq; +bool irq_inverted;
The IRQ is not touch-specific, it should be part of the main platform data. I can't see anything in the patch actually using this or any other part of the touch platform data, though...
include/linux/wm97xx.h struct wm97xx { · line 319
Quoted 6 lines
include/linux/wm97xx.h +6
-0+int cont_rate; +int pen_int; +int pressure; +int ac97_touch_slot; + +};
As I said previously this should be able to completely replace the existing touch configuration. That means the entire mach_ops structure, plus all the stuff that can be configured via module options (including the new option for the WM1616).
include/sound/ac97_codec.h int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); · line 647
Quoted 5 lines · Marek Vasut
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
include/sound/ac97_codec.h +3
-0+/* AC97 platform_data adding function */ +inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data); +
I think Takashi asked for this to be done as an inline? I tend to agree with him.
Quoted 10 lines · Mark Brown
include/linux/wm97xx.h struct wm97xx { · line 312
Quoted 5 lines · Marek Vasut
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
include/linux/wm97xx.h +3
-0+struct wm97xx_touch_pdata { +int irq; +bool irq_inverted;The IRQ is not touch-specific, it should be part of the main platform data. I can't see anything in the patch actually using this or any other part of the touch platform data, though...
Also, please do try to remember to post patches to the appropriate subsystems - this is a patch to the input and power subsystems so you need to run the patch past their maintainers.
Dne Út 21. července 2009 20:30:56 Mark Brown napsal(a):
Quoted 9 lines · Marek Vasut
Review
Quoted 5 lines
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
(quoted diff) +3
-0+/* AC97 platform_data adding function */ +inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data); +I think Takashi asked for this to be done as an inline? I tend to agree with him.
Ok, this one should be better then? Mark, thanks for guiding me :-)
From 082f09b9f3c1bbf3240610dc89baba33d47787b7 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletions(-)
include/sound/ac97_codec.h +6 -0
@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/soc/soc-core.c +4 -1
@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata; + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne Út 21. července 2009 20:30:56 Mark Brown napsal(a):
Quoted 9 lines · Marek Vasut
Review
Quoted 5 lines
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
(quoted diff) +3
-0+/* AC97 platform_data adding function */ +inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data); +I think Takashi asked for this to be done as an inline? I tend to agree with him.
Ok, this one fixes one more issue. Should be fine now. Please consider applying.
From 082f09b9f3c1bbf3240610dc89baba33d47787b7 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/5] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletions(-)
include/sound/ac97_codec.h +6 -0
@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +static inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/soc/soc-core.c +4 -1
@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata; + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne Út 21. července 2009 20:30:56 Mark Brown napsal(a):
Quoted 9 lines · Marek Vasut
Review
Quoted 5 lines
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
(quoted diff) +3
-0+/* AC97 platform_data adding function */ +inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data); +I think Takashi asked for this to be done as an inline? I tend to agree with him.
And here's that pxa-ac97 patch, just for completeness.
From 8f022739a263ffa47623385cc176355b93b660e8 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 2/5] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 3 +++ sound/soc/pxa/pxa2xx-ac97.c | 7 ++++++- 4 files changed, 15 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +3 -0
@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */
sound/arm/pxa2xx-ac97.c +3 -0
@@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id; ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +202,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[id], pdata->codec_pdata[id]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
sound/soc/pxa/pxa2xx-ac97.c +6 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,13 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata + [pdev->id <0 ?0 : pdev->id]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 21 Jul 2009 22:24:21 +0200,
Quoted 48 lines · Marek Vasut
From
082f09b9f3c1bbf3240610dc89baba33d47787b7Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/5] Allow passingplatform_datato devices attached to AC97 busThis patch allows passing
platform_datato devices attached to AC97 bus (like touchscreens, battery measurement chips ...).Signed-off-by Marek Vasut <[email protected]>--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletions(-)include/sound/ac97_codec.h +6
-0@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +static inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */ include/sound/soc-dai.h +1
-0@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,sound/soc/soc-core.c +0
-0
sound/soc/soc-core.c int snd_soc_init_card(struct snd_soc_device *socdev) · line 1387
Quoted 8 lines
sound/soc/soc-core.c +3
-1@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata;
Any reason not to use the newly added snd_ac97_dev_add_pdata()?
thanks,
Takashi
Dne Út 21. července 2009 22:59:35 Takashi Iwai napsal(a):
Quoted 53 lines
At Tue, 21 Jul 2009 22:24:21 +0200,
Quoted 50 lines · Marek Vasut
From
082f09b9f3c1bbf3240610dc89baba33d47787b7Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/5] Allow passingplatform_datato devices attached to AC97 busThis patch allows passing
platform_datato devices attached to AC97 bus (like touchscreens, battery measurement chips ...).Signed-off-by Marek Vasut <[email protected]>--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletions(-)include/sound/ac97_codec.h +0
-0@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct
snd_pcm_runtime*runtime); /* ad hoc AC97 device driver access */
extern structbus_typeac97_bus_type;include/sound/ac97_codec.h +2
-0+/* AC97 platform_data adding function */ +static inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void*data) +{
include/sound/ac97_codec.h +3
-0+ ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */ include/sound/soc-dai.h +1
-0@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,sound/soc/soc-core.c +0
-0@@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev) continue; }
Quoted 8 lines
sound/soc/soc-core.c int snd_soc_init_card(struct snd_soc_device · line 1387
Quoted 6 lines
sound/soc/soc-core.c +3
-1} -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; + codec->ac97->dev.platform_data = + card->dai_link[i].cpu_dai->ac97_pdata;Any reason not to use the newly added
snd_ac97_dev_add_pdata()?
hm, that's true, one more iteration then.
Quoted 5 lines
thanks,
Takashi
From 776233642ae196ee1998791ec69bd20d7725ecca Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/4] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 6 +++++- 3 files changed, 12 insertions(+), 1 deletions(-)
include/sound/ac97_codec.h +6 -0
@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +static inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/soc/soc-core.c +5 -1
@@ -28,6 +28,7 @@#include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/platform_device.h> +#include <sound/ac97_codec.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h>
@@ -1381,8 +1382,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; +snd_ac97_dev_add_pdata (codec->ac97, + card->dai_link[i].cpu_dai->ac97_pdata); + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Btw. I also reworked the wm97xx-battery a little more. Also, CCing power- supply people.
From 0c04c7f9cac26de8b4e401c17e65051c7f44ec3e Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to use platform_data
This patch converts the wm97xx driver to use platform_data supplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it's platform_data and prepares a structure for touchscreen driver.
--- drivers/input/touchscreen/wm97xx-core.c | 3 ++ drivers/power/wm97xx_battery.c | 59 +++++++++++++++++++++++-------- include/linux/wm97xx.h | 18 +++++++++ include/linux/wm97xx_batt.h | 26 ------------- 4 files changed, 65 insertions(+), 41 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h
drivers/input/touchscreen/wm97xx-core.c +3 -0
@@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)static int wm97xx_probe (struct device *dev) {struct wm97xx *wm; +struct wm97xx_pdata *pdata = dev->platform_data;int ret =0 , id =0 ; wm =kzalloc (sizeof (struct wm97xx ),GFP_KERNEL );
@@ -658,6 +659,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; + wm->battery_dev->dev.platform_data = pdata; ret =platform_device_add (wm->battery_dev);if (ret <0 ) goto batt_reg_err;
@@ -671,6 +673,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->touch_dev, wm); wm->touch_dev->dev.parent = dev; + wm->touch_dev->dev.platform_data = pdata; ret =platform_device_add (wm->touch_dev);if (ret <0 ) goto touch_reg_err;
drivers/power/wm97xx_battery.c +44 -15
148 lines not on this page · raw message
include/linux/wm97xx.h +18 -0
@@ -293,6 +293,24 @@ struct wm97xx {u16 suspend_mode;/* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { +int batt_aux; +int temp_aux; +int charge_gpio; +int min_voltage; +int max_voltage; +int batt_div; +int batt_mult; +int temp_div; +int temp_mult; +int batt_tech; +char *batt_name; +}; + +struct wm97xx_pdata { +struct wm97xx_batt_pdata *batt_pdata;/* battery data */ +}; +/* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status.
include/linux/wm97xx_batt.h deleted +0 -26
@@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { -int batt_aux; -int temp_aux; -int charge_gpio; -int min_voltage; -int max_voltage; -int batt_div; -int batt_mult; -int temp_div; -int temp_mult; -int batt_tech; -char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) {} -#endif - -#endif
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
drivers/power/wm97xx_battery.c static int __devinit wm97xx_bat_probe(struct platform_device *dev) · line 193
Quoted 7 lines · Marek Vasut
drivers/power/wm97xx_battery.c +7
-0+ ret =set_irq_type (gpio_to_irq (pdata->charge_gpio), +IRQ_TYPE_EDGE_BOTH ); +if (ret) + goto err2; + ret =request_irq (gpio_to_irq (pdata->charge_gpio), + wm97xx_chrg_irq,IRQF_DISABLED , +"AC Detect" ,0 );
This should be done as one call to request_irq().
Why?
If the IRQ is already in use by something else, calling set_irq_type() will stamp on that other user, enforcing the change of configuration. request_irq() will then fail, leaving the IRQ configuration buggered.
Combining the two allows request_irq() to fail if the IRQ line is busy. If it isn't busy, it will configure the IRQ line prior to enabling the IRQ. If the IRQ is shared and sharing is permitted, it will fail if the configuration is not compatible with the existing IRQ configuration.
set_irq_type() should only be used very sparingly and when there's no other option.
Anton Vorontsov
Acked-byQuoted 8 lines · Marek Vasut
Btw. I also reworked the wm97xx-battery a little more. Also, CCing power- supply people.
From
0c04c7f9cac26de8b4e401c17e65051c7f44ec3eMon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to useplatform_data
Quoted 6 lines
This patch converts the wm97xx driver to use
platform_datasupplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it'splatform_dataand prepares a structure for touchscreen driver.Signed-off-by Marek Vasut <[email protected]>---
drivers/power/wm97xx_battery.c static int __devinit wm97xx_bat_probe(struct platform_device *dev) · line 190
Quoted 4 lines
drivers/power/wm97xx_battery.c +4
-0+ ret =set_irq_type (gpio_to_irq (pdata->charge_gpio), +IRQ_TYPE_EDGE_BOTH ); +if (ret) + goto err2;
I always thought that request_irq() would set trigger type as necessary if you pass IRQF_TRIGGER_* flags, so there is no need for explicit set_irq_type() call?
This code in kernel/irq/manage.c:__setup_irq():
/* Setup the type (level, edge polarity) if configured: */
if (new->flags & IRQF_TRIGGER_MASK) {
ret = __irq_set_trigger(desc, irq,
new->flags & IRQF_TRIGGER_MASK);Quoted 5 lines
drivers/power/wm97xx_battery.c +5
-0+ ret =request_irq (gpio_to_irq (pdata->charge_gpio), + wm97xx_chrg_irq,IRQF_DISABLED , +"AC Detect" ,0 ); +if (ret) + goto err3;
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Dne St 22. července 2009 00:33:34 Russell King - ARM Linux napsal(a):
Quoted 17 lines · Marek Vasut
Review
Quoted 7 lines
(quoted diff) +7
-0+ ret = set_irq_type(gpio_to_irq(pdata->charge_gpio), + IRQ_TYPE_EDGE_BOTH); + if (ret) + goto err2; + ret = request_irq(gpio_to_irq(pdata->charge_gpio), + wm97xx_chrg_irq, IRQF_DISABLED, + "AC Detect", 0);This should be done as one call to
request_irq().Why?
If the IRQ is already in use by something else, calling
set_irq_type()will stamp on that other user, enforcing the change of configuration.request_irq()will then fail, leaving the IRQ configuration buggered.
Quoted 7 lines
Combining the two allows
request_irq()to fail if the IRQ line is busy. If it isn't busy, it will configure the IRQ line prior to enabling the IRQ. If the IRQ is shared and sharing is permitted, it will fail if the configuration is not compatible with the existing IRQ configuration.
set_irq_type()should only be used very sparingly and when there's no other option.
Sorry, I removed that, this patch should be OK.
From 54febe82847aeef3fcc02a074fd9d21def97f174 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to use platform_data
This patch converts the wm97xx driver to use platform_data supplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it's platform_data and prepares a structure for touchscreen driver.
--- drivers/input/touchscreen/wm97xx-core.c | 3 ++ drivers/power/wm97xx_battery.c | 55 ++++++++++++++++++++++-------- include/linux/wm97xx.h | 18 ++++++++++ include/linux/wm97xx_batt.h | 26 -------------- 4 files changed, 61 insertions(+), 41 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h
drivers/input/touchscreen/wm97xx-core.c +3 -0
@@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)static int wm97xx_probe (struct device *dev) {struct wm97xx *wm; +struct wm97xx_pdata *pdata = dev->platform_data;int ret =0 , id =0 ; wm =kzalloc (sizeof (struct wm97xx ),GFP_KERNEL );
@@ -658,6 +659,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; + wm->battery_dev->dev.platform_data = pdata; ret =platform_device_add (wm->battery_dev);if (ret <0 ) goto batt_reg_err;
@@ -671,6 +673,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->touch_dev, wm); wm->touch_dev->dev.parent = dev; + wm->touch_dev->dev.platform_data = pdata; ret =platform_device_add (wm->touch_dev);if (ret <0 ) goto touch_reg_err;
drivers/power/wm97xx_battery.c +40 -15
144 lines not on this page · raw message
include/linux/wm97xx.h +18 -0
@@ -293,6 +293,24 @@ struct wm97xx {u16 suspend_mode;/* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { +int batt_aux; +int temp_aux; +int charge_gpio; +int min_voltage; +int max_voltage; +int batt_div; +int batt_mult; +int temp_div; +int temp_mult; +int batt_tech; +char *batt_name; +}; + +struct wm97xx_pdata { +struct wm97xx_batt_pdata *batt_pdata;/* battery data */ +}; +/* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status.
include/linux/wm97xx_batt.h deleted +0 -26
@@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { -int batt_aux; -int temp_aux; -int charge_gpio; -int min_voltage; -int max_voltage; -int batt_div; -int batt_mult; -int temp_div; -int temp_mult; -int batt_tech; -char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) {} -#endif - -#endif
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne St 22. července 2009 00:39:00 Marek Vasut napsal(a):
Quoted 23 lines
Dne St 22. července 2009 00:33:34 Russell King - ARM Linux napsal(a):
Quoted 22 lines · Marek Vasut
Review
Quoted 7 lines
(quoted diff) +7
-0+ ret = set_irq_type(gpio_to_irq(pdata->charge_gpio), + IRQ_TYPE_EDGE_BOTH); + if (ret) + goto err2; + ret = request_irq(gpio_to_irq(pdata->charge_gpio), + wm97xx_chrg_irq, IRQF_DISABLED, + "AC Detect", 0);This should be done as one call to
request_irq().Why?
If the IRQ is already in use by something else, calling
set_irq_type()will stamp on that other user, enforcing the change of configuration.request_irq()will then fail, leaving the IRQ configuration buggered.Combining the two allows
request_irq()to fail if the IRQ line is busy. If it isn't busy, it will configure the IRQ line prior to enabling the IRQ. If the IRQ is shared and sharing is permitted, it will fail if the configuration is not compatible with the existing IRQ configuration.
Quoted 4 lines
Quoted 2 lines
set_irq_type()should only be used very sparingly and when there's no other option.Sorry, I removed that, this patch should be OK.
Argh, I forget to fix the goto label.
From 54febe82847aeef3fcc02a074fd9d21def97f174 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to use platform_data
This patch converts the wm97xx driver to use platform_data supplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it's platform_data and prepares a structure for touchscreen driver.
--- drivers/input/touchscreen/wm97xx-core.c | 3 ++ drivers/power/wm97xx_battery.c | 55 ++++++++++++++++++++++-------- include/linux/wm97xx.h | 18 ++++++++++ include/linux/wm97xx_batt.h | 26 -------------- 4 files changed, 61 insertions(+), 41 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h
drivers/input/touchscreen/wm97xx-core.c +3 -0
@@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)static int wm97xx_probe (struct device *dev) {struct wm97xx *wm; +struct wm97xx_pdata *pdata = dev->platform_data;int ret =0 , id =0 ; wm =kzalloc (sizeof (struct wm97xx ),GFP_KERNEL );
@@ -658,6 +659,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; + wm->battery_dev->dev.platform_data = pdata; ret =platform_device_add (wm->battery_dev);if (ret <0 ) goto batt_reg_err;
@@ -671,6 +673,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->touch_dev, wm); wm->touch_dev->dev.parent = dev; + wm->touch_dev->dev.platform_data = pdata; ret =platform_device_add (wm->touch_dev);if (ret <0 ) goto touch_reg_err;
drivers/power/wm97xx_battery.c +40 -15
144 lines not on this page · raw message
include/linux/wm97xx.h +18 -0
@@ -293,6 +293,24 @@ struct wm97xx {u16 suspend_mode;/* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { +int batt_aux; +int temp_aux; +int charge_gpio; +int min_voltage; +int max_voltage; +int batt_div; +int batt_mult; +int temp_div; +int temp_mult; +int batt_tech; +char *batt_name; +}; + +struct wm97xx_pdata { +struct wm97xx_batt_pdata *batt_pdata;/* battery data */ +}; +/* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status.
include/linux/wm97xx_batt.h deleted +0 -26
@@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { -int batt_aux; -int temp_aux; -int charge_gpio; -int min_voltage; -int max_voltage; -int batt_div; -int batt_mult; -int temp_div; -int temp_mult; -int batt_tech; -char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) {} -#endif - -#endif
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Dne St 22. července 2009 00:34:24 Anton Vorontsov napsal(a):
Quoted 34 lines · Marek Vasut
Quoted 8 lines
Btw. I also reworked the wm97xx-battery a little more. Also, CCing power- supply people.
From
0c04c7f9cac26de8b4e401c17e65051c7f44ec3eMon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to useplatform_dataQuoted 6 lines
This patch converts the wm97xx driver to use
platform_datasupplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it'splatform_dataand prepares a structure for touchscreen driver.Signed-off-by Marek Vasut <[email protected]>---
Acked-by Anton Vorontsov <[email protected]>Review
Quoted 4 lines
(quoted diff) +4
-0+ ret = set_irq_type(gpio_to_irq(pdata->charge_gpio), + IRQ_TYPE_EDGE_BOTH); + if (ret) + goto err2;I always thought that
request_irq()would set trigger type as necessary if you pass IRQF_TRIGGER_* flags, so there is no need for explicitset_irq_type()call?This code in kernel/irq/manage.c:__setup_irq():
/* Setup the type (level, edge polarity) if configured: */ if (new->flags & IRQF_TRIGGER_MASK) { ret = __irq_set_trigger(desc, irq, new->flags & IRQF_TRIGGER_MASK);
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ ret = request_irq(gpio_to_irq(pdata->charge_gpio), + wm97xx_chrg_irq, IRQF_DISABLED, + "AC Detect", 0); + if (ret) + goto err3;
Yes, sorry, I fixed this one. Btw. we can safely apply the attached patch then. This will need Robert's ack though (mioa701 change).
From 0ccf06e47672e0cc1795c18c701b6db79bdc2eea Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 19:22:13 +0200
Subject: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
--- arch/arm/mach-pxa/mioa701.c | 7 ++++++- arch/arm/mach-pxa/palmld.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmt5.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmte2.c | 20 ++++++++++++-------- arch/arm/mach-pxa/palmtx.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmz72.c | 20 ++++++++++++-------- arch/arm/mach-pxa/treo680.c | 1 - 7 files changed, 60 insertions(+), 45 deletions(-)
arch/arm/mach-pxa/mioa701.c +6 -1
@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h>
@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = { .batt_name = "mioa701_battery", }; +static struct wm97xx_pdata mioa701_wm97xx_pdata = { + .batt_pdata = &mioa701_battery_data, +}; +/* * Voltage regulation */
@@ -728,6 +732,7 @@ struct i2c_pxa_platform_data i2c_pdata = {static pxa2xx_audio_ops_t mioa701_ac97_info = { .reset_gpio =95 , + .codec_pdata = { &mioa701_wm97xx_pdata, }, };/*
arch/arm/mach-pxa/palmld.c +10 -9
@@ -22,7 +22,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/mtd/mtd.h>
@@ -406,9 +406,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmld_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -422,15 +422,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmld_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , +static struct wm97xx_pdata palmld_wm97xx_pdata = { + .batt_pdata = &palmld_batt_pdata, };static pxa2xx_audio_ops_t palmld_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmld_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmld_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , };static struct platform_device palmld_asoc = {
@@ -536,7 +538,6 @@ static void __init palmld_init(void)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);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmt5.c +10 -9
@@ -24,7 +24,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -317,9 +317,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmt5_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -333,15 +333,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmt5_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , +static struct wm97xx_pdata palmt5_wm97xx_pdata = { + .batt_pdata = &palmt5_batt_pdata, };static pxa2xx_audio_ops_t palmt5_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmt5_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmt5_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , };static struct platform_device palmt5_asoc = {
@@ -426,7 +428,6 @@ static void __init palmt5_init(void)pxa_set_ac97_info (&palmt5_ac97_pdata);pxa_set_ficp_info (&palmt5_ficp_platform_data);pxa_set_keypad_info (&palmt5_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmte2.c +12 -8
@@ -23,7 +23,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -290,9 +290,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmte2_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -306,9 +306,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmte2_wm97xx_pdata = { + .batt_pdata = &palmte2_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmte2_ac97_pdata = { + .codec_pdata = { &palmte2_wm97xx_pdata, }, +}; +static struct palm27x_asoc_info palmte2_asoc_pdata = { .jack_gpio =GPIO_NR_PALMTE2_EARPHONE_DETECT , };
@@ -376,9 +381,8 @@ static void __init palmte2_init(void)set_pxa_fb_info (&palmte2_lcd_screen);pxa_set_mci_info (&palmte2_mci_platform_data);palmte2_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmte2_ac97_pdata);pxa_set_ficp_info (&palmte2_ficp_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmtx.c +10 -9
@@ -25,7 +25,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/nand.h>
@@ -340,9 +340,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmtx_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -356,15 +356,17 @@ 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 struct wm97xx_pdata palmtx_wm97xx_pdata = { + .batt_pdata = &palmtx_batt_pdata, };static pxa2xx_audio_ops_t palmtx_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmtx_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmtx_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMTX_EARPHONE_DETECT , };static struct platform_device palmtx_asoc = {
@@ -538,7 +540,6 @@ static void __init palmtx_init(void)pxa_set_ac97_info (&palmtx_ac97_pdata);pxa_set_ficp_info (&palmtx_ficp_platform_data);pxa_set_keypad_info (&palmtx_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmz72.c +12 -8
@@ -27,7 +27,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -343,9 +343,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmz72_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -359,9 +359,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmz72_wm97xx_pdata = { + .batt_pdata = &palmz72_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmz72_ac97_pdata = { + .codec_pdata = { &palmz72_wm97xx_pdata, }, +}; +static struct platform_device palmz72_asoc = { .name ="palm27x-asoc" , .id =-1 ,
@@ -494,10 +499,9 @@ static void __init palmz72_init(void)set_pxa_fb_info (&palmz72_lcd_screen);pxa_set_mci_info (&palmz72_mci_platform_data);palmz72_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmz72_ac97_pdata);pxa_set_ficp_info (&palmz72_ficp_platform_data);pxa_set_keypad_info (&palmz72_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/treo680.c +0 -1
@@ -19,7 +19,6 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/w1-gpio.h>
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 1 line · Marek Vasut
Ok, this one should be better then? Mark, thanks for guiding me :-)
There's so many patches flying around here that I've completely lost track of what the current state of play is. Could you please repost as a new patch series, ideally as a normal submission with meaningful per patch subject headers.
PATCH 1/4 Allow passing platform_data to devices attached to AC97 bus
Dne St 22. července 2009 12:40:29 Mark Brown napsal(a):
Quoted 7 lines · Marek Vasut
Quoted 1 line
Ok, this one should be better then? Mark, thanks for guiding me :-)
There's so many patches flying around here that I've completely lost track of what the current state of play is. Could you please repost as a new patch series, ideally as a normal submission with meaningful per patch subject headers.
From 5ed7859b282c23c2f98167ef3f821625ee8907aa Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/4] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 6 +++++- 3 files changed, 12 insertions(+), 1 deletions(-)
include/sound/ac97_codec.h +6 -0
@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +static inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/soc/soc-core.c +5 -1
@@ -28,6 +28,7 @@#include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/platform_device.h> +#include <sound/ac97_codec.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h>
@@ -1381,8 +1382,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; +snd_ac97_dev_add_pdata (codec->ac97, + card->dai_link[i].cpu_dai->ac97_pdata); + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/4 Allow passing platform_data to devices attached to AC97 bus
In reply to Anton VorontsovOk,
Im sending the set again.
From 5ed7859b282c23c2f98167ef3f821625ee8907aa Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/4] Allow passing platform_data to devices attached to AC97 bus
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
--- include/sound/ac97_codec.h | 6 ++++++ include/sound/soc-dai.h | 1 + sound/soc/soc-core.c | 6 +++++- 3 files changed, 12 insertions(+), 1 deletions(-)
include/sound/ac97_codec.h +6 -0
@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);/* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; +/* AC97 platform_data adding function */ +static inline void snd_ac97_dev_add_pdata (struct snd_ac97 *ac97,void *data) +{ + ac97->dev.platform_data = data; +} +#endif /* __SOUND_AC97_CODEC_H */
include/sound/soc-dai.h +1 -0
@@ -179,6 +179,7 @@ struct snd_soc_dai {int ac97_control;struct device *dev; +void *ac97_pdata;/* platform_data for the ac97 codec */ /* DAI callbacks */ int (*probe)(struct platform_device *pdev,
sound/soc/soc-core.c +5 -1
@@ -28,6 +28,7 @@#include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/platform_device.h> +#include <sound/ac97_codec.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h>
@@ -1381,8 +1382,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)continue ; } } -if (card->dai_link[i].codec_dai->ac97_control) +if (card->dai_link[i].codec_dai->ac97_control) { ac97 =1 ; +snd_ac97_dev_add_pdata (codec->ac97, + card->dai_link[i].cpu_dai->ac97_pdata); + } }snprintf (codec->card->shortname,sizeof (codec->card->shortname),"%s" , card->name);
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/4 Allow passing platform_data for pxa2xx-ac97
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.
From 76c511499fa6115cdd7dd4c2fbf436b38cb7b8a1 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 3 +++ sound/soc/pxa/pxa2xx-ac97.c | 7 ++++++- 4 files changed, 15 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +3 -0
@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */
sound/arm/pxa2xx-ac97.c +3 -0
@@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id; ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +202,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[id], pdata->codec_pdata[id]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
sound/soc/pxa/pxa2xx-ac97.c +6 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,13 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata + [pdev->id <0 ?0 : pdev->id]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 3/4 Convert WM97xx driver to use platform_data
In reply to Marek VasutDne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.
This one should be acked by Anton already.
From 54febe82847aeef3fcc02a074fd9d21def97f174 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to use platform_data
This patch converts the wm97xx driver to use platform_data supplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it's platform_data and prepares a structure for touchscreen driver.
--- drivers/input/touchscreen/wm97xx-core.c | 3 ++ drivers/power/wm97xx_battery.c | 55 ++++++++++++++++++++++-------- include/linux/wm97xx.h | 18 ++++++++++ include/linux/wm97xx_batt.h | 26 -------------- 4 files changed, 61 insertions(+), 41 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h
drivers/input/touchscreen/wm97xx-core.c +3 -0
@@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)static int wm97xx_probe (struct device *dev) {struct wm97xx *wm; +struct wm97xx_pdata *pdata = dev->platform_data;int ret =0 , id =0 ; wm =kzalloc (sizeof (struct wm97xx ),GFP_KERNEL );
@@ -658,6 +659,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; + wm->battery_dev->dev.platform_data = pdata; ret =platform_device_add (wm->battery_dev);if (ret <0 ) goto batt_reg_err;
@@ -671,6 +673,7 @@ static int wm97xx_probe(struct device *dev) }platform_set_drvdata (wm->touch_dev, wm); wm->touch_dev->dev.parent = dev; + wm->touch_dev->dev.platform_data = pdata; ret =platform_device_add (wm->touch_dev);if (ret <0 ) goto touch_reg_err;
drivers/power/wm97xx_battery.c +40 -15
144 lines not on this page · raw message
include/linux/wm97xx.h +18 -0
@@ -293,6 +293,24 @@ struct wm97xx {u16 suspend_mode;/* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { +int batt_aux; +int temp_aux; +int charge_gpio; +int min_voltage; +int max_voltage; +int batt_div; +int batt_mult; +int temp_div; +int temp_mult; +int batt_tech; +char *batt_name; +}; + +struct wm97xx_pdata { +struct wm97xx_batt_pdata *batt_pdata;/* battery data */ +}; +/* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status.
include/linux/wm97xx_batt.h deleted +0 -26
@@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { -int batt_aux; -int temp_aux; -int charge_gpio; -int min_voltage; -int max_voltage; -int batt_div; -int batt_mult; -int temp_div; -int temp_mult; -int batt_tech; -char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) {} -#endif - -#endif
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 4/4 Convert all platforms to pass platform_data to wm97xx battery
In reply to Marek VasutDne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.
And this does the platform conversion. Depends on 3/4 and should be Acked by Robert. So please.
Thanks for your patience (especially yours, Mark)
From 0ccf06e47672e0cc1795c18c701b6db79bdc2eea Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 19:22:13 +0200
Subject: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
--- arch/arm/mach-pxa/mioa701.c | 7 ++++++- arch/arm/mach-pxa/palmld.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmt5.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmte2.c | 20 ++++++++++++-------- arch/arm/mach-pxa/palmtx.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmz72.c | 20 ++++++++++++-------- arch/arm/mach-pxa/treo680.c | 1 - 7 files changed, 60 insertions(+), 45 deletions(-)
arch/arm/mach-pxa/mioa701.c +6 -1
@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h>
@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = { .batt_name = "mioa701_battery", }; +static struct wm97xx_pdata mioa701_wm97xx_pdata = { + .batt_pdata = &mioa701_battery_data, +}; +/* * Voltage regulation */
@@ -728,6 +732,7 @@ struct i2c_pxa_platform_data i2c_pdata = {static pxa2xx_audio_ops_t mioa701_ac97_info = { .reset_gpio =95 , + .codec_pdata = { &mioa701_wm97xx_pdata, }, };/*
arch/arm/mach-pxa/palmld.c +10 -9
@@ -22,7 +22,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/mtd/mtd.h>
@@ -406,9 +406,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmld_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -422,15 +422,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmld_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , +static struct wm97xx_pdata palmld_wm97xx_pdata = { + .batt_pdata = &palmld_batt_pdata, };static pxa2xx_audio_ops_t palmld_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmld_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmld_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , };static struct platform_device palmld_asoc = {
@@ -536,7 +538,6 @@ static void __init palmld_init(void)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);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmt5.c +10 -9
@@ -24,7 +24,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -317,9 +317,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmt5_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -333,15 +333,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmt5_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , +static struct wm97xx_pdata palmt5_wm97xx_pdata = { + .batt_pdata = &palmt5_batt_pdata, };static pxa2xx_audio_ops_t palmt5_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmt5_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmt5_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , };static struct platform_device palmt5_asoc = {
@@ -426,7 +428,6 @@ static void __init palmt5_init(void)pxa_set_ac97_info (&palmt5_ac97_pdata);pxa_set_ficp_info (&palmt5_ficp_platform_data);pxa_set_keypad_info (&palmt5_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmte2.c +12 -8
@@ -23,7 +23,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -290,9 +290,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmte2_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -306,9 +306,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmte2_wm97xx_pdata = { + .batt_pdata = &palmte2_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmte2_ac97_pdata = { + .codec_pdata = { &palmte2_wm97xx_pdata, }, +}; +static struct palm27x_asoc_info palmte2_asoc_pdata = { .jack_gpio =GPIO_NR_PALMTE2_EARPHONE_DETECT , };
@@ -376,9 +381,8 @@ static void __init palmte2_init(void)set_pxa_fb_info (&palmte2_lcd_screen);pxa_set_mci_info (&palmte2_mci_platform_data);palmte2_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmte2_ac97_pdata);pxa_set_ficp_info (&palmte2_ficp_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmtx.c +10 -9
@@ -25,7 +25,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/nand.h>
@@ -340,9 +340,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmtx_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -356,15 +356,17 @@ 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 struct wm97xx_pdata palmtx_wm97xx_pdata = { + .batt_pdata = &palmtx_batt_pdata, };static pxa2xx_audio_ops_t palmtx_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmtx_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmtx_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMTX_EARPHONE_DETECT , };static struct platform_device palmtx_asoc = {
@@ -538,7 +540,6 @@ static void __init palmtx_init(void)pxa_set_ac97_info (&palmtx_ac97_pdata);pxa_set_ficp_info (&palmtx_ficp_platform_data);pxa_set_keypad_info (&palmtx_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmz72.c +12 -8
@@ -27,7 +27,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -343,9 +343,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmz72_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -359,9 +359,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmz72_wm97xx_pdata = { + .batt_pdata = &palmz72_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmz72_ac97_pdata = { + .codec_pdata = { &palmz72_wm97xx_pdata, }, +}; +static struct platform_device palmz72_asoc = { .name ="palm27x-asoc" , .id =-1 ,
@@ -494,10 +499,9 @@ static void __init palmz72_init(void)set_pxa_fb_info (&palmz72_lcd_screen);pxa_set_mci_info (&palmz72_mci_platform_data);palmz72_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmz72_ac97_pdata);pxa_set_ficp_info (&palmz72_ficp_platform_data);pxa_set_keypad_info (&palmz72_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/treo680.c +0 -1
@@ -19,7 +19,6 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/w1-gpio.h>
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Robert Jarzmik
maintainerRe: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
Quoted 5 lines · Marek Vasut
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.And this does the platform conversion. Depends on 3/4 and should be Acked by Robert. So please.
Well, there are 2 things wrong with the mioa701 part.
arch/arm/mach-pxa/mioa701.c static struct wm97xx_batt_info mioa701_battery_data = {
Quoted 14 lines
arch/arm/mach-pxa/mioa701.c +1
-1@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h> @@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = {
(1) \-> should be wm97xx_batt_pdata
(2) remove wm97xx_bat_set_pdata(&mioa701_battery_data) call in mioa701_machine_init().
I'll try to test this evening, and report.
Cheers.
--
Robert
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
Dne St 22. července 2009 20:09:09 Robert Jarzmik napsal(a):
Quoted 31 lines
Quoted 6 lines · Marek Vasut
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.And this does the platform conversion. Depends on 3/4 and should be Acked by Robert. So please.
Well, there are 2 things wrong with the mioa701 part.
Quoted 14 lines
arch/arm/mach-pxa/mioa701.c +1
-1@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h> arch/arm/mach-pxa/mioa701.c static struct wm97xx_batt_info mioa701_battery_data · line 660
Quoted 1 line
arch/arm/mach-pxa/mioa701.c +0
-0@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = {(1) \-> should be
wm97xx_batt_pdata(2) remove
wm97xx_bat_set_pdata(&mioa701_battery_data)call inmioa701_machine_init().
Quoted 6 lines
I'll try to test this evening, and report.
Cheers.
--
Robert
Thanks! Here's a fixed patch.
From 3f6fa6d7fb1ac1959b612580151248c222d63a68 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 19:22:13 +0200
Subject: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
--- arch/arm/mach-pxa/mioa701.c | 10 +++++++--- arch/arm/mach-pxa/palmld.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmt5.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmte2.c | 20 ++++++++++++-------- arch/arm/mach-pxa/palmtx.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmz72.c | 20 ++++++++++++-------- arch/arm/mach-pxa/treo680.c | 1 - 7 files changed, 61 insertions(+), 47 deletions(-)
arch/arm/mach-pxa/mioa701.c +7 -3
@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h>
@@ -648,7 +648,7 @@ static struct platform_device power_dev = { }, }; -static struct wm97xx_batt_info mioa701_battery_data = { +static struct wm97xx_batt_pdata mioa701_battery_data = { .batt_aux =WM97XX_AUX_ID1 , .temp_aux =-1 , .charge_gpio =-1 ,
@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = { .batt_name = "mioa701_battery", }; +static struct wm97xx_pdata mioa701_wm97xx_pdata = { + .batt_pdata = &mioa701_battery_data, +}; +/* * Voltage regulation */
@@ -728,6 +732,7 @@ struct i2c_pxa_platform_data i2c_pdata = {static pxa2xx_audio_ops_t mioa701_ac97_info = { .reset_gpio =95 , + .codec_pdata = { &mioa701_wm97xx_pdata, }, };/*
@@ -804,7 +809,6 @@ static void __init mioa701_machine_init(void) mioa701_mci_info.detect_delay =msecs_to_jiffies (250 );pxa_set_mci_info (&mioa701_mci_info);pxa_set_keypad_info (&mioa701_keypad_info); -wm97xx_bat_set_pdata (&mioa701_battery_data);pxa_set_udc_info (&mioa701_udc_info);pxa_set_ac97_info (&mioa701_ac97_info); pm_power_off = mioa701_poweroff;
arch/arm/mach-pxa/palmld.c +10 -9
@@ -22,7 +22,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/mtd/mtd.h>
@@ -406,9 +406,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmld_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -422,15 +422,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmld_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , +static struct wm97xx_pdata palmld_wm97xx_pdata = { + .batt_pdata = &palmld_batt_pdata, };static pxa2xx_audio_ops_t palmld_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmld_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmld_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , };static struct platform_device palmld_asoc = {
@@ -536,7 +538,6 @@ static void __init palmld_init(void)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);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmt5.c +10 -9
@@ -24,7 +24,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -317,9 +317,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmt5_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -333,15 +333,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmt5_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , +static struct wm97xx_pdata palmt5_wm97xx_pdata = { + .batt_pdata = &palmt5_batt_pdata, };static pxa2xx_audio_ops_t palmt5_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmt5_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmt5_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , };static struct platform_device palmt5_asoc = {
@@ -426,7 +428,6 @@ static void __init palmt5_init(void)pxa_set_ac97_info (&palmt5_ac97_pdata);pxa_set_ficp_info (&palmt5_ficp_platform_data);pxa_set_keypad_info (&palmt5_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmte2.c +12 -8
@@ -23,7 +23,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -290,9 +290,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmte2_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -306,9 +306,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmte2_wm97xx_pdata = { + .batt_pdata = &palmte2_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmte2_ac97_pdata = { + .codec_pdata = { &palmte2_wm97xx_pdata, }, +}; +static struct palm27x_asoc_info palmte2_asoc_pdata = { .jack_gpio =GPIO_NR_PALMTE2_EARPHONE_DETECT , };
@@ -376,9 +381,8 @@ static void __init palmte2_init(void)set_pxa_fb_info (&palmte2_lcd_screen);pxa_set_mci_info (&palmte2_mci_platform_data);palmte2_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmte2_ac97_pdata);pxa_set_ficp_info (&palmte2_ficp_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmtx.c +10 -9
@@ -25,7 +25,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/nand.h>
@@ -340,9 +340,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmtx_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -356,15 +356,17 @@ 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 struct wm97xx_pdata palmtx_wm97xx_pdata = { + .batt_pdata = &palmtx_batt_pdata, };static pxa2xx_audio_ops_t palmtx_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmtx_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmtx_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMTX_EARPHONE_DETECT , };static struct platform_device palmtx_asoc = {
@@ -538,7 +540,6 @@ static void __init palmtx_init(void)pxa_set_ac97_info (&palmtx_ac97_pdata);pxa_set_ficp_info (&palmtx_ficp_platform_data);pxa_set_keypad_info (&palmtx_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmz72.c +12 -8
@@ -27,7 +27,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -343,9 +343,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_info palmz72_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -359,9 +359,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmz72_wm97xx_pdata = { + .batt_pdata = &palmz72_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmz72_ac97_pdata = { + .codec_pdata = { &palmz72_wm97xx_pdata, }, +}; +static struct platform_device palmz72_asoc = { .name ="palm27x-asoc" , .id =-1 ,
@@ -494,10 +499,9 @@ static void __init palmz72_init(void)set_pxa_fb_info (&palmz72_lcd_screen);pxa_set_mci_info (&palmz72_mci_platform_data);palmz72_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmz72_ac97_pdata);pxa_set_ficp_info (&palmz72_ficp_platform_data);pxa_set_keypad_info (&palmz72_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/treo680.c +0 -1
@@ -19,7 +19,6 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/w1-gpio.h>
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 4 lines · Marek Vasut
This patch allows passing
platform_datato devices attached to AC97 bus (like touchscreens, battery measurement chips ...).Signed-off-by Marek Vasut <[email protected]>
Takashi, should I apply this to ASoC or do you want to merge it given that it touches ALSA core stuff?
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
In reply to Marek Vasutsound/arm/pxa2xx-ac97.c static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) · line 174
Quoted 6 lines · Marek Vasut
sound/arm/pxa2xx-ac97.c +2
-0struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id;
dev here is the AC97 controller device - if there's more than one AC97 controller in the system they can each have the four child devices. On the other hand, I don't think any of the PXA processors have more than one AC97 controller so it'll never actually have any impact.
I think the best thing for now is to either warn if anything except the primary codec has platform data or change the platform data to have a variable something like primary_audio_pdata. The driver doesn't appear to support secondary codecs anyway.
At Thu, 23 Jul 2009 11:16:55 +0100,
Quoted 6 lines · Mark Brown
Quoted 3 lines · Marek Vasut
This patch allows passing
platform_datato devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
Quoted 6 lines
Quoted 1 line
Signed-off-by Marek Vasut <[email protected]>Acked-by Mark Brown <[email protected]>Takashi, should I apply this to ASoC or do you want to merge it given that it touches ALSA core stuff?
Feel free to take it into your tree. The core (ac97) change is used only by ASoC as now, and above all, it doesn't break anything else.
thanks,
Takashi
Quoted 2 lines · Takashi Iwai
Feel free to take it into your tree. The core (ac97) change is used only by ASoC as now, and above all, it doesn't break anything else.
OK, applied now.
Re: [PATCH 3/4] Convert WM97xx driver to use platform_data
In reply to Marek VasutQuoted 20 lines · Marek Vasut
drivers/input/touchscreen/wm97xx-core.c +3
-1@@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)static int wm97xx_probe (struct device *dev) {struct wm97xx *wm; +struct wm97xx_pdata *pdata = dev->platform_data;int ret =0 , id =0 ; wm =kzalloc (sizeof (struct wm97xx ),GFP_KERNEL ); +++ b/drivers/power/wm97xx_battery.c@@ -22,17 +22,19 @@#include <linux/spinlock.h> #include <linux/interrupt.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/irq.h>
...
Quoted 11 lines
drivers/input/touchscreen/wm97xx-core.c +7
-1+static irqreturn_t wm97xx_chrg_irq (int irq,void *data) +{ +schedule_work (&bat_work); +return IRQ_HANDLED ; +} + -if (pdata->charge_gpio >=0 &&gpio_is_valid (pdata->charge_gpio)) { +if (gpio_is_valid (pdata->charge_gpio)) { ret =gpio_request (pdata->charge_gpio,"BATT CHRG" );if (ret)
drivers/input/touchscreen/wm97xx-core.c
Quoted 10 lines
drivers/input/touchscreen/wm97xx-core.c +5
-0goto err; ret =gpio_direction_input (pdata->charge_gpio);if (ret) goto err2; + ret =request_irq (gpio_to_irq (pdata->charge_gpio), + wm97xx_chrg_irq,IRQF_DISABLED , +"AC Detect" ,0 ); +if (ret) + goto err2; props++;/* POWER_SUPPLY_PROP_STATUS */
None of these hunks appear to be related to the change in where the platform data is coming from and should be split out, as should all the error handling code which follows.
drivers/input/touchscreen/wm97xx-core.c
Quoted 6 lines
drivers/input/touchscreen/wm97xx-core.c +0
-6-void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) -{ - pdata = data; -} -EXPORT_SYMBOL_GPL (wm97xx_bat_set_pdata); -
This change and the removal of the old structure should ideally be included in the commit which converts all the users to avoid build errors during bisection. I'd say it's OK to have the driver just print a warning or something if someone boots the affected kernel during the transition period.
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
In reply to Mark BrownDne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
Quoted 12 lines · Marek Vasut
Review
Quoted 5 lines
(quoted diff) +2
-0struct snd_ac97_bus *ac97_bus; struct snd_ac97_template ac97_template; int ret; + pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + int id = dev->id < 0 ? 0 : dev->id;dev here is the AC97 controller device - if there's more than one AC97 controller in the system they can each have the four child devices. On the other hand, I don't think any of the PXA processors have more than one AC97 controller so it'll never actually have any impact.
Quoted 4 lines
I think the best thing for now is to either warn if anything except the primary codec has platform data or change the platform data to have a variable something like
primary_audio_pdata. The driver doesn't appear to support secondary codecs anyway.
Ok, here's a fixed patch.
From 645d82cc2621b992ceb1e164e7fca182a2c321d4 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/4] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 9 +++++++++ sound/soc/pxa/pxa2xx-ac97.c | 11 ++++++++++- 4 files changed, 25 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +3 -0
@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */
sound/arm/pxa2xx-ac97.c +9 -0
@@ -170,6 +170,13 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + +if (dev->id >=0 ) { +dev_err (&dev->dev,"PXA2xx has only one AC97 port.\n" ); + ret = -ENXIO ; + goto err_dev; + } ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +207,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[0 ], pdata->codec_pdata[0 ]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
@@ -212,6 +220,7 @@ err_remove: err:if (card)snd_card_free (card); +err_dev:return ret; }
sound/soc/pxa/pxa2xx-ac97.c +10 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,17 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +if (pdev->id >=0 ) { +dev_err (&dev->dev,"PXA2xx has only one AC97 port.\n" ); +return -ENXIO ; + } + +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata[0 ]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
Quoted 2 lines · Marek Vasut
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
I'm OK with this. Eric any issues?
Quoted 116 lines
Signed-off-by Marek Vasut <[email protected]>--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 9 +++++++++ sound/soc/pxa/pxa2xx-ac97.c | 11 ++++++++++- 4 files changed, 25 insertions(+), 1 deletions(-)arch/arm/mach-pxa/include/mach/audio.h +3
-0@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified, @@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);include/sound/ac97_codec.h +3
-0@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */ sound/arm/pxa2xx-ac97.c +9
-0@@ -170,6 +170,13 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + +if (dev->id >=0 ) { +dev_err (&dev->dev,"PXA2xx has only one AC97 port.\n" ); + ret = -ENXIO ; + goto err_dev; + } ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);@@ -200,6 +207,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[0 ], pdata->codec_pdata[0 ]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {@@ -212,6 +220,7 @@ err_remove: err:if (card)snd_card_free (card); +err_dev:return ret; }sound/soc/pxa/pxa2xx-ac97.c +10
-1@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h" @@ -241,9 +242,17 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +if (pdev->id >=0 ) { +dev_err (&dev->dev,"PXA2xx has only one AC97 port.\n" ); +return -ENXIO ; + } + +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata[0 ]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up Signature · 1 line
1.6.3.3
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
In reply to Marek VasutDne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
Quoted 13 lines
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
Quoted 12 lines · Marek Vasut
Review
Quoted 5 lines
(quoted diff) +2
-0struct snd_ac97_bus *ac97_bus; struct snd_ac97_template ac97_template; int ret; + pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + int id = dev->id < 0 ? 0 : dev->id;dev here is the AC97 controller device - if there's more than one AC97 controller in the system they can each have the four child devices. On the other hand, I don't think any of the PXA processors have more than one AC97 controller so it'll never actually have any impact.
Quoted 6 lines
Quoted 4 lines
I think the best thing for now is to either warn if anything except the primary codec has platform data or change the platform data to have a variable something like
primary_audio_pdata. The driver doesn't appear to support secondary codecs anyway.Ok, here's a fixed patch.
Argh, one more iteration here. There was a typo in the previous patch. Sorry.
From 645d82cc2621b992ceb1e164e7fca182a2c321d4 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH 1/4] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 9 +++++++++ sound/soc/pxa/pxa2xx-ac97.c | 11 ++++++++++- 4 files changed, 25 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +3 -0
@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */
sound/arm/pxa2xx-ac97.c +9 -0
@@ -170,6 +170,13 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + +if (dev->id >=0 ) { +dev_err (&dev->dev,"PXA2xx has only one AC97 port.\n" ); + ret = -ENXIO ; + goto err_dev; + } ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +207,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +snd_ac97_dev_add_pdata (ac97_bus->codec[0 ], pdata->codec_pdata[0 ]);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
@@ -212,6 +220,7 @@ err_remove: err:if (card)snd_card_free (card); +err_dev:return ret; }
sound/soc/pxa/pxa2xx-ac97.c +10 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,17 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +if (pdev->id >=0 ) { +dev_err (&pdev->dev,"PXA2xx has only one AC97 port.\n" ); +return -ENXIO ; + } + +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata[0 ]; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Robert Jarzmik
maintainerRe: [PATCH 3/4] Convert WM97xx driver to use platform_data
In reply to Marek VasutQuoted 18 lines · Marek Vasut
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.This one should be acked by Anton already.
From
54febe82847aeef3fcc02a074fd9d21def97f174Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to useplatform_dataThis patch converts the wm97xx driver to use
platform_datasupplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it'splatform_dataand prepares a structure for touchscreen driver.Signed-off-by Marek Vasut <[email protected]>
drivers/power/wm97xx_battery.c static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps) · line 108
Quoted 4 lines
drivers/power/wm97xx_battery.c +1
-0@@ -97,6 +105,7 @@ static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps)static void wm97xx_bat_update (struct power_supply *bat_ps) {int old_status = bat_status; +struct wm97xx_batt_pdata *pdata =dev_get_drvdata (bat_ps->dev->parent);
Are you sure of this line ?
Because when I add this line next to it :
printk(KERN_INFO "RJK: charge_gpio = %d\n", pdata->charge_gpio); I get : [ 160.079239] power_supply mioa701_battery: prop VOLTAGE_NOW=4012 [ 160.089767] power_supply mioa701_battery: prop VOLTAGE_MAX=4032 [ 160.099772] power_supply mioa701_battery: prop VOLTAGE_MIN=3072 [ 160.111776] RJK: charge_gpio = 260440062
Needless to say that my kernel doesn't boot in that case (because of the following gpio_get_value()). I was expecting to have "-1" in my printk.
Cheers.
--
Robert
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 3/4] Convert WM97xx driver to use platform_data
Dne Pá 24. července 2009 21:44:01 Robert Jarzmik napsal(a):
Quoted 34 lines
Quoted 21 lines · Marek Vasut
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.This one should be acked by Anton already.
From
54febe82847aeef3fcc02a074fd9d21def97f174Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 18:52:28 +0200
Subject: [PATCH 3/4] Convert WM97xx driver to useplatform_dataThis patch converts the wm97xx driver to use
platform_datasupplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it'splatform_dataand prepares a structure for touchscreen driver.Signed-off-by Marek Vasut <[email protected]>(quoted diff) +0
-0@@ -97,6 +105,7 @@ static void wm97xx_bat_external_power_changed(struct
power_supply*bat_ps) static voidwm97xx_bat_update(struct power_supply *bat_ps)
{Review
Quoted 2 lines
(quoted diff) +1
-0int old_status = bat_status; + struct wm97xx_batt_pdata *pdata = dev_get_drvdata(bat_ps->dev->parent);Are you sure of this line ?
Because when I add this line next to it :printk(KERN_INFO "RJK: charge_gpio = %d\n", pdata->charge_gpio); I get : [ 160.079239] power_supply mioa701_battery: prop VOLTAGE_NOW=4012 [ 160.089767] power_supply mioa701_battery: prop VOLTAGE_MAX=4032 [ 160.099772] power_supply mioa701_battery: prop VOLTAGE_MIN=3072 [ 160.111776] RJK: charge_gpio = 260440062
Quoted 2 lines
Needless to say that my kernel doesn't boot in that case (because of the following
gpio_get_value()). I was expecting to have "-1" in my printk.
Argh ... right. Thanks, try attached patch.
Quoted 5 lines
Cheers.
--
Robert
From 532c7e0d33c2366e658d13fcb57b68786307b74a Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Thu, 23 Jul 2009 15:52:08 +0200
Subject: [PATCH 3/7] Convert WM97xx battery to use platform_data
This patch converts the wm97xx-battery driver to use platform_data supplied by ac97 bus.
--- drivers/power/wm97xx_battery.c | 26 +++++++++++++++++--------- include/linux/wm97xx.h | 18 ++++++++++++++++++ include/linux/wm97xx_batt.h | 26 -------------------------- 3 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h
drivers/power/wm97xx_battery.c +17 -9
@@ -22,17 +22,18 @@#include <linux/spinlock.h> #include <linux/interrupt.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> static DEFINE_MUTEX (bat_lock);static struct work_struct bat_work;struct mutex work_lock;static int bat_status =POWER_SUPPLY_STATUS_UNKNOWN ; -static struct wm97xx_batt_info *pdata;static enum power_supply_property *prop;static unsigned long wm97xx_read_bat (struct power_supply *bat_ps) { +struct wm97xx_pdata *wmdata = bat_ps->dev->parent->platform_data; +struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; +return wm97xx_read_aux_adc (bat_ps->dev->parent->driver_data, pdata->batt_aux) * pdata->batt_mult / pdata->batt_div;
@@ -40,6 +41,9 @@ static unsigned long wm97xx_read_bat(struct power_supply *bat_ps)static unsigned long wm97xx_read_temp (struct power_supply *bat_ps) { +struct wm97xx_pdata *wmdata = bat_ps->dev->parent->platform_data; +struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; +return wm97xx_read_aux_adc (bat_ps->dev->parent->driver_data, pdata->temp_aux) * pdata->temp_mult / pdata->temp_div;
@@ -49,6 +53,9 @@ static int wm97xx_bat_get_property(struct power_supply *bat_ps,enum power_supply_property psp, union power_supply_propval *val) { + struct wm97xx_pdata *wmdata = bat_ps->dev->parent->platform_data; +struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; +switch (psp) {case POWER_SUPPLY_PROP_STATUS : val->intval = bat_status;
@@ -97,6 +104,8 @@ static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps)static void wm97xx_bat_update (struct power_supply *bat_ps) {int old_status = bat_status; +struct wm97xx_pdata *wmdata = bat_ps->dev->parent->platform_data; +struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata;mutex_lock (&work_lock);
@@ -149,6 +158,8 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)int ret =0 ;int props =1 ;/* POWER_SUPPLY_PROP_PRESENT */ int i =0 ; +struct wm97xx_pdata *wmdata = dev->dev.platform_data; +struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata;if (dev->id !=-1 )return -EINVAL ;
@@ -156,7 +167,7 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)mutex_init (&work_lock);if (!pdata) { -dev_err (&dev->dev,"Please use wm97xx_bat_set_pdata\n" ); +dev_err (&dev->dev,"No platform_data supplied\n" );return -EINVAL ; }
@@ -229,6 +240,9 @@ err: static int __devexit wm97xx_bat_remove(struct platform_device *dev) { +struct wm97xx_pdata *wmdata = dev->dev.platform_data; +struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; +if (pdata && pdata->charge_gpio && pdata->charge_gpio >=0 )gpio_free (pdata->charge_gpio);flush_scheduled_work ();
@@ -258,12 +272,6 @@ static void __exit wm97xx_bat_exit(void)platform_driver_unregister (&wm97xx_bat_driver); } -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) -{ - pdata = data; -} -EXPORT_SYMBOL_GPL (wm97xx_bat_set_pdata); -module_init (wm97xx_bat_init);module_exit (wm97xx_bat_exit);
include/linux/wm97xx.h +18 -0
@@ -293,6 +293,24 @@ struct wm97xx {u16 suspend_mode;/* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { +int batt_aux; +int temp_aux; +int charge_gpio; +int min_voltage; +int max_voltage; +int batt_div; +int batt_mult; +int temp_div; +int temp_mult; +int batt_tech; +char *batt_name; +}; + +struct wm97xx_pdata { +struct wm97xx_batt_pdata *batt_pdata;/* battery data */ +}; +/* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status.
include/linux/wm97xx_batt.h deleted +0 -26
@@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { -int batt_aux; -int temp_aux; -int charge_gpio; -int min_voltage; -int max_voltage; -int batt_div; -int batt_mult; -int temp_div; -int temp_mult; -int batt_tech; -char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata (struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata (struct wm97xx_batt_info *data) {} -#endif - -#endif
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
In reply to Marek VasutQuoted 3 lines · Marek Vasut
Thanks! Here's a fixed patch.
For the mioa701 part :
Cheers.
Signature · 1 line
Robert
Re: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
In reply to Marek VasutDne St 22. července 2009 20:30:42 Marek Vasut napsal(a):
Quoted 32 lines
Dne St 22. července 2009 20:09:09 Robert Jarzmik napsal(a):
Quoted 31 lines
Quoted 6 lines · Marek Vasut
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
Quoted 2 lines
Ok,
Im sending the set again.And this does the platform conversion. Depends on 3/4 and should be Acked by Robert. So please.
Well, there are 2 things wrong with the mioa701 part.
Quoted 14 lines
arch/arm/mach-pxa/mioa701.c +1
-1@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h> arch/arm/mach-pxa/mioa701.c static struct wm97xx_batt_info · line 660
Quoted 1 line
arch/arm/mach-pxa/mioa701.c +0
-0@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = {(1) \-> should be
wm97xx_batt_pdata(2) remove
wm97xx_bat_set_pdata(&mioa701_battery_data)call inmioa701_machine_init().
Quoted 8 lines
Quoted 6 lines
I'll try to test this evening, and report.
Cheers.
--
RobertThanks! Here's a fixed patch.
Looks like this isnt only a problem with mio. I missed the change to pdata in palmte2 and z72 too, sorry. I compile-tested it now so this one should be OK.
From 3f6fa6d7fb1ac1959b612580151248c222d63a68 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 19:22:13 +0200
Subject: [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery
--- arch/arm/mach-pxa/mioa701.c | 10 +++++++--- arch/arm/mach-pxa/palmld.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmt5.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmte2.c | 20 ++++++++++++-------- arch/arm/mach-pxa/palmtx.c | 19 ++++++++++--------- arch/arm/mach-pxa/palmz72.c | 20 ++++++++++++-------- arch/arm/mach-pxa/treo680.c | 1 - 7 files changed, 61 insertions(+), 47 deletions(-)
arch/arm/mach-pxa/mioa701.c +7 -3
@@ -34,7 +34,7 @@#include <linux/irq.h> #include <linux/pda_power.h> #include <linux/power_supply.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> #include <linux/regulator/max1586.h>
@@ -648,7 +648,7 @@ static struct platform_device power_dev = { }, }; -static struct wm97xx_batt_info mioa701_battery_data = { +static struct wm97xx_batt_pdata mioa701_battery_data = { .batt_aux =WM97XX_AUX_ID1 , .temp_aux =-1 , .charge_gpio =-1 ,
@@ -660,6 +660,10 @@ static struct wm97xx_batt_info mioa701_battery_data = { .batt_name = "mioa701_battery", }; +static struct wm97xx_pdata mioa701_wm97xx_pdata = { + .batt_pdata = &mioa701_battery_data, +}; +/* * Voltage regulation */
@@ -728,6 +732,7 @@ struct i2c_pxa_platform_data i2c_pdata = {static pxa2xx_audio_ops_t mioa701_ac97_info = { .reset_gpio =95 , + .codec_pdata = { &mioa701_wm97xx_pdata, }, };/*
@@ -804,7 +809,6 @@ static void __init mioa701_machine_init(void) mioa701_mci_info.detect_delay =msecs_to_jiffies (250 );pxa_set_mci_info (&mioa701_mci_info);pxa_set_keypad_info (&mioa701_keypad_info); -wm97xx_bat_set_pdata (&mioa701_battery_data);pxa_set_udc_info (&mioa701_udc_info);pxa_set_ac97_info (&mioa701_ac97_info); pm_power_off = mioa701_poweroff;
arch/arm/mach-pxa/palmld.c +10 -9
@@ -22,7 +22,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/mtd/mtd.h>
@@ -406,9 +406,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmld_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -422,15 +422,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmld_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , +static struct wm97xx_pdata palmld_wm97xx_pdata = { + .batt_pdata = &palmld_batt_pdata, };static pxa2xx_audio_ops_t palmld_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmld_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmld_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMLD_EARPHONE_DETECT , };static struct platform_device palmld_asoc = {
@@ -536,7 +538,6 @@ static void __init palmld_init(void)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);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmt5.c +10 -9
@@ -24,7 +24,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -317,9 +317,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmt5_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -333,15 +333,17 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ -static struct palm27x_asoc_info palmt5_asoc_pdata = { - .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , +static struct wm97xx_pdata palmt5_wm97xx_pdata = { + .batt_pdata = &palmt5_batt_pdata, };static pxa2xx_audio_ops_t palmt5_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmt5_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmt5_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMT5_EARPHONE_DETECT , };static struct platform_device palmt5_asoc = {
@@ -426,7 +428,6 @@ static void __init palmt5_init(void)pxa_set_ac97_info (&palmt5_ac97_pdata);pxa_set_ficp_info (&palmt5_ficp_platform_data);pxa_set_keypad_info (&palmt5_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmte2.c +12 -8
@@ -23,7 +23,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -290,9 +290,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmte2_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -306,9 +306,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmte2_wm97xx_pdata = { + .batt_pdata = &palmte2_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmte2_ac97_pdata = { + .codec_pdata = { &palmte2_wm97xx_pdata, }, +}; +static struct palm27x_asoc_info palmte2_asoc_pdata = { .jack_gpio =GPIO_NR_PALMTE2_EARPHONE_DETECT , };
@@ -376,9 +381,8 @@ static void __init palmte2_init(void)set_pxa_fb_info (&palmte2_lcd_screen);pxa_set_mci_info (&palmte2_mci_platform_data);palmte2_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmte2_ac97_pdata);pxa_set_ficp_info (&palmte2_ficp_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmtx.c +10 -9
@@ -25,7 +25,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/nand.h>
@@ -340,9 +340,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmtx_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -356,15 +356,17 @@ 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 struct wm97xx_pdata palmtx_wm97xx_pdata = { + .batt_pdata = &palmtx_batt_pdata, };static pxa2xx_audio_ops_t palmtx_ac97_pdata = { .reset_gpio =95 , + .codec_pdata = { &palmtx_wm97xx_pdata, }, +}; + +static struct palm27x_asoc_info palmtx_asoc_pdata = { + .jack_gpio =GPIO_NR_PALMTX_EARPHONE_DETECT , };static struct platform_device palmtx_asoc = {
@@ -538,7 +540,6 @@ static void __init palmtx_init(void)pxa_set_ac97_info (&palmtx_ac97_pdata);pxa_set_ficp_info (&palmtx_ficp_platform_data);pxa_set_keypad_info (&palmtx_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/palmz72.c +12 -8
@@ -27,7 +27,7 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> +#include <linux/wm97xx.h> #include <linux/power_supply.h> #include <linux/usb/gpio_vbus.h>
@@ -343,9 +343,9 @@ static struct platform_device power_supply = { };/****************************************************************************** -* WM97xx battery +* WM97xx audio, battery ******************************************************************************/ -static struct wm97xx_batt_info wm97xx_batt_pdata = { +static struct wm97xx_batt_pdata palmz72_batt_pdata = { .batt_aux =WM97XX_AUX_ID3 , .temp_aux =WM97XX_AUX_ID2 , .charge_gpio =-1 ,
@@ -359,9 +359,14 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; -/****************************************************************************** -* aSoC audio -******************************************************************************/ +static struct wm97xx_pdata palmz72_wm97xx_pdata = { + .batt_pdata = &palmz72_batt_pdata, +}; + +static pxa2xx_audio_ops_t palmz72_ac97_pdata = { + .codec_pdata = { &palmz72_wm97xx_pdata, }, +}; +static struct platform_device palmz72_asoc = { .name ="palm27x-asoc" , .id =-1 ,
@@ -494,10 +499,9 @@ static void __init palmz72_init(void)set_pxa_fb_info (&palmz72_lcd_screen);pxa_set_mci_info (&palmz72_mci_platform_data);palmz72_udc_init (); -pxa_set_ac97_info (NULL ); +pxa_set_ac97_info (&palmz72_ac97_pdata);pxa_set_ficp_info (&palmz72_ficp_platform_data);pxa_set_keypad_info (&palmz72_keypad_platform_data); -wm97xx_bat_set_pdata (&wm97xx_batt_pdata);platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/treo680.c +0 -1
@@ -19,7 +19,6 @@#include <linux/pda_power.h> #include <linux/pwm_backlight.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> #include <linux/power_supply.h> #include <linux/sysdev.h> #include <linux/w1-gpio.h>
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
In reply to Marek VasutDne Čt 23. července 2009 20:39:37 Marek Vasut napsal(a):
Quoted 19 lines
Dne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
Quoted 18 lines
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
Quoted 16 lines · Marek Vasut
sound/arm/pxa2xx-ac97.c static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
Quoted 5 lines
sound/arm/pxa2xx-ac97.c +2
-0struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; +int id = dev->id <0 ?0 : dev->id;dev here is the AC97 controller device - if there's more than one AC97 controller in the system they can each have the four child devices. On the other hand, I don't think any of the PXA processors have more than one AC97 controller so it'll never actually have any impact.
I think the best thing for now is to either warn if anything except the primary codec has platform data or change the platform data to have a variable something like
primary_audio_pdata. The driver doesn't appear to support secondary codecs anyway.
Quoted 4 lines
Quoted 1 line
Ok, here's a fixed patch.
Argh, one more iteration here. There was a typo in the previous patch. Sorry.
Hi, well ... any updates ? Eric, is this patch ok with you ?
_______________________________________________
Alsa-devel mailing list [email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
Dne Út 28. července 2009 07:28:20 Marek Vasut napsal(a):
Quoted 21 lines
Dne Čt 23. července 2009 20:39:37 Marek Vasut napsal(a):
Quoted 20 lines
Dne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
Quoted 19 lines
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
Quoted 17 lines · Marek Vasut
Review
Quoted 5 lines
(quoted diff) +2
-0struct snd_ac97_bus *ac97_bus; struct snd_ac97_template ac97_template; int ret; + pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + int id = dev->id < 0 ? 0 : dev->id;dev here is the AC97 controller device - if there's more than one AC97 controller in the system they can each have the four child devices. On the other hand, I don't think any of the PXA processors have more than one AC97 controller so it'll never actually have any impact.
I think the best thing for now is to either warn if anything except the primary codec has platform data or change the platform data to have a variable something like
primary_audio_pdata. The driver doesn't appear to support secondary codecs anyway.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Ok, here's a fixed patch.
Argh, one more iteration here. There was a typo in the previous patch. Sorry.
Hi, well ... any updates ? Eric, is this patch ok with you ?
I made one more revision here as in case the platform_data aren't supplied, the kernel obviously crashes.
From 207d54244768e94ce0144cba55acf4ae065e6ce0 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
--- arch/arm/mach-pxa/include/mach/audio.h | 3 +++ include/sound/ac97_codec.h | 3 +++ sound/arm/pxa2xx-ac97.c | 10 ++++++++++ sound/soc/pxa/pxa2xx-ac97.c | 12 +++++++++++- 4 files changed, 27 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/audio.h +3 -0
@@ -3,10 +3,12 @@#include <sound/core.h> #include <sound/pcm.h> +#include <sound/ac97_codec.h> /* * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) * a -1 value means no gpio will be used for reset +* @codec_pdata: AC97 codec platform_data * reset_gpio should only be specified for pxa27x CPUs where a silicon * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {void (*resume)(void *);void *priv;int reset_gpio; +void *codec_pdata[AC97_BUS_MAX_DEVICES ]; } pxa2xx_audio_ops_t;extern void pxa_set_ac97_info (pxa2xx_audio_ops_t *ops);
include/sound/ac97_codec.h +3 -0
@@ -32,6 +32,9 @@#include "control.h" #include "info.h" +/* maximum number of devices on the AC97 bus */ +#define AC97_BUS_MAX_DEVICES 4 +/* * AC'97 codec registers */
sound/arm/pxa2xx-ac97.c +10 -0
@@ -170,6 +170,13 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)struct snd_ac97_bus *ac97_bus;struct snd_ac97_template ac97_template;int ret; +pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; + +if (dev->id >=0 ) { +dev_err (&dev->dev,"PXA2xx has only one AC97 port.\n" ); + ret = -ENXIO ; + goto err_dev; + } ret =snd_card_create (SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ,THIS_MODULE ,0 , &card);
@@ -200,6 +207,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)snprintf (card->longname,sizeof (card->longname),"%s (%s)" , dev->dev.driver->name, card->mixername); +if (pdata && pdata->codec_data) +snd_ac97_dev_add_pdata (ac97_bus->codec[0 ], pdata->codec_pdata);snd_card_set_dev (card, &dev->dev); ret =snd_card_register (card);if (ret ==0 ) {
@@ -212,6 +221,7 @@ err_remove: err:if (card)snd_card_free (card); +err_dev:return ret; }
sound/soc/pxa/pxa2xx-ac97.c +11 -1
@@ -22,6 +22,7 @@#include <mach/hardware.h> #include <mach/regs-ac97.h> #include <mach/dma.h> +#include <mach/audio.h> #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h"
@@ -241,9 +242,18 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);static int __devinit pxa2xx_ac97_dev_probe (struct platform_device *pdev) {int i; +pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; -for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) +if (pdev->id >=0 ) { +dev_err (&pdev->dev,"PXA2xx has only one AC97 port.\n" ); +return -ENXIO ; + } + +for (i =0 ; i <ARRAY_SIZE (pxa_ac97_dai); i++) { pxa_ac97_dai[i].dev = &pdev->dev; +if (pdata && pdata->codec_pdata) + pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata; + }/* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up
Signature · 1 line
1.6.3.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
Quoted 7 lines · Marek Vasut
From
207d54244768e94ce0144cba55acf4ae065e6ce0Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passingplatform_datafor pxa2xx-ac97This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
I've applied this one too since it's ALSA only and it'll ease merge issues next merge window - we can revisit if any of the other patches get applied before.
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
Dne Čt 13. srpna 2009 22:40:34 Mark Brown napsal(a):
Quoted 6 lines · Marek Vasut
Quoted 5 lines
From
207d54244768e94ce0144cba55acf4ae065e6ce0Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passingplatform_datafor pxa2xx-ac97
Quoted 6 lines
Quoted 2 lines
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
I've applied this one too since it's ALSA only and it'll ease merge issues next merge window - we can revisit if any of the other patches get applied before.
Hi,
thanks, I think you can apply the 3/4 and 4/4 as well. But you should probably talk to Anton about the 3/4 if he wants to merge it through your tree or his or whatever. He acked it previously, it's in that huge thread from july. The mail's subject is "[PATCH 2/4] Allow passing platform_data for pxa2xx-ac97" and it's from 22/07/2009.
Cheers!
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
Quoted 14 lines · Marek Vasut
Dne Čt 13. srpna 2009 22:40:34 Mark Brown napsal(a):
Quoted 6 lines · Marek Vasut
Quoted 5 lines
From
207d54244768e94ce0144cba55acf4ae065e6ce0Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passingplatform_datafor pxa2xx-ac97Quoted 6 lines
Quoted 2 lines
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
I've applied this one too since it's ALSA only and it'll ease merge issues next merge window - we can revisit if any of the other patches get applied before.
Quoted 7 lines
Hi,
thanks, I think you can apply the 3/4 and 4/4 as well. But you should probably talk to Anton about the 3/4 if he wants to merge it through your tree or his or whatever. He acked it previously, it's in that huge thread from july. The mail's subject is "[PATCH 2/4] Allow passing
platform_datafor pxa2xx-ac97" and it's from 22/07/2009.
I'm fine with it going through Mark's tree. Thanks!
Signature · 7 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
In reply to Marek VasutQuoted 11 lines · Marek Vasut
Dne Čt 13. srpna 2009 22:40:34 Mark Brown napsal(a):
Quoted 3 lines
I've applied this one too since it's ALSA only and it'll ease merge issues next merge window - we can revisit if any of the other patches get applied before.
thanks, I think you can apply the 3/4 and 4/4 as well. But you should probably talk to Anton about the 3/4 if he wants to merge it through your tree or his or whatever. He acked it previously, it's in that huge thread from july. The mail's subject is "[PATCH 2/4] Allow passing
platform_datafor pxa2xx-ac97" and it's from 22/07/2009.
Will those be OK for the Palm platforms without the arch/arm changes? AFAIR (and I may be remembering an old version) these patches would break the Palms unless the arch/arm stuff goes in in the same merge window.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel