aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-01-23 20:42:08 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-26 06:25:21 -0500
commit160afa7f05ef4922b136335cd1793b607ffb0d7c (patch)
tree20ec0a69f3eca366cc6b64aba64b8b98732d7800
parent58cc357f86a342924b0ed5c590823035690a0b19 (diff)
ASoC: sh: fsi: move chan_num from fsi_stream to fsi_priv
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/sh/fsi.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 5f39f364effd..605ea7f17cf3 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -130,7 +130,6 @@ struct fsi_stream {
130 struct snd_pcm_substream *substream; 130 struct snd_pcm_substream *substream;
131 131
132 int fifo_max_num; 132 int fifo_max_num;
133 int chan_num;
134 133
135 int buff_offset; 134 int buff_offset;
136 int buff_len; 135 int buff_len;
@@ -145,6 +144,7 @@ struct fsi_priv {
145 void __iomem *base; 144 void __iomem *base;
146 struct fsi_master *master; 145 struct fsi_master *master;
147 146
147 int chan_num;
148 struct fsi_stream playback; 148 struct fsi_stream playback;
149 struct fsi_stream capture; 149 struct fsi_stream capture;
150 150
@@ -348,7 +348,6 @@ static void fsi_stream_pop(struct fsi_priv *fsi, int is_play)
348static int fsi_get_fifo_data_num(struct fsi_priv *fsi, int is_play) 348static int fsi_get_fifo_data_num(struct fsi_priv *fsi, int is_play)
349{ 349{
350 u32 status; 350 u32 status;
351 struct fsi_stream *io = fsi_get_stream(fsi, is_play);
352 int data_num; 351 int data_num;
353 352
354 status = is_play ? 353 status = is_play ?
@@ -356,7 +355,7 @@ static int fsi_get_fifo_data_num(struct fsi_priv *fsi, int is_play)
356 fsi_reg_read(fsi, DIFF_ST); 355 fsi_reg_read(fsi, DIFF_ST);
357 356
358 data_num = 0x1ff & (status >> 8); 357 data_num = 0x1ff & (status >> 8);
359 data_num *= io->chan_num; 358 data_num *= fsi->chan_num;
360 359
361 return data_num; 360 return data_num;
362} 361}
@@ -378,7 +377,7 @@ static int fsi_get_frame_width(struct fsi_priv *fsi, int is_play)
378 struct snd_pcm_substream *substream = io->substream; 377 struct snd_pcm_substream *substream = io->substream;
379 struct snd_pcm_runtime *runtime = substream->runtime; 378 struct snd_pcm_runtime *runtime = substream->runtime;
380 379
381 return frames_to_bytes(runtime, 1) / io->chan_num; 380 return frames_to_bytes(runtime, 1) / fsi->chan_num;
382} 381}
383 382
384static void fsi_count_fifo_err(struct fsi_priv *fsi) 383static void fsi_count_fifo_err(struct fsi_priv *fsi)
@@ -571,10 +570,10 @@ static void fsi_fifo_init(struct fsi_priv *fsi,
571 * 7 channels: 32 ( 32 x 7 = 224) 570 * 7 channels: 32 ( 32 x 7 = 224)
572 * 8 channels: 32 ( 32 x 8 = 256) 571 * 8 channels: 32 ( 32 x 8 = 256)
573 */ 572 */
574 for (i = 1; i < io->chan_num; i <<= 1) 573 for (i = 1; i < fsi->chan_num; i <<= 1)
575 io->fifo_max_num >>= 1; 574 io->fifo_max_num >>= 1;
576 dev_dbg(dai->dev, "%d channel %d store\n", 575 dev_dbg(dai->dev, "%d channel %d store\n",
577 io->chan_num, io->fifo_max_num); 576 fsi->chan_num, io->fifo_max_num);
578 577
579 /* 578 /*
580 * set interrupt generation factor 579 * set interrupt generation factor
@@ -650,7 +649,7 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, int stream)
650 * data_num_max : number of FSI fifo free space 649 * data_num_max : number of FSI fifo free space
651 * data_num : number of ALSA residue data 650 * data_num : number of ALSA residue data
652 */ 651 */
653 data_num_max = io->fifo_max_num * io->chan_num; 652 data_num_max = io->fifo_max_num * fsi->chan_num;
654 data_num_max -= fsi_get_fifo_data_num(fsi, is_play); 653 data_num_max -= fsi_get_fifo_data_num(fsi, is_play);
655 654
656 data_num = data_residue_num; 655 data_num = data_residue_num;
@@ -746,14 +745,11 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
746{ 745{
747 struct fsi_priv *fsi = fsi_get_priv(substream); 746 struct fsi_priv *fsi = fsi_get_priv(substream);
748 struct fsi_master *master = fsi_get_master(fsi); 747 struct fsi_master *master = fsi_get_master(fsi);
749 struct fsi_stream *io;
750 u32 flags = fsi_get_info_flags(fsi); 748 u32 flags = fsi_get_info_flags(fsi);
751 u32 fmt; 749 u32 fmt;
752 u32 data; 750 u32 data;
753 int is_play = fsi_is_play(substream); 751 int is_play = fsi_is_play(substream);
754 752
755 io = fsi_get_stream(fsi, is_play);
756
757 pm_runtime_get_sync(dai->dev); 753 pm_runtime_get_sync(dai->dev);
758 754
759 755
@@ -776,29 +772,29 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
776 switch (fmt) { 772 switch (fmt) {
777 case SH_FSI_FMT_MONO: 773 case SH_FSI_FMT_MONO:
778 data = CR_MONO; 774 data = CR_MONO;
779 io->chan_num = 1; 775 fsi->chan_num = 1;
780 break; 776 break;
781 case SH_FSI_FMT_MONO_DELAY: 777 case SH_FSI_FMT_MONO_DELAY:
782 data = CR_MONO_D; 778 data = CR_MONO_D;
783 io->chan_num = 1; 779 fsi->chan_num = 1;
784 break; 780 break;
785 case SH_FSI_FMT_PCM: 781 case SH_FSI_FMT_PCM:
786 data = CR_PCM; 782 data = CR_PCM;
787 io->chan_num = 2; 783 fsi->chan_num = 2;
788 break; 784 break;
789 case SH_FSI_FMT_I2S: 785 case SH_FSI_FMT_I2S:
790 data = CR_I2S; 786 data = CR_I2S;
791 io->chan_num = 2; 787 fsi->chan_num = 2;
792 break; 788 break;
793 case SH_FSI_FMT_TDM: 789 case SH_FSI_FMT_TDM:
794 io->chan_num = is_play ? 790 fsi->chan_num = is_play ?
795 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags); 791 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags);
796 data = CR_TDM | (io->chan_num - 1); 792 data = CR_TDM | (fsi->chan_num - 1);
797 break; 793 break;
798 case SH_FSI_FMT_TDM_DELAY: 794 case SH_FSI_FMT_TDM_DELAY:
799 io->chan_num = is_play ? 795 fsi->chan_num = is_play ?
800 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags); 796 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags);
801 data = CR_TDM_D | (io->chan_num - 1); 797 data = CR_TDM_D | (fsi->chan_num - 1);
802 break; 798 break;
803 case SH_FSI_FMT_SPDIF: 799 case SH_FSI_FMT_SPDIF:
804 if (master->core->ver < 2) { 800 if (master->core->ver < 2) {
@@ -806,7 +802,7 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
806 return -EINVAL; 802 return -EINVAL;
807 } 803 }
808 data = CR_BWS_16 | CR_DTMD_SPDIF_PCM | CR_PCM; 804 data = CR_BWS_16 | CR_DTMD_SPDIF_PCM | CR_PCM;
809 io->chan_num = 2; 805 fsi->chan_num = 2;
810 fsi_spdif_clk_ctrl(fsi, 1); 806 fsi_spdif_clk_ctrl(fsi, 1);
811 fsi_reg_mask_set(fsi, OUT_SEL, DMMD, DMMD); 807 fsi_reg_mask_set(fsi, OUT_SEL, DMMD, DMMD);
812 break; 808 break;