Skip to contentSkip to conversation

ASoC: Add WM8510 driver

PATCH In review Mark Brown 2 participants 5 messages Jun 5, 2008 – Jun 6, 2008 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/3 ASoC: Add WM8510 driver

The WM8510 is a mono CODEC with speaker driver optimised for telephony applications, featuring:
- 16/20/24/32 bit audio at data rates between 8kHz and 48kHz
- On-chip PLL
- Dual microphone inputs

This driver was originally written by Liam Girdwood with updates from Brett Saunders, Geoffrey Wossum and myself.

---
 sound/soc/codecs/Kconfig  |    3 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/wm8510.c |  836 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/wm8510.h |  103 ++++++
 4 files changed, 944 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/wm8510.c
 create mode 100644 sound/soc/codecs/wm8510.h
sound/soc/codecs/Kconfig +3 -0
index 7beefcc..ef400b3 100644
@@ -5,6 +5,9 @@ config SND_SOC_AC97_CODEC
 config SND_SOC_UDA1380
         tristate
 
+config SND_SOC_WM8510
+	tristate
+
 config SND_SOC_WM8731
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index d5926a1..b92c665 100644
@@ -1,5 +1,6 @@
 snd-soc-ac97-objs := ac97.o
 snd-soc-uda1380-objs := uda1380.o
+snd-soc-wm8510-objs := wm8510.o
 snd-soc-wm8731-objs := wm8731.o
 snd-soc-wm8750-objs := wm8750.o
 snd-soc-wm8753-objs := wm8753.o
@@ -10,6 +11,7 @@ snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
 obj-$(CONFIG_SND_SOC_UDA1380)	+= snd-soc-uda1380.o
+obj-$(CONFIG_SND_SOC_WM8510)	+= snd-soc-wm8510.o
 obj-$(CONFIG_SND_SOC_WM8731)	+= snd-soc-wm8731.o
 obj-$(CONFIG_SND_SOC_WM8750)	+= snd-soc-wm8750.o
 obj-$(CONFIG_SND_SOC_WM8753)	+= snd-soc-wm8753.o
sound/soc/codecs/wm8510.c new file +836 -0

836 lines not on this page · raw message

sound/soc/codecs/wm8510.h new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
1.5.5.3

A message that is not in the archive (sent off-list or not yet received): 1212670174-19810-2-git-send-email-broonie@opensource.wolfsonmicro.com

author
#2 lore raw

PATCH 3/3 Revised AT32 ASoC Patch

From: Geoffrey Wossum <[email protected]>

Attached is a revised version of my patch to add AT32 to ASoC. This cleans most of the style issues associated with the previous patch. Also fixes an issue with the playpaq_wm8510.c code depending on a non-released patch to th AT32 portmux support.

Patch is against 2.6.24.3.atmel.3 kernel, the latest AVR32 kernel Atmel has released, with the linux-2.6-asoc patches from when v2.6.24 was tagged also applied.

[Fixed up minor checkpatch issues and updated for current kernels -- broonie]

---
 sound/soc/Kconfig               |    1 +
 sound/soc/Makefile              |    3 +-
 sound/soc/at32/Kconfig          |   34 ++
 sound/soc/at32/Makefile         |   11 +
 sound/soc/at32/at32-pcm.c       |  491 ++++++++++++++++++++++
 sound/soc/at32/at32-pcm.h       |   79 ++++
 sound/soc/at32/at32-ssc.c       |  849 +++++++++++++++++++++++++++++++++++++++
 sound/soc/at32/at32-ssc.h       |   59 +++
 sound/soc/at32/playpaq_wm8510.c |  524 ++++++++++++++++++++++++
 9 files changed, 2050 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/at32/Kconfig
 create mode 100644 sound/soc/at32/Makefile
 create mode 100644 sound/soc/at32/at32-pcm.c
 create mode 100644 sound/soc/at32/at32-pcm.h
 create mode 100644 sound/soc/at32/at32-ssc.c
 create mode 100644 sound/soc/at32/at32-ssc.h
 create mode 100644 sound/soc/at32/playpaq_wm8510.c
sound/soc/Kconfig +1 -0
index fd7bc4f..b939e22 100644
@@ -22,6 +22,7 @@ config SND_SOC_AC97_BUS
 	bool
 
 # All the supported Soc's
+source "sound/soc/at32/Kconfig"
 source "sound/soc/at91/Kconfig"
 source "sound/soc/pxa/Kconfig"
 source "sound/soc/s3c24xx/Kconfig"
sound/soc/Makefile +2 -1
index 782db21..3645f95 100644
@@ -1,4 +1,5 @@
 snd-soc-core-objs := soc-core.o soc-dapm.o
 
 obj-$(CONFIG_SND_SOC)	+= snd-soc-core.o
