linux/include/uapi/sound/asoc.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
 *
 * Copyright (C) 2012 Texas Instruments Inc.
 * Copyright (C) 2015 Intel Corporation.
 *
 * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
 * algorithms, equalisers, DAIs, widgets etc.
*/

#ifndef __LINUX_UAPI_SND_ASOC_H
#define __LINUX_UAPI_SND_ASOC_H

#include <linux/types.h>
#include <sound/asound.h>

/*
 * Maximum number of channels topology kcontrol can represent.
 */
#define SND_SOC_TPLG_MAX_CHAN

/*
 * Maximum number of PCM formats capability
 */
#define SND_SOC_TPLG_MAX_FORMATS

/*
 * Maximum number of PCM stream configs
 */
#define SND_SOC_TPLG_STREAM_CONFIG_MAX

/*
 * Maximum number of physical link's hardware configs
 */
#define SND_SOC_TPLG_HW_CONFIG_MAX

/* individual kcontrol info types - can be mixed with other types */
#define SND_SOC_TPLG_CTL_VOLSW
#define SND_SOC_TPLG_CTL_VOLSW_SX
#define SND_SOC_TPLG_CTL_VOLSW_XR_SX
#define SND_SOC_TPLG_CTL_ENUM
#define SND_SOC_TPLG_CTL_BYTES
#define SND_SOC_TPLG_CTL_ENUM_VALUE
#define SND_SOC_TPLG_CTL_RANGE
#define SND_SOC_TPLG_CTL_STROBE


/* individual widget kcontrol info types - can be mixed with other types */
#define SND_SOC_TPLG_DAPM_CTL_VOLSW
#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE
#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT
#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE
#define SND_SOC_TPLG_DAPM_CTL_PIN

/* DAPM widget types - add new items to the end */
#define SND_SOC_TPLG_DAPM_INPUT
#define SND_SOC_TPLG_DAPM_OUTPUT
#define SND_SOC_TPLG_DAPM_MUX
#define SND_SOC_TPLG_DAPM_MIXER
#define SND_SOC_TPLG_DAPM_PGA
#define SND_SOC_TPLG_DAPM_OUT_DRV
#define SND_SOC_TPLG_DAPM_ADC
#define SND_SOC_TPLG_DAPM_DAC
#define SND_SOC_TPLG_DAPM_SWITCH
#define SND_SOC_TPLG_DAPM_PRE
#define SND_SOC_TPLG_DAPM_POST
#define SND_SOC_TPLG_DAPM_AIF_IN
#define SND_SOC_TPLG_DAPM_AIF_OUT
#define SND_SOC_TPLG_DAPM_DAI_IN
#define SND_SOC_TPLG_DAPM_DAI_OUT
#define SND_SOC_TPLG_DAPM_DAI_LINK
#define SND_SOC_TPLG_DAPM_BUFFER
#define SND_SOC_TPLG_DAPM_SCHEDULER
#define SND_SOC_TPLG_DAPM_EFFECT
#define SND_SOC_TPLG_DAPM_SIGGEN
#define SND_SOC_TPLG_DAPM_SRC
#define SND_SOC_TPLG_DAPM_ASRC
#define SND_SOC_TPLG_DAPM_ENCODER
#define SND_SOC_TPLG_DAPM_DECODER
#define SND_SOC_TPLG_DAPM_LAST

/* Header magic number and string sizes */
#define SND_SOC_TPLG_MAGIC

/* string sizes */
#define SND_SOC_TPLG_NUM_TEXTS

/* ABI version */
#define SND_SOC_TPLG_ABI_VERSION
#define SND_SOC_TPLG_ABI_VERSION_MIN

/* Max size of TLV data */
#define SND_SOC_TPLG_TLV_SIZE

/*
 * File and Block header data types.
 * Add new generic and vendor types to end of list.
 * Generic types are handled by the core whilst vendors types are passed
 * to the component drivers for handling.
 */
