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
20struct 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
40struct 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
62struct 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
85struct 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
104struct 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
130struct 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
155int sdw_cdns_probe(struct sdw_cdns *cdns);
156extern struct sdw_master_ops sdw_cdns_master_ops;
157
158irqreturn_t sdw_cdns_irq(int irq, void *dev_id);
159irqreturn_t sdw_cdns_thread(int irq, void *dev_id);
160
161int sdw_cdns_init(struct sdw_cdns *cdns);
162int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
163 struct sdw_cdns_stream_config config);
164int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns);
165
166int sdw_cdns_get_stream(struct sdw_cdns *cdns,
167 struct sdw_cdns_streams *stream,
168 u32 ch, u32 dir);
169int sdw_cdns_alloc_stream(struct sdw_cdns *cdns,
170 struct sdw_cdns_streams *stream,
171 struct sdw_cdns_port *port, u32 ch, u32 dir);
172void sdw_cdns_config_stream(struct sdw_cdns *cdns, struct sdw_cdns_port *port,
173 u32 ch, u32 dir, struct sdw_cdns_pdi *pdi);
174
175void sdw_cdns_shutdown(struct snd_pcm_substream *substream,
176 struct snd_soc_dai *dai);
177int sdw_cdns_pcm_set_stream(struct snd_soc_dai *dai,
178 void *stream, int direction);
179int sdw_cdns_pdm_set_stream(struct snd_soc_dai *dai,
180 void *stream, int direction);
181
182enum sdw_command_response
183cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
184
185enum sdw_command_response
186cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg);
187
188enum sdw_command_response
189cdns_xfer_msg_defer(struct sdw_bus *bus,
190 struct sdw_msg *msg, struct sdw_defer *defer);
191
192enum sdw_command_response
193cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
194
195int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params);
196
197int cdns_set_sdw_stream(struct snd_soc_dai *dai,
198 void *stream, bool pcm, int direction);
199#endif
200