Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Renesas R-Car SSIU/SSI support |
| 3 | * |
| 4 | * Copyright (C) 2013 Renesas Solutions Corp. |
| 5 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 6 | * |
| 7 | * Based on fsi.c |
| 8 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
| 14 | #include <linux/delay.h> |
| 15 | #include "rsnd.h" |
| 16 | #define RSND_SSI_NAME_SIZE 16 |
| 17 | |
| 18 | /* |
| 19 | * SSICR |
| 20 | */ |
| 21 | #define FORCE (1 << 31) /* Fixed */ |
Kuninori Morimoto | 849fc82 | 2013-07-28 18:59:02 -0700 | [diff] [blame] | 22 | #define DMEN (1 << 28) /* DMA Enable */ |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 23 | #define UIEN (1 << 27) /* Underflow Interrupt Enable */ |
| 24 | #define OIEN (1 << 26) /* Overflow Interrupt Enable */ |
| 25 | #define IIEN (1 << 25) /* Idle Mode Interrupt Enable */ |
| 26 | #define DIEN (1 << 24) /* Data Interrupt Enable */ |
Kuninori Morimoto | 186fadc | 2015-11-30 08:54:03 +0000 | [diff] [blame] | 27 | #define CHNL_4 (1 << 22) /* Channels */ |
| 28 | #define CHNL_6 (2 << 22) /* Channels */ |
| 29 | #define CHNL_8 (3 << 22) /* Channels */ |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 30 | #define DWL_8 (0 << 19) /* Data Word Length */ |
| 31 | #define DWL_16 (1 << 19) /* Data Word Length */ |
| 32 | #define DWL_18 (2 << 19) /* Data Word Length */ |
| 33 | #define DWL_20 (3 << 19) /* Data Word Length */ |
| 34 | #define DWL_22 (4 << 19) /* Data Word Length */ |
| 35 | #define DWL_24 (5 << 19) /* Data Word Length */ |
| 36 | #define DWL_32 (6 << 19) /* Data Word Length */ |
| 37 | |
| 38 | #define SWL_32 (3 << 16) /* R/W System Word Length */ |
| 39 | #define SCKD (1 << 15) /* Serial Bit Clock Direction */ |
| 40 | #define SWSD (1 << 14) /* Serial WS Direction */ |
| 41 | #define SCKP (1 << 13) /* Serial Bit Clock Polarity */ |
| 42 | #define SWSP (1 << 12) /* Serial WS Polarity */ |
| 43 | #define SDTA (1 << 10) /* Serial Data Alignment */ |
Kuninori Morimoto | f46a93b | 2015-11-17 08:28:11 +0000 | [diff] [blame] | 44 | #define PDTA (1 << 9) /* Parallel Data Alignment */ |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 45 | #define DEL (1 << 8) /* Serial Data Delay */ |
| 46 | #define CKDV(v) (v << 4) /* Serial Clock Division Ratio */ |
| 47 | #define TRMD (1 << 1) /* Transmit/Receive Mode Select */ |
| 48 | #define EN (1 << 0) /* SSI Module Enable */ |
| 49 | |
| 50 | /* |
| 51 | * SSISR |
| 52 | */ |
| 53 | #define UIRQ (1 << 27) /* Underflow Error Interrupt Status */ |
| 54 | #define OIRQ (1 << 26) /* Overflow Error Interrupt Status */ |
| 55 | #define IIRQ (1 << 25) /* Idle Mode Interrupt Status */ |
| 56 | #define DIRQ (1 << 24) /* Data Interrupt Status Flag */ |
| 57 | |
Kuninori Morimoto | 849fc82 | 2013-07-28 18:59:02 -0700 | [diff] [blame] | 58 | /* |
| 59 | * SSIWSR |
| 60 | */ |
| 61 | #define CONT (1 << 8) /* WS Continue Function */ |
Kuninori Morimoto | 186fadc | 2015-11-30 08:54:03 +0000 | [diff] [blame] | 62 | #define WS_MODE (1 << 0) /* WS Mode */ |
Kuninori Morimoto | 849fc82 | 2013-07-28 18:59:02 -0700 | [diff] [blame] | 63 | |
Kuninori Morimoto | 8aefda5 | 2014-05-22 23:25:43 -0700 | [diff] [blame] | 64 | #define SSI_NAME "ssi" |
| 65 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 66 | struct rsnd_ssi { |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 67 | struct rsnd_mod mod; |
Kuninori Morimoto | 940e947 | 2015-10-26 08:42:25 +0000 | [diff] [blame] | 68 | struct rsnd_mod *dma; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 69 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 70 | u32 flags; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 71 | u32 cr_own; |
| 72 | u32 cr_clk; |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 73 | u32 cr_mode; |
Kuninori Morimoto | 08bada2 | 2015-11-30 08:53:04 +0000 | [diff] [blame] | 74 | u32 wsr; |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 75 | int chan; |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 76 | int rate; |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 77 | int irq; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 78 | unsigned int usrcnt; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 79 | }; |
| 80 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 81 | /* flags */ |
| 82 | #define RSND_SSI_CLK_PIN_SHARE (1 << 0) |
| 83 | #define RSND_SSI_NO_BUSIF (1 << 1) /* SSI+DMA without BUSIF */ |
| 84 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 85 | #define for_each_rsnd_ssi(pos, priv, i) \ |
| 86 | for (i = 0; \ |
| 87 | (i < rsnd_ssi_nr(priv)) && \ |
Kuninori Morimoto | dd27d80 | 2014-01-23 18:39:40 -0800 | [diff] [blame] | 88 | ((pos) = ((struct rsnd_ssi *)(priv)->ssi + i)); \ |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 89 | i++) |
| 90 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 91 | #define rsnd_ssi_get(priv, id) ((struct rsnd_ssi *)(priv->ssi) + id) |
Kuninori Morimoto | 232c00b | 2015-10-26 08:38:26 +0000 | [diff] [blame] | 92 | #define rsnd_ssi_to_dma(mod) ((ssi)->dma) |
Kuninori Morimoto | dd27d80 | 2014-01-23 18:39:40 -0800 | [diff] [blame] | 93 | #define rsnd_ssi_nr(priv) ((priv)->ssi_nr) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 94 | #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod) |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 95 | #define rsnd_ssi_mode_flags(p) ((p)->flags) |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 96 | #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io)) |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 97 | #define rsnd_ssi_is_multi_slave(ssi, io) ((mod) != rsnd_io_to_mod_ssi(io)) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 98 | |
Kuninori Morimoto | b415b4d | 2015-10-22 03:15:46 +0000 | [diff] [blame] | 99 | int rsnd_ssi_use_busif(struct rsnd_dai_stream *io) |
Kuninori Morimoto | d9288d0 | 2014-06-22 17:56:23 -0700 | [diff] [blame] | 100 | { |
Kuninori Morimoto | b415b4d | 2015-10-22 03:15:46 +0000 | [diff] [blame] | 101 | struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io); |
Kuninori Morimoto | d9288d0 | 2014-06-22 17:56:23 -0700 | [diff] [blame] | 102 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | d9288d0 | 2014-06-22 17:56:23 -0700 | [diff] [blame] | 103 | int use_busif = 0; |
| 104 | |
Kuninori Morimoto | 7b466fc | 2014-11-27 08:05:54 +0000 | [diff] [blame] | 105 | if (!rsnd_ssi_is_dma_mode(mod)) |
| 106 | return 0; |
| 107 | |
Kuninori Morimoto | d9288d0 | 2014-06-22 17:56:23 -0700 | [diff] [blame] | 108 | if (!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_NO_BUSIF)) |
| 109 | use_busif = 1; |
| 110 | if (rsnd_io_to_mod_src(io)) |
| 111 | use_busif = 1; |
| 112 | |
| 113 | return use_busif; |
| 114 | } |
| 115 | |
Kuninori Morimoto | e10369d | 2015-10-26 08:42:09 +0000 | [diff] [blame] | 116 | static void rsnd_ssi_status_clear(struct rsnd_mod *mod) |
| 117 | { |
| 118 | rsnd_mod_write(mod, SSISR, 0); |
| 119 | } |
| 120 | |
| 121 | static u32 rsnd_ssi_status_get(struct rsnd_mod *mod) |
| 122 | { |
| 123 | return rsnd_mod_read(mod, SSISR); |
| 124 | } |
| 125 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 126 | static void rsnd_ssi_status_check(struct rsnd_mod *mod, |
| 127 | u32 bit) |
| 128 | { |
| 129 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
| 130 | struct device *dev = rsnd_priv_to_dev(priv); |
| 131 | u32 status; |
| 132 | int i; |
| 133 | |
| 134 | for (i = 0; i < 1024; i++) { |
Kuninori Morimoto | e10369d | 2015-10-26 08:42:09 +0000 | [diff] [blame] | 135 | status = rsnd_ssi_status_get(mod); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 136 | if (status & bit) |
| 137 | return; |
| 138 | |
| 139 | udelay(50); |
| 140 | } |
| 141 | |
| 142 | dev_warn(dev, "status check failed\n"); |
| 143 | } |
| 144 | |
Kuninori Morimoto | 37447b4 | 2015-10-26 08:40:41 +0000 | [diff] [blame] | 145 | static int rsnd_ssi_irq_enable(struct rsnd_mod *ssi_mod) |
| 146 | { |
| 147 | struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod); |
| 148 | |
| 149 | if (rsnd_is_gen1(priv)) |
| 150 | return 0; |
| 151 | |
| 152 | /* enable SSI interrupt if Gen2 */ |
| 153 | rsnd_mod_write(ssi_mod, SSI_INT_ENABLE, |
| 154 | rsnd_ssi_is_dma_mode(ssi_mod) ? |
| 155 | 0x0e000000 : 0x0f000000); |
| 156 | |
| 157 | return 0; |
| 158 | } |
| 159 | |
| 160 | static int rsnd_ssi_irq_disable(struct rsnd_mod *ssi_mod) |
| 161 | { |
| 162 | struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod); |
| 163 | |
| 164 | if (rsnd_is_gen1(priv)) |
| 165 | return 0; |
| 166 | |
| 167 | /* disable SSI interrupt if Gen2 */ |
| 168 | rsnd_mod_write(ssi_mod, SSI_INT_ENABLE, 0x00000000); |
| 169 | |
| 170 | return 0; |
| 171 | } |
| 172 | |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 173 | u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io) |
| 174 | { |
| 175 | struct rsnd_mod *mod; |
| 176 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 177 | struct rsnd_priv *priv = rsnd_io_to_priv(io); |
| 178 | struct device *dev = rsnd_priv_to_dev(priv); |
| 179 | enum rsnd_mod_type types[] = { |
| 180 | RSND_MOD_SSIM1, |
| 181 | RSND_MOD_SSIM2, |
| 182 | RSND_MOD_SSIM3, |
| 183 | }; |
| 184 | int i, mask; |
| 185 | |
| 186 | switch (runtime->channels) { |
| 187 | case 2: /* Multi channel is not needed for Stereo */ |
| 188 | return 0; |
| 189 | case 6: |
| 190 | break; |
| 191 | default: |
| 192 | dev_err(dev, "unsupported channel\n"); |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | mask = 0; |
| 197 | for (i = 0; i < ARRAY_SIZE(types); i++) { |
| 198 | mod = rsnd_io_to_mod(io, types[i]); |
| 199 | if (!mod) |
| 200 | continue; |
| 201 | |
| 202 | mask |= 1 << rsnd_mod_id(mod); |
| 203 | } |
| 204 | |
| 205 | return mask; |
| 206 | } |
| 207 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 208 | static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, |
Kuninori Morimoto | adcf7d5 | 2013-12-19 19:28:39 -0800 | [diff] [blame] | 209 | struct rsnd_dai_stream *io) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 210 | { |
Kuninori Morimoto | 1b13d118 | 2015-01-15 08:08:34 +0000 | [diff] [blame] | 211 | struct rsnd_priv *priv = rsnd_io_to_priv(io); |
Kuninori Morimoto | adcf7d5 | 2013-12-19 19:28:39 -0800 | [diff] [blame] | 212 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 213 | struct device *dev = rsnd_priv_to_dev(priv); |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 214 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
Kuninori Morimoto | b76e218 | 2015-09-10 07:02:21 +0000 | [diff] [blame] | 215 | struct rsnd_mod *mod = rsnd_mod_get(ssi); |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 216 | struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); |
Kuninori Morimoto | c140284 | 2015-12-17 02:57:27 +0000 | [diff] [blame] | 217 | int slots = rsnd_get_slot_width(io); |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 218 | int j, ret; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 219 | int ssi_clk_mul_table[] = { |
| 220 | 1, 2, 4, 8, 16, 6, 12, |
| 221 | }; |
| 222 | unsigned int main_rate; |
Kuninori Morimoto | ba9c949 | 2014-03-03 20:51:21 -0800 | [diff] [blame] | 223 | unsigned int rate = rsnd_src_get_ssi_rate(priv, io, runtime); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 224 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 225 | if (!rsnd_rdai_is_clk_master(rdai)) |
| 226 | return 0; |
| 227 | |
| 228 | if (ssi_parent_mod && !rsnd_ssi_is_parent(mod, io)) |
| 229 | return 0; |
| 230 | |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 231 | if (rsnd_ssi_is_multi_slave(mod, io)) |
| 232 | return 0; |
| 233 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 234 | if (ssi->usrcnt > 1) { |
| 235 | if (ssi->rate != rate) { |
| 236 | dev_err(dev, "SSI parent/child should use same rate\n"); |
| 237 | return -EINVAL; |
| 238 | } |
| 239 | |
| 240 | return 0; |
| 241 | } |
| 242 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 243 | /* |
| 244 | * Find best clock, and try to start ADG |
| 245 | */ |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 246 | for (j = 0; j < ARRAY_SIZE(ssi_clk_mul_table); j++) { |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 247 | |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 248 | /* |
| 249 | * this driver is assuming that |
Kuninori Morimoto | 8ec85e7 | 2015-11-30 08:53:27 +0000 | [diff] [blame] | 250 | * system word is 32bit x slots |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 251 | * see rsnd_ssi_init() |
| 252 | */ |
Kuninori Morimoto | 8ec85e7 | 2015-11-30 08:53:27 +0000 | [diff] [blame] | 253 | main_rate = rate * 32 * slots * ssi_clk_mul_table[j]; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 254 | |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 255 | ret = rsnd_adg_ssi_clk_try_start(mod, main_rate); |
| 256 | if (0 == ret) { |
| 257 | ssi->cr_clk = FORCE | SWL_32 | |
| 258 | SCKD | SWSD | CKDV(j); |
Kuninori Morimoto | 08bada2 | 2015-11-30 08:53:04 +0000 | [diff] [blame] | 259 | ssi->wsr = CONT; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 260 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 261 | ssi->rate = rate; |
| 262 | |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 263 | dev_dbg(dev, "%s[%d] outputs %u Hz\n", |
| 264 | rsnd_mod_name(mod), |
| 265 | rsnd_mod_id(mod), rate); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 266 | |
Kuninori Morimoto | eae6fff | 2015-09-10 07:03:48 +0000 | [diff] [blame] | 267 | return 0; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 268 | } |
| 269 | } |
| 270 | |
| 271 | dev_err(dev, "unsupported clock rate\n"); |
| 272 | return -EIO; |
| 273 | } |
| 274 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 275 | static void rsnd_ssi_master_clk_stop(struct rsnd_ssi *ssi, |
| 276 | struct rsnd_dai_stream *io) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 277 | { |
Kuninori Morimoto | f708d94 | 2015-01-15 08:07:19 +0000 | [diff] [blame] | 278 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
Kuninori Morimoto | b76e218 | 2015-09-10 07:02:21 +0000 | [diff] [blame] | 279 | struct rsnd_mod *mod = rsnd_mod_get(ssi); |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 280 | struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 281 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 282 | if (!rsnd_rdai_is_clk_master(rdai)) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 283 | return; |
| 284 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 285 | if (ssi_parent_mod && !rsnd_ssi_is_parent(mod, io)) |
| 286 | return; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 287 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 288 | if (ssi->usrcnt > 1) |
| 289 | return; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 290 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 291 | ssi->cr_clk = 0; |
| 292 | ssi->rate = 0; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 293 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 294 | rsnd_adg_ssi_clk_stop(mod); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 295 | } |
| 296 | |
Kuninori Morimoto | 840ada3 | 2015-11-30 08:52:38 +0000 | [diff] [blame] | 297 | static int rsnd_ssi_config_init(struct rsnd_ssi *ssi, |
| 298 | struct rsnd_dai_stream *io) |
| 299 | { |
| 300 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
| 301 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 302 | u32 cr_own; |
| 303 | u32 cr_mode; |
Kuninori Morimoto | 186fadc | 2015-11-30 08:54:03 +0000 | [diff] [blame] | 304 | u32 wsr; |
Kuninori Morimoto | f98ed11 | 2015-12-02 07:34:28 +0000 | [diff] [blame] | 305 | int is_tdm; |
| 306 | |
Kuninori Morimoto | c140284 | 2015-12-17 02:57:27 +0000 | [diff] [blame] | 307 | is_tdm = (rsnd_get_slot_width(io) >= 6) ? 1 : 0; |
Kuninori Morimoto | 840ada3 | 2015-11-30 08:52:38 +0000 | [diff] [blame] | 308 | |
| 309 | /* |
| 310 | * always use 32bit system word. |
| 311 | * see also rsnd_ssi_master_clk_enable() |
| 312 | */ |
| 313 | cr_own = FORCE | SWL_32 | PDTA; |
| 314 | |
| 315 | if (rdai->bit_clk_inv) |
| 316 | cr_own |= SCKP; |
Kuninori Morimoto | f98ed11 | 2015-12-02 07:34:28 +0000 | [diff] [blame] | 317 | if (rdai->frm_clk_inv ^ is_tdm) |
Kuninori Morimoto | 840ada3 | 2015-11-30 08:52:38 +0000 | [diff] [blame] | 318 | cr_own |= SWSP; |
| 319 | if (rdai->data_alignment) |
| 320 | cr_own |= SDTA; |
| 321 | if (rdai->sys_delay) |
| 322 | cr_own |= DEL; |
| 323 | if (rsnd_io_is_play(io)) |
| 324 | cr_own |= TRMD; |
| 325 | |
| 326 | switch (runtime->sample_bits) { |
| 327 | case 16: |
| 328 | cr_own |= DWL_16; |
| 329 | break; |
| 330 | case 32: |
| 331 | cr_own |= DWL_24; |
| 332 | break; |
| 333 | default: |
| 334 | return -EINVAL; |
| 335 | } |
| 336 | |
| 337 | if (rsnd_ssi_is_dma_mode(rsnd_mod_get(ssi))) { |
| 338 | cr_mode = UIEN | OIEN | /* over/under run */ |
| 339 | DMEN; /* DMA : enable DMA */ |
| 340 | } else { |
| 341 | cr_mode = DIEN; /* PIO : enable Data interrupt */ |
| 342 | } |
| 343 | |
Kuninori Morimoto | 186fadc | 2015-11-30 08:54:03 +0000 | [diff] [blame] | 344 | /* |
| 345 | * TDM Extend Mode |
| 346 | * see |
| 347 | * rsnd_ssiu_init_gen2() |
| 348 | */ |
| 349 | wsr = ssi->wsr; |
Kuninori Morimoto | f98ed11 | 2015-12-02 07:34:28 +0000 | [diff] [blame] | 350 | if (is_tdm) { |
Kuninori Morimoto | 186fadc | 2015-11-30 08:54:03 +0000 | [diff] [blame] | 351 | wsr |= WS_MODE; |
| 352 | cr_own |= CHNL_8; |
| 353 | } |
| 354 | |
Kuninori Morimoto | 840ada3 | 2015-11-30 08:52:38 +0000 | [diff] [blame] | 355 | ssi->cr_own = cr_own; |
| 356 | ssi->cr_mode = cr_mode; |
Kuninori Morimoto | 186fadc | 2015-11-30 08:54:03 +0000 | [diff] [blame] | 357 | ssi->wsr = wsr; |
Kuninori Morimoto | 840ada3 | 2015-11-30 08:52:38 +0000 | [diff] [blame] | 358 | |
| 359 | return 0; |
| 360 | } |
| 361 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 362 | /* |
| 363 | * SSI mod common functions |
| 364 | */ |
| 365 | static int rsnd_ssi_init(struct rsnd_mod *mod, |
Kuninori Morimoto | 2c0fac1 | 2015-06-15 06:25:20 +0000 | [diff] [blame] | 366 | struct rsnd_dai_stream *io, |
Kuninori Morimoto | 690602f | 2015-01-15 08:07:47 +0000 | [diff] [blame] | 367 | struct rsnd_priv *priv) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 368 | { |
| 369 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 370 | int ret; |
| 371 | |
| 372 | ssi->usrcnt++; |
| 373 | |
| 374 | rsnd_mod_power_on(mod); |
| 375 | |
| 376 | ret = rsnd_ssi_master_clk_start(ssi, io); |
| 377 | if (ret < 0) |
| 378 | return ret; |
| 379 | |
| 380 | if (rsnd_ssi_is_parent(mod, io)) |
| 381 | return 0; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 382 | |
Kuninori Morimoto | 840ada3 | 2015-11-30 08:52:38 +0000 | [diff] [blame] | 383 | ret = rsnd_ssi_config_init(ssi, io); |
| 384 | if (ret < 0) |
| 385 | return ret; |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 386 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 387 | /* clear error status */ |
| 388 | rsnd_ssi_status_clear(mod); |
| 389 | |
| 390 | rsnd_ssi_irq_enable(mod); |
| 391 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 392 | return 0; |
| 393 | } |
| 394 | |
| 395 | static int rsnd_ssi_quit(struct rsnd_mod *mod, |
Kuninori Morimoto | 2c0fac1 | 2015-06-15 06:25:20 +0000 | [diff] [blame] | 396 | struct rsnd_dai_stream *io, |
Kuninori Morimoto | 690602f | 2015-01-15 08:07:47 +0000 | [diff] [blame] | 397 | struct rsnd_priv *priv) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 398 | { |
| 399 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 400 | struct device *dev = rsnd_priv_to_dev(priv); |
| 401 | |
Andrzej Hajda | e5d9cfc | 2015-12-24 08:02:39 +0100 | [diff] [blame] | 402 | if (!ssi->usrcnt) { |
| 403 | dev_err(dev, "%s[%d] usrcnt error\n", |
| 404 | rsnd_mod_name(mod), rsnd_mod_id(mod)); |
| 405 | return -EIO; |
| 406 | } |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 407 | |
Andrzej Hajda | e5d9cfc | 2015-12-24 08:02:39 +0100 | [diff] [blame] | 408 | if (!rsnd_ssi_is_parent(mod, io)) { |
Andrzej Hajda | e5d9cfc | 2015-12-24 08:02:39 +0100 | [diff] [blame] | 409 | ssi->cr_own = 0; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 410 | |
Andrzej Hajda | e5d9cfc | 2015-12-24 08:02:39 +0100 | [diff] [blame] | 411 | rsnd_ssi_irq_disable(mod); |
| 412 | } |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 413 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 414 | rsnd_ssi_master_clk_stop(ssi, io); |
| 415 | |
| 416 | rsnd_mod_power_off(mod); |
| 417 | |
| 418 | ssi->usrcnt--; |
| 419 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 420 | return 0; |
| 421 | } |
| 422 | |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 423 | static int rsnd_ssi_hw_params(struct rsnd_mod *mod, |
Kuninori Morimoto | 2c0fac1 | 2015-06-15 06:25:20 +0000 | [diff] [blame] | 424 | struct rsnd_dai_stream *io, |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 425 | struct snd_pcm_substream *substream, |
| 426 | struct snd_pcm_hw_params *params) |
| 427 | { |
| 428 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 429 | int chan = params_channels(params); |
| 430 | |
| 431 | /* |
| 432 | * Already working. |
| 433 | * It will happen if SSI has parent/child connection. |
| 434 | */ |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 435 | if (ssi->usrcnt > 1) { |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 436 | /* |
| 437 | * it is error if child <-> parent SSI uses |
| 438 | * different channels. |
| 439 | */ |
| 440 | if (ssi->chan != chan) |
| 441 | return -EIO; |
| 442 | } |
| 443 | |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 444 | ssi->chan = chan; |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 445 | |
| 446 | return 0; |
| 447 | } |
| 448 | |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 449 | static int rsnd_ssi_start(struct rsnd_mod *mod, |
| 450 | struct rsnd_dai_stream *io, |
| 451 | struct rsnd_priv *priv) |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 452 | { |
| 453 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
| 454 | u32 cr; |
| 455 | |
| 456 | cr = ssi->cr_own | |
| 457 | ssi->cr_clk | |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 458 | ssi->cr_mode; |
| 459 | |
| 460 | /* |
| 461 | * EN will be set via SSIU :: SSI_CONTROL |
| 462 | * if Multi channel mode |
| 463 | */ |
| 464 | if (!rsnd_ssi_multi_slaves(io)) |
| 465 | cr |= EN; |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 466 | |
| 467 | rsnd_mod_write(mod, SSICR, cr); |
Kuninori Morimoto | 08bada2 | 2015-11-30 08:53:04 +0000 | [diff] [blame] | 468 | rsnd_mod_write(mod, SSIWSR, ssi->wsr); |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 469 | |
| 470 | return 0; |
| 471 | } |
| 472 | |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 473 | static int rsnd_ssi_stop(struct rsnd_mod *mod, |
| 474 | struct rsnd_dai_stream *io, |
| 475 | struct rsnd_priv *priv) |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 476 | { |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 477 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 478 | u32 cr; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 479 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 480 | /* |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 481 | * don't stop if not last user |
| 482 | * see also |
| 483 | * rsnd_ssi_start |
| 484 | * rsnd_ssi_interrupt |
| 485 | */ |
| 486 | if (ssi->usrcnt > 1) |
| 487 | return 0; |
| 488 | |
| 489 | /* |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 490 | * disable all IRQ, |
| 491 | * and, wait all data was sent |
| 492 | */ |
| 493 | cr = ssi->cr_own | |
| 494 | ssi->cr_clk; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 495 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 496 | rsnd_mod_write(mod, SSICR, cr | EN); |
| 497 | rsnd_ssi_status_check(mod, DIRQ); |
| 498 | |
| 499 | /* |
| 500 | * disable SSI, |
| 501 | * and, wait idle state |
| 502 | */ |
| 503 | rsnd_mod_write(mod, SSICR, cr); /* disabled all */ |
| 504 | rsnd_ssi_status_check(mod, IIRQ); |
Kuninori Morimoto | c17dba8 | 2014-11-27 08:05:09 +0000 | [diff] [blame] | 505 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 506 | return 0; |
| 507 | } |
| 508 | |
Kuninori Morimoto | bfc0cfe | 2015-06-15 06:26:56 +0000 | [diff] [blame] | 509 | static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
| 510 | struct rsnd_dai_stream *io) |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 511 | { |
Kuninori Morimoto | 690602f | 2015-01-15 08:07:47 +0000 | [diff] [blame] | 512 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
Kuninori Morimoto | 765ae7c | 2015-01-15 08:09:13 +0000 | [diff] [blame] | 513 | int is_dma = rsnd_ssi_is_dma_mode(mod); |
Kuninori Morimoto | 02299d9 | 2015-05-21 03:50:23 +0000 | [diff] [blame] | 514 | u32 status; |
Kuninori Morimoto | 75defee | 2015-06-15 06:21:15 +0000 | [diff] [blame] | 515 | bool elapsed = false; |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 516 | bool stop = false; |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 517 | |
Kuninori Morimoto | 02299d9 | 2015-05-21 03:50:23 +0000 | [diff] [blame] | 518 | spin_lock(&priv->lock); |
| 519 | |
| 520 | /* ignore all cases if not working */ |
Kuninori Morimoto | d5bbe7d | 2015-06-15 06:27:47 +0000 | [diff] [blame] | 521 | if (!rsnd_io_is_working(io)) |
Kuninori Morimoto | 02299d9 | 2015-05-21 03:50:23 +0000 | [diff] [blame] | 522 | goto rsnd_ssi_interrupt_out; |
| 523 | |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 524 | status = rsnd_ssi_status_get(mod); |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 525 | |
| 526 | /* PIO only */ |
Kuninori Morimoto | 765ae7c | 2015-01-15 08:09:13 +0000 | [diff] [blame] | 527 | if (!is_dma && (status & DIRQ)) { |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 528 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 529 | u32 *buf = (u32 *)(runtime->dma_area + |
| 530 | rsnd_dai_pointer_offset(io, 0)); |
| 531 | |
| 532 | /* |
| 533 | * 8/16/32 data can be assesse to TDR/RDR register |
| 534 | * directly as 32bit data |
| 535 | * see rsnd_ssi_init() |
| 536 | */ |
Kuninori Morimoto | 985a4f6 | 2015-01-15 08:06:49 +0000 | [diff] [blame] | 537 | if (rsnd_io_is_play(io)) |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 538 | rsnd_mod_write(mod, SSITDR, *buf); |
| 539 | else |
| 540 | *buf = rsnd_mod_read(mod, SSIRDR); |
| 541 | |
Kuninori Morimoto | 75defee | 2015-06-15 06:21:15 +0000 | [diff] [blame] | 542 | elapsed = rsnd_dai_pointer_update(io, sizeof(*buf)); |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 543 | } |
| 544 | |
Kuninori Morimoto | 12927a8 | 2015-06-15 06:20:54 +0000 | [diff] [blame] | 545 | /* DMA only */ |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 546 | if (is_dma && (status & (UIRQ | OIRQ))) |
| 547 | stop = true; |
Kuninori Morimoto | 69e32a5 | 2015-10-26 08:41:36 +0000 | [diff] [blame] | 548 | |
Kuninori Morimoto | 5342dff | 2015-11-26 11:13:40 +0000 | [diff] [blame] | 549 | rsnd_ssi_status_clear(mod); |
Kuninori Morimoto | 02299d9 | 2015-05-21 03:50:23 +0000 | [diff] [blame] | 550 | rsnd_ssi_interrupt_out: |
| 551 | spin_unlock(&priv->lock); |
| 552 | |
Kuninori Morimoto | 75defee | 2015-06-15 06:21:15 +0000 | [diff] [blame] | 553 | if (elapsed) |
| 554 | rsnd_dai_period_elapsed(io); |
Kuninori Morimoto | 6a25c8d | 2016-01-26 04:56:14 +0000 | [diff] [blame^] | 555 | |
| 556 | if (stop) |
| 557 | snd_pcm_stop_xrun(io->substream); |
| 558 | |
Kuninori Morimoto | bfc0cfe | 2015-06-15 06:26:56 +0000 | [diff] [blame] | 559 | } |
| 560 | |
| 561 | static irqreturn_t rsnd_ssi_interrupt(int irq, void *data) |
| 562 | { |
| 563 | struct rsnd_mod *mod = data; |
| 564 | |
| 565 | rsnd_mod_interrupt(mod, __rsnd_ssi_interrupt); |
Kuninori Morimoto | 75defee | 2015-06-15 06:21:15 +0000 | [diff] [blame] | 566 | |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 567 | return IRQ_HANDLED; |
| 568 | } |
| 569 | |
Kuninori Morimoto | 6cfad78 | 2014-11-27 08:08:10 +0000 | [diff] [blame] | 570 | /* |
| 571 | * SSI PIO |
| 572 | */ |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 573 | static void rsnd_ssi_parent_attach(struct rsnd_mod *mod, |
| 574 | struct rsnd_dai_stream *io, |
| 575 | struct rsnd_priv *priv) |
| 576 | { |
| 577 | if (!__rsnd_ssi_is_pin_sharing(mod)) |
| 578 | return; |
| 579 | |
| 580 | switch (rsnd_mod_id(mod)) { |
| 581 | case 1: |
| 582 | case 2: |
| 583 | rsnd_dai_connect(rsnd_ssi_mod_get(priv, 0), io, RSND_MOD_SSIP); |
| 584 | break; |
| 585 | case 4: |
| 586 | rsnd_dai_connect(rsnd_ssi_mod_get(priv, 3), io, RSND_MOD_SSIP); |
| 587 | break; |
| 588 | case 8: |
| 589 | rsnd_dai_connect(rsnd_ssi_mod_get(priv, 7), io, RSND_MOD_SSIP); |
| 590 | break; |
| 591 | } |
| 592 | } |
| 593 | |
Kuninori Morimoto | c7f69ab | 2015-10-26 08:43:41 +0000 | [diff] [blame] | 594 | static int rsnd_ssi_common_probe(struct rsnd_mod *mod, |
| 595 | struct rsnd_dai_stream *io, |
| 596 | struct rsnd_priv *priv) |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 597 | { |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 598 | struct device *dev = rsnd_priv_to_dev(priv); |
| 599 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 600 | int ret; |
| 601 | |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 602 | /* |
| 603 | * SSIP/SSIU/IRQ are not needed on |
| 604 | * SSI Multi slaves |
| 605 | */ |
| 606 | if (rsnd_ssi_is_multi_slave(mod, io)) |
| 607 | return 0; |
| 608 | |
Kuninori Morimoto | e7d850d | 2015-10-26 08:43:57 +0000 | [diff] [blame] | 609 | rsnd_ssi_parent_attach(mod, io, priv); |
| 610 | |
Kuninori Morimoto | c7f69ab | 2015-10-26 08:43:41 +0000 | [diff] [blame] | 611 | ret = rsnd_ssiu_attach(io, mod); |
| 612 | if (ret < 0) |
| 613 | return ret; |
| 614 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 615 | ret = devm_request_irq(dev, ssi->irq, |
Kuninori Morimoto | 6cfad78 | 2014-11-27 08:08:10 +0000 | [diff] [blame] | 616 | rsnd_ssi_interrupt, |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 617 | IRQF_SHARED, |
Kuninori Morimoto | bfc0cfe | 2015-06-15 06:26:56 +0000 | [diff] [blame] | 618 | dev_name(dev), mod); |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 619 | |
| 620 | return ret; |
| 621 | } |
| 622 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 623 | static struct rsnd_mod_ops rsnd_ssi_pio_ops = { |
Kuninori Morimoto | 8aefda5 | 2014-05-22 23:25:43 -0700 | [diff] [blame] | 624 | .name = SSI_NAME, |
Kuninori Morimoto | c7f69ab | 2015-10-26 08:43:41 +0000 | [diff] [blame] | 625 | .probe = rsnd_ssi_common_probe, |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 626 | .init = rsnd_ssi_init, |
| 627 | .quit = rsnd_ssi_quit, |
Kuninori Morimoto | 4922985 | 2014-11-27 08:07:17 +0000 | [diff] [blame] | 628 | .start = rsnd_ssi_start, |
| 629 | .stop = rsnd_ssi_stop, |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 630 | .hw_params = rsnd_ssi_hw_params, |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 631 | }; |
| 632 | |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 633 | static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, |
Kuninori Morimoto | 2c0fac1 | 2015-06-15 06:25:20 +0000 | [diff] [blame] | 634 | struct rsnd_dai_stream *io, |
Kuninori Morimoto | 690602f | 2015-01-15 08:07:47 +0000 | [diff] [blame] | 635 | struct rsnd_priv *priv) |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 636 | { |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 637 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 638 | int dma_id = 0; /* not needed */ |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 639 | int ret; |
| 640 | |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 641 | /* |
| 642 | * SSIP/SSIU/IRQ/DMA are not needed on |
| 643 | * SSI Multi slaves |
| 644 | */ |
| 645 | if (rsnd_ssi_is_multi_slave(mod, io)) |
| 646 | return 0; |
| 647 | |
Kuninori Morimoto | c7f69ab | 2015-10-26 08:43:41 +0000 | [diff] [blame] | 648 | ret = rsnd_ssi_common_probe(mod, io, priv); |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 649 | if (ret) |
Kuninori Morimoto | b543b52 | 2015-03-26 04:02:32 +0000 | [diff] [blame] | 650 | return ret; |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 651 | |
Kuninori Morimoto | 355cb84fb | 2016-01-21 01:58:33 +0000 | [diff] [blame] | 652 | /* SSI probe might be called many times in MUX multi path */ |
| 653 | ret = rsnd_dma_attach(io, mod, &ssi->dma, dma_id); |
Kuninori Morimoto | 8aefda5 | 2014-05-22 23:25:43 -0700 | [diff] [blame] | 654 | |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 655 | return ret; |
| 656 | } |
| 657 | |
| 658 | static int rsnd_ssi_dma_remove(struct rsnd_mod *mod, |
Kuninori Morimoto | 2c0fac1 | 2015-06-15 06:25:20 +0000 | [diff] [blame] | 659 | struct rsnd_dai_stream *io, |
Kuninori Morimoto | 690602f | 2015-01-15 08:07:47 +0000 | [diff] [blame] | 660 | struct rsnd_priv *priv) |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 661 | { |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 662 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
| 663 | struct device *dev = rsnd_priv_to_dev(priv); |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 664 | int irq = ssi->irq; |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 665 | |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 666 | /* PIO will request IRQ again */ |
Kuninori Morimoto | b05ce4c | 2015-10-22 03:13:44 +0000 | [diff] [blame] | 667 | devm_free_irq(dev, irq, mod); |
Kuninori Morimoto | 4e7d606 | 2014-11-27 08:07:47 +0000 | [diff] [blame] | 668 | |
Kuninori Morimoto | 97463e1 | 2014-11-27 08:02:43 +0000 | [diff] [blame] | 669 | return 0; |
| 670 | } |
| 671 | |
| 672 | static int rsnd_ssi_fallback(struct rsnd_mod *mod, |
Kuninori Morimoto | 2c0fac1 | 2015-06-15 06:25:20 +0000 | [diff] [blame] | 673 | struct rsnd_dai_stream *io, |
Kuninori Morimoto | 690602f | 2015-01-15 08:07:47 +0000 | [diff] [blame] | 674 | struct rsnd_priv *priv) |
Kuninori Morimoto | 97463e1 | 2014-11-27 08:02:43 +0000 | [diff] [blame] | 675 | { |
Kuninori Morimoto | d3a7682 | 2014-11-09 20:00:58 -0800 | [diff] [blame] | 676 | struct device *dev = rsnd_priv_to_dev(priv); |
| 677 | |
Kuninori Morimoto | d3a7682 | 2014-11-09 20:00:58 -0800 | [diff] [blame] | 678 | /* |
| 679 | * fallback to PIO |
| 680 | * |
| 681 | * SSI .probe might be called again. |
| 682 | * see |
| 683 | * rsnd_rdai_continuance_probe() |
| 684 | */ |
| 685 | mod->ops = &rsnd_ssi_pio_ops; |
| 686 | |
| 687 | dev_info(dev, "%s[%d] fallback to PIO mode\n", |
| 688 | rsnd_mod_name(mod), rsnd_mod_id(mod)); |
| 689 | |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 690 | return 0; |
| 691 | } |
| 692 | |
Kuninori Morimoto | 9b99e9a | 2015-06-15 06:26:25 +0000 | [diff] [blame] | 693 | static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io, |
| 694 | struct rsnd_mod *mod) |
Kuninori Morimoto | d9288d0 | 2014-06-22 17:56:23 -0700 | [diff] [blame] | 695 | { |
Kuninori Morimoto | 72adc61 | 2015-02-20 10:31:23 +0000 | [diff] [blame] | 696 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
Kuninori Morimoto | 72adc61 | 2015-02-20 10:31:23 +0000 | [diff] [blame] | 697 | int is_play = rsnd_io_is_play(io); |
| 698 | char *name; |
| 699 | |
Kuninori Morimoto | b415b4d | 2015-10-22 03:15:46 +0000 | [diff] [blame] | 700 | if (rsnd_ssi_use_busif(io)) |
Kuninori Morimoto | 72adc61 | 2015-02-20 10:31:23 +0000 | [diff] [blame] | 701 | name = is_play ? "rxu" : "txu"; |
| 702 | else |
| 703 | name = is_play ? "rx" : "tx"; |
| 704 | |
| 705 | return rsnd_dma_request_channel(rsnd_ssi_of_node(priv), |
| 706 | mod, name); |
Kuninori Morimoto | d9288d0 | 2014-06-22 17:56:23 -0700 | [diff] [blame] | 707 | } |
| 708 | |
Kuninori Morimoto | 849fc82 | 2013-07-28 18:59:02 -0700 | [diff] [blame] | 709 | static struct rsnd_mod_ops rsnd_ssi_dma_ops = { |
Kuninori Morimoto | 8aefda5 | 2014-05-22 23:25:43 -0700 | [diff] [blame] | 710 | .name = SSI_NAME, |
Kuninori Morimoto | 72adc61 | 2015-02-20 10:31:23 +0000 | [diff] [blame] | 711 | .dma_req = rsnd_ssi_dma_req, |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 712 | .probe = rsnd_ssi_dma_probe, |
| 713 | .remove = rsnd_ssi_dma_remove, |
Kuninori Morimoto | 849fc82 | 2013-07-28 18:59:02 -0700 | [diff] [blame] | 714 | .init = rsnd_ssi_init, |
| 715 | .quit = rsnd_ssi_quit, |
Kuninori Morimoto | 497deba | 2015-10-26 08:43:01 +0000 | [diff] [blame] | 716 | .start = rsnd_ssi_start, |
| 717 | .stop = rsnd_ssi_stop, |
Kuninori Morimoto | 97463e1 | 2014-11-27 08:02:43 +0000 | [diff] [blame] | 718 | .fallback = rsnd_ssi_fallback, |
Kuninori Morimoto | 919567d | 2015-04-10 08:50:30 +0000 | [diff] [blame] | 719 | .hw_params = rsnd_ssi_hw_params, |
Kuninori Morimoto | 849fc82 | 2013-07-28 18:59:02 -0700 | [diff] [blame] | 720 | }; |
| 721 | |
Kuninori Morimoto | 0579541 | 2014-11-27 08:05:01 +0000 | [diff] [blame] | 722 | int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod) |
| 723 | { |
| 724 | return mod->ops == &rsnd_ssi_dma_ops; |
| 725 | } |
| 726 | |
| 727 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 728 | /* |
| 729 | * Non SSI |
| 730 | */ |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 731 | static struct rsnd_mod_ops rsnd_ssi_non_ops = { |
Kuninori Morimoto | 8aefda5 | 2014-05-22 23:25:43 -0700 | [diff] [blame] | 732 | .name = SSI_NAME, |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 733 | }; |
| 734 | |
| 735 | /* |
| 736 | * ssi mod function |
| 737 | */ |
Kuninori Morimoto | b4c83b1 | 2015-12-17 03:00:10 +0000 | [diff] [blame] | 738 | static void rsnd_ssi_connect(struct rsnd_mod *mod, |
| 739 | struct rsnd_dai_stream *io) |
| 740 | { |
| 741 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
| 742 | enum rsnd_mod_type types[] = { |
| 743 | RSND_MOD_SSI, |
| 744 | RSND_MOD_SSIM1, |
| 745 | RSND_MOD_SSIM2, |
| 746 | RSND_MOD_SSIM3, |
| 747 | }; |
| 748 | enum rsnd_mod_type type; |
| 749 | int i; |
| 750 | |
| 751 | /* try SSI -> SSIM1 -> SSIM2 -> SSIM3 */ |
| 752 | for (i = 0; i < ARRAY_SIZE(types); i++) { |
| 753 | type = types[i]; |
| 754 | if (!rsnd_io_to_mod(io, type)) { |
| 755 | rsnd_dai_connect(mod, io, type); |
| 756 | rsnd_set_slot(rdai, 2 * (i + 1), (i + 1)); |
| 757 | return; |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | void rsnd_parse_connect_ssi(struct rsnd_dai *rdai, |
| 763 | struct device_node *playback, |
| 764 | struct device_node *capture) |
| 765 | { |
| 766 | struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai); |
| 767 | struct device_node *node; |
| 768 | struct device_node *np; |
| 769 | struct rsnd_mod *mod; |
| 770 | int i; |
| 771 | |
| 772 | node = rsnd_ssi_of_node(priv); |
| 773 | if (!node) |
| 774 | return; |
| 775 | |
| 776 | i = 0; |
| 777 | for_each_child_of_node(node, np) { |
| 778 | mod = rsnd_ssi_mod_get(priv, i); |
| 779 | if (np == playback) |
| 780 | rsnd_ssi_connect(mod, &rdai->playback); |
| 781 | if (np == capture) |
| 782 | rsnd_ssi_connect(mod, &rdai->capture); |
| 783 | i++; |
| 784 | } |
| 785 | |
| 786 | of_node_put(node); |
| 787 | } |
| 788 | |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 789 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) |
| 790 | { |
Takashi Iwai | 8b14719 | 2013-11-05 18:40:05 +0100 | [diff] [blame] | 791 | if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv))) |
| 792 | id = 0; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 793 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 794 | return rsnd_mod_get(rsnd_ssi_get(priv, id)); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 795 | } |
| 796 | |
Kuninori Morimoto | b415b4d | 2015-10-22 03:15:46 +0000 | [diff] [blame] | 797 | int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) |
Kuninori Morimoto | 7b5ce97 | 2014-01-23 18:39:32 -0800 | [diff] [blame] | 798 | { |
| 799 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
| 800 | |
| 801 | return !!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_CLK_PIN_SHARE); |
| 802 | } |
| 803 | |
Kuninori Morimoto | 5ba17b42 | 2016-01-21 01:58:07 +0000 | [diff] [blame] | 804 | static u32 *rsnd_ssi_get_status(struct rsnd_dai_stream *io, |
| 805 | struct rsnd_mod *mod, |
| 806 | enum rsnd_mod_type type) |
| 807 | { |
| 808 | /* |
| 809 | * SSIP (= SSI parent) needs to be special, otherwise, |
| 810 | * 2nd SSI might doesn't start. see also rsnd_mod_call() |
| 811 | * |
| 812 | * We can't include parent SSI status on SSI, because we don't know |
| 813 | * how many SSI requests parent SSI. Thus, it is localed on "io" now. |
| 814 | * ex) trouble case |
| 815 | * Playback: SSI0 |
| 816 | * Capture : SSI1 (needs SSI0) |
| 817 | * |
| 818 | * 1) start Capture -> SSI0/SSI1 are started. |
| 819 | * 2) start Playback -> SSI0 doesn't work, because it is already |
| 820 | * marked as "started" on 1) |
| 821 | * |
| 822 | * OTOH, using each mod's status is good for MUX case. |
| 823 | * It doesn't need to start in 2nd start |
| 824 | * ex) |
| 825 | * IO-0: SRC0 -> CTU1 -+-> MUX -> DVC -> SSIU -> SSI0 |
| 826 | * | |
| 827 | * IO-1: SRC1 -> CTU2 -+ |
| 828 | * |
| 829 | * 1) start IO-0 -> start SSI0 |
| 830 | * 2) start IO-1 -> SSI0 doesn't need to start, because it is |
| 831 | * already started on 1) |
| 832 | */ |
| 833 | if (type == RSND_MOD_SSIP) |
| 834 | return &io->parent_ssi_status; |
| 835 | |
| 836 | return rsnd_mod_get_status(io, mod, type); |
| 837 | } |
| 838 | |
Kuninori Morimoto | 2ea6b07 | 2015-11-10 05:14:12 +0000 | [diff] [blame] | 839 | int rsnd_ssi_probe(struct rsnd_priv *priv) |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 840 | { |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 841 | struct device_node *node; |
| 842 | struct device_node *np; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 843 | struct device *dev = rsnd_priv_to_dev(priv); |
| 844 | struct rsnd_mod_ops *ops; |
| 845 | struct clk *clk; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 846 | struct rsnd_ssi *ssi; |
| 847 | char name[RSND_SSI_NAME_SIZE]; |
Kuninori Morimoto | 2f78dd7 | 2015-03-26 04:02:09 +0000 | [diff] [blame] | 848 | int i, nr, ret; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 849 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 850 | node = rsnd_ssi_of_node(priv); |
| 851 | if (!node) |
| 852 | return -EINVAL; |
Kuninori Morimoto | 90e8e50 | 2014-03-17 19:29:55 -0700 | [diff] [blame] | 853 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 854 | nr = of_get_child_count(node); |
| 855 | if (!nr) { |
| 856 | ret = -EINVAL; |
| 857 | goto rsnd_ssi_probe_done; |
| 858 | } |
| 859 | |
Kuninori Morimoto | dd27d80 | 2014-01-23 18:39:40 -0800 | [diff] [blame] | 860 | ssi = devm_kzalloc(dev, sizeof(*ssi) * nr, GFP_KERNEL); |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 861 | if (!ssi) { |
| 862 | ret = -ENOMEM; |
| 863 | goto rsnd_ssi_probe_done; |
| 864 | } |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 865 | |
Kuninori Morimoto | dd27d80 | 2014-01-23 18:39:40 -0800 | [diff] [blame] | 866 | priv->ssi = ssi; |
| 867 | priv->ssi_nr = nr; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 868 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 869 | i = 0; |
| 870 | for_each_child_of_node(node, np) { |
| 871 | ssi = rsnd_ssi_get(priv, i); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 872 | |
Kuninori Morimoto | 8aefda5 | 2014-05-22 23:25:43 -0700 | [diff] [blame] | 873 | snprintf(name, RSND_SSI_NAME_SIZE, "%s.%d", |
| 874 | SSI_NAME, i); |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 875 | |
Kuninori Morimoto | 60dbb4f | 2013-12-03 22:09:33 -0800 | [diff] [blame] | 876 | clk = devm_clk_get(dev, name); |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 877 | if (IS_ERR(clk)) { |
| 878 | ret = PTR_ERR(clk); |
| 879 | goto rsnd_ssi_probe_done; |
| 880 | } |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 881 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 882 | if (of_get_property(np, "shared-pin", NULL)) |
| 883 | ssi->flags |= RSND_SSI_CLK_PIN_SHARE; |
| 884 | |
| 885 | if (of_get_property(np, "no-busif", NULL)) |
| 886 | ssi->flags |= RSND_SSI_NO_BUSIF; |
| 887 | |
| 888 | ssi->irq = irq_of_parse_and_map(np, 0); |
| 889 | if (!ssi->irq) { |
| 890 | ret = -EINVAL; |
| 891 | goto rsnd_ssi_probe_done; |
| 892 | } |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 893 | |
| 894 | ops = &rsnd_ssi_non_ops; |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 895 | if (of_get_property(np, "pio-transfer", NULL)) |
Kuninori Morimoto | ff8f30e | 2014-03-03 20:50:49 -0800 | [diff] [blame] | 896 | ops = &rsnd_ssi_pio_ops; |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 897 | else |
| 898 | ops = &rsnd_ssi_dma_ops; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 899 | |
Kuninori Morimoto | b76e218 | 2015-09-10 07:02:21 +0000 | [diff] [blame] | 900 | ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk, |
Kuninori Morimoto | 5ba17b42 | 2016-01-21 01:58:07 +0000 | [diff] [blame] | 901 | rsnd_ssi_get_status, RSND_MOD_SSI, i); |
Kuninori Morimoto | 2f78dd7 | 2015-03-26 04:02:09 +0000 | [diff] [blame] | 902 | if (ret) |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 903 | goto rsnd_ssi_probe_done; |
| 904 | |
| 905 | i++; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 906 | } |
| 907 | |
Kuninori Morimoto | 02534f2 | 2015-11-10 05:11:35 +0000 | [diff] [blame] | 908 | ret = 0; |
| 909 | |
| 910 | rsnd_ssi_probe_done: |
| 911 | of_node_put(node); |
| 912 | |
| 913 | return ret; |
Kuninori Morimoto | ae5c322 | 2013-07-21 21:36:57 -0700 | [diff] [blame] | 914 | } |
Kuninori Morimoto | 2f78dd7 | 2015-03-26 04:02:09 +0000 | [diff] [blame] | 915 | |
Kuninori Morimoto | 2ea6b07 | 2015-11-10 05:14:12 +0000 | [diff] [blame] | 916 | void rsnd_ssi_remove(struct rsnd_priv *priv) |
Kuninori Morimoto | 2f78dd7 | 2015-03-26 04:02:09 +0000 | [diff] [blame] | 917 | { |
| 918 | struct rsnd_ssi *ssi; |
| 919 | int i; |
| 920 | |
| 921 | for_each_rsnd_ssi(ssi, priv, i) { |
Kuninori Morimoto | b76e218 | 2015-09-10 07:02:21 +0000 | [diff] [blame] | 922 | rsnd_mod_quit(rsnd_mod_get(ssi)); |
Kuninori Morimoto | 2f78dd7 | 2015-03-26 04:02:09 +0000 | [diff] [blame] | 923 | } |
| 924 | } |