aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/fsi.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-02-03 03:51:29 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-03 06:55:38 -0500
commitb49e8027810b674dc0bf0ba3d629c5fae52d78f3 (patch)
tree0dcedffb3937ad5d0069674a63b516fb76852711 /sound/soc/sh/fsi.c
parentd78629e2a4457149bd21fdb0cdbbb1c3ec019d96 (diff)
ASoC: fsi: tidyup: move fsi_fifo_init() onto fsi_hw_startup()
fsi_fifo_init() is called only from fsi_hw_startup() 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/fsi.c')
-rw-r--r--sound/soc/sh/fsi.c109
1 files changed, 54 insertions, 55 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 05307acb2bd3..79485ed9fd57 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -692,61 +692,6 @@ static void __fsi_port_clk_ctrl(struct fsi_priv *fsi, int is_play, int enable)
692/* 692/*
693 * ctrl function 693 * ctrl function
694 */ 694 */
695static void fsi_fifo_init(struct fsi_priv *fsi,
696 int is_play,
697 struct device *dev)
698{
699 struct fsi_master *master = fsi_get_master(fsi);
700 struct fsi_stream *io = fsi_stream_get(fsi, is_play);
701 u32 shift, i;
702 int frame_capa;
703
704 /* get on-chip RAM capacity */
705 shift = fsi_master_read(master, FIFO_SZ);
706 shift >>= fsi_get_port_shift(fsi, is_play);
707 shift &= FIFO_SZ_MASK;
708 frame_capa = 256 << shift;
709 dev_dbg(dev, "fifo = %d words\n", frame_capa);
710
711 /*
712 * The maximum number of sample data varies depending
713 * on the number of channels selected for the format.
714 *
715 * FIFOs are used in 4-channel units in 3-channel mode
716 * and in 8-channel units in 5- to 7-channel mode
717 * meaning that more FIFOs than the required size of DPRAM
718 * are used.
719 *
720 * ex) if 256 words of DP-RAM is connected
721 * 1 channel: 256 (256 x 1 = 256)
722 * 2 channels: 128 (128 x 2 = 256)
723 * 3 channels: 64 ( 64 x 3 = 192)
724 * 4 channels: 64 ( 64 x 4 = 256)
725 * 5 channels: 32 ( 32 x 5 = 160)
726 * 6 channels: 32 ( 32 x 6 = 192)
727 * 7 channels: 32 ( 32 x 7 = 224)
728 * 8 channels: 32 ( 32 x 8 = 256)
729 */
730 for (i = 1; i < fsi->chan_num; i <<= 1)
731 frame_capa >>= 1;
732 dev_dbg(dev, "%d channel %d store\n",
733 fsi->chan_num, frame_capa);
734
735 io->fifo_sample_capa = fsi_frame2sample(fsi, frame_capa);
736
737 /*
738 * set interrupt generation factor
739 * clear FIFO
740 */
741 if (is_play) {
742 fsi_reg_write(fsi, DOFF_CTL, IRQ_HALF);
743 fsi_reg_mask_set(fsi, DOFF_CTL, FIFO_CLR, FIFO_CLR);
744 } else {
745 fsi_reg_write(fsi, DIFF_CTL, IRQ_HALF);
746 fsi_reg_mask_set(fsi, DIFF_CTL, FIFO_CLR, FIFO_CLR);
747 }
748}
749
750static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io, 695static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io,
751 void (*run16)(struct fsi_priv *fsi, int size), 696 void (*run16)(struct fsi_priv *fsi, int size),
752 void (*run32)(struct fsi_priv *fsi, int size), 697 void (*run32)(struct fsi_priv *fsi, int size),
@@ -867,6 +812,60 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
867/* 812/*
868 * dai ops 813 * dai ops
869 */ 814 */
815static void fsi_fifo_init(struct fsi_priv *fsi,
816 int is_play,
817 struct device *dev)
818{
819 struct fsi_master *master = fsi_get_master(fsi);
820 struct fsi_stream *io = fsi_stream_get(fsi, is_play);
821 u32 shift, i;
822 int frame_capa;
823
824 /* get on-chip RAM capacity */
825 shift = fsi_master_read(master, FIFO_SZ);
826 shift >>= fsi_get_port_shift(fsi, is_play);
827 shift &= FIFO_SZ_MASK;
828 frame_capa = 256 << shift;
829 dev_dbg(dev, "fifo = %d words\n", frame_capa);
830
831 /*
832 * The maximum number of sample data varies depending
833 * on the number of channels selected for the format.
834 *
835 * FIFOs are used in 4-channel units in 3-channel mode
836 * and in 8-channel units in 5- to 7-channel mode
837 * meaning that more FIFOs than the required size of DPRAM
838 * are used.
839 *
840 * ex) if 256 words of DP-RAM is connected
841 * 1 channel: 256 (256 x 1 = 256)
842 * 2 channels: 128 (128 x 2 = 256)
843 * 3 channels: 64 ( 64 x 3 = 192)
844 * 4 channels: 64 ( 64 x 4 = 256)
845 * 5 channels: 32 ( 32 x 5 = 160)
846 * 6 channels: 32 ( 32 x 6 = 192)
847 * 7 channels: 32 ( 32 x 7 = 224)
848 * 8 channels: 32 ( 32 x 8 = 256)
849 */
850 for (i = 1; i < fsi->chan_num; i <<= 1)
851 frame_capa >>= 1;
852 dev_dbg(dev, "%d channel %d store\n",
853 fsi->chan_num, frame_capa);
854
855 io->fifo_sample_capa = fsi_frame2sample(fsi, frame_capa);
856
857 /*
858 * set interrupt generation factor
859 * clear FIFO
860 */
861 if (is_play) {
862 fsi_reg_write(fsi, DOFF_CTL, IRQ_HALF);
863 fsi_reg_mask_set(fsi, DOFF_CTL, FIFO_CLR, FIFO_CLR);
864 } else {
865 fsi_reg_write(fsi, DIFF_CTL, IRQ_HALF);
866 fsi_reg_mask_set(fsi, DIFF_CTL, FIFO_CLR, FIFO_CLR);
867 }
868}
870 869
871static int fsi_hw_startup(struct fsi_priv *fsi, 870static int fsi_hw_startup(struct fsi_priv *fsi,
872 int is_play, 871 int is_play,