aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s5pc100/clock.c
diff options
context:
space:
mode:
authorSeungwhan Youn <sw.youn@samsung.com>2010-10-13 21:35:23 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-10-25 03:05:28 -0400
commit04a4fd0ae2c58943a7435de879b9714c96a1e96a (patch)
treea66f2b5c6bb1a963ebd21c3e9d998f28aad7d77e /arch/arm/mach-s5pc100/clock.c
parent4cfd9c2530822860d745154e4e64a1c241a0a674 (diff)
ARM: S5PC100: Add SCLK_SPDIF clock
This patch add SCLK_SPDIF clock to support source clock of S/PDIF on S5PC100. Signed-off-by: Seungwhan Youn <sw.youn@samsung.com> Acked-by: Jassi Brar <jassi.brar@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s5pc100/clock.c')
-rw-r--r--arch/arm/mach-s5pc100/clock.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 42b7138efb1d..306ae743ad72 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -980,6 +980,64 @@ struct clksrc_sources clk_src_pwi = {
980 .nr_sources = ARRAY_SIZE(clk_src_pwi_list), 980 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
981}; 981};
982 982
983static struct clk *clk_sclk_spdif_list[] = {
984 [0] = &clk_sclk_audio0.clk,
985 [1] = &clk_sclk_audio1.clk,
986 [2] = &clk_sclk_audio2.clk,
987};
988
989struct clksrc_sources clk_src_sclk_spdif = {
990 .sources = clk_sclk_spdif_list,
991 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
992};
993
994static int s5pc100_spdif_set_rate(struct clk *clk, unsigned long rate)
995{
996 struct clk *pclk;
997 int ret;
998
999 pclk = clk_get_parent(clk);
1000 if (IS_ERR(pclk))
1001 return -EINVAL;
1002
1003 ret = pclk->ops->set_rate(pclk, rate);
1004 clk_put(pclk);
1005
1006 return ret;
1007}
1008
1009static unsigned long s5pc100_spdif_get_rate(struct clk *clk)
1010{
1011 struct clk *pclk;
1012 int rate;
1013
1014 pclk = clk_get_parent(clk);
1015 if (IS_ERR(pclk))
1016 return -EINVAL;
1017
1018 rate = pclk->ops->get_rate(clk);
1019 clk_put(pclk);
1020
1021 return rate;
1022}
1023
1024static struct clk_ops s5pc100_sclk_spdif_ops = {
1025 .set_rate = s5pc100_spdif_set_rate,
1026 .get_rate = s5pc100_spdif_get_rate,
1027};
1028
1029static struct clksrc_clk clk_sclk_spdif = {
1030 .clk = {
1031 .name = "sclk_spdif",
1032 .id = -1,
1033 .ctrlbit = (1 << 11),
1034 .enable = s5pc100_sclk1_ctrl,
1035 .ops = &s5pc100_sclk_spdif_ops,
1036 },
1037 .sources = &clk_src_sclk_spdif,
1038 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
1039};
1040
983static struct clksrc_clk clksrcs[] = { 1041static struct clksrc_clk clksrcs[] = {
984 { 1042 {
985 .clk = { 1043 .clk = {
@@ -1185,6 +1243,7 @@ static struct clksrc_clk *sysclks[] = {
1185 &clk_sclk_audio0, 1243 &clk_sclk_audio0,
1186 &clk_sclk_audio1, 1244 &clk_sclk_audio1,
1187 &clk_sclk_audio2, 1245 &clk_sclk_audio2,
1246 &clk_sclk_spdif,
1188}; 1247};
1189 1248
1190void __init_or_cpufreq s5pc100_setup_clocks(void) 1249void __init_or_cpufreq s5pc100_setup_clocks(void)