asoc: bfin: add i2s driver for blackfin bf60x processor
PATCH 1/1 asoc: bfin: add i2s driver for blackfin bf60x processor
This driver includes i2s dai, dma and sport driver. It enables i2s mode support on blackfin bf60x platform.
--- sound/soc/blackfin/Kconfig | 25 ++- sound/soc/blackfin/Makefile | 6 + sound/soc/blackfin/bf6xx-i2s-pcm.c | 294 +++++++++++++++++++++++++ sound/soc/blackfin/bf6xx-i2s.c | 245 +++++++++++++++++++++ sound/soc/blackfin/bf6xx-sport.c | 422 ++++++++++++++++++++++++++++++++++++ sound/soc/blackfin/bf6xx-sport.h | 82 +++++++ 6 files changed, 1070 insertions(+), 4 deletions(-) create mode 100644 sound/soc/blackfin/bf6xx-i2s-pcm.c create mode 100644 sound/soc/blackfin/bf6xx-i2s.c create mode 100644 sound/soc/blackfin/bf6xx-sport.c create mode 100644 sound/soc/blackfin/bf6xx-sport.h
sound/soc/blackfin/Kconfig +21 -4
@@ -1,6 +1,6 @@ config SND_BF5XX_I2S tristate "SoC I2S Audio for the ADI BF5xx chip" - depends on BLACKFIN + depends on BLACKFIN && !BF60x select SND_BF5XX_SOC_SPORT help Say Y or M if you want to add support for codecs attached to
@@ -8,10 +8,21 @@ config SND_BF5XX_I2S mode (supports single stereo In/Out). You will also need to select the audio interfaces to support below. +config SND_BF6XX_I2S + tristate "SoC I2S Audio for the ADI BF6xx chip" + depends on BLACKFIN && 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 + mode (supports single stereo In/Out). + You will also need to select the audio interfaces to support below. + config SND_BF5XX_SOC_SSM2602 tristate "SoC SSM2602 Audio support for BF52x ezkit" - depends on SND_BF5XX_I2S && (SPI_MASTER || I2C) - select SND_BF5XX_SOC_I2S + depends on (SND_BF5XX_I2S || SND_BF6XX_I2S) && (SPI_MASTER || I2C) + select SND_BF5XX_SOC_I2S if SND_BF5XX_I2S + select SND_BF6XX_SOC_I2S if SND_BF6XX_I2S select SND_SOC_SSM2602 help Say Y if you want to add support for SoC audio on BF527-EZKIT.
@@ -162,9 +173,15 @@ config SND_BF5XX_SOC_AD1980 config SND_BF5XX_SOC_SPORT tristate +config SND_BF6XX_SOC_SPORT + tristate + config SND_BF5XX_SOC_I2S tristate +config SND_BF6XX_SOC_I2S + tristate + config SND_BF5XX_SOC_TDM tristate
@@ -173,7 +190,7 @@ config SND_BF5XX_SOC_AC97 config SND_BF5XX_SPORT_NUM int "Set a SPORT for Sound chip" - depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM) + depends on (BLACKFIN && SND_SOC) range 0 3 if BF54x range 0 1 if !BF54x default 0
sound/soc/blackfin/Makefile +6 -0
@@ -1,18 +1,24 @@ # Blackfin Platform Support snd-bf5xx-ac97-objs := bf5xx-ac97-pcm.o snd-bf5xx-i2s-objs := bf5xx-i2s-pcm.o +snd-bf6xx-i2s-objs := bf6xx-i2s-pcm.o snd-bf5xx-tdm-objs := bf5xx-tdm-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 snd-soc-bf5xx-i2s-objs := bf5xx-i2s.o +snd-soc-bf6xx-i2s-objs := bf6xx-i2s.o snd-soc-bf5xx-tdm-objs := bf5xx-tdm.o obj-$(CONFIG_SND_BF5XX_AC97) += snd-bf5xx-ac97.o obj-$(CONFIG_SND_BF5XX_I2S) += snd-bf5xx-i2s.o +obj-$(CONFIG_SND_BF6XX_I2S) += snd-bf6xx-i2s.o obj-$(CONFIG_SND_BF5XX_TDM) += snd-bf5xx-tdm.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 obj-$(CONFIG_SND_BF5XX_SOC_I2S) += snd-soc-bf5xx-i2s.o +obj-$(CONFIG_SND_BF6XX_SOC_I2S) += snd-soc-bf6xx-i2s.o obj-$(CONFIG_SND_BF5XX_SOC_TDM) += snd-soc-bf5xx-tdm.o # Blackfin Machine Support
sound/soc/blackfin/bf6xx-i2s-pcm.c new file +294 -0
294 lines not on this page · raw message
sound/soc/blackfin/bf6xx-i2s.c new file +245 -0
245 lines not on this page · raw message
sound/soc/blackfin/bf6xx-sport.c new file +422 -0
422 lines not on this page · raw message
sound/soc/blackfin/bf6xx-sport.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Quoted 2 lines · Scott Jiang
This driver includes i2s dai, dma and sport driver. It enables i2s mode support on blackfin bf60x platform.
This should be a patch series, for example the DAI, DMA and SPORT drivers would normally all be split out.
Overall this is mostly good, the main thing that's jumping out at me is that the SPORT API looks like it doesn't really have too many device specifics in it so it's a bit surprising that we need completely separate I2S and DMA drivers for the two chip generations.
sound/soc/blackfin/Kconfig config SND_BF5XX_I2S · line 13
Quoted 3 lines
sound/soc/blackfin/Kconfig +3
-0+config SND_BF6XX_I2S + tristate "SoC I2S Audio for the ADI BF6xx chip" + depends on BLACKFIN && BF60x
Shouldn't BF60x already depend on BLACKFIN?
Quoted 2 lines
config
SND_BF5XX_SOC_SSM2602
tristate "SoC SSM2602 Audio support for BF52x ezkit"
This bit also needs updating...
sound/soc/blackfin/Kconfig config SND_BF5XX_SOC_AC97 · line 193
Quoted 4 lines
config
SND_BF5XX_SPORT_NUMsound/soc/blackfin/Kconfig +1
-1int "Set a SPORT for Sound chip" - depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM) + depends on (BLACKFIN && SND_SOC)
Shouldn't have a dependency on SND_SOC - this menu can't be entered without ASoC being enabled.
sound/soc/blackfin/bf6xx-i2s-pcm.c line 284
Quoted 5 lines
sound/soc/blackfin/bf6xx-i2s-pcm.c new file +5
-0+static int __init snd_bfin_i2s_pcm_init (void ) +{ +return platform_driver_register (&bfin_i2s_pcm_driver); +} +module_init (snd_bfin_i2s_pcm_init);
module_platform_driver().
sound/soc/blackfin/bf6xx-i2s.c line 131
Quoted 11 lines
sound/soc/blackfin/bf6xx-i2s.c new file +11
-0+#ifdef CONFIG_PM +static int bfin_i2s_suspend (struct snd_soc_dai *dai) +{ +struct sport_device *sport =snd_soc_dai_get_drvdata (dai); + +if (dai->capture_active) +sport_rx_stop (sport); +if (dai->playback_active) +sport_tx_stop (sport); +return 0 ; +}
The framework should do this for you, by the time we get to suspending there shouldn't be any active streams that aren't supposed to stay active over the time the device is suspended.
sound/soc/blackfin/bf6xx-i2s.c line 238
Quoted 9 lines
sound/soc/blackfin/bf6xx-i2s.c new file +9
-0+static int __init bfin_i2s_init (void ) +{ +return platform_driver_register (&bfin_i2s_driver); +} + +static void __exit bfin_i2s_exit(void) +{ +platform_driver_unregister (&bfin_i2s_driver); +}
module_platform_driver().
Review
Quoted 2 lines
(quoted diff) +2
-0+void sport_tx_start(struct sport_device *sport) +{
Is it not possible to make the SPORT API the same between the 5xx and the 6xx such that we can share all the drivers between the two chip generations with just the SPORT code varying?
sound/soc/blackfin/bf6xx-sport.c line 409
Quoted 1 line
sound/soc/blackfin/bf6xx-sport.c new file +1
-0+dev_info (dev,"SPORT create success\n" );
Make this dev_dbg at most.
Quoted 6 lines
Overall this is mostly good, the main thing that's jumping out at me is that the SPORT API looks like it doesn't really have too many device specifics in it so it's a bit surprising that we need completely separate I2S and DMA drivers for the two chip generations.
These two sports are totally different, bf5xx is full duplex, while bf6xx is half duplex.
So we combine two sports on bf6xx to one logic sport.
I carefully reviewed these drivers, only dma driver can be merged to one. Do I need to do this?
Quoted 5 lines
Quoted 2 lines
config
SND_BF5XX_SOC_SSM2602
tristate "SoC SSM2602 Audio support for BF52x ezkit"This bit also needs updating...
Do you mean config name or prompt?
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+void sport_tx_start(struct sport_device *sport) +{Is it not possible to make the SPORT API the same between the 5xx and the 6xx such that we can share all the drivers between the two chip generations with just the SPORT code varying?
The dai driver introduce too many chip specific settings in the bf5xx design. Also sport behavior has many differences, for example tx and rx channel is not independent on bf5xx.
I need to use many macros to seperate these differences.
Quoted 5 lines · Scott Jiang
These two sports are totally different, bf5xx is full duplex, while bf6xx is half duplex.
So we combine two sports on bf6xx to one logic sport.
I carefully reviewed these drivers, only dma driver can be merged to one. Do I need to do this?
Well, it'd be nice. But it sounds like there's far too many differences so it seems reasonable to not bother, it'd probably just make the code too complex.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
config
SND_BF5XX_SOC_SSM2602
tristate "SoC SSM2602 Audio support for BF52x ezkit"This bit also needs updating...
Do you mean config name or prompt?
Both, ideally.