Skip to contentSkip to conversation

ASoC AC97 audio support for ep93xx

PATCH Applied Mika Westerberg 5 participants 10 messages Oct 14, 2010 – Oct 15, 2010

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

v3 cover ASoC AC97 audio support for ep93xx

Hi,

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).

Changes the previous version:
- rebased against latest ASoC tree (added support for multicomponent ASoC)
- fixed according comments by Mark Brown
- patch 1/4 (DMA fix) is now in ARM tree so dropped from this series.

Thanks,
MW

Mika Westerberg (3):
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                     |   34 ++
 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                        |   16 +-
 sound/soc/ep93xx/Makefile                       |    4 +
 sound/soc/ep93xx/ep93xx-ac97.c                  |  468 +++++++++++++++++++++++
 sound/soc/ep93xx/simone.c                       |   89 +++++
 8 files changed, 613 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.c
 create mode 100644 sound/soc/ep93xx/simone.c
#1 lore raw

PATCH v3 1/3 ASoC: add ep93xx AC97 audio driver

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

---
 sound/soc/ep93xx/Kconfig       |    7 +-
 sound/soc/ep93xx/Makefile      |    2 +
 sound/soc/ep93xx/ep93xx-ac97.c |  468 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 476 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.c
sound/soc/ep93xx/Kconfig +6 -1
index f617f56..108e5ff 100644
@@ -3,11 +3,16 @@ 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_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 +468 -0

468 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#2 lore raw

PATCH v3 2/3 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                     |   34 +++++++++++++++++++++++
 arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h    |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-ep93xx/core.c +34 -0
index 1990e22..ffdf87b 100644
@@ -832,6 +832,40 @@ 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);
+	platform_device_register(&ep93xx_pcm_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
Acked-by on v3 2/3
#3 lore raw

Re: [PATCH v3 2/3] ARM: ep93xx: add AC97 platform support

Quoted 8 lines · Mika Westerberg

Add platform support for the EP93xx AC97 controller driver.

---
 arch/arm/mach-ep93xx/core.c                     |   34 +++++++++++++++++++++++
 arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h    |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)

Looks good.

Quoted 69 lines
arch/arm/mach-ep93xx/core.c +34 -0
index 1990e22..ffdf87b 100644
@@ -832,6 +832,40 @@ 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);
+	platform_device_register(&ep93xx_pcm_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 · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
[email protected]         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#4 lore raw

RE: [PATCH v3 2/3] ARM: ep93xx: add AC97 platform support

In reply to Mika Westerberg
Quoted 15 lines · Mika Westerberg

Add platform support for the EP93xx AC97 controller driver.

---
 arch/arm/mach-ep93xx/core.c                     |   34 +++++++++++++++++++++++
 arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h    |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-ep93xx/core.c +0 -0
index 1990e22..ffdf87b 100644

arch/arm/mach-ep93xx/core.c void ep93xx_i2s_release(void) · line 841

Quoted 10 lines
arch/arm/mach-ep93xx/core.c +7 -0
@@ -832,6 +832,40 @@ 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,

The last register in the AC97 peripheral is AC97GCIS at offset 0xa8. So the end address should be:

	.end	= EP93XX_AAC_PHYS_BASE + 0xac - 1,
Quoted 12 lines
arch/arm/mach-ep93xx/core.c +12 -0
+		.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,

arch/arm/mach-ep93xx/core.c void ep93xx_i2s_release(void) · line 863

Quoted 10 lines
arch/arm/mach-ep93xx/core.c +10 -0
+	.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);

This is fine for now.

Eventually some thought should go into a proper iomux to prevent loading drivers with conflicting pin requirements. Currently, depending on the configuration, this could break if a user should try to use the ac97 and i2s audio at the same time (I2SONAC97 mode). But, the same problem already exists if a user tries using spi and i2s audio (I2SONSSP mode).

