Input: Small regmap improvements
Subsystems (2)
cover Input: Small regmap improvements
This series has a few small improvements to the regmap usage in some of the input drivers, there's nothing really important here but it's all nice to have.
---
Mark Brown (3):
Input: cap11xx - Cache hardware ID registers
Input: cap11xx - Convert to use maple tree register cache
Input: qt1050 - Convert to use maple tree register cache
drivers/input/keyboard/cap11xx.c | 5 +---- drivers/input/keyboard/qt1050.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-)
---
base-commit: 6465e260f48790807eef06b583b38ca9789b6072
change-id: 20230929-input-maple-55fb28d952ea
Best regards,
Signature · 1 line
Mark Brown <[email protected]>
PATCH 1/3 Input: cap11xx - Cache hardware ID registers
The cap11xx devices have three hardware identification registers which are currently marked as volatile, preventing caching of those registers. This is not ideal since the registers should never change at runtime, we should be able to cache the value after the first read. Stop marking the registers as volatile, we don't have register defaults specified in the driver so this will result in reading from the hardware on first use.
--- drivers/input/keyboard/cap11xx.c | 3 --- 1 file changed, 3 deletions(-)
drivers/input/keyboard/cap11xx.c +0 -3
@@ -160,9 +160,6 @@ static bool cap11xx_volatile_reg(struct device *dev, unsigned int reg)case CAP11XX_REG_SENOR_DELTA (3 ):case CAP11XX_REG_SENOR_DELTA (4 ):case CAP11XX_REG_SENOR_DELTA (5 ): -case CAP11XX_REG_PRODUCT_ID : -case CAP11XX_REG_MANUFACTURER_ID : -case CAP11XX_REG_REVISION :return true; }
Signature · 1 line
2.39.2
PATCH 2/3 Input: cap11xx - Convert to use maple tree register cache
In reply to Mark BrownThe maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.
--- drivers/input/keyboard/cap11xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/cap11xx.c +1 -1
@@ -174,7 +174,7 @@ static const struct regmap_config cap11xx_regmap_config = { .reg_defaults = cap11xx_reg_defaults, .num_reg_defaults = ARRAY_SIZE(cap11xx_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .volatile_reg = cap11xx_volatile_reg, };
Signature · 1 line
2.39.2
PATCH 3/3 Input: qt1050 - Convert to use maple tree register cache
In reply to Mark BrownThe maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.
--- drivers/input/keyboard/qt1050.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/qt1050.c +1 -1
@@ -213,7 +213,7 @@ static struct regmap_config qt1050_regmap_config = { .val_bits = 8, .max_register = QT1050_RES_CAL, - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .wr_table = &qt1050_writeable_table, .rd_table = &qt1050_readable_table,
Signature · 1 line
2.39.2
Dmitry Torokhov
maintainerRe: [PATCH 2/3] Input: cap11xx - Convert to use maple tree register cache
In reply to Mark BrownHi Mark,
Quoted 14 lines · Mark Brown
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.
Signed-off-by Mark Brown <[email protected]>--- drivers/input/keyboard/cap11xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/keyboard/cap11xx.c +0
-0
drivers/input/keyboard/cap11xx.c static const struct regmap_config cap11xx_regmap_config = { · line 177
Quoted 5 lines
drivers/input/keyboard/cap11xx.c +1
-1@@ -174,7 +174,7 @@ static const struct regmap_config cap11xx_regmap_config = { .reg_defaults = cap11xx_reg_defaults, .num_reg_defaults = ARRAY_SIZE(cap11xx_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE,
I do not think these driver care much about the cache type. Optimal one might even depend on the architecture. I wonder if we could have something like REGCACHE_DEFAULT to signal that whatever is the "best default" implementation it should be used?
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH 2/3] Input: cap11xx - Convert to use maple tree register cache
Quoted 9 lines · Dmitry Torokhov
drivers/input/keyboard/cap11xx.c static const struct regmap_config cap11xx_regmap_config = { · line 177
Quoted 2 lines · Mark Brown
drivers/input/keyboard/cap11xx.c +1
-1- .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE,I do not think these driver care much about the cache type. Optimal one might even depend on the architecture. I wonder if we could have something like
REGCACHE_DEFAULTto signal that whatever is the "best default" implementation it should be used?
I do sometimes wonder about that but there's also been enough issues with the earlier stage of the transition and shaking out bugs in the new code that it makes me a bit nervous about using one. It has also been a useful exercise to go through and actually look at the users, but that could be done any time.
Dmitry Torokhov
maintainerQuoted 3 lines · Mark Brown
This series has a few small improvements to the regmap usage in some of the input drivers, there's nothing really important here but it's all nice to have.
Applied the lot, sorry for the delay.
Thanks.
Signature · 1 line
Dmitry