#include "topology.h"
#include "pre-processor.h"
+int tplg_build_base_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent, bool skip_name)
+{
+ snd_config_t *top, *parent_obj, *cfg, *dest;
+ const char *parent_name;
+
+ /* find parent section config */
+ top = tplg_object_get_section(tplg_pp, parent);
+ if (!top)
+ return -EINVAL;
+
+ parent_obj = tplg_object_get_instance_config(tplg_pp, parent);
+
+ /* get parent name */
+ parent_name = tplg_object_get_name(tplg_pp, parent_obj);
+ if (!parent_name)
+ return 0;
+
+ /* find parent config with name */
+ dest = tplg_find_config(top, parent_name);
+ if (!dest) {
+ SNDERR("Cannot find parent config %s\n", parent_name);
+ return -EINVAL;
+ }
+
+ /* build config from template and add to parent */
+ return tplg_build_object_from_template(tplg_pp, obj_cfg, &cfg, dest, skip_name);
+}
+
+int tplg_build_scale_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent)
+{
+ return tplg_build_base_object(tplg_pp, obj_cfg, parent, true);
+}
+
+int tplg_build_ops_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent)
+{
+ return tplg_build_base_object(tplg_pp, obj_cfg, parent, false);
+}
+
+int tplg_build_channel_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent)
+{
+ return tplg_build_base_object(tplg_pp, obj_cfg, parent, false);
+}
+
int tplg_build_tlv_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
snd_config_t *parent)
{
return ret;
}
+const struct config_template_items scale_config = {
+ .int_config_ids = {"min", "step", "mute"},
+};
+
+const struct config_template_items ops_config = {
+ .int_config_ids = {"get", "put"},
+ .string_config_ids = {"info"},
+};
+
+const struct config_template_items channel_config = {
+ .int_config_ids = {"reg", "shift"},
+};
+
const struct config_template_items widget_config = {
.int_config_ids = {"index", "no_pm", "shift", "invert", "subseq", "event_type",
"event_flags"},
{"Base", "manifest", "SectionManifest", &tplg_build_generic_object, NULL},
{"Base", "data", "SectionData", &tplg_build_data_object, &data_config},
{"Base", "tlv", "SectionTLV", &tplg_build_tlv_object, NULL},
+ {"Base", "scale", "scale", &tplg_build_scale_object, &scale_config},
+ {"Base", "ops", "ops" ,&tplg_build_ops_object, &ops_config},
+ {"Base", "extops", "extops" ,&tplg_build_ops_object, &ops_config},
+ {"Base", "channel", "channel", &tplg_build_channel_object, &channel_config},
{"Base", "VendorToken", "SectionVendorTokens", &tplg_build_vendor_token_object, NULL},
{"Widget", "", "SectionWidget", &tplg_build_generic_object, &widget_config},
};
bool skip_name);
int tplg_build_tlv_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
snd_config_t *parent);
+int tplg_build_scale_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent);
+int tplg_build_ops_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent);
+int tplg_build_channel_object(struct tplg_pre_processor *tplg_pp, snd_config_t *obj_cfg,
+ snd_config_t *parent);
int tplg_parent_update(struct tplg_pre_processor *tplg_pp, snd_config_t *parent,
const char *section_name, const char *item_name);