Skip to contentSkip to conversation

ASoC: blackfin: add bf6xx audio dma driver

PATCH In review Scott Jiang 2 participants 6 messages Sep 23, 2014 – Sep 25, 2014

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

PATCH 1/1 ASoC: blackfin: add bf6xx audio dma driver

Bf5xx and bf6xx reused bf5xx-i2s-pcm.c before. Recently tdm driver has been merged into bf5xx-i2s-pcm.c and it's not compatible with bf6xx audio. So create this dma driver and add tdm support later.

---
 sound/soc/blackfin/Kconfig     |   22 ++--
 sound/soc/blackfin/Makefile    |    2 +
 sound/soc/blackfin/bf6xx-pcm.c |  230 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 248 insertions(+), 6 deletions(-)
 create mode 100644 sound/soc/blackfin/bf6xx-pcm.c
sound/soc/blackfin/Kconfig +16 -6
index 6410aa2..9d6bd9d 100644
@@ -1,8 +1,17 @@
 config SND_BF5XX_I2S
 	tristate "SoC I2S Audio for the ADI Blackfin chip"
-	depends on BLACKFIN
-	select SND_BF5XX_SOC_SPORT if !BF60x
-	select SND_BF6XX_SOC_SPORT if BF60x
+	depends on BLACKFIN && !BF60x
+	select SND_BF5XX_SOC_SPORT
+	help
+	  Say Y or M if you want to add support for codecs attached to
+	  the Blackfin SPORT (synchronous serial ports) interface in I2S
+	  mode (supports single stereo In/Out).
+	  You will also need to select the audio interfaces to support below.
+
+config SND_BF6XX_PCM
+	tristate "SoC Audio for the ADI Blackfin BF6xx chip"
+	depends on BF60x
+	select SND_BF6XX_SOC_SPORT
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the Blackfin SPORT (synchronous serial ports) interface in I2S
@@ -11,7 +20,7 @@ config SND_BF5XX_I2S
 
 config SND_BF5XX_SOC_SSM2602
 	tristate "SoC SSM2602 Audio Codec Add-On Card support"
-	depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI
+	depends on (SND_BF5XX_I2S || SND_BF6XX_PCM) && SND_SOC_I2C_AND_SPI
 	select SND_BF5XX_SOC_I2S if !BF60x
 	select SND_BF6XX_SOC_I2S if BF60x
 	select SND_SOC_SSM2602_SPI if SPI_MASTER
@@ -45,8 +54,9 @@ config SND_SOC_BFIN_EVAL_ADAU1373
 
 config SND_SOC_BFIN_EVAL_ADAU1X61
 	tristate "Support for the EVAL-ADAU1X61 board on Blackfin eval boards"
-	depends on SND_BF5XX_I2S && I2C
-	select SND_BF5XX_SOC_I2S
+	depends on (SND_BF5XX_I2S || SND_BF6XX_PCM) && I2C
+	select SND_BF5XX_SOC_I2S if !BF60x
+	select SND_BF6XX_SOC_I2S if BF60x
 	select SND_SOC_ADAU1761_I2C
 	help
 	  Say Y if you want to add support for the Analog Devices EVAL-ADAU1X61
sound/soc/blackfin/Makefile +2 -0
index f21e948..cef39f6 100644
@@ -1,6 +1,7 @@
 # Blackfin Platform Support
 snd-bf5xx-ac97-objs := bf5xx-ac97-pcm.o
 snd-bf5xx-i2s-objs := bf5xx-i2s-pcm.o
+snd-bf6xx-pcm-objs := bf6xx-pcm.o
 snd-soc-bf5xx-sport-objs := bf5xx-sport.o
 snd-soc-bf6xx-sport-objs := bf6xx-sport.o
 snd-soc-bf5xx-ac97-objs := bf5xx-ac97.o
@@ -9,6 +10,7 @@ snd-soc-bf6xx-i2s-objs := bf6xx-i2s.o
 
 obj-$(CONFIG_SND_BF5XX_AC97) += snd-bf5xx-ac97.o
 obj-$(CONFIG_SND_BF5XX_I2S) += snd-bf5xx-i2s.o
+obj-$(CONFIG_SND_BF6XX_PCM) += snd-bf6xx-pcm.o
 obj-$(CONFIG_SND_BF5XX_SOC_SPORT) += snd-soc-bf5xx-sport.o
 obj-$(CONFIG_SND_BF6XX_SOC_SPORT) += snd-soc-bf6xx-sport.o
 obj-$(CONFIG_SND_BF5XX_SOC_AC97) += snd-soc-bf5xx-ac97.o
