[alsa-devel] [PATCH] 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.
At Tue, 21 Jul 2009 16:33:14 +0200, Marek Vasut wrote:
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 251fc1c..c6b24e2 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -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.
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index c570ebd..cfab74e 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -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.
/* register ac97 codec to bus */ static int snd_ac97_dev_register(struct snd_device *device) { diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index d9c94d7..dea18ee 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -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;
Use the get function.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1d70829..0b12fe5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
At Tue, 21 Jul 2009 15:53:23 +0100, Mark Brown wrote:
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Ah, right. This can be fixed later, then.
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
Agreed.
Takashi
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
At Tue, 21 Jul 2009 15:53:23 +0100,
Mark Brown wrote:
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Ah, right. This can be fixed later, then.
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
Agreed.
Takashi
Ok, I split it in two, here's the one that adds necessary stuff to alsa.
On Tue, Jul 21, 2009 at 05:40:01PM +0200, Marek Vasut wrote:
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
+/* 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.
Dne Út 21. července 2009 20:30:56 Mark Brown napsal(a):
On Tue, Jul 21, 2009 at 05:40:01PM +0200, Marek Vasut wrote:
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
+/* 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 :-)
On Tue, Jul 21, 2009 at 09:51:05PM +0200, Marek Vasut wrote:
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.
Dne St 22. července 2009 12:40:29 Mark Brown napsal(a):
On Tue, Jul 21, 2009 at 09:51:05PM +0200, Marek Vasut wrote:
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.
On Wed, Jul 22, 2009 at 12:59:13PM +0200, Marek Vasut wrote:
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
Signed-off-by: Marek Vasut marek.vasut@gmail.com
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
Takashi, should I apply this to ASoC or do you want to merge it given that it touches ALSA core stuff?
At Thu, 23 Jul 2009 11:16:55 +0100, Mark Brown wrote:
On Wed, Jul 22, 2009 at 12:59:13PM +0200, Marek Vasut wrote:
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...).
Signed-off-by: Marek Vasut marek.vasut@gmail.com
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
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
On Thu, Jul 23, 2009 at 12:28:41PM +0200, Takashi Iwai wrote:
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.
Dne Út 21. července 2009 20:30:56 Mark Brown napsal(a):
On Tue, Jul 21, 2009 at 05:40:01PM +0200, Marek Vasut wrote:
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
+/* 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.
At Tue, 21 Jul 2009 22:24:21 +0200, Marek Vasut wrote:
From 082f09b9f3c1bbf3240610dc89baba33d47787b7 Mon Sep 17 00:00:00 2001 From: Marek Vasut marek.vasut@gmail.com 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 ...).
Signed-off-by: Marek Vasut marek.vasut@gmail.com
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(-)
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 251fc1c..702f90d 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -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 */ diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 352d7ee..0d65a03 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -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,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1d70829..0b12fe5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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):
At Tue, 21 Jul 2009 22:24:21 +0200,
Marek Vasut wrote:
From 082f09b9f3c1bbf3240610dc89baba33d47787b7 Mon Sep 17 00:00:00 2001 From: Marek Vasut marek.vasut@gmail.com 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 ...).
Signed-off-by: Marek Vasut marek.vasut@gmail.com
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(-)
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 251fc1c..702f90d 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -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 */ diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 352d7ee..0d65a03 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -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,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1d70829..0b12fe5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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()?
hm, that's true, one more iteration then.
thanks,
Takashi
Btw. I also reworked the wm97xx-battery a little more. Also, CCing power- supply people.
On Wed, Jul 22, 2009 at 12:13:12AM +0200, Marek Vasut wrote:
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.
Dne St 22. července 2009 00:33:34 Russell King - ARM Linux napsal(a):
On Wed, Jul 22, 2009 at 12:13:12AM +0200, Marek Vasut wrote:
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.
Sorry, I removed that, this patch should be OK.
Dne St 22. července 2009 00:39:00 Marek Vasut napsal(a):
Dne St 22. července 2009 00:33:34 Russell King - ARM Linux napsal(a):
On Wed, Jul 22, 2009 at 12:13:12AM +0200, Marek Vasut wrote:
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.
Sorry, I removed that, this patch should be OK.
Argh, I forget to fix the goto label.
On Wed, Jul 22, 2009 at 12:13:12AM +0200, Marek Vasut wrote:
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 marek.vasut@gmail.com 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.
Signed-off-by: Marek Vasut marek.vasut@gmail.com
Acked-by: Anton Vorontsov cbouatmailru@gmail.com
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);
ret = request_irq(gpio_to_irq(pdata->charge_gpio),
wm97xx_chrg_irq, IRQF_DISABLED,
"AC Detect", 0);
if (ret)
goto err3;
Dne St 22. července 2009 00:34:24 Anton Vorontsov napsal(a):
On Wed, Jul 22, 2009 at 12:13:12AM +0200, Marek Vasut wrote:
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 marek.vasut@gmail.com 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.
Signed-off-by: Marek Vasut marek.vasut@gmail.com
Acked-by: Anton Vorontsov cbouatmailru@gmail.com
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);
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).
Ok, Im sending the set again.
On Wed, Jul 22, 2009 at 01:02:40PM +0200, Marek Vasut wrote:
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;
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.
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
On Wed, Jul 22, 2009 at 01:02:40PM +0200, Marek Vasut wrote:
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;
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.
Ok, here's a fixed patch.
On Thu, Jul 23, 2009 at 04:16:12PM +0200, Marek Vasut wrote:
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver..
I'm OK with this. Eric any issues?
Signed-off-by: Marek Vasut marek.vasut@gmail.com
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(-)
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h index 16eb025..a3449e3 100644 --- a/arch/arm/mach-pxa/include/mach/audio.h +++ b/arch/arm/mach-pxa/include/mach/audio.h @@ -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); diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 9b1c098..3dae3f7 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -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
*/ diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index c570ebd..22d4f83 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -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; }
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index d9c94d7..b19451d 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -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
-- 1.6.3.3
Dne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
On Wed, Jul 22, 2009 at 01:02:40PM +0200, Marek Vasut wrote:
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;
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.
Ok, here's a fixed patch.
Argh, one more iteration here. There was a typo in the previous patch. Sorry.
Dne Čt 23. července 2009 20:39:37 Marek Vasut napsal(a):
Dne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
On Wed, Jul 22, 2009 at 01:02:40PM +0200, Marek Vasut wrote:
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;
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.
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 ?
Dne Út 28. července 2009 07:28:20 Marek Vasut napsal(a):
Dne Čt 23. července 2009 20:39:37 Marek Vasut napsal(a):
Dne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
On Wed, Jul 22, 2009 at 01:02:40PM +0200, Marek Vasut wrote:
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;
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.
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.
On Thu, Jul 30, 2009 at 02:55:01AM +0200, Marek Vasut wrote:
From 207d54244768e94ce0144cba55acf4ae065e6ce0 Mon Sep 17 00:00:00 2001 From: Marek Vasut marek.vasut@gmail.com 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..
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.
Dne Čt 13. srpna 2009 22:40:34 Mark Brown napsal(a):
On Thu, Jul 30, 2009 at 02:55:01AM +0200, Marek Vasut wrote:
From 207d54244768e94ce0144cba55acf4ae065e6ce0 Mon Sep 17 00:00:00 2001 From: Marek Vasut marek.vasut@gmail.com 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..
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!
On Fri, Aug 14, 2009 at 01:34:22AM +0200, Marek Vasut wrote:
Dne Čt 13. srpna 2009 22:40:34 Mark Brown napsal(a):
On Thu, Jul 30, 2009 at 02:55:01AM +0200, Marek Vasut wrote:
From 207d54244768e94ce0144cba55acf4ae065e6ce0 Mon Sep 17 00:00:00 2001 From: Marek Vasut marek.vasut@gmail.com 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..
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.
I'm fine with it going through Mark's tree. Thanks!
On Fri, Aug 14, 2009 at 01:34:22AM +0200, Marek Vasut wrote:
Dne Čt 13. srpna 2009 22:40:34 Mark Brown napsal(a):
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_data for 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.
On Wed, Jul 22, 2009 at 01:04:16PM +0200, Marek Vasut wrote:
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 252eb11..f944918 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -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>
...
+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) goto 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)
props++; /* POWER_SUPPLY_PROP_STATUS */goto err2;
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.
-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.
Marek Vasut marek.vasut@gmail.com writes:
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
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 marek.vasut@gmail.com 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.
Signed-off-by: Marek Vasut marek.vasut@gmail.com
@@ -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
Dne Pá 24. července 2009 21:44:01 Robert Jarzmik napsal(a):
Marek Vasut marek.vasut@gmail.com writes:
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
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 marek.vasut@gmail.com 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.
Signed-off-by: Marek Vasut marek.vasut@gmail.com
@@ -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.
Argh ... right. Thanks, try attached patch.
Cheers.
-- Robert
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
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)
Marek Vasut marek.vasut@gmail.com writes:
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
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.
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 3cab452..803917d 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c @@ -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
Dne St 22. července 2009 20:09:09 Robert Jarzmik napsal(a):
Marek Vasut marek.vasut@gmail.com writes:
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
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.
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 3cab452..803917d 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c @@ -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
Thanks! Here's a fixed patch.
Marek Vasut marek.vasut@gmail.com writes:
Thanks! Here's a fixed patch.
For the mioa701 part : Acked-by: Robert Jarzmik robert.jarzmik@free.fr
Cheers.
Dne St 22. července 2009 20:30:42 Marek Vasut napsal(a):
Dne St 22. července 2009 20:09:09 Robert Jarzmik napsal(a):
Marek Vasut marek.vasut@gmail.com writes:
Dne St 22. července 2009 13:01:03 Marek Vasut napsal(a):
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.
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 3cab452..803917d 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c @@ -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
Thanks! 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.
Dne Út 21. července 2009 20:30:56 Mark Brown napsal(a):
On Tue, Jul 21, 2009 at 05:40:01PM +0200, Marek Vasut wrote:
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
+/* 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.
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
At Tue, 21 Jul 2009 15:53:23 +0100,
Mark Brown wrote:
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Ah, right. This can be fixed later, then.
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
Agreed.
Takashi
And this patch adds changes to pxa2xx-ac97. Also, I fixed the magic constant.
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
At Tue, 21 Jul 2009 15:53:23 +0100,
Mark Brown wrote:
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Ah, right. This can be fixed later, then.
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
Agreed.
Takashi
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.
On Tue, Jul 21, 2009 at 07:40:21PM +0200, Marek Vasut wrote:
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
+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...
- 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).
On Tue, Jul 21, 2009 at 07:27:54PM +0100, Mark Brown wrote:
On Tue, Jul 21, 2009 at 07:40:21PM +0200, Marek Vasut wrote:
Dne ??t 21. ??ervence 2009 17:16:07 Takashi Iwai napsal(a):
+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 17:16:07 Takashi Iwai napsal(a):
At Tue, 21 Jul 2009 15:53:23 +0100,
Mark Brown wrote:
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Ah, right. This can be fixed later, then.
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
Agreed.
Takashi
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).
Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a):
At Tue, 21 Jul 2009 15:53:23 +0100,
Mark Brown wrote:
On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote:
Marek Vasut wrote:
int ret;
- pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
Use the get function.
There's no such function in mainline right now. However, apropos of something else I submitted a patch adding that to the driver core - it's been merged for 2.6.32 but won't be available in ALSA until after the next merge window. The function is dev_get_platdata().
Ah, right. This can be fixed later, then.
Also, at the next time, add Russell or linux-arm to Cc so that he knows at least that a file in arch/arm will be changed.
Ideally split things into two separate patches.
Agreed.
Takashi
And one more patch to convert the mainstone accelerated touch driver to use platform_data.
Marek Vasut marek.vasut@gmail.com writes:
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h index 16eb025..8825b18 100644 --- a/arch/arm/mach-pxa/include/mach/audio.h +++ b/arch/arm/mach-pxa/include/mach/audio.h @@ -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 ?
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index c570ebd..cfab74e 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -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]);
Is there something that grants that dev->id is lesser than 4 ?
Cheers.
At Tue, 21 Jul 2009 17:11:03 +0200, Robert Jarzmik wrote:
Marek Vasut marek.vasut@gmail.com writes:
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h index 16eb025..8825b18 100644 --- a/arch/arm/mach-pxa/include/mach/audio.h +++ b/arch/arm/mach-pxa/include/mach/audio.h @@ -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
You can add, for the whole serie, my : Tested-by: Robert Jarzmik robert.jarzmik@free.fr
-- Robert
participants (6)
-
Anton Vorontsov
-
Marek Vasut
-
Mark Brown
-
Robert Jarzmik
-
Russell King - ARM Linux
-
Takashi Iwai