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

Commit fdffc473 authored by Mike Tipton's avatar Mike Tipton
Browse files

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: default avatarMike Tipton <mdtipton@codeaurora.org>
parent 70335921
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -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);
+4 −0
Original line number Diff line number Diff line
@@ -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