sound/soc/blackfin/bf6xx-pcm.c new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 3 lines · Scott Jiang

Bf5xx and bf6xx reused bf5xx-i2s-pcm.c before. Recently tdm driver has been merged into bf5xx-i2s-pcm.c and it's not compatible with bf6xx audio. So create this dma driver and add tdm support later.

Can you go into a bit more detail on the differences - clearly there's some similarlities since the drivers got merged, can we really not share any code?

#2 lore raw

2014-09-24 16:26 GMT+08:00 Mark Brown <[email protected]>:

Quoted 8 lines · Scott Jiang
Quoted 3 lines

Bf5xx and bf6xx reused bf5xx-i2s-pcm.c before. Recently tdm driver has been merged into bf5xx-i2s-pcm.c and it's not compatible with bf6xx audio. So create this dma driver and add tdm support later.

Can you go into a bit more detail on the differences - clearly there's some similarlities since the drivers got merged, can we really not share any code?

First, sport2 only supports i2s and left justified mode, while sport3 adds i2s packed
and right justified mode. Second, in tdm mode for sport2, tx and rx are dependent and have
a window granularity of 8 channel. While sport3 doesn't have these limits. What's more,
sport3 is not only used on blackfin. That means many patches can only apply to this driver.

Thanks,
Scott

maintainer
#3 lore raw
Quoted 6 lines · Scott Jiang

2014-09-24 16:26 GMT+08:00 Mark Brown <[email protected]>:

Quoted 3 lines

Can you go into a bit more detail on the differences - clearly there's some similarlities since the drivers got merged, can we really not share any code?

Quoted 8 lines

First, sport2 only supports i2s and left justified mode, while sport3 adds i2s packed
and right justified mode. Second, in tdm mode for sport2, tx and rx are dependent and have
a window granularity of 8 channel. While sport3 doesn't have these limits. What's more,
sport3 is not only used on blackfin. That means many patches can only apply to this driver.

These sound more like extended functionality and tweaks rather than massive updates which need a completely separate driver - new modes and so on.

#4 lore raw

2014-09-24 19:42 GMT+08:00 Mark Brown <[email protected]>:

Quoted 16 lines · Scott Jiang
Quoted 6 lines

2014-09-24 16:26 GMT+08:00 Mark Brown <[email protected]>:

Quoted 3 lines

Can you go into a bit more detail on the differences - clearly there's some similarlities since the drivers got merged, can we really not share any code?

Quoted 8 lines

First, sport2 only supports i2s and left justified mode, while sport3 adds i2s packed
and right justified mode. Second, in tdm mode for sport2, tx and rx are dependent and have
a window granularity of 8 channel. While sport3 doesn't have these limits. What's more,
sport3 is not only used on blackfin. That means many patches can only apply to this driver.

Quoted 3 lines

These sound more like extended functionality and tweaks rather than massive updates which need a completely separate driver - new modes and so on.

Yes, it looks similar in i2s mode. But in tdm mode, because we don't need to copy 2 channels user buffer to 8 channels dma buffer, it might looks very different.
If you think this patch is not good, I'd send a new one after I merged tdm driver.
By the way, if the channel order of hardware is different from what is expected by alsa,
the copy work is left to plugin or driver?

Scott

maintainer
#5 lore raw
Quoted 11 lines · Scott Jiang

2014-09-24 19:42 GMT+08:00 Mark Brown <[email protected]>:

Quoted 3 lines

These sound more like extended functionality and tweaks rather than massive updates which need a completely separate driver - new modes and so on.

Yes, it looks similar in i2s mode. But in tdm mode, because we don't need to copy 2 channels user buffer to 8 channels dma buffer, it might looks very different.
If you think this patch is not good, I'd send a new one after I merged tdm driver.

Well, I'd rather not see the driver split into two separate drivers again if at all possible - ideally just the bits that need splitting. It sounds like you need separate copy operations for the two cases but otherwise things are fairly similar? If the driver ended up being nothing but conditional code that'd be bad but if it's just a few places then it's going to be better to avoid duplicating the entire thing.

Quoted 3 lines

By the way, if the channel order of hardware is different from what is expected by alsa,
the copy work is left to plugin or driver?

If the format is just not something ALSA understands then the driver ought to do it. If ALSA does understand it but it's just not what most applications want then the plugin should be a better choice.