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