Skip to contentSkip to conversation

ASoC AC97 audio support for ep93xx

PATCH Superseded Mika Westerberg 1 participant 5 messages Oct 10, 2010

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC AC97 audio support for ep93xx

Hello,

This series adds AC97 audio support for Cirrus Logic EP93xx family SoCs. Example machine driver is for Simplemachines Sim.One (which is the only hardware that I have which has AC97 codec).

The first patch is a bugfix for the DMA code. Without the patch audio DMA transfers may corrupt if playing application is killed while playing. This results weird noise playback when application is started again. I would like Ryan Mallon to confirm that this is indeed correct fix and if possible to check that I2S transfers still work after this patch is applied.

Please review.

Changes to previous revision:
- patches are taken from the correct branch so they should apply on top of latest mainline
- increased cold reset sleep time

Thanks,
MW

Mika Westerberg (4):
ARM: ep93xx: DMA: fix channel_disable
ASoC: add ep93xx AC97 audio driver
ARM: ep93xx: add AC97 platform support
ASoC: ep93xx: add Simplemachines Sim.One AC97 audio support

 arch/arm/mach-ep93xx/core.c                     |   32 ++
 arch/arm/mach-ep93xx/dma-m2p.c                  |    2 +-
 arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h    |    1 +
 arch/arm/mach-ep93xx/simone.c                   |    1 +
 sound/soc/ep93xx/Kconfig                        |   17 +-
 sound/soc/ep93xx/Makefile                       |    4 +
 sound/soc/ep93xx/ep93xx-ac97.c                  |  476 +++++++++++++++++++++++
 sound/soc/ep93xx/ep93xx-ac97.h                  |   17 +
 sound/soc/ep93xx/simone.c                       |   80 ++++
 10 files changed, 629 insertions(+), 2 deletions(-)
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.c
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.h
 create mode 100644 sound/soc/ep93xx/simone.c
#1 lore raw

PATCH v2 1/4 ARM: ep93xx: DMA: fix channel_disable

When channel_disable() is called, it disables per channel interrupts and waits until channels state becomes STATE_STALL, and then disables the channel. Now, if the DMA transfer is disabled while the channel is in STATE_NEXT we will not wait anything and disable the channel immediately. This seems to cause weird data corruption for example in audio transfers.

Fix is to wait while we are in STATE_NEXT or STATE_ON and only then disable the channel.

---
 arch/arm/mach-ep93xx/dma-m2p.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-ep93xx/dma-m2p.c +1 -1
index 8904ca4..a696d35 100644
@@ -276,7 +276,7 @@ static void channel_disable(struct m2p_channel *ch)
 	v &= ~(M2P_CONTROL_STALL_IRQ_EN | M2P_CONTROL_NFB_IRQ_EN);
 	m2p_set_control(ch, v);
 
-	while (m2p_channel_state(ch) == STATE_ON)
+	while (m2p_channel_state(ch) >= STATE_ON)
 		cpu_relax();
 
 	m2p_set_control(ch, 0x0);
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH v2 2/4 ASoC: add ep93xx AC97 audio driver

In reply to Mika Westerberg

Add support for AC97 controllers found in Cirrus Logic EP93xx family SoCs.

---
 sound/soc/ep93xx/Kconfig       |    8 +-
 sound/soc/ep93xx/Makefile      |    2 +
 sound/soc/ep93xx/ep93xx-ac97.c |  476 ++++++++++++++++++++++++++++++++++++++++
 sound/soc/ep93xx/ep93xx-ac97.h |   17 ++
 4 files changed, 502 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.c
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.h
sound/soc/ep93xx/Kconfig +7 -1
index f617f56..4a9d236 100644
@@ -3,11 +3,17 @@ config SND_EP93XX_SOC
 	depends on ARCH_EP93XX && SND_SOC
 	help
 	  Say Y or M if you want to add support for codecs attached to
-	  the EP93xx I2S interface.
+	  the EP93xx I2S or AC97 interfaces.
 
 config SND_EP93XX_SOC_I2S
 	tristate
 
+config SND_EP93XX_SOC_AC97
+	tristate
+	select AC97_BUS
+	select SND_AC97_CODEC
+	select SND_SOC_AC97_BUS
+
 config SND_EP93XX_SOC_SNAPPERCL15
         tristate "SoC Audio support for Bluewater Systems Snapper CL15 module"
         depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15
sound/soc/ep93xx/Makefile +2 -0
index 272e60f..ac06e00 100644
@@ -1,9 +1,11 @@
 # EP93xx Platform Support
 snd-soc-ep93xx-objs				:= ep93xx-pcm.o
 snd-soc-ep93xx-i2s-objs	 			:= ep93xx-i2s.o
+snd-soc-ep93xx-ac97-objs 			:= ep93xx-ac97.o
 
 obj-$(CONFIG_SND_EP93XX_SOC)			+= snd-soc-ep93xx.o
 obj-$(CONFIG_SND_EP93XX_SOC_I2S)		+= snd-soc-ep93xx-i2s.o
+obj-$(CONFIG_SND_EP93XX_SOC_AC97)		+= snd-soc-ep93xx-ac97.o
 
 # EP93XX Machine Support
 snd-soc-snappercl15-objs			:= snappercl15.o
sound/soc/ep93xx/ep93xx-ac97.c new file +476 -0

476 lines not on this page · raw message

