summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-04-11 12:35:41 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-04-11 12:35:42 +0200
commit1d0397d6029d16671624ae74d388592f47073be4 (patch)
tree6a56e3ccde80cfb4201c79fe35713511972139a0 /drivers/base
parentc9fea6f4379c72b7c59e1efceab09a35bc7eac43 (diff)
parent31895662f9ba81e8ea9ef05abf8edcb29d4b9c18 (diff)
downloadlinux-1d0397d6029d16671624ae74d388592f47073be4.tar.bz2
Merge tag 'mmio-clk-config' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into drm-misc-next
regmap: MMIO regmap clock configuration This patch provides a mechanism for specifying a different clock to be used with the regmap clock integration. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180226131207.GB6681@sirena.org.uk
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-mmio.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 5189fd6182f6..5cadfd3394d8 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -28,6 +28,8 @@
struct regmap_mmio_context {
void __iomem *regs;
unsigned val_bytes;
+
+ bool attached_clk;
struct clk *clk;
void (*reg_write)(struct regmap_mmio_context *ctx,
@@ -363,4 +365,26 @@ struct regmap *__devm_regmap_init_mmio_clk(struct device *dev,
}
EXPORT_SYMBOL_GPL(__devm_regmap_init_mmio_clk);
+int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk)
+{
+ struct regmap_mmio_context *ctx = map->bus_context;
+
+ ctx->clk = clk;
+ ctx->attached_clk = true;
+
+ return clk_prepare(ctx->clk);
+}
+EXPORT_SYMBOL_GPL(regmap_mmio_attach_clk);
+
+void regmap_mmio_detach_clk(struct regmap *map)
+{
+ struct regmap_mmio_context *ctx = map->bus_context;
+
+ clk_unprepare(ctx->clk);
+
+ ctx->attached_clk = false;
+ ctx->clk = NULL;
+}
+EXPORT_SYMBOL_GPL(regmap_mmio_detach_clk);
+
MODULE_LICENSE("GPL v2");