1
2
3
4
5
6
7
8
9
10
11#ifndef __LINUX_SND_SOC_DPCM_H
12#define __LINUX_SND_SOC_DPCM_H
13
14#include <linux/slab.h>
15#include <linux/list.h>
16#include <sound/pcm.h>
17
18struct snd_soc_pcm_runtime;
19
20
21
22
23
24enum snd_soc_dpcm_update {
25 SND_SOC_DPCM_UPDATE_NO = 0,
26 SND_SOC_DPCM_UPDATE_BE,
27 SND_SOC_DPCM_UPDATE_FE,
28};
29
30
31
32
33enum snd_soc_dpcm_link_state {
34 SND_SOC_DPCM_LINK_STATE_NEW = 0,
35 SND_SOC_DPCM_LINK_STATE_FREE,
36};
37
38
39
40
41enum snd_soc_dpcm_state {
42 SND_SOC_DPCM_STATE_NEW = 0,
43 SND_SOC_DPCM_STATE_OPEN,
44 SND_SOC_DPCM_STATE_HW_PARAMS,
45 SND_SOC_DPCM_STATE_PREPARE,
46 SND_SOC_DPCM_STATE_START,
47 SND_SOC_DPCM_STATE_STOP,
48 SND_SOC_DPCM_STATE_PAUSED,
49 SND_SOC_DPCM_STATE_SUSPEND,
50 SND_SOC_DPCM_STATE_HW_FREE,
51 SND_SOC_DPCM_STATE_CLOSE,
52};
53
54
55
56
57
58
59
60
61enum snd_soc_dpcm_trigger {
62 SND_SOC_DPCM_TRIGGER_PRE = 0,
63 SND_SOC_DPCM_TRIGGER_POST,
64 SND_SOC_DPCM_TRIGGER_BESPOKE,
65};
66
67
68
69
70
71
72struct snd_soc_dpcm {
73
74 struct snd_soc_pcm_runtime *be;
75 struct snd_soc_pcm_runtime *fe;
76
77
78 enum snd_soc_dpcm_link_state state;
79
80
81 struct list_head list_be;
82 struct list_head list_fe;
83
84
85 struct snd_pcm_hw_params hw_params;
86#ifdef CONFIG_DEBUG_FS
87 struct dentry *debugfs_state;
88#endif
89};
90
91
92
93
94struct snd_soc_dpcm_runtime {
95 struct list_head be_clients;
96 struct list_head fe_clients;
97
98 int users;
99 struct snd_pcm_runtime *runtime;
100 struct snd_pcm_hw_params hw_params;
101
102
103 enum snd_soc_dpcm_update runtime_update;
104 enum snd_soc_dpcm_state state;
105};
106
107
108int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe,
109 struct snd_soc_pcm_runtime *be, int stream);
110
111
112int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe,
113 struct snd_soc_pcm_runtime *be, int stream);
114
115
116int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream);
117
118
119int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe,
120 struct snd_soc_pcm_runtime *be, int stream);
121
122
123struct snd_pcm_substream *
124 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream);
125
126
127enum snd_soc_dpcm_state
128 snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream);
129
130
131void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream,
132 enum snd_soc_dpcm_state state);
133
134
135int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
136int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
137int soc_dpcm_runtime_update(struct snd_soc_card *);
138
139int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
140 int stream, struct snd_soc_dapm_widget_list **list_);
141int dpcm_process_paths(struct snd_soc_pcm_runtime *fe,
142 int stream, struct snd_soc_dapm_widget_list **list, int new);
143int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream);
144int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream);
145void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream);
146void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream);
147int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream);
148int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int tream);
149int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, int cmd);
150int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream);
151int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
152 int event);
153
154static inline void dpcm_path_put(struct snd_soc_dapm_widget_list **list)
155{
156 kfree(*list);
157}
158
159
160#endif
161