summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/Kconfig
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2026-03-10 14:18:11 +0000
committerMark Brown <broonie@kernel.org>2026-03-10 14:52:51 +0000
commitbf2d44d07de726b0393439cb4d4defc5cf89a4fc (patch)
treee34d8d1d707dfca30faf8ac9316884b4e55a9758 /sound/soc/codecs/Kconfig
parentb4e6b01191afb9516570437a7aff61019134fd59 (diff)
downloadlinux-next-bf2d44d07de726b0393439cb4d4defc5cf89a4fc.tar.gz
linux-next-bf2d44d07de726b0393439cb4d4defc5cf89a4fc.zip
ASoC: wm_adsp: Add kunit test for firmware file search
Add KUnit testing of the wm_adsp code that searches for firmware files. Also make the SND_SOC_WM_ADSP Kconfig symbol visible if KUNIT is enabled so that wm_adsp can be manually included for KUnit testing. The firmware filename is composed of several fields, some of which are optional, and there is a search algorithm to fallback from specific to generic versions of firmware for a device. This KUnit test verifies that wm_adsp is searching for the correct sequence of filenames. The are two ways of testing this, and both are used in this KUnit test. 1. Trap the calls to firmware_request_nowarn() and test that the sequence of filenames request is correct. This is the most thorough test because it proves that exactly the expected filenames are requested, in the correct order. But it doesn't fully cover regression testing. If a change to the search algorithm changes the expected sequence of requested files, the test must also be changed to expect that new sequence. If the expectation is wrong, the tests can pass (because the search order is as expected) while picking a different file in some cases from what it did before the change. 2. Test which file is picked from a simulated directory of files. This is better for regression testing because it is independent of the search algorithm. It does not need to change if the search algorithm changes. It is not testing exactly which files the algorithm searches for, only which file it eventually picks from a given set of available files. In other words, the regression test is: does it still pick the same file from the same directory of files? But it is impractical for thorough testing. It doesn't prove that exactly the correct files were searched for, unless it was to test with every possible combination of file names and directory content that could ever exist. Clearly this is impossible to implement, since the number of combations of possible valid filenames in a directory and number of files in a directory is astronomically large. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20260310141817.1871794-5-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/Kconfig')
-rw-r--r--sound/soc/codecs/Kconfig14
1 files changed, 13 insertions, 1 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index adb3fb923be3..f9e6a83e55c6 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -398,7 +398,7 @@ config SND_SOC_WM_HUBS
default m if SND_SOC_WM8993=m || SND_SOC_WM8994=m
config SND_SOC_WM_ADSP
- tristate
+ tristate "Cirrus Logic wm_adsp driver" if KUNIT
select FW_CS_DSP
select SND_SOC_COMPRESS
default y if SND_SOC_MADERA=y
@@ -424,6 +424,18 @@ config SND_SOC_WM_ADSP
default m if SND_SOC_CS35L56=m
default m if SND_SOC_CS48L32=m
+config SND_SOC_WM_ADSP_TEST
+ tristate "KUnit tests for Cirrus Logic wm_adsp" if !KUNIT_ALL_TESTS
+ depends on KUNIT
+ depends on SND_SOC_WM_ADSP
+ default KUNIT_ALL_TESTS
+ help
+ This builds KUnit tests for the Cirrus Logic wm_adsp library.
+ For more information on KUnit and unit tests in general,
+ please refer to the KUnit documentation in
+ Documentation/dev-tools/kunit/.
+ If in doubt, say "N".
+
config SND_SOC_AB8500_CODEC
tristate
depends on ABX500_CORE