mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04: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
7033592191
commit
fdffc47313
2 changed files with 28 additions and 0 deletions
|
|
@ -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"
|
||||
|
||||
|
|
@ -270,6 +271,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)
|
||||
|
|
@ -282,3 +285,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);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ struct clk_regmap {
|
|||
struct clk_vdd_class_data vdd_data;
|
||||
struct clk_regmap_ops *ops;
|
||||
struct list_head list_node;
|
||||
struct device *dev;
|
||||
};
|
||||
#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)
|
||||
|
||||
|
|
@ -71,4 +72,7 @@ struct clk_register_data {
|
|||
u32 offset;
|
||||
};
|
||||
|
||||
int clk_runtime_get_regmap(struct clk_regmap *rclk);
|
||||
void clk_runtime_put_regmap(struct clk_regmap *rclk);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue