[alsa-devel] [PATCH 0/7] topology: Add support for physical DAIs
From: Mengdong Lin mengdong.lin@linux.intel.com
This is the last series for topology user space atm.
This series adds support for physical DAIs and includes a few minor fixes. All ABI updates here can be supported by kernel in a backward compatible way.
Guneshwor Singh (3): topology: ABI - Define new types for physical DAI topology: Support configuring physical DAIs by C API topology: Export physical DAIs to the binary for kernel
Mengdong Lin (4): topology: ABI - Update manifest and pump ABI version to 5 topology: Parse physical DAIs in text conf file topology: ABI - Add voice wake up flag for DAI links topology: Revise document and comments for ABI v5
include/sound/asoc.h | 37 +++++++- include/topology.h | 94 ++++++++++++------- src/topology/builder.c | 11 +++ src/topology/data.c | 4 + src/topology/elem.c | 4 + src/topology/parser.c | 16 ++++ src/topology/pcm.c | 223 +++++++++++++++++++++++++++++++++++++++++++++- src/topology/tplg_local.h | 7 ++ 8 files changed, 362 insertions(+), 34 deletions(-)
From: Mengdong Lin mengdong.lin@linux.intel.com
Pump ABI version to 5.
To support physical DAIs and furture extension, add the following fields to manifest: - the count of physical DAIs. Later patches will add new ABI types for physical DAIs. - some reserved fields for new ABI objects in the future.
Kerel will handle this ABI update in a backward compatible way, via patch 'ASoC: topology: Make manifest backward compatible from ABI v4'.
Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/include/sound/asoc.h b/include/sound/asoc.h index 039ef3e..e14843b 100644 --- a/include/sound/asoc.h +++ b/include/sound/asoc.h @@ -79,7 +79,8 @@ #define SND_SOC_TPLG_NUM_TEXTS 16
/* ABI version */ -#define SND_SOC_TPLG_ABI_VERSION 0x4 +#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ +#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
/* Max size of TLV data */ #define SND_SOC_TPLG_TLV_SIZE 32 @@ -331,6 +332,8 @@ struct snd_soc_tplg_manifest { __le32 graph_elems; /* number of graph elements */ __le32 pcm_elems; /* number of PCM elements */ __le32 dai_link_elems; /* number of DAI link elements */ + __le32 dai_elems; /* number of physical DAI elements */ + __le32 reserved[20]; /* reserved for new ABI element types */ struct snd_soc_tplg_private priv; } __attribute__((packed));
From: Guneshwor Singh guneshwor.o.singh@intel.com
Define the type and ABI struct for physical DAIs (e.g. backend DAIs). They are new to ABI and so no backward compatibility risk.
Signed-off-by: Guneshwor Singh guneshwor.o.singh@intel.com Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/include/sound/asoc.h b/include/sound/asoc.h index e14843b..1232f1e 100644 --- a/include/sound/asoc.h +++ b/include/sound/asoc.h @@ -102,7 +102,8 @@ #define SND_SOC_TPLG_TYPE_CODEC_LINK 9 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 #define SND_SOC_TPLG_TYPE_PDATA 11 -#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA +#define SND_SOC_TPLG_TYPE_DAI 12 +#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
/* vendor block IDs - please add new vendor types to end */ #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 @@ -121,6 +122,11 @@ #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
+/* DAI flags */ +#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) +#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) +#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) + /* DAI physical PCM data formats. * Add new formats to the end of the list. */ @@ -510,4 +516,27 @@ struct snd_soc_tplg_link_config { __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ struct snd_soc_tplg_private priv; } __attribute__((packed)); + +/* + * Describes SW/FW specific features of physical DAI. + * It can be used to configure backend DAIs for DPCM. + * + * File block representation for physical DAI :- + * +-----------------------------------+-----+ + * | struct snd_soc_tplg_hdr | 1 | + * +-----------------------------------+-----+ + * | struct snd_soc_tplg_dai | N | + * +-----------------------------------+-----+ + */ +struct snd_soc_tplg_dai { + __le32 size; /* in bytes of this structure */ + char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ + __le32 dai_id; /* unique ID - used to match */ + __le32 playback; /* supports playback mode */ + __le32 capture; /* supports capture mode */ + struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ + __le32 flag_mask; /* bitmask of flags to configure */ + __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ + struct snd_soc_tplg_private priv; +} __attribute__((packed)); #endif
From: Mengdong Lin mengdong.lin@linux.intel.com
Add support for parsing physical DAIs in the text configuration file. The syntax of physical DAIs is described in document in topology.h
Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/include/topology.h b/include/topology.h index c52c580..0581b1c 100644 --- a/include/topology.h +++ b/include/topology.h @@ -663,6 +663,36 @@ extern "C" { * } * </pre> * + * <h4>Physical DAI</h4> + * A physical DAI (e.g. backend DAI for DPCM) is defined as a new section + * that can include a unique ID, playback and capture stream capabilities, + * optional flags, and private data. <br> + * Its PCM stream capablities are same as those for PCM objects, + * please refer to section 'PCM Capabilities'. + * + * <pre> + * SectionDAI."name" { + * + * index "1" # Index number + * + * id "0" # used for binding to the Backend DAI + * + * pcm."playback" { + * capabilities "capabilities1" # capabilities for playback + * } + * + * pcm."capture" { + * capabilities "capabilities2" # capabilities for capture + * } + * + * symmetric_rates "true" # optional flags + * symmetric_channels "true" + * symmetric_sample_bits "false" + * + * data "name" # optional private data + * } + * </pre> + * * <h4>Manifest Private Data</h4> * Manfiest may have private data. Users need to define a manifest section * and add the references to 1 or multiple data sections. Please refer to @@ -735,6 +765,7 @@ enum snd_tplg_type { SND_TPLG_TYPE_TUPLE, /*!< Vendor tuples */ SND_TPLG_TYPE_LINK, /*!< Physical DAI link */ SND_TPLG_TYPE_HW_CONFIG, /*!< Link HW config */ + SND_TPLG_TYPE_DAI, /*!< Physical DAI */ };
/** diff --git a/src/topology/data.c b/src/topology/data.c index 59bc970..0d5c430 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -46,6 +46,10 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) priv = &elem->widget->priv; break;
+ case SND_TPLG_TYPE_DAI: + priv = &elem->dai->priv; + break; + default: SNDERR("error: '%s': no support for private data for type %d\n", elem->id, elem->type); diff --git a/src/topology/elem.c b/src/topology/elem.c index 01dce1f..1a5ac84 100644 --- a/src/topology/elem.c +++ b/src/topology/elem.c @@ -192,6 +192,10 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, list_add_tail(&elem->list, &tplg->pcm_list); obj_size = sizeof(struct snd_soc_tplg_pcm); break; + case SND_TPLG_TYPE_DAI: + list_add_tail(&elem->list, &tplg->dai_list); + obj_size = sizeof(struct snd_soc_tplg_dai); + break; case SND_TPLG_TYPE_BE: case SND_TPLG_TYPE_LINK: list_add_tail(&elem->list, &tplg->be_list); diff --git a/src/topology/parser.c b/src/topology/parser.c index 7d0486c..72efef4 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -133,6 +133,14 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) continue; }
+ if (strcmp(id, "SectionDAI") == 0) { + err = tplg_parse_compound(tplg, n, + tplg_parse_dai, NULL); + if (err < 0) + return err; + continue; + } + if (strcmp(id, "SectionHWConfig") == 0) { err = tplg_parse_compound(tplg, n, tplg_parse_hw_config, NULL); @@ -450,6 +458,7 @@ snd_tplg_t *snd_tplg_new(void) INIT_LIST_HEAD(&tplg->tlv_list); INIT_LIST_HEAD(&tplg->widget_list); INIT_LIST_HEAD(&tplg->pcm_list); + INIT_LIST_HEAD(&tplg->dai_list); INIT_LIST_HEAD(&tplg->be_list); INIT_LIST_HEAD(&tplg->cc_list); INIT_LIST_HEAD(&tplg->route_list); @@ -476,6 +485,7 @@ void snd_tplg_free(snd_tplg_t *tplg) tplg_elem_free_list(&tplg->tlv_list); tplg_elem_free_list(&tplg->widget_list); tplg_elem_free_list(&tplg->pcm_list); + tplg_elem_free_list(&tplg->dai_list); tplg_elem_free_list(&tplg->be_list); tplg_elem_free_list(&tplg->cc_list); tplg_elem_free_list(&tplg->route_list); diff --git a/src/topology/pcm.c b/src/topology/pcm.c index a9d3277..4093e2f 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -341,6 +341,7 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *n; struct tplg_elem *elem = private; struct snd_soc_tplg_pcm *pcm; + struct snd_soc_tplg_dai *dai; unsigned int *playback, *capture; struct snd_soc_tplg_stream_caps *caps; const char *id, *value; @@ -357,6 +358,14 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, capture = &pcm->capture; caps = pcm->caps; break; + + case SND_TPLG_TYPE_DAI: + dai = elem->dai; + playback = &dai->playback; + capture = &dai->capture; + caps = dai->caps; + break; + default: return -EINVAL; } @@ -557,6 +566,109 @@ int tplg_parse_pcm(snd_tplg_t *tplg, return 0; }
+/* Parse physical DAI */ +int tplg_parse_dai(snd_tplg_t *tplg, + snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) +{ + struct snd_soc_tplg_dai *dai; + struct tplg_elem *elem; + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id, *val = NULL; + int err; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAI); + if (!elem) + return -ENOMEM; + + dai = elem->dai; + dai->size = elem->size; + elem_copy_text(dai->dai_name, elem->id, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + + tplg_dbg(" DAI: %s\n", elem->id); + + snd_config_for_each(i, next, cfg) { + + n = snd_config_iterator_entry(i); + if (snd_config_get_id(n, &id) < 0) + continue; + + /* skip comments */ + if (strcmp(id, "comment") == 0) + continue; + if (id[0] == '#') + continue; + + if (strcmp(id, "index") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + elem->index = atoi(val); + tplg_dbg("\t%s: %d\n", id, elem->index); + continue; + } + + if (strcmp(id, "id") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + dai->dai_id = atoi(val); + tplg_dbg("\t%s: %d\n", id, dai->dai_id); + continue; + } + + /* stream capabilities */ + if (strcmp(id, "pcm") == 0) { + err = tplg_parse_compound(tplg, n, + tplg_parse_streams, elem); + if (err < 0) + return err; + continue; + } + + /* flags */ + if (strcmp(id, "symmetric_rates") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES, + &dai->flag_mask, &dai->flags); + if (err < 0) + return err; + continue; + } + + if (strcmp(id, "symmetric_channels") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS, + &dai->flag_mask, &dai->flags); + if (err < 0) + return err; + continue; + } + + if (strcmp(id, "symmetric_sample_bits") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS, + &dai->flag_mask, &dai->flags); + if (err < 0) + return err; + continue; + } + + /* private data */ + if (strcmp(id, "data") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); + tplg_dbg("\t%s: %s\n", id, val); + continue; + } + } + + return 0; +} + /* parse physical link runtime supported HW configs in text conf file */ static int parse_hw_config_refs(snd_tplg_t *tplg, snd_config_t *cfg, struct tplg_elem *elem) diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index 9e67bf8..eeeb0f1 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -64,6 +64,7 @@ struct snd_tplg { struct list_head tlv_list; struct list_head widget_list; struct list_head pcm_list; + struct list_head dai_list; struct list_head be_list; struct list_head cc_list; struct list_head route_list; @@ -145,6 +146,7 @@ struct tplg_elem { struct snd_soc_tplg_bytes_control *bytes_ext; struct snd_soc_tplg_dapm_widget *widget; struct snd_soc_tplg_pcm *pcm; + struct snd_soc_tplg_dai *dai; struct snd_soc_tplg_link_config *link;/* physical link */ struct snd_soc_tplg_dapm_graph_elem *route; struct snd_soc_tplg_stream *stream_cfg; @@ -222,6 +224,9 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, void *private ATTRIBUTE_UNUSED);
+int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + void *private ATTRIBUTE_UNUSED); + int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *private ATTRIBUTE_UNUSED);
From: Guneshwor Singh guneshwor.o.singh@intel.com
In addition to text conf file, physical DAIs can also be configured by C API. This patch defines the template to add physical DAI configurations from C API.
Signed-off-by: Guneshwor Singh guneshwor.o.singh@intel.com Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/include/topology.h b/include/topology.h index 0581b1c..c5d0080 100644 --- a/include/topology.h +++ b/include/topology.h @@ -1014,6 +1014,22 @@ struct snd_tplg_hw_config_template { unsigned int *rx_chanmap; /* array of slot number */ };
+/** \struct snd_tplg_dai_template + * \brief Template type for physical DAI. + * It can be used to configure backend DAIs for DPCM. + */ +struct snd_tplg_dai_template { + const char *dai_name; /*!< DAI name */ + unsigned int dai_id; /*!< unique ID - used to match */ + unsigned int playback; /*!< supports playback mode */ + unsigned int capture; /*!< supports capture mode */ + struct snd_tplg_stream_caps_template *caps[2]; /*!< playback & capture for DAI */ + unsigned int flag_mask; /*!< bitmask of flags to configure */ + unsigned int flags; /*!< SND_SOC_TPLG_DAI_FLGBIT_* */ + struct snd_soc_tplg_private *priv; /*!< private data */ + +}; + /** \struct snd_tplg_link_template * \brief Template type for BE and CC DAI Links. */ @@ -1050,6 +1066,7 @@ typedef struct snd_tplg_obj_template { struct snd_tplg_graph_template *graph; /*!< Graph elements */ struct snd_tplg_pcm_template *pcm; /*!< PCM elements */ struct snd_tplg_link_template *link; /*!< BE and CC Links */ + struct snd_tplg_dai_template *dai; /*!< Physical DAI */ }; } snd_tplg_obj_template_t;
diff --git a/src/topology/parser.c b/src/topology/parser.c index 72efef4..4afa576 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -364,6 +364,8 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) return tplg_add_graph_object(tplg, t); case SND_TPLG_TYPE_PCM: return tplg_add_pcm_object(tplg, t); + case SND_TPLG_TYPE_DAI: + return tplg_add_dai_object(tplg, t); case SND_TPLG_TYPE_LINK: case SND_TPLG_TYPE_BE: case SND_TPLG_TYPE_CC: diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 4093e2f..9f60e4b 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -1201,3 +1201,58 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
return 0; } + +int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) +{ + struct snd_tplg_dai_template *dai_tpl = t->dai; + struct snd_soc_tplg_dai *dai, *_dai; + struct tplg_elem *elem; + int i; + + tplg_dbg("DAI %s\n", dai_tpl->dai_name); + + elem = tplg_elem_new_common(tplg, NULL, dai_tpl->dai_name, + SND_TPLG_TYPE_DAI); + if (!elem) + return -ENOMEM; + + dai = elem->dai; + dai->size = elem->size; + + elem_copy_text(dai->dai_name, dai_tpl->dai_name, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + dai->dai_id = dai_tpl->dai_id; + + /* stream caps */ + dai->playback = dai_tpl->playback; + dai->capture = dai_tpl->capture; + + for (i = 0; i < 2; i++) { + if (dai_tpl->caps[i]) + tplg_add_stream_caps(&dai->caps[i], dai_tpl->caps[i]); + } + + /* flags */ + dai->flag_mask = dai_tpl->flag_mask; + dai->flags = dai_tpl->flags; + + /* private data */ + if (dai_tpl->priv != NULL) { + _dai = realloc(dai, + elem->size + dai_tpl->priv->size); + if (!_dai) { + tplg_elem_free(elem); + return -ENOMEM; + } + + dai = _dai; + dai->priv.size = dai_tpl->priv->size; + + elem->dai = dai; + elem->size += dai->priv.size; + memcpy(dai->priv.data, dai_tpl->priv->data, + dai->priv.size); + } + + return 0; +} diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index eeeb0f1..807462b 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -297,3 +297,4 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type); int tplg_build_links(snd_tplg_t *tplg, unsigned int type); int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); +int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
From: Guneshwor Singh guneshwor.o.singh@intel.com
Export the physical DAI objects to the binary output file for kernel. For physical DAIs defined by the text conf file, find and merge their stream capablities and private data before exporting.
Signed-off-by: Guneshwor Singh guneshwor.o.singh@intel.com Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/src/topology/builder.c b/src/topology/builder.c index b0ba54e..20fa925 100644 --- a/src/topology/builder.c +++ b/src/topology/builder.c @@ -204,6 +204,9 @@ static int write_block(snd_tplg_t *tplg, struct list_head *base, 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; } @@ -293,6 +296,14 @@ int tplg_write_data(snd_tplg_t *tplg) return ret; }
+ /* write physical dai elems */ + ret = write_block(tplg, &tplg->dai_list, + SND_TPLG_TYPE_DAI); + if (ret < 0) { + SNDERR("failed to write physical dai elems %d\n", ret); + return ret; + } + /* write be elems */ ret = write_block(tplg, &tplg->be_list, SND_TPLG_TYPE_BE); diff --git a/src/topology/parser.c b/src/topology/parser.c index 4afa576..c5f9757 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -288,6 +288,10 @@ static int tplg_build_integ(snd_tplg_t *tplg) if (err < 0) return err;
+ err = tplg_build_dais(tplg, SND_TPLG_TYPE_DAI); + if (err < 0) + return err; + err = tplg_build_links(tplg, SND_TPLG_TYPE_BE); if (err < 0) return err; diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 9f60e4b..d7c04c2 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -129,6 +129,61 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type) return 0; }
+/* build a physical DAI */ +static int tplg_build_dai(snd_tplg_t *tplg, struct tplg_elem *elem) +{ + struct tplg_ref *ref; + struct list_head *base, *pos; + int err = 0; + + /* get playback & capture stream caps */ + err = tplg_build_stream_caps(tplg, elem->id, elem->dai->caps); + if (err < 0) + return err; + + /* get private data */ + base = &elem->ref_list; + list_for_each(pos, base) { + + ref = list_entry(pos, struct tplg_ref, list); + + if (ref->type == SND_TPLG_TYPE_DATA) { + err = tplg_copy_data(tplg, elem, ref); + if (err < 0) + return err; + } + } + + /* add DAI to manifest */ + tplg->manifest.dai_elems++; + + return 0; +} + +/* build physical DAIs*/ +int tplg_build_dais(snd_tplg_t *tplg, unsigned int type) +{ + struct list_head *base, *pos; + struct tplg_elem *elem; + int err = 0; + + base = &tplg->dai_list; + list_for_each(pos, base) { + + elem = list_entry(pos, struct tplg_elem, list); + if (elem->type != type) { + SNDERR("error: invalid elem '%s'\n", elem->id); + return -EINVAL; + } + + err = tplg_build_dai(tplg, elem); + if (err < 0) + return err; + } + + return 0; +} + static int tplg_build_stream_cfg(snd_tplg_t *tplg, struct snd_soc_tplg_stream *stream, int num_streams) { diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index 807462b..f913563 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -294,6 +294,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, struct tplg_elem **e);
int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type); +int tplg_build_dais(snd_tplg_t *tplg, unsigned int type); int tplg_build_links(snd_tplg_t *tplg, unsigned int type); int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
From: Mengdong Lin mengdong.lin@linux.intel.com
Add a new flag bit SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP to link flags. If a link is used for voice wake up, users can set this flag bit and topology will set the link's 'ignore_suspend' to true.
This ABI update is backward compatible and applied in kernel. We may rename this flag when we find a better name for this.
Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/include/sound/asoc.h b/include/sound/asoc.h index 1232f1e..082c542 100644 --- a/include/sound/asoc.h +++ b/include/sound/asoc.h @@ -146,6 +146,7 @@ #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) +#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
/* * Block Header.
From: Mengdong Lin mengdong.lin@linux.intel.com
Revise the obsolete content in document and comments.
Here are the major changes in implementation from early phase design: - PCM object is used to configure front end DAI & DAI links, not used by physical DAI or DAI links. - No longer use separate object for backend or codec<->codec links, but use physical links to cover them.
Signed-off-by: Mengdong Lin mengdong.lin@linux.intel.com
diff --git a/include/topology.h b/include/topology.h index c5d0080..593eaa6 100644 --- a/include/topology.h +++ b/include/topology.h @@ -40,9 +40,10 @@ extern "C" { * currently recognises the following object types :- * * * Controls (mixer, enumerated and byte) including TLV data. - * * PCMs (FE and BE configurations and capabilities) + * * PCMs (Front End DAI & DAI link) * * DAPM widgets * * DAPM graph elements. + * * Physical DAI & DAI links * * Private data for each object type. * * Manifest (containing count of each object type) * @@ -511,8 +512,8 @@ extern "C" { * refer to section Control Private Data. * * <h4>PCM Capabilities</h4> - * Topology can also define the capabilities of FE and BE PCMs. Capabilities - * can be defined with the following section :- + * Topology can also define the PCM capabilities of front end or physical DAIs. + * Capabilities can be defined with the following section :- * * <pre> * SectionPCMCapabilities."name" { @@ -525,8 +526,8 @@ extern "C" { * } * </pre> * The supported formats use the same naming convention as the driver macros. - * The PCM capabilities name can be referred to and included by BE, PCM and - * Codec <-> codec topology sections. + * The PCM capabilities name can be referred to and included by PCM and + * physical DAI sections. * * <h4>PCM Configurations</h4> * PCM runtime configurations can be defined for playback and capture stream @@ -552,31 +553,14 @@ extern "C" { * </pre> * * The supported formats use the same naming convention as the driver macros. - * The PCM configuration name can be referred to and included by BE, PCM and - * Codec <-> codec topology sections. + * The PCM configuration name can be referred to and included by PCM and + * physical link sections. * - * <h4>PCM Configurations</h4> - * PCM, BE and Codec to Codec link sections define the supported capabilities - * and configurations for supported playback and capture streams. The - * definitions and content for PCMs, BE and Codec links are the same with the - * exception of the section type :- - * - * <pre> - * SectionPCM."name" { - * .... - * } - * SectionBE."name" { - * .... - * } - * SectionCC."name" { - * .... - * } - * </pre> - * - * The section types above should be used for PCMs, Back Ends and Codec to Codec - * links respectively.<br> - * - * The data for each section is defined as follows :- + * <h4>PCM (Front-end DAI & DAI link) </h4> + * PCM sections define the supported capabilities and configurations for + * supported playback and capture streams, names and flags for front end + * DAI & DAI links. Topology kernel driver will use a PCM object to create + * a pair of FE DAI & DAI links. * * <pre> * SectionPCM."name" { @@ -1031,7 +1015,7 @@ struct snd_tplg_dai_template { };
/** \struct snd_tplg_link_template - * \brief Template type for BE and CC DAI Links. + * \brief Template type for physical DAI Links. */ struct snd_tplg_link_template { const char *name; /*!< link name, used to match */ @@ -1065,7 +1049,7 @@ typedef struct snd_tplg_obj_template { struct snd_tplg_enum_template *enum_ctl; /*!< Enum control */ struct snd_tplg_graph_template *graph; /*!< Graph elements */ struct snd_tplg_pcm_template *pcm; /*!< PCM elements */ - struct snd_tplg_link_template *link; /*!< BE and CC Links */ + struct snd_tplg_link_template *link; /*!< physical DAI Links */ struct snd_tplg_dai_template *dai; /*!< Physical DAI */ }; } snd_tplg_obj_template_t; diff --git a/src/topology/pcm.c b/src/topology/pcm.c index d7c04c2..2e0a120 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -1198,7 +1198,6 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) && t->type != SND_TPLG_TYPE_CC) return -EINVAL;
- /* here type can be either BE or CC. */ elem = tplg_elem_new_common(tplg, NULL, link_tpl->name, t->type); if (!elem) return -ENOMEM;
On Wed, 16 Nov 2016 07:36:06 +0100, mengdong.lin@linux.intel.com wrote:
From: Mengdong Lin mengdong.lin@linux.intel.com
This is the last series for topology user space atm.
This series adds support for physical DAIs and includes a few minor fixes. All ABI updates here can be supported by kernel in a backward compatible way.
Guneshwor Singh (3): topology: ABI - Define new types for physical DAI topology: Support configuring physical DAIs by C API topology: Export physical DAIs to the binary for kernel
Mengdong Lin (4): topology: ABI - Update manifest and pump ABI version to 5 topology: Parse physical DAIs in text conf file topology: ABI - Add voice wake up flag for DAI links topology: Revise document and comments for ABI v5
Applied all patches now. Thanks.
Takashi
participants (2)
-
mengdong.lin@linux.intel.com
-
Takashi Iwai