Merge branch 'testing/driver-warnings' of git://git.kernel.org/pub/scm/linux/kernel...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-s3c24xx / clock-s3c2440.c
index 937a571d1b328a5621dec6ccc99fd58871a22f51..4407b17305396267b56d407f3ae80fb3dd4ef8b4 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,
        },
 };