From: Mark Brown <broonie@kernel.org>
To: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
Shuah Khan <shuah@kernel.org>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
linux-kselftest@vger.kernel.org
Subject: [PATCH v3 2/3] kselftest: alsa: optimization for SNDRV_CTL_ELEM_ACCESS_VOLATILE
Date: Wed, 8 Dec 2021 21:17:44 +0000 [thread overview]
Message-ID: <20211208211745.533603-3-broonie@kernel.org> (raw)
In-Reply-To: <20211208211745.533603-1-broonie@kernel.org>
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
The volatile attribute of control element means that the hardware can
voluntarily change the state of control element independent of any
operation by software. ALSA control core necessarily sends notification
to userspace subscribers for any change from userspace application, while
it doesn't for the hardware's voluntary change.
This commit adds optimization for the attribute. Even if read value is
different from written value, the test reports success as long as the
target control element has the attribute. On the other hand, the
difference is itself reported for developers' convenience.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/Ya7TAHdMe9i41bsC@workstation
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/alsa/mixer-test.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index ab51cf7b9e03..171d33692c7b 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -307,9 +307,13 @@ bool show_mismatch(struct ctl_data *ctl, int index,
}
if (expected_int != read_int) {
- ksft_print_msg("%s.%d expected %lld but read %lld\n",
- ctl->name, index, expected_int, read_int);
- return true;
+ // NOTE: The volatile attribute means that the hardware can voluntarily change the
+ // state of control element independent of any operation by software.
+ bool is_volatile = snd_ctl_elem_info_is_volatile(ctl->info);
+
+ ksft_print_msg("%s.%d expected %lld but read %lld, is_volatile %d\n",
+ ctl->name, index, expected_int, read_int, is_volatile);
+ return !is_volatile;
} else {
return false;
}
--
2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
Shuah Khan <shuah@kernel.org>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org,
Mark Brown <broonie@kernel.org>
Subject: [PATCH v3 2/3] kselftest: alsa: optimization for SNDRV_CTL_ELEM_ACCESS_VOLATILE
Date: Wed, 8 Dec 2021 21:17:44 +0000 [thread overview]
Message-ID: <20211208211745.533603-3-broonie@kernel.org> (raw)
In-Reply-To: <20211208211745.533603-1-broonie@kernel.org>
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
The volatile attribute of control element means that the hardware can
voluntarily change the state of control element independent of any
operation by software. ALSA control core necessarily sends notification
to userspace subscribers for any change from userspace application, while
it doesn't for the hardware's voluntary change.
This commit adds optimization for the attribute. Even if read value is
different from written value, the test reports success as long as the
target control element has the attribute. On the other hand, the
difference is itself reported for developers' convenience.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/Ya7TAHdMe9i41bsC@workstation
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/alsa/mixer-test.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index ab51cf7b9e03..171d33692c7b 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -307,9 +307,13 @@ bool show_mismatch(struct ctl_data *ctl, int index,
}
if (expected_int != read_int) {
- ksft_print_msg("%s.%d expected %lld but read %lld\n",
- ctl->name, index, expected_int, read_int);
- return true;
+ // NOTE: The volatile attribute means that the hardware can voluntarily change the
+ // state of control element independent of any operation by software.
+ bool is_volatile = snd_ctl_elem_info_is_volatile(ctl->info);
+
+ ksft_print_msg("%s.%d expected %lld but read %lld, is_volatile %d\n",
+ ctl->name, index, expected_int, read_int, is_volatile);
+ return !is_volatile;
} else {
return false;
}
--
2.30.2
next prev parent reply other threads:[~2021-12-08 21:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 21:17 [PATCH v3 0/3] kselftest: alsa: Add basic mixer selftest Mark Brown
2021-12-08 21:17 ` Mark Brown
2021-12-08 21:17 ` [PATCH v3 1/3] kselftest: alsa: Add simplistic test for ALSA mixer controls kselftest Mark Brown
2021-12-08 21:17 ` Mark Brown
2021-12-08 21:17 ` Mark Brown [this message]
2021-12-08 21:17 ` [PATCH v3 2/3] kselftest: alsa: optimization for SNDRV_CTL_ELEM_ACCESS_VOLATILE Mark Brown
2021-12-08 21:25 ` Shuah Khan
2021-12-08 21:25 ` Shuah Khan
2021-12-10 3:10 ` Takashi Sakamoto
2021-12-10 3:10 ` Takashi Sakamoto
2021-12-08 21:17 ` [PATCH v3 3/3] kselftest: alsa: Use private alsa-lib configuration in mixer test Mark Brown
2021-12-08 21:17 ` Mark Brown
2021-12-08 21:27 ` Shuah Khan
2021-12-08 21:27 ` Shuah Khan
2021-12-08 21:44 ` Mark Brown
2021-12-08 21:44 ` Mark Brown
2021-12-08 22:06 ` Shuah Khan
2021-12-08 22:06 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211208211745.533603-3-broonie@kernel.org \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=shuah@kernel.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.