regulator: sy8824x: Enable REGCACHE_FLAT
PATCH 1/1 regulator: sy8824x: Enable REGCACHE_FLAT
Enable regmap cache to reduce i2c transactions and corresponding interrupts if regulator is accessed frequently. Since the register map is small -- there's only one register in sy8824c and sy8824e, there are only two registers in sy20276 and sy20278, so we use a FLAT regmap cache.
--- drivers/regulator/sy8824x.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/regulator/sy8824x.c +15 -1
@@ -25,6 +25,7 @@ struct sy8824_config {unsigned int vsel_min;unsigned int vsel_step;unsigned int vsel_count; +const struct regmap_config *config; };struct sy8824_device_info {
@@ -110,6 +111,15 @@ static int sy8824_regulator_register(struct sy8824_device_info *di,static const struct regmap_config sy8824_regmap_config = { .reg_bits =8 , .val_bits =8 , + .num_reg_defaults_raw =1 , + .cache_type =REGCACHE_FLAT , +}; + +static const struct regmap_config sy20276_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .num_reg_defaults_raw =2 , + .cache_type =REGCACHE_FLAT , };static int sy8824_i2c_probe (struct i2c_client *client)
@@ -134,7 +144,7 @@ static int sy8824_i2c_probe(struct i2c_client *client) di->dev = dev; di->cfg =of_device_get_match_data (dev); - regmap =devm_regmap_init_i2c (client, &sy8824_regmap_config); + regmap =devm_regmap_init_i2c (client, di->cfg->config);if (IS_ERR (regmap)) {dev_err (dev,"Failed to allocate regmap!\n" );return PTR_ERR (regmap);
@@ -160,6 +170,7 @@ static const struct sy8824_config sy8824c_cfg = { .vsel_min = 762500, .vsel_step = 12500, .vsel_count = 64, + .config = &sy8824_regmap_config, };static const struct sy8824_config sy8824e_cfg = {
@@ -169,6 +180,7 @@ static const struct sy8824_config sy8824e_cfg = { .vsel_min = 700000, .vsel_step = 12500, .vsel_count = 64, + .config = &sy8824_regmap_config, };static const struct sy8824_config sy20276_cfg = {
@@ -178,6 +190,7 @@ static const struct sy8824_config sy20276_cfg = { .vsel_min = 600000, .vsel_step = 10000, .vsel_count = 128, + .config = &sy20276_regmap_config, };static const struct sy8824_config sy20278_cfg = {
@@ -187,6 +200,7 @@ static const struct sy8824_config sy20278_cfg = { .vsel_min = 762500, .vsel_step = 12500, .vsel_count = 64, + .config = &sy20276_regmap_config, };static const struct of_device_id sy8824_dt_ids[] = {
Signature · 1 line
2.32.0
Mark Brown
maintainerQuoted 5 lines · Jisheng Zhang
Enable regmap cache to reduce i2c transactions and corresponding interrupts if regulator is accessed frequently. Since the register map is small -- there's only one register in sy8824c and sy8824e, there are only two registers in sy20276 and sy20278, so we use a FLAT regmap cache.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: sy8824x: Enable REGCACHE_FLAT
commit: 784ed36958390c511cd48db061401f9ba20ba67a
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