aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-02-03 03:50:09 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-03 06:55:38 -0500
commitc1e6f10ea94715f00cce4c9aaf7fc91fb34ec52d (patch)
treef965d995c0581e688818d32d8912abba9b396dee /sound/soc/sh
parent9f71770b88d1dafa46d4f3c3b359d1791e23eecf (diff)
ASoC: fsi: reduce runtime calculation by using pre-setting
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/fsi.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 3241e5bdd54b..0d78740d0a6b 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -167,6 +167,7 @@ struct fsi_stream {
167 int buff_sample_pos; /* sample position of ALSA buffer */ 167 int buff_sample_pos; /* sample position of ALSA buffer */
168 int period_samples; /* sample number / 1 period */ 168 int period_samples; /* sample number / 1 period */
169 int period_pos; /* current period position */ 169 int period_pos; /* current period position */
170 int sample_width; /* sample width */
170 171
171 int uerr_num; 172 int uerr_num;
172 int oerr_num; 173 int oerr_num;
@@ -406,6 +407,7 @@ static void fsi_stream_push(struct fsi_priv *fsi,
406 io->buff_sample_pos = 0; 407 io->buff_sample_pos = 0;
407 io->period_samples = fsi_frame2sample(fsi, runtime->period_size); 408 io->period_samples = fsi_frame2sample(fsi, runtime->period_size);
408 io->period_pos = 0; 409 io->period_pos = 0;
410 io->sample_width = samples_to_bytes(runtime, 1);
409 io->oerr_num = -1; /* ignore 1st err */ 411 io->oerr_num = -1; /* ignore 1st err */
410 io->uerr_num = -1; /* ignore 1st err */ 412 io->uerr_num = -1; /* ignore 1st err */
411 spin_unlock_irqrestore(&master->lock, flags); 413 spin_unlock_irqrestore(&master->lock, flags);
@@ -431,6 +433,7 @@ static void fsi_stream_pop(struct fsi_priv *fsi, int is_play)
431 io->buff_sample_pos = 0; 433 io->buff_sample_pos = 0;
432 io->period_samples = 0; 434 io->period_samples = 0;
433 io->period_pos = 0; 435 io->period_pos = 0;
436 io->sample_width = 0;
434 io->oerr_num = 0; 437 io->oerr_num = 0;
435 io->uerr_num = 0; 438 io->uerr_num = 0;
436 spin_unlock_irqrestore(&master->lock, flags); 439 spin_unlock_irqrestore(&master->lock, flags);
@@ -752,7 +755,6 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, int stream)
752 int is_play = fsi_stream_is_play(stream); 755 int is_play = fsi_stream_is_play(stream);
753 struct fsi_stream *io = fsi_get_stream(fsi, is_play); 756 struct fsi_stream *io = fsi_get_stream(fsi, is_play);
754 int sample_residues; 757 int sample_residues;
755 int sample_width;
756 int samples; 758 int samples;
757 int samples_max; 759 int samples_max;
758 int over_period; 760 int over_period;
@@ -780,9 +782,6 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, int stream)
780 io->buff_sample_pos = 0; 782 io->buff_sample_pos = 0;
781 } 783 }
782 784
783 /* get 1 sample data width */
784 sample_width = samples_to_bytes(runtime, 1);
785
786 /* get number of residue samples */ 785 /* get number of residue samples */
787 sample_residues = io->buff_sample_capa - io->buff_sample_pos; 786 sample_residues = io->buff_sample_capa - io->buff_sample_pos;
788 787
@@ -798,7 +797,7 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, int stream)
798 797
799 samples = sample_residues; 798 samples = sample_residues;
800 799
801 switch (sample_width) { 800 switch (io->sample_width) {
802 case 2: 801 case 2:
803 fn = fsi_dma_soft_push16; 802 fn = fsi_dma_soft_push16;
804 break; 803 break;
@@ -818,7 +817,7 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, int stream)
818 samples_max = sample_residues; 817 samples_max = sample_residues;
819 samples = fsi_get_current_fifo_samples(fsi, is_play); 818 samples = fsi_get_current_fifo_samples(fsi, is_play);
820 819
821 switch (sample_width) { 820 switch (io->sample_width) {
822 case 2: 821 case 2:
823 fn = fsi_dma_soft_pop16; 822 fn = fsi_dma_soft_pop16;
824 break; 823 break;