regmap: Add debugfs file for forcing field writes
authorWaqar Hameed <waqar.hameed@axis.com>
Tue, 13 Jun 2023 11:42:27 +0000 (13:42 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 13 Jun 2023 12:15:04 +0000 (13:15 +0100)
commitb629c698eae745eb51b6d92395e2eee44bbf5f49
treeeba275a3802d57020141b2a4a8c89734a340351f
parentecfb8ce26d02ec136b4e1ae8c5a77d22d335057b
regmap: Add debugfs file for forcing field writes

`_regmap_update_bits()` checks if the current register value differs
from the new value, and only writes to the register if they differ. When
testing hardware drivers, it might be desirable to always force a
register write, for example when writing to a `regmap_field`. This
enables and simplifies testing and verification of the hardware
interaction. For example, when using a hardware mock/simulation model,
one can then more easily verify that the driver makes the correct
expected register writes during certain events.

Add a bool variable `force_write_field` and a corresponding debugfs
entry to enable this. Since this feature could interfere with driver
operation, guard it with a macro.

Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
Link: https://lore.kernel.org/r/pnd1qifa7sj.fsf@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/internal.h
drivers/base/regmap/regmap-debugfs.c
drivers/base/regmap/regmap.c