]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: ipc4: Add definition for generic bytes control
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 17 Dec 2025 14:39:44 +0000 (16:39 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 17 Dec 2025 16:35:50 +0000 (16:35 +0000)
Currently IPC4 only supports module specific custom bytes controls, where
each control's param_id is module specific.
These bytes controls cannot be handled in a generic way, there is no clean
way to support for example notifications from firmware when their data
has been changed.

Add definition for generic bytes control which should be handled in a
similar way as the enum/switch controls.

The generic param id for BYTES is selected to be 202

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20251217143945.2667-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc4-topology.h
sound/soc/sof/ipc4.c

index 191b51d9799399903b791529cb49a9c445dc632c..9a028a59c5536a149b9884c8a38c5a52b89a192b 100644 (file)
@@ -368,19 +368,24 @@ struct sof_ipc4_control_data {
 
 #define SOF_IPC4_SWITCH_CONTROL_PARAM_ID       200
 #define SOF_IPC4_ENUM_CONTROL_PARAM_ID         201
+#define SOF_IPC4_BYTES_CONTROL_PARAM_ID                202
 
 /**
  * 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
+ * @num_elems: Number of elements in the chanv array or number of bytes in data
  * @reserved: reserved for future use, must be set to 0
  * @chanv: channel ID and value array
+ * @data: binary payload
  */
 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);
+       union {
+               DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
+               DECLARE_FLEX_ARRAY(uint8_t, data);
+       };
 } __packed;
 
 /**
index 20d723f48fff0ca17b3842578ef7b9efa7532ca4..2be8d8ce487ab871b4540375a57a2da5403b87ac 100644 (file)
@@ -445,6 +445,7 @@ static bool sof_ipc4_tx_payload_for_get_data(struct sof_ipc4_msg *tx)
        switch (tx->extension & SOF_IPC4_MOD_EXT_MSG_PARAM_ID_MASK) {
        case SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_SWITCH_CONTROL_PARAM_ID):
        case SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_ENUM_CONTROL_PARAM_ID):
+       case SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_BYTES_CONTROL_PARAM_ID):
                return true;
        default:
                return false;