Lines Matching +full:dai +full:- +full:format
1 /* SPDX-License-Identifier: GPL-2.0
3 * linux/sound/soc-dai.h -- ALSA SoC Layer
5 * Copyright: 2005-2008 Wolfson Microelectronics. PLC.
7 * Digital Audio Interface (DAI) API.
22 * DAI hardware audio formats.
39 /* Describes the possible PCM format */
56 * DAI Clock gating.
58 * DAI bit clocks can be gated (disabled) when the DAI is not
64 /* Describes the possible PCM format */
66 * define GATED -> CONT. GATED will be selected if both are selected.
76 * DAI hardware signal polarity.
78 * Specifies whether the DAI can also support inverted clocks for the specified
79 * format.
82 * - "normal" polarity means signal is available at rising edge of BCLK
83 * - "inverted" polarity means signal is available at falling edge of BCLK
85 * FSYNC "normal" polarity depends on the frame format:
86 * - I2S: frame consists of left then right channel data. Left channel starts
88 * - Left/Right Justified: frame consists of left then right channel data.
91 * - DSP A/B: Frame starts with rising FSYNC edge.
92 * - AC97: Frame starts with rising FSYNC edge.
101 /* Describes the possible PCM format */
110 * DAI hardware clock providers/consumers
121 /* previous definitions kept for backwards-compatibility, do not use in new contributions */
133 /* Describes the possible PCM format */
171 int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
174 int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
177 int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
180 int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
184 u64 snd_soc_dai_get_fmt(const struct snd_soc_dai *dai, int priority);
185 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
187 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
190 int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
194 int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
197 int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
201 int snd_soc_dai_get_channel_map(const struct snd_soc_dai *dai,
205 int snd_soc_dai_is_dummy(const struct snd_soc_dai *dai);
207 int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
210 void snd_soc_dai_hw_free(struct snd_soc_dai *dai,
213 int snd_soc_dai_startup(struct snd_soc_dai *dai,
215 void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
217 void snd_soc_dai_suspend(struct snd_soc_dai *dai);
218 void snd_soc_dai_resume(struct snd_soc_dai *dai);
219 int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd);
220 bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream);
221 void snd_soc_dai_action(struct snd_soc_dai *dai,
223 static inline void snd_soc_dai_activate(struct snd_soc_dai *dai, in snd_soc_dai_activate() argument
226 snd_soc_dai_action(dai, stream, 1); in snd_soc_dai_activate()
228 static inline void snd_soc_dai_deactivate(struct snd_soc_dai *dai, in snd_soc_dai_deactivate() argument
231 snd_soc_dai_action(dai, stream, -1); in snd_soc_dai_deactivate()
233 int snd_soc_dai_active(const struct snd_soc_dai *dai);
244 int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
246 void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
249 int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
251 int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
254 int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai,
257 int snd_soc_dai_compr_ack(struct snd_soc_dai *dai,
260 int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai,
263 int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai,
266 int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai,
270 const char *snd_soc_dai_name_get(const struct snd_soc_dai *dai);
273 /* DAI driver callbacks */
274 int (*probe)(struct snd_soc_dai *dai);
275 int (*remove)(struct snd_soc_dai *dai);
276 /* compress dai */
280 struct snd_soc_dai *dai);
283 * DAI clocking configuration, all optional.
286 int (*set_sysclk)(struct snd_soc_dai *dai,
288 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
290 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
291 int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);
294 * DAI format configuration
297 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
300 int (*set_tdm_slot)(struct snd_soc_dai *dai,
303 int (*set_channel_map)(struct snd_soc_dai *dai,
306 int (*get_channel_map)(const struct snd_soc_dai *dai,
309 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
311 int (*set_stream)(struct snd_soc_dai *dai,
313 void *(*get_stream)(struct snd_soc_dai *dai, int direction);
316 * DAI digital mute - optional.
317 * Called by soc-core to minimise any pops.
319 int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);
322 * ALSA PCM audio operations - all optional.
323 * Called by soc-core during audio PCM operations.
337 * compatible with the current state of the dai. For example this
353 * Format list for auto selection.
354 * Format will be increased if priority format was
362 /* probe ordering - for components with runtime dependencies */
398 * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97
400 * structure for every DAI they have.
406 /* DAI description */
417 /* DAI capabilities */
432 void *dma_data; /* DAI DMA data */
438 * Holds runtime data for a DAI.
448 /* DAI runtime info */
451 /* Symmetry data - only valid if symmetry is being enforced */
472 snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream) in snd_soc_dai_get_pcm_stream() argument
475 &dai->driver->playback : &dai->driver->capture; in snd_soc_dai_get_pcm_stream()
478 #define snd_soc_dai_get_widget_playback(dai) snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_PLAYBACK) argument
479 #define snd_soc_dai_get_widget_capture(dai) snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_CAPTURE) argument
481 struct snd_soc_dapm_widget *snd_soc_dai_get_widget(struct snd_soc_dai *dai, int stream) in snd_soc_dai_get_widget() argument
483 return dai->stream[stream].widget; in snd_soc_dai_get_widget()
486 #define snd_soc_dai_set_widget_playback(dai, widget) snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_P… argument
487 #define snd_soc_dai_set_widget_capture(dai, widget) snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_C… argument
489 void snd_soc_dai_set_widget(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_widget *widget) in snd_soc_dai_set_widget() argument
491 dai->stream[stream].widget = widget; in snd_soc_dai_set_widget()
494 #define snd_soc_dai_dma_data_get_playback(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_PLAYB… argument
495 #define snd_soc_dai_dma_data_get_capture(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_CAPTUR… argument
496 #define snd_soc_dai_get_dma_data(dai, ss) snd_soc_dai_dma_data_get(dai, ss->stream) argument
497 static inline void *snd_soc_dai_dma_data_get(const struct snd_soc_dai *dai, int stream) in snd_soc_dai_dma_data_get() argument
499 return dai->stream[stream].dma_data; in snd_soc_dai_dma_data_get()
502 #define snd_soc_dai_dma_data_set_playback(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM… argument
503 #define snd_soc_dai_dma_data_set_capture(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM… argument
504 #define snd_soc_dai_set_dma_data(dai, ss, data) snd_soc_dai_dma_data_set(dai, ss->stream, data) argument
505 static inline void snd_soc_dai_dma_data_set(struct snd_soc_dai *dai, int stream, void *data) in snd_soc_dai_dma_data_set() argument
507 dai->stream[stream].dma_data = data; in snd_soc_dai_dma_data_set()
510 static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, void *playback, void *capture) in snd_soc_dai_init_dma_data() argument
512 snd_soc_dai_dma_data_set_playback(dai, playback); in snd_soc_dai_init_dma_data()
513 snd_soc_dai_dma_data_set_capture(dai, capture); in snd_soc_dai_init_dma_data()
516 static inline unsigned int snd_soc_dai_tdm_mask_get(const struct snd_soc_dai *dai, in snd_soc_dai_tdm_mask_get() argument
519 return dai->stream[stream].tdm_mask; in snd_soc_dai_tdm_mask_get()
522 static inline void snd_soc_dai_tdm_mask_set(struct snd_soc_dai *dai, int stream, in snd_soc_dai_tdm_mask_set() argument
525 dai->stream[stream].tdm_mask = tdm_mask; in snd_soc_dai_tdm_mask_set()
528 static inline unsigned int snd_soc_dai_stream_active(const struct snd_soc_dai *dai, in snd_soc_dai_stream_active() argument
532 return dai->stream[stream].active; in snd_soc_dai_stream_active()
535 static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai, in snd_soc_dai_set_drvdata() argument
538 dev_set_drvdata(dai->dev, data); in snd_soc_dai_set_drvdata()
541 static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) in snd_soc_dai_get_drvdata() argument
543 return dev_get_drvdata(dai->dev); in snd_soc_dai_get_drvdata()
547 * snd_soc_dai_set_stream() - Configures a DAI for stream operation
548 * @dai: DAI
549 * @stream: STREAM (opaque structure depending on DAI type)
558 static inline int snd_soc_dai_set_stream(struct snd_soc_dai *dai, in snd_soc_dai_set_stream() argument
561 if (dai->driver->ops->set_stream) in snd_soc_dai_set_stream()
562 return dai->driver->ops->set_stream(dai, stream, direction); in snd_soc_dai_set_stream()
564 return -ENOTSUPP; in snd_soc_dai_set_stream()
568 * snd_soc_dai_get_stream() - Retrieves stream from DAI
569 * @dai: DAI
576 * ERR_PTR(-ENOTSUPP) if callback is not supported;
578 static inline void *snd_soc_dai_get_stream(struct snd_soc_dai *dai, in snd_soc_dai_get_stream() argument
581 if (dai->driver->ops->get_stream) in snd_soc_dai_get_stream()
582 return dai->driver->ops->get_stream(dai, direction); in snd_soc_dai_get_stream()
584 return ERR_PTR(-ENOTSUPP); in snd_soc_dai_get_stream()