ASoC: Add ADAV80x codec driver
Subsystems (3)
Lars-Peter Clausen
maintainerPATCH 1/3 ASoC: Add ADAV80x codec driver
This patch adds support for the Analog Devices ADAV801 and ADAV803 audio codec.
---
Changes since v1:
* Sync register on resume
* Don't use arrays for the mux enums and controls
* Rework PLL handling. Use DAPM for powering the PLL and OSC down and use set_sysclk to select the system clock instead of doing this implicitly in set_pll.
--- MAINTAINERS | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/adav80x.c | 908 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/adav80x.h | 31 ++ 5 files changed, 946 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/adav80x.c create mode 100644 sound/soc/codecs/adav80x.h
MAINTAINERS +1 -0
@@ -534,6 +534,7 @@ L: [email protected] (moderated for non-subscribers) W: http://wiki.analog.com/ S: Supported F: sound/soc/codecs/adau* +F: sound/soc/codecs/adav* F: sound/soc/codecs/ad1* F: sound/soc/codecs/ssm*
sound/soc/codecs/Kconfig +4 -0
@@ -17,6 +17,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_AD193X if SND_SOC_I2C_AND_SPI select SND_SOC_AD1980 if SND_SOC_AC97_BUS select SND_SOC_AD73311 + select SND_SOC_ADAV80X select SND_SOC_ADS117X select SND_SOC_AK4104 if SPI_MASTER select SND_SOC_AK4535 if I2C
@@ -137,6 +138,9 @@ config SND_SOC_ADAU1701 select SIGMA tristate +config SND_SOC_ADAV80X + tristate + config SND_SOC_ADS117X tristate
sound/soc/codecs/Makefile +2 -0
@@ -5,6 +5,7 @@ snd-soc-ad193x-objs := ad193x.o snd-soc-ad1980-objs := ad1980.o snd-soc-ad73311-objs := ad73311.o snd-soc-adau1701-objs := adau1701.o +snd-soc-adav80x-objs := adav80x.o snd-soc-ads117x-objs := ads117x.o snd-soc-ak4104-objs := ak4104.o snd-soc-ak4535-objs := ak4535.o
@@ -99,6 +100,7 @@ obj-$(CONFIG_SND_SOC_AD193X) += snd-soc-ad193x.o obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o obj-$(CONFIG_SND_SOC_ADAU1701) += snd-soc-adau1701.o +obj-$(CONFIG_SND_SOC_ADAV80X) += snd-soc-adav80x.o obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o
sound/soc/codecs/adav80x.c new file +908 -0
908 lines not on this page · raw message
sound/soc/codecs/adav80x.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* header file for ADAV80X parts +* +* Copyright 2011 Analog Devices Inc. +* +* Licensed under the GPL-2 or later. +*/ + +#ifndef _ADAV80X_H +#define _ADAV80X_H + +enum adav80x_pll_src { +ADAV80X_PLL_SRC_XIN , +ADAV80X_PLL_SRC_XTAL , +ADAV80X_PLL_SRC_MCLKI , +}; + +enum adav80x_pll { +ADAV80X_PLL1 =0 , +ADAV80X_PLL2 =1 , +}; + +enum adav80x_clk_src { +ADAV80X_CLK_XIN =0 , +ADAV80X_CLK_MCLKI =1 , +ADAV80X_CLK_PLL1 =2 , +ADAV80X_CLK_PLL2 =3 , +ADAV80X_CLK_XTAL =6 , +}; + +#endif
Signature · 1 line
1.7.2.5
Lars-Peter Clausen
maintainerPATCH 2/3 ASoC: Blackfin: Add machine driver for EVAL-ADAV80X boards
Add a machine driver to support the EVAL-ADAV801 and EVAL-ADAV803 boards connected to a Analog Devices BF5XX evaluation board.
--- sound/soc/blackfin/Kconfig | 13 +++ sound/soc/blackfin/Makefile | 2 + sound/soc/blackfin/bfin-eval-adav80x.c | 165 ++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 0 deletions(-) create mode 100644 sound/soc/blackfin/bfin-eval-adav80x.c
sound/soc/blackfin/Kconfig +13 -0
@@ -27,6 +27,19 @@ config SND_SOC_BFIN_EVAL_ADAU1701 board connected to one of the Blackfin evaluation boards like the BF5XX-STAMP or BF5XX-EZKIT. +config SND_SOC_BFIN_EVAL_ADAV80X + tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards" + depends on SND_BF5XX_I2S && (SPI_MASTER || I2C) + select SND_BF5XX_SOC_I2S + select SND_SOC_ADAV80X + help + Say Y if you want to add support for the Analog Devices EVAL-ADAV801 or + EVAL-ADAV803 board connected to one of the Blackfin evaluation boards + like the BF5XX-STAMP or BF5XX-EZKIT. + + Note: This driver assumes that the ADAV80X digital record and playback + interfaces are connected to the first SPORT port on the BF5XX board. + config SND_BF5XX_SOC_AD73311 tristate "SoC AD73311 Audio support for Blackfin" depends on SND_BF5XX_I2S
sound/soc/blackfin/Makefile +2 -0
@@ -22,6 +22,7 @@ snd-ssm2602-objs := bf5xx-ssm2602.o snd-ad73311-objs := bf5xx-ad73311.o snd-ad193x-objs := bf5xx-ad193x.o snd-soc-bfin-eval-adau1701-objs := bfin-eval-adau1701.o +snd-soc-bfin-eval-adav80x-objs := bfin-eval-adav80x.o obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o
@@ -29,3 +30,4 @@ obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) += snd-soc-bfin-eval-adau1701.o +obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) += snd-soc-bfin-eval-adav80x.o
sound/soc/blackfin/bfin-eval-adav80x.c new file +165 -0
165 lines not on this page · raw message
Signature · 1 line
1.7.2.5
Lars-Peter Clausen
maintainerPATCH 3/3 Blackfin: bf537: Stamp: Register adav801 codec and ASoC machine driver
In reply to Lars-Peter ClausenThere is already an entry in the spi device table for the codec, but the modalias was wrong. Also the config symbol name for the codec is wrong, so this is fixed as well.
--- arch/blackfin/mach-bf537/boards/stamp.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
arch/blackfin/mach-bf537/boards/stamp.c +16 -3
@@ -1000,9 +1000,9 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = { },#endif -#if defined(CONFIG_SND_BF5XX_SOC_ADAV80X ) || defined(CONFIG_SND_BF5XX_SOC_ADAV80X_MODULE ) +#if defined(CONFIG_SND_SOC_ADAV80X ) || defined(CONFIG_SND_SOC_ADV80X_MODULE ) { - .modalias = "adav80x", + .modalias = "adav801", .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ .bus_num = 0, .chip_select = 1,
@@ -2118,7 +2118,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { },#endif -#if defined(CONFIG_SND_BF5XX_SOC_ADAV80X) || defined(CONFIG_SND_BF5XX_SOC_ADAV80X_MODULE) +#if defined(CONFIG_SND_SOC_ADAV80X) || defined(CONFIG_SND_SOC_ADAV80X_MODULE) { I2C_BOARD_INFO("adav803", 0x10), },
@@ -2553,6 +2553,14 @@ static struct platform_device bfin_ad73311_codec_device = { };#endif +#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X ) || \ + defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X_MODULE ) +static struct platform_device bfin_eval_adav801_device = { + .name ="bfin-eval-adav801" , + .id =-1 , +}; +#endif +#if defined(CONFIG_SND_BF5XX_SOC_I2S ) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE )static struct platform_device bfin_i2s = { .name = "bfin-i2s",
@@ -2833,6 +2841,11 @@ static struct platform_device *stamp_devices[] __initdata = { defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701_MODULE) &bf5xx_adau1701_device,#endif + +#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X ) || \ + defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X_MODULE ) + &bfin_eval_adav801_device, +#endif };static int __init net2272_init (void )
Signature · 1 line
1.7.2.5
Quoted 21 lines · Lars-Peter Clausen
This patch adds support for the Analog Devices ADAV801 and ADAV803 audio codec.
Signed-off-by Lars-Peter Clausen <[email protected]>---
Changes since v1:
* Sync register on resume
* Don't use arrays for the mux enums and controls
* Rework PLL handling. Use DAPM for powering the PLL and OSC down and useset_sysclkto select the system clock instead of doing this implicitly inset_pll.--- MAINTAINERS | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/adav80x.c | 908 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/adav80x.h | 31 ++ 5 files changed, 946 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/adav80x.c create mode 100644 sound/soc/codecs/adav80x.h
snip
Quoted 10 lines
sound/soc/codecs/adav80x.c new file +10
-0+ +static int adav80x_probe (struct snd_soc_codec *codec) +{ +int ret; +struct adav80x *adav80x =snd_soc_codec_get_drvdata (codec); + + ret =snd_soc_codec_set_cache_io (codec,7 ,9 , adav80x->control_type); +if (ret) { +dev_err (codec->dev,"failed to set cache I/O: %d\n" , ret); +return ret;
sound/soc/codecs/adav80x.c line 756
Quoted 10 lines
sound/soc/codecs/adav80x.c new file +10
-0+ } + +/* Power down SYSCLK output, power down S/PDIF receiver */ +snd_soc_write (codec,ADAV80X_PLL_OUTE ,0x27 ); +/* Disable DAC zero flag */ +snd_soc_write (codec,ADAV80X_DAC_CTRL3 ,0x6 ); + +return adav80x_set_bias_level (codec,SND_SOC_BIAS_STANDBY ); +} +
It's usually better disable things like sysclk output in your machine driver as others may depend on it for probing.
Liam
Lars-Peter Clausen
maintainerQuoted 39 lines · Liam Girdwood
Quoted 21 lines · Lars-Peter Clausen
This patch adds support for the Analog Devices ADAV801 and ADAV803 audio codec.
Signed-off-by Lars-Peter Clausen <[email protected]>---
Changes since v1:
* Sync register on resume
* Don't use arrays for the mux enums and controls
* Rework PLL handling. Use DAPM for powering the PLL and OSC down and useset_sysclkto select the system clock instead of doing this implicitly inset_pll.--- MAINTAINERS | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/adav80x.c | 908 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/adav80x.h | 31 ++ 5 files changed, 946 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/adav80x.c create mode 100644 sound/soc/codecs/adav80x.hsnip
Quoted 14 lines
sound/soc/codecs/adav80x.c new file +14
-0+ +static int adav80x_probe (struct snd_soc_codec *codec) +{ +int ret; +struct adav80x *adav80x =snd_soc_codec_get_drvdata (codec); + + ret =snd_soc_codec_set_cache_io (codec,7 ,9 , adav80x->control_type); +if (ret) { +dev_err (codec->dev,"failed to set cache I/O: %d\n" , ret); +return ret; + } + +/* Power down SYSCLK output, power down S/PDIF receiver */ +snd_soc_write (codec,ADAV80X_PLL_OUTE ,0x27 );
Quoted 8 lines
sound/soc/codecs/adav80x.c line 756
Quoted 6 lines
sound/soc/codecs/adav80x.c new file +6
-0+/* Disable DAC zero flag */ +snd_soc_write (codec,ADAV80X_DAC_CTRL3 ,0x6 ); + +return adav80x_set_bias_level (codec,SND_SOC_BIAS_STANDBY ); +} +It's usually better disable things like sysclk output in your machine driver as others may depend on it for probing.
What is the proper API to do this? set_sysclk with dir = SND_SOC_CLOCK_OUT and freq = 0?
Quoted 6 lines · Lars-Peter Clausen
Quoted 1 line · Liam Girdwood
It's usually better disable things like sysclk output in your machine driver as others may depend on it for probing.
What is the proper API to do this?
set_sysclkwith dir =SND_SOC_CLOCK_OUTand freq = 0?
Something like that, yes.