summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-11-02 14:34:14 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2023-11-02 14:34:14 -1000
commitedd8e84ae9514e93368f56c3715b11af52df6c3b (patch)
tree2b37c874c009ccef2e38157c2fc6040324902673 /tools/testing
parent4ea4ed22b57846facd9cb4af5f67cb7bd2792cf3 (diff)
parentdc6e08b1a2ae262c23e14f5c259b4ca63a554e4f (diff)
Merge tag 'sound-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "Most of changes at this time are for ASoC, spread over ASoC core and drivers due to the API prefix standardization. Other than that, there have little change wrt API, rather lots of driver-specific updates and fixes. Some highlight below: ASoC: - Standardization of API prefix - GPIO API usage improvements - Support for HDA patches - Lots of work on SOF, including crash dump support - Fixes for noise when stopping some Sounwire CODECs - Support for AMD platforms with es83xx, AMD ACP 6.3 and 7.0, Awinc AT87390 and AW88399, many Intel platforms, many Mediatek platforms, Qualcomm SM6115 and SC7180 platforms, Richtek RTQ9128 and Texas Instruments TAS575x HD-audio and USB-audio: - Deferred probe support of audio component binding - More fixes and enhancements for Cirrus subcodecs - USB Scarlett2 mixer and McIntosh DSD quirk Others: - More enhancement of snd-aloop driver - Update MAINTAINERS entry for linux-sound mailing list" * tag 'sound-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (485 commits) ALSA: hda: cs35l41: Fix missing error code in cs35l41_smart_amp() ALSA: hda: cs35l41: mark cs35l41_verify_id() static ASoC: codecs: wsa883x: make use of new mute_unmute_on_trigger flag ASoC: soc-dai: add flag to mute and unmute stream during trigger ASoC: ams-delta.c: use component after check ASoC: amd: acp: select SND_SOC_AMD_ACP_LEGACY_COMMON for ACP63 ASoC: codecs: aw88399: fix typo in Kconfig select ASoC: amd: acp: add ACPI dependency ASoC: Intel: avs: Add rt5514 machine board ASoC: Intel: avs: Add rt5514 machine board ALSA: scarlett2: Add missing check with firmware version control ALSA: virtio: use ack callback ALSA: scarlett2: Remap Level Meter values ALSA: scarlett2: Allow passing any output to line_out_remap() ALSA: scarlett2: Add support for reading firmware version ALSA: scarlett2: Rename Gen 3 config sets ALSA: scarlett2: Rename scarlett_gen2 to scarlett2 ASoC: cs35l41: Detect CSPL errors when sending CSPL commands ALSA: hda: cs35l41: Check CSPL state after loading firmware ALSA: hda: cs35l41: Do not unload firmware before reset in system suspend ...
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/alsa/alsa-local.h10
-rw-r--r--tools/testing/selftests/alsa/conf.c100
-rw-r--r--tools/testing/selftests/alsa/pcm-test.c10
3 files changed, 73 insertions, 47 deletions
diff --git a/tools/testing/selftests/alsa/alsa-local.h b/tools/testing/selftests/alsa/alsa-local.h
index de030dc23bd1..29143ef52101 100644
--- a/tools/testing/selftests/alsa/alsa-local.h
+++ b/tools/testing/selftests/alsa/alsa-local.h
@@ -24,4 +24,14 @@ int conf_get_bool(snd_config_t *root, const char *key1, const char *key2, int de
void conf_get_string_array(snd_config_t *root, const char *key1, const char *key2,
const char **array, int array_size, const char *def);
+struct card_cfg_data {
+ int card;
+ snd_config_t *config;
+ const char *filename;
+ const char *config_id;
+ struct card_cfg_data *next;
+};
+
+extern struct card_cfg_data *conf_cards;
+
#endif /* __ALSA_LOCAL_H */
diff --git a/tools/testing/selftests/alsa/conf.c b/tools/testing/selftests/alsa/conf.c
index 2f1685a3eae1..00925eb8d9f4 100644
--- a/tools/testing/selftests/alsa/conf.c
+++ b/tools/testing/selftests/alsa/conf.c
@@ -19,14 +19,7 @@
#define SYSFS_ROOT "/sys"
-struct card_data {
- int card;
- snd_config_t *config;
- const char *filename;
- struct card_data *next;
-};
-
-static struct card_data *conf_cards;
+struct card_cfg_data *conf_cards;
static const char *alsa_config =
"ctl.hw {\n"
@@ -97,9 +90,9 @@ snd_config_t *get_alsalib_config(void)
return config;
}
-static struct card_data *conf_data_by_card(int card, bool msg)
+static struct card_cfg_data *conf_data_by_card(int card, bool msg)
{
- struct card_data *conf;
+ struct card_cfg_data *conf;
for (conf = conf_cards; conf; conf = conf->next) {
if (conf->card == card) {
@@ -229,55 +222,31 @@ static bool sysfs_match(const char *sysfs_root, snd_config_t *config)
return iter > 0;
}
-static bool test_filename1(int card, const char *filename, const char *sysfs_card_root)
+static void assign_card_config(int card, const char *sysfs_card_root)
{
- struct card_data *data, *data2;
- snd_config_t *config, *sysfs_config, *card_config, *sysfs_card_config, *node;
- snd_config_iterator_t i, next;
+ struct card_cfg_data *data;
+ snd_config_t *sysfs_card_config;
- config = conf_load_from_file(filename);
- if (snd_config_search(config, "sysfs", &sysfs_config) ||
- snd_config_get_type(sysfs_config) != SND_CONFIG_TYPE_COMPOUND)
- ksft_exit_fail_msg("Missing global sysfs block in filename %s\n", filename);
- if (snd_config_search(config, "card", &card_config) ||
- snd_config_get_type(card_config) != SND_CONFIG_TYPE_COMPOUND)
- ksft_exit_fail_msg("Missing global card block in filename %s\n", filename);
- if (!sysfs_match(SYSFS_ROOT, sysfs_config))
- return false;
- snd_config_for_each(i, next, card_config) {
- node = snd_config_iterator_entry(i);
- if (snd_config_search(node, "sysfs", &sysfs_card_config) ||
- snd_config_get_type(sysfs_card_config) != SND_CONFIG_TYPE_COMPOUND)
- ksft_exit_fail_msg("Missing card sysfs block in filename %s\n", filename);
+ for (data = conf_cards; data; data = data->next) {
+ snd_config_search(data->config, "sysfs", &sysfs_card_config);
if (!sysfs_match(sysfs_card_root, sysfs_card_config))
continue;
- data = malloc(sizeof(*data));
- if (!data)
- ksft_exit_fail_msg("Out of memory\n");
- data2 = conf_data_by_card(card, false);
- if (data2)
- ksft_exit_fail_msg("Duplicate card '%s' <-> '%s'\n", filename, data2->filename);
+
data->card = card;
- data->filename = filename;
- data->config = node;
- data->next = conf_cards;
- conf_cards = data;
- return true;
+ break;
}
- return false;
}
-static bool test_filename(const char *filename)
+static void assign_card_configs(void)
{
char fn[128];
int card;
for (card = 0; card < 32; card++) {
snprintf(fn, sizeof(fn), "%s/class/sound/card%d", SYSFS_ROOT, card);
- if (access(fn, R_OK) == 0 && test_filename1(card, filename, fn))
- return true;
+ if (access(fn, R_OK) == 0)
+ assign_card_config(card, fn);
}
- return false;
}
static int filename_filter(const struct dirent *dirent)
@@ -296,6 +265,41 @@ static int filename_filter(const struct dirent *dirent)
return 0;
}
+static bool match_config(const char *filename)
+{
+ struct card_cfg_data *data;
+ snd_config_t *config, *sysfs_config, *card_config, *sysfs_card_config, *node;
+ snd_config_iterator_t i, next;
+
+ config = conf_load_from_file(filename);
+ if (snd_config_search(config, "sysfs", &sysfs_config) ||
+ snd_config_get_type(sysfs_config) != SND_CONFIG_TYPE_COMPOUND)
+ ksft_exit_fail_msg("Missing global sysfs block in filename %s\n", filename);
+ if (snd_config_search(config, "card", &card_config) ||
+ snd_config_get_type(card_config) != SND_CONFIG_TYPE_COMPOUND)
+ ksft_exit_fail_msg("Missing global card block in filename %s\n", filename);
+ if (!sysfs_match(SYSFS_ROOT, sysfs_config))
+ return false;
+ snd_config_for_each(i, next, card_config) {
+ node = snd_config_iterator_entry(i);
+ if (snd_config_search(node, "sysfs", &sysfs_card_config) ||
+ snd_config_get_type(sysfs_card_config) != SND_CONFIG_TYPE_COMPOUND)
+ ksft_exit_fail_msg("Missing card sysfs block in filename %s\n", filename);
+
+ data = malloc(sizeof(*data));
+ if (!data)
+ ksft_exit_fail_msg("Out of memory\n");
+ data->filename = filename;
+ data->config = node;
+ data->card = -1;
+ if (snd_config_get_id(node, &data->config_id))
+ ksft_exit_fail_msg("snd_config_get_id failed for card\n");
+ data->next = conf_cards;
+ conf_cards = data;
+ }
+ return true;
+}
+
void conf_load(void)
{
const char *fn = "conf.d";
@@ -311,17 +315,19 @@ void conf_load(void)
if (filename == NULL)
ksft_exit_fail_msg("Out of memory\n");
sprintf(filename, "%s/%s", fn, namelist[j]->d_name);
- if (test_filename(filename))
+ if (match_config(filename))
filename = NULL;
free(filename);
free(namelist[j]);
}
free(namelist);
+
+ assign_card_configs();
}
void conf_free(void)
{
- struct card_data *conf;
+ struct card_cfg_data *conf;
while (conf_cards) {
conf = conf_cards;
@@ -332,7 +338,7 @@ void conf_free(void)
snd_config_t *conf_by_card(int card)
{
- struct card_data *conf;
+ struct card_cfg_data *conf;
conf = conf_data_by_card(card, true);
if (conf)
diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c
index c0a39818c5a4..de664dedb541 100644
--- a/tools/testing/selftests/alsa/pcm-test.c
+++ b/tools/testing/selftests/alsa/pcm-test.c
@@ -566,6 +566,7 @@ void *card_thread(void *data)
int main(void)
{
struct card_data *card;
+ struct card_cfg_data *conf;
struct pcm_data *pcm;
snd_config_t *global_config, *cfg;
int num_pcm_tests = 0, num_tests, num_std_pcm_tests;
@@ -583,6 +584,10 @@ int main(void)
find_pcms();
+ for (conf = conf_cards; conf; conf = conf->next)
+ if (conf->card < 0)
+ num_missing++;
+
num_std_pcm_tests = conf_get_count(default_pcm_config, "test", NULL);
for (pcm = pcm_list; pcm != NULL; pcm = pcm->next) {
@@ -598,6 +603,11 @@ int main(void)
ksft_set_plan(num_missing + num_pcm_tests);
+ for (conf = conf_cards; conf; conf = conf->next)
+ if (conf->card < 0)
+ ksft_test_result_fail("test.missing.%s.%s\n",
+ conf->filename, conf->config_id);
+
for (pcm = pcm_missing; pcm != NULL; pcm = pcm->next) {
ksft_test_result(false, "test.missing.%d.%d.%d.%s\n",
pcm->card, pcm->device, pcm->subdevice,