Skip to content

Commit

Permalink
ASoC: fsi: Add over_period flag to prevent the misunderstanding
Browse files Browse the repository at this point in the history
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Dec 30, 2009
1 parent 5b61735 commit 1c418d1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions sound/soc/sh/fsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,24 @@ static int fsi_data_push(struct fsi_priv *fsi)
int fifo_free;
int width;
u8 *start;
int i;
int i, over_period;

if (!fsi ||
!fsi->substream ||
!fsi->substream->runtime)
return -EINVAL;

runtime = fsi->substream->runtime;
over_period = 0;
substream = fsi->substream;
runtime = substream->runtime;

/* FSI FIFO has limit.
* So, this driver can not send periods data at a time
*/
if (fsi->byte_offset >=
fsi->period_len * (fsi->periods + 1)) {

substream = fsi->substream;
over_period = 1;
fsi->periods = (fsi->periods + 1) % runtime->periods;

if (0 == fsi->periods)
Expand Down Expand Up @@ -429,7 +431,7 @@ static int fsi_data_push(struct fsi_priv *fsi)

fsi_irq_enable(fsi, 1);

if (substream)
if (over_period)
snd_pcm_period_elapsed(substream);

return 0;
Expand All @@ -443,22 +445,24 @@ static int fsi_data_pop(struct fsi_priv *fsi)
int fifo_fill;
int width;
u8 *start;
int i;
int i, over_period;

if (!fsi ||
!fsi->substream ||
!fsi->substream->runtime)
return -EINVAL;

runtime = fsi->substream->runtime;
over_period = 0;
substream = fsi->substream;
runtime = substream->runtime;

/* FSI FIFO has limit.
* So, this driver can not send periods data at a time
*/
if (fsi->byte_offset >=
fsi->period_len * (fsi->periods + 1)) {

substream = fsi->substream;
over_period = 1;
fsi->periods = (fsi->periods + 1) % runtime->periods;

if (0 == fsi->periods)
Expand Down Expand Up @@ -498,7 +502,7 @@ static int fsi_data_pop(struct fsi_priv *fsi)

fsi_irq_enable(fsi, 0);

if (substream)
if (over_period)
snd_pcm_period_elapsed(substream);

return 0;
Expand Down

0 comments on commit 1c418d1

Please sign in to comment.