ARM: S3C24XX: Add .get_rate callback for "camif-upll" clock
authorSylwester Nawrocki <sylvester.nawrocki@gmail.com>
Tue, 28 Aug 2012 22:59:42 +0000 (15:59 -0700)
committerKukjin Kim <kgene.kim@samsung.com>
Thu, 20 Sep 2012 23:04:40 +0000 (08:04 +0900)
Add missing get_rate callback for the "camif-upll" clock, so frequency
of this clock is properly reported with clk_get_rate().

Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-s3c24xx/clock-s3c2440.c

index cb2883d553b5e53c320588eb740d435e111d0758..749220f91a7079e8a4a1e65561189497e9743c36 100644 (file)
@@ -87,6 +87,19 @@ static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate)
        return 0;
 }
 
+static unsigned long s3c2440_camif_upll_getrate(struct clk *clk)
+{
+       unsigned long parent_rate = clk_get_rate(clk->parent);
+       unsigned long camdivn =  __raw_readl(S3C2440_CAMDIVN);
+
+       if (!(camdivn & S3C2440_CAMDIVN_CAMCLK_SEL))
+               return parent_rate;
+
+       camdivn &= S3C2440_CAMDIVN_CAMCLK_MASK;
+
+       return parent_rate / (camdivn + 1) / 2;
+}
+
 /* Extra S3C2440 clocks */
 
 static struct clk s3c2440_clk_cam = {
@@ -99,6 +112,7 @@ static struct clk s3c2440_clk_cam_upll = {
        .name           = "camif-upll",
        .ops            = &(struct clk_ops) {
                .set_rate       = s3c2440_camif_upll_setrate,
+               .get_rate       = s3c2440_camif_upll_getrate,
                .round_rate     = s3c2440_camif_upll_round,
        },
 };