This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:tools-software:linux-drivers:sound:ad1835a [09 May 2011 21:47] – Added part number to title andyr | resources:tools-software:linux-drivers:sound:ad1835a [04 Feb 2021 15:36] (current) – [Driver testing] Michael Hennerich | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
+ | |||
+ | ===== Supported devices ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | ===== Evaluation Boards ===== | ||
+ | |||
+ | * [[adi> | ||
+ | |||
+ | ====== Source Code ====== | ||
+ | |||
+ | ==== Status ==== | ||
+ | |||
+ | ^ Source ^ Mainline? ^ | ||
+ | | [[git.linux.org> | ||
+ | |||
+ | ==== Files ==== | ||
+ | |||
+ | ^ Function ^ File ^ | ||
+ | | driver | ||
+ | | include | [[git.linux.org> | ||
+ | |||
+ | ====== Example device initialization ====== | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | You need to set the modalias of your SPI info according to your codec. Valid values are " | ||
+ | |||
+ | <code c> | ||
+ | static struct spi_board_info board_spi_board_info[] __initdata = { | ||
+ | [--snip--] | ||
+ | { | ||
+ | .modalias = " | ||
+ | .max_speed_hz = 3125000, | ||
+ | .bus_num = 0, | ||
+ | .chip_select = 4, /* CS, change it for your board */ | ||
+ | .mode = SPI_MODE_3, | ||
+ | }, | ||
+ | [--snip--] | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | <code c> | ||
+ | static int __init board_init(void) | ||
+ | { | ||
+ | [--snip--] | ||
+ | |||
+ | spi_register_board_info(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/ | ||
+ | | Playback Deemphasis | Select playback de-emphasis. Possible Values: " | ||
+ | | 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 ^ | ||
+ | | " | ||
+ | | " | ||
+ | | " | ||
+ | |||
+ | ==== Supported DAI formats ==== | ||
+ | |||
+ | ^ Name ^ Supported by driver ^ Description ^ | ||
+ | | SND_SOC_DAIFMT_I2S | ||
+ | | SND_SOC_DAIFMT_RIGHT_J | no | Right Justified mode | | ||
+ | | SND_SOC_DAIFMT_LEFT_J | ||
+ | | SND_SOC_DAIFMT_DSP_A | ||
+ | | SND_SOC_DAIFMT_DSP_B | ||
+ | | SND_SOC_DAIFMT_AC97 | ||
+ | | SND_SOC_DAIFMT_PDM | ||
+ | | | | | ||
+ | | 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 ==== | ||
+ | |||
+ | <code c> | ||
+ | static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream, | ||
+ | struct snd_pcm_hw_params *params) | ||
+ | { | ||
+ | struct snd_soc_pcm_runtime *rtd = substream-> | ||
+ | struct snd_soc_dai *cpu_dai = rtd-> | ||
+ | struct snd_soc_dai *codec_dai = rtd-> | ||
+ | int ret; | ||
+ | |||
+ | /* set cpu DAI configuration */ | ||
+ | ret = snd_soc_dai_set_fmt(cpu_dai, | ||
+ | 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_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 = " | ||
+ | .stream_name = " | ||
+ | .cpu_dai_name = " | ||
+ | .codec_dai_name = " | ||
+ | .platform_name = " | ||
+ | .codec_name = " | ||
+ | .ops = & | ||
+ | }; | ||
+ | </ | ||
+ | ====== AD1836 evaluation board driver | ||
===== Adding Kernel Support - As a module ===== | ===== Adding Kernel Support - As a module ===== | ||
Line 20: | Line 179: | ||
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. | 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 ==== | ==== Testing the built in kernel driver ==== | ||
Line 34: | Line 194: | ||
#0: bf5xx_ad183x (AD183X) | #0: bf5xx_ad183x (AD183X) | ||
</ | </ | ||
+ | |||
==== Testing the audio module ==== | ==== Testing the audio module ==== | ||
< | < | ||
Line 61: | Line 222: | ||
</ | </ | ||
- | ===== Testing Audio ===== | + | ===== Driver testing |
- Check the output | - Check the output | ||
Line 125: | Line 286: | ||
Also you can run " | Also you can run " | ||
- Check to make sure mp3s work (assuming you have built mp3play), | - Check to make sure mp3s work (assuming you have built mp3play), | ||
- | - The first step is to download a mp3 file onto the platform. The '' | + | - The first step is to download a mp3 file onto the platform. The '' |
root:/ | root:/ | ||
</ | </ |