Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /*
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * Copyright(c) 2018 Intel Corporation. All rights reserved.
0007  */
0008 
0009 #ifndef __INCLUDE_SOUND_SOF_CONTROL_H__
0010 #define __INCLUDE_SOUND_SOF_CONTROL_H__
0011 
0012 #include <uapi/sound/sof/header.h>
0013 #include <sound/sof/header.h>
0014 
0015 /*
0016  * Component Mixers and Controls
0017  */
0018 
0019 /* channel positions - uses same values as ALSA */
0020 enum sof_ipc_chmap {
0021     SOF_CHMAP_UNKNOWN = 0,
0022     SOF_CHMAP_NA,       /**< N/A, silent */
0023     SOF_CHMAP_MONO,     /**< mono stream */
0024     SOF_CHMAP_FL,       /**< front left */
0025     SOF_CHMAP_FR,       /**< front right */
0026     SOF_CHMAP_RL,       /**< rear left */
0027     SOF_CHMAP_RR,       /**< rear right */
0028     SOF_CHMAP_FC,       /**< front centre */
0029     SOF_CHMAP_LFE,      /**< LFE */
0030     SOF_CHMAP_SL,       /**< side left */
0031     SOF_CHMAP_SR,       /**< side right */
0032     SOF_CHMAP_RC,       /**< rear centre */
0033     SOF_CHMAP_FLC,      /**< front left centre */
0034     SOF_CHMAP_FRC,      /**< front right centre */
0035     SOF_CHMAP_RLC,      /**< rear left centre */
0036     SOF_CHMAP_RRC,      /**< rear right centre */
0037     SOF_CHMAP_FLW,      /**< front left wide */
0038     SOF_CHMAP_FRW,      /**< front right wide */
0039     SOF_CHMAP_FLH,      /**< front left high */
0040     SOF_CHMAP_FCH,      /**< front centre high */
0041     SOF_CHMAP_FRH,      /**< front right high */
0042     SOF_CHMAP_TC,       /**< top centre */
0043     SOF_CHMAP_TFL,      /**< top front left */
0044     SOF_CHMAP_TFR,      /**< top front right */
0045     SOF_CHMAP_TFC,      /**< top front centre */
0046     SOF_CHMAP_TRL,      /**< top rear left */
0047     SOF_CHMAP_TRR,      /**< top rear right */
0048     SOF_CHMAP_TRC,      /**< top rear centre */
0049     SOF_CHMAP_TFLC,     /**< top front left centre */
0050     SOF_CHMAP_TFRC,     /**< top front right centre */
0051     SOF_CHMAP_TSL,      /**< top side left */
0052     SOF_CHMAP_TSR,      /**< top side right */
0053     SOF_CHMAP_LLFE,     /**< left LFE */
0054     SOF_CHMAP_RLFE,     /**< right LFE */
0055     SOF_CHMAP_BC,       /**< bottom centre */
0056     SOF_CHMAP_BLC,      /**< bottom left centre */
0057     SOF_CHMAP_BRC,      /**< bottom right centre */
0058     SOF_CHMAP_LAST = SOF_CHMAP_BRC,
0059 };
0060 
0061 /* control data type and direction */
0062 enum sof_ipc_ctrl_type {
0063     /*  per channel data - uses struct sof_ipc_ctrl_value_chan */
0064     SOF_CTRL_TYPE_VALUE_CHAN_GET = 0,
0065     SOF_CTRL_TYPE_VALUE_CHAN_SET,
0066     /* component data - uses struct sof_ipc_ctrl_value_comp */
0067     SOF_CTRL_TYPE_VALUE_COMP_GET,
0068     SOF_CTRL_TYPE_VALUE_COMP_SET,
0069     /* bespoke data - uses struct sof_abi_hdr */
0070     SOF_CTRL_TYPE_DATA_GET,
0071     SOF_CTRL_TYPE_DATA_SET,
0072 };
0073 
0074 /* control command type */
0075 enum sof_ipc_ctrl_cmd {
0076     SOF_CTRL_CMD_VOLUME = 0, /**< maps to ALSA volume style controls */
0077     SOF_CTRL_CMD_ENUM,  /**< maps to ALSA enum style controls */
0078     SOF_CTRL_CMD_SWITCH,    /**< maps to ALSA switch style controls */
0079     SOF_CTRL_CMD_BINARY,    /**< maps to ALSA binary style controls */
0080 };
0081 
0082 /* generic channel mapped value data */
0083 struct sof_ipc_ctrl_value_chan {
0084     uint32_t channel;   /**< channel map - enum sof_ipc_chmap */
0085     uint32_t value;
0086 } __packed;
0087 
0088 /* generic component mapped value data */
0089 struct sof_ipc_ctrl_value_comp {
0090     uint32_t index; /**< component source/sink/control index in control */
0091     union {
0092         uint32_t uvalue;
0093         int32_t svalue;
0094     };
0095 } __packed;
0096 
0097 /* generic control data */
0098 struct sof_ipc_ctrl_data {
0099     struct sof_ipc_reply rhdr;
0100     uint32_t comp_id;
0101 
0102     /* control access and data type */
0103     uint32_t type;      /**< enum sof_ipc_ctrl_type */
0104     uint32_t cmd;       /**< enum sof_ipc_ctrl_cmd */
0105     uint32_t index;     /**< control index for comps > 1 control */
0106 
0107     /* control data - can either be appended or DMAed from host */
0108     struct sof_ipc_host_buffer buffer;
0109     uint32_t num_elems; /**< in array elems or bytes for data type */
0110     uint32_t elems_remaining;   /**< elems remaining if sent in parts */
0111 
0112     uint32_t msg_index; /**< for large messages sent in parts */
0113 
0114     /* reserved for future use */
0115     uint32_t reserved[6];
0116 
0117     /* control data - add new types if needed */
0118     union {
0119         /* channel values can be used by volume type controls */
0120         struct sof_ipc_ctrl_value_chan chanv[0];
0121         /* component values used by routing controls like mux, mixer */
0122         struct sof_ipc_ctrl_value_comp compv[0];
0123         /* data can be used by binary controls */
0124         struct sof_abi_hdr data[0];
0125     };
0126 } __packed;
0127 
0128 /** Event type */
0129 enum sof_ipc_ctrl_event_type {
0130     SOF_CTRL_EVENT_GENERIC = 0, /**< generic event */
0131     SOF_CTRL_EVENT_GENERIC_METADATA,    /**< generic event with metadata */
0132     SOF_CTRL_EVENT_KD,  /**< keyword detection event */
0133     SOF_CTRL_EVENT_VAD, /**< voice activity detection event */
0134 };
0135 
0136 /**
0137  * Generic notification data.
0138  */
0139 struct sof_ipc_comp_event {
0140     struct sof_ipc_reply rhdr;
0141     uint16_t src_comp_type; /**< COMP_TYPE_ */
0142     uint32_t src_comp_id;   /**< source component id */
0143     uint32_t event_type;    /**< event type - SOF_CTRL_EVENT_* */
0144     uint32_t num_elems; /**< in array elems or bytes for data type */
0145 
0146     /* reserved for future use */
0147     uint32_t reserved[8];
0148 
0149     /* control data - add new types if needed */
0150     union {
0151         /* data can be used by binary controls */
0152         struct sof_abi_hdr data[0];
0153         /* event specific values */
0154         uint32_t event_value;
0155     };
0156 } __packed;
0157 
0158 #endif