- Upstream fixes, including the alsa-tools build breakage: 0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch 0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch 0003-ucm-add-_identifiers-list.patch 0004-namehint-correct-the-args-check.patch 0005-namehint-improve-the-previous-patch-check-the-return.patch 0006-ucm-docs-allow-spaces-in-device-names-for-JackHWMute.patch 0007-use-case-docs-add-PlaybackMixerCopy-and-CaptureMixer.patch 0008-ucm-docs-add-JackCTL-rearrange-JackControl-and-JackD.patch 0009-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch 0010-src-ucm-main.c-fix-build-without-mixer.patch 0011-alsa.m4-another-try-to-fix-the-libatopology-detectio.patch 0012-ucm-docs-add-Mic-DigitalMic-and-multiple-devices-com.patch 0013-ucm-docs-remove-DigitalMic-it-does-not-have-sense.patch 0014-ucm-docs-change-the-Mic-description-to-simple-Microp.patch 0015-ucm-docs-add-note-about-the-sequences-and-device-spl.patch 0016-ucm-docs-remove-MixerCopy-values-add-Priority-for-ve.patch 0017-ucm-setup-conf_format-after-getting-ALSA_CONFIG_UCM_.patch 0018-alsa-lib-fix-the-array-parser-unique-compound-keys.patch 0019-topology-remove-vendor_fd-name-from-snd_tplg-structu.patch 0020-topology-file-position-and-size-cleanups.patch 0021-topology-use-an-array-describing-blocks-for-the-main.patch 0022-topology-use-size_t-for-calc_block_size.patch 0023-topology-merge-write_block-to-tplg_write_data.patch 0024-topology-make-vebose-output-more-nice.patch 0025-topology-use-list_insert-macro-in-tplg_elem_insert.patch 0026-topology-dapm-coding-fixes.patch 0027-topology-dapm-merge-identical-index-blocks-like-for-.patch 0028-topology-more-coding-fixes.patch 0029-Fix-alsa-sound-.h-for-external-programs.patch OBS-URL: https://build.opensuse.org/request/show/758564 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=263
179 lines
5.0 KiB
Diff
179 lines
5.0 KiB
Diff
From 4dcceb5f866deda09e971b1c31d46403c3bd8e9e Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Fri, 13 Dec 2019 18:49:29 +0100
|
|
Subject: [PATCH 23/30] topology: merge write_block to tplg_write_data
|
|
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
src/topology/builder.c | 95 ++++++++++++++++++--------------------------------
|
|
1 file changed, 33 insertions(+), 62 deletions(-)
|
|
|
|
diff --git a/src/topology/builder.c b/src/topology/builder.c
|
|
index bbee71d67e94..f530fcd853c4 100644
|
|
--- a/src/topology/builder.c
|
|
+++ b/src/topology/builder.c
|
|
@@ -183,56 +183,6 @@ static size_t calc_block_size(struct list_head *base)
|
|
return size;
|
|
}
|
|
|
|
-static int write_block(snd_tplg_t *tplg, struct list_head *base, int type)
|
|
-{
|
|
- size_t size;
|
|
-
|
|
- /* calculate the block size in bytes for all elems in this list */
|
|
- size = calc_block_size(base);
|
|
- if (size == 0)
|
|
- return size;
|
|
-
|
|
- verbose(tplg, " block size for type %d is %zd\n", type, size);
|
|
-
|
|
- /* write each elem for this block */
|
|
- switch (type) {
|
|
- case SND_TPLG_TYPE_MIXER:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_MIXER, "mixer");
|
|
- case SND_TPLG_TYPE_BYTES:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_BYTES, "bytes");
|
|
- case SND_TPLG_TYPE_ENUM:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_ENUM, "enum");
|
|
- case SND_TPLG_TYPE_DAPM_GRAPH:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_DAPM_GRAPH, "route");
|
|
- case SND_TPLG_TYPE_DAPM_WIDGET:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_DAPM_WIDGET, "widget");
|
|
- case SND_TPLG_TYPE_PCM:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_PCM, "pcm");
|
|
- case SND_TPLG_TYPE_BE:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_BACKEND_LINK, "be");
|
|
- case SND_TPLG_TYPE_CC:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_CODEC_LINK, "cc");
|
|
- case SND_TPLG_TYPE_DATA:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_PDATA, "data");
|
|
- case SND_TPLG_TYPE_DAI:
|
|
- return write_elem_block(tplg, base, size,
|
|
- SND_SOC_TPLG_TYPE_DAI, "dai");
|
|
- default:
|
|
- return -EINVAL;
|
|
- }
|
|
-
|
|
- return 0;
|
|
-}
|
|
-
|
|
/* write the manifest including its private data */
|
|
static ssize_t write_manifest_data(snd_tplg_t *tplg)
|
|
{
|
|
@@ -262,60 +212,72 @@ int tplg_write_data(snd_tplg_t *tplg)
|
|
const char *name;
|
|
struct list_head *list;
|
|
int type;
|
|
+ int tsoc;
|
|
} *wptr, wtable[] = {
|
|
{
|
|
- .name = "control mixer elements",
|
|
+ .name = "control mixer",
|
|
.list = &tplg->mixer_list,
|
|
.type = SND_TPLG_TYPE_MIXER,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_MIXER,
|
|
},
|
|
{
|
|
- .name = "control enum elements",
|
|
+ .name = "control enum",
|
|
.list = &tplg->enum_list,
|
|
.type = SND_TPLG_TYPE_ENUM,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_ENUM,
|
|
},
|
|
{
|
|
- .name = "control extended (bytes) elements",
|
|
+ .name = "control extended (bytes)",
|
|
.list = &tplg->bytes_ext_list,
|
|
.type = SND_TPLG_TYPE_BYTES,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_BYTES,
|
|
},
|
|
{
|
|
- .name = "dapm widget elements",
|
|
+ .name = "dapm widget",
|
|
.list = &tplg->widget_list,
|
|
.type = SND_TPLG_TYPE_DAPM_WIDGET,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET,
|
|
},
|
|
{
|
|
- .name = "pcm elements",
|
|
+ .name = "pcm",
|
|
.list = &tplg->pcm_list,
|
|
.type = SND_TPLG_TYPE_PCM,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_PCM,
|
|
},
|
|
{
|
|
- .name = "physical dai elements",
|
|
+ .name = "physical dai",
|
|
.list = &tplg->dai_list,
|
|
.type = SND_TPLG_TYPE_DAI,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_DAI,
|
|
},
|
|
{
|
|
- .name = "be elements",
|
|
+ .name = "be",
|
|
.list = &tplg->be_list,
|
|
.type = SND_TPLG_TYPE_BE,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK,
|
|
},
|
|
{
|
|
- .name = "cc elements",
|
|
+ .name = "cc",
|
|
.list = &tplg->cc_list,
|
|
.type = SND_TPLG_TYPE_CC,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK,
|
|
},
|
|
{
|
|
- .name = "route (dapm graph) elements",
|
|
+ .name = "route (dapm graph)",
|
|
.list = &tplg->route_list,
|
|
.type = SND_TPLG_TYPE_DAPM_GRAPH,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH,
|
|
},
|
|
{
|
|
- .name = "private data elements",
|
|
+ .name = "private data",
|
|
.list = &tplg->pdata_list,
|
|
.type = SND_TPLG_TYPE_DATA,
|
|
+ .tsoc = SND_SOC_TPLG_TYPE_PDATA,
|
|
},
|
|
};
|
|
|
|
ssize_t ret;
|
|
+ size_t size;
|
|
unsigned int index;
|
|
|
|
/* write manifest */
|
|
@@ -328,9 +290,18 @@ int tplg_write_data(snd_tplg_t *tplg)
|
|
/* write all blocks */
|
|
for (index = 0; index < ARRAY_SIZE(wtable); index++) {
|
|
wptr = &wtable[index];
|
|
- ret = write_block(tplg, wptr->list, wptr->type);
|
|
+ /* calculate the block size in bytes for all elems in this list */
|
|
+ size = calc_block_size(wptr->list);
|
|
+ if (size == 0)
|
|
+ continue;
|
|
+ verbose(tplg, " block size for type %s (%d:%d) is %zd\n",
|
|
+ wptr->name, wptr->type,
|
|
+ wptr->tsoc, size);
|
|
+ ret = write_elem_block(tplg, wptr->list, size,
|
|
+ wptr->tsoc, wptr->name);
|
|
if (ret < 0) {
|
|
- SNDERR("failed to write %s: %s\n", wptr->name, snd_strerror(-ret));
|
|
+ SNDERR("failed to write %s elements: %s\n",
|
|
+ wptr->name, snd_strerror(-ret));
|
|
return ret;
|
|
}
|
|
}
|
|
--
|
|
2.16.4
|
|
|