linux/sound/soc/intel/avs/topology.c

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2021 Intel Corporation
//
// Authors: Cezary Rojewski <[email protected]>
//          Amadeusz Slawinski <[email protected]>
//

#include <linux/firmware.h>
#include <linux/uuid.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/soc-topology.h>
#include <uapi/sound/intel/avs/tokens.h>
#include "avs.h"
#include "control.h"
#include "topology.h"
#include "utils.h"

/* Get pointer to vendor array at the specified offset. */
#define avs_tplg_vendor_array_at(array, offset)

/* Get pointer to vendor array that is next in line. */
#define avs_tplg_vendor_array_next(array)

/*
 * Scan provided block of tuples for the specified token. If found,
 * @offset is updated with position at which first matching token is
 * located.
 *
 * Returns 0 on success, -ENOENT if not found and error code otherwise.
 */
static int
avs_tplg_vendor_array_lookup(struct snd_soc_tplg_vendor_array *tuples,
			     u32 block_size, u32 token, u32 *offset)
{}

/*
 * See avs_tplg_vendor_array_lookup() for description.
 *
 * Behaves exactly like avs_tplg_vendor_lookup() but starts from the
 * next vendor array in line. Useful when searching for the finish line
 * of an arbitrary entry in a list of entries where each is composed of
 * several vendor tuples and a specific token marks the beginning of
 * a new entry block.
 */
static int
avs_tplg_vendor_array_lookup_next(struct snd_soc_tplg_vendor_array *tuples,
				  u32 block_size, u32 token, u32 *offset)
{}

/*
 * Scan provided block of tuples for the specified token which marks
 * the border of an entry block. Behavior is similar to
 * avs_tplg_vendor_array_lookup() except 0 is also returned if no
 * matching token has been found. In such case, returned @size is
 * assigned to @block_size as the entire block belongs to the current
 * entry.
 *
 * Returns 0 on success, error code otherwise.
 */
static int
avs_tplg_vendor_entry_size(struct snd_soc_tplg_vendor_array *tuples,
			   u32 block_size, u32 entry_id_token, u32 *size)
{}

/*
 * Vendor tuple parsing descriptor.
 *
 * @token: vendor specific token that identifies tuple
 * @type: tuple type, one of SND_SOC_TPLG_TUPLE_TYPE_XXX
 * @offset: offset of a struct's field to initialize
 * @parse: parsing function, extracts and assigns value to object's field
 */
struct avs_tplg_token_parser {};

