]> www.infradead.org Git - users/jedix/linux-maple.git/commit
firmware: cs_dsp: Add mock regmap for KUnit testing
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Thu, 12 Dec 2024 14:37:14 +0000 (14:37 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 13 Dec 2024 13:14:37 +0000 (13:14 +0000)
commitd54a3fc6bf3db0db0e16cfdf7f48a8bbb803f6b0
tree4430ba9d661c24032f27cdd71f2ccc87aafd7751
parent3ce8df13f65e3ed297def63bb1e3ee6f024cbdc5
firmware: cs_dsp: Add mock regmap for KUnit testing

Add a mock regmap implementation to act as a simulated DSP for KUnit
testing. This is built as a utility module so that it could be used by
clients of cs_dsp to create a mock "DSP" for their own testing.

cs_dsp interacts with the DSP only through registers. Most of the
register space of the DSP is RAM. ADSP cores have a small set of control
registers. HALO Core DSPs have a much larger set of control registers but
only a small subset are used.

Most writes are "blind" in the sense that cs_dsp does not expect to
receive any sort of response from the DSP. So there isn't any need to
emulate a "DSP", only a set of registers that can be written and read
back.

The idea of the mock regmap is to use the cache to accumulate writes
which can then be tested against the values that are expected to be in
the registers.

Stray writes can be detected by dropping the cache entries for all
addresses that should have been written and then issuing a regcache_sync().
If this causes bus writes it means there were writes to unexpected
registers.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20241212143725.1381013-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
MAINTAINERS
drivers/firmware/cirrus/Kconfig
drivers/firmware/cirrus/Makefile
drivers/firmware/cirrus/test/Makefile [new file with mode: 0644]
drivers/firmware/cirrus/test/cs_dsp_mock_regmap.c [new file with mode: 0644]
drivers/firmware/cirrus/test/cs_dsp_mock_utils.c [new file with mode: 0644]
include/linux/firmware/cirrus/cs_dsp_test_utils.h [new file with mode: 0644]