summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/alsa/mixer-test.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-03-22 16:18:07 +0100
committerTakashi Iwai <tiwai@suse.de>2023-03-24 07:49:47 +0100
commit05a2cdfef02595cf1ec843c814cac5d57290ad35 (patch)
tree0ddc3e5d5d603aa6a6340fbf5a03941675f7c5a8 /tools/testing/selftests/alsa/mixer-test.c
parentALSA: ac97: Remove redundant driver match function (diff)
downloadlinux-05a2cdfef02595cf1ec843c814cac5d57290ad35.tar.xz
linux-05a2cdfef02595cf1ec843c814cac5d57290ad35.zip
kselftest/alsa - mixer-test: Log values associated with event issues
While it is common for driver bugs with events to apply to all events there are some issues which only trigger for specific values. Understanding these is easier if we know what we were trying to do when configuring the control so add logging for the specific values involved in the spurious event. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230322-alsa-mixer-event-values-v1-1-78189fcf6655@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/alsa/mixer-test.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index 321c36f79279..c95d63e553f4 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -458,6 +458,48 @@ static void test_ctl_name(struct ctl_data *ctl)
ctl->card->card, ctl->elem);
}
+static void show_values(struct ctl_data *ctl, snd_ctl_elem_value_t *orig_val,
+ snd_ctl_elem_value_t *read_val)
+{
+ long long orig_int, read_int;
+ int i;
+
+ for (i = 0; i < snd_ctl_elem_info_get_count(ctl->info); i++) {
+ switch (snd_ctl_elem_info_get_type(ctl->info)) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ orig_int = snd_ctl_elem_value_get_boolean(orig_val, i);
+ read_int = snd_ctl_elem_value_get_boolean(read_val, i);
+ break;
+
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ orig_int = snd_ctl_elem_value_get_integer(orig_val, i);
+ read_int = snd_ctl_elem_value_get_integer(read_val, i);
+ break;
+
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ orig_int = snd_ctl_elem_value_get_integer64(orig_val,
+ i);
+ read_int = snd_ctl_elem_value_get_integer64(read_val,
+ i);
+ break;
+
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ orig_int = snd_ctl_elem_value_get_enumerated(orig_val,
+ i);
+ read_int = snd_ctl_elem_value_get_enumerated(read_val,
+ i);
+ break;
+
+ default:
+ return;
+ }
+
+ ksft_print_msg("%s.%d orig %lld read %lld, is_volatile %d\n",
+ ctl->name, i, orig_int, read_int,
+ snd_ctl_elem_info_is_volatile(ctl->info));
+ }
+}
+
static bool show_mismatch(struct ctl_data *ctl, int index,
snd_ctl_elem_value_t *read_val,
snd_ctl_elem_value_t *expected_val)
@@ -597,12 +639,14 @@ static int write_and_verify(struct ctl_data *ctl,
if (err < 1) {
ksft_print_msg("No event generated for %s\n",
ctl->name);
+ show_values(ctl, initial_val, read_val);
ctl->event_missing++;
}
} else {
if (err != 0) {
ksft_print_msg("Spurious event generated for %s\n",
ctl->name);
+ show_values(ctl, initial_val, read_val);
ctl->event_spurious++;
}
}