Quoted 25 lines
arch/arm/mach-ep93xx/core.c +5 -0
+
+	platform_device_register(&ep93xx_ac97_device);
+	platform_device_register(&ep93xx_pcm_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 +0 -0
index 3330b36..5066045 100644

arch/arm/mach-ep93xx/include/mach/platform.h void ep93xx_keypad_release_gpio(struct platform_device *pdev); · line 67

Quoted 7 lines
arch/arm/mach-ep93xx/include/mach/platform.h +1 -0
@@ -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;

Other than the end resource this all looks fine.

#5 lore raw

Re: [PATCH v3 2/3] ARM: ep93xx: add AC97 platform support

Quoted 11 lines · H Hartley Sweeten

arch/arm/mach-ep93xx/core.c void ep93xx_i2s_release(void) · line 863

Quoted 6 lines · Mika Westerberg
arch/arm/mach-ep93xx/core.c +6 -0
+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);

This is fine for now.

Quoted 6 lines

Eventually some thought should go into a proper iomux to prevent loading drivers with conflicting pin requirements. Currently, depending on the configuration, this could break if a user should try to use the ac97 and i2s audio at the same time (I2SONAC97 mode). But, the same problem already exists if a user tries using spi and i2s audio (I2SONSSP mode).

I initially suggested this also, since we have acquire/release functions for some other drivers, but I now think this is fine as is. It's highly unlikely that a board is going to have both I2S and AC97 audio. We can change this later if such a board shows up, no need to make the code more complicated for hypothetical boards :-).

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
[email protected]         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#6 lore raw

RE: [PATCH v3 2/3] ARM: ep93xx: add AC97 platform support

Quoted 19 lines · Ryan Mallon
Quoted 11 lines · H Hartley Sweeten

arch/arm/mach-ep93xx/core.c void ep93xx_i2s_release(void) · line 863

Quoted 7 lines · Mika Westerberg
arch/arm/mach-ep93xx/core.c +6 -0
+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);

This is fine for now.

Quoted 6 lines

Eventually some thought should go into a proper iomux to prevent loading drivers with conflicting pin requirements. Currently, depending on the configuration, this could break if a user should try to use the ac97 and i2s audio at the same time (I2SONAC97 mode). But, the same problem already exists if a user tries using spi and i2s audio (I2SONSSP mode).

Quoted 5 lines

I initially suggested this also, since we have acquire/release functions for some other drivers, but I now think this is fine as is. It's highly unlikely that a board is going to have both I2S and AC97 audio. We can change this later if such a board shows up, no need to make the code more complicated for hypothetical boards :-).

Agree. That's why I said eventually.... ;-)

The only platforms I know of that have both audio systems are the EDB9307, EDB9312, and EDB9315 boards from Cirrus. I don't have any of these so, unless someone steps up with one to test, Mika's implementation is fine.

Regards,
Hartley

#7 lore raw

PATCH v3 3/3 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     |   89 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 101 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 108e5ff..5742904 100644
@@ -21,3 +21,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 +89 -0

89 lines not on this page · raw message

Signature · 1 line
1.5.6.5
Acked-by on the v3 series
#8 lore raw
In reply to Mika Westerberg
Quoted 21 lines · Mika Westerberg

Hi,

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).

Changes the previous version:
- rebased against latest ASoC tree (added support for multicomponent ASoC)
- fixed according comments by Mark Brown
- patch 1/4 (DMA fix) is now in ARM tree so dropped from this series.

Thanks,
MW

Mika Westerberg (3):
ASoC: add ep93xx AC97 audio driver
ARM: ep93xx: add AC97 platform support
ASoC: ep93xx: add Simplemachines Sim.One AC97 audio support

Quoted 11 lines
 arch/arm/mach-ep93xx/core.c                     |   34 ++
 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                        |   16 +-
 sound/soc/ep93xx/Makefile                       |    4 +
 sound/soc/ep93xx/ep93xx-ac97.c                  |  468 +++++++++++++++++++++++
 sound/soc/ep93xx/simone.c                       |   89 +++++
 8 files changed, 613 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/ep93xx/ep93xx-ac97.c
 create mode 100644 sound/soc/ep93xx/simone.c

All

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Applied
#9 lore raw
In reply to Mika Westerberg
Quoted 3 lines · Mika Westerberg

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).

Applied all, thanks.