Skip to content

Commit 2cc3fdc

Browse files
committed
ASoC: es8316: Don't use ranges based register lookup for a single register
The es8316 driver uses a register range to specify the single volatile register it has. While the cost will be in the noise this is a bunch of overhead compared to just having a volatile_reg() callback so switch to the callback. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230419-asoc-es8316-volatile-v1-1-2074ec93d8f1@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 996b07e commit 2cc3fdc

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

sound/soc/codecs/es8316.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -803,22 +803,23 @@ static const struct snd_soc_component_driver soc_component_dev_es8316 = {
803803
.endianness = 1,
804804
};
805805

806-
static const struct regmap_range es8316_volatile_ranges[] = {
807-
regmap_reg_range(ES8316_GPIO_FLAG, ES8316_GPIO_FLAG),
808-
};
809-
810-
static const struct regmap_access_table es8316_volatile_table = {
811-
.yes_ranges = es8316_volatile_ranges,
812-
.n_yes_ranges = ARRAY_SIZE(es8316_volatile_ranges),
813-
};
806+
static bool es8316_volatile_reg(struct device *dev, unsigned int reg)
807+
{
808+
switch (reg) {
809+
case ES8316_GPIO_FLAG:
810+
return true;
811+
default:
812+
return false;
813+
}
814+
}
814815

815816
static const struct regmap_config es8316_regmap = {
816817
.reg_bits = 8,
817818
.val_bits = 8,
818819
.use_single_read = true,
819820
.use_single_write = true,
820821
.max_register = 0x53,
821-
.volatile_table = &es8316_volatile_table,
822+
.volatile_reg = es8316_volatile_reg,
822823
.cache_type = REGCACHE_RBTREE,
823824
};
824825

0 commit comments

Comments
 (0)