1e2cfd2c9SKuninori Morimoto /* SPDX-License-Identifier: GPL-2.0
2e2cfd2c9SKuninori Morimoto *
3a47cbe72SMark Brown * linux/sound/soc-dai.h -- ALSA SoC Layer
4a47cbe72SMark Brown *
5a47cbe72SMark Brown * Copyright: 2005-2008 Wolfson Microelectronics. PLC.
6a47cbe72SMark Brown *
7a47cbe72SMark Brown * Digital Audio Interface (DAI) API.
8a47cbe72SMark Brown */
9a47cbe72SMark Brown
10a47cbe72SMark Brown #ifndef __LINUX_SND_SOC_DAI_H
11a47cbe72SMark Brown #define __LINUX_SND_SOC_DAI_H
12a47cbe72SMark Brown
13a47cbe72SMark Brown
14a47cbe72SMark Brown #include <linux/list.h>
15d2e3cb85SMengdong Lin #include <sound/asoc.h>
16a47cbe72SMark Brown
17a47cbe72SMark Brown struct snd_pcm_substream;
18888df395SMark Brown struct snd_soc_dapm_widget;
1949681077SVinod Koul struct snd_compr_stream;
20a47cbe72SMark Brown
21a47cbe72SMark Brown /*
22a47cbe72SMark Brown * DAI hardware audio formats.
23a47cbe72SMark Brown *
24a47cbe72SMark Brown * Describes the physical PCM data formating and clocking. Add new formats
25a47cbe72SMark Brown * to the end.
26a47cbe72SMark Brown */
27d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_I2S SND_SOC_DAI_FORMAT_I2S
28d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_RIGHT_J SND_SOC_DAI_FORMAT_RIGHT_J
29d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_LEFT_J SND_SOC_DAI_FORMAT_LEFT_J
30d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_DSP_A SND_SOC_DAI_FORMAT_DSP_A
31d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_DSP_B SND_SOC_DAI_FORMAT_DSP_B
32d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_AC97 SND_SOC_DAI_FORMAT_AC97
33d2e3cb85SMengdong Lin #define SND_SOC_DAIFMT_PDM SND_SOC_DAI_FORMAT_PDM
34a47cbe72SMark Brown
35a47cbe72SMark Brown /* left and right justified also known as MSB and LSB respectively */
36a47cbe72SMark Brown #define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
37a47cbe72SMark Brown #define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
38a47cbe72SMark Brown
39ba9e82a1SKuninori Morimoto /* Describes the possible PCM format */
40ba9e82a1SKuninori Morimoto /*
41ba9e82a1SKuninori Morimoto * use SND_SOC_DAI_FORMAT_xx as eash shift.
42ba9e82a1SKuninori Morimoto * see
43ba9e82a1SKuninori Morimoto * snd_soc_runtime_get_dai_fmt()
44ba9e82a1SKuninori Morimoto */
45ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_FORMAT_SHIFT 0
46ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_FORMAT_MASK (0xFFFF << SND_SOC_POSSIBLE_DAIFMT_FORMAT_SHIFT)
47ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_I2S (1 << SND_SOC_DAI_FORMAT_I2S)
48ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_RIGHT_J (1 << SND_SOC_DAI_FORMAT_RIGHT_J)
49ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_LEFT_J (1 << SND_SOC_DAI_FORMAT_LEFT_J)
50ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_DSP_A (1 << SND_SOC_DAI_FORMAT_DSP_A)
51ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_DSP_B (1 << SND_SOC_DAI_FORMAT_DSP_B)
52ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_AC97 (1 << SND_SOC_DAI_FORMAT_AC97)
53ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_PDM (1 << SND_SOC_DAI_FORMAT_PDM)
54ba9e82a1SKuninori Morimoto
55a47cbe72SMark Brown /*
56a47cbe72SMark Brown * DAI Clock gating.
57a47cbe72SMark Brown *
58fc926a7cSRandy Dunlap * DAI bit clocks can be gated (disabled) when the DAI is not
59a47cbe72SMark Brown * sending or receiving PCM data in a frame. This can be used to save power.
60a47cbe72SMark Brown */
6175d9ac46SMark Brown #define SND_SOC_DAIFMT_CONT (1 << 4) /* continuous clock */
62eef28e10SKuninori Morimoto #define SND_SOC_DAIFMT_GATED (0 << 4) /* clock is gated */
63a47cbe72SMark Brown
64ba9e82a1SKuninori Morimoto /* Describes the possible PCM format */
65ba9e82a1SKuninori Morimoto /*
66ba9e82a1SKuninori Morimoto * define GATED -> CONT. GATED will be selected if both are selected.
67ba9e82a1SKuninori Morimoto * see
68ba9e82a1SKuninori Morimoto * snd_soc_runtime_get_dai_fmt()
69ba9e82a1SKuninori Morimoto */
70ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CLOCK_SHIFT 16
71ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CLOCK_MASK (0xFFFF << SND_SOC_POSSIBLE_DAIFMT_CLOCK_SHIFT)
72ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_GATED (0x1ULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_SHIFT)
73ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CONT (0x2ULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_SHIFT)
74ba9e82a1SKuninori Morimoto
75a47cbe72SMark Brown /*
761d387a3fSAnatol Pomozov * DAI hardware signal polarity.
77a47cbe72SMark Brown *
78a47cbe72SMark Brown * Specifies whether the DAI can also support inverted clocks for the specified
79a47cbe72SMark Brown * format.
801d387a3fSAnatol Pomozov *
811d387a3fSAnatol Pomozov * BCLK:
821d387a3fSAnatol Pomozov * - "normal" polarity means signal is available at rising edge of BCLK
831d387a3fSAnatol Pomozov * - "inverted" polarity means signal is available at falling edge of BCLK
841d387a3fSAnatol Pomozov *
851d387a3fSAnatol Pomozov * FSYNC "normal" polarity depends on the frame format:
861d387a3fSAnatol Pomozov * - I2S: frame consists of left then right channel data. Left channel starts
871d387a3fSAnatol Pomozov * with falling FSYNC edge, right channel starts with rising FSYNC edge.
881d387a3fSAnatol Pomozov * - Left/Right Justified: frame consists of left then right channel data.
891d387a3fSAnatol Pomozov * Left channel starts with rising FSYNC edge, right channel starts with
901d387a3fSAnatol Pomozov * falling FSYNC edge.
911d387a3fSAnatol Pomozov * - DSP A/B: Frame starts with rising FSYNC edge.
921d387a3fSAnatol Pomozov * - AC97: Frame starts with rising FSYNC edge.
931d387a3fSAnatol Pomozov *
941d387a3fSAnatol Pomozov * "Negative" FSYNC polarity is the one opposite of "normal" polarity.
95a47cbe72SMark Brown */
965d163336SKuninori Morimoto #define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
9775d9ac46SMark Brown #define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */
9875d9ac46SMark Brown #define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */
9975d9ac46SMark Brown #define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */
100a47cbe72SMark Brown
101ba9e82a1SKuninori Morimoto /* Describes the possible PCM format */
102ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_INV_SHIFT 32
103ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_INV_MASK (0xFFFFULL << SND_SOC_POSSIBLE_DAIFMT_INV_SHIFT)
104ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_NB_NF (0x1ULL << SND_SOC_POSSIBLE_DAIFMT_INV_SHIFT)
105ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_NB_IF (0x2ULL << SND_SOC_POSSIBLE_DAIFMT_INV_SHIFT)
106ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_IB_NF (0x4ULL << SND_SOC_POSSIBLE_DAIFMT_INV_SHIFT)
107ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_IB_IF (0x8ULL << SND_SOC_POSSIBLE_DAIFMT_INV_SHIFT)
108ba9e82a1SKuninori Morimoto
109a47cbe72SMark Brown /*
110f026c123SPierre-Louis Bossart * DAI hardware clock providers/consumers
111a47cbe72SMark Brown *
112a47cbe72SMark Brown * This is wrt the codec, the inverse is true for the interface
113f026c123SPierre-Louis Bossart * i.e. if the codec is clk and FRM provider then the interface is
114f026c123SPierre-Louis Bossart * clk and frame consumer.
115a47cbe72SMark Brown */
116f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBP_CFP (1 << 12) /* codec clk provider & frame provider */
117f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBC_CFP (2 << 12) /* codec clk consumer & frame provider */
118f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBP_CFC (3 << 12) /* codec clk provider & frame consumer */
11947c11316SKuninori Morimoto #define SND_SOC_DAIFMT_CBC_CFC (4 << 12) /* codec clk consumer & frame consumer */
120f026c123SPierre-Louis Bossart
121f026c123SPierre-Louis Bossart /* previous definitions kept for backwards-compatibility, do not use in new contributions */
122f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBM_CFM SND_SOC_DAIFMT_CBP_CFP
123f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBS_CFM SND_SOC_DAIFMT_CBC_CFP
124f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBM_CFS SND_SOC_DAIFMT_CBP_CFC
125f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CBS_CFS SND_SOC_DAIFMT_CBC_CFC
126a47cbe72SMark Brown
127905f3a04SCharles Keepax /* when passed to set_fmt directly indicate if the device is provider or consumer */
128905f3a04SCharles Keepax #define SND_SOC_DAIFMT_BP_FP SND_SOC_DAIFMT_CBP_CFP
129905f3a04SCharles Keepax #define SND_SOC_DAIFMT_BC_FP SND_SOC_DAIFMT_CBC_CFP
130905f3a04SCharles Keepax #define SND_SOC_DAIFMT_BP_FC SND_SOC_DAIFMT_CBP_CFC
131905f3a04SCharles Keepax #define SND_SOC_DAIFMT_BC_FC SND_SOC_DAIFMT_CBC_CFC
132905f3a04SCharles Keepax
133ba9e82a1SKuninori Morimoto /* Describes the possible PCM format */
134ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT 48
135ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_MASK (0xFFFFULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT)
136ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CBP_CFP (0x1ULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT)
137ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CBC_CFP (0x2ULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT)
138ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CBP_CFC (0x4ULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT)
139ba9e82a1SKuninori Morimoto #define SND_SOC_POSSIBLE_DAIFMT_CBC_CFC (0x8ULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT)
140ba9e82a1SKuninori Morimoto
141a47cbe72SMark Brown #define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
142a47cbe72SMark Brown #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
143a47cbe72SMark Brown #define SND_SOC_DAIFMT_INV_MASK 0x0f00
144f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK 0xf000
145f026c123SPierre-Louis Bossart
146f026c123SPierre-Louis Bossart #define SND_SOC_DAIFMT_MASTER_MASK SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK
147a47cbe72SMark Brown
148a47cbe72SMark Brown /*
149a47cbe72SMark Brown * Master Clock Directions
150a47cbe72SMark Brown */
151a47cbe72SMark Brown #define SND_SOC_CLOCK_IN 0
152a47cbe72SMark Brown #define SND_SOC_CLOCK_OUT 1
153a47cbe72SMark Brown
1548f738d58SMark Brown #define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S8 |\
1558f738d58SMark Brown SNDRV_PCM_FMTBIT_S16_LE |\
1568f738d58SMark Brown SNDRV_PCM_FMTBIT_S16_BE |\
1578f738d58SMark Brown SNDRV_PCM_FMTBIT_S20_3LE |\
1588f738d58SMark Brown SNDRV_PCM_FMTBIT_S20_3BE |\
159823dbb6eSMaciej S. Szmigiero SNDRV_PCM_FMTBIT_S20_LE |\
160823dbb6eSMaciej S. Szmigiero SNDRV_PCM_FMTBIT_S20_BE |\
1618f738d58SMark Brown SNDRV_PCM_FMTBIT_S24_3LE |\
1628f738d58SMark Brown SNDRV_PCM_FMTBIT_S24_3BE |\
163d34c4307SJon Smirl SNDRV_PCM_FMTBIT_S32_LE |\
164d34c4307SJon Smirl SNDRV_PCM_FMTBIT_S32_BE)
16533f503c9SMark Brown
166f0fba2adSLiam Girdwood struct snd_soc_dai_driver;
167a47cbe72SMark Brown struct snd_soc_dai;
168a47cbe72SMark Brown struct snd_ac97_bus_ops;
169a47cbe72SMark Brown
170a47cbe72SMark Brown /* Digital Audio Interface clocking API.*/
171a47cbe72SMark Brown int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
172a47cbe72SMark Brown unsigned int freq, int dir);
173a47cbe72SMark Brown
174a47cbe72SMark Brown int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
175a47cbe72SMark Brown int div_id, int div);
176a47cbe72SMark Brown
177a47cbe72SMark Brown int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
17885488037SMark Brown int pll_id, int source, unsigned int freq_in, unsigned int freq_out);
179a47cbe72SMark Brown
180e54cf76bSLiam Girdwood int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
181e54cf76bSLiam Girdwood
182a47cbe72SMark Brown /* Digital Audio interface formatting */
183ba9e82a1SKuninori Morimoto int snd_soc_dai_get_fmt_max_priority(struct snd_soc_pcm_runtime *rtd);
184ba9e82a1SKuninori Morimoto u64 snd_soc_dai_get_fmt(struct snd_soc_dai *dai, int priority);
185a47cbe72SMark Brown int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
186a47cbe72SMark Brown
187a47cbe72SMark Brown int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
188a5479e38SDaniel Ribeiro unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width);
189a47cbe72SMark Brown
190472df3cbSBarry Song int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
191472df3cbSBarry Song unsigned int tx_num, unsigned int *tx_slot,
192472df3cbSBarry Song unsigned int rx_num, unsigned int *rx_slot);
193472df3cbSBarry Song
194a47cbe72SMark Brown int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
195a47cbe72SMark Brown
196a47cbe72SMark Brown /* Digital Audio Interface mute */
197da18396fSMark Brown int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
198da18396fSMark Brown int direction);
199a47cbe72SMark Brown
200467b061fSSrinivas Kandagatla
201467b061fSSrinivas Kandagatla int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai,
202467b061fSSrinivas Kandagatla unsigned int *tx_num, unsigned int *tx_slot,
203467b061fSSrinivas Kandagatla unsigned int *rx_num, unsigned int *rx_slot);
204467b061fSSrinivas Kandagatla
205bece9e95SLiam Girdwood int snd_soc_dai_is_dummy(struct snd_soc_dai *dai);
206bece9e95SLiam Girdwood
207aa6166c2SKuninori Morimoto int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
208aa6166c2SKuninori Morimoto struct snd_pcm_substream *substream,
209aa6166c2SKuninori Morimoto struct snd_pcm_hw_params *params);
210846faaedSKuninori Morimoto void snd_soc_dai_hw_free(struct snd_soc_dai *dai,
211c304c9acSKuninori Morimoto struct snd_pcm_substream *substream,
212c304c9acSKuninori Morimoto int rollback);
2135a52a045SKuninori Morimoto int snd_soc_dai_startup(struct snd_soc_dai *dai,
2145a52a045SKuninori Morimoto struct snd_pcm_substream *substream);
215330fcb51SKuninori Morimoto void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
21600a0b46cSKuninori Morimoto struct snd_pcm_substream *substream, int rollback);
217e0f22622SKuninori Morimoto void snd_soc_dai_suspend(struct snd_soc_dai *dai);
21824b09d05SKuninori Morimoto void snd_soc_dai_resume(struct snd_soc_dai *dai);
219b423c420SKuninori Morimoto int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
220b423c420SKuninori Morimoto struct snd_soc_pcm_runtime *rtd, int num);
221467fece8SKuninori Morimoto bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream);
22225612477SPierre-Louis Bossart void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link);
223dc829106SKuninori Morimoto void snd_soc_dai_action(struct snd_soc_dai *dai,
224dc829106SKuninori Morimoto int stream, int action);
snd_soc_dai_activate(struct snd_soc_dai * dai,int stream)225dc829106SKuninori Morimoto static inline void snd_soc_dai_activate(struct snd_soc_dai *dai,
226dc829106SKuninori Morimoto int stream)
227dc829106SKuninori Morimoto {
228dc829106SKuninori Morimoto snd_soc_dai_action(dai, stream, 1);
229dc829106SKuninori Morimoto }
snd_soc_dai_deactivate(struct snd_soc_dai * dai,int stream)230dc829106SKuninori Morimoto static inline void snd_soc_dai_deactivate(struct snd_soc_dai *dai,
231dc829106SKuninori Morimoto int stream)
232dc829106SKuninori Morimoto {
233dc829106SKuninori Morimoto snd_soc_dai_action(dai, stream, -1);
234dc829106SKuninori Morimoto }
235efffd9b3SKuninori Morimoto int snd_soc_dai_active(struct snd_soc_dai *dai);
236aa6166c2SKuninori Morimoto
23751801aeaSKuninori Morimoto int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order);
2387eaa313bSKuninori Morimoto int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order);
2390b73ba55SKuninori Morimoto int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd);
240d108c7fdSKuninori Morimoto int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream);
2416374f493SKuninori Morimoto int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd,
2426374f493SKuninori Morimoto int rollback);
24330819358SKuninori Morimoto int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
24430819358SKuninori Morimoto int cmd);
2458544f08cSKuninori Morimoto void snd_soc_pcm_dai_delay(struct snd_pcm_substream *substream,
2468544f08cSKuninori Morimoto snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);
2470b73ba55SKuninori Morimoto
248b5ae4cceSKuninori Morimoto int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
249b5ae4cceSKuninori Morimoto struct snd_compr_stream *cstream);
2502b25f81dSKuninori Morimoto void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
2511e6a93cfSKuninori Morimoto struct snd_compr_stream *cstream,
2521e6a93cfSKuninori Morimoto int rollback);
253eb08411bSKuninori Morimoto int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
254eb08411bSKuninori Morimoto struct snd_compr_stream *cstream, int cmd);
2558dfedafbSKuninori Morimoto int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
2568dfedafbSKuninori Morimoto struct snd_compr_stream *cstream,
2578dfedafbSKuninori Morimoto struct snd_compr_params *params);
258adbef543SKuninori Morimoto int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai,
259adbef543SKuninori Morimoto struct snd_compr_stream *cstream,
260adbef543SKuninori Morimoto struct snd_codec *params);
26153294353SKuninori Morimoto int snd_soc_dai_compr_ack(struct snd_soc_dai *dai,
26253294353SKuninori Morimoto struct snd_compr_stream *cstream,
26353294353SKuninori Morimoto size_t bytes);
264ed38cc59SKuninori Morimoto int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai,
265ed38cc59SKuninori Morimoto struct snd_compr_stream *cstream,
266ed38cc59SKuninori Morimoto struct snd_compr_tstamp *tstamp);
26788b3a7dfSKuninori Morimoto int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai,
26888b3a7dfSKuninori Morimoto struct snd_compr_stream *cstream,
26988b3a7dfSKuninori Morimoto struct snd_compr_metadata *metadata);
27094d72819SKuninori Morimoto int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai,
27194d72819SKuninori Morimoto struct snd_compr_stream *cstream,
27294d72819SKuninori Morimoto struct snd_compr_metadata *metadata);
273b5ae4cceSKuninori Morimoto
27409f75f09SKuninori Morimoto const char *snd_soc_dai_name_get(struct snd_soc_dai *dai);
27509f75f09SKuninori Morimoto
276a47cbe72SMark Brown struct snd_soc_dai_ops {
277624fee45SKuninori Morimoto /* DAI driver callbacks */
278624fee45SKuninori Morimoto int (*probe)(struct snd_soc_dai *dai);
279624fee45SKuninori Morimoto int (*remove)(struct snd_soc_dai *dai);
280624fee45SKuninori Morimoto /* compress dai */
281624fee45SKuninori Morimoto int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
282624fee45SKuninori Morimoto /* Optional Callback used at pcm creation*/
283624fee45SKuninori Morimoto int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
284624fee45SKuninori Morimoto struct snd_soc_dai *dai);
285624fee45SKuninori Morimoto
286a47cbe72SMark Brown /*
287a47cbe72SMark Brown * DAI clocking configuration, all optional.
288a47cbe72SMark Brown * Called by soc_card drivers, normally in their hw_params.
289a47cbe72SMark Brown */
290a47cbe72SMark Brown int (*set_sysclk)(struct snd_soc_dai *dai,
291a47cbe72SMark Brown int clk_id, unsigned int freq, int dir);
29285488037SMark Brown int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
29385488037SMark Brown unsigned int freq_in, unsigned int freq_out);
294a47cbe72SMark Brown int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
295e54cf76bSLiam Girdwood int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);
296a47cbe72SMark Brown
297a47cbe72SMark Brown /*
298a47cbe72SMark Brown * DAI format configuration
299a47cbe72SMark Brown * Called by soc_card drivers, normally in their hw_params.
300a47cbe72SMark Brown */
301a47cbe72SMark Brown int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
302e5c21514SXiubo Li int (*xlate_tdm_slot_mask)(unsigned int slots,
30389c67857SXiubo Li unsigned int *tx_mask, unsigned int *rx_mask);
304a47cbe72SMark Brown int (*set_tdm_slot)(struct snd_soc_dai *dai,
305a5479e38SDaniel Ribeiro unsigned int tx_mask, unsigned int rx_mask,
306a5479e38SDaniel Ribeiro int slots, int slot_width);
307472df3cbSBarry Song int (*set_channel_map)(struct snd_soc_dai *dai,
308472df3cbSBarry Song unsigned int tx_num, unsigned int *tx_slot,
309472df3cbSBarry Song unsigned int rx_num, unsigned int *rx_slot);
310467b061fSSrinivas Kandagatla int (*get_channel_map)(struct snd_soc_dai *dai,
311467b061fSSrinivas Kandagatla unsigned int *tx_num, unsigned int *tx_slot,
312467b061fSSrinivas Kandagatla unsigned int *rx_num, unsigned int *rx_slot);
313a47cbe72SMark Brown int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
314a47cbe72SMark Brown
315e8444560SPierre-Louis Bossart int (*set_stream)(struct snd_soc_dai *dai,
31697349b60SShreyas NC void *stream, int direction);
317e8444560SPierre-Louis Bossart void *(*get_stream)(struct snd_soc_dai *dai, int direction);
31836d73c4aSPierre-Louis Bossart
319a47cbe72SMark Brown /*
320a47cbe72SMark Brown * DAI digital mute - optional.
321a47cbe72SMark Brown * Called by soc-core to minimise any pops.
322a47cbe72SMark Brown */
323da18396fSMark Brown int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);
324dee89c4dSMark Brown
325dee89c4dSMark Brown /*
326dee89c4dSMark Brown * ALSA PCM audio operations - all optional.
327dee89c4dSMark Brown * Called by soc-core during audio PCM operations.
328dee89c4dSMark Brown */
329dee89c4dSMark Brown int (*startup)(struct snd_pcm_substream *,
330dee89c4dSMark Brown struct snd_soc_dai *);
331dee89c4dSMark Brown void (*shutdown)(struct snd_pcm_substream *,
332dee89c4dSMark Brown struct snd_soc_dai *);
333dee89c4dSMark Brown int (*hw_params)(struct snd_pcm_substream *,
334dee89c4dSMark Brown struct snd_pcm_hw_params *, struct snd_soc_dai *);
335dee89c4dSMark Brown int (*hw_free)(struct snd_pcm_substream *,
336dee89c4dSMark Brown struct snd_soc_dai *);
337dee89c4dSMark Brown int (*prepare)(struct snd_pcm_substream *,
338dee89c4dSMark Brown struct snd_soc_dai *);
3399f1614aaSMarkus Pargmann /*
3409f1614aaSMarkus Pargmann * NOTE: Commands passed to the trigger function are not necessarily
3419f1614aaSMarkus Pargmann * compatible with the current state of the dai. For example this
3429f1614aaSMarkus Pargmann * sequence of commands is possible: START STOP STOP.
3439f1614aaSMarkus Pargmann * So do not unconditionally use refcounting functions in the trigger
3449f1614aaSMarkus Pargmann * function, e.g. clk_enable/disable.
3459f1614aaSMarkus Pargmann */
346dee89c4dSMark Brown int (*trigger)(struct snd_pcm_substream *, int,
347dee89c4dSMark Brown struct snd_soc_dai *);
34807bf84aaSLiam Girdwood int (*bespoke_trigger)(struct snd_pcm_substream *, int,
34907bf84aaSLiam Girdwood struct snd_soc_dai *);
350258020d0SPeter Ujfalusi /*
351258020d0SPeter Ujfalusi * For hardware based FIFO caused delay reporting.
352258020d0SPeter Ujfalusi * Optional.
353258020d0SPeter Ujfalusi */
354258020d0SPeter Ujfalusi snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
355258020d0SPeter Ujfalusi struct snd_soc_dai *);
356350d9935SKuninori Morimoto
357ba9e82a1SKuninori Morimoto /*
358ba9e82a1SKuninori Morimoto * Format list for auto selection.
359ba9e82a1SKuninori Morimoto * Format will be increased if priority format was
360ba9e82a1SKuninori Morimoto * not selected.
361ba9e82a1SKuninori Morimoto * see
362ba9e82a1SKuninori Morimoto * snd_soc_dai_get_fmt()
363ba9e82a1SKuninori Morimoto */
364ba9e82a1SKuninori Morimoto u64 *auto_selectable_formats;
365ba9e82a1SKuninori Morimoto int num_auto_selectable_formats;
366ba9e82a1SKuninori Morimoto
367624fee45SKuninori Morimoto /* probe ordering - for components with runtime dependencies */
368624fee45SKuninori Morimoto int probe_order;
369624fee45SKuninori Morimoto int remove_order;
370624fee45SKuninori Morimoto
371350d9935SKuninori Morimoto /* bit field */
372350d9935SKuninori Morimoto unsigned int no_capture_mute:1;
373*868eb92bSSrinivas Kandagatla unsigned int mute_unmute_on_trigger:1;
374a47cbe72SMark Brown };
375a47cbe72SMark Brown
3762e622ae4SVinod Koul struct snd_soc_cdai_ops {
3772e622ae4SVinod Koul /*
3782e622ae4SVinod Koul * for compress ops
3792e622ae4SVinod Koul */
3802e622ae4SVinod Koul int (*startup)(struct snd_compr_stream *,
3812e622ae4SVinod Koul struct snd_soc_dai *);
3822e622ae4SVinod Koul int (*shutdown)(struct snd_compr_stream *,
3832e622ae4SVinod Koul struct snd_soc_dai *);
3842e622ae4SVinod Koul int (*set_params)(struct snd_compr_stream *,
3852e622ae4SVinod Koul struct snd_compr_params *, struct snd_soc_dai *);
3862e622ae4SVinod Koul int (*get_params)(struct snd_compr_stream *,
3872e622ae4SVinod Koul struct snd_codec *, struct snd_soc_dai *);
3882e622ae4SVinod Koul int (*set_metadata)(struct snd_compr_stream *,
3892e622ae4SVinod Koul struct snd_compr_metadata *, struct snd_soc_dai *);
3902e622ae4SVinod Koul int (*get_metadata)(struct snd_compr_stream *,
3912e622ae4SVinod Koul struct snd_compr_metadata *, struct snd_soc_dai *);
3922e622ae4SVinod Koul int (*trigger)(struct snd_compr_stream *, int,
3932e622ae4SVinod Koul struct snd_soc_dai *);
3942e622ae4SVinod Koul int (*pointer)(struct snd_compr_stream *,
3952e622ae4SVinod Koul struct snd_compr_tstamp *, struct snd_soc_dai *);
3962e622ae4SVinod Koul int (*ack)(struct snd_compr_stream *, size_t,
3972e622ae4SVinod Koul struct snd_soc_dai *);
3982e622ae4SVinod Koul };
3992e622ae4SVinod Koul
400a47cbe72SMark Brown /*
401f0fba2adSLiam Girdwood * Digital Audio Interface Driver.
402a47cbe72SMark Brown *
403f0fba2adSLiam Girdwood * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97
404f0fba2adSLiam Girdwood * operations and capabilities. Codec and platform drivers will register this
405f0fba2adSLiam Girdwood * structure for every DAI they have.
406f0fba2adSLiam Girdwood *
407f0fba2adSLiam Girdwood * This structure covers the clocking, formating and ALSA operations for each
408f0fba2adSLiam Girdwood * interface.
409a47cbe72SMark Brown */
410f0fba2adSLiam Girdwood struct snd_soc_dai_driver {
411a47cbe72SMark Brown /* DAI description */
412f0fba2adSLiam Girdwood const char *name;
413a47cbe72SMark Brown unsigned int id;
41462368294SMark Brown unsigned int base;
41568003e6cSMengdong Lin struct snd_soc_dobj dobj;
41645655ec6SKuninori Morimoto struct of_phandle_args *dai_args;
417a47cbe72SMark Brown
418a47cbe72SMark Brown /* ops */
4191ee46ebdSMark Brown const struct snd_soc_dai_ops *ops;
4202e622ae4SVinod Koul const struct snd_soc_cdai_ops *cops;
421a47cbe72SMark Brown
422a47cbe72SMark Brown /* DAI capabilities */
423a47cbe72SMark Brown struct snd_soc_pcm_stream capture;
424a47cbe72SMark Brown struct snd_soc_pcm_stream playback;
425f14654ddSKuninori Morimoto unsigned int symmetric_rate:1;
4263635bf09SNicolin Chen unsigned int symmetric_channels:1;
427f14654ddSKuninori Morimoto unsigned int symmetric_sample_bits:1;
428f0fba2adSLiam Girdwood };
429f0fba2adSLiam Girdwood
4303653480cSKuninori Morimoto /* for Playback/Capture */
4313653480cSKuninori Morimoto struct snd_soc_dai_stream {
4323653480cSKuninori Morimoto struct snd_soc_dapm_widget *widget;
4333653480cSKuninori Morimoto
4343653480cSKuninori Morimoto unsigned int active; /* usage count */
4353653480cSKuninori Morimoto unsigned int tdm_mask; /* CODEC TDM slot masks and params (for fixup) */
4363653480cSKuninori Morimoto
4373653480cSKuninori Morimoto void *dma_data; /* DAI DMA data */
4383653480cSKuninori Morimoto };
4393653480cSKuninori Morimoto
440f0fba2adSLiam Girdwood /*
441f0fba2adSLiam Girdwood * Digital Audio Interface runtime data.
442f0fba2adSLiam Girdwood *
443f0fba2adSLiam Girdwood * Holds runtime data for a DAI.
444f0fba2adSLiam Girdwood */
445f0fba2adSLiam Girdwood struct snd_soc_dai {
446f0fba2adSLiam Girdwood const char *name;
447f0fba2adSLiam Girdwood int id;
448f0fba2adSLiam Girdwood struct device *dev;
449f0fba2adSLiam Girdwood
450f0fba2adSLiam Girdwood /* driver ops */
451f0fba2adSLiam Girdwood struct snd_soc_dai_driver *driver;
452a47cbe72SMark Brown
453a47cbe72SMark Brown /* DAI runtime info */
4543653480cSKuninori Morimoto struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1];
455a47cbe72SMark Brown
45617841020SDong Aisheng /* Symmetry data - only valid if symmetry is being enforced */
45717841020SDong Aisheng unsigned int rate;
4583635bf09SNicolin Chen unsigned int channels;
4593635bf09SNicolin Chen unsigned int sample_bits;
46017841020SDong Aisheng
461f0fba2adSLiam Girdwood /* parent platform/codec */
4626106d129SLars-Peter Clausen struct snd_soc_component *component;
4632466ab97SMark Brown
464a47cbe72SMark Brown struct list_head list;
465b56be800SKuninori Morimoto
46600a0b46cSKuninori Morimoto /* function mark */
46700a0b46cSKuninori Morimoto struct snd_pcm_substream *mark_startup;
468c304c9acSKuninori Morimoto struct snd_pcm_substream *mark_hw_params;
4696374f493SKuninori Morimoto struct snd_pcm_substream *mark_trigger;
4701e6a93cfSKuninori Morimoto struct snd_compr_stream *mark_compr_startup;
47100a0b46cSKuninori Morimoto
472b56be800SKuninori Morimoto /* bit field */
473b56be800SKuninori Morimoto unsigned int probed:1;
474a47cbe72SMark Brown };
475a47cbe72SMark Brown
476acf253c1SKuninori Morimoto static inline struct snd_soc_pcm_stream *
snd_soc_dai_get_pcm_stream(const struct snd_soc_dai * dai,int stream)477acf253c1SKuninori Morimoto snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream)
478acf253c1SKuninori Morimoto {
479acf253c1SKuninori Morimoto return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
480acf253c1SKuninori Morimoto &dai->driver->playback : &dai->driver->capture;
481acf253c1SKuninori Morimoto }
482acf253c1SKuninori Morimoto
483944d721eSKuninori Morimoto #define snd_soc_dai_get_widget_playback(dai) snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_PLAYBACK)
484944d721eSKuninori Morimoto #define snd_soc_dai_get_widget_capture(dai) snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_CAPTURE)
4850c01f6caSKuninori Morimoto static inline
snd_soc_dai_get_widget(struct snd_soc_dai * dai,int stream)48637ed1236SKuninori Morimoto struct snd_soc_dapm_widget *snd_soc_dai_get_widget(struct snd_soc_dai *dai, int stream)
4870c01f6caSKuninori Morimoto {
4883653480cSKuninori Morimoto return dai->stream[stream].widget;
4890c01f6caSKuninori Morimoto }
4900c01f6caSKuninori Morimoto
491944d721eSKuninori Morimoto #define snd_soc_dai_set_widget_playback(dai, widget) snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_PLAYBACK, widget)
492944d721eSKuninori Morimoto #define snd_soc_dai_set_widget_capture(dai, widget) snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_CAPTURE, widget)
49337ed1236SKuninori Morimoto static inline
snd_soc_dai_set_widget(struct snd_soc_dai * dai,int stream,struct snd_soc_dapm_widget * widget)49437ed1236SKuninori Morimoto void snd_soc_dai_set_widget(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_widget *widget)
49537ed1236SKuninori Morimoto {
4963653480cSKuninori Morimoto dai->stream[stream].widget = widget;
49737ed1236SKuninori Morimoto }
49837ed1236SKuninori Morimoto
49960df5935SKuninori Morimoto #define snd_soc_dai_dma_data_get_playback(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_PLAYBACK)
50060df5935SKuninori Morimoto #define snd_soc_dai_dma_data_get_capture(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_CAPTURE)
50160df5935SKuninori Morimoto #define snd_soc_dai_get_dma_data(dai, ss) snd_soc_dai_dma_data_get(dai, ss->stream)
snd_soc_dai_dma_data_get(const struct snd_soc_dai * dai,int stream)50260df5935SKuninori Morimoto static inline void *snd_soc_dai_dma_data_get(const struct snd_soc_dai *dai, int stream)
503fd23b7deSDaniel Mack {
5043653480cSKuninori Morimoto return dai->stream[stream].dma_data;
505fd23b7deSDaniel Mack }
506fd23b7deSDaniel Mack
50760df5935SKuninori Morimoto #define snd_soc_dai_dma_data_set_playback(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_PLAYBACK, data)
50860df5935SKuninori Morimoto #define snd_soc_dai_dma_data_set_capture(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_CAPTURE, data)
50960df5935SKuninori Morimoto #define snd_soc_dai_set_dma_data(dai, ss, data) snd_soc_dai_dma_data_set(dai, ss->stream, data)
snd_soc_dai_dma_data_set(struct snd_soc_dai * dai,int stream,void * data)51060df5935SKuninori Morimoto static inline void snd_soc_dai_dma_data_set(struct snd_soc_dai *dai, int stream, void *data)
511fd23b7deSDaniel Mack {
5123653480cSKuninori Morimoto dai->stream[stream].dma_data = data;
513f0fba2adSLiam Girdwood }
514f0fba2adSLiam Girdwood
snd_soc_dai_init_dma_data(struct snd_soc_dai * dai,void * playback,void * capture)5153653480cSKuninori Morimoto static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, void *playback, void *capture)
516ecfc0c04SMark Brown {
5173653480cSKuninori Morimoto snd_soc_dai_dma_data_set_playback(dai, playback);
5183653480cSKuninori Morimoto snd_soc_dai_dma_data_set_capture(dai, capture);
519ecfc0c04SMark Brown }
520ecfc0c04SMark Brown
snd_soc_dai_tdm_mask_get(struct snd_soc_dai * dai,int stream)521d4c0326eSKuninori Morimoto static inline unsigned int snd_soc_dai_tdm_mask_get(struct snd_soc_dai *dai, int stream)
522d4c0326eSKuninori Morimoto {
5233653480cSKuninori Morimoto return dai->stream[stream].tdm_mask;
524d4c0326eSKuninori Morimoto }
525d4c0326eSKuninori Morimoto
snd_soc_dai_tdm_mask_set(struct snd_soc_dai * dai,int stream,unsigned int tdm_mask)526d4c0326eSKuninori Morimoto static inline void snd_soc_dai_tdm_mask_set(struct snd_soc_dai *dai, int stream,
527d4c0326eSKuninori Morimoto unsigned int tdm_mask)
528d4c0326eSKuninori Morimoto {
5293653480cSKuninori Morimoto dai->stream[stream].tdm_mask = tdm_mask;
5303653480cSKuninori Morimoto }
5313653480cSKuninori Morimoto
snd_soc_dai_stream_active(struct snd_soc_dai * dai,int stream)5323653480cSKuninori Morimoto static inline unsigned int snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream)
5333653480cSKuninori Morimoto {
5343653480cSKuninori Morimoto /* see snd_soc_dai_action() for setup */
5353653480cSKuninori Morimoto return dai->stream[stream].active;
536d4c0326eSKuninori Morimoto }
537d4c0326eSKuninori Morimoto
snd_soc_dai_set_drvdata(struct snd_soc_dai * dai,void * data)538f0fba2adSLiam Girdwood static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai,
539f0fba2adSLiam Girdwood void *data)
540f0fba2adSLiam Girdwood {
541f0fba2adSLiam Girdwood dev_set_drvdata(dai->dev, data);
542f0fba2adSLiam Girdwood }
543f0fba2adSLiam Girdwood
snd_soc_dai_get_drvdata(struct snd_soc_dai * dai)544f0fba2adSLiam Girdwood static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai)
545f0fba2adSLiam Girdwood {
546f0fba2adSLiam Girdwood return dev_get_drvdata(dai->dev);
547fd23b7deSDaniel Mack }
548fd23b7deSDaniel Mack
54997349b60SShreyas NC /**
550e8444560SPierre-Louis Bossart * snd_soc_dai_set_stream() - Configures a DAI for stream operation
55197349b60SShreyas NC * @dai: DAI
552e8444560SPierre-Louis Bossart * @stream: STREAM (opaque structure depending on DAI type)
55397349b60SShreyas NC * @direction: Stream direction(Playback/Capture)
554e8444560SPierre-Louis Bossart * Some subsystems, such as SoundWire, don't have a notion of direction and we reuse
55597349b60SShreyas NC * the ASoC stream direction to configure sink/source ports.
55697349b60SShreyas NC * Playback maps to source ports and Capture for sink ports.
55797349b60SShreyas NC *
55897349b60SShreyas NC * This should be invoked with NULL to clear the stream set previously.
55997349b60SShreyas NC * Returns 0 on success, a negative error code otherwise.
56097349b60SShreyas NC */
snd_soc_dai_set_stream(struct snd_soc_dai * dai,void * stream,int direction)561e8444560SPierre-Louis Bossart static inline int snd_soc_dai_set_stream(struct snd_soc_dai *dai,
56297349b60SShreyas NC void *stream, int direction)
56397349b60SShreyas NC {
564e8444560SPierre-Louis Bossart if (dai->driver->ops->set_stream)
565e8444560SPierre-Louis Bossart return dai->driver->ops->set_stream(dai, stream, direction);
56697349b60SShreyas NC else
56797349b60SShreyas NC return -ENOTSUPP;
56897349b60SShreyas NC }
56997349b60SShreyas NC
57036d73c4aSPierre-Louis Bossart /**
571e8444560SPierre-Louis Bossart * snd_soc_dai_get_stream() - Retrieves stream from DAI
57236d73c4aSPierre-Louis Bossart * @dai: DAI
57336d73c4aSPierre-Louis Bossart * @direction: Stream direction(Playback/Capture)
57436d73c4aSPierre-Louis Bossart *
57536d73c4aSPierre-Louis Bossart * This routine only retrieves that was previously configured
576e8444560SPierre-Louis Bossart * with snd_soc_dai_get_stream()
57736d73c4aSPierre-Louis Bossart *
578d20e834eSPierre-Louis Bossart * Returns pointer to stream or an ERR_PTR value, e.g.
579d20e834eSPierre-Louis Bossart * ERR_PTR(-ENOTSUPP) if callback is not supported;
58036d73c4aSPierre-Louis Bossart */
snd_soc_dai_get_stream(struct snd_soc_dai * dai,int direction)581e8444560SPierre-Louis Bossart static inline void *snd_soc_dai_get_stream(struct snd_soc_dai *dai,
58236d73c4aSPierre-Louis Bossart int direction)
58336d73c4aSPierre-Louis Bossart {
584e8444560SPierre-Louis Bossart if (dai->driver->ops->get_stream)
585e8444560SPierre-Louis Bossart return dai->driver->ops->get_stream(dai, direction);
58636d73c4aSPierre-Louis Bossart else
587308811a3SSrinivas Kandagatla return ERR_PTR(-ENOTSUPP);
58836d73c4aSPierre-Louis Bossart }
58936d73c4aSPierre-Louis Bossart
590a47cbe72SMark Brown #endif
591