#define SND_SOC_TPLG_TYPE_MIXER
#define SND_SOC_TPLG_TYPE_BYTES
#define SND_SOC_TPLG_TYPE_ENUM
#define SND_SOC_TPLG_TYPE_DAPM_GRAPH
#define SND_SOC_TPLG_TYPE_DAPM_WIDGET
#define SND_SOC_TPLG_TYPE_DAI_LINK
#define SND_SOC_TPLG_TYPE_PCM
#define SND_SOC_TPLG_TYPE_MANIFEST
#define SND_SOC_TPLG_TYPE_CODEC_LINK
#define SND_SOC_TPLG_TYPE_BACKEND_LINK
#define SND_SOC_TPLG_TYPE_PDATA
#define SND_SOC_TPLG_TYPE_DAI
#define SND_SOC_TPLG_TYPE_MAX

/* vendor block IDs - please add new vendor types to end */
#define SND_SOC_TPLG_TYPE_VENDOR_FW
#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG
#define SND_SOC_TPLG_TYPE_VENDOR_COEFF
#define SND_SOC_TPLG_TYPEVENDOR_CODEC

#define SND_SOC_TPLG_STREAM_PLAYBACK
#define SND_SOC_TPLG_STREAM_CAPTURE

/* vendor tuple types */
#define SND_SOC_TPLG_TUPLE_TYPE_UUID
#define SND_SOC_TPLG_TUPLE_TYPE_STRING
#define SND_SOC_TPLG_TUPLE_TYPE_BOOL
#define SND_SOC_TPLG_TUPLE_TYPE_BYTE
#define SND_SOC_TPLG_TUPLE_TYPE_WORD
#define SND_SOC_TPLG_TUPLE_TYPE_SHORT

/* DAI flags */
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS

/* DAI clock gating */
#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED
#define SND_SOC_TPLG_DAI_CLK_GATE_GATED
#define SND_SOC_TPLG_DAI_CLK_GATE_CONT

/* DAI mclk_direction */
#define SND_SOC_TPLG_MCLK_CO
#define SND_SOC_TPLG_MCLK_CI

/* DAI physical PCM data formats.
 * Add new formats to the end of the list.
 */
#define SND_SOC_DAI_FORMAT_I2S
#define SND_SOC_DAI_FORMAT_RIGHT_J
#define SND_SOC_DAI_FORMAT_LEFT_J
#define SND_SOC_DAI_FORMAT_DSP_A
#define SND_SOC_DAI_FORMAT_DSP_B
#define SND_SOC_DAI_FORMAT_AC97
#define SND_SOC_DAI_FORMAT_PDM

/* left and right justified also known as MSB and LSB respectively */
#define SND_SOC_DAI_FORMAT_MSB
#define SND_SOC_DAI_FORMAT_LSB

/* DAI link flags */
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS
#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP

/* DAI topology BCLK parameter
 * For the backwards capability, by default codec is bclk provider
 */
#define SND_SOC_TPLG_BCLK_CP
#define SND_SOC_TPLG_BCLK_CC
/* keep previous definitions for compatibility */
#define SND_SOC_TPLG_BCLK_CM
#define SND_SOC_TPLG_BCLK_CS

/* DAI topology FSYNC parameter
 * For the backwards capability, by default codec is fsync provider
 */
#define SND_SOC_TPLG_FSYNC_CP
#define SND_SOC_TPLG_FSYNC_CC
/* keep previous definitions for compatibility */
#define SND_SOC_TPLG_FSYNC_CM
#define SND_SOC_TPLG_FSYNC_CS

/*
 * Block Header.
 * This header precedes all object and object arrays below.
 */
struct snd_soc_tplg_hdr {} __attribute__((packed));

/* vendor tuple for uuid */
struct snd_soc_tplg_vendor_uuid_elem {} __attribute__((packed));

/* vendor tuple for a bool/byte/short/word value */
struct snd_soc_tplg_vendor_value_elem {} __attribute__((packed));

/* vendor tuple for string */
struct snd_soc_tplg_vendor_string_elem {} __attribute__((packed));

struct snd_soc_tplg_vendor_array {} __attribute__((packed));

/*
 * Private data.
 * All topology objects may have private data that can be used by the driver or
 * firmware. Core will ignore this data.
 */
struct snd_soc_tplg_private {} __attribute__((packed));

/*
 * Kcontrol TLV data.
 */
struct snd_soc_tplg_tlv_dbscale {} __attribute__((packed));

struct snd_soc_tplg_ctl_tlv {} __attribute__((packed));

/*
 * Kcontrol channel data
 */
struct snd_soc_tplg_channel {} __attribute__((packed));

/*
 * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
 * Kcontrol ops need get/put/info.
 * Bytes ext ops need get/put.
 */
