alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsi: Modify over/under run error settlement
@ 2010-02-22  7:41 Kuninori Morimoto
  2010-02-22 10:14 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Kuninori Morimoto @ 2010-02-22  7:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
---
 sound/soc/sh/fsi.c |   46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 3c36d24..993abb7 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -388,7 +388,7 @@ static void fsi_soft_all_reset(struct fsi_master *master)
 }
 
 /* playback interrupt */
-static int fsi_data_push(struct fsi_priv *fsi)
+static int fsi_data_push(struct fsi_priv *fsi, int startup)
 {
 	struct snd_pcm_runtime *runtime;
 	struct snd_pcm_substream *substream = NULL;
@@ -397,7 +397,7 @@ static int fsi_data_push(struct fsi_priv *fsi)
 	int fifo_free;
 	int width;
 	u8 *start;
-	int i, ret, over_period;
+	int i, over_period;
 
 	if (!fsi			||
 	    !fsi->substream		||
@@ -453,24 +453,26 @@ static int fsi_data_push(struct fsi_priv *fsi)
 
 	fsi->byte_offset += send * width;
 
-	ret = 0;
 	status = fsi_reg_read(fsi, DOFF_ST);
-	if (status & ERR_OVER) {
+	if (!startup) {
 		struct snd_soc_dai *dai = fsi_get_dai(substream);
-		dev_err(dai->dev, "over run error\n");
-		fsi_reg_write(fsi, DOFF_ST, status & ~ST_ERR);
-		ret = -EIO;
+
+		if (status & ERR_OVER)
+			dev_err(dai->dev, "over run\n");
+		if (status & ERR_UNDER)
+			dev_err(dai->dev, "under run\n");
 	}
+	fsi_reg_write(fsi, DOFF_ST, 0);
 
 	fsi_irq_enable(fsi, 1);
 
 	if (over_period)
 		snd_pcm_period_elapsed(substream);
 
-	return ret;
+	return 0;
 }
 
-static int fsi_data_pop(struct fsi_priv *fsi)
+static int fsi_data_pop(struct fsi_priv *fsi, int startup)
 {
 	struct snd_pcm_runtime *runtime;
 	struct snd_pcm_substream *substream = NULL;
@@ -479,7 +481,7 @@ static int fsi_data_pop(struct fsi_priv *fsi)
 	int fifo_fill;
 	int width;
 	u8 *start;
-	int i, ret, over_period;
+	int i, over_period;
 
 	if (!fsi			||
 	    !fsi->substream		||
@@ -534,21 +536,23 @@ static int fsi_data_pop(struct fsi_priv *fsi)
 
 	fsi->byte_offset += fifo_fill * width;
 
-	ret = 0;
 	status = fsi_reg_read(fsi, DIFF_ST);
-	if (status & ERR_UNDER) {
+	if (!startup) {
 		struct snd_soc_dai *dai = fsi_get_dai(substream);
-		dev_err(dai->dev, "under run error\n");
-		fsi_reg_write(fsi, DIFF_ST, status & ~ST_ERR);
-		ret = -EIO;
+
+		if (status & ERR_OVER)
+			dev_err(dai->dev, "over run\n");
+		if (status & ERR_UNDER)
+			dev_err(dai->dev, "under run\n");
 	}
+	fsi_reg_write(fsi, DIFF_ST, 0);
 
 	fsi_irq_enable(fsi, 0);
 
 	if (over_period)
 		snd_pcm_period_elapsed(substream);
 
-	return ret;
+	return 0;
 }
 
 static irqreturn_t fsi_interrupt(int irq, void *data)
@@ -562,13 +566,13 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
 	fsi_master_write(master, SOFT_RST, status | 0x00000010);
 
 	if (int_st & INT_A_OUT)
-		fsi_data_push(&master->fsia);
+		fsi_data_push(&master->fsia, 0);
 	if (int_st & INT_B_OUT)
-		fsi_data_push(&master->fsib);
+		fsi_data_push(&master->fsib, 0);
 	if (int_st & INT_A_IN)
-		fsi_data_pop(&master->fsia);
+		fsi_data_pop(&master->fsia, 0);
 	if (int_st & INT_B_IN)
-		fsi_data_pop(&master->fsib);
+		fsi_data_pop(&master->fsib, 0);
 
 	fsi_master_write(master, INT_ST, 0x0000000);
 
@@ -726,7 +730,7 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 		fsi_stream_push(fsi, substream,
 				frames_to_bytes(runtime, runtime->buffer_size),
 				frames_to_bytes(runtime, runtime->period_size));
-		ret = is_play ? fsi_data_push(fsi) : fsi_data_pop(fsi);
+		ret = is_play ? fsi_data_push(fsi, 1) : fsi_data_pop(fsi, 1);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		fsi_irq_disable(fsi, is_play);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: fsi: Modify over/under run error settlement
  2010-02-22  7:41 [PATCH] ASoC: fsi: Modify over/under run error settlement Kuninori Morimoto
@ 2010-02-22 10:14 ` Mark Brown
  2010-02-23  2:21   ` Kuninori Morimoto
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2010-02-22 10:14 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA

On Mon, Feb 22, 2010 at 04:41:57PM +0900, Kuninori Morimoto wrote:
> Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>

What is the effect of this change?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: fsi: Modify over/under run error settlement
  2010-02-22 10:14 ` Mark Brown
@ 2010-02-23  2:21   ` Kuninori Morimoto
  2010-02-23 10:46     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Kuninori Morimoto @ 2010-02-23  2:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Dear Mark

> On Mon, Feb 22, 2010 at 04:41:57PM +0900, Kuninori Morimoto wrote:
> > Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
> 
> What is the effect of this change?

Sorry. I should have explained details.

In current FSI driver, playback function cares only overrun,
and capture function cares only underrun.

But playback function should had cared about underrun,
and capture function should had cared about overrun too.

My patch modify playback/capture to care both overrun and underrun


Best regards
--
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: fsi: Modify over/under run error settlement
  2010-02-23  2:21   ` Kuninori Morimoto
@ 2010-02-23 10:46     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-02-23 10:46 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA

On Tue, Feb 23, 2010 at 11:21:17AM +0900, Kuninori Morimoto wrote:

> Sorry. I should have explained details.

> In current FSI driver, playback function cares only overrun,
> and capture function cares only underrun.

> But playback function should had cared about underrun,
> and capture function should had cared about overrun too.

> My patch modify playback/capture to care both overrun and underrun

OK - I've applied the patch with the above explanation added to the
commit message.  Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-23 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22  7:41 [PATCH] ASoC: fsi: Modify over/under run error settlement Kuninori Morimoto
2010-02-22 10:14 ` Mark Brown
2010-02-23  2:21   ` Kuninori Morimoto
2010-02-23 10:46     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).