diff --git a/topology/pre-process-dapm.c b/topology/pre-process-dapm.c index 9355a86..78944a6 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. ex: pga.0.1, buffer.1.1 etc diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c index 61cc85f..34b9203 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 878653d..3a8a4bc 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,