162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
462306a36Sopenharmony_ci * redistributing this file, you may do so under either license.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright(c) 2019 Intel Corporation. All rights reserved.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __IPC_CHANNEL_MAP_H__
1062306a36Sopenharmony_ci#define __IPC_CHANNEL_MAP_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <uapi/sound/sof/header.h>
1362306a36Sopenharmony_ci#include <sound/sof/header.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/**
1662306a36Sopenharmony_ci * \brief Channel map, specifies transformation of one-to-many or many-to-one.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * In case of one-to-many specifies how the output channels are computed out of
1962306a36Sopenharmony_ci * a single source channel,
2062306a36Sopenharmony_ci * in case of many-to-one specifies how a single target channel is computed
2162306a36Sopenharmony_ci * from a multichannel input stream.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * Channel index specifies position of the channel in the stream on the 'one'
2462306a36Sopenharmony_ci * side.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci * Ext ID is the identifier of external part of the transformation. Depending
2762306a36Sopenharmony_ci * on the context, it may be pipeline ID, dai ID, ...
2862306a36Sopenharmony_ci *
2962306a36Sopenharmony_ci * Channel mask describes which channels are taken into account on the "many"
3062306a36Sopenharmony_ci * side. Bit[i] set to 1 means that i-th channel is used for computation
3162306a36Sopenharmony_ci * (either as source or as a target).
3262306a36Sopenharmony_ci *
3362306a36Sopenharmony_ci * Channel mask is followed by array of coefficients in Q2.30 format,
3462306a36Sopenharmony_ci * one per each channel set in the mask (left to right, LS bit set in the
3562306a36Sopenharmony_ci * mask corresponds to ch_coeffs[0]).
3662306a36Sopenharmony_ci */
3762306a36Sopenharmony_cistruct sof_ipc_channel_map {
3862306a36Sopenharmony_ci	uint32_t ch_index;
3962306a36Sopenharmony_ci	uint32_t ext_id;
4062306a36Sopenharmony_ci	uint32_t ch_mask;
4162306a36Sopenharmony_ci	uint32_t reserved;
4262306a36Sopenharmony_ci	int32_t ch_coeffs[];
4362306a36Sopenharmony_ci} __packed;
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/**
4662306a36Sopenharmony_ci * \brief Complete map for each channel of a multichannel stream.
4762306a36Sopenharmony_ci *
4862306a36Sopenharmony_ci * num_ch_map Specifies number of items in the ch_map.
4962306a36Sopenharmony_ci * More than one transformation per a single channel is allowed (in case
5062306a36Sopenharmony_ci * multiple external entities are transformed).
5162306a36Sopenharmony_ci * A channel may be skipped in the transformation list, then it is filled
5262306a36Sopenharmony_ci * with 0's by the transformation function.
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_cistruct sof_ipc_stream_map {
5562306a36Sopenharmony_ci	struct sof_ipc_cmd_hdr hdr;
5662306a36Sopenharmony_ci	uint32_t num_ch_map;
5762306a36Sopenharmony_ci	uint32_t reserved[3];
5862306a36Sopenharmony_ci	struct sof_ipc_channel_map ch_map[];
5962306a36Sopenharmony_ci} __packed;
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#endif /* __IPC_CHANNEL_MAP_H__ */
62