]> err.no Git - linux-2.6/commitdiff
[ARM] 3359/1: S3C24XX - add support for clk_set_rate
authorBen Dooks <ben-linux@fluff.org>
Mon, 20 Mar 2006 21:00:08 +0000 (21:00 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 21 Mar 2006 22:06:18 +0000 (22:06 +0000)
Patch from Ben Dooks

Add support for clk_set_rate and clk_round_rate to the
s3c2410 clock implementation

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-s3c2410/clock.c
arch/arm/mach-s3c2410/clock.h

index e205a6316b08273901a1521cb8fc80fd74f2568f..95c6d46c3dd64b0d9ba8208071097a72899431db 100644 (file)
@@ -180,12 +180,24 @@ unsigned long clk_get_rate(struct clk *clk)
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
+       if (!IS_ERR(clk) && clk->round_rate)
+               return (clk->round_rate)(clk, rate);
+
        return rate;
 }
 
 int clk_set_rate(struct clk *clk, unsigned long rate)
 {
-       return -EINVAL;
+       int ret;
+
+       if (IS_ERR(clk))
+               return -EINVAL;
+
+       mutex_lock(&clocks_mutex);
+       ret = (clk->set_rate)(clk, rate);
+       mutex_unlock(&clocks_mutex);
+
+       return ret;
 }
 
 struct clk *clk_get_parent(struct clk *clk)
index c4f36f006496514cae98c7af68e88970db5ba3bf..32864b30c1e0965488b0a1c9ec9fb463be8f168a 100644 (file)
@@ -21,6 +21,8 @@ struct clk {
        unsigned long         ctrlbit;
 
        int                 (*enable)(struct clk *, int enable);
+       int                 (*set_rate)(struct clk *c, unsigned long rate);
+       unsigned long       (*round_rate)(struct clk *c, unsigned long rate);
        int                 (*set_parent)(struct clk *c, struct clk *parent);
 };