diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-11-07 22:09:20 -0500 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2012-11-08 03:52:05 -0500 |
commit | 50ce2da3486a9ba5371fc772407d7ee8e819dedd (patch) | |
tree | 79edf58ba16dbc773c14a30cb92bcfc7837ba259 /arch/arm/mach-shmobile | |
parent | 13e35b408ad0dd5592a7d2d1e6ad6c4962b8c4c5 (diff) |
ARM: shmobile: use FSI driver's audio clock on mackerel
Current FSI driver can control audio clock without platform
call-back functions
This patch removed board-specific call-back/settings
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index d5fe365cb870..bf2bcb92b426 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -862,76 +862,6 @@ static struct platform_device leds_device = { | |||
862 | 862 | ||
863 | /* FSI */ | 863 | /* FSI */ |
864 | #define IRQ_FSI evt2irq(0x1840) | 864 | #define IRQ_FSI evt2irq(0x1840) |
865 | static int __fsi_set_round_rate(struct clk *clk, long rate, int enable) | ||
866 | { | ||
867 | int ret; | ||
868 | |||
869 | if (rate <= 0) | ||
870 | return 0; | ||
871 | |||
872 | if (!enable) { | ||
873 | clk_disable(clk); | ||
874 | return 0; | ||
875 | } | ||
876 | |||
877 | ret = clk_set_rate(clk, clk_round_rate(clk, rate)); | ||
878 | if (ret < 0) | ||
879 | return ret; | ||
880 | |||
881 | return clk_enable(clk); | ||
882 | } | ||
883 | |||
884 | static int fsi_b_set_rate(struct device *dev, int rate, int enable) | ||
885 | { | ||
886 | struct clk *fsib_clk; | ||
887 | struct clk *fdiv_clk = clk_get(NULL, "fsidivb"); | ||
888 | long fsib_rate = 0; | ||
889 | long fdiv_rate = 0; | ||
890 | int ackmd_bpfmd; | ||
891 | int ret; | ||
892 | |||
893 | /* clock start */ | ||
894 | switch (rate) { | ||
895 | case 44100: | ||
896 | fsib_rate = rate * 256; | ||
897 | ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64; | ||
898 | break; | ||
899 | case 48000: | ||
900 | fsib_rate = 85428000; /* around 48kHz x 256 x 7 */ | ||
901 | fdiv_rate = rate * 256; | ||
902 | ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64; | ||
903 | break; | ||
904 | default: | ||
905 | pr_err("unsupported rate in FSI2 port B\n"); | ||
906 | return -EINVAL; | ||
907 | } | ||
908 | |||
909 | /* FSI B setting */ | ||
910 | fsib_clk = clk_get(dev, "ickb"); | ||
911 | if (IS_ERR(fsib_clk)) | ||
912 | return -EIO; | ||
913 | |||
914 | /* fsib */ | ||
915 | ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable); | ||
916 | if (ret < 0) | ||
917 | goto fsi_set_rate_end; | ||
918 | |||
919 | /* FSI DIV */ | ||
920 | ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable); | ||
921 | if (ret < 0) { | ||
922 | /* disable FSI B */ | ||
923 | if (enable) | ||
924 | __fsi_set_round_rate(fsib_clk, fsib_rate, 0); | ||
925 | goto fsi_set_rate_end; | ||
926 | } | ||
927 | |||
928 | ret = ackmd_bpfmd; | ||
929 | |||
930 | fsi_set_rate_end: | ||
931 | clk_put(fsib_clk); | ||
932 | return ret; | ||
933 | } | ||
934 | |||
935 | static struct sh_fsi_platform_info fsi_info = { | 865 | static struct sh_fsi_platform_info fsi_info = { |
936 | .port_a = { | 866 | .port_a = { |
937 | .flags = SH_FSI_BRS_INV, | 867 | .flags = SH_FSI_BRS_INV, |
@@ -942,8 +872,8 @@ static struct sh_fsi_platform_info fsi_info = { | |||
942 | .flags = SH_FSI_BRS_INV | | 872 | .flags = SH_FSI_BRS_INV | |
943 | SH_FSI_BRM_INV | | 873 | SH_FSI_BRM_INV | |
944 | SH_FSI_LRS_INV | | 874 | SH_FSI_LRS_INV | |
875 | SH_FSI_CLK_CPG | | ||
945 | SH_FSI_FMT_SPDIF, | 876 | SH_FSI_FMT_SPDIF, |
946 | .set_rate = fsi_b_set_rate, | ||
947 | } | 877 | } |
948 | }; | 878 | }; |
949 | 879 | ||