xref: /openbmc/linux/include/sound/sof/channel_map.h (revision 195c5ad9)
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /*
3  * This file is provided under a dual BSD/GPLv2 license.  When using or
4  * redistributing this file, you may do so under either license.
5  *
6  * Copyright(c) 2019 Intel Corporation. All rights reserved.
7  */
8 
9 #ifndef __IPC_CHANNEL_MAP_H__
10 #define __IPC_CHANNEL_MAP_H__
11 
12 #include <uapi/sound/sof/header.h>
13 #include <sound/sof/header.h>
14 
15 /**
16  * \brief Channel map, specifies transformation of one-to-many or many-to-one.
17  *
18  * In case of one-to-many specifies how the output channels are computed out of
19  * a single source channel,
20  * in case of many-to-one specifies how a single target channel is computed
21  * from a multichannel input stream.
22  *
23  * Channel index specifies position of the channel in the stream on the 'one'
24  * side.
25  *
26  * Ext ID is the identifier of external part of the transformation. Depending
27  * on the context, it may be pipeline ID, dai ID, ...
28  *
29  * Channel mask describes which channels are taken into account on the "many"
30  * side. Bit[i] set to 1 means that i-th channel is used for computation
31  * (either as source or as a target).
32  *
33  * Channel mask is followed by array of coefficients in Q2.30 format,
34  * one per each channel set in the mask (left to right, LS bit set in the
35  * mask corresponds to ch_coeffs[0]).
36  */
37 struct sof_ipc_channel_map {
38 	uint32_t ch_index;
39 	uint32_t ext_id;
40 	uint32_t ch_mask;
41 	uint32_t reserved;
42 	int32_t ch_coeffs[];
43 } __packed;
44 
45 /**
46  * \brief Complete map for each channel of a multichannel stream.
47  *
48  * num_ch_map Specifies number of items in the ch_map.
49  * More than one transformation per a single channel is allowed (in case
50  * multiple external entities are transformed).
51  * A channel may be skipped in the transformation list, then it is filled
52  * with 0's by the transformation function.
53  */
54 struct sof_ipc_stream_map {
55 	struct sof_ipc_cmd_hdr hdr;
56 	uint32_t num_ch_map;
57 	uint32_t reserved[3];
58 	struct sof_ipc_channel_map ch_map[];
59 } __packed;
60 
61 #endif /* __IPC_CHANNEL_MAP_H__ */
62