sound/soc/ep93xx/ep93xx-ac97.h new file +17 -0
new file mode 100644
index 0000000..684c1bb
@@ -0,0 +1,17 @@
+/*
+ * sound/soc/ep93xx/ep93xx-ac97.h
+ * EP93xx AC97 controller driver
+ *
+ * Copyright (c) 2010 Mika Westerberg
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _EP93XX_SND_SOC_AC97_H
+#define _EP93XX_SND_SOC_AC97_H
+
+extern struct snd_soc_dai ep93xx_ac97_dai;
+
+#endif /* _EP93XX_SND_SOC_AC97_H */
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH v2 3/4 ARM: ep93xx: add AC97 platform support

In reply to Mika Westerberg

Add platform support for the EP93xx AC97 controller driver.

---
 arch/arm/mach-ep93xx/core.c                     |   32 +++++++++++++++++++++++
 arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h    |    1 +
 3 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/mach-ep93xx/core.c +32 -0
index 4cb55d3..6f514c4 100644
@@ -826,6 +826,38 @@ void ep93xx_i2s_release(void)
 }
 EXPORT_SYMBOL(ep93xx_i2s_release);
 
+/*************************************************************************
+ * EP93xx AC97 audio peripheral handling
+ *************************************************************************/
+static struct resource ep93xx_ac97_resources[] = {
+	{
+		.start	= EP93XX_AAC_PHYS_BASE,
+		.end	= EP93XX_AAC_PHYS_BASE + 0xb0 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= IRQ_EP93XX_AACINTR,
+		.end	= IRQ_EP93XX_AACINTR,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device ep93xx_ac97_device = {
+	.name		= "ep93xx-ac97",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(ep93xx_ac97_resources),
+	.resource	= ep93xx_ac97_resources,
+};
+
+void __init ep93xx_register_ac97(void)
+{
+	/*
+	 * Make sure that the AC97 pins are not used by I2S.
+	 */
+	ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97);
+	platform_device_register(&ep93xx_ac97_device);
+}
+
 extern void ep93xx_gpio_init(void);
 
 void __init ep93xx_init_devices(void)
arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +1 -0
index c54b3e5..9ac4d10 100644
@@ -105,6 +105,7 @@
 #define EP93XX_GPIO_B_INT_STATUS	EP93XX_GPIO_REG(0xbc)
 #define EP93XX_GPIO_EEDRIVE		EP93XX_GPIO_REG(0xc8)
 
+#define EP93XX_AAC_PHYS_BASE		EP93XX_APB_PHYS(0x00080000)
 #define EP93XX_AAC_BASE			EP93XX_APB_IOMEM(0x00080000)
 
 #define EP93XX_SPI_PHYS_BASE		EP93XX_APB_PHYS(0x000a0000)
arch/arm/mach-ep93xx/include/mach/platform.h +1 -0
index 3330b36..5066045 100644
@@ -61,6 +61,7 @@ void ep93xx_keypad_release_gpio(struct platform_device *pdev);
 void ep93xx_register_i2s(void);
 int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config);
 void ep93xx_i2s_release(void);
+void ep93xx_register_ac97(void);
 
 void ep93xx_init_devices(void);
 extern struct sys_timer ep93xx_timer;
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH v2 4/4 ASoC: ep93xx: add Simplemachines Sim.One AC97 audio support

In reply to Mika Westerberg

Add AC97 audio support for Simplemachines Sim.One board.

---
 arch/arm/mach-ep93xx/simone.c |    1 +
 sound/soc/ep93xx/Kconfig      |    9 +++++
 sound/soc/ep93xx/Makefile     |    2 +
 sound/soc/ep93xx/simone.c     |   80 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/ep93xx/simone.c
arch/arm/mach-ep93xx/simone.c +1 -0
index 5dded58..f5f81f9 100644
@@ -61,6 +61,7 @@ static void __init simone_init_machine(void)
 	ep93xx_register_fb(&simone_fb_info);
 	ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info,
 			    ARRAY_SIZE(simone_i2c_board_info));
+	ep93xx_register_ac97();
 }
 
 MACHINE_START(SIM_ONE, "Simplemachines Sim.One Board")
sound/soc/ep93xx/Kconfig +9 -0
index 4a9d236..4aa6087 100644
@@ -22,3 +22,12 @@ config SND_EP93XX_SOC_SNAPPERCL15
         help
           Say Y or M here if you want to add support for I2S audio on the
           Bluewater Systems Snapper CL15 module.
+
+config SND_EP93XX_SOC_SIMONE
+	tristate "SoC Audio support for Simplemachines Sim.One board"
+	depends on SND_EP93XX_SOC && MACH_SIM_ONE
+	select SND_EP93XX_SOC_AC97
+	select SND_SOC_AC97_CODEC
+	help
+	  Say Y or M here if you want to add support for AC97 audio on the
+	  Simplemachines Sim.One board.
sound/soc/ep93xx/Makefile +2 -0
index ac06e00..8e7977f 100644
@@ -9,5 +9,7 @@ obj-$(CONFIG_SND_EP93XX_SOC_AC97)		+= snd-soc-ep93xx-ac97.o
 
 # EP93XX Machine Support
 snd-soc-snappercl15-objs			:= snappercl15.o
+snd-soc-simone-objs				:= simone.o
 
 obj-$(CONFIG_SND_EP93XX_SOC_SNAPPERCL15)	+= snd-soc-snappercl15.o
+obj-$(CONFIG_SND_EP93XX_SOC_SIMONE)		+= snd-soc-simone.o
sound/soc/ep93xx/simone.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
1.5.6.5