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