1
2
3 #include <sound/soc.h>
4
5 #ifndef __SDW_CADENCE_H
6 #define __SDW_CADENCE_H
7
8
9
10
11
12
13
14
15
16
17
18
19
20 struct sdw_cdns_pdi {
21 bool assigned;
22 int num;
23 int intel_alh_id;
24 int l_ch_num;
25 int h_ch_num;
26 int ch_count;
27 enum sdw_data_direction dir;
28 enum sdw_stream_type type;
29 };
30
31
32
33
34
35
36
37
38
39
40 struct sdw_cdns_port {
41 unsigned int num;
42 bool assigned;
43 unsigned int ch;
44 enum sdw_data_direction direction;
45 struct sdw_cdns_pdi *pdi;
46 };
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 struct sdw_cdns_streams {
63 unsigned int num_bd;
64 unsigned int num_in;
65 unsigned int num_out;
66 unsigned int num_ch_bd;
67 unsigned int num_ch_in;
68 unsigned int num_ch_out;
69 unsigned int num_pdi;
70 struct sdw_cdns_pdi *bd;
71 struct sdw_cdns_pdi *in;
72 struct sdw_cdns_pdi *out;
73 };
74
75
76
77
78
79
80
81
82
83
84
85 struct sdw_cdns_stream_config {
86 unsigned int pcm_bd;
87 unsigned int pcm_in;
88 unsigned int pcm_out;
89 unsigned int pdm_bd;
90 unsigned int pdm_in;
91 unsigned int pdm_out;
92 };
93
94
95
96
97
98
99
100
101
102
103
104 struct sdw_cdns_dma_data {
105 char *name;
106 struct sdw_stream_runtime *stream;
107 int nr_ports;
108 struct sdw_cdns_port **port;
109 struct sdw_bus *bus;
110 enum sdw_stream_type stream_type;
111 int link_id;
112 };
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130 struct sdw_cdns {
131 struct device *dev;
132 struct sdw_bus bus;
133 unsigned int instance;
134
135 u32 response_buf[0x80];
136 struct completion tx_complete;
137 struct sdw_defer *defer;
138
139 struct sdw_cdns_port *ports;
140 int num_ports;
141
142 struct sdw_cdns_streams pcm;
143 struct sdw_cdns_streams pdm;
144
145 void __iomem *registers;
146
147 bool link_up;
148 unsigned int msg_count;
149 };
150
151 #define bus_to_cdns(_bus) container_of(_bus, struct sdw_cdns, bus)
152
153
154
155 int sdw_cdns_probe(struct sdw_cdns *cdns);
156 extern struct sdw_master_ops sdw_cdns_master_ops;
157
158 irqreturn_t sdw_cdns_irq(int irq, void *dev_id);
159 irqreturn_t sdw_cdns_thread(int irq, void *dev_id);
160
161 int sdw_cdns_init(struct sdw_cdns *cdns);
162 int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
163 struct sdw_cdns_stream_config config);
164 int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns);
165
166 #ifdef CONFIG_DEBUG_FS
167 void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root);
168 #endif
169
170 int sdw_cdns_get_stream(struct sdw_cdns *cdns,
171 struct sdw_cdns_streams *stream,
172 u32 ch, u32 dir);
173 int sdw_cdns_alloc_stream(struct sdw_cdns *cdns,
174 struct sdw_cdns_streams *stream,
175 struct sdw_cdns_port *port, u32 ch, u32 dir);
176 void sdw_cdns_config_stream(struct sdw_cdns *cdns, struct sdw_cdns_port *port,
177 u32 ch, u32 dir, struct sdw_cdns_pdi *pdi);
178
179 int sdw_cdns_pcm_set_stream(struct snd_soc_dai *dai,
180 void *stream, int direction);
181 int sdw_cdns_pdm_set_stream(struct snd_soc_dai *dai,
182 void *stream, int direction);
183
184 enum sdw_command_response
185 cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
186
187 enum sdw_command_response
188 cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg);
189
190 enum sdw_command_response
191 cdns_xfer_msg_defer(struct sdw_bus *bus,
192 struct sdw_msg *msg, struct sdw_defer *defer);
193
194 enum sdw_command_response
195 cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
196
197 int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params);
198
199 int cdns_set_sdw_stream(struct snd_soc_dai *dai,
200 void *stream, bool pcm, int direction);
201 #endif