Skip to content

Commit fe2a914

Browse files
ujfalusibardliao
authored andcommitted
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 329762f commit fe2a914

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
@@ -368,19 +368,24 @@ struct sof_ipc4_control_data {
368368

369369
#define SOF_IPC4_SWITCH_CONTROL_PARAM_ID 200
370370
#define SOF_IPC4_ENUM_CONTROL_PARAM_ID 201
371+
#define SOF_IPC4_BYTES_CONTROL_PARAM_ID 202
371372

372373
/**
373374
* struct sof_ipc4_control_msg_payload - IPC payload for kcontrol parameters
374375
* @id: unique id of the control
375-
* @num_elems: Number of elements in the chanv array
376+
* @num_elems: Number of elements in the chanv array or number of bytes in data
376377
* @reserved: reserved for future use, must be set to 0
377378
* @chanv: channel ID and value array
379+
* @data: binary payload
378380
*/
379381
struct sof_ipc4_control_msg_payload {
380382
uint16_t id;
381383
uint16_t num_elems;
382384
uint32_t reserved[4];
383-
DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
385+
union {
386+
DECLARE_FLEX_ARRAY(struct sof_ipc4_ctrl_value_chan, chanv);
387+
DECLARE_FLEX_ARRAY(uint8_t, data);
388+
};
384389
} __packed;
385390

386391
/**

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)