資料介紹
Table of Contents
ADAU1977 Sound CODEC Linux Driver
Supported Devices
Evaluation Boards
Source Code
Status
Files
Function | File |
---|---|
driver | sound/soc/codecs/adau1977.c |
driver | sound/soc/codecs/adau1977-spi.c |
driver | sound/soc/codecs/adau1977-i2c.c |
include | sound/soc/codecs/adau1977.h |
platform data | include/linux/platform_data/adau1977.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.
The platform data for the ADAU1977 allow to specify the MICBIAS pin voltage. If no platform data is specified (i.e. set to NULL) the default voltage of 8.5 V will be used.
/** * enum adau1977_micbias - ADAU1977 MICBIAS pin voltage setting * @ADAU1977_MICBIAS_5V0: MICBIAS is set to 5.0 V * @ADAU1977_MICBIAS_5V5: MICBIAS is set to 5.5 V * @ADAU1977_MICBIAS_6V0: MICBIAS is set to 6.0 V * @ADAU1977_MICBIAS_6V5: MICBIAS is set to 6.5 V * @ADAU1977_MICBIAS_7V0: MICBIAS is set to 7.0 V * @ADAU1977_MICBIAS_7V5: MICBIAS is set to 7.5 V * @ADAU1977_MICBIAS_8V0: MICBIAS is set to 8.0 V * @ADAU1977_MICBIAS_8V5: MICBIAS is set to 8.5 V * @ADAU1977_MICBIAS_9V0: MICBIAS is set to 9.0 V */ enum adau1977_micbias { ADAU1977_MICBIAS_5V0 = 0x0, ADAU1977_MICBIAS_5V5 = 0x1, ADAU1977_MICBIAS_6V0 = 0x2, ADAU1977_MICBIAS_6V5 = 0x3, ADAU1977_MICBIAS_7V0 = 0x4, ADAU1977_MICBIAS_7V5 = 0x5, ADAU1977_MICBIAS_8V0 = 0x6, ADAU1977_MICBIAS_8V5 = 0x7, ADAU1977_MICBIAS_9V0 = 0x8, }; ? /** * struct adau1977_platform_data - Platform configuration data for the ADAU1977 * @micbias: Specifies the voltage for the MICBIAS pin */ struct adau1977_platform_data { enum adau1977_micbias micbias; };
Voltage Supplies
The ADAU1977 driver expects a regulator supply for the AVDD voltage to be specified. This allows the driver to disable the supply when not needed, which helps to conserve power. Additionally the driver optionally accepts a supply for the DVDD voltage. If a supply for the DVDD voltage is specified the driver will use that regulator and disable the internal LDO.
When using machine board files to register the device the regulators can be specified in the board file.
static struct regulator_consumer_supply adau1977_avdd_consumer_supplies[] = { REGULATOR_SUPPLY("AVDD", "spi0.1"), }; ? static struct regulator_init_data adau1977_avdd_reg_init_data = { .constraints = { .name = "3V3", .valid_ops_mask = REGULATOR_CHANGE_STATUS, }, .consumer_supplies = adau1977_avdd_consumer_supplies, .num_consumer_supplies = ARRAY_SIZE(adau1977_avdd_consumer_supplies), }; ? static struct fixed_voltage_config adau1977_avdd_pdata = { .supply_name = "board-3V3", .microvolts = 3300000, .gpio = -EINVAL, .enabled_at_boot = 0, .init_data = &adau1977_avdd_reg_init_data, }; ? static struct platform_device adau1977_avdd_voltage_regulator = { .name = "reg-fixed-voltage", .id = 0, .dev = { .platform_data = &adau1977_avdd_pdata, }, }; ? /* Optional */ static struct regulator_consumer_supply adau1977_dvdd_consumer_supplies[] = { REGULATOR_SUPPLY("DVDD", "spi0.1"), }; ? static struct regulator_init_data adau1977_dvdd_reg_init_data = { .constraints = { .name = "1V8", .valid_ops_mask = REGULATOR_CHANGE_STATUS, }, .consumer_supplies = adau1977_dvdd_consumer_supplies, .num_consumer_supplies = ARRAY_SIZE(adau1977_dvdd_consumer_supplies), }; ? static struct fixed_voltage_config adau1977_dvdd_pdata = { .supply_name = "board-1V8", .microvolts = 1800000, .gpio = -EINVAL, .enabled_at_boot = 0, .init_data = &adau1977_dvdd_reg_init_data, }; ? static struct platform_device adau1977_dvdd_voltage_regulator = { .name = "reg-fixed-voltage", .id = 1, .dev = { .platform_data = &adau1977_dvdd_pdata, }, };
When using devicetree the regulators should be specified in the devicetree. For more on how to specify the regulators using devicetree see the regulator devicetree bindings documentation and the devicetree examples below in the SPI and I2C sections.
Devicetree bindings
The ADAU1977 driver is fully devicetree compatible. Depending on the bus type the device is connected to different properties must/can be specified.
Shared required properties:
- compatible: Must be “adi,adau1977”, “adi,adau1978” or adi,adau1979“
- AVDD-supply: A handle to the power supply connected to the AVDD pin
Shared optional properties:
- DVDD-supply: A handle to the power supply connected to the DVDD pin. If specified the internal LDO will be disabled.
- reset-gpios: GPIO chip handle and specifier that define which GPIO is connected to the chips PD/RST pin. If not specified the reset pin is assumed to be hardwired to VCC.
- adi,micbias: Configures the voltage setting for the MICBIAS pin. If not specified the default value will be 8.5 Volts. This property is only valid for the ADAU1977. Valid values for this property are:
- 0: 5.0V
- 1: 5.5V
- 2: 6.0V
- 3: 6.5V
- 4: 7.0V
- 5: 7.5V
- 6: 8.0V
- 7: 8.5V
- 8: 9.0V
I2C required properties:
- reg: The I2C address of the chip
SPI required properties:
- reg: The SPI chipselect signal of the SPI master associated with this chip
- spi-max-frequency: Maximum spi frequency to use.
I2C
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 device id depends on the ADDR0 and ADDR1 pin settings and needs to be set according to your board setup.
ADDR1 | ADDR0 | I2C device id |
---|---|---|
0 | 0 | 0x11 |
0 | 1 | 0x31 |
1 | 0 | 0x51 |
1 | 1 | 0x71 |
In this example we assume ADDR0=0 and ADDR1=0.
static struct adau1977_platform_data adau1977_pdata = { .micbias = ADAU1977_MICBIAS_6V5, }; ? static struct i2c_board_info __initdata bfin_i2c_board_info[] = { ? [--snip--] { I2C_BOARD_INFO("adau1977", 0x11), .platform_data = &adau1977_pdata, }, [--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
codec_supply: fixedregulator@0 { compatible = "regulator-fixed"; regulator-name = "AVDD"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; i2c@41600000 { compatible = "...; ... #size-cells = <0>; #address-cells = <1>; adau1977: codec@11 { compatible = "adi,adau1977"; reg = <0x11>; reset-gpios = <&gpio 5 0>; AVDD-supply = <&codec_supply>; }; };
SPI
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
static struct adau1977_platform_data adau1977_pdata = { .micbias = ADAU1977_MICBIAS_7V5, }; ? static struct spi_board_info board_spi_board_info[] __initdata = { [--snip--] { .modalias = "adau1977", .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ .bus_num = 0, .chip_select = GPIO_PF10 + MAX_CTRL_CS, /* CS, change it for your board */ .mode = SPI_MODE_0, .platform_data = &adau1977_pdata, }, [--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);
Devicetree
codec_supply: fixedregulator@0 { compatible = "regulator-fixed"; regulator-name = "AVDD"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; spi@41600000 { compatible = "...; ... #size-cells = <0>; #address-cells = <1>; adau1977: codec@1 { compatible = "adi,adau1977"; reg = <0x1>; spi-max-frequency = <10000000>; reset-gpios = <&gpio 5 0>; AVDD-supply = <&codec_supply>; adi,micbias = <5>; }; };
ASoC DAPM Widgets
ALSA Controls
Name | Description |
---|---|
ADC1 Capture Volume | Post ADC gain for channel 1 |
ADC2 Capture Volume | Post ADC gain for channel 2 |
ADC3 Capture Volume | Post ADC gain for channel 3 |
ADC4 Capture Volume | Post ADC gain for channel 4 |
ADC1 Highpass-Filter Capture Switch | Enables/disables the highpass-filter for channel 1 |
ADC2 Highpass-Filter Capture Switch | Enables/disables the highpass-filter for channel 2 |
ADC3 Highpass-Filter Capture Switch | Enables/disables the highpass-filter for channel 3 |
ADC4 Highpass-Filter Capture Switch | Enables/disables the highpass-filter for channel 4 |
ADC1 DC Substraction Capture Switch | Enables/disables DC offset subtraction for channel 1 |
ADC2 DC Substraction Capture Switch | Enables/disables DC offset subtraction for channel 2 |
ADC3 DC Substraction Capture Switch | Enables/disables DC offset subtraction for channel 3 |
ADC4 DC Substraction Capture Switch | Enables/disables DC offset subtraction for channel 4 |
DAI configuration
The codec driver registers one DAI: adau1977-hifi
Supported DAI formats
Name | Supported by driver | Description | Notes |
---|---|---|---|
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 | yes | Codec bit- and frameclock master | Master mode is not supported if the LRCLK is used as clock source |
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 |
System clock configuration
The sysclk can either be provided by the internal PLL derived from the MCLK signal or by the LRCLK signal.
enum adau1977_clk_id { ADAU1977_SYSCLK, }; ? enum adau1977_sysclk_src { ADAU1977_SYSCLK_SRC_MCLK, ADAU1977_SYSCLK_SRC_LRCLK, };
If the MCLK is used the supported sampling rates of the device is constraint to those sample rates that can be derived from the the MCLK. The constraints are setup in the CODEC driver's startup routine. This means that the sysclk needs to be configured before the CODEC's startup callback is called. This can either be done from the machine driver's startup or init callback.
For some hardware configurations it might be possible to change the MCLK frequency at runtime (e.g. to support both 44.1kHz and 48kHz based sample rates). In this case in order for the CODEC driver to not set any sample rate constraints the sysclk frequency should be set to 0 until it has been decided which MCLK frequency is used. This can for example be implemented by setting the sysclk to 0 in the machine driver's startup callback and setting it to the actual frequency in the hw_params callback.
TDM configuration
The TDM mode of the ADAU1977 can be configured using the snd_soc_dai_set_tdm_slot() function.
- The number of slots can be either 2, 4, 8 or 16. If the number of slots is set to 0 the device will go to I2S mode.
- The slot width can be 16, 24, 32 bits per slot (In master mode only 16 and 32 bits per slot are supported)
- tx_mask must always be 0.
- Each slot can hold the data sample of one channel. Which slot holds which channel is configured by rx_mask. The first bit that is set in rx_mask is the slot that holds the first channel, the second bit the slot that holds the second channel and so on. If less then 4 bits are set the channels for which no slot has been provided are disabled. (E.g. 0x33, configures channel 0 to slot 0, channel 1 to slot 1, channel 2 to slot 4 and channel 3 to slot 4).
Example TDM configuration:
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x00, 0x0f, 4, 32);
To configure whether the unused TDM slots should be tristated or actively driven low the snd_soc_dai_set_tristate() function is used. By default they are driven low.
Example tristate configuration:
ret = snd_soc_dai_set_tristate(codec_dai, true);
Example machine driver configuration
Fixed MCLK
static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) { return snd_snd_soc_codec_set_sysclk_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ADAU1977_SYSCLK_SRC_MCLK, 1228000, SND_SOC_CLOCK_IN); } ? static struct snd_soc_dai_link eval_adau1977_dai = { .name = "adau1977", .stream_name = "ADAU1977", .cpu_dai_name = "bfin-i2s.0", .codec_dai_name = "adau1977-hifi", .platform_name = "bfin-i2s-pcm-audio", .codec_name = "adau1977.0-0011", .init = eval_adau1977_init, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, };
Configurable MCLK
static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) { return snd_snd_soc_codec_set_sysclk_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ADAU1977_SYSCLK_SRC_MCLK, 0, SND_SOC_CLOCK_IN); } ? static int eval_adau1977_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; int ret; ? if (params_rate(params) % 441000 == 0) mclk_rate = 11289600; else mclk_rate = 12288000; ? clk_set_rate(mclk, mclk_rate); ? return snd_snd_soc_codec_set_sysclk_set_sysclk(rtd->codec, ADAU1977_SYSCLK, ADAU1977_SYSCLK_SRC_MCLK, mclk_rate, SND_SOC_CLOCK_IN); } ? static struct snd_soc_ops eval_adau1977_ops = { .hw_params = bfin_eval_adau1x61_hw_params, }; ? static struct snd_soc_dai_link eval_adau1977_dai = { .name = "adau1977", .stream_name = "ADAU1977", .cpu_dai_name = "bfin-i2s.0", .codec_dai_name = "adau1977-hifi", .platform_name = "bfin-i2s-pcm-audio", .codec_name = "adau1977.0-0011", .ops = &eval_adau1977_ops, .init = eval_adau1977_init, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, };
- 基于EVAL-ADAU1977Z模擬到數字轉換的參考設計
- EVAR-ADA77年 ADAU1977評估板
- ADAU1977 IBIS模型
- ADAU1977評估軟件-64位
- ADAU1977評估軟件-32位
- AD1836聲音Linux漂流器
- AD1845:并聯端口16位聲音端口立體聲編碼器數據Sheet
- ADAU1361聲音編解碼器Linux驅動程序
- SM2602聲音Linux漂流器
- ADAU第1373聲音編解碼器Linux驅動程序
- ADAU1781聲音編解碼器Linux驅動程序
- ADAU1701聲音音頻系統Linux驅動器
- SM2518聲音Linux漂流器
- UG-600:評估ADAU1977/ADAU1978/ADAU1979
- ADAU1977中文資料數據手冊PDF免費下載(高性能模數轉換器) 10次下載
- 低功耗立體聲CODEC ADAU1373的主要特性及應用電路 2838次閱讀
- 單芯片音頻系統ADAU1401的特點性能及應用電路 6888次閱讀
- 低功耗24位立體聲編譯碼器ADAU1781的主要特性及應用 2849次閱讀
- 拾音器工作原理_拾音器的作用 2.3w次閱讀
- 拾音器是干什么用的_拾音器和麥克風的區別 5.4w次閱讀
- 拾音器怎么安裝_拾音器怎么用 3.3w次閱讀
- 分音器如何操作 電子分音器有什么用 6468次閱讀
- 音箱中的分音器的作用是什么 5609次閱讀
- 聲音傳感器有哪些_聲音傳感器的應用 8.4w次閱讀
- 一種監控拾音器電路的分析與制作 2.5w次閱讀
- 拾音器是什么_有什么用_拾音器工作原理介紹 1.7w次閱讀
- 拾音器底噪聲音大怎么解決及安裝注意事項 2.3w次閱讀
- 拾音器和話筒分別有什么優勢 2.2w次閱讀
- 聲音傳感器模塊使用說明 2.3w次閱讀
- adau1701的優點及缺點分析 1.9w次閱讀
下載排行
本周
- 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次下載 | 免費
評論
查看更多