Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: sy8827n: Enable REGCACHE_FLAT

Enable regmap cache to reduce i2c transactions and corresponding
interrupts if regulator is accessed frequently. Since the register map
is small, we use a FLAT regmap cache.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20210803165211.3b00db29@xhacker.debian
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jisheng Zhang and committed by
Mark Brown
6bdd1c67 784ed369

+14
+14
drivers/regulator/sy8827n.c
··· 19 19 #define SY8827N_MODE (1 << 6) 20 20 #define SY8827N_VSEL1 1 21 21 #define SY8827N_CTRL 2 22 + #define SY8827N_ID1 3 23 + #define SY8827N_ID2 4 24 + #define SY8827N_PGOOD 5 25 + #define SY8827N_MAX (SY8827N_PGOOD + 1) 22 26 23 27 #define SY8827N_NVOLTAGES 64 24 28 #define SY8827N_VSELMIN 600000 ··· 106 102 return PTR_ERR_OR_ZERO(rdev); 107 103 } 108 104 105 + static bool sy8827n_volatile_reg(struct device *dev, unsigned int reg) 106 + { 107 + if (reg == SY8827N_PGOOD) 108 + return true; 109 + return false; 110 + } 111 + 109 112 static const struct regmap_config sy8827n_regmap_config = { 110 113 .reg_bits = 8, 111 114 .val_bits = 8, 115 + .volatile_reg = sy8827n_volatile_reg, 116 + .num_reg_defaults_raw = SY8827N_MAX, 117 + .cache_type = REGCACHE_FLAT, 112 118 }; 113 119 114 120 static int sy8827n_i2c_probe(struct i2c_client *client)