public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: broonie@kernel.org (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: Applied "regmap: mmio: Add function to attach a clock" to the regmap tree
Date: Mon, 26 Feb 2018 11:17:49 +0000	[thread overview]
Message-ID: <E1eqGmz-0005ZC-LJ@debutante> (raw)
In-Reply-To: <1155920db000d014fd1cd604ed48d1b9a8f64ac1.1519204731.git-series.maxime.ripard@bootlin.com>

The patch

   regmap: mmio: Add function to attach a clock

has been applied to the regmap tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 31895662f9ba81e8ea9ef05abf8edcb29d4b9c18 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime.ripard@free-electrons.com>
Date: Wed, 21 Feb 2018 10:20:25 +0100
Subject: [PATCH] regmap: mmio: Add function to attach a clock

regmap_init_mmio_clk allows to specify a clock that needs to be enabled
while accessing the registers.

However, that clock is retrieved through its clock ID, which means it will
lookup that clock based on the current device that registers the regmap,
and, in the DT case, will only look in that device OF node.

This might be problematic if the clock to enable is stored in another node.
Let's add a function that allows to attach a clock that has already been
retrieved to a regmap in order to fix this.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap-mmio.c | 24 ++++++++++++++++++++++++
 include/linux/regmap.h            |  3 +++
 2 files changed, 27 insertions(+)

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");
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 6a3aeba40e9e..5f7ad0552c03 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -21,6 +21,7 @@
 #include <linux/lockdep.h>
 
 struct module;
+struct clk;
 struct device;
 struct i2c_client;
 struct irq_domain;
@@ -905,6 +906,8 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
 	__regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config,	\
 				sdw, config)
 
+int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
+void regmap_mmio_detach_clk(struct regmap *map);
 void regmap_exit(struct regmap *map);
 int regmap_reinit_cache(struct regmap *map,
 			const struct regmap_config *config);
-- 
2.16.1

  reply	other threads:[~2018-02-26 11:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21  9:20 [PATCH v2 00/10] drm/sun4i: Allwinner MIPI-DSI support Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 01/10] regmap: mmio: Add function to attach a clock Maxime Ripard
2018-02-26 11:17   ` Mark Brown [this message]
2018-02-26 13:12   ` Mark Brown
2018-02-21  9:20 ` [PATCH v2 02/10] drm/sun4i: tcon: Add TRI finish interrupt for vblank Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 03/10] drm/sun4i: Protect the TCON pixel clocks Maxime Ripard
2018-02-23 14:05   ` [v2,03/10] " Giulio Benetti
2018-02-23 23:31   ` Giulio Benetti
2018-02-26 11:15     ` Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 04/10] dt-bindings: display: Add Allwinner MIPI-DSI bindings Maxime Ripard
2018-03-01 22:15   ` Rob Herring
2018-03-06 13:23     ` Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 05/10] drm/sun4i: Add Allwinner A31 MIPI-DSI controller support Maxime Ripard
2018-02-21 14:48   ` kbuild test robot
2018-02-21  9:20 ` [PATCH v2 06/10] dt-bindings: vendor: Add Huarui Lighting Maxime Ripard
2018-03-01 22:38   ` Rob Herring
2018-02-21  9:20 ` [PATCH v2 07/10] dt-bindings: panel: Add Huarui LHR050H41 panel documentation Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 08/10] drm/panel: Add Huarui LHR050H41 panel driver Maxime Ripard
2018-02-21 15:05   ` kbuild test robot
2018-02-21 15:05   ` [RFC PATCH] drm/panel: lhr050h41_init[] can be static kbuild test robot
2018-02-21 15:36   ` [PATCH v2 08/10] drm/panel: Add Huarui LHR050H41 panel driver Chen-Yu Tsai
2018-03-02  9:52     ` Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 09/10] arm: dts: sun8i: a33: Add the DSI-related nodes Maxime Ripard
2018-02-21  9:20 ` [PATCH v2 10/10] [DO NOT MERGE] arm: dts: sun8i: bpi-m2m: Add DSI display Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1eqGmz-0005ZC-LJ@debutante \
    --to=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox