Lines Matching +full:rx +full:- +full:slots
1 // SPDX-License-Identifier: GPL-2.0
3 // soc-dai.c
10 #include <sound/soc-dai.h>
11 #include <sound/soc-link.h>
23 case -EPROBE_DEFER:
24 case -ENOTSUPP:
27 dev_err(dai->dev,
29 func, dai->name, ret);
39 #define soc_dai_mark_push(dai, substream, tgt) ((dai)->mark_##tgt = substream)
40 #define soc_dai_mark_pop(dai, tgt) ((dai)->mark_##tgt = NULL)
41 #define soc_dai_mark_match(dai, substream, tgt) ((dai)->mark_##tgt == substream)
44 * snd_soc_dai_set_sysclk - configure DAI system or master clock.
57 if (dai->driver->ops &&
58 dai->driver->ops->set_sysclk)
59 ret = dai->driver->ops->set_sysclk(dai, clk_id, freq, dir);
61 ret = snd_soc_component_set_sysclk(dai->component, clk_id, 0,
69 * snd_soc_dai_set_clkdiv - configure DAI clock dividers.
81 int ret = -EINVAL;
83 if (dai->driver->ops &&
84 dai->driver->ops->set_clkdiv)
85 ret = dai->driver->ops->set_clkdiv(dai, div_id, div);
92 * snd_soc_dai_set_pll - configure DAI PLL.
106 if (dai->driver->ops &&
107 dai->driver->ops->set_pll)
108 ret = dai->driver->ops->set_pll(dai, pll_id, source,
111 ret = snd_soc_component_set_pll(dai->component, pll_id, source,
119 * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio.
127 int ret = -ENOTSUPP;
129 if (dai->driver->ops &&
130 dai->driver->ops->set_bclk_ratio)
131 ret = dai->driver->ops->set_bclk_ratio(dai, ratio);
146 if (dai->driver->ops &&
147 dai->driver->ops->num_auto_selectable_formats)
148 max = max(max, dai->driver->ops->num_auto_selectable_formats);
157 * snd_soc_dai_get_fmt - get supported audio format.
171 const struct snd_soc_dai_ops *ops = dai->driver->ops;
189 max = ops->num_auto_selectable_formats;
195 fmt |= ops->auto_selectable_formats[i];
201 * snd_soc_dai_set_fmt - configure DAI hardware audio format.
209 int ret = -ENOTSUPP;
211 if (dai->driver->ops && dai->driver->ops->set_fmt)
212 ret = dai->driver->ops->set_fmt(dai, fmt);
219 * snd_soc_xlate_tdm_slot_mask - generate tx/rx slot mask.
220 * @slots: Number of slots in use.
221 * @tx_mask: bitmask representing active TX slots.
222 * @rx_mask: bitmask representing active RX slots.
224 * Generates the TDM tx and rx slot default masks for DAI.
226 static int snd_soc_xlate_tdm_slot_mask(unsigned int slots,
233 if (!slots)
234 return -EINVAL;
236 *tx_mask = (1 << slots) - 1;
237 *rx_mask = (1 << slots) - 1;
243 * snd_soc_dai_set_tdm_slot() - Configures a DAI for TDM operation
245 * @tx_mask: bitmask representing active TX slots.
246 * @rx_mask: bitmask representing active RX slots.
247 * @slots: Number of slots in use.
251 * the total number of slots of the TDM stream and @slot_with the width of each
253 * active slots of the TDM stream for the specified DAI, i.e. which slots the
260 * TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask,
267 int slots, int slot_width)
269 int ret = -ENOTSUPP;
276 if (dai->driver->ops &&
277 dai->driver->ops->xlate_tdm_slot_mask)
278 dai->driver->ops->xlate_tdm_slot_mask(slots,
281 snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
286 if (dai->driver->ops &&
287 dai->driver->ops->set_tdm_slot)
288 ret = dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
289 slots, slot_width);
295 * snd_soc_dai_set_channel_map - configure DAI audio channel map
299 * 0~num-1 uses
300 * @rx_num: how many RX channels
301 * @rx_slot: pointer to an array which imply the RX slot number channel
302 * 0~num-1 uses
310 int ret = -ENOTSUPP;
312 if (dai->driver->ops &&
313 dai->driver->ops->set_channel_map)
314 ret = dai->driver->ops->set_channel_map(dai, tx_num, tx_slot,
321 * snd_soc_dai_get_channel_map - Get DAI audio channel map
325 * 0~num-1 uses
326 * @rx_num: how many RX channels
327 * @rx_slot: pointer to an array which imply the RX slot number channel
328 * 0~num-1 uses
334 int ret = -ENOTSUPP;
336 if (dai->driver->ops &&
337 dai->driver->ops->get_channel_map)
338 ret = dai->driver->ops->get_channel_map(dai, tx_num, tx_slot,
345 * snd_soc_dai_set_tristate - configure DAI system or master clock.
353 int ret = -EINVAL;
355 if (dai->driver->ops &&
356 dai->driver->ops->set_tristate)
357 ret = dai->driver->ops->set_tristate(dai, tristate);
368 if (!snd_soc_dai_stream_valid(dai, substream->stream))
371 if (dai->driver->ops &&
372 dai->driver->ops->prepare)
373 ret = dai->driver->ops->prepare(substream, dai);
380 * snd_soc_dai_digital_mute - configure DAI system or master clock.
390 int ret = -ENOTSUPP;
396 if (dai->driver->ops &&
397 dai->driver->ops->mute_stream &&
399 !dai->driver->ops->no_capture_mute))
400 ret = dai->driver->ops->mute_stream(dai, mute, direction);
412 if (dai->driver->ops &&
413 dai->driver->ops->hw_params)
414 ret = dai->driver->ops->hw_params(substream, params, dai);
430 if (dai->driver->ops &&
431 dai->driver->ops->hw_free)
432 dai->driver->ops->hw_free(substream, dai);
443 if (!snd_soc_dai_stream_valid(dai, substream->stream))
446 if (dai->driver->ops &&
447 dai->driver->ops->startup)
448 ret = dai->driver->ops->startup(substream, dai);
461 if (!snd_soc_dai_stream_valid(dai, substream->stream))
467 if (dai->driver->ops &&
468 dai->driver->ops->shutdown)
469 dai->driver->ops->shutdown(substream, dai);
478 int ret = -ENOTSUPP;
479 if (dai->driver->ops &&
480 dai->driver->ops->compress_new)
481 ret = dai->driver->ops->compress_new(rtd);
486 * snd_soc_dai_stream_valid() - check if a DAI supports the given stream
495 return stream->channels_min;
502 dai->stream[stream].active += action;
505 dai->component->active += action;
515 active += dai->stream[stream].active;
527 if (dai->probed)
530 if (dai->driver->ops) {
531 if (dai->driver->ops->probe_order != order)
534 if (dai->driver->ops->probe) {
535 int ret = dai->driver->ops->probe(dai);
541 dai->probed = 1;
553 if (!dai->probed)
556 if (dai->driver->ops) {
557 if (dai->driver->ops->remove_order != order)
560 if (dai->driver->ops->remove) {
561 r = dai->driver->ops->remove(dai);
566 dai->probed = 0;
578 if (dai->driver->ops &&
579 dai->driver->ops->pcm_new) {
580 int ret = dai->driver->ops->pcm_new(rtd, dai);
609 if (!snd_soc_dai_stream_valid(dai, substream->stream))
612 if (dai->driver->ops &&
613 dai->driver->ops->trigger)
614 ret = dai->driver->ops->trigger(substream, cmd, dai);
635 if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
636 snd_soc_dai_digital_mute(dai, 0, substream->stream);
648 if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
649 snd_soc_dai_digital_mute(dai, 1, substream->stream);
678 if (dai->driver->ops &&
679 dai->driver->ops->delay)
680 *cpu_delay = max(*cpu_delay, dai->driver->ops->delay(substream, dai));
684 if (dai->driver->ops &&
685 dai->driver->ops->delay)
686 *codec_delay = max(*codec_delay, dai->driver->ops->delay(substream, dai));
694 if (dai->driver->cops &&
695 dai->driver->cops->startup)
696 ret = dai->driver->cops->startup(cstream, dai);
713 if (dai->driver->cops &&
714 dai->driver->cops->shutdown)
715 dai->driver->cops->shutdown(cstream, dai);
727 if (dai->driver->cops &&
728 dai->driver->cops->trigger)
729 ret = dai->driver->cops->trigger(cstream, cmd, dai);
741 if (dai->driver->cops &&
742 dai->driver->cops->set_params)
743 ret = dai->driver->cops->set_params(cstream, params, dai);
755 if (dai->driver->cops &&
756 dai->driver->cops->get_params)
757 ret = dai->driver->cops->get_params(cstream, params, dai);
769 if (dai->driver->cops &&
770 dai->driver->cops->ack)
771 ret = dai->driver->cops->ack(cstream, bytes, dai);
783 if (dai->driver->cops &&
784 dai->driver->cops->pointer)
785 ret = dai->driver->cops->pointer(cstream, tstamp, dai);
797 if (dai->driver->cops &&
798 dai->driver->cops->set_metadata)
799 ret = dai->driver->cops->set_metadata(cstream, metadata, dai);
811 if (dai->driver->cops &&
812 dai->driver->cops->get_metadata)
813 ret = dai->driver->cops->get_metadata(cstream, metadata, dai);