1 From 2d6dfbd200d8de9bef8fb30bec90594acea9a145 Mon Sep 17 00:00:00 2001
2 From: Dong Aisheng <aisheng.dong@nxp.com>
3 Date: Fri, 16 Aug 2019 18:01:26 +0800
4 Subject: [PATCH] Revert "ASoC: fsl_sai: Add support for SAI new version"
6 This reverts commit 4f7a0728b5305e2d865f543fbcffd617e03c7674.
8 sound/soc/fsl/fsl_sai.c | 228 ++++++++++++++++++++----------------------------
9 sound/soc/fsl/fsl_sai.h | 41 +++++----
10 2 files changed, 113 insertions(+), 156 deletions(-)
12 --- a/sound/soc/fsl/fsl_sai.c
13 +++ b/sound/soc/fsl/fsl_sai.c
14 @@ -40,7 +40,6 @@ static const struct snd_pcm_hw_constrain
15 static irqreturn_t fsl_sai_isr(int irq, void *devid)
17 struct fsl_sai *sai = (struct fsl_sai *)devid;
18 - unsigned int ofs = sai->soc_data->reg_offset;
19 struct device *dev = &sai->pdev->dev;
20 u32 flags, xcsr, mask;
22 @@ -53,7 +52,7 @@ static irqreturn_t fsl_sai_isr(int irq,
23 mask = (FSL_SAI_FLAGS >> FSL_SAI_CSR_xIE_SHIFT) << FSL_SAI_CSR_xF_SHIFT;
26 - regmap_read(sai->regmap, FSL_SAI_TCSR(ofs), &xcsr);
27 + regmap_read(sai->regmap, FSL_SAI_TCSR, &xcsr);
31 @@ -83,11 +82,11 @@ static irqreturn_t fsl_sai_isr(int irq,
32 xcsr &= ~FSL_SAI_CSR_xF_MASK;
35 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), flags | xcsr);
36 + regmap_write(sai->regmap, FSL_SAI_TCSR, flags | xcsr);
40 - regmap_read(sai->regmap, FSL_SAI_RCSR(ofs), &xcsr);
41 + regmap_read(sai->regmap, FSL_SAI_RCSR, &xcsr);
45 @@ -117,7 +116,7 @@ irq_rx:
46 xcsr &= ~FSL_SAI_CSR_xF_MASK;
49 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), flags | xcsr);
50 + regmap_write(sai->regmap, FSL_SAI_RCSR, flags | xcsr);
54 @@ -141,7 +140,6 @@ static int fsl_sai_set_dai_sysclk_tr(str
55 int clk_id, unsigned int freq, int fsl_dir)
57 struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
58 - unsigned int ofs = sai->soc_data->reg_offset;
59 bool tx = fsl_dir == FSL_FMT_TRANSMITTER;
62 @@ -162,7 +160,7 @@ static int fsl_sai_set_dai_sysclk_tr(str
66 - regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, ofs),
67 + regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx),
68 FSL_SAI_CR2_MSEL_MASK, val_cr2);
71 @@ -195,7 +193,6 @@ static int fsl_sai_set_dai_fmt_tr(struct
72 unsigned int fmt, int fsl_dir)
74 struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
75 - unsigned int ofs = sai->soc_data->reg_offset;
76 bool tx = fsl_dir == FSL_FMT_TRANSMITTER;
77 u32 val_cr2 = 0, val_cr4 = 0;
79 @@ -290,9 +287,9 @@ static int fsl_sai_set_dai_fmt_tr(struct
83 - regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, ofs),
84 + regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx),
85 FSL_SAI_CR2_BCP | FSL_SAI_CR2_BCD_MSTR, val_cr2);
86 - regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, ofs),
87 + regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx),
88 FSL_SAI_CR4_MF | FSL_SAI_CR4_FSE |
89 FSL_SAI_CR4_FSP | FSL_SAI_CR4_FSD_MSTR, val_cr4);
91 @@ -319,7 +316,6 @@ static int fsl_sai_set_dai_fmt(struct sn
92 static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)
94 struct fsl_sai *sai = snd_soc_dai_get_drvdata(dai);
95 - unsigned int ofs = sai->soc_data->reg_offset;
96 unsigned long clk_rate;
97 u32 savediv = 0, ratio, savesub = freq;
99 @@ -382,17 +378,17 @@ static int fsl_sai_set_bclk(struct snd_s
101 if ((sai->synchronous[TX] && !sai->synchronous[RX]) ||
102 (!tx && !sai->synchronous[RX])) {
103 - regmap_update_bits(sai->regmap, FSL_SAI_RCR2(ofs),
104 + regmap_update_bits(sai->regmap, FSL_SAI_RCR2,
105 FSL_SAI_CR2_MSEL_MASK,
106 FSL_SAI_CR2_MSEL(sai->mclk_id[tx]));
107 - regmap_update_bits(sai->regmap, FSL_SAI_RCR2(ofs),
108 + regmap_update_bits(sai->regmap, FSL_SAI_RCR2,
109 FSL_SAI_CR2_DIV_MASK, savediv - 1);
110 } else if ((sai->synchronous[RX] && !sai->synchronous[TX]) ||
111 (tx && !sai->synchronous[TX])) {
112 - regmap_update_bits(sai->regmap, FSL_SAI_TCR2(ofs),
113 + regmap_update_bits(sai->regmap, FSL_SAI_TCR2,
114 FSL_SAI_CR2_MSEL_MASK,
115 FSL_SAI_CR2_MSEL(sai->mclk_id[tx]));
116 - regmap_update_bits(sai->regmap, FSL_SAI_TCR2(ofs),
117 + regmap_update_bits(sai->regmap, FSL_SAI_TCR2,
118 FSL_SAI_CR2_DIV_MASK, savediv - 1);
121 @@ -407,7 +403,6 @@ static int fsl_sai_hw_params(struct snd_
122 struct snd_soc_dai *cpu_dai)
124 struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
125 - unsigned int ofs = sai->soc_data->reg_offset;
126 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
127 unsigned int channels = params_channels(params);
128 u32 word_width = params_width(params);
129 @@ -460,19 +455,19 @@ static int fsl_sai_hw_params(struct snd_
131 if (!sai->is_slave_mode) {
132 if (!sai->synchronous[TX] && sai->synchronous[RX] && !tx) {
133 - regmap_update_bits(sai->regmap, FSL_SAI_TCR4(ofs),
134 + regmap_update_bits(sai->regmap, FSL_SAI_TCR4,
135 FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK,
137 - regmap_update_bits(sai->regmap, FSL_SAI_TCR5(ofs),
138 + regmap_update_bits(sai->regmap, FSL_SAI_TCR5,
139 FSL_SAI_CR5_WNW_MASK | FSL_SAI_CR5_W0W_MASK |
140 FSL_SAI_CR5_FBT_MASK, val_cr5);
141 regmap_write(sai->regmap, FSL_SAI_TMR,
142 ~0UL - ((1 << channels) - 1));
143 } else if (!sai->synchronous[RX] && sai->synchronous[TX] && tx) {
144 - regmap_update_bits(sai->regmap, FSL_SAI_RCR4(ofs),
145 + regmap_update_bits(sai->regmap, FSL_SAI_RCR4,
146 FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK,
148 - regmap_update_bits(sai->regmap, FSL_SAI_RCR5(ofs),
149 + regmap_update_bits(sai->regmap, FSL_SAI_RCR5,
150 FSL_SAI_CR5_WNW_MASK | FSL_SAI_CR5_W0W_MASK |
151 FSL_SAI_CR5_FBT_MASK, val_cr5);
152 regmap_write(sai->regmap, FSL_SAI_RMR,
153 @@ -480,10 +475,10 @@ static int fsl_sai_hw_params(struct snd_
157 - regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, ofs),
158 + regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx),
159 FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK,
161 - regmap_update_bits(sai->regmap, FSL_SAI_xCR5(tx, ofs),
162 + regmap_update_bits(sai->regmap, FSL_SAI_xCR5(tx),
163 FSL_SAI_CR5_WNW_MASK | FSL_SAI_CR5_W0W_MASK |
164 FSL_SAI_CR5_FBT_MASK, val_cr5);
165 regmap_write(sai->regmap, FSL_SAI_xMR(tx), ~0UL - ((1 << channels) - 1));
166 @@ -511,8 +506,6 @@ static int fsl_sai_trigger(struct snd_pc
167 struct snd_soc_dai *cpu_dai)
169 struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
170 - unsigned int ofs = sai->soc_data->reg_offset;
172 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
173 u32 xcsr, count = 100;
175 @@ -521,9 +514,9 @@ static int fsl_sai_trigger(struct snd_pc
176 * Rx sync with Tx clocks: Clear SYNC for Tx, set it for Rx.
177 * Tx sync with Rx clocks: Clear SYNC for Rx, set it for Tx.
179 - regmap_update_bits(sai->regmap, FSL_SAI_TCR2(ofs), FSL_SAI_CR2_SYNC,
180 - sai->synchronous[TX] ? FSL_SAI_CR2_SYNC : 0);
181 - regmap_update_bits(sai->regmap, FSL_SAI_RCR2(ofs), FSL_SAI_CR2_SYNC,
182 + regmap_update_bits(sai->regmap, FSL_SAI_TCR2, FSL_SAI_CR2_SYNC,
183 + sai->synchronous[TX] ? FSL_SAI_CR2_SYNC : 0);
184 + regmap_update_bits(sai->regmap, FSL_SAI_RCR2, FSL_SAI_CR2_SYNC,
185 sai->synchronous[RX] ? FSL_SAI_CR2_SYNC : 0);
188 @@ -534,44 +527,43 @@ static int fsl_sai_trigger(struct snd_pc
189 case SNDRV_PCM_TRIGGER_START:
190 case SNDRV_PCM_TRIGGER_RESUME:
191 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
192 - regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
193 + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx),
194 FSL_SAI_CSR_FRDE, FSL_SAI_CSR_FRDE);
196 - regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs),
197 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
198 FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE);
199 - regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs),
200 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
201 FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE);
203 - regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
204 + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx),
205 FSL_SAI_CSR_xIE_MASK, FSL_SAI_FLAGS);
207 case SNDRV_PCM_TRIGGER_STOP:
208 case SNDRV_PCM_TRIGGER_SUSPEND:
209 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
210 - regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
211 + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx),
212 FSL_SAI_CSR_FRDE, 0);
213 - regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
214 + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx),
215 FSL_SAI_CSR_xIE_MASK, 0);
217 /* Check if the opposite FRDE is also disabled */
218 - regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
219 + regmap_read(sai->regmap, FSL_SAI_xCSR(!tx), &xcsr);
220 if (!(xcsr & FSL_SAI_CSR_FRDE)) {
221 /* Disable both directions and reset their FIFOs */
222 - regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs),
223 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
224 FSL_SAI_CSR_TERE, 0);
225 - regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs),
226 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
227 FSL_SAI_CSR_TERE, 0);
229 /* TERE will remain set till the end of current frame */
232 - regmap_read(sai->regmap,
233 - FSL_SAI_xCSR(tx, ofs), &xcsr);
234 + regmap_read(sai->regmap, FSL_SAI_xCSR(tx), &xcsr);
235 } while (--count && xcsr & FSL_SAI_CSR_TERE);
237 - regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs),
238 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
239 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
240 - regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs),
241 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
242 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
245 @@ -583,13 +575,13 @@ static int fsl_sai_trigger(struct snd_pc
247 if (!sai->is_slave_mode) {
248 /* Software Reset for both Tx and Rx */
249 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs),
251 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs),
253 + regmap_write(sai->regmap,
254 + FSL_SAI_TCSR, FSL_SAI_CSR_SR);
255 + regmap_write(sai->regmap,
256 + FSL_SAI_RCSR, FSL_SAI_CSR_SR);
257 /* Clear SR bit to finish the reset */
258 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), 0);
259 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0);
260 + regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
261 + regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
265 @@ -604,11 +596,10 @@ static int fsl_sai_startup(struct snd_pc
266 struct snd_soc_dai *cpu_dai)
268 struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
269 - unsigned int ofs = sai->soc_data->reg_offset;
270 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
273 - regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, ofs),
274 + regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx),
275 FSL_SAI_CR3_TRCE_MASK,
278 @@ -622,10 +613,9 @@ static void fsl_sai_shutdown(struct snd_
279 struct snd_soc_dai *cpu_dai)
281 struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
282 - unsigned int ofs = sai->soc_data->reg_offset;
283 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
285 - regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, ofs),
286 + regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx),
287 FSL_SAI_CR3_TRCE_MASK, 0);
290 @@ -643,20 +633,18 @@ static const struct snd_soc_dai_ops fsl_
291 static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
293 struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
294 - unsigned int ofs = sai->soc_data->reg_offset;
296 /* Software Reset for both Tx and Rx */
297 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR);
298 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR);
299 + regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
300 + regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR);
301 /* Clear SR bit to finish the reset */
302 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), 0);
303 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0);
304 + regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
305 + regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
307 - regmap_update_bits(sai->regmap, FSL_SAI_TCR1(ofs),
308 - FSL_SAI_CR1_RFW_MASK,
309 + regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK,
310 sai->soc_data->fifo_depth - FSL_SAI_MAXBURST_TX);
311 - regmap_update_bits(sai->regmap, FSL_SAI_RCR1(ofs),
312 - FSL_SAI_CR1_RFW_MASK, FSL_SAI_MAXBURST_RX - 1);
313 + regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK,
314 + FSL_SAI_MAXBURST_RX - 1);
316 snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx,
317 &sai->dma_params_rx);
318 @@ -693,12 +681,12 @@ static const struct snd_soc_component_dr
322 -static struct reg_default fsl_sai_reg_defaults_ofs0[] = {
323 - {FSL_SAI_TCR1(0), 0},
324 - {FSL_SAI_TCR2(0), 0},
325 - {FSL_SAI_TCR3(0), 0},
326 - {FSL_SAI_TCR4(0), 0},
327 - {FSL_SAI_TCR5(0), 0},
328 +static struct reg_default fsl_sai_reg_defaults[] = {
337 @@ -707,50 +695,24 @@ static struct reg_default fsl_sai_reg_de
342 - {FSL_SAI_RCR1(0), 0},
343 - {FSL_SAI_RCR2(0), 0},
344 - {FSL_SAI_RCR3(0), 0},
345 - {FSL_SAI_RCR4(0), 0},
346 - {FSL_SAI_RCR5(0), 0},
350 -static struct reg_default fsl_sai_reg_defaults_ofs8[] = {
351 - {FSL_SAI_TCR1(8), 0},
352 - {FSL_SAI_TCR2(8), 0},
353 - {FSL_SAI_TCR3(8), 0},
354 - {FSL_SAI_TCR4(8), 0},
355 - {FSL_SAI_TCR5(8), 0},
365 - {FSL_SAI_RCR1(8), 0},
366 - {FSL_SAI_RCR2(8), 0},
367 - {FSL_SAI_RCR3(8), 0},
368 - {FSL_SAI_RCR4(8), 0},
369 - {FSL_SAI_RCR5(8), 0},
380 static bool fsl_sai_readable_reg(struct device *dev, unsigned int reg)
382 - struct fsl_sai *sai = dev_get_drvdata(dev);
383 - unsigned int ofs = sai->soc_data->reg_offset;
385 - if (reg >= FSL_SAI_TCSR(ofs) && reg <= FSL_SAI_TCR5(ofs))
388 - if (reg >= FSL_SAI_RCSR(ofs) && reg <= FSL_SAI_RCR5(ofs))
401 @@ -760,6 +722,12 @@ static bool fsl_sai_readable_reg(struct
414 @@ -785,13 +753,9 @@ static bool fsl_sai_readable_reg(struct
416 static bool fsl_sai_volatile_reg(struct device *dev, unsigned int reg)
418 - struct fsl_sai *sai = dev_get_drvdata(dev);
419 - unsigned int ofs = sai->soc_data->reg_offset;
421 - if (reg == FSL_SAI_TCSR(ofs) || reg == FSL_SAI_RCSR(ofs))
430 @@ -824,16 +788,13 @@ static bool fsl_sai_volatile_reg(struct
432 static bool fsl_sai_writeable_reg(struct device *dev, unsigned int reg)
434 - struct fsl_sai *sai = dev_get_drvdata(dev);
435 - unsigned int ofs = sai->soc_data->reg_offset;
437 - if (reg >= FSL_SAI_TCSR(ofs) && reg <= FSL_SAI_TCR5(ofs))
440 - if (reg >= FSL_SAI_RCSR(ofs) && reg <= FSL_SAI_RCR5(ofs))
453 @@ -843,6 +804,12 @@ static bool fsl_sai_writeable_reg(struct
466 @@ -850,15 +817,15 @@ static bool fsl_sai_writeable_reg(struct
470 -static struct regmap_config fsl_sai_regmap_config = {
471 +static const struct regmap_config fsl_sai_regmap_config = {
477 .max_register = FSL_SAI_RMR,
478 - .reg_defaults = fsl_sai_reg_defaults_ofs0,
479 - .num_reg_defaults = ARRAY_SIZE(fsl_sai_reg_defaults_ofs0),
480 + .reg_defaults = fsl_sai_reg_defaults,
481 + .num_reg_defaults = ARRAY_SIZE(fsl_sai_reg_defaults),
482 .readable_reg = fsl_sai_readable_reg,
483 .volatile_reg = fsl_sai_volatile_reg,
484 .writeable_reg = fsl_sai_writeable_reg,
485 @@ -890,12 +857,6 @@ static int fsl_sai_probe(struct platform
487 return PTR_ERR(base);
489 - if (sai->soc_data->reg_offset == 8) {
490 - fsl_sai_regmap_config.reg_defaults = fsl_sai_reg_defaults_ofs8;
491 - fsl_sai_regmap_config.num_reg_defaults =
492 - ARRAY_SIZE(fsl_sai_reg_defaults_ofs8);
495 sai->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
496 "bus", base, &fsl_sai_regmap_config);
498 @@ -1022,13 +983,11 @@ static int fsl_sai_remove(struct platfor
499 static const struct fsl_sai_soc_data fsl_sai_vf610_data = {
500 .use_imx_pcm = false,
505 static const struct fsl_sai_soc_data fsl_sai_imx6sx_data = {
511 static const struct of_device_id fsl_sai_ids[] = {
512 @@ -1061,7 +1020,6 @@ static int fsl_sai_runtime_suspend(struc
513 static int fsl_sai_runtime_resume(struct device *dev)
515 struct fsl_sai *sai = dev_get_drvdata(dev);
516 - unsigned int ofs = sai->soc_data->reg_offset;
519 ret = clk_prepare_enable(sai->bus_clk);
520 @@ -1083,11 +1041,11 @@ static int fsl_sai_runtime_resume(struct
523 regcache_cache_only(sai->regmap, false);
524 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR);
525 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR);
526 + regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
527 + regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR);
528 usleep_range(1000, 2000);
529 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), 0);
530 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0);
531 + regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
532 + regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
534 ret = regcache_sync(sai->regmap);
536 --- a/sound/soc/fsl/fsl_sai.h
537 +++ b/sound/soc/fsl/fsl_sai.h
539 SNDRV_PCM_FMTBIT_S32_LE)
541 /* SAI Register Map Register */
542 -#define FSL_SAI_TCSR(ofs) (0x00 + ofs) /* SAI Transmit Control */
543 -#define FSL_SAI_TCR1(ofs) (0x04 + ofs) /* SAI Transmit Configuration 1 */
544 -#define FSL_SAI_TCR2(ofs) (0x08 + ofs) /* SAI Transmit Configuration 2 */
545 -#define FSL_SAI_TCR3(ofs) (0x0c + ofs) /* SAI Transmit Configuration 3 */
546 -#define FSL_SAI_TCR4(ofs) (0x10 + ofs) /* SAI Transmit Configuration 4 */
547 -#define FSL_SAI_TCR5(ofs) (0x14 + ofs) /* SAI Transmit Configuration 5 */
548 +#define FSL_SAI_TCSR 0x00 /* SAI Transmit Control */
549 +#define FSL_SAI_TCR1 0x04 /* SAI Transmit Configuration 1 */
550 +#define FSL_SAI_TCR2 0x08 /* SAI Transmit Configuration 2 */
551 +#define FSL_SAI_TCR3 0x0c /* SAI Transmit Configuration 3 */
552 +#define FSL_SAI_TCR4 0x10 /* SAI Transmit Configuration 4 */
553 +#define FSL_SAI_TCR5 0x14 /* SAI Transmit Configuration 5 */
554 #define FSL_SAI_TDR0 0x20 /* SAI Transmit Data 0 */
555 #define FSL_SAI_TDR1 0x24 /* SAI Transmit Data 1 */
556 #define FSL_SAI_TDR2 0x28 /* SAI Transmit Data 2 */
558 #define FSL_SAI_TFR6 0x58 /* SAI Transmit FIFO 6 */
559 #define FSL_SAI_TFR7 0x5C /* SAI Transmit FIFO 7 */
560 #define FSL_SAI_TMR 0x60 /* SAI Transmit Mask */
561 -#define FSL_SAI_RCSR(ofs) (0x80 + ofs) /* SAI Receive Control */
562 -#define FSL_SAI_RCR1(ofs) (0x84 + ofs)/* SAI Receive Configuration 1 */
563 -#define FSL_SAI_RCR2(ofs) (0x88 + ofs) /* SAI Receive Configuration 2 */
564 -#define FSL_SAI_RCR3(ofs) (0x8c + ofs) /* SAI Receive Configuration 3 */
565 -#define FSL_SAI_RCR4(ofs) (0x90 + ofs) /* SAI Receive Configuration 4 */
566 -#define FSL_SAI_RCR5(ofs) (0x94 + ofs) /* SAI Receive Configuration 5 */
567 +#define FSL_SAI_RCSR 0x80 /* SAI Receive Control */
568 +#define FSL_SAI_RCR1 0x84 /* SAI Receive Configuration 1 */
569 +#define FSL_SAI_RCR2 0x88 /* SAI Receive Configuration 2 */
570 +#define FSL_SAI_RCR3 0x8c /* SAI Receive Configuration 3 */
571 +#define FSL_SAI_RCR4 0x90 /* SAI Receive Configuration 4 */
572 +#define FSL_SAI_RCR5 0x94 /* SAI Receive Configuration 5 */
573 #define FSL_SAI_RDR0 0xa0 /* SAI Receive Data 0 */
574 #define FSL_SAI_RDR1 0xa4 /* SAI Receive Data 1 */
575 #define FSL_SAI_RDR2 0xa8 /* SAI Receive Data 2 */
577 #define FSL_SAI_RFR7 0xdc /* SAI Receive FIFO 7 */
578 #define FSL_SAI_RMR 0xe0 /* SAI Receive Mask */
580 -#define FSL_SAI_xCSR(tx, ofs) (tx ? FSL_SAI_TCSR(ofs) : FSL_SAI_RCSR(ofs))
581 -#define FSL_SAI_xCR1(tx, ofs) (tx ? FSL_SAI_TCR1(ofs) : FSL_SAI_RCR1(ofs))
582 -#define FSL_SAI_xCR2(tx, ofs) (tx ? FSL_SAI_TCR2(ofs) : FSL_SAI_RCR2(ofs))
583 -#define FSL_SAI_xCR3(tx, ofs) (tx ? FSL_SAI_TCR3(ofs) : FSL_SAI_RCR3(ofs))
584 -#define FSL_SAI_xCR4(tx, ofs) (tx ? FSL_SAI_TCR4(ofs) : FSL_SAI_RCR4(ofs))
585 -#define FSL_SAI_xCR5(tx, ofs) (tx ? FSL_SAI_TCR5(ofs) : FSL_SAI_RCR5(ofs))
586 -#define FSL_SAI_xDR(tx, ofs) (tx ? FSL_SAI_TDR(ofs) : FSL_SAI_RDR(ofs))
587 -#define FSL_SAI_xFR(tx, ofs) (tx ? FSL_SAI_TFR(ofs) : FSL_SAI_RFR(ofs))
588 +#define FSL_SAI_xCSR(tx) (tx ? FSL_SAI_TCSR : FSL_SAI_RCSR)
589 +#define FSL_SAI_xCR1(tx) (tx ? FSL_SAI_TCR1 : FSL_SAI_RCR1)
590 +#define FSL_SAI_xCR2(tx) (tx ? FSL_SAI_TCR2 : FSL_SAI_RCR2)
591 +#define FSL_SAI_xCR3(tx) (tx ? FSL_SAI_TCR3 : FSL_SAI_RCR3)
592 +#define FSL_SAI_xCR4(tx) (tx ? FSL_SAI_TCR4 : FSL_SAI_RCR4)
593 +#define FSL_SAI_xCR5(tx) (tx ? FSL_SAI_TCR5 : FSL_SAI_RCR5)
594 +#define FSL_SAI_xDR(tx) (tx ? FSL_SAI_TDR : FSL_SAI_RDR)
595 +#define FSL_SAI_xFR(tx) (tx ? FSL_SAI_TFR : FSL_SAI_RFR)
596 #define FSL_SAI_xMR(tx) (tx ? FSL_SAI_TMR : FSL_SAI_RMR)
598 /* SAI Transmit/Receive Control Register */
600 struct fsl_sai_soc_data {
602 unsigned int fifo_depth;
603 - unsigned int reg_offset;