ASoC for Alchemy Au1000/1500/1100
v5 cover ASoC for Alchemy Au1000/1500/1100
Hello,
Here's V5 of the AC97/I2S ASoC patchset for early Alchemy chips and their respective evaluation boards.
The patches are largely based on the old mips/au1x00.c driver which they replace.
AC97 Tested on a Db1500 development board; I2S untested since none of the testboards I have actually have an I2S codec (just testpoints).
Changes since V4:
- incorporate feedback from Liam Girdwood.
- rediff against latest ASoC changes
Changes since V3:
- dropped the hunk which removed the I2S constants from the au1000.h header to avoid merge conflicts with other patches.
- use the context structure declared in psc.h. Follow-up patches for psc* code depend on this.
Changes since V2:
- implemented changes after feedback from Lars-Peter Clausen:
* split patch 1 in two, one for the ASoC drivers, and a separate for DB1000 machine code.
* get rid of automatic dma device registration
* tidied the I2S/AC97 sources
- mark sound/mips/au1x00.c as DEPRECATED instead of removing it outright.
Changes since V1:
- added untested I2S controller driver for completeness, removed the audio defines from the au1000 header.
Manuel Lauss (3):
ASoC: Alchemy AC97C/I2SC audio support
ASoC: Add a DB1x00 AC97 machine driver
ALSA: deprecate MIPS AU1X00 AC97 driver
arch/mips/alchemy/devboards/db1x00/platform.c | 48 ++++ sound/mips/Kconfig | 5 +- sound/soc/au1x/Kconfig | 28 ++ sound/soc/au1x/Makefile | 10 + sound/soc/au1x/ac97c.c | 365 ++++++++++++++++++++++++ sound/soc/au1x/db1000.c | 75 +++++ sound/soc/au1x/dma.c | 377 +++++++++++++++++++++++++ sound/soc/au1x/i2sc.c | 347 +++++++++++++++++++++++ sound/soc/au1x/psc.h | 19 +- 9 files changed, 1264 insertions(+), 10 deletions(-) create mode 100644 sound/soc/au1x/ac97c.c create mode 100644 sound/soc/au1x/db1000.c create mode 100644 sound/soc/au1x/dma.c create mode 100644 sound/soc/au1x/i2sc.c
Signature · 1 line
1.7.6
PATCH v5 1/3 ASoC: Alchemy AC97C/I2SC audio support
This patch adds ASoC support for the AC97 and I2S controllers on the old Au1000/Au1500/Au1100 chips,
AC97 Tested on a Db1500. I2S untested since none of the boards actually have an I2S codec wired up (just test pins).
---
V5: incorporate feedback from Liam Girdwood
V4: dropped hunk which removed I2S constants in au1000.h header to avoid merge
conflicts with other patches, use the context structure in psc.h since it fits really well.
V3: implemented feedback from Lars-Peter Clausen: src tidying, no more
automatic dma device registration, split off db1000 board code.
V2: added untested I2S controller driver for completeness, removed the audio
defines from the au1000 header as well.
sound/soc/au1x/Kconfig | 19 +++ sound/soc/au1x/Makefile | 8 + sound/soc/au1x/ac97c.c | 365 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/au1x/dma.c | 377 +++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/au1x/i2sc.c | 347 +++++++++++++++++++++++++++++++++++++++++++ sound/soc/au1x/psc.h | 19 ++- 6 files changed, 1126 insertions(+), 9 deletions(-) create mode 100644 sound/soc/au1x/ac97c.c create mode 100644 sound/soc/au1x/dma.c create mode 100644 sound/soc/au1x/i2sc.c
sound/soc/au1x/Kconfig +19 -0
@@ -18,6 +18,25 @@ config SND_SOC_AU1XPSC_AC97 select SND_AC97_CODEC select SND_SOC_AC97_BUS +## +## Au1000/1500/1100 DMA + AC97C/I2SC +## +config SND_SOC_AU1XAUDIO + tristate "SoC Audio for Au1000/Au1500/Au1100" + depends on MIPS_ALCHEMY + help + This is a driver set for the AC97 unit and the + old DMA controller as found on the Au1000/Au1500/Au1100 chips. + +config SND_SOC_AU1XAC97C + tristate + select AC97_BUS + select SND_AC97_CODEC + select SND_SOC_AC97_BUS + +config SND_SOC_AU1XI2SC + tristate + ## ## Boards
sound/soc/au1x/Makefile +8 -0
@@ -3,9 +3,17 @@ snd-soc-au1xpsc-dbdma-objs := dbdma2.o snd-soc-au1xpsc-i2s-objs := psc-i2s.o snd-soc-au1xpsc-ac97-objs := psc-ac97.o +# Au1000/1500/1100 Audio units +snd-soc-au1x-dma-objs := dma.o +snd-soc-au1x-ac97c-objs := ac97c.o +snd-soc-au1x-i2sc-objs := i2sc.o + obj-$(CONFIG_SND_SOC_AU1XPSC) += snd-soc-au1xpsc-dbdma.o obj-$(CONFIG_SND_SOC_AU1XPSC_I2S) += snd-soc-au1xpsc-i2s.o obj-$(CONFIG_SND_SOC_AU1XPSC_AC97) += snd-soc-au1xpsc-ac97.o +obj-$(CONFIG_SND_SOC_AU1XAUDIO) += snd-soc-au1x-dma.o +obj-$(CONFIG_SND_SOC_AU1XAC97C) += snd-soc-au1x-ac97c.o +obj-$(CONFIG_SND_SOC_AU1XI2SC) += snd-soc-au1x-i2sc.o # Boards snd-soc-db1200-objs := db1200.o
sound/soc/au1x/ac97c.c new file +365 -0
365 lines not on this page · raw message
sound/soc/au1x/dma.c new file +377 -0
377 lines not on this page · raw message
sound/soc/au1x/i2sc.c new file +347 -0
347 lines not on this page · raw message
sound/soc/au1x/psc.h +10 -9
@@ -1,7 +1,7 @@/* -* Au12x0/Au1550 PSC ALSA ASoC audio support. +* Alchemy ALSA ASoC audio support. * -* (c) 2007-2008 MSC Vertriebsges.m.b.H., +* (c) 2007-2011 MSC Vertriebsges.m.b.H., * Manuel Lauss <[email protected]> * * This program is free software; you can redistribute it and/or modify
@@ -13,7 +13,13 @@#ifndef _AU1X_PCM_H#define _AU1X_PCM_H -/* DBDMA helpers */ +#define PCM_TX 0 +#define PCM_RX 1 + +#define SUBSTREAM_TYPE (substream) \ + ((substream)->stream == SNDRV_PCM_STREAM_PLAYBACK ? PCM_TX : PCM_RX) + +/* PSC/DBDMA helpers */ extern struct platform_device *au1xpsc_pcm_add (struct platform_device *pdev);extern void au1xpsc_pcm_destroy (struct platform_device *dmapd);
@@ -27,15 +33,10 @@ struct au1xpsc_audio_data {unsigned long pm[2 ];struct mutex lock; +int dmaids[2 ];struct platform_device *dmapd; }; -#define PCM_TX 0 -#define PCM_RX 1 - -#define SUBSTREAM_TYPE (substream) \ - ((substream)->stream == SNDRV_PCM_STREAM_PLAYBACK ? PCM_TX : PCM_RX) -/* easy access macros */ #define PSC_CTRL (x) ((unsigned long)((x)->mmio) + PSC_CTRL_OFFSET)#define PSC_SEL (x) ((unsigned long)((x)->mmio) + PSC_SEL_OFFSET)
Signature · 1 line
1.7.6
Re: [PATCH V5 1/3] ASoC: Alchemy AC97C/I2SC audio support
On Mon, Jul 25, 2011 at 01:44:45PM +0200, Manuel Lauss wrote:
Looks good, I'll apply this but a few minor comments you might want to look at incrementally.
sound/soc/au1x/dma.c line 30
Quoted 7 lines
sound/soc/au1x/dma.c new file +7
-0+#define ALCHEMY_PCM_FMTS \ + (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | \ + SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE | \ + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE | \ + SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_U32_BE | \ + 0)
Why the | 0? Same for the other one.
sound/soc/au1x/dma.c line 165
Quoted 7 lines
sound/soc/au1x/dma.c new file +7
-0+case (DMA_D0 |DMA_D1 ): +pr_debug ("DMA %d missed interrupt.\n" , stream->dma); +au1000_dma_stop (stream); +au1000_dma_start (stream); +break ; +case (~DMA_D0 & ~DMA_D1 ): +pr_debug ("DMA %d empty irq.\n" , stream->dma);
This case should return IRQ_NONE really since it didn't handle an interrupt...
Re: [PATCH V5 1/3] ASoC: Alchemy AC97C/I2SC audio support
Quoted 13 lines · Mark Brown
On Mon, Jul 25, 2011 at 01:44:45PM +0200, Manuel Lauss wrote:
Looks good, I'll apply this but a few minor comments you might want to look at incrementally.
Quoted 7 lines
+#define
ALCHEMY_PCM_FMTS\
+ (SNDRV_PCM_FMTBIT_S8|SNDRV_PCM_FMTBIT_U8| \+ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | \ + SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE | \ + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE | \ + SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_U32_BE | \+ 0)
Quoted 1 line
Why the | 0? Same for the other one.
Old habit in case I need to insert other format bits in the future (then the second-to-last line need not be changed in a patch).
Quoted 10 lines
Quoted 7 lines
+ case (
DMA_D0|DMA_D1):
+pr_debug("DMA %d missed interrupt.\n", stream->dma);
+au1000_dma_stop(stream);
+au1000_dma_start(stream);
+ break;
+ case (~DMA_D0 & ~DMA_D1):
+pr_debug("DMA %d empty irq.\n", stream->dma);This case should return
IRQ_NONEreally since it didn't handle an interrupt...
If that last case ever happens the DMA engine is broken, as it shouldn't issue interrupts when no transfer is in progress. The errata sheets don't mention anything (yet).
Thanks!
Manuel Lauss
Re: [PATCH V5 1/3] ASoC: Alchemy AC97C/I2SC audio support
Quoted 11 lines · Manuel Lauss
On Tue, Jul 26, 2011 at 4:31 PM, Mark Brown
Quoted 5 lines
Quoted 2 lines
+ case (~DMA_D0 & ~DMA_D1):
+pr_debug("DMA %d empty irq.\n", stream->dma);This case should return
IRQ_NONEreally since it didn't handle an interrupt...If that last case ever happens the DMA engine is broken, as it shouldn't issue interrupts when no transfer is in progress. The errata sheets don't mention anything (yet).
In that case this should be an error rather than debug level print and I'd say the IRQ_NONE thing definitely applies.
PATCH v5 2/3 ASoC: Add a DB1x00 AC97 machine driver
In reply to Manuel LaussAdd a machine driver suitable for the AC97 part on the DB1000/DB1500/DB1100 boards.
Run-tested on DB1500.
---
V4/V5: no changes.
V3: split off from patch 1, implemented new machine code.
arch/mips/alchemy/devboards/db1x00/platform.c | 48 ++++++++++++++++ sound/soc/au1x/Kconfig | 9 +++ sound/soc/au1x/Makefile | 2 + sound/soc/au1x/db1000.c | 75 +++++++++++++++++++++++++ 4 files changed, 134 insertions(+), 0 deletions(-) create mode 100644 sound/soc/au1x/db1000.c
arch/mips/alchemy/devboards/db1x00/platform.c +48 -0
@@ -19,8 +19,11 @@*/ #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/platform_device.h> +#include <asm/mach-au1x00/au1000.h> +#include <asm/mach-au1x00/au1000_dma.h> #include <asm/mach-au1x00/au1xxx.h> #include <asm/mach-db1x00/bcsr.h> #include "../platform.h"
@@ -85,6 +88,45 @@#endif #endif +static struct resource alchemy_ac97c_res[] = { + [0 ] = { + .start =AU1000_AC97_PHYS_ADDR , + .end =AU1000_AC97_PHYS_ADDR +0xfff , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =DMA_ID_AC97C_TX , + .end =DMA_ID_AC97C_TX , + .flags =IORESOURCE_DMA , + }, + [2 ] = { + .start =DMA_ID_AC97C_RX , + .end =DMA_ID_AC97C_RX , + .flags =IORESOURCE_DMA , + }, +}; + +static struct platform_device alchemy_ac97c_dev = { + .name ="alchemy-ac97c" , + .id =-1 , + .resource = alchemy_ac97c_res, + .num_resources =ARRAY_SIZE (alchemy_ac97c_res), +}; + +static struct platform_device alchemy_ac97c_dma_dev = { + .name ="alchemy-pcm-dma" , + .id =0 , +}; + +static struct platform_device db1x00_codec_dev = { + .name ="ac97-codec" , + .id =-1 , +}; + +static struct platform_device db1x00_audio_dev = { + .name ="db1000-audio" , +}; +static int __init db1xxx_dev_init (void ) {#ifdef DB1XXX_HAS_PCMCIA
@@ -113,6 +155,12 @@ static int __init db1xxx_dev_init(void) 1);#endif db1x_register_norflash (BOARD_FLASH_SIZE ,BOARD_FLASH_WIDTH ,F_SWAPPED ); + +platform_device_register (&db1x00_codec_dev); +platform_device_register (&alchemy_ac97c_dma_dev); +platform_device_register (&alchemy_ac97c_dev); +platform_device_register (&db1x00_audio_dev); +return 0 ; }device_initcall (db1xxx_dev_init);
sound/soc/au1x/Kconfig +9 -0
@@ -41,6 +41,15 @@ config SND_SOC_AU1XI2SC ## ## Boards ## +config SND_SOC_DB1000 + tristate "DB1000 Audio support" + depends on SND_SOC_AU1XAUDIO + select SND_SOC_AU1XAC97C + select SND_SOC_AC97_CODEC + help + Select this option to enable AC97 audio on the early DB1x00 series + of boards (DB1000/DB1500/DB1100). + config SND_SOC_DB1200 tristate "DB1200 AC97+I2S audio support" depends on SND_SOC_AU1XPSC
sound/soc/au1x/Makefile +2 -0
@@ -16,6 +16,8 @@ obj-$(CONFIG_SND_SOC_AU1XAC97C) += snd-soc-au1x-ac97c.o obj-$(CONFIG_SND_SOC_AU1XI2SC) += snd-soc-au1x-i2sc.o # Boards +snd-soc-db1000-objs := db1000.o snd-soc-db1200-objs := db1200.o +obj-$(CONFIG_SND_SOC_DB1000) += snd-soc-db1000.o obj-$(CONFIG_SND_SOC_DB1200) += snd-soc-db1200.o
sound/soc/au1x/db1000.c new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
1.7.6
Re: [PATCH V5 2/3] ASoC: Add a DB1x00 AC97 machine driver
Quoted 6 lines · Manuel Lauss
Add a machine driver suitable for the AC97 part on the DB1000/DB1500/DB1100 boards.
Run-tested on DB1500.
Signed-off-by Manuel Lauss <[email protected]>
Since you've got both arch/ and sound/ changes in here I need an ack from the MIPS maintainers for this one before I can apply it.
Ralf Baechle
Acked-byRe: [PATCH V5 2/3] ASoC: Add a DB1x00 AC97 machine driver
Quoted 10 lines · Mark Brown
Quoted 6 lines · Manuel Lauss
Add a machine driver suitable for the AC97 part on the DB1000/DB1500/DB1100 boards.
Run-tested on DB1500.
Signed-off-by Manuel Lauss <[email protected]>Since you've got both
arch/andsound/changes in here I need an ack from the MIPS maintainers for this one before I can apply it.
Ack, ack, ack...
Ralf
Mark Brown
AppliedRe: [PATCH V5 2/3] ASoC: Add a DB1x00 AC97 machine driver
In reply to Manuel LaussQuoted 2 lines · Manuel Lauss
Add a machine driver suitable for the AC97 part on the DB1000/DB1500/DB1100 boards.
Applied, thanks.
PATCH v5 3/3 ALSA: deprecate MIPS AU1X00 AC97 driver
In reply to Manuel LaussNow that an ASoC variant is available, tell users that this driver is now living on borrowed time...
---
V4/V5: no changes.
V3: mark driver DEPRECATED instead of removing it outright.
sound/mips/Kconfig | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
sound/mips/Kconfig +4 -1
@@ -23,12 +23,15 @@ config SND_SGI_HAL2 config SND_AU1X00 - tristate "Au1x00 AC97 Port Driver" + tristate "Au1x00 AC97 Port Driver (DEPRECATED)" depends on SOC_AU1000 || SOC_AU1100 || SOC_AU1500 select SND_PCM select SND_AC97_CODEC help ALSA Sound driver for the Au1x00's AC97 port. + Newer drivers for ASoC are available, please do not use + this driver as it will be removed in the future. + endif # SND_MIPS
Signature · 1 line
1.7.6
Mark Brown
AppliedRe: [PATCH V5 3/3] ALSA: deprecate MIPS AU1X00 AC97 driver
Quoted 2 lines · Manuel Lauss
Now that an ASoC variant is available, tell users that this driver is now living on borrowed time...
Applied, thanks.
Quoted 37 lines · Manuel Lauss
Hello,
Here's V5 of the AC97/I2S ASoC patchset for early Alchemy chips and their respective evaluation boards.
The patches are largely based on the oldmips/au1x00.cdriver which they replace.AC97 Tested on a Db1500 development board; I2S untested since none of the testboards I have actually have an I2S codec (just testpoints).
Changes since V4:
- incorporate feedback from Liam Girdwood.
- rediff against latest ASoC changesChanges since V3:
- dropped the hunk which removed the I2S constants from theau1000.hheader to avoid merge conflicts with other patches.
- use the context structure declared inpsc.h. Follow-up patches for psc* code depend on this.Changes since V2:
- implemented changes after feedback from Lars-Peter Clausen:
* split patch 1 in two, one for the ASoC drivers, and a separate for DB1000 machine code.
* get rid of automatic dma device registration
* tidied the I2S/AC97 sources
- marksound/mips/au1x00.cas DEPRECATED instead of removing it outright.Changes since V1:
- added untested I2S controller driver for completeness, removed the audio defines from the au1000 header.Manuel Lauss (3):
ASoC: Alchemy AC97C/I2SC audio support
ASoC: Add a DB1x00 AC97 machine driver
ALSA: deprecate MIPS AU1X00 AC97 driver
Quoted 15 lines
arch/mips/alchemy/devboards/db1x00/platform.c | 48 ++++ sound/mips/Kconfig | 5 +- sound/soc/au1x/Kconfig | 28 ++ sound/soc/au1x/Makefile | 10 + sound/soc/au1x/ac97c.c | 365 ++++++++++++++++++++++++ sound/soc/au1x/db1000.c | 75 +++++ sound/soc/au1x/dma.c | 377 +++++++++++++++++++++++++ sound/soc/au1x/i2sc.c | 347 +++++++++++++++++++++++ sound/soc/au1x/psc.h | 19 +- 9 files changed, 1264 insertions(+), 10 deletions(-) create mode 100644 sound/soc/au1x/ac97c.c create mode 100644 sound/soc/au1x/db1000.c create mode 100644 sound/soc/au1x/dma.c create mode 100644 sound/soc/au1x/i2sc.c
All