[ARM] 3331/1: S3C24XX - add clk_set_parent() to clock code
authorBen Dooks <ben-linux@fluff.org>
Mon, 20 Mar 2006 17:10:04 +0000 (17:10 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 21 Mar 2006 22:06:03 +0000 (22:06 +0000)
Patch from Ben Dooks

Add clk_set_parent() call to clock code

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 aaada9e3d67f7d39512b581b96b74ef94e682a22..773b7aec3e99b67881b633aaf48e72eedabfe4c1 100644 (file)
@@ -192,6 +192,23 @@ struct clk *clk_get_parent(struct clk *clk)
        return clk->parent;
 }
 
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+       int ret = 0;
+
+       if (IS_ERR(clk))
+               return -EINVAL;
+
+       mutex_lock(&clocks_mutex);
+
+       if (clk->set_parent)
+               ret = (clk->set_parent)(clk, parent);
+
+       mutex_unlock(&clocks_mutex);
+
+       return ret;
+}
+
 EXPORT_SYMBOL(clk_get);
 EXPORT_SYMBOL(clk_put);
 EXPORT_SYMBOL(clk_enable);
@@ -200,6 +217,7 @@ EXPORT_SYMBOL(clk_get_rate);
 EXPORT_SYMBOL(clk_round_rate);
 EXPORT_SYMBOL(clk_set_rate);
 EXPORT_SYMBOL(clk_get_parent);
+EXPORT_SYMBOL(clk_set_parent);
 
 /* base clock enable */
 
index eb5c95d1e7f255491a1bff88f7745a43572afe41..c4f36f006496514cae98c7af68e88970db5ba3bf 100644 (file)
@@ -19,7 +19,9 @@ struct clk {
        int                   usage;
        unsigned long         rate;
        unsigned long         ctrlbit;
+
        int                 (*enable)(struct clk *, int enable);
+       int                 (*set_parent)(struct clk *c, struct clk *parent);
 };
 
 /* other clocks which may be registered by board support */