alsa-utils/topology/pre-process-dai.c
Ranjani Sridharan 3719c80a4d topology: pre-process-dai: add support for fe_dai objects
Add support for fe_dai objects:

For ex:

Object.PCM.pcm."0" {
	name	"Port0"
	direction	"duplex"
	Object.Base.fe_dai."Port 0" {}
}

will be converted to update the SectionPCM as follows:

SectionPCM {
        Port0 {
                id 0
                dai {
                        'Port 0' {
				id 0
			}
                }
}

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00

54 lines
1.6 KiB
C

/*
Copyright(c) 2021 Intel Corporation
All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution
in the file called LICENSE.GPL.
*/
#include <errno.h>
#include <stdio.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/conf.h>
#include <alsa/error.h>
#include "topology.h"
#include "pre-processor.h"
int tplg_build_hw_cfg_object(struct tplg_pre_processor *tplg_pp,
snd_config_t *obj_cfg, snd_config_t *parent)
{
snd_config_t *hw_cfg, *obj;
const char *name;
int ret;
obj = tplg_object_get_instance_config(tplg_pp, obj_cfg);
name = tplg_object_get_name(tplg_pp, obj);
if (!name)
return -EINVAL;
ret = tplg_build_object_from_template(tplg_pp, obj_cfg, &hw_cfg, NULL, false);
if (ret < 0)
return ret;
return tplg_parent_update(tplg_pp, parent, "hw_configs", name);
}
int tplg_build_fe_dai_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);
}