forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/soc/sh/rcar/rsnd.h
....@@ -42,144 +42,211 @@
4242 */
4343 enum rsnd_reg {
4444 /* SCU (MIX/CTU/DVC) */
45
- RSND_REG_SRC_I_BUSIF_MODE,
46
- RSND_REG_SRC_O_BUSIF_MODE,
47
- RSND_REG_SRC_ROUTE_MODE0,
48
- RSND_REG_SRC_SWRSR,
49
- RSND_REG_SRC_SRCIR,
50
- RSND_REG_SRC_ADINR,
51
- RSND_REG_SRC_IFSCR,
52
- RSND_REG_SRC_IFSVR,
53
- RSND_REG_SRC_SRCCR,
54
- RSND_REG_SRC_CTRL,
55
- RSND_REG_SRC_BSDSR,
56
- RSND_REG_SRC_BSISR,
57
- RSND_REG_SRC_INT_ENABLE0,
58
- RSND_REG_SRC_BUSIF_DALIGN,
59
- RSND_REG_SRCIN_TIMSEL0,
60
- RSND_REG_SRCIN_TIMSEL1,
61
- RSND_REG_SRCIN_TIMSEL2,
62
- RSND_REG_SRCIN_TIMSEL3,
63
- RSND_REG_SRCIN_TIMSEL4,
64
- RSND_REG_SRCOUT_TIMSEL0,
65
- RSND_REG_SRCOUT_TIMSEL1,
66
- RSND_REG_SRCOUT_TIMSEL2,
67
- RSND_REG_SRCOUT_TIMSEL3,
68
- RSND_REG_SRCOUT_TIMSEL4,
69
- RSND_REG_SCU_SYS_STATUS0,
70
- RSND_REG_SCU_SYS_STATUS1,
71
- RSND_REG_SCU_SYS_INT_EN0,
72
- RSND_REG_SCU_SYS_INT_EN1,
73
- RSND_REG_CMD_CTRL,
74
- RSND_REG_CMD_BUSIF_MODE,
75
- RSND_REG_CMD_BUSIF_DALIGN,
76
- RSND_REG_CMD_ROUTE_SLCT,
77
- RSND_REG_CMDOUT_TIMSEL,
78
- RSND_REG_CTU_SWRSR,
79
- RSND_REG_CTU_CTUIR,
80
- RSND_REG_CTU_ADINR,
81
- RSND_REG_CTU_CPMDR,
82
- RSND_REG_CTU_SCMDR,
83
- RSND_REG_CTU_SV00R,
84
- RSND_REG_CTU_SV01R,
85
- RSND_REG_CTU_SV02R,
86
- RSND_REG_CTU_SV03R,
87
- RSND_REG_CTU_SV04R,
88
- RSND_REG_CTU_SV05R,
89
- RSND_REG_CTU_SV06R,
90
- RSND_REG_CTU_SV07R,
91
- RSND_REG_CTU_SV10R,
92
- RSND_REG_CTU_SV11R,
93
- RSND_REG_CTU_SV12R,
94
- RSND_REG_CTU_SV13R,
95
- RSND_REG_CTU_SV14R,
96
- RSND_REG_CTU_SV15R,
97
- RSND_REG_CTU_SV16R,
98
- RSND_REG_CTU_SV17R,
99
- RSND_REG_CTU_SV20R,
100
- RSND_REG_CTU_SV21R,
101
- RSND_REG_CTU_SV22R,
102
- RSND_REG_CTU_SV23R,
103
- RSND_REG_CTU_SV24R,
104
- RSND_REG_CTU_SV25R,
105
- RSND_REG_CTU_SV26R,
106
- RSND_REG_CTU_SV27R,
107
- RSND_REG_CTU_SV30R,
108
- RSND_REG_CTU_SV31R,
109
- RSND_REG_CTU_SV32R,
110
- RSND_REG_CTU_SV33R,
111
- RSND_REG_CTU_SV34R,
112
- RSND_REG_CTU_SV35R,
113
- RSND_REG_CTU_SV36R,
114
- RSND_REG_CTU_SV37R,
115
- RSND_REG_MIX_SWRSR,
116
- RSND_REG_MIX_MIXIR,
117
- RSND_REG_MIX_ADINR,
118
- RSND_REG_MIX_MIXMR,
119
- RSND_REG_MIX_MVPDR,
120
- RSND_REG_MIX_MDBAR,
121
- RSND_REG_MIX_MDBBR,
122
- RSND_REG_MIX_MDBCR,
123
- RSND_REG_MIX_MDBDR,
124
- RSND_REG_MIX_MDBER,
125
- RSND_REG_DVC_SWRSR,
126
- RSND_REG_DVC_DVUIR,
127
- RSND_REG_DVC_ADINR,
128
- RSND_REG_DVC_DVUCR,
129
- RSND_REG_DVC_ZCMCR,
130
- RSND_REG_DVC_VOL0R,
131
- RSND_REG_DVC_VOL1R,
132
- RSND_REG_DVC_VOL2R,
133
- RSND_REG_DVC_VOL3R,
134
- RSND_REG_DVC_VOL4R,
135
- RSND_REG_DVC_VOL5R,
136
- RSND_REG_DVC_VOL6R,
137
- RSND_REG_DVC_VOL7R,
138
- RSND_REG_DVC_DVUER,
139
- RSND_REG_DVC_VRCTR,
140
- RSND_REG_DVC_VRPDR,
141
- RSND_REG_DVC_VRDBR,
45
+ SRC_I_BUSIF_MODE,
46
+ SRC_O_BUSIF_MODE,
47
+ SRC_ROUTE_MODE0,
48
+ SRC_SWRSR,
49
+ SRC_SRCIR,
50
+ SRC_ADINR,
51
+ SRC_IFSCR,
52
+ SRC_IFSVR,
53
+ SRC_SRCCR,
54
+ SRC_CTRL,
55
+ SRC_BSDSR,
56
+ SRC_BSISR,
57
+ SRC_INT_ENABLE0,
58
+ SRC_BUSIF_DALIGN,
59
+ SRCIN_TIMSEL0,
60
+ SRCIN_TIMSEL1,
61
+ SRCIN_TIMSEL2,
62
+ SRCIN_TIMSEL3,
63
+ SRCIN_TIMSEL4,
64
+ SRCOUT_TIMSEL0,
65
+ SRCOUT_TIMSEL1,
66
+ SRCOUT_TIMSEL2,
67
+ SRCOUT_TIMSEL3,
68
+ SRCOUT_TIMSEL4,
69
+ SCU_SYS_STATUS0,
70
+ SCU_SYS_STATUS1,
71
+ SCU_SYS_INT_EN0,
72
+ SCU_SYS_INT_EN1,
73
+ CMD_CTRL,
74
+ CMD_BUSIF_MODE,
75
+ CMD_BUSIF_DALIGN,
76
+ CMD_ROUTE_SLCT,
77
+ CMDOUT_TIMSEL,
78
+ CTU_SWRSR,
79
+ CTU_CTUIR,
80
+ CTU_ADINR,
81
+ CTU_CPMDR,
82
+ CTU_SCMDR,
83
+ CTU_SV00R,
84
+ CTU_SV01R,
85
+ CTU_SV02R,
86
+ CTU_SV03R,
87
+ CTU_SV04R,
88
+ CTU_SV05R,
89
+ CTU_SV06R,
90
+ CTU_SV07R,
91
+ CTU_SV10R,
92
+ CTU_SV11R,
93
+ CTU_SV12R,
94
+ CTU_SV13R,
95
+ CTU_SV14R,
96
+ CTU_SV15R,
97
+ CTU_SV16R,
98
+ CTU_SV17R,
99
+ CTU_SV20R,
100
+ CTU_SV21R,
101
+ CTU_SV22R,
102
+ CTU_SV23R,
103
+ CTU_SV24R,
104
+ CTU_SV25R,
105
+ CTU_SV26R,
106
+ CTU_SV27R,
107
+ CTU_SV30R,
108
+ CTU_SV31R,
109
+ CTU_SV32R,
110
+ CTU_SV33R,
111
+ CTU_SV34R,
112
+ CTU_SV35R,
113
+ CTU_SV36R,
114
+ CTU_SV37R,
115
+ MIX_SWRSR,
116
+ MIX_MIXIR,
117
+ MIX_ADINR,
118
+ MIX_MIXMR,
119
+ MIX_MVPDR,
120
+ MIX_MDBAR,
121
+ MIX_MDBBR,
122
+ MIX_MDBCR,
123
+ MIX_MDBDR,
124
+ MIX_MDBER,
125
+ DVC_SWRSR,
126
+ DVC_DVUIR,
127
+ DVC_ADINR,
128
+ DVC_DVUCR,
129
+ DVC_ZCMCR,
130
+ DVC_VOL0R,
131
+ DVC_VOL1R,
132
+ DVC_VOL2R,
133
+ DVC_VOL3R,
134
+ DVC_VOL4R,
135
+ DVC_VOL5R,
136
+ DVC_VOL6R,
137
+ DVC_VOL7R,
138
+ DVC_DVUER,
139
+ DVC_VRCTR,
140
+ DVC_VRPDR,
141
+ DVC_VRDBR,
142142
143143 /* ADG */
144
- RSND_REG_BRRA,
145
- RSND_REG_BRRB,
146
- RSND_REG_BRGCKR,
147
- RSND_REG_DIV_EN,
148
- RSND_REG_AUDIO_CLK_SEL0,
149
- RSND_REG_AUDIO_CLK_SEL1,
150
- RSND_REG_AUDIO_CLK_SEL2,
144
+ BRRA,
145
+ BRRB,
146
+ BRGCKR,
147
+ DIV_EN,
148
+ AUDIO_CLK_SEL0,
149
+ AUDIO_CLK_SEL1,
150
+ AUDIO_CLK_SEL2,
151151
152152 /* SSIU */
153
- RSND_REG_SSI_MODE,
154
- RSND_REG_SSI_MODE0,
155
- RSND_REG_SSI_MODE1,
156
- RSND_REG_SSI_MODE2,
157
- RSND_REG_SSI_CONTROL,
158
- RSND_REG_SSI_CTRL,
159
- RSND_REG_SSI_BUSIF_MODE,
160
- RSND_REG_SSI_BUSIF_ADINR,
161
- RSND_REG_SSI_BUSIF_DALIGN,
162
- RSND_REG_SSI_INT_ENABLE,
163
- RSND_REG_SSI_SYS_STATUS0,
164
- RSND_REG_SSI_SYS_STATUS1,
165
- RSND_REG_SSI_SYS_STATUS2,
166
- RSND_REG_SSI_SYS_STATUS3,
167
- RSND_REG_SSI_SYS_STATUS4,
168
- RSND_REG_SSI_SYS_STATUS5,
169
- RSND_REG_SSI_SYS_STATUS6,
170
- RSND_REG_SSI_SYS_STATUS7,
171
- RSND_REG_HDMI0_SEL,
172
- RSND_REG_HDMI1_SEL,
153
+ SSI_MODE,
154
+ SSI_MODE0,
155
+ SSI_MODE1,
156
+ SSI_MODE2,
157
+ SSI_CONTROL,
158
+ SSI_CTRL,
159
+ SSI_BUSIF0_MODE,
160
+ SSI_BUSIF1_MODE,
161
+ SSI_BUSIF2_MODE,
162
+ SSI_BUSIF3_MODE,
163
+ SSI_BUSIF4_MODE,
164
+ SSI_BUSIF5_MODE,
165
+ SSI_BUSIF6_MODE,
166
+ SSI_BUSIF7_MODE,
167
+ SSI_BUSIF0_ADINR,
168
+ SSI_BUSIF1_ADINR,
169
+ SSI_BUSIF2_ADINR,
170
+ SSI_BUSIF3_ADINR,
171
+ SSI_BUSIF4_ADINR,
172
+ SSI_BUSIF5_ADINR,
173
+ SSI_BUSIF6_ADINR,
174
+ SSI_BUSIF7_ADINR,
175
+ SSI_BUSIF0_DALIGN,
176
+ SSI_BUSIF1_DALIGN,
177
+ SSI_BUSIF2_DALIGN,
178
+ SSI_BUSIF3_DALIGN,
179
+ SSI_BUSIF4_DALIGN,
180
+ SSI_BUSIF5_DALIGN,
181
+ SSI_BUSIF6_DALIGN,
182
+ SSI_BUSIF7_DALIGN,
183
+ SSI_INT_ENABLE,
184
+ SSI_SYS_STATUS0,
185
+ SSI_SYS_STATUS1,
186
+ SSI_SYS_STATUS2,
187
+ SSI_SYS_STATUS3,
188
+ SSI_SYS_STATUS4,
189
+ SSI_SYS_STATUS5,
190
+ SSI_SYS_STATUS6,
191
+ SSI_SYS_STATUS7,
192
+ SSI_SYS_INT_ENABLE0,
193
+ SSI_SYS_INT_ENABLE1,
194
+ SSI_SYS_INT_ENABLE2,
195
+ SSI_SYS_INT_ENABLE3,
196
+ SSI_SYS_INT_ENABLE4,
197
+ SSI_SYS_INT_ENABLE5,
198
+ SSI_SYS_INT_ENABLE6,
199
+ SSI_SYS_INT_ENABLE7,
200
+ HDMI0_SEL,
201
+ HDMI1_SEL,
202
+ SSI9_BUSIF0_MODE,
203
+ SSI9_BUSIF1_MODE,
204
+ SSI9_BUSIF2_MODE,
205
+ SSI9_BUSIF3_MODE,
206
+ SSI9_BUSIF4_MODE,
207
+ SSI9_BUSIF5_MODE,
208
+ SSI9_BUSIF6_MODE,
209
+ SSI9_BUSIF7_MODE,
210
+ SSI9_BUSIF0_ADINR,
211
+ SSI9_BUSIF1_ADINR,
212
+ SSI9_BUSIF2_ADINR,
213
+ SSI9_BUSIF3_ADINR,
214
+ SSI9_BUSIF4_ADINR,
215
+ SSI9_BUSIF5_ADINR,
216
+ SSI9_BUSIF6_ADINR,
217
+ SSI9_BUSIF7_ADINR,
218
+ SSI9_BUSIF0_DALIGN,
219
+ SSI9_BUSIF1_DALIGN,
220
+ SSI9_BUSIF2_DALIGN,
221
+ SSI9_BUSIF3_DALIGN,
222
+ SSI9_BUSIF4_DALIGN,
223
+ SSI9_BUSIF5_DALIGN,
224
+ SSI9_BUSIF6_DALIGN,
225
+ SSI9_BUSIF7_DALIGN,
173226
174227 /* SSI */
175
- RSND_REG_SSICR,
176
- RSND_REG_SSISR,
177
- RSND_REG_SSITDR,
178
- RSND_REG_SSIRDR,
179
- RSND_REG_SSIWSR,
228
+ SSICR,
229
+ SSISR,
230
+ SSITDR,
231
+ SSIRDR,
232
+ SSIWSR,
180233
181
- RSND_REG_MAX,
234
+ REG_MAX,
182235 };
236
+#define SRCIN_TIMSEL(i) (SRCIN_TIMSEL0 + (i))
237
+#define SRCOUT_TIMSEL(i) (SRCOUT_TIMSEL0 + (i))
238
+#define CTU_SVxxR(i, j) (CTU_SV00R + (i * 8) + (j))
239
+#define DVC_VOLxR(i) (DVC_VOL0R + (i))
240
+#define AUDIO_CLK_SEL(i) (AUDIO_CLK_SEL0 + (i))
241
+#define SSI_BUSIF_MODE(i) (SSI_BUSIF0_MODE + (i))
242
+#define SSI_BUSIF_ADINR(i) (SSI_BUSIF0_ADINR + (i))
243
+#define SSI_BUSIF_DALIGN(i) (SSI_BUSIF0_DALIGN + (i))
244
+#define SSI9_BUSIF_MODE(i) (SSI9_BUSIF0_MODE + (i))
245
+#define SSI9_BUSIF_ADINR(i) (SSI9_BUSIF0_ADINR + (i))
246
+#define SSI9_BUSIF_DALIGN(i) (SSI9_BUSIF0_DALIGN + (i))
247
+#define SSI_SYS_STATUS(i) (SSI_SYS_STATUS0 + (i))
248
+#define SSI_SYS_INT_ENABLE(i) (SSI_SYS_INT_ENABLE0 + (i))
249
+
183250
184251 struct rsnd_priv;
185252 struct rsnd_mod;
....@@ -189,20 +256,9 @@
189256 /*
190257 * R-Car basic functions
191258 */
192
-#define rsnd_mod_read(m, r) \
193
- rsnd_read(rsnd_mod_to_priv(m), m, RSND_REG_##r)
194
-#define rsnd_mod_write(m, r, d) \
195
- rsnd_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
196
-#define rsnd_mod_bset(m, r, s, d) \
197
- rsnd_bset(rsnd_mod_to_priv(m), m, RSND_REG_##r, s, d)
198
-
199
-u32 rsnd_read(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg);
200
-void rsnd_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
201
- enum rsnd_reg reg, u32 data);
202
-void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
203
- enum rsnd_reg reg, u32 data);
204
-void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
205
- u32 mask, u32 data);
259
+u32 rsnd_mod_read(struct rsnd_mod *mod, enum rsnd_reg reg);
260
+void rsnd_mod_write(struct rsnd_mod *mod, enum rsnd_reg reg, u32 data);
261
+void rsnd_mod_bset(struct rsnd_mod *mod, enum rsnd_reg reg, u32 mask, u32 data);
206262 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
207263 u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
208264 u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
....@@ -274,15 +330,21 @@
274330 int (*fallback)(struct rsnd_mod *mod,
275331 struct rsnd_dai_stream *io,
276332 struct rsnd_priv *priv);
277
- int (*nolock_start)(struct rsnd_mod *mod,
278
- struct rsnd_dai_stream *io,
279
- struct rsnd_priv *priv);
280
- int (*nolock_stop)(struct rsnd_mod *mod,
281
- struct rsnd_dai_stream *io,
282
- struct rsnd_priv *priv);
283333 int (*prepare)(struct rsnd_mod *mod,
284334 struct rsnd_dai_stream *io,
285335 struct rsnd_priv *priv);
336
+ int (*cleanup)(struct rsnd_mod *mod,
337
+ struct rsnd_dai_stream *io,
338
+ struct rsnd_priv *priv);
339
+ int (*hw_free)(struct rsnd_mod *mod,
340
+ struct rsnd_dai_stream *io,
341
+ struct snd_pcm_substream *substream);
342
+ u32 *(*get_status)(struct rsnd_mod *mod,
343
+ struct rsnd_dai_stream *io,
344
+ enum rsnd_mod_type type);
345
+ int (*id)(struct rsnd_mod *mod);
346
+ int (*id_sub)(struct rsnd_mod *mod);
347
+ int (*id_cmd)(struct rsnd_mod *mod);
286348 };
287349
288350 struct rsnd_dai_stream;
....@@ -292,60 +354,59 @@
292354 struct rsnd_mod_ops *ops;
293355 struct rsnd_priv *priv;
294356 struct clk *clk;
295
- u32 *(*get_status)(struct rsnd_dai_stream *io,
296
- struct rsnd_mod *mod,
297
- enum rsnd_mod_type type);
298357 u32 status;
299358 };
300359 /*
301360 * status
302361 *
303
- * 0xH0000CBA
362
+ * 0xH0000CB0
304363 *
305
- * A 0: nolock_start 1: nolock_stop
306364 * B 0: init 1: quit
307365 * C 0: start 1: stop
366
+ * D 0: hw_params 1: hw_free
308367 *
309368 * H is always called (see __rsnd_mod_call)
310369 * H 0: probe 1: remove
311370 * H 0: pcm_new
312371 * H 0: fallback
313
- * H 0: hw_params
314372 * H 0: pointer
315373 * H 0: prepare
374
+ * H 0: cleanup
316375 */
317
-#define __rsnd_mod_shift_nolock_start 0
318
-#define __rsnd_mod_shift_nolock_stop 0
319376 #define __rsnd_mod_shift_init 4
320377 #define __rsnd_mod_shift_quit 4
321378 #define __rsnd_mod_shift_start 8
322379 #define __rsnd_mod_shift_stop 8
380
+#define __rsnd_mod_shift_hw_params 12
381
+#define __rsnd_mod_shift_hw_free 12
323382 #define __rsnd_mod_shift_probe 28 /* always called */
324383 #define __rsnd_mod_shift_remove 28 /* always called */
325384 #define __rsnd_mod_shift_irq 28 /* always called */
326385 #define __rsnd_mod_shift_pcm_new 28 /* always called */
327386 #define __rsnd_mod_shift_fallback 28 /* always called */
328
-#define __rsnd_mod_shift_hw_params 28 /* always called */
329387 #define __rsnd_mod_shift_pointer 28 /* always called */
330388 #define __rsnd_mod_shift_prepare 28 /* always called */
389
+#define __rsnd_mod_shift_cleanup 28 /* always called */
331390
332391 #define __rsnd_mod_add_probe 0
333392 #define __rsnd_mod_add_remove 0
334
-#define __rsnd_mod_add_nolock_start 1
335
-#define __rsnd_mod_add_nolock_stop -1
393
+#define __rsnd_mod_add_prepare 0
394
+#define __rsnd_mod_add_cleanup 0
336395 #define __rsnd_mod_add_init 1
337396 #define __rsnd_mod_add_quit -1
338397 #define __rsnd_mod_add_start 1
339398 #define __rsnd_mod_add_stop -1
399
+#define __rsnd_mod_add_hw_params 1
400
+#define __rsnd_mod_add_hw_free -1
340401 #define __rsnd_mod_add_irq 0
341402 #define __rsnd_mod_add_pcm_new 0
342403 #define __rsnd_mod_add_fallback 0
343
-#define __rsnd_mod_add_hw_params 0
344404 #define __rsnd_mod_add_pointer 0
345
-#define __rsnd_mod_add_prepare 0
346405
347406 #define __rsnd_mod_call_probe 0
348407 #define __rsnd_mod_call_remove 0
408
+#define __rsnd_mod_call_prepare 0
409
+#define __rsnd_mod_call_cleanup 0
349410 #define __rsnd_mod_call_init 0
350411 #define __rsnd_mod_call_quit 1
351412 #define __rsnd_mod_call_start 0
....@@ -355,13 +416,9 @@
355416 #define __rsnd_mod_call_fallback 0
356417 #define __rsnd_mod_call_hw_params 0
357418 #define __rsnd_mod_call_pointer 0
358
-#define __rsnd_mod_call_nolock_start 0
359
-#define __rsnd_mod_call_nolock_stop 1
360
-#define __rsnd_mod_call_prepare 0
419
+#define __rsnd_mod_call_hw_free 1
361420
362421 #define rsnd_mod_to_priv(mod) ((mod)->priv)
363
-#define rsnd_mod_name(mod) ((mod)->ops->name)
364
-#define rsnd_mod_id(mod) ((mod)->id)
365422 #define rsnd_mod_power_on(mod) clk_enable((mod)->clk)
366423 #define rsnd_mod_power_off(mod) clk_disable((mod)->clk)
367424 #define rsnd_mod_get(ip) (&(ip)->mod)
....@@ -370,9 +427,6 @@
370427 struct rsnd_mod *mod,
371428 struct rsnd_mod_ops *ops,
372429 struct clk *clk,
373
- u32* (*get_status)(struct rsnd_dai_stream *io,
374
- struct rsnd_mod *mod,
375
- enum rsnd_mod_type type),
376430 enum rsnd_mod_type type,
377431 int id);
378432 void rsnd_mod_quit(struct rsnd_mod *mod);
....@@ -381,9 +435,13 @@
381435 void rsnd_mod_interrupt(struct rsnd_mod *mod,
382436 void (*callback)(struct rsnd_mod *mod,
383437 struct rsnd_dai_stream *io));
384
-u32 *rsnd_mod_get_status(struct rsnd_dai_stream *io,
385
- struct rsnd_mod *mod,
438
+u32 *rsnd_mod_get_status(struct rsnd_mod *mod,
439
+ struct rsnd_dai_stream *io,
386440 enum rsnd_mod_type type);
441
+int rsnd_mod_id(struct rsnd_mod *mod);
442
+int rsnd_mod_id_raw(struct rsnd_mod *mod);
443
+int rsnd_mod_id_sub(struct rsnd_mod *mod);
444
+char *rsnd_mod_name(struct rsnd_mod *mod);
387445 struct rsnd_mod *rsnd_mod_next(int *iterator,
388446 struct rsnd_dai_stream *io,
389447 enum rsnd_mod_type *array,
....@@ -403,6 +461,7 @@
403461 struct device_node *playback,
404462 struct device_node *capture);
405463
464
+int rsnd_channel_normalization(int chan);
406465 #define rsnd_runtime_channel_original(io) \
407466 rsnd_runtime_channel_original_with_params(io, NULL)
408467 int rsnd_runtime_channel_original_with_params(struct rsnd_dai_stream *io,
....@@ -415,8 +474,9 @@
415474 rsnd_runtime_channel_for_ssi_with_params(io, NULL)
416475 int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,
417476 struct snd_pcm_hw_params *params);
418
-int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io);
419
-int rsnd_runtime_is_ssi_tdm(struct rsnd_dai_stream *io);
477
+int rsnd_runtime_is_multi_ssi(struct rsnd_dai_stream *io);
478
+int rsnd_runtime_is_tdm(struct rsnd_dai_stream *io);
479
+int rsnd_runtime_is_tdm_split(struct rsnd_dai_stream *io);
420480
421481 /*
422482 * DT
....@@ -425,6 +485,7 @@
425485 of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, node)
426486 #define RSND_NODE_DAI "rcar_sound,dai"
427487 #define RSND_NODE_SSI "rcar_sound,ssi"
488
+#define RSND_NODE_SSIU "rcar_sound,ssiu"
428489 #define RSND_NODE_SRC "rcar_sound,src"
429490 #define RSND_NODE_CTU "rcar_sound,ctu"
430491 #define RSND_NODE_MIX "rcar_sound,mix"
....@@ -441,8 +502,17 @@
441502 struct rsnd_mod *dma;
442503 struct rsnd_dai *rdai;
443504 struct device *dmac_dev; /* for IPMMU */
505
+ u32 converted_rate; /* converted sampling rate */
506
+ int converted_chan; /* converted channels */
444507 u32 parent_ssi_status;
508
+ u32 flags;
445509 };
510
+
511
+/* flags */
512
+#define RSND_STREAM_HDMI0 (1 << 0) /* for HDMI0 */
513
+#define RSND_STREAM_HDMI1 (1 << 1) /* for HDMI1 */
514
+#define RSND_STREAM_TDM_SPLIT (1 << 2) /* for TDM split mode */
515
+
446516 #define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
447517 #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
448518 #define rsnd_io_to_mod_ssiu(io) rsnd_io_to_mod((io), RSND_MOD_SSIU)
....@@ -457,6 +527,8 @@
457527 #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io)
458528 #define rsnd_io_to_runtime(io) ((io)->substream ? \
459529 (io)->substream->runtime : NULL)
530
+#define rsnd_io_converted_rate(io) ((io)->converted_rate)
531
+#define rsnd_io_converted_chan(io) ((io)->converted_chan)
460532 int rsnd_io_is_working(struct rsnd_dai_stream *io);
461533
462534 struct rsnd_dai {
....@@ -468,6 +540,7 @@
468540
469541 int max_channels; /* 2ch - 16ch */
470542 int ssi_lane; /* 1lane - 4lane */
543
+ int chan_width; /* 16/24/32 bit width */
471544
472545 unsigned int clk_master:1;
473546 unsigned int bit_clk_inv:1;
....@@ -501,6 +574,11 @@
501574 int rsnd_rdai_ssi_lane_ctrl(struct rsnd_dai *rdai,
502575 int ssi_lane);
503576
577
+#define rsnd_rdai_width_set(rdai, width) \
578
+ rsnd_rdai_width_ctrl(rdai, width)
579
+#define rsnd_rdai_width_get(rdai) \
580
+ rsnd_rdai_width_ctrl(rdai, 0)
581
+int rsnd_rdai_width_ctrl(struct rsnd_dai *rdai, int width);
504582 void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io);
505583 int rsnd_dai_connect(struct rsnd_mod *mod,
506584 struct rsnd_dai_stream *io,
....@@ -545,6 +623,8 @@
545623 #define RSND_GEN1 (1 << 0)
546624 #define RSND_GEN2 (2 << 0)
547625 #define RSND_GEN3 (3 << 0)
626
+#define RSND_SOC_MASK (0xFF << 4)
627
+#define RSND_SOC_E (1 << 4) /* E1/E2/E3 */
548628
549629 /*
550630 * below value will be filled on rsnd_gen_probe()
....@@ -617,6 +697,9 @@
617697 #define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1)
618698 #define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2)
619699 #define rsnd_is_gen3(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN3)
700
+#define rsnd_is_e3(priv) (((priv)->flags & \
701
+ (RSND_GEN_MASK | RSND_SOC_MASK)) == \
702
+ (RSND_GEN3 | RSND_SOC_E))
620703
621704 #define rsnd_flags_has(p, f) ((p)->flags & (f))
622705 #define rsnd_flags_set(p, f) ((p)->flags |= (f))
....@@ -691,16 +774,8 @@
691774 int rsnd_ssi_probe(struct rsnd_priv *priv);
692775 void rsnd_ssi_remove(struct rsnd_priv *priv);
693776 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
694
-int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
695777 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
696
-u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io);
697
-
698
-#define RSND_SSI_HDMI_PORT0 0xf0
699
-#define RSND_SSI_HDMI_PORT1 0xf1
700
-int rsnd_ssi_hdmi_port(struct rsnd_dai_stream *io);
701
-void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
702
- struct device_node *endpoint,
703
- int dai_i);
778
+u32 rsnd_ssi_multi_secondaries_runtime(struct rsnd_dai_stream *io);
704779
705780 #define rsnd_ssi_is_pin_sharing(io) \
706781 __rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
....@@ -710,7 +785,7 @@
710785 void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
711786 struct device_node *playback,
712787 struct device_node *capture);
713
-unsigned int rsnd_ssi_clk_query(struct rsnd_priv *priv,
788
+unsigned int rsnd_ssi_clk_query(struct rsnd_dai *rdai,
714789 int param1, int param2, int *idx);
715790
716791 /*
....@@ -720,6 +795,10 @@
720795 struct rsnd_mod *mod);
721796 int rsnd_ssiu_probe(struct rsnd_priv *priv);
722797 void rsnd_ssiu_remove(struct rsnd_priv *priv);
798
+void rsnd_parse_connect_ssiu(struct rsnd_dai *rdai,
799
+ struct device_node *playback,
800
+ struct device_node *capture);
801
+#define rsnd_ssiu_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_SSIU)
723802
724803 /*
725804 * R-Car SRC
....@@ -745,7 +824,6 @@
745824 */
746825 int rsnd_ctu_probe(struct rsnd_priv *priv);
747826 void rsnd_ctu_remove(struct rsnd_priv *priv);
748
-int rsnd_ctu_converted_channel(struct rsnd_mod *mod);
749827 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
750828 #define rsnd_ctu_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_CTU)
751829 #define rsnd_parse_connect_ctu(rdai, playback, capture) \