Skip to contentSkip to conversation

ASoC Platform Driver for AT32AP7000 (AVR32)

PATCH In review Geoffrey Wossum 2 participants 4 messages May 27, 2008 – May 28, 2008

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

PATCH 1/1 ASoC Platform Driver for AT32AP7000 (AVR32)

Add ASoC platform driver for AT32AP7000 (AVR32).
This is basically a port of the at91 ASoC platform code to the AVR32. This is currently against the Linux 2.6.24.3.atmel.3 kernel, the latest kernel Atmel has released for the AVR32.

playpaq_wm8510.c isn't necessarily intended for inclusion into the mainline kernel or linux-2.6-asoc repository. It's provided more as a reference machine driver for an AT32AP7000 system.

sound/soc/at32/Makefile new file +15 -0
@@ -0,0 +1,15 @@
+# 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.h new file +79 -0

79 lines not on this page · raw message

sound/soc/at32/at32-pcm.c new file +505 -0

505 lines not on this page · raw message

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

855 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/Kconfig new file +32 -0
@@ -0,0 +1,32 @@
+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
+        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
sound/soc/at32/playpaq_wm8510.c new file +550 -0

550 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Geoffrey Wossum

Add ASoC platform driver for AT32AP7000 (AVR32). This is basically a port of the at91 ASoC platform code to the

Thanks - I've added this to the ASoC git tree.

The driver looks good but there are quite a few issues that should be fixed up before submission to mainline but these are coding style issues rather than anything substantial - most of them can be picked up by running the script scripts/checkpatch.pl in the kernel source against your patch (it also has a --file argument which can be used to run it on regular files rather than patches).

One thing that's missing is the build system updates in sound/soc to hook this in.

Quoted 2 lines

AVR32. This is currently against the Linux 2.6.24.3.atmel.3 kernel, the latest kernel Atmel has released for the AVR32.

Will this driver work with a current mainline kernel or does it require other things from the Atmel kernel?

Quoted 3 lines

playpaq_wm8510.c isn't necessarily intended for inclusion into the mainline kernel or linux-2.6-asoc repository. It's provided more as a reference machine driver for an AT32AP7000 system.

It's generally useful to have reference machine drivers - apart from anything else, it helps from the point of view of doing build tests even if you don't have the hardware to actually run them.

sound/soc/at32/at32-pcm.h line 77

Quoted 2 lines
sound/soc/at32/at32-pcm.h new file +2 -0
+#define ssc_readx(base, reg)            (__raw_readl((base) + (reg)))
+#define ssc_writex(base, reg, value)    __raw_writel((value), (base) + (reg))

It might be a bit better to provide these as inline

Quoted 1 line

+#include <sound/driver.h>

driver.h shouldn't be required with current ALSA versions, though I can't remember if it's needed on the older kernel you're running with.

Quoted 4 lines
sound/soc/at32/at32-ssc.c new file +4 -0
+/*
+ * SSC register values that Atmel left out of <linux/atmel-ssc.h>.  These
+ * are expected to be used with SSC_BF
+ */

sound/soc/at32/at32-ssc.c line 65

Quoted 10 lines
sound/soc/at32/at32-ssc.c new file +10 -0
+/* START bit field values */
+#define SSC_START_CONTINUOUS    0
+#define SSC_START_TX_RX         1
+#define SSC_START_LOW_RF        2
+#define SSC_START_HIGH_RF       3
+#define SSC_START_FALLING_RF    4
+#define SSC_START_RISING_RF     5
+#define SSC_START_LEVEL_RF      6
+#define SSC_START_EDGE_RF       7
+#define SSS_START_COMPARE_0     8

I guess ideally these should be merged in there? Shouldn't be a blocker for merging this, though.

sound/soc/at32/Kconfig line 22

Quoted 8 lines
sound/soc/at32/Kconfig new file +8 -0
+config SND_AT32_SOC_PLAYPAQ
+        tristate "SoC Audio support for PlayPaq with WM8510"
+        depends on SND_AT32_SOC
+        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.

Should this not also depend on having base support for the system?

sound/soc/at32/Kconfig line 32

Quoted 7 lines
sound/soc/at32/Kconfig new file +7 -0
+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

Probably best to include a note here explaining why you don't want to select this unless you want to test the AT32 clock generation or something?

sound/soc/at32/playpaq_wm8510.c line 82

Quoted 5 lines
sound/soc/at32/playpaq_wm8510.c new file +5 -0
+static int playpaq_wm8510_startup(
+    struct snd_pcm_substream *substream)
+{
+    return 0;
+}

You shouldn't need to provide empty functions for things like this.

sound/soc/at32/playpaq_wm8510.c line 363

Quoted 3 lines
sound/soc/at32/playpaq_wm8510.c new file +3 -0
+    /* always connected endpoints */
+    snd_soc_dapm_set_endpoint(codec, "Int Mic", 1);
+    snd_soc_dapm_set_endpoint(codec, "Ext Spk", 1);

It's also a good idea to explicitly disconnect any unused connections on the codec, although it's not in any way essential to do so.

#2 lore raw
Quoted 5 lines · Mark Brown
Quoted 2 lines · Geoffrey Wossum

