資料介紹
Table of Contents
AD1836 Sound CODEC Linux Driver
Supported devices
Evaluation Boards
Source Code
Status
Files
Function | File |
---|---|
driver | sound/soc/codecs/ad1836.c |
include | sound/soc/codecs/ad1836.h |
Example device initialization
Declaring SPI slave devices
Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.
This method is appropriate when the SPI bus is a system bus, as in many embedded systems, wherein each SPI bus has a number which is known in advance. It is thus possible to pre-declare the SPI devices that inhabit this bus. This is done with an array of struct spi_board_info, which is registered by calling spi_register_board_info().
For more information see: Documentation/spi/spi-summary
You need to set the modalias of your SPI info according to your codec. Valid values are “ad1835”, “ad1836”, “ad1837”, “ad1838” and “ad1839”. You'll also have to adjust bus_num and chip_select according to your board setup.
static struct spi_board_info board_spi_board_info[] __initdata = { [--snip--] { .modalias = "ad1836", .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ .bus_num = 0, .chip_select = 4, /* CS, change it for your board */ .mode = SPI_MODE_3, }, [--snip--] };
static int __init board_init(void) { [--snip--] ? spi_register_board_info(board_spi_board_info, ARRAY_SIZE(board_spi_board_info)); ? [--snip--] ? return 0; } arch_initcall(board_init);
ASoC DAPM Widgets
Name | Description | Model |
---|---|---|
DAC1OUT | DAC Channel1 Output | AD1835A, AD1836A, AD1838A |
DAC2OUT | DAC Channel2 Output | AD1835A, AD1836A, AD1838A |
DAC3OUT | DAC Channel3 Output | AD1835A, AD1836A, AD1838A |
DAC4OUT | DAC Channel4 Output | AD1835A |
ADC1IN | ADC Channel1 Input | AD1835A, AD1836A, AD1838A |
ADC2IN | ADC Channel2 Input | AD1836A |
ALSA Controls
Name | Description | Model |
---|---|---|
ADC High Pass Filter Switch | Enable/Disable ADC high-pass filter | AD1835A, AD1836A, AD1838A |
Playback Deemphasis | Select playback de-emphasis. Possible Values: “None”, “44.1kHz”, “32kHz”, “48kHz” | AD1835A, AD1836A, AD1838A |
DAC1 Playback Volume | DAC Channel 1 volume | AD1835A, AD1836A, AD1838A |
DAC2 Playback Volume | DAC Channel 2 volume | AD1835A, AD1836A, AD1838A |
DAC3 Playback Volume | DAC Channel 3 volume | AD1835A, AD1836A, AD1838A |
DAC4 Playback Volume | DAC Channel 4 volume | AD1835A |
DAC1 Playback Switch | Mute/Unmute DAC Channel 1 | AD1835A, AD1836A, AD1838A |
DAC2 Playback Switch | Mute/Unmute DAC Channel 2 | AD1835A, AD1836A, AD1838A |
DAC3 Playback Switch | Mute/Unmute DAC Channel 3 | AD1835A, AD1836A, AD1838A |
DAC4 Playback Switch | Mute/Unmute DAC Channel 4 | AD1835A |
ADC1 Capture Switch | Mute/Unmute ADC Channel1 | AD1835A, AD1836A, AD1838A |
ADC2 Capture Switch | Mute/Unmute ADC Channel2 | AD1836A |
ADC2 Capture Volume | Gain for ADC Channel 2 | AD1836A |
DAI Configuration
The CODEC driver registers one DAI named depending on the chip model used.
DAI name | Model |
---|---|
“ad1835-hifi” | AD1835, AD1837 |
“ad1836-hifi” | AD1836 |
“ad1838-hifi” | AD1838, AD1839 |
Supported DAI formats
Name | Supported by driver | Description |
---|---|---|
SND_SOC_DAIFMT_I2S | no | I2S mode |
SND_SOC_DAIFMT_RIGHT_J | no | Right Justified mode |
SND_SOC_DAIFMT_LEFT_J | no | Left Justified mode |
SND_SOC_DAIFMT_DSP_A | yes | 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 | no | Normal bit- and frameclock |
SND_SOC_DAIFMT_NB_IF | no | Normal bitclock, inverted frameclock |
SND_SOC_DAIFMT_IB_NF | no | 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 | no | Codec bit- and frameclock slave |
Example DAI Configuration
static int bf5xx_ad1836_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; ? /* set cpu DAI configuration */ ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM); if (ret < 0) return ret; ? /* set codec DAI configuration */ ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM); if (ret < 0) return ret; ? return 0; } ? static struct snd_soc_ops bf5xx_ad1836_ops = { .hw_params = bf5xx_ad1836_hw_params, }; ? static struct snd_soc_dai_link bf5xx_ad1836_dai = { .name = "ad1836", .stream_name = "AD1836", .cpu_dai_name = "bfin-tdm.0", .codec_dai_name = "ad1836-hifi", .platform_name = "bfin-tdm-pcm-audio", .codec_name = "spi0.4", .ops = &bf5xx_ad1836_ops, };
AD1836 evaluation board driver
Adding Kernel Support - As a module
To add support for the built-in codec AD183X of BF5XX to the kernel build system, a few things must be enabled properly for things to work.The configuration is as following:
Linux Kernel Configuration Device Drivers ---> Sound --->Sound card support Advanced Linux Sound Architecture ---> Advanced Linux Sound Architecture < > Sequencer support OSS Mixer API OSS PCM (digital audio) API ALSA for SoC audio support ---> SoC I2S(TDM mode) Audio for the ADI BF5xx chip SoC AD183X Audio support for BF5xx
Doing this will create modules (outside the kernel). The modules will be inserted automatically when it is needed. You can also build sound driver into kernel.
Testing the built in kernel driver
If audio is configured as modules, skip this section. If audio is built into kernel and you have booted the kernel, there are a few things to check to ensure audio is working:
- Check the boot messages to see if you have booted the correct kernel. During kernel boot, it should print out:
Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC). ASoC version 0.13.1 dma rx:3 tx:4, err irq:45, regs: asoc: AD183X <-> bf5xx-tdm mapping ok ALSA device list: #0: bf5xx_ad183x (AD183X)
Testing the audio module
root:/> modprobe snd-ad183x dma rx:3 tx:4, err irq:45, regs:ffc00800 asoc: AD183X <-> bf5xx-tdm mapping ok root:/> modprobe snd-pcm-oss root:/> lsmod Module Size Used by snd_pcm_oss 28414 0 snd_mixer_oss 10215 1 snd_pcm_oss snd_ad183x 801 0 snd_bf5xx_tdm 1857 1 snd_ad183x snd_soc_ad183x 8033 1 snd_ad183x snd_soc_bf5xx_tdm 2157 1 snd_ad183x snd_soc_bf5xx_sport 9392 2 snd_bf5xx_tdm,snd_soc_bf5xx_tdm snd_soc_core 33839 4 snd_ad183x,snd_bf5xx_tdm,snd_soc_ad183x,snd_soc_bf5xx_tdm snd_pcm 44936 3 snd_pcm_oss,snd_bf5xx_tdm,snd_soc_core snd_page_alloc 2753 1 snd_pcm snd_timer 12412 1 snd_pcm snd 32171 5 snd_pcm_oss,snd_mixer_oss,snd_soc_core,snd_pcm,snd_timer input_core 15713 1 snd soundcore 3591 1 snd root:~> tone TONE: generating sine wave at 1000 Hz...
Driver testing
- Check the output
root:~> tone TONE: generating sine wave at 1000 Hz...You should hear something out of the headphone Jack.
- Check and set the audio mixer:
root:/> amixer Simple mixer control 'Playback Deemphasis',0 Capabilities: enum Items: 'None' '44.1kHz' '32kHz' '48kHz' Item0: '48kHz' Simple mixer control 'ADC High Pass Filter',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'ADC1',0 Capabilities: pswitch Playback channels: Front Left - Front Right Mono: Front Left: Playback [on] Front Right: Playback [on] Simple mixer control 'ADC2',0 Capabilities: pswitch Playback channels: Front Left - Front Right Mono: Front Left: Playback [on] Front Right: Playback [on] Simple mixer control 'DAC1',0 Capabilities: volume pswitch Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 1023 Front Left: 1023 [100%] Playback [on] Front Right: 1023 [100%] Playback [on] Simple mixer control 'DAC2',0 Capabilities: volume pswitch Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 1023 Front Left: 1023 [100%] Playback [on] Front Right: 1023 [100%] Playback [on] Simple mixer control 'DAC3',0 Capabilities: volume pswitch Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 1023 Front Left: 1023 [100%] Playback [on] Front Right: 1023 [100%] Playback [on] root:/> amixer sset 'DAC3' 200 Simple mixer control 'DAC3',0 Capabilities: volume pswitch Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 1023 Front Left: 200 [20%] Playback [on] Front Right: 200 [20%] Playback [on]Also you can run “alsamixer” to get graphic configuration interface, OSS-based “mixer” can work too.
- Check to make sure mp3s work (assuming you have built mp3play),
- The first step is to download a mp3 file onto the platform. The
wget
command assumes that networking is properly configured (you have an IP number, the default gateway is set, and DNS servers can be accessed), and working.root:/> cd /var root:/var> wget http://www.radiocrazy.com/shows/A/AbbottCostello/ABCOWhosOnFirstclip.mp3
- Next, play it with mp3play:
root:/var> mp3play ABCOWhosOnFirstclip.mp3
- You can play it in one step with:
root:~> mp3play http://www.radiocrazy.com/shows/A/AbbottCostello/ABCOWhosOnFirstclip.mp3 http://www.radiocrazy.com/shows/A/AbbottCostello/ABCOWhosOnFirstclip.mp3: MPEG2-III (0 ms)
- Optionally check to make sure the mic and headphone are working properly:
root:~> arecord -d 10 test.wav Recording WAVE "test.wav" : Unsigned 8 bit, Rate 8000 Hz, Mono root:~> aplay test.wav
This should record 10 seconds of whatever is on the Line, and then play it back over the output. - You should also be able to do a “talkthrough”, and hear on the speakers anything you put on the line.
root:~> arecord | aplay
- AD5790 IDAC Linux漂流器(Wiki站點(diǎn))
- AD5504 IO高體積ADC Linux漂流器
- TN:ADSP-21161 SIMD SHARC DSP與AD1836(24位/96 KHz)多通道編解碼器的接口
- AD1845:并聯(lián)端口16位聲音端口立體聲編碼器數(shù)據(jù)Sheet
- AD1819:AC‘97聲音端口編碼器數(shù)據(jù)Sheet
- AD7298 IIO多通道ADC Linux漂流器
- ADAU1361聲音編解碼器Linux驅(qū)動(dòng)程序
- SM2602聲音Linux漂流器
- AN-620:AD1836和AD1953在帶DSP的4進(jìn)9出模擬系統(tǒng)中的應(yīng)用
- ADAU1977聲音Linux漂流器
- ADAU第1373聲音編解碼器Linux驅(qū)動(dòng)程序
- ADAU1781聲音編解碼器Linux驅(qū)動(dòng)程序
- ADAU1701聲音音頻系統(tǒng)Linux驅(qū)動(dòng)器
- SM2518聲音Linux漂流器
- AD1836:多通道96 kHz編解碼器初步數(shù)據(jù)表
- 聲音發(fā)生器電路圖分享 2001次閱讀
- 制作一個(gè)全景聲音放大器的電路原理和資料簡(jiǎn)介 3818次閱讀
- 拾音器工作原理_拾音器的作用 2.3w次閱讀
- 拾音器是干什么用的_拾音器和麥克風(fēng)的區(qū)別 5.4w次閱讀
- 拾音器怎么安裝_拾音器怎么用 3.3w次閱讀
- 3D環(huán)繞立體聲具有哪些應(yīng)用特點(diǎn) 7667次閱讀
- 分音器如何操作 電子分音器有什么用 6468次閱讀
- 音箱中的分音器的作用是什么 5609次閱讀
- 聲音傳感器有哪些_聲音傳感器的應(yīng)用 8.4w次閱讀
- 一種監(jiān)控拾音器電路的分析與制作 2.5w次閱讀
- 拾音器是什么_有什么用_拾音器工作原理介紹 1.7w次閱讀
- 拾音器底噪聲音大怎么解決及安裝注意事項(xiàng) 2.3w次閱讀
- 拾音器和話筒分別有什么優(yōu)勢(shì) 2.2w次閱讀
- 聲音傳感器模塊使用說明 2.3w次閱讀
- 聲音傳感器有哪些 1.3w次閱讀
下載排行
本周
- 1電子電路原理第七版PDF電子教材免費(fèi)下載
- 0.00 MB | 1491次下載 | 免費(fèi)
- 2單片機(jī)典型實(shí)例介紹
- 18.19 MB | 95次下載 | 1 積分
- 3S7-200PLC編程實(shí)例詳細(xì)資料
- 1.17 MB | 27次下載 | 1 積分
- 4筆記本電腦主板的元件識(shí)別和講解說明
- 4.28 MB | 18次下載 | 4 積分
- 5開關(guān)電源原理及各功能電路詳解
- 0.38 MB | 11次下載 | 免費(fèi)
- 6100W短波放大電路圖
- 0.05 MB | 4次下載 | 3 積分
- 7基于單片機(jī)和 SG3525的程控開關(guān)電源設(shè)計(jì)
- 0.23 MB | 4次下載 | 免費(fèi)
- 8基于AT89C2051/4051單片機(jī)編程器的實(shí)驗(yàn)
- 0.11 MB | 4次下載 | 免費(fèi)
本月
- 1OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234313次下載 | 免費(fèi)
- 2PADS 9.0 2009最新版 -下載
- 0.00 MB | 66304次下載 | 免費(fèi)
- 3protel99下載protel99軟件下載(中文版)
- 0.00 MB | 51209次下載 | 免費(fèi)
- 4LabView 8.0 專業(yè)版下載 (3CD完整版)
- 0.00 MB | 51043次下載 | 免費(fèi)
- 5555集成電路應(yīng)用800例(新編版)
- 0.00 MB | 33562次下載 | 免費(fèi)
- 6接口電路圖大全
- 未知 | 30320次下載 | 免費(fèi)
- 7Multisim 10下載Multisim 10 中文版
- 0.00 MB | 28588次下載 | 免費(fèi)
- 8開關(guān)電源設(shè)計(jì)實(shí)例指南
- 未知 | 21539次下載 | 免費(fèi)
總榜
- 1matlab軟件下載入口
- 未知 | 935053次下載 | 免費(fèi)
- 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
- 78.1 MB | 537793次下載 | 免費(fèi)
- 3MATLAB 7.1 下載 (含軟件介紹)
- 未知 | 420026次下載 | 免費(fèi)
- 4OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234313次下載 | 免費(fèi)
- 5Altium DXP2002下載入口
- 未知 | 233046次下載 | 免費(fèi)
- 6電路仿真軟件multisim 10.0免費(fèi)下載
- 340992 | 191183次下載 | 免費(fèi)
- 7十天學(xué)會(huì)AVR單片機(jī)與C語言視頻教程 下載
- 158M | 183277次下載 | 免費(fèi)
- 8proe5.0野火版下載(中文版免費(fèi)下載)
- 未知 | 138039次下載 | 免費(fèi)
評(píng)論
查看更多