aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2015-10-26 04:42:09 -0400
committerMark Brown <broonie@kernel.org>2015-11-16 05:09:29 -0500
commite10369d88c16456b0ff3ae31b4e30a3d2795a243 (patch)
tree4c5db473955e56adb4e8522c7fb7a24be68a79f4 /sound/soc/sh
parent2daf71ad8da6cb57f919c9c876ee7e42530371df (diff)
ASoC: rsnd: use common rsnd_ssi_status_xxx()
Current ssi.c driver has random access to SSISR register. Let's use common rsnd_ssi_status_xxx() function Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/rcar/ssi.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 86e51ce66b10..ad5539def58f 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -105,6 +105,16 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
105 return use_busif; 105 return use_busif;
106} 106}
107 107
108static void rsnd_ssi_status_clear(struct rsnd_mod *mod)
109{
110 rsnd_mod_write(mod, SSISR, 0);
111}
112
113static u32 rsnd_ssi_status_get(struct rsnd_mod *mod)
114{
115 return rsnd_mod_read(mod, SSISR);
116}
117
108static void rsnd_ssi_status_check(struct rsnd_mod *mod, 118static void rsnd_ssi_status_check(struct rsnd_mod *mod,
109 u32 bit) 119 u32 bit)
110{ 120{
@@ -114,7 +124,7 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod,
114 int i; 124 int i;
115 125
116 for (i = 0; i < 1024; i++) { 126 for (i = 0; i < 1024; i++) {
117 status = rsnd_mod_read(mod, SSISR); 127 status = rsnd_ssi_status_get(mod);
118 if (status & bit) 128 if (status & bit)
119 return; 129 return;
120 130
@@ -245,7 +255,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
245 rsnd_mod_write(mod, SSIWSR, CONT); 255 rsnd_mod_write(mod, SSIWSR, CONT);
246 256
247 /* clear error status */ 257 /* clear error status */
248 rsnd_mod_write(mod, SSISR, 0); 258 rsnd_ssi_status_clear(mod);
249 259
250 ssi->usrcnt++; 260 ssi->usrcnt++;
251 261
@@ -406,17 +416,20 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod,
406 return 0; 416 return 0;
407} 417}
408 418
409static void rsnd_ssi_record_error(struct rsnd_ssi *ssi, u32 status) 419static u32 rsnd_ssi_record_error(struct rsnd_ssi *ssi)
410{ 420{
411 struct rsnd_mod *mod = rsnd_mod_get(ssi); 421 struct rsnd_mod *mod = rsnd_mod_get(ssi);
422 u32 status = rsnd_ssi_status_get(mod);
412 423
413 /* under/over flow error */ 424 /* under/over flow error */
414 if (status & (UIRQ | OIRQ)) { 425 if (status & (UIRQ | OIRQ)) {
415 ssi->err++; 426 ssi->err++;
416 427
417 /* clear error status */ 428 /* clear error status */
418 rsnd_mod_write(mod, SSISR, 0); 429 rsnd_ssi_status_clear(mod);
419 } 430 }
431
432 return status;
420} 433}
421 434
422static int rsnd_ssi_start(struct rsnd_mod *mod, 435static int rsnd_ssi_start(struct rsnd_mod *mod,
@@ -442,7 +455,7 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
442 455
443 rsnd_ssi_irq_disable(mod); 456 rsnd_ssi_irq_disable(mod);
444 457
445 rsnd_ssi_record_error(ssi, rsnd_mod_read(mod, SSISR)); 458 rsnd_ssi_record_error(ssi);
446 459
447 rsnd_ssi_hw_stop(io, ssi); 460 rsnd_ssi_hw_stop(io, ssi);
448 461
@@ -467,7 +480,7 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
467 if (!rsnd_io_is_working(io)) 480 if (!rsnd_io_is_working(io))
468 goto rsnd_ssi_interrupt_out; 481 goto rsnd_ssi_interrupt_out;
469 482
470 status = rsnd_mod_read(mod, SSISR); 483 status = rsnd_ssi_record_error(ssi);
471 484
472 /* PIO only */ 485 /* PIO only */
473 if (!is_dma && (status & DIRQ)) { 486 if (!is_dma && (status & DIRQ)) {
@@ -500,8 +513,6 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
500 rsnd_ssi_start(mod, io, priv); 513 rsnd_ssi_start(mod, io, priv);
501 } 514 }
502 515
503 rsnd_ssi_record_error(ssi, status);
504
505 if (ssi->err > 1024) { 516 if (ssi->err > 1024) {
506 rsnd_ssi_irq_disable(mod); 517 rsnd_ssi_irq_disable(mod);
507 518