diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-02-03 03:56:27 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-03 06:55:39 -0500 |
commit | 1b0ca1a0c056c7c97b18e363f939f0635ca093af (patch) | |
tree | 613607d8e560520446f9cf19c8db6f59be0fe605 /sound/soc/sh/fsi.c | |
parent | 5e97313ac483f03a9af661aada356980fe310e0d (diff) |
ASoC: fsi: tidyup: fsi_pio_xxx() are gathered
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.c | 101 |
1 files changed, 49 insertions, 52 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index b02886ad6f87..7c93b7c2fdbd 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -554,54 +554,6 @@ static int fsi_stream_remove(struct fsi_priv *fsi) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | /* | 556 | /* |
557 | * pio function | ||
558 | */ | ||
559 | |||
560 | static u8 *fsi_pio_get_area(struct fsi_priv *fsi, struct fsi_stream *io) | ||
561 | { | ||
562 | struct snd_pcm_runtime *runtime = io->substream->runtime; | ||
563 | |||
564 | return runtime->dma_area + | ||
565 | samples_to_bytes(runtime, io->buff_sample_pos); | ||
566 | } | ||
567 | |||
568 | static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int num) | ||
569 | { | ||
570 | u16 *start = (u16 *)_buf; | ||
571 | int i; | ||
572 | |||
573 | for (i = 0; i < num; i++) | ||
574 | fsi_reg_write(fsi, DODT, ((u32)*(start + i) << 8)); | ||
575 | } | ||
576 | |||
577 | static void fsi_pio_pop16(struct fsi_priv *fsi, u8 *_buf, int num) | ||
578 | { | ||
579 | u16 *start = (u16 *)_buf; | ||
580 | int i; | ||
581 | |||
582 | for (i = 0; i < num; i++) | ||
583 | *(start + i) = (u16)(fsi_reg_read(fsi, DIDT) >> 8); | ||
584 | } | ||
585 | |||
586 | static void fsi_pio_push32(struct fsi_priv *fsi, u8 *_buf, int num) | ||
587 | { | ||
588 | u32 *start = (u32 *)_buf; | ||
589 | int i; | ||
590 | |||
591 | for (i = 0; i < num; i++) | ||
592 | fsi_reg_write(fsi, DODT, *(start + i)); | ||
593 | } | ||
594 | |||
595 | static void fsi_pio_pop32(struct fsi_priv *fsi, u8 *_buf, int num) | ||
596 | { | ||
597 | u32 *start = (u32 *)_buf; | ||
598 | int i; | ||
599 | |||
600 | for (i = 0; i < num; i++) | ||
601 | *(start + i) = fsi_reg_read(fsi, DIDT); | ||
602 | } | ||
603 | |||
604 | /* | ||
605 | * irq function | 557 | * irq function |
606 | */ | 558 | */ |
607 | 559 | ||
@@ -757,10 +709,55 @@ static void __fsi_port_clk_ctrl(struct fsi_priv *fsi, int is_play, int enable) | |||
757 | fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0); | 709 | fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0); |
758 | } | 710 | } |
759 | 711 | ||
712 | |||
760 | /* | 713 | /* |
761 | * ctrl function | 714 | * pio data transfer handler |
762 | */ | 715 | */ |
763 | static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io, | 716 | static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int samples) |
717 | { | ||
718 | u16 *buf = (u16 *)_buf; | ||
719 | int i; | ||
720 | |||
721 | for (i = 0; i < samples; i++) | ||
722 | fsi_reg_write(fsi, DODT, ((u32)*(buf + i) << 8)); | ||
723 | } | ||
724 | |||
725 | static void fsi_pio_pop16(struct fsi_priv *fsi, u8 *_buf, int samples) | ||
726 | { | ||
727 | u16 *buf = (u16 *)_buf; | ||
728 | int i; | ||
729 | |||
730 | for (i = 0; i < samples; i++) | ||
731 | *(buf + i) = (u16)(fsi_reg_read(fsi, DIDT) >> 8); | ||
732 | } | ||
733 | |||
734 | static void fsi_pio_push32(struct fsi_priv *fsi, u8 *_buf, int samples) | ||
735 | { | ||
736 | u32 *buf = (u32 *)_buf; | ||
737 | int i; | ||
738 | |||
739 | for (i = 0; i < samples; i++) | ||
740 | fsi_reg_write(fsi, DODT, *(buf + i)); | ||
741 | } | ||
742 | |||
743 | static void fsi_pio_pop32(struct fsi_priv *fsi, u8 *_buf, int samples) | ||
744 | { | ||
745 | u32 *buf = (u32 *)_buf; | ||
746 | int i; | ||
747 | |||
748 | for (i = 0; i < samples; i++) | ||
749 | *(buf + i) = fsi_reg_read(fsi, DIDT); | ||
750 | } | ||
751 | |||
752 | static u8 *fsi_pio_get_area(struct fsi_priv *fsi, struct fsi_stream *io) | ||
753 | { | ||
754 | struct snd_pcm_runtime *runtime = io->substream->runtime; | ||
755 | |||
756 | return runtime->dma_area + | ||
757 | samples_to_bytes(runtime, io->buff_sample_pos); | ||
758 | } | ||
759 | |||
760 | static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io, | ||
764 | void (*run16)(struct fsi_priv *fsi, u8 *buf, int samples), | 761 | void (*run16)(struct fsi_priv *fsi, u8 *buf, int samples), |
765 | void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples), | 762 | void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples), |
766 | int samples) | 763 | int samples) |
@@ -825,7 +822,7 @@ static int fsi_pio_pop(struct fsi_priv *fsi, struct fsi_stream *io) | |||
825 | 822 | ||
826 | samples = min(sample_residues, sample_space); | 823 | samples = min(sample_residues, sample_space); |
827 | 824 | ||
828 | return fsi_fifo_data_ctrl(fsi, io, | 825 | return fsi_pio_transfer(fsi, io, |
829 | fsi_pio_pop16, | 826 | fsi_pio_pop16, |
830 | fsi_pio_pop32, | 827 | fsi_pio_pop32, |
831 | samples); | 828 | samples); |
@@ -843,7 +840,7 @@ static int fsi_pio_push(struct fsi_priv *fsi, struct fsi_stream *io) | |||
843 | 840 | ||
844 | samples = min(sample_residues, sample_space); | 841 | samples = min(sample_residues, sample_space); |
845 | 842 | ||
846 | return fsi_fifo_data_ctrl(fsi, io, | 843 | return fsi_pio_transfer(fsi, io, |
847 | fsi_pio_push16, | 844 | fsi_pio_push16, |
848 | fsi_pio_push32, | 845 | fsi_pio_push32, |
849 | samples); | 846 | samples); |