diff options
Diffstat (limited to 'Documentation/sound/alsa/soc/codec.txt')
-rw-r--r-- | Documentation/sound/alsa/soc/codec.txt | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/Documentation/sound/alsa/soc/codec.txt b/Documentation/sound/alsa/soc/codec.txt index 1e766ad0ebd1..1e95342ed72e 100644 --- a/Documentation/sound/alsa/soc/codec.txt +++ b/Documentation/sound/alsa/soc/codec.txt | |||
@@ -9,7 +9,7 @@ code should be added to the platform and machine drivers respectively. | |||
9 | Each codec driver *must* provide the following features:- | 9 | Each codec driver *must* provide the following features:- |
10 | 10 | ||
11 | 1) Codec DAI and PCM configuration | 11 | 1) Codec DAI and PCM configuration |
12 | 2) Codec control IO - using I2C, 3 Wire(SPI) or both API's | 12 | 2) Codec control IO - using I2C, 3 Wire(SPI) or both APIs |
13 | 3) Mixers and audio controls | 13 | 3) Mixers and audio controls |
14 | 4) Codec audio operations | 14 | 4) Codec audio operations |
15 | 15 | ||
@@ -19,7 +19,7 @@ Optionally, codec drivers can also provide:- | |||
19 | 6) DAPM event handler. | 19 | 6) DAPM event handler. |
20 | 7) DAC Digital mute control. | 20 | 7) DAC Digital mute control. |
21 | 21 | ||
22 | It's probably best to use this guide in conjunction with the existing codec | 22 | Its probably best to use this guide in conjunction with the existing codec |
23 | driver code in sound/soc/codecs/ | 23 | driver code in sound/soc/codecs/ |
24 | 24 | ||
25 | ASoC Codec driver breakdown | 25 | ASoC Codec driver breakdown |
@@ -27,8 +27,8 @@ ASoC Codec driver breakdown | |||
27 | 27 | ||
28 | 1 - Codec DAI and PCM configuration | 28 | 1 - Codec DAI and PCM configuration |
29 | ----------------------------------- | 29 | ----------------------------------- |
30 | Each codec driver must have a struct snd_soc_codec_dai to define it's DAI and | 30 | Each codec driver must have a struct snd_soc_codec_dai to define its DAI and |
31 | PCM's capabilities and operations. This struct is exported so that it can be | 31 | PCM capabilities and operations. This struct is exported so that it can be |
32 | registered with the core by your machine driver. | 32 | registered with the core by your machine driver. |
33 | 33 | ||
34 | e.g. | 34 | e.g. |
@@ -67,18 +67,18 @@ EXPORT_SYMBOL_GPL(wm8731_dai); | |||
67 | 67 | ||
68 | 2 - Codec control IO | 68 | 2 - Codec control IO |
69 | -------------------- | 69 | -------------------- |
70 | The codec can usually be controlled via an I2C or SPI style interface (AC97 | 70 | The codec can usually be controlled via an I2C or SPI style interface |
71 | combines control with data in the DAI). The codec drivers will have to provide | 71 | (AC97 combines control with data in the DAI). The codec drivers provide |
72 | functions to read and write the codec registers along with supplying a register | 72 | functions to read and write the codec registers along with supplying a |
73 | cache:- | 73 | register cache:- |
74 | 74 | ||
75 | /* IO control data and register cache */ | 75 | /* IO control data and register cache */ |
76 | void *control_data; /* codec control (i2c/3wire) data */ | 76 | void *control_data; /* codec control (i2c/3wire) data */ |
77 | void *reg_cache; | 77 | void *reg_cache; |
78 | 78 | ||
79 | Codec read/write should do any data formatting and call the hardware read write | 79 | Codec read/write should do any data formatting and call the hardware |
80 | below to perform the IO. These functions are called by the core and alsa when | 80 | read write below to perform the IO. These functions are called by the |
81 | performing DAPM or changing the mixer:- | 81 | core and ALSA when performing DAPM or changing the mixer:- |
82 | 82 | ||
83 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); | 83 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); |
84 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); | 84 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); |
@@ -131,7 +131,7 @@ Defines a stereo enumerated control | |||
131 | 131 | ||
132 | 4 - Codec Audio Operations | 132 | 4 - Codec Audio Operations |
133 | -------------------------- | 133 | -------------------------- |
134 | The codec driver also supports the following alsa operations:- | 134 | The codec driver also supports the following ALSA operations:- |
135 | 135 | ||
136 | /* SoC audio ops */ | 136 | /* SoC audio ops */ |
137 | struct snd_soc_ops { | 137 | struct snd_soc_ops { |
@@ -142,15 +142,15 @@ struct snd_soc_ops { | |||
142 | int (*prepare)(struct snd_pcm_substream *); | 142 | int (*prepare)(struct snd_pcm_substream *); |
143 | }; | 143 | }; |
144 | 144 | ||
145 | Please refer to the alsa driver PCM documentation for details. | 145 | Please refer to the ALSA driver PCM documentation for details. |
146 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm | 146 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm |
147 | 147 | ||
148 | 148 | ||
149 | 5 - DAPM description. | 149 | 5 - DAPM description. |
150 | --------------------- | 150 | --------------------- |
151 | The Dynamic Audio Power Management description describes the codec's power | 151 | The Dynamic Audio Power Management description describes the codec power |
152 | components, their relationships and registers to the ASoC core. Please read | 152 | components and their relationships and registers to the ASoC core. |
153 | dapm.txt for details of building the description. | 153 | Please read dapm.txt for details of building the description. |
154 | 154 | ||
155 | Please also see the examples in other codec drivers. | 155 | Please also see the examples in other codec drivers. |
156 | 156 | ||
@@ -158,8 +158,8 @@ Please also see the examples in other codec drivers. | |||
158 | 6 - DAPM event handler | 158 | 6 - DAPM event handler |
159 | ---------------------- | 159 | ---------------------- |
160 | This function is a callback that handles codec domain PM calls and system | 160 | This function is a callback that handles codec domain PM calls and system |
161 | domain PM calls (e.g. suspend and resume). It's used to put the codec to sleep | 161 | domain PM calls (e.g. suspend and resume). It is used to put the codec |
162 | when not in use. | 162 | to sleep when not in use. |
163 | 163 | ||
164 | Power states:- | 164 | Power states:- |
165 | 165 | ||
@@ -175,13 +175,14 @@ Power states:- | |||
175 | SNDRV_CTL_POWER_D3cold: /* Everything Off, without power */ | 175 | SNDRV_CTL_POWER_D3cold: /* Everything Off, without power */ |
176 | 176 | ||
177 | 177 | ||
178 | 7 - Codec DAC digital mute control. | 178 | 7 - Codec DAC digital mute control |
179 | ------------------------------------ | 179 | ---------------------------------- |
180 | Most codecs have a digital mute before the DAC's that can be used to minimise | 180 | Most codecs have a digital mute before the DACs that can be used to |
181 | any system noise. The mute stops any digital data from entering the DAC. | 181 | minimise any system noise. The mute stops any digital data from |
182 | entering the DAC. | ||
182 | 183 | ||
183 | A callback can be created that is called by the core for each codec DAI when the | 184 | A callback can be created that is called by the core for each codec DAI |
184 | mute is applied or freed. | 185 | when the mute is applied or freed. |
185 | 186 | ||
186 | i.e. | 187 | i.e. |
187 | 188 | ||