struct snd_soc_tplg_io_ops {} __attribute__((packed));

/*
 * kcontrol header
 */
struct snd_soc_tplg_ctl_hdr {} __attribute__((packed));

/*
 * Stream Capabilities
 */
struct snd_soc_tplg_stream_caps {} __attribute__((packed));

/*
 * FE or BE Stream configuration supported by SW/FW
 */
struct snd_soc_tplg_stream {} __attribute__((packed));


/*
 * Describes a physical link's runtime supported hardware config,
 * i.e. hardware audio formats.
 */
struct snd_soc_tplg_hw_config {} __attribute__((packed));

/*
 * Manifest. List totals for each payload type. Not used in parsing, but will
 * be passed to the component driver before any other objects in order for any
 * global component resource allocations.
 *
 * File block representation for manifest :-
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_hdr           |  1 |
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_manifest      |  1 |
 * +-----------------------------------+----+
 */
struct snd_soc_tplg_manifest {} __attribute__((packed));

/*
 * Mixer kcontrol.
 *
 * File block representation for mixer kcontrol :-
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_hdr           |  1 |
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_mixer_control |  N |
 * +-----------------------------------+----+
 */
struct snd_soc_tplg_mixer_control {} __attribute__((packed));

/*
 * Enumerated kcontrol
 *
 * File block representation for enum kcontrol :-
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_hdr           |  1 |
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_enum_control  |  N |
 * +-----------------------------------+----+
 */
struct snd_soc_tplg_enum_control {} __attribute__((packed));

/*
 * Bytes kcontrol
 *
 * File block representation for bytes kcontrol :-
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_hdr           |  1 |
 * +-----------------------------------+----+
 * | struct snd_soc_tplg_bytes_control |  N |
 * +-----------------------------------+----+
 */
struct snd_soc_tplg_bytes_control {} __attribute__((packed));

/*
 * DAPM Graph Element
 *
 * File block representation for DAPM graph elements :-
 * +-------------------------------------+----+
 * | struct snd_soc_tplg_hdr             |  1 |
 * +-------------------------------------+----+
 * | struct snd_soc_tplg_dapm_graph_elem |  N |
 * +-------------------------------------+----+
 */
struct snd_soc_tplg_dapm_graph_elem {} __attribute__((packed));

/*
 * DAPM Widget.
 *
 * File block representation for DAPM widget :-
 * +-------------------------------------+-----+
 * | struct snd_soc_tplg_hdr             |  1  |
 * +-------------------------------------+-----+
 * | struct snd_soc_tplg_dapm_widget     |  N  |
 * +-------------------------------------+-----+
 * |   struct snd_soc_tplg_enum_control  | 0|1 |
 * |   struct snd_soc_tplg_mixer_control | 0|N |
 * +-------------------------------------+-----+
 *
 * Optional enum or mixer control can be appended to the end of each widget
 * in the block.
 */
struct snd_soc_tplg_dapm_widget {} __attribute__((packed));


/*
 * Describes SW/FW specific features of PCM (FE DAI & DAI link).
 *
 * File block representation for PCM :-
 * +-----------------------------------+-----+
 * | struct snd_soc_tplg_hdr           |  1  |
 * +-----------------------------------+-----+
 * | struct snd_soc_tplg_pcm           |  N  |
 * +-----------------------------------+-----+
 */
struct snd_soc_tplg_pcm {} __attribute__((packed));


/*
 * Describes the physical link runtime supported configs or params
 *
 * File block representation for physical link config :-
 * +-----------------------------------+-----+
 * | struct snd_soc_tplg_hdr           |  1  |
 * +-----------------------------------+-----+
 * | struct snd_soc_tplg_link_config   |  N  |
 * +-----------------------------------+-----+
 */
struct snd_soc_tplg_link_config {} __attribute__((packed));

/*
 * Describes SW/FW specific features of physical DAI.
 * It can be used to configure backend DAIs for DPCM.
 *
 * File block representation for physical DAI :-
 * +-----------------------------------+-----+
 * | struct snd_soc_tplg_hdr           |  1  |
 * +-----------------------------------+-----+
 * | struct snd_soc_tplg_dai           |  N  |
 * +-----------------------------------+-----+
 */
struct snd_soc_tplg_dai {} __attribute__((packed));

#endif