2020-08-12 13:33:26

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH] regulator: da9211: add cache_type

Add regmap_cache to reduce wakeups events of interrupt if regulator is
accessed frequently. This results in saving more power.

Suggested-by: Daniel Kurtz <[email protected]>
Signed-off-by: Hsin-Yi Wang <[email protected]>
---
drivers/regulator/da9211-regulator.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

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),
};
--
2.28.0.236.gb10cc79966-goog


2020-08-13 10:54:08

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH] regulator: da9211: add cache_type

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 <[email protected]>
> Signed-off-by: Hsin-Yi Wang <[email protected]>

Acked-by: Adam Thomson <[email protected]>

2020-08-18 17:03:44

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] regulator: da9211: add cache_type

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