Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 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> |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 16 | #include <linux/dma-mapping.h> |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 17 | #include <linux/io.h> |
| 18 | #include <linux/list.h> |
| 19 | #include <linux/module.h> |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 20 | #include <linux/sh_dma.h> |
| 21 | #include <linux/workqueue.h> |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 22 | #include <sound/rcar_snd.h> |
| 23 | #include <sound/soc.h> |
| 24 | #include <sound/pcm_params.h> |
| 25 | |
| 26 | /* |
| 27 | * pseudo register |
| 28 | * |
| 29 | * The register address offsets SRU/SCU/SSIU on Gen1/Gen2 are very different. |
| 30 | * This driver uses pseudo register in order to hide it. |
| 31 | * see gen1/gen2 for detail |
| 32 | */ |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 33 | enum rsnd_reg { |
Kuninori Morimoto | 507d466 | 2013-11-28 18:43:45 -0800 | [diff] [blame] | 34 | /* SRU/SCU/SSIU */ |
Kuninori Morimoto | 2582718c | 2013-12-19 19:27:37 -0800 | [diff] [blame] | 35 | RSND_REG_SRC_ROUTE_SEL, /* for Gen1 */ |
| 36 | RSND_REG_SRC_TMG_SEL0, /* for Gen1 */ |
| 37 | RSND_REG_SRC_TMG_SEL1, /* for Gen1 */ |
| 38 | RSND_REG_SRC_TMG_SEL2, /* for Gen1 */ |
| 39 | RSND_REG_SRC_ROUTE_CTRL, /* for Gen1 */ |
Kuninori Morimoto | 629509c | 2014-01-23 18:42:00 -0800 | [diff] [blame] | 40 | RSND_REG_SRC_CTRL, /* for Gen2 */ |
| 41 | RSND_REG_SSI_CTRL, /* for Gen2 */ |
| 42 | RSND_REG_SSI_CONTROL, |
| 43 | RSND_REG_SSI_BUSIF_MODE, /* for Gen2 */ |
| 44 | RSND_REG_SSI_BUSIF_ADINR, /* for Gen2 */ |
Kuninori Morimoto | 07539c1 | 2013-07-21 21:36:35 -0700 | [diff] [blame] | 45 | RSND_REG_SSI_MODE0, |
| 46 | RSND_REG_SSI_MODE1, |
Kuninori Morimoto | 52ea2a7 | 2013-12-19 19:28:19 -0800 | [diff] [blame] | 47 | RSND_REG_INT_ENABLE, /* for Gen2 */ |
Kuninori Morimoto | 0290d2a | 2014-01-23 18:37:39 -0800 | [diff] [blame] | 48 | RSND_REG_SRC_BUSIF_MODE, |
Kuninori Morimoto | ef74940 | 2013-12-19 19:28:51 -0800 | [diff] [blame] | 49 | RSND_REG_SRC_ROUTE_MODE0, |
| 50 | RSND_REG_SRC_SWRSR, |
| 51 | RSND_REG_SRC_SRCIR, |
Kuninori Morimoto | 690ef81 | 2013-12-19 19:27:03 -0800 | [diff] [blame] | 52 | RSND_REG_SRC_ADINR, |
Kuninori Morimoto | ef74940 | 2013-12-19 19:28:51 -0800 | [diff] [blame] | 53 | RSND_REG_SRC_IFSCR, |
| 54 | RSND_REG_SRC_IFSVR, |
| 55 | RSND_REG_SRC_SRCCR, |
Kuninori Morimoto | 1b7b08ef | 2014-01-23 18:41:36 -0800 | [diff] [blame] | 56 | RSND_REG_SRC_MNFSR, /* for Gen1 */ |
Kuninori Morimoto | 629509c | 2014-01-23 18:42:00 -0800 | [diff] [blame] | 57 | RSND_REG_SRC_BSDSR, /* for Gen2 */ |
| 58 | RSND_REG_SRC_BSISR, /* for Gen2 */ |
Kuninori Morimoto | 07539c1 | 2013-07-21 21:36:35 -0700 | [diff] [blame] | 59 | |
Kuninori Morimoto | dfc9403 | 2013-07-21 21:36:46 -0700 | [diff] [blame] | 60 | /* ADG */ |
| 61 | RSND_REG_BRRA, |
| 62 | RSND_REG_BRRB, |
| 63 | RSND_REG_SSICKR, |
| 64 | RSND_REG_AUDIO_CLK_SEL0, |
| 65 | RSND_REG_AUDIO_CLK_SEL1, |
| 66 | RSND_REG_AUDIO_CLK_SEL2, |
Kuninori Morimoto | ef74940 | 2013-12-19 19:28:51 -0800 | [diff] [blame] | 67 | RSND_REG_AUDIO_CLK_SEL3, /* for Gen1 */ |
| 68 | RSND_REG_AUDIO_CLK_SEL4, /* for Gen1 */ |
| 69 | RSND_REG_AUDIO_CLK_SEL5, /* for Gen1 */ |
Kuninori Morimoto | ee2c828 | 2014-02-11 21:04:12 -0800 | [diff] [blame] | 70 | RSND_REG_DIV_EN, /* for Gen2 */ |
Kuninori Morimoto | 629509c | 2014-01-23 18:42:00 -0800 | [diff] [blame] | 71 | RSND_REG_SRCIN_TIMSEL0, /* for Gen2 */ |
| 72 | RSND_REG_SRCIN_TIMSEL1, /* for Gen2 */ |
| 73 | RSND_REG_SRCIN_TIMSEL2, /* for Gen2 */ |
| 74 | RSND_REG_SRCIN_TIMSEL3, /* for Gen2 */ |
| 75 | RSND_REG_SRCIN_TIMSEL4, /* for Gen2 */ |
| 76 | RSND_REG_SRCOUT_TIMSEL0, /* for Gen2 */ |
| 77 | RSND_REG_SRCOUT_TIMSEL1, /* for Gen2 */ |
| 78 | RSND_REG_SRCOUT_TIMSEL2, /* for Gen2 */ |
| 79 | RSND_REG_SRCOUT_TIMSEL3, /* for Gen2 */ |
| 80 | RSND_REG_SRCOUT_TIMSEL4, /* for Gen2 */ |
Kuninori Morimoto | dfc9403 | 2013-07-21 21:36:46 -0700 | [diff] [blame] | 81 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 82 | /* SSI */ |
| 83 | RSND_REG_SSICR, |
| 84 | RSND_REG_SSISR, |
| 85 | RSND_REG_SSITDR, |
| 86 | RSND_REG_SSIRDR, |
| 87 | RSND_REG_SSIWSR, |
| 88 | |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 89 | RSND_REG_MAX, |
| 90 | }; |
| 91 | |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 92 | struct rsnd_priv; |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 93 | struct rsnd_mod; |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 94 | struct rsnd_dai; |
| 95 | struct rsnd_dai_stream; |
| 96 | |
| 97 | /* |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 98 | * R-Car basic functions |
| 99 | */ |
| 100 | #define rsnd_mod_read(m, r) \ |
| 101 | rsnd_read(rsnd_mod_to_priv(m), m, RSND_REG_##r) |
| 102 | #define rsnd_mod_write(m, r, d) \ |
| 103 | rsnd_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d) |
| 104 | #define rsnd_mod_bset(m, r, s, d) \ |
| 105 | rsnd_bset(rsnd_mod_to_priv(m), m, RSND_REG_##r, s, d) |
| 106 | |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 107 | u32 rsnd_read(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg); |
| 108 | void rsnd_write(struct rsnd_priv *priv, struct rsnd_mod *mod, |
| 109 | enum rsnd_reg reg, u32 data); |
| 110 | void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg, |
| 111 | u32 mask, u32 data); |
| 112 | |
| 113 | /* |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 114 | * R-Car DMA |
| 115 | */ |
| 116 | struct rsnd_dma { |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 117 | struct sh_dmae_slave slave; |
| 118 | struct work_struct work; |
| 119 | struct dma_chan *chan; |
| 120 | enum dma_data_direction dir; |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 121 | |
| 122 | int submit_loop; |
Kuninori Morimoto | 4686a0a | 2014-01-23 18:41:44 -0800 | [diff] [blame] | 123 | int offset; /* it cares A/B plane */ |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 124 | }; |
| 125 | |
| 126 | void rsnd_dma_start(struct rsnd_dma *dma); |
| 127 | void rsnd_dma_stop(struct rsnd_dma *dma); |
| 128 | int rsnd_dma_available(struct rsnd_dma *dma); |
| 129 | int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, |
Kuninori Morimoto | 4686a0a | 2014-01-23 18:41:44 -0800 | [diff] [blame] | 130 | int is_play, int id); |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 131 | void rsnd_dma_quit(struct rsnd_priv *priv, |
| 132 | struct rsnd_dma *dma); |
| 133 | |
| 134 | |
| 135 | /* |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 136 | * R-Car sound mod |
| 137 | */ |
| 138 | |
| 139 | struct rsnd_mod_ops { |
| 140 | char *name; |
| 141 | int (*init)(struct rsnd_mod *mod, |
| 142 | struct rsnd_dai *rdai, |
| 143 | struct rsnd_dai_stream *io); |
| 144 | int (*quit)(struct rsnd_mod *mod, |
| 145 | struct rsnd_dai *rdai, |
| 146 | struct rsnd_dai_stream *io); |
| 147 | int (*start)(struct rsnd_mod *mod, |
| 148 | struct rsnd_dai *rdai, |
| 149 | struct rsnd_dai_stream *io); |
| 150 | int (*stop)(struct rsnd_mod *mod, |
| 151 | struct rsnd_dai *rdai, |
| 152 | struct rsnd_dai_stream *io); |
| 153 | }; |
| 154 | |
Kuninori Morimoto | 4686a0a | 2014-01-23 18:41:44 -0800 | [diff] [blame] | 155 | struct rsnd_dai_stream; |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 156 | struct rsnd_mod { |
| 157 | int id; |
| 158 | struct rsnd_priv *priv; |
| 159 | struct rsnd_mod_ops *ops; |
| 160 | struct list_head list; /* connect to rsnd_dai playback/capture */ |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 161 | struct rsnd_dma dma; |
Kuninori Morimoto | 4686a0a | 2014-01-23 18:41:44 -0800 | [diff] [blame] | 162 | struct rsnd_dai_stream *io; |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | #define rsnd_mod_to_priv(mod) ((mod)->priv) |
Kuninori Morimoto | 0a4d94c | 2013-07-28 18:58:50 -0700 | [diff] [blame] | 166 | #define rsnd_mod_to_dma(mod) (&(mod)->dma) |
| 167 | #define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma) |
Kuninori Morimoto | 4686a0a | 2014-01-23 18:41:44 -0800 | [diff] [blame] | 168 | #define rsnd_mod_to_io(mod) ((mod)->io) |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 169 | #define rsnd_mod_id(mod) ((mod)->id) |
| 170 | #define for_each_rsnd_mod(pos, n, io) \ |
| 171 | list_for_each_entry_safe(pos, n, &(io)->head, list) |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 172 | |
| 173 | void rsnd_mod_init(struct rsnd_priv *priv, |
| 174 | struct rsnd_mod *mod, |
| 175 | struct rsnd_mod_ops *ops, |
| 176 | int id); |
| 177 | char *rsnd_mod_name(struct rsnd_mod *mod); |
| 178 | |
| 179 | /* |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 180 | * R-Car sound DAI |
| 181 | */ |
| 182 | #define RSND_DAI_NAME_SIZE 16 |
| 183 | struct rsnd_dai_stream { |
| 184 | struct list_head head; /* head of rsnd_mod list */ |
| 185 | struct snd_pcm_substream *substream; |
| 186 | int byte_pos; |
| 187 | int period_pos; |
| 188 | int byte_per_period; |
| 189 | int next_period_byte; |
| 190 | }; |
| 191 | |
| 192 | struct rsnd_dai { |
| 193 | char name[RSND_DAI_NAME_SIZE]; |
| 194 | struct rsnd_dai_platform_info *info; /* rcar_snd.h */ |
| 195 | struct rsnd_dai_stream playback; |
| 196 | struct rsnd_dai_stream capture; |
| 197 | |
Dan Carpenter | a373773 | 2013-11-08 12:46:53 +0300 | [diff] [blame] | 198 | unsigned int clk_master:1; |
| 199 | unsigned int bit_clk_inv:1; |
| 200 | unsigned int frm_clk_inv:1; |
| 201 | unsigned int sys_delay:1; |
| 202 | unsigned int data_alignment:1; |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 203 | }; |
| 204 | |
Kuninori Morimoto | ecba9e7 | 2014-02-24 22:15:18 -0800 | [diff] [blame^] | 205 | #define rsnd_rdai_nr(priv) ((priv)->rdai_nr) |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 206 | #define for_each_rsnd_dai(rdai, priv, i) \ |
Kuninori Morimoto | 00463c11 | 2014-02-11 17:15:51 -0800 | [diff] [blame] | 207 | for (i = 0; \ |
Kuninori Morimoto | ecba9e7 | 2014-02-24 22:15:18 -0800 | [diff] [blame^] | 208 | (i < rsnd_rdai_nr(priv)) && \ |
Kuninori Morimoto | 00463c11 | 2014-02-11 17:15:51 -0800 | [diff] [blame] | 209 | ((rdai) = rsnd_dai_get(priv, i)); \ |
| 210 | i++) |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 211 | |
| 212 | struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id); |
Kuninori Morimoto | cdaa3cd | 2013-07-21 21:36:03 -0700 | [diff] [blame] | 213 | int rsnd_dai_disconnect(struct rsnd_mod *mod); |
| 214 | int rsnd_dai_connect(struct rsnd_dai *rdai, struct rsnd_mod *mod, |
| 215 | struct rsnd_dai_stream *io); |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 216 | int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io); |
Kuninori Morimoto | 4b4dab8 | 2013-07-28 18:58:29 -0700 | [diff] [blame] | 217 | int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai); |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 218 | #define rsnd_dai_get_platform_info(rdai) ((rdai)->info) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 219 | #define rsnd_io_to_runtime(io) ((io)->substream->runtime) |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 220 | |
| 221 | void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt); |
| 222 | int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional); |
Kuninori Morimoto | e779a20 | 2014-01-23 18:39:12 -0800 | [diff] [blame] | 223 | #define rsnd_dai_is_clk_master(rdai) ((rdai)->clk_master) |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 224 | |
| 225 | /* |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 226 | * R-Car Gen1/Gen2 |
| 227 | */ |
| 228 | int rsnd_gen_probe(struct platform_device *pdev, |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 229 | struct rsnd_priv *priv); |
| 230 | void rsnd_gen_remove(struct platform_device *pdev, |
| 231 | struct rsnd_priv *priv); |
| 232 | int rsnd_gen_path_init(struct rsnd_priv *priv, |
| 233 | struct rsnd_dai *rdai, |
| 234 | struct rsnd_dai_stream *io); |
| 235 | int rsnd_gen_path_exit(struct rsnd_priv *priv, |
| 236 | struct rsnd_dai *rdai, |
| 237 | struct rsnd_dai_stream *io); |
| 238 | void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, |
| 239 | struct rsnd_mod *mod, |
| 240 | enum rsnd_reg reg); |
Kuninori Morimoto | c5d5a58 | 2013-10-11 00:07:01 -0700 | [diff] [blame] | 241 | #define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1) |
| 242 | #define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2) |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 243 | |
| 244 | /* |
Kuninori Morimoto | dfc9403 | 2013-07-21 21:36:46 -0700 | [diff] [blame] | 245 | * R-Car ADG |
| 246 | */ |
| 247 | int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod); |
| 248 | int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate); |
| 249 | int rsnd_adg_probe(struct platform_device *pdev, |
Kuninori Morimoto | dfc9403 | 2013-07-21 21:36:46 -0700 | [diff] [blame] | 250 | struct rsnd_priv *priv); |
| 251 | void rsnd_adg_remove(struct platform_device *pdev, |
| 252 | struct rsnd_priv *priv); |
Kuninori Morimoto | 28dc4b6 | 2014-01-23 18:41:10 -0800 | [diff] [blame] | 253 | int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv, |
| 254 | struct rsnd_mod *mod, |
| 255 | unsigned int src_rate, |
| 256 | unsigned int dst_rate); |
Kuninori Morimoto | 629509c | 2014-01-23 18:42:00 -0800 | [diff] [blame] | 257 | int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod, |
| 258 | struct rsnd_dai *rdai, |
| 259 | struct rsnd_dai_stream *io, |
| 260 | unsigned int src_rate, |
| 261 | unsigned int dst_rate); |
| 262 | int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod, |
| 263 | struct rsnd_dai *rdai, |
| 264 | struct rsnd_dai_stream *io); |
Kuninori Morimoto | dfc9403 | 2013-07-21 21:36:46 -0700 | [diff] [blame] | 265 | |
| 266 | /* |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 267 | * R-Car sound priv |
| 268 | */ |
| 269 | struct rsnd_priv { |
| 270 | |
| 271 | struct device *dev; |
| 272 | struct rcar_snd_info *info; |
| 273 | spinlock_t lock; |
| 274 | |
| 275 | /* |
Kuninori Morimoto | 3337744 | 2013-07-21 21:36:21 -0700 | [diff] [blame] | 276 | * below value will be filled on rsnd_gen_probe() |
| 277 | */ |
| 278 | void *gen; |
| 279 | |
| 280 | /* |
Kuninori Morimoto | 07539c1 | 2013-07-21 21:36:35 -0700 | [diff] [blame] | 281 | * below value will be filled on rsnd_scu_probe() |
| 282 | */ |
| 283 | void *scu; |
| 284 | int scu_nr; |
| 285 | |
| 286 | /* |
Kuninori Morimoto | dfc9403 | 2013-07-21 21:36:46 -0700 | [diff] [blame] | 287 | * below value will be filled on rsnd_adg_probe() |
| 288 | */ |
| 289 | void *adg; |
| 290 | |
| 291 | /* |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 292 | * below value will be filled on rsnd_ssi_probe() |
| 293 | */ |
Kuninori Morimoto | dd27d80 | 2014-01-23 18:39:40 -0800 | [diff] [blame] | 294 | void *ssi; |
| 295 | int ssi_nr; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 296 | |
| 297 | /* |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 298 | * below value will be filled on rsnd_dai_probe() |
| 299 | */ |
| 300 | struct snd_soc_dai_driver *daidrv; |
| 301 | struct rsnd_dai *rdai; |
Kuninori Morimoto | ecba9e7 | 2014-02-24 22:15:18 -0800 | [diff] [blame^] | 302 | int rdai_nr; |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 303 | }; |
| 304 | |
| 305 | #define rsnd_priv_to_dev(priv) ((priv)->dev) |
Kuninori Morimoto | 5da39cf | 2014-02-24 22:15:00 -0800 | [diff] [blame] | 306 | #define rsnd_priv_to_info(priv) ((priv)->info) |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 307 | #define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags) |
| 308 | #define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags) |
| 309 | |
Kuninori Morimoto | 07539c1 | 2013-07-21 21:36:35 -0700 | [diff] [blame] | 310 | /* |
| 311 | * R-Car SCU |
| 312 | */ |
| 313 | int rsnd_scu_probe(struct platform_device *pdev, |
Kuninori Morimoto | 07539c1 | 2013-07-21 21:36:35 -0700 | [diff] [blame] | 314 | struct rsnd_priv *priv); |
| 315 | void rsnd_scu_remove(struct platform_device *pdev, |
| 316 | struct rsnd_priv *priv); |
| 317 | struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id); |
Kuninori Morimoto | ef74940 | 2013-12-19 19:28:51 -0800 | [diff] [blame] | 318 | unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, |
| 319 | struct rsnd_mod *ssi_mod, |
| 320 | struct snd_pcm_runtime *runtime); |
| 321 | |
Kuninori Morimoto | 07539c1 | 2013-07-21 21:36:35 -0700 | [diff] [blame] | 322 | #define rsnd_scu_nr(priv) ((priv)->scu_nr) |
| 323 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 324 | /* |
| 325 | * R-Car SSI |
| 326 | */ |
| 327 | int rsnd_ssi_probe(struct platform_device *pdev, |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 328 | struct rsnd_priv *priv); |
| 329 | void rsnd_ssi_remove(struct platform_device *pdev, |
| 330 | struct rsnd_priv *priv); |
| 331 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); |
Kuninori Morimoto | 4b4dab8 | 2013-07-28 18:58:29 -0700 | [diff] [blame] | 332 | struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv, |
| 333 | int dai_id, int is_play); |
Kuninori Morimoto | 7b5ce97 | 2014-01-23 18:39:32 -0800 | [diff] [blame] | 334 | int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); |
Kuninori Morimoto | 32f27eb | 2014-01-23 18:41:17 -0800 | [diff] [blame] | 335 | int rsnd_ssi_is_play(struct rsnd_mod *mod); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 336 | |
Kuninori Morimoto | 1536a96 | 2013-07-21 21:35:52 -0700 | [diff] [blame] | 337 | #endif |