18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright(c) 2019 Intel Corporation. All rights reserved.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __IPC_CHANNEL_MAP_H__
108c2ecf20Sopenharmony_ci#define __IPC_CHANNEL_MAP_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <uapi/sound/sof/header.h>
138c2ecf20Sopenharmony_ci#include <sound/sof/header.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/**
168c2ecf20Sopenharmony_ci * \brief Channel map, specifies transformation of one-to-many or many-to-one.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * In case of one-to-many specifies how the output channels are computed out of
198c2ecf20Sopenharmony_ci * a single source channel,
208c2ecf20Sopenharmony_ci * in case of many-to-one specifies how a single target channel is computed
218c2ecf20Sopenharmony_ci * from a multichannel input stream.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * Channel index specifies position of the channel in the stream on the 'one'
248c2ecf20Sopenharmony_ci * side.
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * Ext ID is the identifier of external part of the transformation. Depending
278c2ecf20Sopenharmony_ci * on the context, it may be pipeline ID, dai ID, ...
288c2ecf20Sopenharmony_ci *
298c2ecf20Sopenharmony_ci * Channel mask describes which channels are taken into account on the "many"
308c2ecf20Sopenharmony_ci * side. Bit[i] set to 1 means that i-th channel is used for computation
318c2ecf20Sopenharmony_ci * (either as source or as a target).
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci * Channel mask is followed by array of coefficients in Q2.30 format,
348c2ecf20Sopenharmony_ci * one per each channel set in the mask (left to right, LS bit set in the
358c2ecf20Sopenharmony_ci * mask corresponds to ch_coeffs[0]).
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_cistruct sof_ipc_channel_map {
388c2ecf20Sopenharmony_ci	uint32_t ch_index;
398c2ecf20Sopenharmony_ci	uint32_t ext_id;
408c2ecf20Sopenharmony_ci	uint32_t ch_mask;
418c2ecf20Sopenharmony_ci	uint32_t reserved;
428c2ecf20Sopenharmony_ci	int32_t ch_coeffs[0];
438c2ecf20Sopenharmony_ci} __packed;
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/**
468c2ecf20Sopenharmony_ci * \brief Complete map for each channel of a multichannel stream.
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci * num_ch_map Specifies number of items in the ch_map.
498c2ecf20Sopenharmony_ci * More than one transformation per a single channel is allowed (in case
508c2ecf20Sopenharmony_ci * multiple external entities are transformed).
518c2ecf20Sopenharmony_ci * A channel may be skipped in the transformation list, then it is filled
528c2ecf20Sopenharmony_ci * with 0's by the transformation function.
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_cistruct sof_ipc_stream_map {
558c2ecf20Sopenharmony_ci	struct sof_ipc_cmd_hdr hdr;
568c2ecf20Sopenharmony_ci	uint32_t num_ch_map;
578c2ecf20Sopenharmony_ci	uint32_t reserved[3];
588c2ecf20Sopenharmony_ci	struct sof_ipc_channel_map ch_map[0];
598c2ecf20Sopenharmony_ci} __packed;
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#endif /* __IPC_CHANNEL_MAP_H__ */
62