mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 08:26:31 +01:00
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>
This commit is contained in:
parent
0925ad7f09
commit
68dd54784a
3 changed files with 43 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue