Skip to contentSkip to conversation

ASoC/2.6.37: fix au1x platform

PATCH Applied Manuel Lauss 3 participants 11 messages Aug 26, 2010 – Oct 13, 2010

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

PATCH v5 1/1 ASoC/2.6.37: fix au1x platform

This patch fixes up the au1x audio platform after the multi-component merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.

The AC97 part is limited to one instance only for now due to issues with getting at driver data in the soc_ac97_ops.

---
v5: smaller patch
v4: fixed a bug in the previous bugfix, and added DAI drvdata accessors.
v3: fixed a bug which caused cat /proc/iomem to loop endlessly.
v2: prepare PCM,I2S for multiple card operation, use dev_name() for DAI name.

Against Liam's asoc/for-2.6.37 branch.

Tested on DB1200 and DB1300 (here both I2S and AC97 operate as independent cards), please fold this into the other Au1x multi-component patches.

Issues I observed with AC97:
* AC97 is limited to a single instance since I cannot get at the driver data in the AC97 callbacks at all time (or did I miss anything?):
when the AC97 codec calls snd_ac97_mixer(), it calls into the soc_ac97_ops callbacks; however ac97->bus->card->private_data (suggested by Mark) is _always_ NULL, so no way to get at the dai and ultimately driver data.

* generic AC97 codec use spits out this kobject warning, which is caused by the "device_register()" in soc-core.c::soc_ac97_dev_register():

asoc: ac97-hifi <-> au1xpsc-ac97.1 mapping ok
kobject (8fdc59b0): tried to init an initialized object, something is seriously wrong.

Call Trace:
[<804959c4>] dump_stack+0x8/0x34
[<802a30e4>] kobject_init+0x50/0xcc
[<802ec27c>] device_initialize+0x2c/0x70
[<802ecb64>] device_register+0x14/0x28
[<8039e058>] snd_soc_instantiate_cards+0xa00/0xb10
[<8039e27c>] soc_probe+0x114/0x154
[<802ef0fc>] driver_probe_device+0xe4/0x1a0
[<802ee404>] bus_for_each_drv+0x60/0xb0
[<802ef370>] device_attach+0x74/0xa8
[<802ee1e8>] bus_probe_device+0x30/0x54
[<802ec9a0>] device_add+0x384/0x534
[<802f09a4>] platform_device_add+0x15c/0x1c8
[<805ccb14>] db1200_audio_load+0x70/0x9c
[<801004fc>] do_one_initcall+0xfc/0x1e0
[<805ba32c>] kernel_init+0xc8/0x168
[<80105904>] kernel_thread_helper+0x10/0x18
 arch/mips/alchemy/devboards/db1200/platform.c |    6 ++
 sound/soc/au1x/db1200.c                       |   16 +++---
 sound/soc/au1x/dbdma2.c                       |   82 ++++++++-----------------
 sound/soc/au1x/psc-ac97.c                     |   59 +++++++++++-------
 sound/soc/au1x/psc-i2s.c                      |   42 ++++---------
 sound/soc/au1x/psc.h                          |    7 +--
 6 files changed, 91 insertions(+), 121 deletions(-)
arch/mips/alchemy/devboards/db1200/platform.c +6 -0
index 3fa34c3..fbb5593 100644
@@ -429,6 +429,11 @@ static struct platform_device db1200_audio_dev = {
 	.resource	= au1200_psc1_res,
 };
 
