diff options
author | Hsin-Yi Wang <hsinyi@chromium.org> | 2020-08-12 15:31:02 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-08-18 18:18:39 +0200 |
commit | 989e08c3d0044fc707c26c0329ed49e33e8e4c7b (patch) | |
tree | 43cd8c585558a938beadcb4f1aa3993fb34c75f5 /drivers/regulator/da9211-regulator.c | |
parent | regulator: lp8755: Get rid of lp8755_read/lp8755_write/lp8755_update_bits (diff) | |
download | linux-989e08c3d0044fc707c26c0329ed49e33e8e4c7b.tar.xz linux-989e08c3d0044fc707c26c0329ed49e33e8e4c7b.zip |
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 <djkurtz@chromium.org>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20200812133101.2513317-1-hsinyi@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/da9211-regulator.c')
-rw-r--r-- | drivers/regulator/da9211-regulator.c | 14 |
1 files changed, 14 insertions, 0 deletions
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), }; |