Commit da5feefe authored by Liam Girdwood's avatar Liam Girdwood Committed by Mark Brown

ASoC: Docs: Update codec documentation

Update the codec class driver documentation and bring it up to date
with the current code base. This includes API changes, regmap and
multi component.
Signed-off-by: default avatarLiam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 272b98c6
ASoC Codec Driver ASoC Codec Class Driver
================= =======================
The codec driver is generic and hardware independent code that configures the The codec class driver is generic and hardware independent code that configures
codec to provide audio capture and playback. It should contain no code that is the codec, FM, MODEM, BT or external DSP to provide audio capture and playback.
specific to the target platform or machine. All platform and machine specific It should contain no code that is specific to the target platform or machine.
code should be added to the platform and machine drivers respectively. All platform and machine specific code should be added to the platform and
machine drivers respectively.
Each codec driver *must* provide the following features:- Each codec class driver *must* provide the following features:-
1) Codec DAI and PCM configuration 1) Codec DAI and PCM configuration
2) Codec control IO - using I2C, 3 Wire(SPI) or both APIs 2) Codec control IO - using RegMap API
3) Mixers and audio controls 3) Mixers and audio controls
4) Codec audio operations 4) Codec audio operations
5) DAPM description.
6) DAPM event handler.
Optionally, codec drivers can also provide:- Optionally, codec drivers can also provide:-
5) DAPM description.
6) DAPM event handler.
7) DAC Digital mute control. 7) DAC Digital mute control.
Its probably best to use this guide in conjunction with the existing codec Its probably best to use this guide in conjunction with the existing codec
...@@ -64,26 +65,9 @@ struct snd_soc_dai_driver wm8731_dai = { ...@@ -64,26 +65,9 @@ struct snd_soc_dai_driver wm8731_dai = {
2 - Codec control IO 2 - Codec control IO
-------------------- --------------------
The codec can usually be controlled via an I2C or SPI style interface The codec can usually be controlled via an I2C or SPI style interface
(AC97 combines control with data in the DAI). The codec drivers provide (AC97 combines control with data in the DAI). The codec driver should use the
functions to read and write the codec registers along with supplying a Regmap API for all codec IO. Please see include/linux/regmap.h and existing
register cache:- codec drivers for example regmap usage.
/* IO control data and register cache */
void *control_data; /* codec control (i2c/3wire) data */
void *reg_cache;
Codec read/write should do any data formatting and call the hardware
read write below to perform the IO. These functions are called by the
core and ALSA when performing DAPM or changing the mixer:-
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
Codec hardware IO functions - usually points to either the I2C, SPI or AC97
read/write:-
hw_write_t hw_write;
hw_read_t hw_read;
3 - Mixers and audio controls 3 - Mixers and audio controls
...@@ -127,7 +111,7 @@ Defines a stereo enumerated control ...@@ -127,7 +111,7 @@ Defines a stereo enumerated control
4 - Codec Audio Operations 4 - Codec Audio Operations
-------------------------- --------------------------
The codec driver also supports the following ALSA operations:- The codec driver also supports the following ALSA PCM operations:-
/* SoC audio ops */ /* SoC audio ops */
struct snd_soc_ops { struct snd_soc_ops {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment