[alsa-devel] [PATCH 1/3] topology: Add support for new widget types
Add topology support for new DSP widget types. This allows the new widgets to be added to the driver and firmware DAPM graphs.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- include/sound/asoc.h | 9 ++++++++- src/topology/dapm.c | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/sound/asoc.h b/include/sound/asoc.h index 082c5429..14ba30ff 100644 --- a/include/sound/asoc.h +++ b/include/sound/asoc.h @@ -70,7 +70,14 @@ #define SND_SOC_TPLG_DAPM_DAI_IN 13 #define SND_SOC_TPLG_DAPM_DAI_OUT 14 #define SND_SOC_TPLG_DAPM_DAI_LINK 15 -#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DAI_LINK +#define SND_SOC_TPLG_DAPM_BUFFER 16 +#define SND_SOC_TPLG_DAPM_PIPELINE 17 +#define SND_SOC_TPLG_DAPM_EFFECT 18 +#define SND_SOC_TPLG_DAPM_SIGGEN 19 +#define SND_SOC_TPLG_DAPM_SRC 20 +#define SND_SOC_TPLG_DAPM_ASRC 21 +#define SND_SOC_TPLG_DAPM_CODEC 22 +#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_CODEC
/* Header magic number and string sizes */ #define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ diff --git a/src/topology/dapm.c b/src/topology/dapm.c index 6af750b9..23908821 100644 --- a/src/topology/dapm.c +++ b/src/topology/dapm.c @@ -38,6 +38,13 @@ static const struct map_elem widget_map[] = { {"dai_in", SND_SOC_TPLG_DAPM_DAI_IN}, {"dai_out", SND_SOC_TPLG_DAPM_DAI_OUT}, {"dai_link", SND_SOC_TPLG_DAPM_DAI_LINK}, + {"buffer", SND_SOC_TPLG_DAPM_BUFFER}, + {"pipeline", SND_SOC_TPLG_DAPM_PIPELINE}, + {"effect", SND_SOC_TPLG_DAPM_EFFECT}, + {"siggen", SND_SOC_TPLG_DAPM_SIGGEN}, + {"src", SND_SOC_TPLG_DAPM_SRC}, + {"asrc", SND_SOC_TPLG_DAPM_ASRC}, + {"codec", SND_SOC_TPLG_DAPM_CODEC}, };
static int lookup_widget(const char *w)
The parser is missing some fields for certain objects that are part of the ABI. This patch adds the missing fields to the parser.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/topology/pcm.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+)
diff --git a/src/topology/pcm.c b/src/topology/pcm.c index daef20e4..0f4deb4f 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -383,6 +383,49 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, tplg_dbg("\t\t%s: %d\n", id, sc->channels_max); continue; } + + if (strcmp(id, "periods_min") == 0) { + sc->periods_min = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->periods_min); + continue; + } + + if (strcmp(id, "periods_max") == 0) { + sc->periods_max = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->periods_max); + continue; + } + + if (strcmp(id, "period_size_min") == 0) { + sc->period_size_min = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->period_size_min); + continue; + } + + if (strcmp(id, "period_size_max") == 0) { + sc->period_size_max = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->period_size_max); + continue; + } + + if (strcmp(id, "buffer_size_min") == 0) { + sc->buffer_size_min = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_min); + continue; + } + + if (strcmp(id, "buffer_size_max") == 0) { + sc->buffer_size_max = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_max); + continue; + } + + if (strcmp(id, "sig_bits") == 0) { + sc->sig_bits = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->sig_bits); + continue; + } + }
return 0; @@ -572,6 +615,17 @@ int tplg_parse_pcm(snd_tplg_t *tplg, continue; }
+ if (strcmp(id, "compress") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (strcmp(val, "true") == 0) + pcm->compress = 1; + + tplg_dbg("\t%s: %s\n", id, val); + continue; + } + if (strcmp(id, "dai") == 0) { err = tplg_parse_compound(tplg, n, tplg_parse_fe_dai, elem); @@ -655,6 +709,26 @@ int tplg_parse_dai(snd_tplg_t *tplg, continue; }
+ if (strcmp(id, "playback") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + dai->playback = atoi(val); + tplg_dbg("\t%s: %d\n", id, dai->playback); + continue; + } + + + if (strcmp(id, "capture") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + dai->capture = atoi(val); + tplg_dbg("\t%s: %d\n", id, dai->capture); + continue; + } + + /* stream capabilities */ if (strcmp(id, "pcm") == 0) { err = tplg_parse_compound(tplg, n, @@ -997,6 +1071,23 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, continue; }
+ if (strcmp(id, "bclk_freq") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->bclk_rate = atoi(val); + continue; + } + + if (strcmp(id, "bclk_invert") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "true")) + hw_cfg->invert_bclk = true; + continue; + } + if (strcmp(id, "fsync") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -1005,6 +1096,98 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, hw_cfg->fsync_master = true; continue; } + + if (strcmp(id, "fsync_invert") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "true")) + hw_cfg->invert_fsync = true; + continue; + } + + if (strcmp(id, "fsync_freq") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->fsync_rate = atoi(val); + continue; + } + + if (strcmp(id, "mclk_freq") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->mclk_rate = atoi(val); + continue; + } + + if (strcmp(id, "mclk") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "master")) + hw_cfg->mclk_direction = true; + continue; + } + + if (strcmp(id, "pm_gate_clocks") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "true")) + hw_cfg->clock_gated = true; + continue; + } + + if (strcmp(id, "tdm_slots") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tdm_slots = atoi(val); + continue; + } + + if (strcmp(id, "tdm_slot_width") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tdm_slot_width = atoi(val); + continue; + } + + if (strcmp(id, "tx_slots") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tx_slots = atoi(val); + continue; + } + + if (strcmp(id, "rx_slots") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->rx_slots = atoi(val); + continue; + } + + if (strcmp(id, "tx_channels") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tx_channels = atoi(val); + continue; + } + + if (strcmp(id, "rx_channels") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->rx_channels = atoi(val); + continue; + } + }
return 0;
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/topology/tplg_local.h | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index 42e3201d..60af0177 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -22,7 +22,6 @@ #include <sound/asoc.h> #include <sound/tlv.h>
-#define TPLG_DEBUG #ifdef TPLG_DEBUG #define tplg_dbg SNDERR #else
participants (1)
-
Liam Girdwood