资料介绍
Table of Contents
SSM2518 Sound CODEC Linux Driver
Supported Devices
Reference Circuits
Evaluation Boards
Source Code
Status
Files
Function | File |
---|---|
driver | sound/soc/codecs/ssm2518.c |
include | sound/soc/codecs/ssm2518.h |
Example device initialization
For compile time configuration, it’s common Linux practice to keep board- and application-specific configuration out of the main driver file, instead putting it into the board support file.
For devices on custom boards, as typical of embedded and SoC-(system-on-chip) based hardware, Linux uses platform_data to point to board-specific structures describing devices and how they are connected to the SoC. This can include available ports, chip variants, preferred modes, default initialization, additional pin roles, and so on. This shrinks the board-support packages (BSPs) and minimizes board and application specific #ifdefs in drivers.
Declaring I2C devices
Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each I2C bus segment, and what address these devices are using. For this reason, the kernel code must instantiate I2C devices explicitly. There are different ways to achieve this, depending on the context and requirements. However the most common method is to declare the I2C devices by bus number.
This method is appropriate when the I2C bus is a system bus, as in many embedded systems, wherein each I2C bus has a number which is known in advance. It is thus possible to pre-declare the I2C devices that inhabit this bus. This is done with an array of struct i2c_board_info, which is registered by calling i2c_register_board_info().
So, to enable such a driver one need only edit the board support file by adding an appropriate entry to i2c_board_info.
For more information see: Documentation/i2c/instantiating-devices
The I2C address of the SSM2518 depends on the setting of the ADDR pin
ADDR | I2C Address |
---|---|
0 | 0x34 |
1 | 0x36 |
static struct i2c_board_info __initdata bfin_i2c_board_info[] = { [--snip--] { I2C_BOARD_INFO("ssm2518", 0x34), }, [--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);
Devicetree
i2s: i2c@41600000 { compatible = "...; ... #size-cells = <0>; #address-cells = <1>; ssm2518: ssm2518@34 { compatible = "adi,ssm2518"; reg = <0x34>; gpios = <&gpio 5 0>; }; };
ASoC DAPM Widgets
Name | Description |
---|---|
OUTL | Output for Left Channel |
OUTR | Output for Right Channel |
ALSA Controls
Name | Description |
---|---|
Playback De-emphasis Switch | Enable/Disable de-emphasis |
Master Playback Volume | DAC Volume Control |
Master Playback Switch | Unmutes/Mutes the DAC output |
Amp Low Power Mode Switch | Enables/Disables the lower power mode of the Amplifier |
DAC Low Power Mode Switch | Enables/Disables the lower power mode of the DAC |
DRC Switch | Enable/Disable Dynamic Range Control |
DRC Limiter Switch | Enable/Disable the DRC Limiter function |
DRC Compressor Switch | Enable/Disable the DRC Compressor function |
DRC Expander Switch | Enable/Disable the DRC Expander function |
DRC Noise Gate Switch | Enable/Disable the DRC Noise Gate function |
DRC Limiter Threshold Volume | DRC Limiter Threshold Setting. Relative to input |
DRC Compressor Lower Threshold Volume | DRC Compressor Lower Threshold Setting. Relative to input |
DRC Expander Upper Threshold Volume | DRC Expander Upper Threshold Setting. Relative to input |
DRC Noise Gate Threshold Volume | DRC Noise Gate Threshold Setting. Relative to input |
DRC Upper Output Threshold Volume | DRC Limiter Threshold Setting. Relative to input |
DRC Lower Output Threshold Volume | DRC Minimum Output Signal Amplitude Setting. This is the minimum output level produced by the DRC and is used to indicate the expander lower threshold, or output signal level when the input rises beyond the noise gate threshold |
DRC Post Volume | Post-DRC Gain Adjust Setting. This can be used to add additional gain after the DRC function to compensate for the overall reduction of system gain due to the DRC |
DRC Peak Detector Attack Time | DRC Peak Detector Attack Time |
DRC Peak Detector Release Time | DRC Peak Detector Release Time |
DRC Attack Time | DRC Attack Time. Used to smooth the gain curve at the thresholds (knees) of each DRC function |
DRC Decay Time | DRC Decay Time. Used to smooth the gain curve at the thresholds (knees) of each DRC function |
DRC Hold Time | DRC Normal Operation Hold Time. Used to prevent the gain curve calculation from increasing too quickly |
DRC Noise Gate Hold Time | |
DRC RMS Averaging Time | DRC RMS Detector Averaging Time. This is the averaging time for the rms level that is compared to the DRC thresholds |
DAI configuration
The codec driver registers one DAI named “ssm2518-hifi”.
Supported DAI formats
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 | yes | data MSB after FRM LRC |
SND_SOC_DAIFMT_DSP_B | yes | 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 | no | 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 |
Supported SYSCLK rates
The CODECs system clock can be configured for various input rates. When configuring the codec system clock use SSM2518_SYSCLK for the clock id.
The following list contains the supported system clock rates and their resulting sample-rates.
SYSCLK | Supported sample-rates |
---|---|
2048000, 4096000, 8192000, 8192000, 3200000, 6400000, 12800000 | 8kHz, 16kHz, 32kHz |
2822000, 5644800, 11289600, 16934400, 22579200, 33868800, 4410000, 8820000, 17640000 | 11.025kHz, 22.05kHz, 44.1kHz |
3072000, 6144000, 38864000, 4800000, 9600000, 19200000 | 12kHz, 24kHz, 48kHz, 96kHz |
12288000, 16384000, 24576000 | 8kHz, 12kHz, 16kHz, 24kHz, 32kHz, 48kHz, 96kHz |
SYSCLK configuration
To configure the devices sysclk the snd_soc_codec_set_sysclk()
function can be used. It needs to be called at least once before playback starts. The clk_id
parameter must always be SSM2518_SYSCLK
and the dir
parameter must always be SND_SOC_CLOCK_IN
. The freq
can be set to any of the frequencies above. The system clock can either be taken from the external MCLK or the BCLK. In case the system clock is taken from the BCLK the BCLK needs to be applied to the MCLK pin and the BLCK can be left unconnected. To use the MCLK as the system clock source the source
parameter should to be set to SSM2518_SYSCLK_SRC_MCLK
, to use the BCLK it should be set to SSM2518_SYSCLK_SRC_BCLK
#define SSM2518_SYSCLK 0 enum ssm2518_sysclk_src { SSM2518_SYSCLK_SRC_MCLK = 0, SSM2518_SYSCLK_SRC_BCLK = 1, };
snd_soc_codec_set_sysclk
interface was removed. Instead snd_soc_component_set_sysclk
should be used
TDM configuration
If you want to use the SSM2518 in TDM mode you can configure it using snd_soc_dai_set_tdm_slot() from you ASoC board driver.
The following restrictions apply to the parameters of snd_soc_dai_set_tdm_slot().
- tx_mask must have exactly two bits set. The most upper bit will be the slot of right channel, the most lower bit will be the slot left channel. E.g. 0x3 means the left channel will be at slot 0 and the right channel will be at slot 1 in the TDM stream.
- rx_mask must be 0.
- slots must be either 1, 2, 4, 8 or 16
- width must be either 16, 24, 32
Example:
static int ssm2518_link_init(struct snd_soc_pcm_runtime *rtd) { int ret; ret = snd_soc_dai_set_tdm_slot(rtd->codec_dai, 0x0c, 0x00, 8, 32); if (ret < 0) return ret; return 0; } static struct snd_soc_dai_link ssm2518_dai_link = { ..., .init = ssm2518_link_init, };
Example DAI configuration
#include "../codecs/ssm2518.h" static int pmod_amp3_init(struct snd_soc_pcm_runtime *rtd) { return snd_soc_codec_set_sysclk(rtd->codec, SSM2518_SYSCLK, SSM2518_SYSCLK_SRC_MCLK, 12288000, SND_SOC_CLOCK_IN); } static const struct snd_soc_dapm_widget pmod_amp3_widgets[] = { SND_SOC_DAPM_SPK("Speaker Out", NULL), }; static const struct snd_soc_dapm_route pmod_amp3_routes[] = { { "Speaker Out", NULL, "OUTL" }, { "Speaker Out", NULL, "OUTR" }, }; static struct snd_soc_dai_link pmod_amp3_dai_link = { .name = "ssm2518", .stream_name = "ssm2518", .codec_dai_name = "ssm2518-hifi", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .init = pmod_amp3_init, }; static struct snd_soc_card pmod_amp3_card = { .name = "PMOD AMP3 SSM2518", .owner = THIS_MODULE, .dai_link = &pmod_amp3_dai_link, .num_links = 1, .dapm_widgets = pmod_amp3_widgets, .num_dapm_widgets = ARRAY_SIZE(pmod_amp3_widgets), .dapm_routes = pmod_amp3_routes, .num_dapm_routes = ARRAY_SIZE(pmod_amp3_routes), .fully_routed = true, };
More information
- 555声音发生器I2C控制
- AD5790 IDAC Linux漂流器(Wiki站点)
- AD5504 IO高体积ADC Linux漂流器
- AD1836声音Linux漂流器
- AD1845:并联端口16位声音端口立体声编码器数据Sheet
- AD1819:AC‘97声音端口编码器数据Sheet
- AD1881年:AC‘97声音Max Codec过时的数据Sheet
- AD7298 IIO多通道ADC Linux漂流器
- ADAU1361声音编解码器Linux驱动程序
- SM2602声音Linux漂流器
- ADAU1977声音Linux漂流器
- ADAU第1373声音编解码器Linux驱动程序
- ADAU1781声音编解码器Linux驱动程序
- ADAU1701声音音频系统Linux驱动器
- ADIN1200/ADIN1300 Linux漂流器
- SM401声控集成块构成的声控闪光电路 3628次阅读
- 拾音器工作原理_拾音器的作用 2.3w次阅读
- 拾音器是干什么用的_拾音器和麦克风的区别 5.4w次阅读
- 拾音器怎么安装_拾音器怎么用 3.3w次阅读
- 3D环绕立体声具有哪些应用特点 7667次阅读
- 分音器如何操作 电子分音器有什么用 6468次阅读
- 音箱中的分音器的作用是什么 5609次阅读
- 声音传感器有哪些_声音传感器的应用 8.4w次阅读
- 一种监控拾音器电路的分析与制作 2.5w次阅读
- 拾音器是什么_有什么用_拾音器工作原理介绍 1.7w次阅读
- 拾音器底噪声音大怎么解决及安装注意事项 2.3w次阅读
- 拾音器和话筒分别有什么优势 2.2w次阅读
- 声音传感器模块使用说明 2.3w次阅读
- 声音传感器有哪些 1.3w次阅读
- 长虹r2518n电路图(没有图像只有声音) 8925次阅读
下载排行
本周
- 1电子电路原理第七版PDF电子教材免费下载
- 0.00 MB | 1491次下载 | 免费
- 2单片机典型实例介绍
- 18.19 MB | 95次下载 | 1 积分
- 3S7-200PLC编程实例详细资料
- 1.17 MB | 27次下载 | 1 积分
- 4笔记本电脑主板的元件识别和讲解说明
- 4.28 MB | 18次下载 | 4 积分
- 5开关电源原理及各功能电路详解
- 0.38 MB | 11次下载 | 免费
- 6100W短波放大电路图
- 0.05 MB | 4次下载 | 3 积分
- 7基于单片机和 SG3525的程控开关电源设计
- 0.23 MB | 4次下载 | 免费
- 8基于AT89C2051/4051单片机编程器的实验
- 0.11 MB | 4次下载 | 免费
本月
- 1OrCAD10.5下载OrCAD10.5中文版软件
- 0.00 MB | 234313次下载 | 免费
- 2PADS 9.0 2009最新版 -下载
- 0.00 MB | 66304次下载 | 免费
- 3protel99下载protel99软件下载(中文版)
- 0.00 MB | 51209次下载 | 免费
- 4LabView 8.0 专业版下载 (3CD完整版)
- 0.00 MB | 51043次下载 | 免费
- 5555集成电路应用800例(新编版)
- 0.00 MB | 33562次下载 | 免费
- 6接口电路图大全
- 未知 | 30320次下载 | 免费
- 7Multisim 10下载Multisim 10 中文版
- 0.00 MB | 28588次下载 | 免费
- 8开关电源设计实例指南
- 未知 | 21539次下载 | 免费
总榜
- 1matlab软件下载入口
- 未知 | 935053次下载 | 免费
- 2protel99se软件下载(可英文版转中文版)
- 78.1 MB | 537793次下载 | 免费
- 3MATLAB 7.1 下载 (含软件介绍)
- 未知 | 420026次下载 | 免费
- 4OrCAD10.5下载OrCAD10.5中文版软件
- 0.00 MB | 234313次下载 | 免费
- 5Altium DXP2002下载入口
- 未知 | 233046次下载 | 免费
- 6电路仿真软件multisim 10.0免费下载
- 340992 | 191183次下载 | 免费
- 7十天学会AVR单片机与C语言视频教程 下载
- 158M | 183277次下载 | 免费
- 8proe5.0野火版下载(中文版免费下载)
- 未知 | 138039次下载 | 免费
评论
查看更多