Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70275397 authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

clk: Separate OF clock code from COMMON_CLK



Clock providers may wish to use the device tree
functionality of the clock framework without using
the COMMON_CLOCK framework. Unconditionally compile
drivers/clk/clk.c and #ifdef out the COMMON_CLK
related code.

Change-Id: I0ba03bbd57879ae17bedcb8c436e031834626673
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent bfc96c5e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/err.h>
#include <linux/list.h>
#include <linux/clkdev.h>
#include <linux/of.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/regulator/consumer.h>
@@ -226,4 +227,10 @@ static inline bool is_better_rate(unsigned long req, unsigned long best,
	return (req <= new && new < best) || (best < req && best < new);
}

extern int of_clk_add_provider(struct device_node *np,
			struct clk *(*clk_src_get)(struct of_phandle_args *args,
						   void *data),
			void *data);
extern void of_clk_del_provider(struct device_node *np);

#endif
+1 −1
Original line number Diff line number Diff line
# common clock types
obj-$(CONFIG_HAVE_CLK)		+= clk-devres.o
obj-$(CONFIG_CLKDEV_LOOKUP)	+= clkdev.o
obj-$(CONFIG_COMMON_CLK)	+= clk.o
obj-$(CONFIG_OF)		+= clk.o
obj-$(CONFIG_COMMON_CLK)	+= clk-divider.o
obj-$(CONFIG_COMMON_CLK)	+= clk-fixed-factor.o
obj-$(CONFIG_COMMON_CLK)	+= clk-fixed-rate.o
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@
#include <linux/init.h>
#include <linux/sched.h>

#if defined(CONFIG_COMMON_CLK)

static DEFINE_SPINLOCK(enable_lock);
static DEFINE_MUTEX(prepare_lock);

@@ -1969,6 +1971,8 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
}
EXPORT_SYMBOL_GPL(clk_notifier_unregister);

#endif /* CONFIG_COMMON_CLK */

#ifdef CONFIG_OF
/**
 * struct of_clk_provider - Clock provider registration structure
@@ -2001,6 +2005,8 @@ struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
}
EXPORT_SYMBOL_GPL(of_clk_src_simple_get);

#if defined(CONFIG_COMMON_CLK)

struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data)
{
	struct clk_onecell_data *clk_data = data;
@@ -2015,6 +2021,8 @@ struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data)
}
EXPORT_SYMBOL_GPL(of_clk_src_onecell_get);

#endif /* CONFIG_COMMON_CLK */

/**
 * of_clk_add_provider() - Register a clock provider for a node
 * @np: Device node pointer associated with clock provider
@@ -2108,6 +2116,8 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
}
EXPORT_SYMBOL_GPL(of_clk_get_parent_name);

#if defined(CONFIG_COMMON_CLK)

/**
 * of_clk_init() - Scan and init clock providers from the DT
 * @matches: array of compatible values and init functions for providers.
@@ -2128,4 +2138,7 @@ void __init of_clk_init(const struct of_device_id *matches)
		clk_init_cb(np);
	}
}

#endif /* CONFIG_COMMON_CLK */

#endif
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
static LIST_HEAD(clocks);
static DEFINE_MUTEX(clocks_mutex);

#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
#if defined(CONFIG_OF)
struct clk *of_clk_get(struct device_node *np, int index)
{
	struct of_phandle_args clkspec;
+1 −1
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
struct device_node;
struct of_phandle_args;

#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
#if defined(CONFIG_OF)
struct clk *of_clk_get(struct device_node *np, int index);
struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
Loading