Skip to content

Commit aa5dc47

Browse files
committed
ASoC: SOF: ipc4/ipc4-loader: Add SOF_INFO and CODEC_INFO to fw_config_params
SOF_INFO (id == 35) tuple holds tuple structured information about SOF features. The first entry in SOF_INFO is the SOF_CODEC_INFO (id == 0) which contains information about the supported codecs for decode/encode in the booted firmware. If present in the fw_config payload, make a copy of it and store it sof_ipc4_fw_data->codec_info to be used by the compressed code. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 6852efd commit aa5dc47

3 files changed

Lines changed: 52 additions & 6 deletions

File tree

include/sound/sof/ipc4/header.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,10 @@ enum sof_ipc4_fw_config_params {
433433
SOF_IPC4_FW_CFG_RESERVED,
434434
SOF_IPC4_FW_CFG_POWER_GATING_POLICY,
435435
SOF_IPC4_FW_CFG_ASSERT_MODE,
436-
SOF_IPC4_FW_RESERVED1,
437-
SOF_IPC4_FW_RESERVED2,
438-
SOF_IPC4_FW_RESERVED3,
439-
SOF_IPC4_FW_RESERVED4,
440-
SOF_IPC4_FW_RESERVED5,
441-
SOF_IPC4_FW_CONTEXT_SAVE
436+
/* Reserved: 24 - 28 */
437+
SOF_IPC4_FW_CONTEXT_SAVE = 29,
438+
/* Reserved: 30 - 34 */
439+
SOF_IPC4_FW_CFG_SOF_INFO = 35,
442440
};
443441

444442
struct sof_ipc4_fw_version {
@@ -448,6 +446,14 @@ struct sof_ipc4_fw_version {
448446
uint16_t build;
449447
} __packed;
450448

449+
/*
450+
* tuple based array for SOF specific information under SOF_IPC4_FW_CFG_SOF_INFO
451+
* tuple of fw_config
452+
*/
453+
enum ipc4_fw_sof_info_params {
454+
SOF_IPC4_SOF_CODEC_INFO,
455+
};
456+
451457
/* Payload data for SOF_IPC4_MOD_SET_DX */
452458
struct sof_ipc4_dx_state_info {
453459
/* core(s) to apply the change */

sound/soc/sof/ipc4-loader.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,37 @@ static int sof_ipc4_validate_firmware(struct snd_sof_dev *sdev)
417417
return 0;
418418
}
419419

420+
static int sof_ipc4_query_sof_info(struct snd_sof_dev *sdev, void *sof_info_data,
421+
u32 sof_info_size)
422+
{
423+
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
424+
struct sof_ipc4_tuple *tuple;
425+
size_t offset = 0;
426+
int ret = 0;
427+
428+
while (offset < sof_info_size) {
429+
tuple = (struct sof_ipc4_tuple *)((u8 *)sof_info_data + offset);
430+
431+
switch (tuple->type) {
432+
case SOF_IPC4_SOF_CODEC_INFO:
433+
ipc4_data->codec_info = devm_kmemdup(sdev->dev, tuple->value,
434+
tuple->size, GFP_KERNEL);
435+
if (!ipc4_data->codec_info) {
436+
ret = -ENOMEM;
437+
goto out;
438+
}
439+
break;
440+
default:
441+
break;
442+
}
443+
444+
offset += sizeof(*tuple) + tuple->size;
445+
}
446+
447+
out:
448+
return ret;
449+
}
450+
420451
int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev)
421452
{
422453
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
@@ -492,6 +523,11 @@ int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev)
492523
*/
493524
ipc4_data->libraries_restored = ipc4_data->fw_context_save;
494525
break;
526+
case SOF_IPC4_FW_CFG_SOF_INFO:
527+
ret = sof_ipc4_query_sof_info(sdev, tuple->value, tuple->size);
528+
if (ret)
529+
goto out;
530+
break;
495531
default:
496532
break;
497533
}

sound/soc/sof/ipc4-priv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ struct sof_ipc4_fw_library {
7575
* @fw_context_save: Firmware supports full context save and restore
7676
* @libraries_restored: The libraries have been retained during firmware boot
7777
*
78+
* @codec_info: Information about the available codecs in booted firmware. The
79+
* data is to be used by the code for compressed support.
7880
* @load_library: Callback function for platform dependent library loading
7981
* @pipeline_state_mutex: Mutex to protect pipeline triggers, ref counts, states and deletion
8082
*/
@@ -91,6 +93,8 @@ struct sof_ipc4_fw_data {
9193
bool fw_context_save;
9294
bool libraries_restored;
9395

96+
void *codec_info;
97+
9498
int (*load_library)(struct snd_sof_dev *sdev,
9599
struct sof_ipc4_fw_library *fw_lib, bool reload);
96100
void (*intel_configure_mic_privacy)(struct snd_sof_dev *sdev,

0 commit comments

Comments
 (0)