Skip to content

Commit 0ddf3f0

Browse files
committed
ASoC: SOF: ipc4: Add definition for generic bytes control
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>
1 parent b055a0c commit 0ddf3f0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

sound/soc/sof/ipc4-topology.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,24 @@ struct sof_ipc4_control_data {
365365

366366
#define SOF_IPC4_SWITCH_CONTROL_PARAM_ID 200
367367
#define SOF_IPC4_ENUM_CONTROL_PARAM_ID 201
368+
#define SOF_IPC4_BYTES_CONTROL_PARAM_ID 202
368369

369370
/**
370371
* struct sof_ipc4_control_msg_payload - IPC payload for kcontrol parameters
371372
* @id: unique id of the control
372-
* @num_elems: Number of elements in the chanv array
373+
* @num_elems: Number of elements in the chanv array or number of bytes in data
373374
* @reserved: reserved for future use, must be set to 0
374375
* @chanv: channel ID and value array
376+
* @data: binary payload
375377
*/
376378
struct sof_ipc4_control_msg_payload {
377379
uint16_t id;
378380
uint16_t num_elems;
379381
uint32_t reserved[4];
380-
DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
382+
union {
383+
DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
384+
DECLARE_FLEX_ARRAY(uint8_t, data);
385+
};
381386
} __packed;
382387

383388
/**

sound/soc/sof/ipc4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ static bool sof_ipc4_tx_payload_for_get_data(struct sof_ipc4_msg *tx)
446446
switch (tx->extension & SOF_IPC4_MOD_EXT_MSG_PARAM_ID_MASK) {
447447
case SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_SWITCH_CONTROL_PARAM_ID):
448448
case SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_ENUM_CONTROL_PARAM_ID):
449+
case SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_BYTES_CONTROL_PARAM_ID):
449450
return true;
450451
default:
451452
return false;

0 commit comments

Comments
 (0)