mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 12:11:59 +02:00
clk: qcom: Add functions to suspend or resume a clk_regmap's device
Add helper functions to suspend or resume the device associated with a clk_regmap. Change-Id: Ie4e47fce64e2052ffacdc3a8cd56fc69758d70fb Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
This commit is contained in:
parent
5d36546f55
commit
2ffa8360f4
|
|
@ -7,6 +7,7 @@
|
|||
#include <linux/clk-provider.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include "clk-regmap.h"
|
||||
|
||||
|
|
@ -271,6 +272,8 @@ int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk)
|
|||
{
|
||||
int ret;
|
||||
|
||||
rclk->dev = dev;
|
||||
|
||||
if (dev && dev_get_regmap(dev, NULL))
|
||||
rclk->regmap = dev_get_regmap(dev, NULL);
|
||||
else if (dev && dev->parent)
|
||||
|
|
@ -283,3 +286,24 @@ int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk)
|
|||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_clk_register_regmap);
|
||||
|
||||
int clk_runtime_get_regmap(struct clk_regmap *rclk)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (pm_runtime_enabled(rclk->dev)) {
|
||||
ret = pm_runtime_get_sync(rclk->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_runtime_get_regmap);
|
||||
|
||||
void clk_runtime_put_regmap(struct clk_regmap *rclk)
|
||||
{
|
||||
if (pm_runtime_enabled(rclk->dev))
|
||||
pm_runtime_put_sync(rclk->dev);
|
||||
}
|
||||
EXPORT_SYMBOL(clk_runtime_put_regmap);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ struct clk_regmap {
|
|||
struct clk_vdd_class_data vdd_data;
|
||||
struct clk_regmap_ops *ops;
|
||||
struct list_head list_node;
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
static inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw)
|
||||
|
|
@ -66,4 +67,7 @@ int clk_post_change_regmap(struct clk_hw *hw, unsigned long old_rate,
|
|||
int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk);
|
||||
bool clk_is_regmap_clk(struct clk_hw *hw);
|
||||
|
||||
int clk_runtime_get_regmap(struct clk_regmap *rclk);
|
||||
void clk_runtime_put_regmap(struct clk_regmap *rclk);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user