aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx/s3c-i2s-v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/s3c24xx/s3c-i2s-v2.c')
-rw-r--r--sound/soc/s3c24xx/s3c-i2s-v2.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c
index 43262e1e8f98..295a4c910262 100644
--- a/sound/soc/s3c24xx/s3c-i2s-v2.c
+++ b/sound/soc/s3c24xx/s3c-i2s-v2.c
@@ -38,13 +38,6 @@
38#include "s3c-i2s-v2.h" 38#include "s3c-i2s-v2.h"
39 39
40#define S3C2412_I2S_DEBUG_CON 0 40#define S3C2412_I2S_DEBUG_CON 0
41#define S3C2412_I2S_DEBUG 0
42
43#if S3C2412_I2S_DEBUG
44#define DBG(x...) printk(KERN_INFO x)
45#else
46#define DBG(x...) do { } while (0)
47#endif
48 41
49static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) 42static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
50{ 43{
@@ -87,13 +80,13 @@ void s3c2412_snd_txctrl(struct s3c_i2sv2_info *i2s, int on)
87 void __iomem *regs = i2s->regs; 80 void __iomem *regs = i2s->regs;
88 u32 fic, con, mod; 81 u32 fic, con, mod;
89 82
90 DBG("%s(%d)\n", __func__, on); 83 pr_debug("%s(%d)\n", __func__, on);
91 84
92 fic = readl(regs + S3C2412_IISFIC); 85 fic = readl(regs + S3C2412_IISFIC);
93 con = readl(regs + S3C2412_IISCON); 86 con = readl(regs + S3C2412_IISCON);
94 mod = readl(regs + S3C2412_IISMOD); 87 mod = readl(regs + S3C2412_IISMOD);
95 88
96 DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic); 89 pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
97 90
98 if (on) { 91 if (on) {
99 con |= S3C2412_IISCON_TXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE; 92 con |= S3C2412_IISCON_TXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
@@ -148,7 +141,7 @@ void s3c2412_snd_txctrl(struct s3c_i2sv2_info *i2s, int on)
148 141
149 fic = readl(regs + S3C2412_IISFIC); 142 fic = readl(regs + S3C2412_IISFIC);
150 dbg_showcon(__func__, con); 143 dbg_showcon(__func__, con);
151 DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic); 144 pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
152} 145}
153EXPORT_SYMBOL_GPL(s3c2412_snd_txctrl); 146EXPORT_SYMBOL_GPL(s3c2412_snd_txctrl);
154 147
@@ -157,13 +150,13 @@ void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
157 void __iomem *regs = i2s->regs; 150 void __iomem *regs = i2s->regs;
158 u32 fic, con, mod; 151 u32 fic, con, mod;
159 152
160 DBG("%s(%d)\n", __func__, on); 153 pr_debug("%s(%d)\n", __func__, on);
161 154
162 fic = readl(regs + S3C2412_IISFIC); 155 fic = readl(regs + S3C2412_IISFIC);
163 con = readl(regs + S3C2412_IISCON); 156 con = readl(regs + S3C2412_IISCON);
164 mod = readl(regs + S3C2412_IISMOD); 157 mod = readl(regs + S3C2412_IISMOD);
165 158
166 DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic); 159 pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
167 160
168 if (on) { 161 if (on) {
169 con |= S3C2412_IISCON_RXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE; 162 con |= S3C2412_IISCON_RXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
@@ -214,7 +207,7 @@ void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
214 } 207 }
215 208
216 fic = readl(regs + S3C2412_IISFIC); 209 fic = readl(regs + S3C2412_IISFIC);
217 DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic); 210 pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
218} 211}
219EXPORT_SYMBOL_GPL(s3c2412_snd_rxctrl); 212EXPORT_SYMBOL_GPL(s3c2412_snd_rxctrl);
220 213
@@ -227,7 +220,7 @@ static int s3c2412_snd_lrsync(struct s3c_i2sv2_info *i2s)
227 u32 iiscon; 220 u32 iiscon;
228 unsigned long timeout = jiffies + msecs_to_jiffies(5); 221 unsigned long timeout = jiffies + msecs_to_jiffies(5);
229 222
230 DBG("Entered %s\n", __func__); 223 pr_debug("Entered %s\n", __func__);
231 224
232 while (1) { 225 while (1) {
233 iiscon = readl(i2s->regs + S3C2412_IISCON); 226 iiscon = readl(i2s->regs + S3C2412_IISCON);
@@ -252,10 +245,10 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
252 struct s3c_i2sv2_info *i2s = to_info(cpu_dai); 245 struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
253 u32 iismod; 246 u32 iismod;
254 247
255 DBG("Entered %s\n", __func__); 248 pr_debug("Entered %s\n", __func__);
256 249
257 iismod = readl(i2s->regs + S3C2412_IISMOD); 250 iismod = readl(i2s->regs + S3C2412_IISMOD);
258 DBG("hw_params r: IISMOD: %x \n", iismod); 251 pr_debug("hw_params r: IISMOD: %x \n", iismod);
259 252
260#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) 253#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
261#define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK 254#define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK
@@ -288,7 +281,7 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
288 iismod |= IISMOD_MASTER; 281 iismod |= IISMOD_MASTER;
289 break; 282 break;
290 default: 283 default:
291 DBG("unknwon master/slave format\n"); 284 pr_debug("unknwon master/slave format\n");
292 return -EINVAL; 285 return -EINVAL;
293 } 286 }
294 287
@@ -305,12 +298,12 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
305 iismod |= S3C2412_IISMOD_SDF_IIS; 298 iismod |= S3C2412_IISMOD_SDF_IIS;
306 break; 299 break;
307 default: 300 default:
308 DBG("Unknown data format\n"); 301 pr_debug("Unknown data format\n");
309 return -EINVAL; 302 return -EINVAL;
310 } 303 }
311 304
312 writel(iismod, i2s->regs + S3C2412_IISMOD); 305 writel(iismod, i2s->regs + S3C2412_IISMOD);
313 DBG("hw_params w: IISMOD: %x \n", iismod); 306 pr_debug("hw_params w: IISMOD: %x \n", iismod);
314 return 0; 307 return 0;
315} 308}
316 309
@@ -323,7 +316,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
323 struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai); 316 struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai);
324 u32 iismod; 317 u32 iismod;
325 318
326 DBG("Entered %s\n", __func__); 319 pr_debug("Entered %s\n", __func__);
327 320
328 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 321 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
329 dai->cpu_dai->dma_data = i2s->dma_playback; 322 dai->cpu_dai->dma_data = i2s->dma_playback;
@@ -332,7 +325,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
332 325
333 /* Working copies of register */ 326 /* Working copies of register */
334 iismod = readl(i2s->regs + S3C2412_IISMOD); 327 iismod = readl(i2s->regs + S3C2412_IISMOD);
335 DBG("%s: r: IISMOD: %x\n", __func__, iismod); 328 pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);
336 329
337 switch (params_format(params)) { 330 switch (params_format(params)) {
338 case SNDRV_PCM_FORMAT_S8: 331 case SNDRV_PCM_FORMAT_S8:
@@ -344,7 +337,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
344 } 337 }
345 338
346 writel(iismod, i2s->regs + S3C2412_IISMOD); 339 writel(iismod, i2s->regs + S3C2412_IISMOD);
347 DBG("%s: w: IISMOD: %x\n", __func__, iismod); 340 pr_debug("%s: w: IISMOD: %x\n", __func__, iismod);
348 return 0; 341 return 0;
349} 342}
350 343
@@ -357,7 +350,7 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
357 unsigned long irqs; 350 unsigned long irqs;
358 int ret = 0; 351 int ret = 0;
359 352
360 DBG("Entered %s\n", __func__); 353 pr_debug("Entered %s\n", __func__);
361 354
362 switch (cmd) { 355 switch (cmd) {
363 case SNDRV_PCM_TRIGGER_START: 356 case SNDRV_PCM_TRIGGER_START:
@@ -417,7 +410,7 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
417 struct s3c_i2sv2_info *i2s = to_info(cpu_dai); 410 struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
418 u32 reg; 411 u32 reg;
419 412
420 DBG("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div); 413 pr_debug("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div);
421 414
422 switch (div_id) { 415 switch (div_id) {
423 case S3C_I2SV2_DIV_BCLK: 416 case S3C_I2SV2_DIV_BCLK:
@@ -425,7 +418,7 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
425 reg &= ~S3C2412_IISMOD_BCLK_MASK; 418 reg &= ~S3C2412_IISMOD_BCLK_MASK;
426 writel(reg | div, i2s->regs + S3C2412_IISMOD); 419 writel(reg | div, i2s->regs + S3C2412_IISMOD);
427 420
428 DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD)); 421 pr_debug("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
429 break; 422 break;
430 423
431 case S3C_I2SV2_DIV_RCLK: 424 case S3C_I2SV2_DIV_RCLK:
@@ -457,7 +450,7 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
457 reg = readl(i2s->regs + S3C2412_IISMOD); 450 reg = readl(i2s->regs + S3C2412_IISMOD);
458 reg &= ~S3C2412_IISMOD_RCLK_MASK; 451 reg &= ~S3C2412_IISMOD_RCLK_MASK;
459 writel(reg | div, i2s->regs + S3C2412_IISMOD); 452 writel(reg | div, i2s->regs + S3C2412_IISMOD);
460 DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD)); 453 pr_debug("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
461 break; 454 break;
462 455
463 case S3C_I2SV2_DIV_PRESCALER: 456 case S3C_I2SV2_DIV_PRESCALER:
@@ -467,7 +460,7 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
467 } else { 460 } else {
468 writel(0x0, i2s->regs + S3C2412_IISPSR); 461 writel(0x0, i2s->regs + S3C2412_IISPSR);
469 } 462 }
470 DBG("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR)); 463 pr_debug("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR));
471 break; 464 break;
472 465
473 default: 466 default:
@@ -560,7 +553,7 @@ int s3c_i2sv2_probe(struct platform_device *pdev,
560 553
561 i2s->iis_pclk = clk_get(dev, "iis"); 554 i2s->iis_pclk = clk_get(dev, "iis");
562 if (i2s->iis_pclk == NULL) { 555 if (i2s->iis_pclk == NULL) {
563 DBG("failed to get iis_clock\n"); 556 dev_err(dev, "failed to get iis_clock\n");
564 iounmap(i2s->regs); 557 iounmap(i2s->regs);
565 return -ENOENT; 558 return -ENOENT;
566 } 559 }