.. | .. |
---|
39 | 39 | /* |
---|
40 | 40 | * DAI Clock gating. |
---|
41 | 41 | * |
---|
42 | | - * DAI bit clocks can be be gated (disabled) when the DAI is not |
---|
| 42 | + * DAI bit clocks can be gated (disabled) when the DAI is not |
---|
43 | 43 | * sending or receiving PCM data in a frame. This can be used to save power. |
---|
44 | 44 | */ |
---|
45 | 45 | #define SND_SOC_DAIFMT_CONT (1 << 4) /* continuous clock */ |
---|
.. | .. |
---|
76 | 76 | * |
---|
77 | 77 | * This is wrt the codec, the inverse is true for the interface |
---|
78 | 78 | * i.e. if the codec is clk and FRM master then the interface is |
---|
79 | | - * clk and frame slave. |
---|
| 79 | + * clk and frame secondary. |
---|
80 | 80 | */ |
---|
81 | 81 | #define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */ |
---|
82 | | -#define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */ |
---|
83 | | -#define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */ |
---|
84 | | -#define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */ |
---|
| 82 | +#define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk secondary & FRM master */ |
---|
| 83 | +#define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame secondary */ |
---|
| 84 | +#define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM secondary */ |
---|
85 | 85 | |
---|
86 | 86 | #define SND_SOC_DAIFMT_FORMAT_MASK 0x000f |
---|
87 | 87 | #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0 |
---|
.. | .. |
---|
145 | 145 | |
---|
146 | 146 | int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); |
---|
147 | 147 | |
---|
| 148 | +int snd_soc_dai_hw_params(struct snd_soc_dai *dai, |
---|
| 149 | + struct snd_pcm_substream *substream, |
---|
| 150 | + struct snd_pcm_hw_params *params); |
---|
| 151 | +void snd_soc_dai_hw_free(struct snd_soc_dai *dai, |
---|
| 152 | + struct snd_pcm_substream *substream); |
---|
| 153 | +int snd_soc_dai_startup(struct snd_soc_dai *dai, |
---|
| 154 | + struct snd_pcm_substream *substream); |
---|
| 155 | +void snd_soc_dai_shutdown(struct snd_soc_dai *dai, |
---|
| 156 | + struct snd_pcm_substream *substream, int rollback); |
---|
| 157 | +snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, |
---|
| 158 | + struct snd_pcm_substream *substream); |
---|
| 159 | +void snd_soc_dai_suspend(struct snd_soc_dai *dai); |
---|
| 160 | +void snd_soc_dai_resume(struct snd_soc_dai *dai); |
---|
| 161 | +int snd_soc_dai_compress_new(struct snd_soc_dai *dai, |
---|
| 162 | + struct snd_soc_pcm_runtime *rtd, int num); |
---|
| 163 | +bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); |
---|
| 164 | +void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link); |
---|
| 165 | +void snd_soc_dai_action(struct snd_soc_dai *dai, |
---|
| 166 | + int stream, int action); |
---|
| 167 | +static inline void snd_soc_dai_activate(struct snd_soc_dai *dai, |
---|
| 168 | + int stream) |
---|
| 169 | +{ |
---|
| 170 | + snd_soc_dai_action(dai, stream, 1); |
---|
| 171 | +} |
---|
| 172 | +static inline void snd_soc_dai_deactivate(struct snd_soc_dai *dai, |
---|
| 173 | + int stream) |
---|
| 174 | +{ |
---|
| 175 | + snd_soc_dai_action(dai, stream, -1); |
---|
| 176 | +} |
---|
| 177 | +int snd_soc_dai_active(struct snd_soc_dai *dai); |
---|
| 178 | + |
---|
| 179 | +int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order); |
---|
| 180 | +int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order); |
---|
| 181 | +int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd); |
---|
| 182 | +int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream); |
---|
| 183 | +int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd); |
---|
| 184 | +int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream, |
---|
| 185 | + int cmd); |
---|
| 186 | + |
---|
| 187 | +int snd_soc_dai_compr_startup(struct snd_soc_dai *dai, |
---|
| 188 | + struct snd_compr_stream *cstream); |
---|
| 189 | +void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai, |
---|
| 190 | + struct snd_compr_stream *cstream); |
---|
| 191 | +int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai, |
---|
| 192 | + struct snd_compr_stream *cstream, int cmd); |
---|
| 193 | +int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai, |
---|
| 194 | + struct snd_compr_stream *cstream, |
---|
| 195 | + struct snd_compr_params *params); |
---|
| 196 | +int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai, |
---|
| 197 | + struct snd_compr_stream *cstream, |
---|
| 198 | + struct snd_codec *params); |
---|
| 199 | +int snd_soc_dai_compr_ack(struct snd_soc_dai *dai, |
---|
| 200 | + struct snd_compr_stream *cstream, |
---|
| 201 | + size_t bytes); |
---|
| 202 | +int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai, |
---|
| 203 | + struct snd_compr_stream *cstream, |
---|
| 204 | + struct snd_compr_tstamp *tstamp); |
---|
| 205 | +int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai, |
---|
| 206 | + struct snd_compr_stream *cstream, |
---|
| 207 | + struct snd_compr_metadata *metadata); |
---|
| 208 | +int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai, |
---|
| 209 | + struct snd_compr_stream *cstream, |
---|
| 210 | + struct snd_compr_metadata *metadata); |
---|
| 211 | + |
---|
148 | 212 | struct snd_soc_dai_ops { |
---|
149 | 213 | /* |
---|
150 | 214 | * DAI clocking configuration, all optional. |
---|
.. | .. |
---|
177 | 241 | |
---|
178 | 242 | int (*set_sdw_stream)(struct snd_soc_dai *dai, |
---|
179 | 243 | void *stream, int direction); |
---|
| 244 | + void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); |
---|
| 245 | + |
---|
180 | 246 | /* |
---|
181 | 247 | * DAI digital mute - optional. |
---|
182 | 248 | * Called by soc-core to minimise any pops. |
---|
183 | 249 | */ |
---|
184 | | - int (*digital_mute)(struct snd_soc_dai *dai, int mute); |
---|
185 | 250 | int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream); |
---|
186 | 251 | |
---|
187 | 252 | /* |
---|
.. | .. |
---|
215 | 280 | */ |
---|
216 | 281 | snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, |
---|
217 | 282 | struct snd_soc_dai *); |
---|
| 283 | + |
---|
| 284 | + /* bit field */ |
---|
| 285 | + unsigned int no_capture_mute:1; |
---|
218 | 286 | }; |
---|
219 | 287 | |
---|
220 | 288 | struct snd_soc_cdai_ops { |
---|
.. | .. |
---|
261 | 329 | /* DAI driver callbacks */ |
---|
262 | 330 | int (*probe)(struct snd_soc_dai *dai); |
---|
263 | 331 | int (*remove)(struct snd_soc_dai *dai); |
---|
264 | | - int (*suspend)(struct snd_soc_dai *dai); |
---|
265 | | - int (*resume)(struct snd_soc_dai *dai); |
---|
266 | 332 | /* compress dai */ |
---|
267 | 333 | int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num); |
---|
268 | 334 | /* Optional Callback used at pcm creation*/ |
---|
269 | 335 | int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, |
---|
270 | 336 | struct snd_soc_dai *dai); |
---|
271 | | - /* DAI is also used for the control bus */ |
---|
272 | | - bool bus_control; |
---|
273 | 337 | |
---|
274 | 338 | /* ops */ |
---|
275 | 339 | const struct snd_soc_dai_ops *ops; |
---|
.. | .. |
---|
301 | 365 | struct snd_soc_dai_driver *driver; |
---|
302 | 366 | |
---|
303 | 367 | /* DAI runtime info */ |
---|
304 | | - unsigned int capture_active; /* stream usage count */ |
---|
305 | | - unsigned int playback_active; /* stream usage count */ |
---|
306 | | - unsigned int probed:1; |
---|
307 | | - |
---|
308 | | - unsigned int active; |
---|
| 368 | + unsigned int stream_active[SNDRV_PCM_STREAM_LAST + 1]; /* usage count */ |
---|
309 | 369 | |
---|
310 | 370 | struct snd_soc_dapm_widget *playback_widget; |
---|
311 | 371 | struct snd_soc_dapm_widget *capture_widget; |
---|
.. | .. |
---|
327 | 387 | unsigned int rx_mask; |
---|
328 | 388 | |
---|
329 | 389 | struct list_head list; |
---|
| 390 | + |
---|
| 391 | + /* function mark */ |
---|
| 392 | + struct snd_pcm_substream *mark_startup; |
---|
| 393 | + |
---|
| 394 | + /* bit field */ |
---|
| 395 | + unsigned int probed:1; |
---|
330 | 396 | }; |
---|
| 397 | + |
---|
| 398 | +static inline struct snd_soc_pcm_stream * |
---|
| 399 | +snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream) |
---|
| 400 | +{ |
---|
| 401 | + return (stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
---|
| 402 | + &dai->driver->playback : &dai->driver->capture; |
---|
| 403 | +} |
---|
| 404 | + |
---|
| 405 | +static inline |
---|
| 406 | +struct snd_soc_dapm_widget *snd_soc_dai_get_widget( |
---|
| 407 | + struct snd_soc_dai *dai, int stream) |
---|
| 408 | +{ |
---|
| 409 | + return (stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
---|
| 410 | + dai->playback_widget : dai->capture_widget; |
---|
| 411 | +} |
---|
331 | 412 | |
---|
332 | 413 | static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, |
---|
333 | 414 | const struct snd_pcm_substream *ss) |
---|
.. | .. |
---|
385 | 466 | return -ENOTSUPP; |
---|
386 | 467 | } |
---|
387 | 468 | |
---|
| 469 | +/** |
---|
| 470 | + * snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI |
---|
| 471 | + * @dai: DAI |
---|
| 472 | + * @direction: Stream direction(Playback/Capture) |
---|
| 473 | + * |
---|
| 474 | + * This routine only retrieves that was previously configured |
---|
| 475 | + * with snd_soc_dai_get_sdw_stream() |
---|
| 476 | + * |
---|
| 477 | + * Returns pointer to stream or an ERR_PTR value, e.g. |
---|
| 478 | + * ERR_PTR(-ENOTSUPP) if callback is not supported; |
---|
| 479 | + */ |
---|
| 480 | +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, |
---|
| 481 | + int direction) |
---|
| 482 | +{ |
---|
| 483 | + if (dai->driver->ops->get_sdw_stream) |
---|
| 484 | + return dai->driver->ops->get_sdw_stream(dai, direction); |
---|
| 485 | + else |
---|
| 486 | + return ERR_PTR(-ENOTSUPP); |
---|
| 487 | +} |
---|
| 488 | + |
---|
| 489 | +static inline unsigned int |
---|
| 490 | +snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream) |
---|
| 491 | +{ |
---|
| 492 | + return dai->stream_active[stream]; |
---|
| 493 | +} |
---|
| 494 | + |
---|
388 | 495 | #endif |
---|