static int
avs_parse_uuid_token(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int
avs_parse_bool_token(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int
avs_parse_byte_token(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int
avs_parse_short_token(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int
avs_parse_word_token(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int
avs_parse_string_token(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int avs_parse_uuid_tokens(struct snd_soc_component *comp, void *object,
				 const struct avs_tplg_token_parser *parsers, int count,
				 struct snd_soc_tplg_vendor_array *tuples)
{}

static int avs_parse_string_tokens(struct snd_soc_component *comp, void *object,
				   const struct avs_tplg_token_parser *parsers, int count,
				   struct snd_soc_tplg_vendor_array *tuples)
{}

static int avs_parse_word_tokens(struct snd_soc_component *comp, void *object,
				 const struct avs_tplg_token_parser *parsers, int count,
				 struct snd_soc_tplg_vendor_array *tuples)
{}

static int avs_parse_tokens(struct snd_soc_component *comp, void *object,
			    const struct avs_tplg_token_parser *parsers, size_t count,
			    struct snd_soc_tplg_vendor_array *tuples, int priv_size)
{}

#define AVS_DEFINE_PTR_PARSER(name, type, member)

AVS_DEFINE_PTR_PARSER(audio_format, struct avs_audio_format, fmts);
AVS_DEFINE_PTR_PARSER(modcfg_base, struct avs_tplg_modcfg_base, modcfgs_base);
AVS_DEFINE_PTR_PARSER(modcfg_ext, struct avs_tplg_modcfg_ext, modcfgs_ext);
AVS_DEFINE_PTR_PARSER(pplcfg, struct avs_tplg_pplcfg, pplcfgs);
AVS_DEFINE_PTR_PARSER(binding, struct avs_tplg_binding, bindings);

static int
parse_audio_format_bitfield(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
{}

static int avs_ssp_sprint(char *buf, size_t size, const char *fmt, int port, int tdm)
{}

static int parse_link_formatted_string(struct snd_soc_component *comp, void *elem,
				       void *object, u32 offset)
{}

static int
parse_dictionary_header(struct snd_soc_component *comp,
			struct snd_soc_tplg_vendor_array *tuples,
			void **dict, u32 *num_entries, size_t entry_size,
			u32 num_entries_token)
{}

static int
parse_dictionary_entries(struct snd_soc_component *comp,
			 struct snd_soc_tplg_vendor_array *tuples, u32 block_size,
			 void *dict, u32 num_entries, size_t entry_size,
			 u32 entry_id_token,
			 const struct avs_tplg_token_parser *parsers, size_t num_parsers)
{}

static int parse_dictionary(struct snd_soc_component *comp,
			    struct snd_soc_tplg_vendor_array *tuples, u32 block_size,
			    void **dict, u32 *num_entries, size_t entry_size,
			    u32 num_entries_token, u32 entry_id_token,
			    const struct avs_tplg_token_parser *parsers, size_t num_parsers)
{}

static const struct avs_tplg_token_parser library_parsers[] =;

static int avs_tplg_parse_libraries(struct snd_soc_component *comp,
				    struct snd_soc_tplg_vendor_array *tuples, u32 block_size)
{}

static const struct avs_tplg_token_parser audio_format_parsers[] =;

static int avs_tplg_parse_audio_formats(struct snd_soc_component *comp,
					struct snd_soc_tplg_vendor_array *tuples,
					u32 block_size)
{}

static const struct avs_tplg_token_parser modcfg_base_parsers[] =;

static int avs_tplg_parse_modcfgs_base(struct snd_soc_component *comp,
				       struct snd_soc_tplg_vendor_array *tuples,
				       u32 block_size)
{}

static const struct avs_tplg_token_parser modcfg_ext_parsers[] =;

static const struct avs_tplg_token_parser pin_format_parsers[] =;

static void
assign_copier_gtw_instance(struct snd_soc_component *comp, struct avs_tplg_modcfg_ext *cfg)
{}

static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp,
				     struct avs_tplg_modcfg_ext *cfg,
				     struct snd_soc_tplg_vendor_array *tuples,
				     u32 block_size)
{}

static int avs_tplg_parse_modcfgs_ext(struct snd_soc_component *comp,
				      struct snd_soc_tplg_vendor_array *tuples,
				      u32 block_size)
{}

static const struct avs_tplg_token_parser pplcfg_parsers[] =;

static int avs_tplg_parse_pplcfgs(struct snd_soc_component *comp,
				  struct snd_soc_tplg_vendor_array *tuples,
				  u32 block_size)
{}

static const struct avs_tplg_token_parser binding_parsers[] =;

static int avs_tplg_parse_bindings(struct snd_soc_component *comp,
				   struct snd_soc_tplg_vendor_array *tuples,
				   u32 block_size)
{}

static const struct avs_tplg_token_parser module_parsers[] =;

static const struct avs_tplg_token_parser init_config_parsers[] =;

static struct avs_tplg_module *
avs_tplg_module_create(struct snd_soc_component *comp, struct avs_tplg_pipeline *owner,
		       struct snd_soc_tplg_vendor_array *tuples, u32 block_size)
{}

static const struct avs_tplg_token_parser pipeline_parsers[] =;

static const struct avs_tplg_token_parser bindings_parsers[] =;

static struct avs_tplg_pipeline *
avs_tplg_pipeline_create(struct snd_soc_component *comp, struct avs_tplg_path *owner,
			 struct snd_soc_tplg_vendor_array *tuples, u32 block_size)
{}

static const struct avs_tplg_token_parser path_parsers[] =;

static struct avs_tplg_path *
avs_tplg_path_create(struct snd_soc_component *comp, struct avs_tplg_path_template *owner,
		     struct snd_soc_tplg_vendor_array *tuples, u32 block_size,
		     const struct avs_tplg_token_parser *parsers, u32 num_parsers)
{}

static const struct avs_tplg_token_parser path_tmpl_parsers[] =;

static int parse_path_template(struct snd_soc_component *comp,
			       struct snd_soc_tplg_vendor_array *tuples, u32 block_size,
			       struct avs_tplg_path_template *template,
			       const struct avs_tplg_token_parser *tmpl_tokens, u32 num_tmpl_tokens,
			       const struct avs_tplg_token_parser *path_tokens, u32 num_path_tokens)
{}

static struct avs_tplg_path_template *
avs_tplg_path_template_create(struct snd_soc_component *comp, struct avs_tplg *owner,
			      struct snd_soc_tplg_vendor_array *tuples, u32 block_size)
{}

static const struct avs_tplg_token_parser mod_init_config_parsers[] =;

static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
					   struct snd_soc_tplg_vendor_array *tuples,
					   u32 block_size)
{}

static int avs_route_load(struct snd_soc_component *comp, int index,
			  struct snd_soc_dapm_route *route)
{}

static int avs_widget_load(struct snd_soc_component *comp, int index,
			   struct snd_soc_dapm_widget *w,
			   struct snd_soc_tplg_dapm_widget *dw)
{}

static int avs_widget_ready(struct snd_soc_component *comp, int index,
			    struct snd_soc_dapm_widget *w,
			    struct snd_soc_tplg_dapm_widget *dw)
{}

static int avs_dai_load(struct snd_soc_component *comp, int index,
			struct snd_soc_dai_driver *dai_drv, struct snd_soc_tplg_pcm *pcm,
			struct snd_soc_dai *dai)
{}

static int avs_link_load(struct snd_soc_component *comp, int index, struct snd_soc_dai_link *link,
			 struct snd_soc_tplg_link_config *cfg)
{}

static const struct avs_tplg_token_parser manifest_parsers[] =;

static int avs_manifest(struct snd_soc_component *comp, int index,
			struct snd_soc_tplg_manifest *manifest)
{}

#define AVS_CONTROL_OPS_VOLUME

static const struct snd_soc_tplg_kcontrol_ops avs_control_ops[] =;

static const struct avs_tplg_token_parser control_parsers[] =;

static int
avs_control_load(struct snd_soc_component *comp, int index, struct snd_kcontrol_new *ctmpl,
		 struct snd_soc_tplg_ctl_hdr *hdr)
{}

static const struct snd_soc_tplg_ops avs_tplg_ops =;

struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp)
{}

int avs_load_topology(struct snd_soc_component *comp, const char *filename)
{}

int avs_remove_topology(struct snd_soc_component *comp)
{}