ADAU1701 is a SigmaDSP with DACs and ADCs,and support both analog and digital inputs/outputs(I2S). This driver is intended to drive ADAU1701 through I2S, so we adapt it into ASoC framework and treat it as an audio codec, also it needs to include firmware loading function to download firmware blob at the initializing time.
Function | File |
---|---|
driver | sound/soc/codecs/adau1701.c |
include | sound/soc/codecs/adau1701.h |
Below is an example which is used on Blackfin board file.
static struct i2c_board_info __initdata bfin_i2c_board_info[] = { [--snip--] #if defined(CONFIG_SND_SOC_ADAU1701) || defined(CONFIG_SND_SOC_ADAU1701_MODULE) { I2C_BOARD_INFO("adau1701", 0x34), }, #endif [--snip--] }
static int __init stamp_init(void) { [--snip--] i2c_register_board_info(0, bfin_i2c_board_info, ARRAY_SIZE(bfin_i2c_board_info)); [--snip--] return 0; } arch_initcall(board_init);
Name | Description |
---|---|
OUT0 | VOUT0 DAC Output |
OUT1 | VOUT1 DAC Output |
OUT2 | VOUT2 DAC Output |
OUT3 | VOUT3 DAC Output |
IN0 | Analog Audio Input 0 (ADC0) |
IN1 | Analog Audio Input 1 (ADC1) |
Name | Description |
---|---|
Master Capture Switch | Mute/Unmute the ADCs |
The CODEC driver register one DAI called “adau1701”.
Name | Supported by driver | Description |
---|---|---|
SND_SOC_DAIFMT_I2S | yes | I2S mode |
SND_SOC_DAIFMT_RIGHT_J | yes | Right Justified mode |
SND_SOC_DAIFMT_LEFT_J | yes | Left Justified mode |
SND_SOC_DAIFMT_DSP_A | no | data MSB after FRM LRC |
SND_SOC_DAIFMT_DSP_B | no | data MSB during FRM LRC |
SND_SOC_DAIFMT_AC97 | no | AC97 mode |
SND_SOC_DAIFMT_PDM | no | Pulse density modulation |
SND_SOC_DAIFMT_NB_NF | yes | Normal bit- and frameclock |
SND_SOC_DAIFMT_NB_IF | yes | Normal bitclock, inverted frameclock |
SND_SOC_DAIFMT_IB_NF | yes | Inverted frameclock, normal bitclock |
SND_SOC_DAIFMT_IB_IF | yes | Inverted bit- and frameclock |
SND_SOC_DAIFMT_CBM_CFM | yes | Codec bit- and frameclock master |
SND_SOC_DAIFMT_CBS_CFM | no | Codec bitclock slave, frameclock master |
SND_SOC_DAIFMT_CBM_CFS | no | Codec bitclock master, frameclock slave |
SND_SOC_DAIFMT_CBS_CFS | yes | Codec bit- and frameclock slave |
The sysclk source can be either be generated using the internal oscillator and an external crystal, or can come from an external clock signal.
enum adau1701_clk_src { ADAU1701_CLK_SRC_OSC, ADAU1701_CLK_SRC_MCLK, };
The sysclk rate is configured using the PLL_MODE0 and PLL_MODE1 pins. Though for completeness it should also be passed to snd_soc_dai_set_sysclk.
static int bfin_eval_adau1701_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai; int ret; ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); if (ret) return ret; ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); if (ret) return ret; ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000, SND_SOC_CLOCK_IN); return ret; } static struct snd_soc_ops bfin_eval_adau1701_ops = { .hw_params = bfin_eval_adau1701_hw_params, }; static struct snd_soc_dai_link bfin_eval_adau1701_dai = { .name = "adau1701", .stream_name = "adau1701", .cpu_dai_name = "bfin-i2s.0", .codec_dai_name = "adau1701", .platform_name = "bfin-i2s-pcm-audio", .codec_name = "adau1701.0-0034", .ops = &bfin_eval_adau1701_ops, };
In order to use the SigmaDSP core of the ADAU1701 you need to provide a firmware file. Please refer to the SigmaDSP Firmware Utility for Linux page on how to generate a firmware file. The firmware file for ADAU1701 driver has to be named adau1701.bin.
There is no dedicated Blackfin STAMP evaluation board for the ADAU1701. During test and driver development we used the EVAL-ADAU1701MINIZ board.
It can be easily wired to the Blackfin STAMP SPORT header.
Function | File |
---|---|
driver | sound/soc/blackfin/bfin-eval-adau1701.c |
Device Drivers ---> [*] I2C support ---> [*] I2C Hardware Bus support ---> *** I2C system bus drivers (mostly embedded / system-on-chip) *** <*> Blackfin TWI I2C support (100) Blackfin TWI I2C clock (kHz)
Enable ALSA SoC evaluation board driver:
Device Drivers --->Sound card support ---> Advanced Linux Sound Architecture ---> ALSA for SoC audio support ---> Support for the EVAL-ADAU1701 boards on Blackfin eval boards
TODO
Load the driver and make sure the sound card is properly instantiated.
This specifies any shell prompt running on the target
root:/> modprobe snd-bf5xx-i2s root:/> modprobe snd-soc-bf5xx-i2s root:/> modprobe snd-soc-adau1701 root:/> modprobe snd-soc-bfin-eval-adau1701 dma rx:3 tx:4, err irq:45, regs:ffc00800 asoc: ADAU1701 <-> bf5xx-i2s mapping ok
This specifies any shell prompt running on the target
root:/> modprobe snd-pcm-oss root:/> tone TONE: generating sine wave at 1000 Hz... root:/> arecord -f cd | aplay Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !