Commit 05fd8e73 authored by Sascha Hauer's avatar Sascha Hauer

clkdev: add possibility to get a clock based on the device name

This adds clk_get_sys to get a clock without the associated struct
device.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 0412d6c9
...@@ -62,9 +62,8 @@ static struct clk *clk_find(const char *dev_id, const char *con_id) ...@@ -62,9 +62,8 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)
return clk; return clk;
} }
struct clk *clk_get(struct device *dev, const char *con_id) struct clk *clk_get_sys(const char *dev_id, const char *con_id)
{ {
const char *dev_id = dev ? dev_name(dev) : NULL;
struct clk *clk; struct clk *clk;
mutex_lock(&clocks_mutex); mutex_lock(&clocks_mutex);
...@@ -75,6 +74,14 @@ struct clk *clk_get(struct device *dev, const char *con_id) ...@@ -75,6 +74,14 @@ struct clk *clk_get(struct device *dev, const char *con_id)
return clk ? clk : ERR_PTR(-ENOENT); return clk ? clk : ERR_PTR(-ENOENT);
} }
EXPORT_SYMBOL(clk_get_sys);
struct clk *clk_get(struct device *dev, const char *con_id)
{
const char *dev_id = dev ? dev_name(dev) : NULL;
return clk_get_sys(dev_id, con_id);
}
EXPORT_SYMBOL(clk_get); EXPORT_SYMBOL(clk_get);
void clk_put(struct clk *clk) void clk_put(struct clk *clk)
......
...@@ -125,4 +125,21 @@ int clk_set_parent(struct clk *clk, struct clk *parent); ...@@ -125,4 +125,21 @@ int clk_set_parent(struct clk *clk, struct clk *parent);
*/ */
struct clk *clk_get_parent(struct clk *clk); struct clk *clk_get_parent(struct clk *clk);
/**
* clk_get_sys - get a clock based upon the device name
* @dev_id: device name
* @con_id: connection ID
*
* Returns a struct clk corresponding to the clock producer, or
* valid IS_ERR() condition containing errno. The implementation
* uses @dev_id and @con_id to determine the clock consumer, and
* thereby the clock producer. In contrast to clk_get() this function
* takes the device name instead of the device itself for identification.
*
* Drivers must assume that the clock source is not enabled.
*
* clk_get_sys should not be called from within interrupt context.
*/
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment