xref: /openbmc/linux/sound/soc/sh/rcar/rsnd.h (revision 497debaa)
1 /*
2  * Renesas R-Car
3  *
4  * Copyright (C) 2013 Renesas Solutions Corp.
5  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 #ifndef RSND_H
12 #define RSND_H
13 
14 #include <linux/clk.h>
15 #include <linux/device.h>
16 #include <linux/dma-mapping.h>
17 #include <linux/io.h>
18 #include <linux/list.h>
19 #include <linux/module.h>
20 #include <linux/of_device.h>
21 #include <linux/of_irq.h>
22 #include <linux/sh_dma.h>
23 #include <linux/workqueue.h>
24 #include <sound/soc.h>
25 #include <sound/pcm_params.h>
26 
27 #include "rcar_snd.h"
28 
29 /*
30  *	pseudo register
31  *
32  * The register address offsets SRU/SCU/SSIU on Gen1/Gen2 are very different.
33  * This driver uses pseudo register in order to hide it.
34  * see gen1/gen2 for detail
35  */
36 enum rsnd_reg {
37 	/* SRU/SCU/SSIU */
38 	RSND_REG_SSI_MODE0,
39 	RSND_REG_SSI_MODE1,
40 	RSND_REG_SRC_BUSIF_MODE,
41 	RSND_REG_SRC_ROUTE_MODE0,
42 	RSND_REG_SRC_SWRSR,
43 	RSND_REG_SRC_SRCIR,
44 	RSND_REG_SRC_ADINR,
45 	RSND_REG_SRC_IFSCR,
46 	RSND_REG_SRC_IFSVR,
47 	RSND_REG_SRC_SRCCR,
48 	RSND_REG_SCU_SYS_STATUS0,
49 	RSND_REG_SCU_SYS_INT_EN0,
50 	RSND_REG_CMD_ROUTE_SLCT,
51 	RSND_REG_CTU_CTUIR,
52 	RSND_REG_CTU_ADINR,
53 	RSND_REG_MIX_SWRSR,
54 	RSND_REG_MIX_MIXIR,
55 	RSND_REG_MIX_ADINR,
56 	RSND_REG_MIX_MIXMR,
57 	RSND_REG_MIX_MVPDR,
58 	RSND_REG_MIX_MDBAR,
59 	RSND_REG_MIX_MDBBR,
60 	RSND_REG_MIX_MDBCR,
61 	RSND_REG_MIX_MDBDR,
62 	RSND_REG_MIX_MDBER,
63 	RSND_REG_DVC_SWRSR,
64 	RSND_REG_DVC_DVUIR,
65 	RSND_REG_DVC_ADINR,
66 	RSND_REG_DVC_DVUCR,
67 	RSND_REG_DVC_ZCMCR,
68 	RSND_REG_DVC_VOL0R,
69 	RSND_REG_DVC_VOL1R,
70 	RSND_REG_DVC_DVUER,
71 
72 	/* ADG */
73 	RSND_REG_BRRA,
74 	RSND_REG_BRRB,
75 	RSND_REG_SSICKR,
76 	RSND_REG_AUDIO_CLK_SEL0,
77 	RSND_REG_AUDIO_CLK_SEL1,
78 
79 	/* SSI */
80 	RSND_REG_SSICR,
81 	RSND_REG_SSISR,
82 	RSND_REG_SSITDR,
83 	RSND_REG_SSIRDR,
84 	RSND_REG_SSIWSR,
85 
86 	/* SHARE see below */
87 	RSND_REG_SHARE01,
88 	RSND_REG_SHARE02,
89 	RSND_REG_SHARE03,
90 	RSND_REG_SHARE04,
91 	RSND_REG_SHARE05,
92 	RSND_REG_SHARE06,
93 	RSND_REG_SHARE07,
94 	RSND_REG_SHARE08,
95 	RSND_REG_SHARE09,
96 	RSND_REG_SHARE10,
97 	RSND_REG_SHARE11,
98 	RSND_REG_SHARE12,
99 	RSND_REG_SHARE13,
100 	RSND_REG_SHARE14,
101 	RSND_REG_SHARE15,
102 	RSND_REG_SHARE16,
103 	RSND_REG_SHARE17,
104 	RSND_REG_SHARE18,
105 	RSND_REG_SHARE19,
106 	RSND_REG_SHARE20,
107 	RSND_REG_SHARE21,
108 	RSND_REG_SHARE22,
109 	RSND_REG_SHARE23,
110 	RSND_REG_SHARE24,
111 	RSND_REG_SHARE25,
112 	RSND_REG_SHARE26,
113 	RSND_REG_SHARE27,
114 	RSND_REG_SHARE28,
115 	RSND_REG_SHARE29,
116 
117 	RSND_REG_MAX,
118 };
119 
120 /* Gen1 only */
121 #define RSND_REG_SRC_ROUTE_SEL		RSND_REG_SHARE01
122 #define RSND_REG_SRC_TMG_SEL0		RSND_REG_SHARE02
123 #define RSND_REG_SRC_TMG_SEL1		RSND_REG_SHARE03
124 #define RSND_REG_SRC_TMG_SEL2		RSND_REG_SHARE04
125 #define RSND_REG_SRC_ROUTE_CTRL		RSND_REG_SHARE05
126 #define RSND_REG_SRC_MNFSR		RSND_REG_SHARE06
127 #define RSND_REG_AUDIO_CLK_SEL3		RSND_REG_SHARE07
128 #define RSND_REG_AUDIO_CLK_SEL4		RSND_REG_SHARE08
129 #define RSND_REG_AUDIO_CLK_SEL5		RSND_REG_SHARE09
130 
131 /* Gen2 only */
132 #define RSND_REG_SRC_CTRL		RSND_REG_SHARE01
133 #define RSND_REG_SSI_CTRL		RSND_REG_SHARE02
134 #define RSND_REG_SSI_BUSIF_MODE		RSND_REG_SHARE03
135 #define RSND_REG_SSI_BUSIF_ADINR	RSND_REG_SHARE04
136 #define RSND_REG_SSI_INT_ENABLE		RSND_REG_SHARE05
137 #define RSND_REG_SRC_BSDSR		RSND_REG_SHARE06
138 #define RSND_REG_SRC_BSISR		RSND_REG_SHARE07
139 #define RSND_REG_DIV_EN			RSND_REG_SHARE08
140 #define RSND_REG_SRCIN_TIMSEL0		RSND_REG_SHARE09
141 #define RSND_REG_SRCIN_TIMSEL1		RSND_REG_SHARE10
142 #define RSND_REG_SRCIN_TIMSEL2		RSND_REG_SHARE11
143 #define RSND_REG_SRCIN_TIMSEL3		RSND_REG_SHARE12
144 #define RSND_REG_SRCIN_TIMSEL4		RSND_REG_SHARE13
145 #define RSND_REG_SRCOUT_TIMSEL0		RSND_REG_SHARE14
146 #define RSND_REG_SRCOUT_TIMSEL1		RSND_REG_SHARE15
147 #define RSND_REG_SRCOUT_TIMSEL2		RSND_REG_SHARE16
148 #define RSND_REG_SRCOUT_TIMSEL3		RSND_REG_SHARE17
149 #define RSND_REG_SRCOUT_TIMSEL4		RSND_REG_SHARE18
150 #define RSND_REG_AUDIO_CLK_SEL2		RSND_REG_SHARE19
151 #define RSND_REG_CMD_CTRL		RSND_REG_SHARE20
152 #define RSND_REG_CMDOUT_TIMSEL		RSND_REG_SHARE21
153 #define RSND_REG_SSI_BUSIF_DALIGN	RSND_REG_SHARE22
154 #define RSND_REG_DVC_VRCTR		RSND_REG_SHARE23
155 #define RSND_REG_DVC_VRPDR		RSND_REG_SHARE24
156 #define RSND_REG_DVC_VRDBR		RSND_REG_SHARE25
157 #define RSND_REG_SCU_SYS_STATUS1	RSND_REG_SHARE26
158 #define RSND_REG_SCU_SYS_INT_EN1	RSND_REG_SHARE27
159 #define RSND_REG_SRC_INT_ENABLE0	RSND_REG_SHARE28
160 #define RSND_REG_SRC_BUSIF_DALIGN	RSND_REG_SHARE29
161 
162 struct rsnd_of_data;
163 struct rsnd_priv;
164 struct rsnd_mod;
165 struct rsnd_dai;
166 struct rsnd_dai_stream;
167 
168 /*
169  *	R-Car basic functions
170  */
171 #define rsnd_mod_read(m, r) \
172 	rsnd_read(rsnd_mod_to_priv(m), m, RSND_REG_##r)
173 #define rsnd_mod_write(m, r, d) \
174 	rsnd_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
175 #define rsnd_mod_force_write(m, r, d) \
176 	rsnd_force_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
177 #define rsnd_mod_bset(m, r, s, d) \
178 	rsnd_bset(rsnd_mod_to_priv(m), m, RSND_REG_##r, s, d)
179 
180 u32 rsnd_read(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg);
181 void rsnd_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
182 		enum rsnd_reg reg, u32 data);
183 void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
184 		enum rsnd_reg reg, u32 data);
185 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
186 		    u32 mask, u32 data);
187 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
188 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
189 u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
190 void rsnd_path_parse(struct rsnd_priv *priv,
191 		     struct rsnd_dai_stream *io);
192 
193 /*
194  *	R-Car DMA
195  */
196 struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
197 			       struct rsnd_mod *mod, int id);
198 int rsnd_dma_probe(struct platform_device *pdev,
199 		   const struct rsnd_of_data *of_data,
200 		   struct rsnd_priv *priv);
201 struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
202 					  struct rsnd_mod *mod, char *name);
203 
204 /*
205  *	R-Car sound mod
206  */
207 enum rsnd_mod_type {
208 	RSND_MOD_AUDMAPP,
209 	RSND_MOD_AUDMA,
210 	RSND_MOD_DVC,
211 	RSND_MOD_MIX,
212 	RSND_MOD_CTU,
213 	RSND_MOD_SRC,
214 	RSND_MOD_SSI,
215 	RSND_MOD_MAX,
216 };
217 
218 struct rsnd_mod_ops {
219 	char *name;
220 	struct dma_chan* (*dma_req)(struct rsnd_dai_stream *io,
221 				    struct rsnd_mod *mod);
222 	int (*probe)(struct rsnd_mod *mod,
223 		     struct rsnd_dai_stream *io,
224 		     struct rsnd_priv *priv);
225 	int (*remove)(struct rsnd_mod *mod,
226 		      struct rsnd_dai_stream *io,
227 		      struct rsnd_priv *priv);
228 	int (*init)(struct rsnd_mod *mod,
229 		    struct rsnd_dai_stream *io,
230 		    struct rsnd_priv *priv);
231 	int (*quit)(struct rsnd_mod *mod,
232 		    struct rsnd_dai_stream *io,
233 		    struct rsnd_priv *priv);
234 	int (*start)(struct rsnd_mod *mod,
235 		     struct rsnd_dai_stream *io,
236 		     struct rsnd_priv *priv);
237 	int (*stop)(struct rsnd_mod *mod,
238 		    struct rsnd_dai_stream *io,
239 		    struct rsnd_priv *priv);
240 	int (*pcm_new)(struct rsnd_mod *mod,
241 		       struct rsnd_dai_stream *io,
242 		       struct snd_soc_pcm_runtime *rtd);
243 	int (*hw_params)(struct rsnd_mod *mod,
244 			 struct rsnd_dai_stream *io,
245 			 struct snd_pcm_substream *substream,
246 			 struct snd_pcm_hw_params *hw_params);
247 	int (*fallback)(struct rsnd_mod *mod,
248 			struct rsnd_dai_stream *io,
249 			struct rsnd_priv *priv);
250 };
251 
252 struct rsnd_dai_stream;
253 struct rsnd_mod {
254 	int id;
255 	enum rsnd_mod_type type;
256 	struct rsnd_mod_ops *ops;
257 	struct rsnd_priv *priv;
258 	struct clk *clk;
259 };
260 /*
261  * status
262  *
263  * 0xH0000CBA
264  *
265  * A	0: probe	1: remove
266  * B	0: init		1: quit
267  * C	0: start	1: stop
268  *
269  * H is always called (see __rsnd_mod_call)
270  * H	0: pcm_new
271  * H	0: fallback
272  * H	0: hw_params
273  */
274 #define __rsnd_mod_shift_probe		0
275 #define __rsnd_mod_shift_remove		0
276 #define __rsnd_mod_shift_init		4
277 #define __rsnd_mod_shift_quit		4
278 #define __rsnd_mod_shift_start		8
279 #define __rsnd_mod_shift_stop		8
280 #define __rsnd_mod_shift_pcm_new	28 /* always called */
281 #define __rsnd_mod_shift_fallback	28 /* always called */
282 #define __rsnd_mod_shift_hw_params	28 /* always called */
283 
284 #define __rsnd_mod_add_probe		 1
285 #define __rsnd_mod_add_remove		-1
286 #define __rsnd_mod_add_init		 1
287 #define __rsnd_mod_add_quit		-1
288 #define __rsnd_mod_add_start		 1
289 #define __rsnd_mod_add_stop		-1
290 #define __rsnd_mod_add_pcm_new		0
291 #define __rsnd_mod_add_fallback		0
292 #define __rsnd_mod_add_hw_params	0
293 
294 #define __rsnd_mod_call_probe		0
295 #define __rsnd_mod_call_remove		1
296 #define __rsnd_mod_call_init		0
297 #define __rsnd_mod_call_quit		1
298 #define __rsnd_mod_call_start		0
299 #define __rsnd_mod_call_stop		1
300 #define __rsnd_mod_call_pcm_new		0
301 #define __rsnd_mod_call_fallback	0
302 #define __rsnd_mod_call_hw_params	0
303 
304 #define rsnd_mod_to_priv(mod) ((mod)->priv)
305 #define rsnd_mod_id(mod) ((mod) ? (mod)->id : -1)
306 #define rsnd_mod_power_on(mod)	clk_enable((mod)->clk)
307 #define rsnd_mod_power_off(mod)	clk_disable((mod)->clk)
308 #define rsnd_mod_get(ip)	(&(ip)->mod)
309 
310 int rsnd_mod_init(struct rsnd_priv *priv,
311 		  struct rsnd_mod *mod,
312 		   struct rsnd_mod_ops *ops,
313 		   struct clk *clk,
314 		   enum rsnd_mod_type type,
315 		   int id);
316 void rsnd_mod_quit(struct rsnd_mod *mod);
317 char *rsnd_mod_name(struct rsnd_mod *mod);
318 struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
319 				  struct rsnd_mod *mod);
320 void rsnd_mod_interrupt(struct rsnd_mod *mod,
321 			void (*callback)(struct rsnd_mod *mod,
322 					 struct rsnd_dai_stream *io));
323 
324 /*
325  *	R-Car sound DAI
326  */
327 #define RSND_DAI_NAME_SIZE	16
328 struct rsnd_dai_stream {
329 	char name[RSND_DAI_NAME_SIZE];
330 	struct snd_pcm_substream *substream;
331 	struct rsnd_mod *mod[RSND_MOD_MAX];
332 	struct rsnd_dai_path_info *info; /* rcar_snd.h */
333 	struct rsnd_dai *rdai;
334 	u32 mod_status[RSND_MOD_MAX];
335 	int byte_pos;
336 	int period_pos;
337 	int byte_per_period;
338 	int next_period_byte;
339 };
340 #define rsnd_io_to_mod(io, i)	((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
341 #define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
342 #define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
343 #define rsnd_io_to_mod_ctu(io)	rsnd_io_to_mod((io), RSND_MOD_CTU)
344 #define rsnd_io_to_mod_mix(io)	rsnd_io_to_mod((io), RSND_MOD_MIX)
345 #define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
346 #define rsnd_io_to_rdai(io)	((io)->rdai)
347 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
348 #define rsnd_io_is_play(io)	(&rsnd_io_to_rdai(io)->playback == io)
349 #define rsnd_io_to_runtime(io) ((io)->substream ? \
350 				(io)->substream->runtime : NULL)
351 int rsnd_io_is_working(struct rsnd_dai_stream *io);
352 
353 struct rsnd_dai {
354 	char name[RSND_DAI_NAME_SIZE];
355 	struct rsnd_dai_stream playback;
356 	struct rsnd_dai_stream capture;
357 	struct rsnd_priv *priv;
358 
359 	unsigned int clk_master:1;
360 	unsigned int bit_clk_inv:1;
361 	unsigned int frm_clk_inv:1;
362 	unsigned int sys_delay:1;
363 	unsigned int data_alignment:1;
364 };
365 
366 #define rsnd_rdai_nr(priv) ((priv)->rdai_nr)
367 #define rsnd_rdai_is_clk_master(rdai) ((rdai)->clk_master)
368 #define rsnd_rdai_to_priv(rdai) ((rdai)->priv)
369 #define for_each_rsnd_dai(rdai, priv, i)		\
370 	for (i = 0;					\
371 	     (i < rsnd_rdai_nr(priv)) &&		\
372 	     ((rdai) = rsnd_rdai_get(priv, i));		\
373 	     i++)
374 
375 struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id);
376 
377 bool rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
378 void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io);
379 int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);
380 int rsnd_dai_connect(struct rsnd_mod *mod,
381 		     struct rsnd_dai_stream *io,
382 		     enum rsnd_mod_type type);
383 
384 /*
385  *	R-Car Gen1/Gen2
386  */
387 int rsnd_gen_probe(struct platform_device *pdev,
388 		   const struct rsnd_of_data *of_data,
389 		   struct rsnd_priv *priv);
390 void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
391 			       struct rsnd_mod *mod,
392 			       enum rsnd_reg reg);
393 phys_addr_t rsnd_gen_get_phy_addr(struct rsnd_priv *priv, int reg_id);
394 
395 #define rsnd_is_gen1(s)		(((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1)
396 #define rsnd_is_gen2(s)		(((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2)
397 
398 /*
399  *	R-Car ADG
400  */
401 int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod);
402 int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate);
403 int rsnd_adg_probe(struct platform_device *pdev,
404 		   const struct rsnd_of_data *of_data,
405 		   struct rsnd_priv *priv);
406 int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv,
407 				  struct rsnd_mod *mod,
408 				  unsigned int src_rate,
409 				  unsigned int dst_rate);
410 int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod,
411 				  struct rsnd_dai_stream *io,
412 				  unsigned int src_rate,
413 				  unsigned int dst_rate);
414 int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,
415 				     struct rsnd_dai_stream *io);
416 int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod,
417 				 struct rsnd_dai_stream *io);
418 
419 /*
420  *	R-Car sound priv
421  */
422 struct rsnd_of_data {
423 	u32 flags;
424 };
425 
426 struct rsnd_priv {
427 
428 	struct platform_device *pdev;
429 	struct rcar_snd_info *info;
430 	spinlock_t lock;
431 
432 	/*
433 	 * below value will be filled on rsnd_gen_probe()
434 	 */
435 	void *gen;
436 
437 	/*
438 	 * below value will be filled on rsnd_adg_probe()
439 	 */
440 	void *adg;
441 
442 	/*
443 	 * below value will be filled on rsnd_dma_probe()
444 	 */
445 	void *dma;
446 
447 	/*
448 	 * below value will be filled on rsnd_ssi_probe()
449 	 */
450 	void *ssi;
451 	int ssi_nr;
452 
453 	/*
454 	 * below value will be filled on rsnd_src_probe()
455 	 */
456 	void *src;
457 	int src_nr;
458 
459 	/*
460 	 * below value will be filled on rsnd_ctu_probe()
461 	 */
462 	void *ctu;
463 	int ctu_nr;
464 
465 	/*
466 	 * below value will be filled on rsnd_mix_probe()
467 	 */
468 	void *mix;
469 	int mix_nr;
470 
471 	/*
472 	 * below value will be filled on rsnd_dvc_probe()
473 	 */
474 	void *dvc;
475 	int dvc_nr;
476 
477 	/*
478 	 * below value will be filled on rsnd_dai_probe()
479 	 */
480 	struct snd_soc_dai_driver *daidrv;
481 	struct rsnd_dai *rdai;
482 	int rdai_nr;
483 };
484 
485 #define rsnd_priv_to_pdev(priv)	((priv)->pdev)
486 #define rsnd_priv_to_dev(priv)	(&(rsnd_priv_to_pdev(priv)->dev))
487 #define rsnd_priv_to_info(priv)	((priv)->info)
488 
489 /*
490  *	rsnd_kctrl
491  */
492 struct rsnd_kctrl_cfg {
493 	unsigned int max;
494 	unsigned int size;
495 	u32 *val;
496 	const char * const *texts;
497 	void (*update)(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
498 	struct rsnd_dai_stream *io;
499 	struct snd_card *card;
500 	struct snd_kcontrol *kctrl;
501 };
502 
503 #define RSND_DVC_CHANNELS	2
504 struct rsnd_kctrl_cfg_m {
505 	struct rsnd_kctrl_cfg cfg;
506 	u32 val[RSND_DVC_CHANNELS];
507 };
508 
509 struct rsnd_kctrl_cfg_s {
510 	struct rsnd_kctrl_cfg cfg;
511 	u32 val;
512 };
513 
514 void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg);
515 #define rsnd_kctrl_remove(_cfg)	_rsnd_kctrl_remove(&((_cfg).cfg))
516 
517 int rsnd_kctrl_new_m(struct rsnd_mod *mod,
518 		     struct rsnd_dai_stream *io,
519 		     struct snd_soc_pcm_runtime *rtd,
520 		     const unsigned char *name,
521 		     void (*update)(struct rsnd_dai_stream *io,
522 				    struct rsnd_mod *mod),
523 		     struct rsnd_kctrl_cfg_m *_cfg,
524 		     u32 max);
525 int rsnd_kctrl_new_s(struct rsnd_mod *mod,
526 		     struct rsnd_dai_stream *io,
527 		     struct snd_soc_pcm_runtime *rtd,
528 		     const unsigned char *name,
529 		     void (*update)(struct rsnd_dai_stream *io,
530 				    struct rsnd_mod *mod),
531 		     struct rsnd_kctrl_cfg_s *_cfg,
532 		     u32 max);
533 int rsnd_kctrl_new_e(struct rsnd_mod *mod,
534 		     struct rsnd_dai_stream *io,
535 		     struct snd_soc_pcm_runtime *rtd,
536 		     const unsigned char *name,
537 		     struct rsnd_kctrl_cfg_s *_cfg,
538 		     void (*update)(struct rsnd_dai_stream *io,
539 				    struct rsnd_mod *mod),
540 		     const char * const *texts,
541 		     u32 max);
542 
543 /*
544  *	R-Car SSI
545  */
546 int rsnd_ssi_probe(struct platform_device *pdev,
547 		   const struct rsnd_of_data *of_data,
548 		   struct rsnd_priv *priv);
549 void rsnd_ssi_remove(struct platform_device *pdev,
550 		     struct rsnd_priv *priv);
551 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
552 int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
553 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
554 
555 #define rsnd_ssi_is_pin_sharing(io)	\
556 	__rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
557 int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
558 
559 /*
560  *	R-Car SRC
561  */
562 int rsnd_src_probe(struct platform_device *pdev,
563 		   const struct rsnd_of_data *of_data,
564 		   struct rsnd_priv *priv);
565 void rsnd_src_remove(struct platform_device *pdev,
566 		     struct rsnd_priv *priv);
567 struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
568 unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
569 				   struct rsnd_dai_stream *io,
570 				   struct snd_pcm_runtime *runtime);
571 int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
572 			struct rsnd_dai_stream *io,
573 			int use_busif);
574 int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
575 		       struct rsnd_dai_stream *io);
576 
577 /*
578  *	R-Car CTU
579  */
580 int rsnd_ctu_probe(struct platform_device *pdev,
581 		   const struct rsnd_of_data *of_data,
582 		   struct rsnd_priv *priv);
583 
584 void rsnd_ctu_remove(struct platform_device *pdev,
585 		     struct rsnd_priv *priv);
586 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
587 
588 /*
589  *	R-Car MIX
590  */
591 int rsnd_mix_probe(struct platform_device *pdev,
592 		   const struct rsnd_of_data *of_data,
593 		   struct rsnd_priv *priv);
594 
595 void rsnd_mix_remove(struct platform_device *pdev,
596 		     struct rsnd_priv *priv);
597 struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id);
598 
599 /*
600  *	R-Car DVC
601  */
602 int rsnd_dvc_probe(struct platform_device *pdev,
603 		   const struct rsnd_of_data *of_data,
604 		   struct rsnd_priv *priv);
605 void rsnd_dvc_remove(struct platform_device *pdev,
606 		     struct rsnd_priv *priv);
607 struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id);
608 
609 #ifdef DEBUG
610 void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type);
611 #define rsnd_mod_confirm_ssi(mssi)	rsnd_mod_make_sure(mssi, RSND_MOD_SSI)
612 #define rsnd_mod_confirm_src(msrc)	rsnd_mod_make_sure(msrc, RSND_MOD_SRC)
613 #define rsnd_mod_confirm_dvc(mdvc)	rsnd_mod_make_sure(mdvc, RSND_MOD_DVC)
614 #else
615 #define rsnd_mod_confirm_ssi(mssi)
616 #define rsnd_mod_confirm_src(msrc)
617 #define rsnd_mod_confirm_dvc(mdvc)
618 #endif
619 
620 #endif
621