+static struct platform_device db1200_stac_dev = {
+	.name		= "ac97-codec",
+	.id		= 1,	/* on PSC1 */
+};
+
 static struct platform_device *db1200_devs[] __initdata = {
 	NULL,		/* PSC0, selected by S6.8 */
 	&db1200_ide_dev,
@@ -436,6 +441,7 @@ static struct platform_device *db1200_devs[] __initdata = {
 	&db1200_rtc_dev,
 	&db1200_nand_dev,
 	&db1200_audio_dev,
+	&db1200_stac_dev,
 };
 
 static int __init db1200_dev_init(void)
sound/soc/au1x/db1200.c +8 -8
index d8dc822..b62fcd3 100644
@@ -27,10 +27,10 @@
 static struct snd_soc_dai_link db1200_ac97_dai = {
 	.name		= "AC97",
 	.stream_name	= "AC97 HiFi",
-	.cpu_dai_name	= "au1xpsc-ac97",
 	.codec_dai_name	= "ac97-hifi",
-	.platform_name	=  "au1xpsc-pcm-audio",
-	.codec_name	= "ac97-codec",
+	.cpu_dai_name	= "au1xpsc_ac97.1",
+	.platform_name	= "au1xpsc-pcm.1",
+	.codec_name	= "ac97-codec.1",
 };
 
 static struct snd_soc_card db1200_ac97_machine = {
@@ -75,10 +75,10 @@ static struct snd_soc_ops db1200_i2s_wm8731_ops = {
 static struct snd_soc_dai_link db1200_i2s_dai = {
 	.name		= "WM8731",
 	.stream_name	= "WM8731 PCM",
-	.cpu_dai_name	= "au1xpsc",
-	.codec_dai_name	= "wm8731-hifi"
-	.platform_name	= "au1xpsc-pcm-audio",
-	.codec_name	= "wm8731-codec.0-001a",
+	.codec_dai_name	= "wm8731-hifi",
+	.cpu_dai_name	= "au1xpsc_i2s.1",
+	.platform_name	= "au1xpsc-pcm.1",
+	.codec_name	= "wm8731-codec.0-001b",
 	.ops		= &db1200_i2s_wm8731_ops,
 };
 
@@ -97,7 +97,7 @@ static int __init db1200_audio_load(void)
 	int ret;
 
 	ret = -ENOMEM;
-	db1200_asoc_dev = platform_device_alloc("soc-audio", -1);
+	db1200_asoc_dev = platform_device_alloc("soc-audio", 1); /* PSC1 */
 	if (!db1200_asoc_dev)
 		goto out;
 
sound/soc/au1x/dbdma2.c +26 -56

191 lines not on this page · raw message

sound/soc/au1x/psc-ac97.c +35 -24

140 lines not on this page · raw message

sound/soc/au1x/psc-i2s.c +14 -28

117 lines not on this page · raw message

sound/soc/au1x/psc.h +2 -5
index f281443..b30eadd 100644
@@ -8,16 +8,11 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
- * NOTE: all of these drivers can only work with a SINGLE instance
- *	 of a PSC. Multiple independent audio devices are impossible
- *	 with ASoC v1.
  */
 
 #ifndef _AU1X_PCM_H
 #define _AU1X_PCM_H
 
-extern struct snd_ac97_bus_ops soc_ac97_ops;
-
 /* DBDMA helpers */
 extern struct platform_device *au1xpsc_pcm_add(struct platform_device *pdev);
 extern void au1xpsc_pcm_destroy(struct platform_device *dmapd);
@@ -28,6 +23,8 @@ struct au1xpsc_audio_data {
 	unsigned long cfg;
 	unsigned long rate;
 
+	struct snd_soc_dai_driver dai_drv;
+
 	unsigned long pm[2];
 	struct mutex lock;
 	struct platform_device *dmapd;
Signature · 1 line
1.7.2
#1 lore raw
Quoted 15 lines · Manuel Lauss

This patch fixes up the au1x audio platform after the multi-component merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.

The AC97 part is limited to one instance only for now due to issues with getting at driver data in the soc_ac97_ops.

---
v5: smaller patch
v4: fixed a bug in the previous bugfix, and added DAI drvdata accessors.
v3: fixed a bug which caused cat /proc/iomem to loop endlessly.
v2: prepare PCM,I2S for multiple card operation, use dev_name() for DAI name.

Quoted 6 lines

Against Liam's asoc/for-2.6.37 branch.

Tested on DB1200 and DB1300 (here both I2S and AC97 operate as independent cards), please fold this into the other Au1x multi-component patches.

This all looks fine

Quoted 10 lines

Issues I observed with AC97:
* AC97 is limited to a single instance since I cannot get at the driver data in the AC97 callbacks at all time (or did I miss anything?):
when the AC97 codec calls snd_ac97_mixer(), it calls into the soc_ac97_ops callbacks; however ac97->bus->card->private_data (suggested by Mark) is _always_ NULL, so no way to get at the dai and ultimately driver data.

* generic AC97 codec use spits out this kobject warning, which is caused by the "device_register()" in soc-core.c::soc_ac97_dev_register():

Although I'm curious about these issues. I didn't see them when testing on my now non working Zylonite with WM9713 (AC97), so I'm suspecting it's related to the generic AC97 somehow.

Unfortunately, this will need someone with working AC97 hardware to fix this issue.

Is the AC97 DAI being probed before the generic AC97 codec driver in this case ?

Liam

#2 lore raw
Quoted 32 lines · Liam Girdwood
Quoted 15 lines · Manuel Lauss

This patch fixes up the au1x audio platform after the multi-component merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.

The AC97 part is limited to one instance only for now due to issues with getting at driver data in the soc_ac97_ops.

---
v5: smaller patch
v4: fixed a bug in the previous bugfix, and added DAI drvdata accessors.
v3: fixed a bug which caused cat /proc/iomem to loop endlessly.
v2: prepare PCM,I2S for multiple card operation, use dev_name() for DAI name.

Quoted 6 lines

Against Liam's asoc/for-2.6.37 branch.

Tested on DB1200 and DB1300 (here both I2S and AC97 operate as independent cards), please fold this into the other Au1x multi-component patches.

This all looks fine

Quoted 7 lines

Issues I observed with AC97:
* AC97 is limited to a single instance since I cannot get at the driver data in the AC97 callbacks at all time (or did I miss anything?):
when the AC97 codec calls snd_ac97_mixer(), it calls into the soc_ac97_ops callbacks; however ac97->bus->card->private_data (suggested by Mark) is _always_ NULL, so no way to get at the dai and ultimately driver data.

Quoted 7 lines
Quoted 3 lines

* generic AC97 codec use spits out this kobject warning, which is caused by the "device_register()" in soc-core.c::soc_ac97_dev_register():

Although I'm curious about these issues. I didn't see them when testing on my now non working Zylonite with WM9713 (AC97), so I'm suspecting it's related to the generic AC97 somehow.

Yeah, the generic AC97 code doesn't really know what's going on with ASoC so we're probably upsetting it again. Most likely we need to redo the stuff to suppress the card registration for AC97 cards.

Quoted 10 lines

Unfortunately, this will need someone with working AC97 hardware to fix this issue.

Is the AC97 DAI being probed before the generic AC97 codec driver in this case ?

Liam

#3 lore raw

Hello,

Quoted 38 lines · Mark Brown
Quoted 36 lines · Liam Girdwood
Quoted 15 lines · Manuel Lauss

This patch fixes up the au1x audio platform after the multi-component merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.

The AC97 part is limited to one instance only for now due to issues with getting at driver data in the soc_ac97_ops.

---
v5: smaller patch
v4: fixed a bug in the previous bugfix, and added DAI drvdata accessors.
v3: fixed a bug which caused cat /proc/iomem to loop endlessly.
v2: prepare PCM,I2S for multiple card operation, use dev_name() for DAI name.

Quoted 6 lines

Against Liam's asoc/for-2.6.37 branch.

Tested on DB1200 and DB1300 (here both I2S and AC97 operate as independent cards),  please fold this into the other Au1x multi-component patches.

This all looks fine

Quoted 10 lines

Issues I observed with AC97:
* AC97 is limited to a single instance since I cannot get at the driver data in the AC97 callbacks at all time (or did I miss anything?):
 when the AC97 codec calls snd_ac97_mixer(), it calls into the soc_ac97_ops callbacks; however ac97->bus->card->private_data (suggested by Mark) is _always_ NULL, so no way to get at the dai and ultimately driver data.

* generic AC97 codec use spits out this kobject warning, which is caused by the "device_register()" in soc-core.c::soc_ac97_dev_register():

Quoted 11 lines
Quoted 3 lines

Although I'm curious about these issues. I didn't see them when testing on my now non working Zylonite with WM9713 (AC97), so I'm suspecting it's related to the generic AC97 somehow.

Yeah, the generic AC97 code doesn't really know what's going on with ASoC so we're probably upsetting it again. Most likely we need to redo the stuff to suppress the card registration for AC97 cards.

Quoted 5 lines

Unfortunately, this will need someone with working AC97 hardware to fix this issue.

Is the AC97 DAI being probed before the generic AC97 codec driver in this case ?

Yes.

I've found another AC97-related issue on another board (DB1300):
With AC97 enabled, the device warning doesn't appear but my ethernet is gone instead:

[...]
smsc911x: Driver version 2008-10-21.
smsc911x-mdio: probed
eth0: attached PHY driver [SMSC LAN8700] (mii_bus:phy_addr=ffffffff:01, irq=-1) net eth0: MAC Address: 00:0f:30:11:00:a1
WM9711/WM9712 SoC Audio Codec 0.4
asoc: wm9712-hifi <-> au1xpsc_ac97.1 mapping ok
asoc: wm8731-hifi <-> au1xpsc_i2s.2 mapping ok
ALSA device list:
#0: DB1300_AC97
#1: DB1300_I2S
IP-Config: Failed to open eth0
IP-Config: No network devices available. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]

Omit the ac97 "soc-audio" device registration and ethernet comes back (the DB1200
for example doesn't hit the reset switch with the AC97 warning present).

Otherwise both cards work fine at the same time.

Thank you!
Manuel Lauss

#4 lore raw
Quoted 3 lines · Manuel Lauss

I've found another AC97-related issue on another board (DB1300):
With AC97 enabled, the device warning doesn't appear but my ethernet is gone instead:

This seems like some sort of pin mux issue or something driver specific? I'm having a hard time thinking of anything ASoC could do that'd cause this, but I don't know how the two subsystems might interact on this system or au1x in general.

In any case I'm tempted to apply what we've got here since while there are still issues it's all au1x (and seemingly AC97) specific and it improves the situation for that platform - we can continue to work on the remaining problems without re-reviewing this code again. Liam, does that seem reasonable?

#5 lore raw
Quoted 7 lines · Mark Brown
Quoted 3 lines · Manuel Lauss

I've found another AC97-related issue on another board (DB1300):
With AC97 enabled, the device warning doesn't appear but my ethernet is gone instead:

This seems like some sort of pin mux issue or something driver specific?

No, no. The drivers don't touch pin config. It is related to the AC97 parts of ASoC, however. Somewhere memory gets overwritten which causes the DB1300's ethernet and the DB1200's reset code to fail. I'll see if I can find out exactly what's going on. There was something similar in the ASoC AC97 code 1-2 years ago which caused linked list corruption, but Liam fixed that pretty quickly.

Manuel

#6 lore raw
Quoted 10 lines · Manuel Lauss

On Fri, Aug 27, 2010 at 9:14 PM, Mark Brown

Quoted 1 line

This seems like some sort of pin mux issue or something driver specific?

No, no. The drivers don't touch pin config. It is related to the AC97 parts of ASoC, however. Somewhere memory gets overwritten which causes the DB1300's ethernet and the DB1200's reset code to fail. I'll see if I can find out exactly what's going on. There was something similar in the ASoC AC97 code 1-2 years ago which caused linked list corruption, but Liam fixed that pretty quickly.

This sounds like the driver specifics I was talking about. ASoC doesn't get involved in anything that's likely to affect memory much in a way that'd only show up on one system, and I'd expect things that did go wrong to have a much less specific effect. It could possibly be the generic AC97 bodge (at which point it's specific to ac97.c) but it's unlikely to be ASoC itself.

Applied
#7 lore raw
In reply to Manuel Lauss
Quoted 9 lines · Manuel Lauss

This patch fixes up the au1x audio platform after the multi-component merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.

The AC97 part is limited to one instance only for now due to issues with getting at driver data in the soc_ac97_ops.

Applied, thanks - we can work on fixing up the remaining issues with AC'97 incrementally.

#8 lore raw

Hello Mark, Liam

Quoted 6 lines · Mark Brown
Quoted 5 lines · Manuel Lauss

This patch fixes up the au1x audio platform after the multi-component merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.

Quoted 7 lines
Quoted 4 lines

The AC97 part is limited to one instance only for now due to issues with getting at driver data in the soc_ac97_ops.

Applied, thanks - we can work on fixing up the remaining issues with AC'97 incrementally.

Here's a snippet of the kernel log with linked-list debugging enabled. Looks like the list issue Liam fixed ~1.5 years ago:
( see http://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014757.html
)

AC97 SoC Audio Codec 0.6
asoc: ac97-hifi <-> au1xpsc_ac97.1 mapping ok
kobject (8f798da0): tried to init an initialized object, something is seriously wrong.

Call Trace:
[<801082d8>] dump_stack+0x8/0x34
[<802d2bf0>] kobject_init+0xc4/0xd4
[<80310758>] device_initialize+0x2c/0x70
[<803110ac>] device_register+0x14/0x28
[<803d1ab4>] snd_soc_instantiate_cards+0xa60/0xbc0
[<803d1d50>] soc_probe+0x13c/0x154
[<80313970>] driver_probe_device+0xc4/0x204
[<80312b90>] bus_for_each_drv+0x68/0xd0
[<80313cd4>] device_attach+0xc0/0xfc
[<80312928>] bus_probe_device+0x38/0x54
[<80310fd8>] device_add+0x4b8/0x578
[<8031560c>] platform_device_add+0x12c/0x24c
[<8060da40>] db1200_audio_load+0x78/0xa4
[<8010aa40>] do_one_initcall+0x40/0x1e8
[<805fb338>] kernel_init+0xd4/0x174
[<8010e734>] kernel_thread_helper+0x10/0x18

------------[ cut here ]------------
WARNING: at /home/mano/db1200/kernel/linux-2.6.git/lib/list_debug.c:30
__list_add+0xa8/0xb0()
list_add corruption. prev->next should be next (8fe44fa8), but was
8f7eefc4. (prev=8f7eefc4).
Modules linked in:
Call Trace:
[<801082d8>] dump_stack+0x8/0x34
[<8012a2dc>] warn_slowpath_common+0x78/0xa4
[<8012a390>] warn_slowpath_fmt+0x2c/0x38
[<802e046c>] __list_add+0xa8/0xb0
[<80312b18>] bus_add_device+0x1d4/0x1e4
[<80310f88>] device_add+0x468/0x578
[<803d1ab4>] snd_soc_instantiate_cards+0xa60/0xbc0
[<803d1d50>] soc_probe+0x13c/0x154
[<80313970>] driver_probe_device+0xc4/0x204
[<80312b90>] bus_for_each_drv+0x68/0xd0
[<80313cd4>] device_attach+0xc0/0xfc
[<80312928>] bus_probe_device+0x38/0x54
[<80310fd8>] device_add+0x4b8/0x578
[<8031560c>] platform_device_add+0x12c/0x24c
[<8060da40>] db1200_audio_load+0x78/0xa4
[<8010aa40>] do_one_initcall+0x40/0x1e8
[<805fb338>] kernel_init+0xd4/0x174
[<8010e734>] kernel_thread_helper+0x10/0x18

---[ end trace 8e74e4819d0d06c3 ]---
------------[ cut here ]------------
WARNING: at /home/mano/db1200/kernel/linux-2.6.git/lib/list_debug.c:30
__list_add+0xa8/0xb0()
list_add corruption. prev->next should be next (8f788f90), but was
8f7eefa4. (prev=8f7eefa4).
Modules linked in:
Call Trace:
[<801082d8>] dump_stack+0x8/0x34
[<8012a2dc>] warn_slowpath_common+0x78/0xa4
[<8012a390>] warn_slowpath_fmt+0x2c/0x38
[<802e046c>] __list_add+0xa8/0xb0
[<80310ff0>] device_add+0x4d0/0x578
[<803d1ab4>] snd_soc_instantiate_cards+0xa60/0xbc0
[<803d1d50>] soc_probe+0x13c/0x154
[<80313970>] driver_probe_device+0xc4/0x204
[<80312b90>] bus_for_each_drv+0x68/0xd0
[<80313cd4>] device_attach+0xc0/0xfc
[<80312928>] bus_probe_device+0x38/0x54
[<80310fd8>] device_add+0x4b8/0x578
[<8031560c>] platform_device_add+0x12c/0x24c
[<8060da40>] db1200_audio_load+0x78/0xa4
[<8010aa40>] do_one_initcall+0x40/0x1e8
[<805fb338>] kernel_init+0xd4/0x174
[<8010e734>] kernel_thread_helper+0x10/0x18

---[ end trace 8e74e4819d0d06c4 ]---

ALSA device list:
#0: DB1200_AC97

Thanks!
Manuel Lauss

#9 lore raw
Quoted 3 lines · Manuel Lauss

Here's a snippet of the kernel log with linked-list debugging enabled. Looks like the list issue Liam fixed ~1.5 years ago:
( see http://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014757.html

Looking at that link I rather suspect you're confusing Liam and myself here... As I've said quite a few times now this will be due to the song and dance with trying to shoehorn the generic AC'97 support into ASoC so we need to fix the bodges for the generic AC'97 driver.