Skip to contentSkip to conversation

Add AC'97 driver for AT91SAM9263ek atmel board.

PATCH In review Sedji Gaouaou 3 participants 8 messages Oct 1, 2008 – Jan 5, 2009

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

PATCH 1/1 Add AC'97 driver for AT91SAM9263ek atmel board.

Add AC'97 driver for AT91SAM9263ek atmel board. The driver includes the playback and the capture.

---
 sound/arm/Kconfig     |    9 +
 sound/arm/Makefile    |    4 +
 sound/arm/at91-ac97.c |  912 +++++++++++++++++++++++++++++++++++++++++++++++++
 sound/arm/at91-ac97.h |  295 ++++++++++++++++
 4 files changed, 1220 insertions(+), 0 deletions(-)
 create mode 100644 sound/arm/at91-ac97.c
 create mode 100644 sound/arm/at91-ac97.h
sound/arm/Kconfig +9 -0
index f8e6de4..bfe12f7 100644
@@ -50,5 +50,14 @@ config SND_PXA2XX_AC97
 	  Say Y or M if you want to support any AC97 codec attached to
 	  the PXA2xx AC97 interface.
 
+config SND_AT91_AC97
+	tristate "AC97 Controller driver for SAM926X familly from ATMEL"
+	depends on SND && ARCH_AT91
+	select SND_PCM
+	select SND_AC97_CODEC
+	help
+	  Say Y or M if you want to support any AC97 codec attached to
+	  the SAM926X AC97 Controller.
+
 endif	# SND_ARM
 
sound/arm/Makefile +4 -0
index 2054de1..73fc74b 100644
@@ -17,3 +17,7 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97)	+= pxa2xx-ac97-lib.o
 
 obj-$(CONFIG_SND_PXA2XX_AC97)	+= snd-pxa2xx-ac97.o
 snd-pxa2xx-ac97-objs		:= pxa2xx-ac97.o
+
+obj-$(CONFIG_SND_AT91_AC97)	+= snd-at91-ac97.o
+snd-at91-ac97-objs		:= at91-ac97.o
+
sound/arm/at91-ac97.c new file +912 -0

912 lines not on this page · raw message

sound/arm/at91-ac97.h new file +295 -0

295 lines not on this page · raw message

Signature · 1 line
1.5.3.7
#1 lore raw

Hi,

Quoted 9 lines · Sedji Gaouaou

Add AC'97 driver for AT91SAM9263ek atmel board.
The driver includes the playback and the capture.

---
 sound/arm/Kconfig     |    9 +
 sound/arm/Makefile    |    4 +
 sound/arm/at91-ac97.c |  912 +++++++++++++++++++++++++++++++++++++++++++++++++
 sound/arm/at91-ac97.h |  295 ++++++++++++++++

When I was writing this patch I was wondering if it should actually be in the sound/arm directory or in a sound/soc/atmel directory?

Regards,
Sedji

#2 lore raw

At Thu, 02 Oct 2008 10:51:02 +0200,

Quoted 14 lines · Sedji Gaouaou

Hi,

Quoted 9 lines · Sedji Gaouaou

Add AC'97 driver for AT91SAM9263ek atmel board.
The driver includes the playback and the capture.

---
 sound/arm/Kconfig     |    9 +
 sound/arm/Makefile    |    4 +
 sound/arm/at91-ac97.c |  912 +++++++++++++++++++++++++++++++++++++++++++++++++
 sound/arm/at91-ac97.h |  295 ++++++++++++++++
Quoted 2 lines

When I was writing this patch I was wondering if it should actually be in the sound/arm directory or in a sound/soc/atmel directory?

sound/arm looks correct unless the driver is based on the ASoC framework.

Takashi

#3 lore raw
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Sedji Gaouaou

Sedji Gaouaou a ?crit :

When I was writing this patch I was wondering if it should actually be in the sound/arm directory or in a sound/soc/atmel directory?

