diff options
Diffstat (limited to 'include/sound/soc-dai.h')
-rw-r--r-- | include/sound/soc-dai.h | 102 |
1 files changed, 64 insertions, 38 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 377693a14385..1bafe95dcf41 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -16,8 +16,6 @@ | |||
16 | 16 | ||
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | 18 | ||
19 | #include <sound/soc.h> | ||
20 | |||
21 | struct snd_pcm_substream; | 19 | struct snd_pcm_substream; |
22 | 20 | ||
23 | /* | 21 | /* |
@@ -91,15 +89,17 @@ struct snd_pcm_substream; | |||
91 | SNDRV_PCM_FMTBIT_S32_LE |\ | 89 | SNDRV_PCM_FMTBIT_S32_LE |\ |
92 | SNDRV_PCM_FMTBIT_S32_BE) | 90 | SNDRV_PCM_FMTBIT_S32_BE) |
93 | 91 | ||
94 | struct snd_soc_dai_ops; | 92 | struct snd_soc_dai_driver; |
95 | struct snd_soc_dai; | 93 | struct snd_soc_dai; |
96 | struct snd_ac97_bus_ops; | 94 | struct snd_ac97_bus_ops; |
97 | 95 | ||
98 | /* Digital Audio Interface registration */ | 96 | /* Digital Audio Interface registration */ |
99 | int snd_soc_register_dai(struct snd_soc_dai *dai); | 97 | int snd_soc_register_dai(struct device *dev, |
100 | void snd_soc_unregister_dai(struct snd_soc_dai *dai); | 98 | struct snd_soc_dai_driver *dai_drv); |
101 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count); | 99 | void snd_soc_unregister_dai(struct device *dev); |
102 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count); | 100 | int snd_soc_register_dais(struct device *dev, |
101 | struct snd_soc_dai_driver *dai_drv, size_t count); | ||
102 | void snd_soc_unregister_dais(struct device *dev, size_t count); | ||
103 | 103 | ||
104 | /* Digital Audio Interface clocking API.*/ | 104 | /* Digital Audio Interface clocking API.*/ |
105 | int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, | 105 | int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
@@ -126,16 +126,6 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); | |||
126 | /* Digital Audio Interface mute */ | 126 | /* Digital Audio Interface mute */ |
127 | int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); | 127 | int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); |
128 | 128 | ||
129 | /* | ||
130 | * Digital Audio Interface. | ||
131 | * | ||
132 | * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97 | ||
133 | * operations and capabilities. Codec and platform drivers will register this | ||
134 | * structure for every DAI they have. | ||
135 | * | ||
136 | * This structure covers the clocking, formating and ALSA operations for each | ||
137 | * interface. | ||
138 | */ | ||
139 | struct snd_soc_dai_ops { | 129 | struct snd_soc_dai_ops { |
140 | /* | 130 | /* |
141 | * DAI clocking configuration, all optional. | 131 | * DAI clocking configuration, all optional. |
@@ -191,54 +181,79 @@ struct snd_soc_dai_ops { | |||
191 | }; | 181 | }; |
192 | 182 | ||
193 | /* | 183 | /* |
194 | * Digital Audio Interface runtime data. | 184 | * Digital Audio Interface Driver. |
195 | * | 185 | * |
196 | * Holds runtime data for a DAI. | 186 | * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97 |
187 | * operations and capabilities. Codec and platform drivers will register this | ||
188 | * structure for every DAI they have. | ||
189 | * | ||
190 | * This structure covers the clocking, formating and ALSA operations for each | ||
191 | * interface. | ||
197 | */ | 192 | */ |
198 | struct snd_soc_dai { | 193 | struct snd_soc_dai_driver { |
199 | /* DAI description */ | 194 | /* DAI description */ |
200 | char *name; | 195 | const char *name; |
201 | unsigned int id; | 196 | unsigned int id; |
202 | int ac97_control; | 197 | int ac97_control; |
203 | 198 | ||
204 | struct device *dev; | 199 | /* DAI driver callbacks */ |
205 | void *ac97_pdata; /* platform_data for the ac97 codec */ | 200 | int (*probe)(struct snd_soc_dai *dai); |
206 | 201 | int (*remove)(struct snd_soc_dai *dai); | |
207 | /* DAI callbacks */ | ||
208 | int (*probe)(struct platform_device *pdev, | ||
209 | struct snd_soc_dai *dai); | ||
210 | void (*remove)(struct platform_device *pdev, | ||
211 | struct snd_soc_dai *dai); | ||
212 | int (*suspend)(struct snd_soc_dai *dai); | 202 | int (*suspend)(struct snd_soc_dai *dai); |
213 | int (*resume)(struct snd_soc_dai *dai); | 203 | int (*resume)(struct snd_soc_dai *dai); |
214 | 204 | ||
215 | /* ops */ | 205 | /* ops */ |
216 | struct snd_soc_dai_ops *ops; | 206 | const struct snd_soc_dai_ops *ops; |
217 | 207 | ||
218 | /* DAI capabilities */ | 208 | /* DAI capabilities */ |
219 | struct snd_soc_pcm_stream capture; | 209 | struct snd_soc_pcm_stream capture; |
220 | struct snd_soc_pcm_stream playback; | 210 | struct snd_soc_pcm_stream playback; |
221 | unsigned int symmetric_rates:1; | 211 | unsigned int symmetric_rates:1; |
212 | }; | ||
213 | |||
214 | /* | ||
215 | * Digital Audio Interface runtime data. | ||
216 | * | ||
217 | * Holds runtime data for a DAI. | ||
218 | */ | ||
219 | struct snd_soc_dai { | ||
220 | const char *name; | ||
221 | int id; | ||
222 | struct device *dev; | ||
223 | void *ac97_pdata; /* platform_data for the ac97 codec */ | ||
224 | |||
225 | /* driver ops */ | ||
226 | struct snd_soc_dai_driver *driver; | ||
222 | 227 | ||
223 | /* DAI runtime info */ | 228 | /* DAI runtime info */ |
224 | struct snd_soc_codec *codec; | 229 | unsigned int capture_active:1; /* stream is in use */ |
230 | unsigned int playback_active:1; /* stream is in use */ | ||
231 | unsigned int symmetric_rates:1; | ||
232 | struct snd_pcm_runtime *runtime; | ||
225 | unsigned int active; | 233 | unsigned int active; |
226 | unsigned char pop_wait:1; | 234 | unsigned char pop_wait:1; |
235 | unsigned char probed:1; | ||
227 | 236 | ||
228 | /* DAI private data */ | 237 | /* DAI DMA data */ |
229 | void *private_data; | 238 | void *playback_dma_data; |
239 | void *capture_dma_data; | ||
230 | 240 | ||
231 | /* parent platform */ | 241 | /* parent platform/codec */ |
232 | struct snd_soc_platform *platform; | 242 | union { |
243 | struct snd_soc_platform *platform; | ||
244 | struct snd_soc_codec *codec; | ||
245 | }; | ||
246 | struct snd_soc_card *card; | ||
233 | 247 | ||
234 | struct list_head list; | 248 | struct list_head list; |
249 | struct list_head card_list; | ||
235 | }; | 250 | }; |
236 | 251 | ||
237 | static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, | 252 | static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, |
238 | const struct snd_pcm_substream *ss) | 253 | const struct snd_pcm_substream *ss) |
239 | { | 254 | { |
240 | return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | 255 | return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
241 | dai->playback.dma_data : dai->capture.dma_data; | 256 | dai->playback_dma_data : dai->capture_dma_data; |
242 | } | 257 | } |
243 | 258 | ||
244 | static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai, | 259 | static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai, |
@@ -246,9 +261,20 @@ static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai, | |||
246 | void *data) | 261 | void *data) |
247 | { | 262 | { |
248 | if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) | 263 | if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) |
249 | dai->playback.dma_data = data; | 264 | dai->playback_dma_data = data; |
250 | else | 265 | else |
251 | dai->capture.dma_data = data; | 266 | dai->capture_dma_data = data; |
267 | } | ||
268 | |||
269 | static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai, | ||
270 | void *data) | ||
271 | { | ||
272 | dev_set_drvdata(dai->dev, data); | ||
273 | } | ||
274 | |||
275 | static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) | ||
276 | { | ||
277 | return dev_get_drvdata(dai->dev); | ||
252 | } | 278 | } |
253 | 279 | ||
254 | #endif | 280 | #endif |