diff mbox series

regulator: da9211: add cache_type

Message ID 20200812133101.2513317-1-hsinyi@chromium.org (mailing list archive)
State New, archived
Headers show
Series regulator: da9211: add cache_type | expand

Commit Message

Hsin-Yi Wang Aug. 12, 2020, 1:31 p.m. UTC
Add regmap_cache to reduce wakeups events of interrupt if regulator is
accessed frequently. This results in saving more power.

Suggested-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
 drivers/regulator/da9211-regulator.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Adam Thomson Aug. 13, 2020, 10:51 a.m. UTC | #1
On 12 August 2020 14:31, Hsin-Yi Wang wrote:

> Add regmap_cache to reduce wakeups events of interrupt if regulator is
> accessed frequently. This results in saving more power.
> 
> Suggested-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Mark Brown Aug. 18, 2020, 4:56 p.m. UTC | #2
On Wed, 12 Aug 2020 21:31:02 +0800, Hsin-Yi Wang wrote:
> Add regmap_cache to reduce wakeups events of interrupt if regulator is
> accessed frequently. This results in saving more power.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: da9211: add cache_type
      commit: 989e08c3d0044fc707c26c0329ed49e33e8e4c7b

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
diff mbox series

Patch

diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index 297b3aa7c753..cffcefd0538d 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -51,10 +51,24 @@  static const struct regmap_range_cfg da9211_regmap_range[] = {
 	},
 };
 
+static bool da9211_volatile_reg(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case DA9211_REG_STATUS_A:
+	case DA9211_REG_STATUS_B:
+	case DA9211_REG_EVENT_A:
+	case DA9211_REG_EVENT_B:
+		return true;
+	}
+	return false;
+}
+
 static const struct regmap_config da9211_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 	.max_register = 5 * 128,
+	.volatile_reg = da9211_volatile_reg,
+	.cache_type = REGCACHE_RBTREE,
 	.ranges = da9211_regmap_range,
 	.num_ranges = ARRAY_SIZE(da9211_regmap_range),
 };