sound/arm looks correct unless the driver is based on the ASoC framework.

Indeed.

If you look at pxa2xx-ac97 you'll see that for that there's actually two drivers (both of which now share most of the actual hardware access code thanks to some good work by Dmitry Baryshkov), one for the non-ASoC AC97 framework and one for use within ASoC. Both can be useful, though the ASoC one is only useful if people design boards which can make use of the extra features it provides.

#4 lore raw

Hi,

Quoted 10 lines · Mark Brown
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Sedji Gaouaou

Sedji Gaouaou a ?crit :

When I was writing this patch I was wondering if it should actually be in the sound/arm directory or in a sound/soc/atmel directory?

sound/arm looks correct unless the driver is based on the ASoC framework.

Quoted 9 lines

Indeed.

If you look at pxa2xx-ac97 you'll see that for that there's actually two drivers (both of which now share most of the actual hardware access code thanks to some good work by Dmitry Baryshkov), one for the non-ASoC AC97 framework and one for use within ASoC. Both can be useful, though the ASoC one is only useful if people design boards which can make use of the extra features it provides.

Should I provide the same thing?
This driver is not based on the ASoC.
Nevertheless I can see that there is a ac97 driver in sound/soc/codec, so should I do the same as pxa, I mean create 2 drivers?

#5 lore raw
Quoted 4 lines · Sedji Gaouaou

Should I provide the same thing?
This driver is not based on the ASoC.
Nevertheless I can see that there is a ac97 driver in sound/soc/codec, so should I do the same as pxa, I mean create 2 drivers?

It's up to you but I would suggest that it's easier to just leave the ASoC driver until there is some user demand for it. The ASoC AC97 support won't offer any benefit unless board designs have codecs or other external components which can take advantage of it.

#6 lore raw

At Thu, 2 Oct 2008 10:52:09 +0100,

Quoted 8 lines · Mark Brown
Quoted 4 lines · Sedji Gaouaou

Should I provide the same thing?
This driver is not based on the ASoC.
Nevertheless I can see that there is a ac97 driver in sound/soc/codec, so should I do the same as pxa, I mean create 2 drivers?

Quoted 4 lines

It's up to you but I would suggest that it's easier to just leave the ASoC driver until there is some user demand for it. The ASoC AC97 support won't offer any benefit unless board designs have codecs or other external components which can take advantage of it.

Agreed.

Takashi

#7 lore raw
In reply to Sedji Gaouaou
Quoted 2 lines · Sedji Gaouaou

Add AC'97 driver for AT91SAM9263ek atmel board.
The driver includes the playback and the capture.

Could this be written so that it'd also work with the AT32 CPUs? It certainly has some similarities to the out of tree AC97 driver in the AVR32 kernels.

sound/arm/at91-ac97.c line 682

Quoted 10 lines
sound/arm/at91-ac97.c new file +10 -0
+static void snd_at91_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
+				 unsigned short val)
+{
+	do {
+		if (ac97c_readl(chip, COSR) & AT91C_AC97C_TXRDY) {
+			ac97c_writel(chip, COTHR, word);
+			return;
+		}
+		udelay(1);
+	} while (--timeout);

Using udelay() might get rather expensive if you end up with a lot of AC97 register access going on. It's not common for plain audio stuff but there are AC97 codecs with additional functionality such as touchscreen interfaces which do a lot more register I/O. A similar issue affected the AVR32 driver, I've no idea if it was fixed there (I know there was code to fix it, but I don't know if it was merged).

sound/arm/at91-ac97.h line 293

Quoted 5 lines
sound/arm/at91-ac97.h new file +5 -0
+#define ac97c_writel(chip, reg, val)			\
+	writel((val), (chip)->regs + AC97C_##reg)
+
+#define ac97c_readl(chip, reg)				\
+	readl((chip)->regs + AC97C_##reg)

There's a bit of a namespacing issue here - might be better to give them a more at91-specific name. It'd also be nicer to use inline functions rather than macros.