Blame view
include/sound/soc-dai.h
15.8 KB
e2cfd2c96 ASoC: soc-dai.h: ... |
1 2 |
/* SPDX-License-Identifier: GPL-2.0 * |
a47cbe726 ASoC: Move DAI st... |
3 4 5 6 |
* linux/sound/soc-dai.h -- ALSA SoC Layer * * Copyright: 2005-2008 Wolfson Microelectronics. PLC. * |
a47cbe726 ASoC: Move DAI st... |
7 8 9 10 11 12 13 14 |
* Digital Audio Interface (DAI) API. */ #ifndef __LINUX_SND_SOC_DAI_H #define __LINUX_SND_SOC_DAI_H #include <linux/list.h> |
d2e3cb85a ASoC: topology: A... |
15 |
#include <sound/asoc.h> |
a47cbe726 ASoC: Move DAI st... |
16 17 |
struct snd_pcm_substream; |
888df395e ASoC: dapm: Imple... |
18 |
struct snd_soc_dapm_widget; |
496810778 ASoC: add definat... |
19 |
struct snd_compr_stream; |
a47cbe726 ASoC: Move DAI st... |
20 21 22 23 24 25 26 |
/* * DAI hardware audio formats. * * Describes the physical PCM data formating and clocking. Add new formats * to the end. */ |
d2e3cb85a ASoC: topology: A... |
27 28 29 30 31 32 33 |
#define SND_SOC_DAIFMT_I2S SND_SOC_DAI_FORMAT_I2S #define SND_SOC_DAIFMT_RIGHT_J SND_SOC_DAI_FORMAT_RIGHT_J #define SND_SOC_DAIFMT_LEFT_J SND_SOC_DAI_FORMAT_LEFT_J #define SND_SOC_DAIFMT_DSP_A SND_SOC_DAI_FORMAT_DSP_A #define SND_SOC_DAIFMT_DSP_B SND_SOC_DAI_FORMAT_DSP_B #define SND_SOC_DAIFMT_AC97 SND_SOC_DAI_FORMAT_AC97 #define SND_SOC_DAIFMT_PDM SND_SOC_DAI_FORMAT_PDM |
a47cbe726 ASoC: Move DAI st... |
34 35 36 37 38 39 40 41 |
/* left and right justified also known as MSB and LSB respectively */ #define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J #define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J /* * DAI Clock gating. * |
fc926a7c8 ASoC: soc-dai.h: ... |
42 |
* DAI bit clocks can be gated (disabled) when the DAI is not |
a47cbe726 ASoC: Move DAI st... |
43 44 |
* sending or receiving PCM data in a frame. This can be used to save power. */ |
75d9ac46b ASoC: Allow DAI f... |
45 |
#define SND_SOC_DAIFMT_CONT (1 << 4) /* continuous clock */ |
eef28e108 ASoC: SND_SOC_DAI... |
46 |
#define SND_SOC_DAIFMT_GATED (0 << 4) /* clock is gated */ |
a47cbe726 ASoC: Move DAI st... |
47 48 |
/* |
1d387a3fd ASoC: Document DA... |
49 |
* DAI hardware signal polarity. |
a47cbe726 ASoC: Move DAI st... |
50 51 52 |
* * Specifies whether the DAI can also support inverted clocks for the specified * format. |
1d387a3fd ASoC: Document DA... |
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
* * BCLK: * - "normal" polarity means signal is available at rising edge of BCLK * - "inverted" polarity means signal is available at falling edge of BCLK * * FSYNC "normal" polarity depends on the frame format: * - I2S: frame consists of left then right channel data. Left channel starts * with falling FSYNC edge, right channel starts with rising FSYNC edge. * - Left/Right Justified: frame consists of left then right channel data. * Left channel starts with rising FSYNC edge, right channel starts with * falling FSYNC edge. * - DSP A/B: Frame starts with rising FSYNC edge. * - AC97: Frame starts with rising FSYNC edge. * * "Negative" FSYNC polarity is the one opposite of "normal" polarity. |
a47cbe726 ASoC: Move DAI st... |
68 |
*/ |
5d163336a ASoC: SND_SOC_DAI... |
69 |
#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ |
75d9ac46b ASoC: Allow DAI f... |
70 71 72 |
#define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */ #define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */ #define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */ |
a47cbe726 ASoC: Move DAI st... |
73 74 75 76 77 |
/* * DAI hardware clock masters. * * This is wrt the codec, the inverse is true for the interface |
47db8e89a ASoC: fixes multi... |
78 |
* i.e. if the codec is clk and FRM master then the interface is |
ca00e66c1 ASoC: soc-dai.h: ... |
79 |
* clk and frame secondary. |
a47cbe726 ASoC: Move DAI st... |
80 |
*/ |
75d9ac46b ASoC: Allow DAI f... |
81 |
#define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */ |
ca00e66c1 ASoC: soc-dai.h: ... |
82 83 84 |
#define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk secondary & FRM master */ #define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame secondary */ #define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM secondary */ |
a47cbe726 ASoC: Move DAI st... |
85 86 87 88 89 90 91 92 93 94 95 |
#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0 #define SND_SOC_DAIFMT_INV_MASK 0x0f00 #define SND_SOC_DAIFMT_MASTER_MASK 0xf000 /* * Master Clock Directions */ #define SND_SOC_CLOCK_IN 0 #define SND_SOC_CLOCK_OUT 1 |
8f738d584 ASoC: Define more... |
96 97 98 99 100 |
#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S8 |\ SNDRV_PCM_FMTBIT_S16_LE |\ SNDRV_PCM_FMTBIT_S16_BE |\ SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S20_3BE |\ |
823dbb6eb ALSA: pcm: add SN... |
101 102 |
SNDRV_PCM_FMTBIT_S20_LE |\ SNDRV_PCM_FMTBIT_S20_BE |\ |
8f738d584 ASoC: Define more... |
103 104 |
SNDRV_PCM_FMTBIT_S24_3LE |\ SNDRV_PCM_FMTBIT_S24_3BE |\ |
d34c43078 ASoC: Add SNDRV_P... |
105 106 |
SNDRV_PCM_FMTBIT_S32_LE |\ SNDRV_PCM_FMTBIT_S32_BE) |
33f503c96 ASoC: Use a share... |
107 |
|
f0fba2ad1 ASoC: multi-compo... |
108 |
struct snd_soc_dai_driver; |
a47cbe726 ASoC: Move DAI st... |
109 110 111 112 113 114 115 116 117 118 119 |
struct snd_soc_dai; struct snd_ac97_bus_ops; /* Digital Audio Interface clocking API.*/ int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir); int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div); int snd_soc_dai_set_pll(struct snd_soc_dai *dai, |
85488037b ASoC: Add source ... |
120 |
int pll_id, int source, unsigned int freq_in, unsigned int freq_out); |
a47cbe726 ASoC: Move DAI st... |
121 |
|
e54cf76ba ASoC: core: Add A... |
122 |
int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio); |
a47cbe726 ASoC: Move DAI st... |
123 124 125 126 |
/* Digital Audio interface formatting */ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, |
a5479e389 ASoC: change set_... |
127 |
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); |
a47cbe726 ASoC: Move DAI st... |
128 |
|
472df3cba ASoC: Provide API... |
129 130 131 |
int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot); |
a47cbe726 ASoC: Move DAI st... |
132 133 134 |
int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); /* Digital Audio Interface mute */ |
da18396f9 ASoC: core: Allow... |
135 136 |
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction); |
a47cbe726 ASoC: Move DAI st... |
137 |
|
467b061f1 ASoC: core: add s... |
138 139 140 141 |
int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot); |
bece9e957 ASoC: utils: Add ... |
142 |
int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); |
aa6166c2a ASoC: soc-dai: mv... |
143 144 145 |
int snd_soc_dai_hw_params(struct snd_soc_dai *dai, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); |
846faaed9 ASoC: soc-dai: ad... |
146 147 |
void snd_soc_dai_hw_free(struct snd_soc_dai *dai, struct snd_pcm_substream *substream); |
5a52a0453 ASoC: soc-dai: ad... |
148 149 |
int snd_soc_dai_startup(struct snd_soc_dai *dai, struct snd_pcm_substream *substream); |
330fcb513 ASoC: soc-dai: ad... |
150 |
void snd_soc_dai_shutdown(struct snd_soc_dai *dai, |
00a0b46c9 ASoC: soc-dai: ad... |
151 |
struct snd_pcm_substream *substream, int rollback); |
1dea80d4b ASoC: soc-dai: ad... |
152 153 |
snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, struct snd_pcm_substream *substream); |
e0f226229 ASoC: soc-dai: ad... |
154 |
void snd_soc_dai_suspend(struct snd_soc_dai *dai); |
24b09d051 ASoC: soc-dai: ad... |
155 |
void snd_soc_dai_resume(struct snd_soc_dai *dai); |
b423c4202 ASoC: soc-dai: ad... |
156 157 |
int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd, int num); |
467fece8f ASoC: soc-dai: mo... |
158 |
bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); |
25612477d ASoC: soc-dai: se... |
159 |
void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link); |
dc8291068 ASoC: soc-dai: ad... |
160 161 162 163 164 165 166 167 168 169 170 171 |
void snd_soc_dai_action(struct snd_soc_dai *dai, int stream, int action); static inline void snd_soc_dai_activate(struct snd_soc_dai *dai, int stream) { snd_soc_dai_action(dai, stream, 1); } static inline void snd_soc_dai_deactivate(struct snd_soc_dai *dai, int stream) { snd_soc_dai_action(dai, stream, -1); } |
efffd9b34 ASoC: soc-dai: ad... |
172 |
int snd_soc_dai_active(struct snd_soc_dai *dai); |
aa6166c2a ASoC: soc-dai: mv... |
173 |
|
51801aeaf ASoC: soc-dai: ad... |
174 |
int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order); |
7eaa313bd ASoC: soc-dai: ad... |
175 |
int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order); |
0b73ba550 ASoC: soc-dai: ad... |
176 |
int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd); |
d108c7fd0 ASoC: soc-dai: ad... |
177 |
int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream); |
42f2472d4 ASoC: soc-dai: ad... |
178 |
int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd); |
30819358a ASoC: soc-dai: ad... |
179 180 |
int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream, int cmd); |
0b73ba550 ASoC: soc-dai: ad... |
181 |
|
b5ae4ccea ASoC: soc-dai: ad... |
182 183 |
int snd_soc_dai_compr_startup(struct snd_soc_dai *dai, struct snd_compr_stream *cstream); |
2b25f81d4 ASoC: soc-dai: ad... |
184 185 |
void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai, struct snd_compr_stream *cstream); |
eb08411bd ASoC: soc-dai: ad... |
186 187 |
int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, int cmd); |
8dfedafb5 ASoC: soc-dai: ad... |
188 189 190 |
int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_params *params); |
adbef5432 ASoC: soc-dai: ad... |
191 192 193 |
int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_codec *params); |
53294353a ASoC: soc-dai: ad... |
194 195 196 |
int snd_soc_dai_compr_ack(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, size_t bytes); |
ed38cc590 ASoC: soc-dai: ad... |
197 198 199 |
int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_tstamp *tstamp); |
88b3a7dfe ASoC: soc-dai: ad... |
200 201 202 |
int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata); |
94d728199 ASoC: soc-dai: ad... |
203 204 205 |
int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata); |
b5ae4ccea ASoC: soc-dai: ad... |
206 |
|
a47cbe726 ASoC: Move DAI st... |
207 208 209 210 211 212 213 |
struct snd_soc_dai_ops { /* * DAI clocking configuration, all optional. * Called by soc_card drivers, normally in their hw_params. */ int (*set_sysclk)(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir); |
85488037b ASoC: Add source ... |
214 215 |
int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out); |
a47cbe726 ASoC: Move DAI st... |
216 |
int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); |
e54cf76ba ASoC: core: Add A... |
217 |
int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio); |
a47cbe726 ASoC: Move DAI st... |
218 219 220 221 222 223 |
/* * DAI format configuration * Called by soc_card drivers, normally in their hw_params. */ int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); |
e5c215148 ASoC: core: remov... |
224 |
int (*xlate_tdm_slot_mask)(unsigned int slots, |
89c678571 ASoC: core: add T... |
225 |
unsigned int *tx_mask, unsigned int *rx_mask); |
a47cbe726 ASoC: Move DAI st... |
226 |
int (*set_tdm_slot)(struct snd_soc_dai *dai, |
a5479e389 ASoC: change set_... |
227 228 |
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); |
472df3cba ASoC: Provide API... |
229 230 231 |
int (*set_channel_map)(struct snd_soc_dai *dai, unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot); |
467b061f1 ASoC: core: add s... |
232 233 234 |
int (*get_channel_map)(struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot); |
a47cbe726 ASoC: Move DAI st... |
235 |
int (*set_tristate)(struct snd_soc_dai *dai, int tristate); |
97349b605 ASoC: Add SoundWi... |
236 237 |
int (*set_sdw_stream)(struct snd_soc_dai *dai, void *stream, int direction); |
36d73c4a9 ASoC: soc-dai: ad... |
238 |
void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); |
a47cbe726 ASoC: Move DAI st... |
239 240 241 242 |
/* * DAI digital mute - optional. * Called by soc-core to minimise any pops. */ |
da18396f9 ASoC: core: Allow... |
243 |
int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream); |
dee89c4d9 ASoC: Merge snd_s... |
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
/* * ALSA PCM audio operations - all optional. * Called by soc-core during audio PCM operations. */ int (*startup)(struct snd_pcm_substream *, struct snd_soc_dai *); void (*shutdown)(struct snd_pcm_substream *, struct snd_soc_dai *); int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *, struct snd_soc_dai *); int (*hw_free)(struct snd_pcm_substream *, struct snd_soc_dai *); int (*prepare)(struct snd_pcm_substream *, struct snd_soc_dai *); |
9f1614aae ASoC: snd_soc_dai... |
259 260 261 262 263 264 265 |
/* * NOTE: Commands passed to the trigger function are not necessarily * compatible with the current state of the dai. For example this * sequence of commands is possible: START STOP STOP. * So do not unconditionally use refcounting functions in the trigger * function, e.g. clk_enable/disable. */ |
dee89c4d9 ASoC: Merge snd_s... |
266 267 |
int (*trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); |
07bf84aaf ASoC: dpcm: Add b... |
268 269 |
int (*bespoke_trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); |
258020d08 ASoC: core: Add d... |
270 271 272 273 274 275 |
/* * For hardware based FIFO caused delay reporting. * Optional. */ snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, struct snd_soc_dai *); |
350d99351 ASoC: soc-dai.c: ... |
276 277 278 |
/* bit field */ unsigned int no_capture_mute:1; |
a47cbe726 ASoC: Move DAI st... |
279 |
}; |
2e622ae41 ASoC: compress: A... |
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
struct snd_soc_cdai_ops { /* * for compress ops */ int (*startup)(struct snd_compr_stream *, struct snd_soc_dai *); int (*shutdown)(struct snd_compr_stream *, struct snd_soc_dai *); int (*set_params)(struct snd_compr_stream *, struct snd_compr_params *, struct snd_soc_dai *); int (*get_params)(struct snd_compr_stream *, struct snd_codec *, struct snd_soc_dai *); int (*set_metadata)(struct snd_compr_stream *, struct snd_compr_metadata *, struct snd_soc_dai *); int (*get_metadata)(struct snd_compr_stream *, struct snd_compr_metadata *, struct snd_soc_dai *); int (*trigger)(struct snd_compr_stream *, int, struct snd_soc_dai *); int (*pointer)(struct snd_compr_stream *, struct snd_compr_tstamp *, struct snd_soc_dai *); int (*ack)(struct snd_compr_stream *, size_t, struct snd_soc_dai *); }; |
a47cbe726 ASoC: Move DAI st... |
303 |
/* |
f0fba2ad1 ASoC: multi-compo... |
304 |
* Digital Audio Interface Driver. |
a47cbe726 ASoC: Move DAI st... |
305 |
* |
f0fba2ad1 ASoC: multi-compo... |
306 307 308 309 310 311 |
* Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97 * operations and capabilities. Codec and platform drivers will register this * structure for every DAI they have. * * This structure covers the clocking, formating and ALSA operations for each * interface. |
a47cbe726 ASoC: Move DAI st... |
312 |
*/ |
f0fba2ad1 ASoC: multi-compo... |
313 |
struct snd_soc_dai_driver { |
a47cbe726 ASoC: Move DAI st... |
314 |
/* DAI description */ |
f0fba2ad1 ASoC: multi-compo... |
315 |
const char *name; |
a47cbe726 ASoC: Move DAI st... |
316 |
unsigned int id; |
623682941 ASoC: core: Allow... |
317 |
unsigned int base; |
68003e6cf ASoC: Support reg... |
318 |
struct snd_soc_dobj dobj; |
a47cbe726 ASoC: Move DAI st... |
319 |
|
f0fba2ad1 ASoC: multi-compo... |
320 321 322 |
/* DAI driver callbacks */ int (*probe)(struct snd_soc_dai *dai); int (*remove)(struct snd_soc_dai *dai); |
496810778 ASoC: add definat... |
323 |
/* compress dai */ |
6f0c42269 ASoC: compress: a... |
324 |
int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num); |
25f7b701c ASoC: core: add o... |
325 326 327 |
/* Optional Callback used at pcm creation*/ int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); |
a47cbe726 ASoC: Move DAI st... |
328 329 |
/* ops */ |
1ee46ebd0 ASoC: Make the DA... |
330 |
const struct snd_soc_dai_ops *ops; |
2e622ae41 ASoC: compress: A... |
331 |
const struct snd_soc_cdai_ops *cops; |
a47cbe726 ASoC: Move DAI st... |
332 333 334 335 |
/* DAI capabilities */ struct snd_soc_pcm_stream capture; struct snd_soc_pcm_stream playback; |
06f409d76 ASoC: Provide cor... |
336 |
unsigned int symmetric_rates:1; |
3635bf09a ASoC: soc-pcm: ad... |
337 338 |
unsigned int symmetric_channels:1; unsigned int symmetric_samplebits:1; |
0168bf0d1 ASoC: core - Allo... |
339 340 341 342 |
/* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order; |
f0fba2ad1 ASoC: multi-compo... |
343 344 345 346 347 348 349 350 351 352 353 |
}; /* * Digital Audio Interface runtime data. * * Holds runtime data for a DAI. */ struct snd_soc_dai { const char *name; int id; struct device *dev; |
f0fba2ad1 ASoC: multi-compo... |
354 355 356 |
/* driver ops */ struct snd_soc_dai_driver *driver; |
a47cbe726 ASoC: Move DAI st... |
357 358 |
/* DAI runtime info */ |
0f6011fd7 ASoC: soc-pcm: me... |
359 |
unsigned int stream_active[SNDRV_PCM_STREAM_LAST + 1]; /* usage count */ |
39b2238e2 ASoC: bunch up bi... |
360 |
|
888df395e ASoC: dapm: Imple... |
361 362 |
struct snd_soc_dapm_widget *playback_widget; struct snd_soc_dapm_widget *capture_widget; |
f0fba2ad1 ASoC: multi-compo... |
363 364 365 |
/* DAI DMA data */ void *playback_dma_data; void *capture_dma_data; |
a47cbe726 ASoC: Move DAI st... |
366 |
|
17841020e ASoC: soc-core: s... |
367 368 |
/* Symmetry data - only valid if symmetry is being enforced */ unsigned int rate; |
3635bf09a ASoC: soc-pcm: ad... |
369 370 |
unsigned int channels; unsigned int sample_bits; |
17841020e ASoC: soc-core: s... |
371 |
|
f0fba2ad1 ASoC: multi-compo... |
372 |
/* parent platform/codec */ |
6106d1294 ASoC: Add compone... |
373 |
struct snd_soc_component *component; |
2466ab970 ASoC: core: Split... |
374 |
|
88bd870f0 ASoC: core: Add i... |
375 376 377 |
/* CODEC TDM slot masks and params (for fixup) */ unsigned int tx_mask; unsigned int rx_mask; |
a47cbe726 ASoC: Move DAI st... |
378 |
struct list_head list; |
b56be800f ASoC: soc-pcm: ca... |
379 |
|
00a0b46c9 ASoC: soc-dai: ad... |
380 381 |
/* function mark */ struct snd_pcm_substream *mark_startup; |
b56be800f ASoC: soc-pcm: ca... |
382 383 |
/* bit field */ unsigned int probed:1; |
a47cbe726 ASoC: Move DAI st... |
384 |
}; |
acf253c11 ASoC: soc-pcm: ad... |
385 386 387 388 389 390 |
static inline struct snd_soc_pcm_stream * snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream) { return (stream == SNDRV_PCM_STREAM_PLAYBACK) ? &dai->driver->playback : &dai->driver->capture; } |
0c01f6ca8 ASoC: soc-pcm: ad... |
391 392 393 394 395 396 397 |
static inline struct snd_soc_dapm_widget *snd_soc_dai_get_widget( struct snd_soc_dai *dai, int stream) { return (stream == SNDRV_PCM_STREAM_PLAYBACK) ? dai->playback_widget : dai->capture_widget; } |
fd23b7dee ASoC: move dma_da... |
398 399 400 401 |
static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, const struct snd_pcm_substream *ss) { return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
f0fba2ad1 ASoC: multi-compo... |
402 |
dai->playback_dma_data : dai->capture_dma_data; |
fd23b7dee ASoC: move dma_da... |
403 404 405 406 407 408 409 |
} static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai, const struct snd_pcm_substream *ss, void *data) { if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) |
f0fba2ad1 ASoC: multi-compo... |
410 |
dai->playback_dma_data = data; |
fd23b7dee ASoC: move dma_da... |
411 |
else |
f0fba2ad1 ASoC: multi-compo... |
412 413 |
dai->capture_dma_data = data; } |
ecfc0c04f ASoC: dai: Provid... |
414 415 416 417 418 419 |
static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, void *playback, void *capture) { dai->playback_dma_data = playback; dai->capture_dma_data = capture; } |
f0fba2ad1 ASoC: multi-compo... |
420 421 422 423 424 425 426 427 428 |
static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai, void *data) { dev_set_drvdata(dai->dev, data); } static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) { return dev_get_drvdata(dai->dev); |
fd23b7dee ASoC: move dma_da... |
429 |
} |
97349b605 ASoC: Add SoundWi... |
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
/** * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation * @dai: DAI * @stream: STREAM * @direction: Stream direction(Playback/Capture) * SoundWire subsystem doesn't have a notion of direction and we reuse * the ASoC stream direction to configure sink/source ports. * Playback maps to source ports and Capture for sink ports. * * This should be invoked with NULL to clear the stream set previously. * Returns 0 on success, a negative error code otherwise. */ static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, void *stream, int direction) { if (dai->driver->ops->set_sdw_stream) return dai->driver->ops->set_sdw_stream(dai, stream, direction); else return -ENOTSUPP; } |
36d73c4a9 ASoC: soc-dai: ad... |
450 451 452 453 454 455 456 457 |
/** * snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI * @dai: DAI * @direction: Stream direction(Playback/Capture) * * This routine only retrieves that was previously configured * with snd_soc_dai_get_sdw_stream() * |
d20e834e1 ASoC: soc-dai: cl... |
458 459 |
* Returns pointer to stream or an ERR_PTR value, e.g. * ERR_PTR(-ENOTSUPP) if callback is not supported; |
36d73c4a9 ASoC: soc-dai: ad... |
460 461 462 463 464 465 466 |
*/ static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, int direction) { if (dai->driver->ops->get_sdw_stream) return dai->driver->ops->get_sdw_stream(dai, direction); else |
308811a32 ASoC: soc-dai: re... |
467 |
return ERR_PTR(-ENOTSUPP); |
36d73c4a9 ASoC: soc-dai: ad... |
468 |
} |
5552f8d72 ASoC: soc-dai: ad... |
469 470 471 472 473 |
static inline unsigned int snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream) { return dai->stream_active[stream]; } |
a47cbe726 ASoC: Move DAI st... |
474 |
#endif |