Takashi Iwai
c349a7f6d8
- Backport upstream fixes: buffer overflow fixes in aplay, segfault in aplaymidi, etc: 0008-topology-include-locale.h.patch 0009-nhlt-dmic-info.c-include-sys-types.h.patch 0010-topology-pre-processor-Add-support-for-enum-controls.patch 0011-configure.ac-fix-UMP-support-detection.patch 0012-bat-really-skip-analysis-of-the-first-period-and-upd.patch 0013-topology-add-include-for-ENABLE_NLS-on-musl.patch 0014-nhlt-use-stdint.h-types.patch 0015-Revert-nhlt-dmic-info.c-include-sys-types.h.patch 0016-aplay-use-stdint.h-types-instead-u_int-u_short-u_cha.patch 0017-alsa-restore.rules-use-devnode-instead-number-atribu.patch 0018-nhlt-Revert-SSP_ANALOG-device_type-field.patch 0019-alsactl-fix-potential-buffer-overwrite.patch 0020-aplay-fix-buffer-overflow-and-tainted-format-string.patch 0021-misc-fix-incorrect-usages-of-strerror.patch 0022-aplay-Add-option-for-specifying-subformat.patch 0023-aplay-allow-to-compile-with-older-alsa-lib-subformat.patch 0024-aplay-log-pcm-status-before-reporting-a-fatal-error.patch 0025-aplay-enable-timestamps-by-default.patch 0026-aplay-status-dumps-are-called-only-in-verbose-mode.patch 0027-aplaymidi-Set-event-completely-for-tempo-event.patch OBS-URL: https://build.opensuse.org/request/show/1137523 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=210
125 lines
5.0 KiB
Diff
125 lines
5.0 KiB
Diff
From 68dd54784a0b2287015433a62600b28bbff49399 Mon Sep 17 00:00:00 2001
|
|
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
|
Date: Mon, 11 Sep 2023 08:18:15 -0700
|
|
Subject: [PATCH] topology: pre-processor: Add support for enum controls
|
|
|
|
Add support for adding enum controls in the topology pre-processor.
|
|
|
|
Closes: https://github.com/alsa-project/alsa-utils/pull/236
|
|
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
topology/pre-process-dapm.c | 26 ++++++++++++++++++++++++++
|
|
topology/pre-process-object.c | 14 +++++++++++++-
|
|
topology/pre-processor.h | 4 ++++
|
|
3 files changed, 43 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/topology/pre-process-dapm.c b/topology/pre-process-dapm.c
|
|
index 9355a861757d..78944a6d9801 100644
|
|
--- a/topology/pre-process-dapm.c
|
|
+++ b/topology/pre-process-dapm.c
|
|
@@ -70,6 +70,26 @@ int tplg_build_channel_object(struct tplg_pre_processor *tplg_pp, snd_config_t *
|
|
return tplg_build_base_object(tplg_pp, obj_cfg, parent, false);
|
|
}
|
|
|
|
+int tplg_build_text_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
+ snd_config_t *parent)
|
|
+{
|
|
+ snd_config_t *cfg;
|
|
+ const char *name;
|
|
+ int ret;
|
|
+
|
|
+ cfg = tplg_object_get_instance_config(tplg_pp, obj_cfg);
|
|
+
|
|
+ name = tplg_object_get_name(tplg_pp, cfg);
|
|
+ if (!name)
|
|
+ return -EINVAL;
|
|
+
|
|
+ ret = tplg_build_object_from_template(tplg_pp, obj_cfg, &cfg, NULL, false);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ return tplg_parent_update(tplg_pp, parent, "texts", name);
|
|
+}
|
|
+
|
|
int tplg_build_tlv_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
snd_config_t *parent)
|
|
{
|
|
@@ -131,6 +151,12 @@ int tplg_build_bytes_control(struct tplg_pre_processor *tplg_pp, snd_config_t *o
|
|
return tplg_build_control(tplg_pp, obj_cfg, parent, "bytes");
|
|
}
|
|
|
|
+int tplg_build_enum_control(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
+ snd_config_t *parent)
|
|
+{
|
|
+ return tplg_build_control(tplg_pp, obj_cfg, parent, "enum");
|
|
+}
|
|
+
|
|
/*
|
|
* Widget names for pipeline endpoints can be of the following type:
|
|
* "class.<constructor args separated by .> ex: pga.0.1, buffer.1.1 etc
|
|
diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c
|
|
index 61cc85fbc43d..34b92033435c 100644
|
|
--- a/topology/pre-process-object.c
|
|
+++ b/topology/pre-process-object.c
|
|
@@ -117,7 +117,7 @@ int tplg_parent_update(struct tplg_pre_processor *tplg_pp, snd_config_t *parent,
|
|
return ret;
|
|
|
|
/* get section config */
|
|
- if (!strcmp(section_name, "tlv")) {
|
|
+ if (!strcmp(section_name, "tlv") || !strcmp(section_name, "texts")) {
|
|
/* set tlv name if config exists already */
|
|
ret = snd_config_search(cfg, section_name, &item_config);
|
|
if (ret < 0) {
|
|
@@ -1038,6 +1038,15 @@ const struct config_template_items bytes_control_config = {
|
|
.compound_config_ids = {"access"}
|
|
};
|
|
|
|
+const struct config_template_items enum_control_config = {
|
|
+ .int_config_ids = {"index"},
|
|
+ .compound_config_ids = {"access"}
|
|
+};
|
|
+
|
|
+const struct config_template_items text_config = {
|
|
+ .compound_config_ids = {"values"}
|
|
+};
|
|
+
|
|
const struct config_template_items scale_config = {
|
|
.int_config_ids = {"min", "step", "mute"},
|
|
};
|
|
@@ -1073,6 +1082,7 @@ const struct build_function_map object_build_map[] = {
|
|
{"Base", "ops", "ops" ,&tplg_build_ops_object, NULL, &ops_config},
|
|
{"Base", "extops", "extops" ,&tplg_build_ops_object, NULL, &ops_config},
|
|
{"Base", "channel", "channel", &tplg_build_channel_object, NULL, &channel_config},
|
|
+ {"Base", "text", "SectionText", &tplg_build_text_object, NULL, &text_config},
|
|
{"Base", "VendorToken", "SectionVendorTokens", &tplg_build_vendor_token_object,
|
|
NULL, NULL},
|
|
{"Base", "hw_config", "SectionHWConfig", &tplg_build_hw_cfg_object, NULL,
|
|
@@ -1085,6 +1095,8 @@ const struct build_function_map object_build_map[] = {
|
|
&mixer_control_config},
|
|
{"Control", "bytes", "SectionControlBytes", &tplg_build_bytes_control, NULL,
|
|
&bytes_control_config},
|
|
+ {"Control", "enum", "SectionControlEnum", &tplg_build_enum_control, NULL,
|
|
+ &enum_control_config},
|
|
{"Dai", "", "SectionBE", &tplg_build_generic_object, NULL, &be_dai_config},
|
|
{"PCM", "pcm", "SectionPCM", &tplg_build_generic_object, NULL, &pcm_config},
|
|
{"PCM", "pcm_caps", "SectionPCMCapabilities", &tplg_build_pcm_caps_object,
|
|
diff --git a/topology/pre-processor.h b/topology/pre-processor.h
|
|
index 878653d4c849..3a8a4bc3b1a8 100644
|
|
--- a/topology/pre-processor.h
|
|
+++ b/topology/pre-processor.h
|
|
@@ -70,6 +70,10 @@ int tplg_build_mixer_control(struct tplg_pre_processor *tplg_pp, snd_config_t *o
|
|
snd_config_t *parent);
|
|
int tplg_build_bytes_control(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
snd_config_t *parent);
|
|
+int tplg_build_enum_control(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
+ snd_config_t *parent);
|
|
+int tplg_build_text_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
+ snd_config_t *parent);
|
|
int tplg_build_dapm_route_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
|
|
snd_config_t *parent);
|
|
int tplg_build_hw_cfg_object(struct tplg_pre_processor *tplg_pp,
|
|
--
|
|
2.35.3
|
|
|