Add ASoC platform driver for AT32AP7000 (AVR32). This is basically a port of the at91 ASoC platform code to the

Thanks - I've added this to the ASoC git tree.

Cool.

Quoted 6 lines

The driver looks good but there are quite a few issues that should be fixed up before submission to mainline but these are coding style issues rather than anything substantial - most of them can be picked up by running the script scripts/checkpatch.pl in the kernel source against your patch (it also has a --file argument which can be used to run it on regular files rather than patches).

Argh! When I perfect my time machine, first thing I'm doing is preventing the invention of tabs. Second, I'm going to convince Kernigham and Ritchie that braces shouldn't be optional. Only then will I go stop the rise of fascism in Europe. :)

Do I need to submit patches to fix the style issues?

Quoted 2 lines

One thing that's missing is the build system updates in sound/soc to hook this in.

Whoops, attached to the end of this email.

Quoted 5 lines
Quoted 2 lines

AVR32. This is currently against the Linux 2.6.24.3.atmel.3 kernel, the latest kernel Atmel has released for the AVR32.

Will this driver work with a current mainline kernel or does it require other things from the Atmel kernel?

at32-pcm.c and at32-ssc.c will compile against a vanilla 2.6.24.3 kernel. playpaq_wm8510.c will not, since it references the WM8510 code that is not in the mainline kernel. Not sure if it would really work. Even though AVR32 is in the mainline kernel, Atmel still has a fairly extensive patch against the kernel. Until you can use an unpatched and current kernel for the AVR32, this code probably isn't a candidate for inclusion the mainline.

Quoted 7 lines
Quoted 3 lines

playpaq_wm8510.c isn't necessarily intended for inclusion into the mainline kernel or linux-2.6-asoc repository. It's provided more as a reference machine driver for an AT32AP7000 system.

It's generally useful to have reference machine drivers - apart from anything else, it helps from the point of view of doing build tests even if you don't have the hardware to actually run them.

I'll have to correct the file to kernel coding standards at some point then. I also need to make it not depend on a patch I have to the kernel.

Quoted 4 lines
Quoted 1 line

+#include <sound/driver.h>

driver.h shouldn't be required with current ALSA versions, though I can't remember if it's needed on the older kernel you're running with.

In 2.6.24, I think you still need to include sound/driver.h. This was part of what clued me into the fact that the linux-2.6-asoc HEAD was not going to work me.

Quoted 6 lines
Quoted 6 lines

+/*
+ * SSC register values that Atmel left out of <linux/atmel-ssc.h>. These + * are expected to be used with SSC_BF
+ */

(quoted diff) +2 -0
+/* START bit field values */
+#define SSC_START_CONTINUOUS    0
Quoted 8 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+#define SSC_START_TX_RX         1
+#define SSC_START_LOW_RF        2
+#define SSC_START_HIGH_RF       3
+#define SSC_START_FALLING_RF    4
+#define SSC_START_RISING_RF     5
+#define SSC_START_LEVEL_RF      6
+#define SSC_START_EDGE_RF       7
+#define SSS_START_COMPARE_0     8

I'll see if I can get this kind of stuff merged into Atmel's patch set.

Thanks,
---
Geoffrey

Patch Makefile's and Kconfig's for ASoC with AT32
Patch is against linux-2.6-asoc repository when v.2.6.24 was tagged

sound/soc/Kconfig +1 -0
Index: linux-2.6.24.3.atmel.3/sound/soc/Kconfig
===================================================================
@@ -25,6 +25,7 @@ config SND_SOC
 	  will be called snd-soc-core.
 
 # 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 +1 -1
Index: linux-2.6.24.3.atmel.3/sound/soc/Makefile
===================================================================
@@ -1,4 +1,4 @@
 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/ imx/ au1x/ blackfin/ fsl/
+obj-$(CONFIG_SND_SOC)	+= codecs/ at32/ at91/ pxa/ s3c24xx/ sh/ imx/ au1x/ blackfin/ fsl/
#3 lore raw
Quoted 1 line · Geoffrey Wossum

Do I need to submit patches to fix the style issues?

Ideally, yes; there are some not entirely mechanical things in there as well so it'd be good to make sure that what goes in has been tested as-is.

Quoted 6 lines
Quoted 2 lines

Will this driver work with a current mainline kernel or does it require other things from the Atmel kernel?

at32-pcm.c and at32-ssc.c will compile against a vanilla 2.6.24.3 kernel. playpaq_wm8510.c will not, since it references the WM8510 code that is not in the mainline kernel. Not sure if it would really work. Even though AVR32 is

We should be able to submit the WM8510 driver so it shouldn't be a blocker.

Quoted 3 lines

in the mainline kernel, Atmel still has a fairly extensive patch against the kernel. Until you can use an unpatched and current kernel for the AVR32, this code probably isn't a candidate for inclusion the mainline.

OTOH, if it will build with current mainline then that reduces the diff that one needs to carry in order to use this support and means there's one less thing in that diff that needs to be merged into mainline. That seems like a net win to me.

Signature · 1 line
"You grabbed my hand and we fell into it, like a daydream - or a fever."