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_dma; 197 198 struct rsnd_dmaen { 199 struct dma_chan *chan; 200 }; 201 202 struct rsnd_dmapp { 203 int dmapp_id; 204 u32 chcr; 205 }; 206 207 struct rsnd_dma { 208 struct rsnd_dma_ops *ops; 209 dma_addr_t src_addr; 210 dma_addr_t dst_addr; 211 union { 212 struct rsnd_dmaen en; 213 struct rsnd_dmapp pp; 214 } dma; 215 }; 216 #define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en) 217 #define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp) 218 #define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma) 219 220 void rsnd_dma_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma); 221 void rsnd_dma_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma); 222 int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id); 223 void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma); 224 int rsnd_dma_probe(struct platform_device *pdev, 225 const struct rsnd_of_data *of_data, 226 struct rsnd_priv *priv); 227 struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node, 228 struct rsnd_mod *mod, char *name); 229 230 /* 231 * R-Car sound mod 232 */ 233 enum rsnd_mod_type { 234 RSND_MOD_DVC = 0, 235 RSND_MOD_MIX, 236 RSND_MOD_CTU, 237 RSND_MOD_SRC, 238 RSND_MOD_SSIP, /* SSI parent */ 239 RSND_MOD_SSI, 240 RSND_MOD_MAX, 241 }; 242 243 struct rsnd_mod_ops { 244 char *name; 245 struct dma_chan* (*dma_req)(struct rsnd_dai_stream *io, 246 struct rsnd_mod *mod); 247 int (*probe)(struct rsnd_mod *mod, 248 struct rsnd_dai_stream *io, 249 struct rsnd_priv *priv); 250 int (*remove)(struct rsnd_mod *mod, 251 struct rsnd_dai_stream *io, 252 struct rsnd_priv *priv); 253 int (*init)(struct rsnd_mod *mod, 254 struct rsnd_dai_stream *io, 255 struct rsnd_priv *priv); 256 int (*quit)(struct rsnd_mod *mod, 257 struct rsnd_dai_stream *io, 258 struct rsnd_priv *priv); 259 int (*start)(struct rsnd_mod *mod, 260 struct rsnd_dai_stream *io, 261 struct rsnd_priv *priv); 262 int (*stop)(struct rsnd_mod *mod, 263 struct rsnd_dai_stream *io, 264 struct rsnd_priv *priv); 265 int (*pcm_new)(struct rsnd_mod *mod, 266 struct rsnd_dai_stream *io, 267 struct snd_soc_pcm_runtime *rtd); 268 int (*hw_params)(struct rsnd_mod *mod, 269 struct rsnd_dai_stream *io, 270 struct snd_pcm_substream *substream, 271 struct snd_pcm_hw_params *hw_params); 272 int (*fallback)(struct rsnd_mod *mod, 273 struct rsnd_dai_stream *io, 274 struct rsnd_priv *priv); 275 }; 276 277 struct rsnd_dai_stream; 278 struct rsnd_mod { 279 int id; 280 enum rsnd_mod_type type; 281 struct rsnd_mod_ops *ops; 282 struct rsnd_dma dma; 283 struct rsnd_priv *priv; 284 struct clk *clk; 285 u32 status; 286 }; 287 /* 288 * status 289 * 290 * 0xH0000CBA 291 * 292 * A 0: probe 1: remove 293 * B 0: init 1: quit 294 * C 0: start 1: stop 295 * 296 * H is always called (see __rsnd_mod_call) 297 * H 0: pcm_new 298 * H 0: fallback 299 * H 0: hw_params 300 */ 301 #define __rsnd_mod_shift_probe 0 302 #define __rsnd_mod_shift_remove 0 303 #define __rsnd_mod_shift_init 4 304 #define __rsnd_mod_shift_quit 4 305 #define __rsnd_mod_shift_start 8 306 #define __rsnd_mod_shift_stop 8 307 #define __rsnd_mod_shift_pcm_new 28 /* always called */ 308 #define __rsnd_mod_shift_fallback 28 /* always called */ 309 #define __rsnd_mod_shift_hw_params 28 /* always called */ 310 311 #define __rsnd_mod_add_probe 1 312 #define __rsnd_mod_add_remove -1 313 #define __rsnd_mod_add_init 1 314 #define __rsnd_mod_add_quit -1 315 #define __rsnd_mod_add_start 1 316 #define __rsnd_mod_add_stop -1 317 #define __rsnd_mod_add_pcm_new 0 318 #define __rsnd_mod_add_fallback 0 319 #define __rsnd_mod_add_hw_params 0 320 321 #define __rsnd_mod_call_probe 0 322 #define __rsnd_mod_call_remove 1 323 #define __rsnd_mod_call_init 0 324 #define __rsnd_mod_call_quit 1 325 #define __rsnd_mod_call_start 0 326 #define __rsnd_mod_call_stop 1 327 #define __rsnd_mod_call_pcm_new 0 328 #define __rsnd_mod_call_fallback 0 329 #define __rsnd_mod_call_hw_params 0 330 331 #define rsnd_mod_to_priv(mod) ((mod)->priv) 332 #define rsnd_mod_to_dma(mod) (&(mod)->dma) 333 #define rsnd_mod_id(mod) ((mod) ? (mod)->id : -1) 334 #define rsnd_mod_power_on(mod) clk_enable((mod)->clk) 335 #define rsnd_mod_power_off(mod) clk_disable((mod)->clk) 336 #define rsnd_mod_get(ip) (&(ip)->mod) 337 338 int rsnd_mod_init(struct rsnd_priv *priv, 339 struct rsnd_mod *mod, 340 struct rsnd_mod_ops *ops, 341 struct clk *clk, 342 enum rsnd_mod_type type, 343 int id); 344 void rsnd_mod_quit(struct rsnd_mod *mod); 345 char *rsnd_mod_name(struct rsnd_mod *mod); 346 struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, 347 struct rsnd_mod *mod); 348 void rsnd_mod_interrupt(struct rsnd_mod *mod, 349 void (*callback)(struct rsnd_mod *mod, 350 struct rsnd_dai_stream *io)); 351 352 /* 353 * R-Car sound DAI 354 */ 355 #define RSND_DAI_NAME_SIZE 16 356 struct rsnd_dai_stream { 357 char name[RSND_DAI_NAME_SIZE]; 358 struct snd_pcm_substream *substream; 359 struct rsnd_mod *mod[RSND_MOD_MAX]; 360 struct rsnd_dai_path_info *info; /* rcar_snd.h */ 361 struct rsnd_dai *rdai; 362 int byte_pos; 363 int period_pos; 364 int byte_per_period; 365 int next_period_byte; 366 }; 367 #define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL) 368 #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI) 369 #define rsnd_io_to_mod_ssip(io) rsnd_io_to_mod((io), RSND_MOD_SSIP) 370 #define rsnd_io_to_mod_src(io) rsnd_io_to_mod((io), RSND_MOD_SRC) 371 #define rsnd_io_to_mod_ctu(io) rsnd_io_to_mod((io), RSND_MOD_CTU) 372 #define rsnd_io_to_mod_mix(io) rsnd_io_to_mod((io), RSND_MOD_MIX) 373 #define rsnd_io_to_mod_dvc(io) rsnd_io_to_mod((io), RSND_MOD_DVC) 374 #define rsnd_io_to_rdai(io) ((io)->rdai) 375 #define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io))) 376 #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io) 377 #define rsnd_io_to_runtime(io) ((io)->substream ? \ 378 (io)->substream->runtime : NULL) 379 int rsnd_io_is_working(struct rsnd_dai_stream *io); 380 381 struct rsnd_dai { 382 char name[RSND_DAI_NAME_SIZE]; 383 struct rsnd_dai_stream playback; 384 struct rsnd_dai_stream capture; 385 struct rsnd_priv *priv; 386 387 unsigned int clk_master:1; 388 unsigned int bit_clk_inv:1; 389 unsigned int frm_clk_inv:1; 390 unsigned int sys_delay:1; 391 unsigned int data_alignment:1; 392 }; 393 394 #define rsnd_rdai_nr(priv) ((priv)->rdai_nr) 395 #define rsnd_rdai_is_clk_master(rdai) ((rdai)->clk_master) 396 #define rsnd_rdai_to_priv(rdai) ((rdai)->priv) 397 #define for_each_rsnd_dai(rdai, priv, i) \ 398 for (i = 0; \ 399 (i < rsnd_rdai_nr(priv)) && \ 400 ((rdai) = rsnd_rdai_get(priv, i)); \ 401 i++) 402 403 struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); 404 405 bool rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt); 406 void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io); 407 int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional); 408 409 /* 410 * R-Car Gen1/Gen2 411 */ 412 int rsnd_gen_probe(struct platform_device *pdev, 413 const struct rsnd_of_data *of_data, 414 struct rsnd_priv *priv); 415 void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, 416 struct rsnd_mod *mod, 417 enum rsnd_reg reg); 418 phys_addr_t rsnd_gen_get_phy_addr(struct rsnd_priv *priv, int reg_id); 419 420 #define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1) 421 #define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2) 422 423 /* 424 * R-Car ADG 425 */ 426 int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod); 427 int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate); 428 int rsnd_adg_probe(struct platform_device *pdev, 429 const struct rsnd_of_data *of_data, 430 struct rsnd_priv *priv); 431 int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv, 432 struct rsnd_mod *mod, 433 unsigned int src_rate, 434 unsigned int dst_rate); 435 int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod, 436 struct rsnd_dai_stream *io, 437 unsigned int src_rate, 438 unsigned int dst_rate); 439 int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod, 440 struct rsnd_dai_stream *io); 441 int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod, 442 struct rsnd_dai_stream *io); 443 444 /* 445 * R-Car sound priv 446 */ 447 struct rsnd_of_data { 448 u32 flags; 449 }; 450 451 struct rsnd_priv { 452 453 struct platform_device *pdev; 454 struct rcar_snd_info *info; 455 spinlock_t lock; 456 457 /* 458 * below value will be filled on rsnd_gen_probe() 459 */ 460 void *gen; 461 462 /* 463 * below value will be filled on rsnd_adg_probe() 464 */ 465 void *adg; 466 467 /* 468 * below value will be filled on rsnd_dma_probe() 469 */ 470 void *dma; 471 472 /* 473 * below value will be filled on rsnd_ssi_probe() 474 */ 475 void *ssi; 476 int ssi_nr; 477 478 /* 479 * below value will be filled on rsnd_src_probe() 480 */ 481 void *src; 482 int src_nr; 483 484 /* 485 * below value will be filled on rsnd_ctu_probe() 486 */ 487 void *ctu; 488 int ctu_nr; 489 490 /* 491 * below value will be filled on rsnd_mix_probe() 492 */ 493 void *mix; 494 int mix_nr; 495 496 /* 497 * below value will be filled on rsnd_dvc_probe() 498 */ 499 void *dvc; 500 int dvc_nr; 501 502 /* 503 * below value will be filled on rsnd_dai_probe() 504 */ 505 struct snd_soc_dai_driver *daidrv; 506 struct rsnd_dai *rdai; 507 int rdai_nr; 508 }; 509 510 #define rsnd_priv_to_pdev(priv) ((priv)->pdev) 511 #define rsnd_priv_to_dev(priv) (&(rsnd_priv_to_pdev(priv)->dev)) 512 #define rsnd_priv_to_info(priv) ((priv)->info) 513 514 /* 515 * rsnd_kctrl 516 */ 517 struct rsnd_kctrl_cfg { 518 unsigned int max; 519 unsigned int size; 520 u32 *val; 521 const char * const *texts; 522 void (*update)(struct rsnd_dai_stream *io, struct rsnd_mod *mod); 523 struct rsnd_dai_stream *io; 524 struct snd_card *card; 525 struct snd_kcontrol *kctrl; 526 }; 527 528 #define RSND_DVC_CHANNELS 2 529 struct rsnd_kctrl_cfg_m { 530 struct rsnd_kctrl_cfg cfg; 531 u32 val[RSND_DVC_CHANNELS]; 532 }; 533 534 struct rsnd_kctrl_cfg_s { 535 struct rsnd_kctrl_cfg cfg; 536 u32 val; 537 }; 538 539 void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg); 540 #define rsnd_kctrl_remove(_cfg) _rsnd_kctrl_remove(&((_cfg).cfg)) 541 542 int rsnd_kctrl_new_m(struct rsnd_mod *mod, 543 struct rsnd_dai_stream *io, 544 struct snd_soc_pcm_runtime *rtd, 545 const unsigned char *name, 546 void (*update)(struct rsnd_dai_stream *io, 547 struct rsnd_mod *mod), 548 struct rsnd_kctrl_cfg_m *_cfg, 549 u32 max); 550 int rsnd_kctrl_new_s(struct rsnd_mod *mod, 551 struct rsnd_dai_stream *io, 552 struct snd_soc_pcm_runtime *rtd, 553 const unsigned char *name, 554 void (*update)(struct rsnd_dai_stream *io, 555 struct rsnd_mod *mod), 556 struct rsnd_kctrl_cfg_s *_cfg, 557 u32 max); 558 int rsnd_kctrl_new_e(struct rsnd_mod *mod, 559 struct rsnd_dai_stream *io, 560 struct snd_soc_pcm_runtime *rtd, 561 const unsigned char *name, 562 struct rsnd_kctrl_cfg_s *_cfg, 563 void (*update)(struct rsnd_dai_stream *io, 564 struct rsnd_mod *mod), 565 const char * const *texts, 566 u32 max); 567 568 /* 569 * R-Car SSI 570 */ 571 int rsnd_ssi_probe(struct platform_device *pdev, 572 const struct rsnd_of_data *of_data, 573 struct rsnd_priv *priv); 574 void rsnd_ssi_remove(struct platform_device *pdev, 575 struct rsnd_priv *priv); 576 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); 577 int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod); 578 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io); 579 580 #define rsnd_ssi_is_pin_sharing(io) \ 581 __rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io)) 582 int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); 583 584 /* 585 * R-Car SRC 586 */ 587 int rsnd_src_probe(struct platform_device *pdev, 588 const struct rsnd_of_data *of_data, 589 struct rsnd_priv *priv); 590 void rsnd_src_remove(struct platform_device *pdev, 591 struct rsnd_priv *priv); 592 struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id); 593 unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, 594 struct rsnd_dai_stream *io, 595 struct snd_pcm_runtime *runtime); 596 int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, 597 struct rsnd_dai_stream *io, 598 int use_busif); 599 int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod, 600 struct rsnd_dai_stream *io); 601 int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod); 602 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod); 603 604 /* 605 * R-Car CTU 606 */ 607 int rsnd_ctu_probe(struct platform_device *pdev, 608 const struct rsnd_of_data *of_data, 609 struct rsnd_priv *priv); 610 611 void rsnd_ctu_remove(struct platform_device *pdev, 612 struct rsnd_priv *priv); 613 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id); 614 615 /* 616 * R-Car MIX 617 */ 618 int rsnd_mix_probe(struct platform_device *pdev, 619 const struct rsnd_of_data *of_data, 620 struct rsnd_priv *priv); 621 622 void rsnd_mix_remove(struct platform_device *pdev, 623 struct rsnd_priv *priv); 624 struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id); 625 626 /* 627 * R-Car DVC 628 */ 629 int rsnd_dvc_probe(struct platform_device *pdev, 630 const struct rsnd_of_data *of_data, 631 struct rsnd_priv *priv); 632 void rsnd_dvc_remove(struct platform_device *pdev, 633 struct rsnd_priv *priv); 634 struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id); 635 636 #ifdef DEBUG 637 void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type); 638 #define rsnd_mod_confirm_ssi(mssi) rsnd_mod_make_sure(mssi, RSND_MOD_SSI) 639 #define rsnd_mod_confirm_src(msrc) rsnd_mod_make_sure(msrc, RSND_MOD_SRC) 640 #define rsnd_mod_confirm_dvc(mdvc) rsnd_mod_make_sure(mdvc, RSND_MOD_DVC) 641 #else 642 #define rsnd_mod_confirm_ssi(mssi) 643 #define rsnd_mod_confirm_src(msrc) 644 #define rsnd_mod_confirm_dvc(mdvc) 645 #endif 646 647 #endif 648