-obj-$(CONFIG_SND_SOC)	+= codecs/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/ omap/
+obj-$(CONFIG_SND_SOC)	+= codecs/ at32/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/
+obj-$(CONFIG_SND_SOC)	+= omap/
sound/soc/at32/Kconfig new file +34 -0
new file mode 100644
index 0000000..b0765e8
@@ -0,0 +1,34 @@
+config SND_AT32_SOC
+        tristate "SoC Audio for the Atmel AT32 System-on-a-Chip"
+        depends on AVR32 && SND_SOC
+        help
+          Say Y or M if you want to add support for codecs attached to 
+          the AT32 SSC interface.  You will also need to
+          to select the audio interfaces to support below.
+
+
+config SND_AT32_SOC_SSC
+        tristate
+
+
+
+config SND_AT32_SOC_PLAYPAQ
+        tristate "SoC Audio support for PlayPaq with WM8510"
+        depends on SND_AT32_SOC && BOARD_PLAYPAQ
+        select SND_AT32_SOC_SSC
+        select SND_SOC_WM8510
+        help
+          Say Y or M here if you want to add support for SoC audio
+          on the LRS PlayPaq.
+
+
+
+config SND_AT32_SOC_PLAYPAQ_SLAVE
+        bool "Run CODEC on PlayPaq in slave mode"
+        depends on SND_AT32_SOC_PLAYPAQ
+        default n
+        help
+          Say Y if you want to run with the AT32 SSC generating the BCLK
+          and FRAME signals on the PlayPaq.  Unless you want to play
+          with the AT32 as the SSC master, you probably want to say N here,
+          as this will give you better sound quality.
sound/soc/at32/Makefile new file +11 -0
new file mode 100644
index 0000000..c03e55e
@@ -0,0 +1,11 @@
+# AT32 Platform Support
+snd-soc-at32-objs := at32-pcm.o
+snd-soc-at32-ssc-objs := at32-ssc.o
+
+obj-$(CONFIG_SND_AT32_SOC) += snd-soc-at32.o
+obj-$(CONFIG_SND_AT32_SOC_SSC) += snd-soc-at32-ssc.o
+
+# AT32 Machine Support
+snd-soc-playpaq-objs := playpaq_wm8510.o
+
+obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o
sound/soc/at32/at32-pcm.c new file +491 -0

491 lines not on this page · raw message

sound/soc/at32/at32-pcm.h new file +79 -0

79 lines not on this page · raw message

sound/soc/at32/at32-ssc.c new file +849 -0

849 lines not on this page · raw message

sound/soc/at32/at32-ssc.h new file +59 -0

59 lines not on this page · raw message

sound/soc/at32/playpaq_wm8510.c new file +524 -0

524 lines not on this page · raw message

Signature · 1 line
1.5.5.3
#3 lore raw
In reply to Mark Brown
Quoted 4 lines · Mark Brown
sound/soc/codecs/wm8510.c new file +4 -0
+	/* bit size */
+	switch (params_format(params)) {
+	case SNDRV_PCM_FORMAT_S16_LE:
+		break;

sound/soc/codecs/wm8510.c line 503

Quoted 10 lines
sound/soc/codecs/wm8510.c new file +10 -0
+	case SNDRV_PCM_FORMAT_S20_3LE:
+		iface |= 0x0020;
+		break;
+	case SNDRV_PCM_FORMAT_S24_LE:
+		iface |= 0x0040;
+		break;
+	case SNDRV_PCM_FORMAT_S32_LE:
+		iface |= 0x0060;
+		break;
+	}

This should either be changed to use SNDRV_PCM_FORMAT_S16 and friends, which I think will automagically use the correct endian for the selected architecture, or explicitly list both _LE and _BE formats. Not an issue, unless you're using a correct endian, I mean big endian, processor like I am :) I would think this would need to be propagated to other CODEC drivers.

Quoted 2 lines

+#define WM8510_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE
|\ + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)

Same thing with big endian here.

Mark, were able to verify that the default value SPKMIX differs from the datasheet? Is this a datasheet mistake, or an issue in the WM8510 part I have? The full markings on the part are "WM8510G / 63AETV9", and the datasheet is "February 2008, Rev 4.4".

---
Geoffrey

author
#4 lore raw
Quoted 10 lines · Geoffrey Wossum

sound/soc/codecs/wm8510.c line 503

Quoted 4 lines · Mark Brown
sound/soc/codecs/wm8510.c new file +4 -0
+	case SNDRV_PCM_FORMAT_S32_LE:
+		iface |= 0x0060;
+		break;
+	}

This should either be changed to use SNDRV_PCM_FORMAT_S16 and friends, which I think will automagically use the correct endian for the selected architecture, or explicitly list both _LE and _BE formats. Not an issue,

It should list both. The codec really doesn't care how the data is laid out in memory, it's up to the other end of the link to format it into the appropriate format for the bus and there's no reason why controllers wouldn't be able to offer byteswapping.

Quoted 2 lines

unless you're using a correct endian, I mean big endian, processor like I am :) I would think this would need to be propagated to other CODEC drivers.

Yes - I've got a change queued up to do this which applies it uniformly over all codec drivers (as part of some other cross-driver cleanup work I'm still working on). For clarity it's a change which should be applied uniformly to all codec drivers rather than over some of them (creating confusion) so for the minute this driver does the same as all the rest.

Quoted 4 lines

Mark, were able to verify that the default value SPKMIX differs from the datasheet? Is this a datasheet mistake, or an issue in the WM8510 part I have? The full markings on the part are "WM8510G / 63AETV9", and the datasheet is "February 2008, Rev 4.4".

It's most likely a typo in the datasheet; I should have confirmed this by tomorrow.

author
#5 lore raw
Quoted 9 lines · Mark Brown
Quoted 4 lines · Geoffrey Wossum

Mark, were able to verify that the default value SPKMIX differs from the datasheet? Is this a datasheet mistake, or an issue in the WM8510 part I have? The full markings on the part are "WM8510G / 63AETV9", and the datasheet is "February 2008, Rev 4.4".

It's most likely a typo in the datasheet; I should have confirmed this by tomorrow.

I've confirmed your patch now, thanks again for the report.