Commit f9e47127 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Wen Zhiwei
Browse files

ASoC: SOF: ipc4-topology: Add definition for generic switch/enum control

stable inclusion
from stable-v6.6.60
commit f01d8fc623711046e1efee00827bff6d5882cdfd
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB44K1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f01d8fc623711046e1efee00827bff6d5882cdfd



--------------------------------

commit 060a07cd9bc69eba2da33ed96b1fa69ead60bab1 upstream.

Currently IPC4 has no notion of a switch or enum type of control which is
a generic concept in ALSA.

The generic support for these control types will be as follows:
- large config is used to send the channel-value par array
- param_id of a SWITCH type is 200
- param_id of an ENUM type is 201

Each module need to support a switch or/and enum must handle these
universal param_ids.
The message payload is described by struct sof_ipc4_control_msg_payload.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230919103115.30783-2-peter.ujfalusi@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 0033d731
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ struct sof_ipc4_copier {
/**
 * struct sof_ipc4_ctrl_value_chan: generic channel mapped value data
 * @channel: Channel ID
 * @value: gain value
 * @value: Value associated with @channel
 */
struct sof_ipc4_ctrl_value_chan {
	u32 channel;
@@ -343,6 +343,23 @@ struct sof_ipc4_control_data {
	};
};

#define SOF_IPC4_SWITCH_CONTROL_PARAM_ID	200
#define SOF_IPC4_ENUM_CONTROL_PARAM_ID		201

/**
 * struct sof_ipc4_control_msg_payload - IPC payload for kcontrol parameters
 * @id: unique id of the control
 * @num_elems: Number of elements in the chanv array
 * @reserved: reserved for future use, must be set to 0
 * @chanv: channel ID and value array
 */
struct sof_ipc4_control_msg_payload {
	uint16_t id;
	uint16_t num_elems;
	uint32_t reserved[4];
	DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
} __packed;

/**
 * struct sof_ipc4_gain_params - IPC gain parameters
 * @channels: Channels