Skip to content

Commit c27032b

Browse files
committed
ASoC: SOF: query FW config to reload library
Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>: We should query FW config if context save is supported, and no need to reload FW if hda->booted_from_imr and ipc4_data->fw_context_save are true.
2 parents e7a4a2f + 3a0e7bb commit c27032b

7 files changed

Lines changed: 19 additions & 2 deletions

File tree

include/sound/sof/ipc4/header.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ enum sof_ipc4_fw_config_params {
423423
SOF_IPC4_FW_CFG_RESERVED,
424424
SOF_IPC4_FW_CFG_POWER_GATING_POLICY,
425425
SOF_IPC4_FW_CFG_ASSERT_MODE,
426+
SOF_IPC4_FW_RESERVED1,
427+
SOF_IPC4_FW_RESERVED2,
428+
SOF_IPC4_FW_RESERVED3,
429+
SOF_IPC4_FW_RESERVED4,
430+
SOF_IPC4_FW_RESERVED5,
431+
SOF_IPC4_FW_CONTEXT_SAVE
426432
};
427433

428434
struct sof_ipc4_fw_version {

sound/soc/sof/intel/hda-loader.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,14 +519,15 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev,
519519
struct sof_ipc4_fw_library *fw_lib, bool reload)
520520
{
521521
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
522+
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
522523
struct hdac_ext_stream *hext_stream;
523524
struct firmware stripped_firmware;
524525
struct sof_ipc4_msg msg = {};
525526
struct snd_dma_buffer dmab;
526527
int ret, ret1;
527528

528-
/* IMR booting will restore the libraries as well, skip the loading */
529-
if (reload && hda->booted_from_imr)
529+
/* if IMR booting is enabled and fw context is saved for D3 state, skip the loading */
530+
if (reload && hda->booted_from_imr && ipc4_data->fw_context_save)
530531
return 0;
531532

532533
/* the fw_lib has been verified during loading, we can trust the validity here */

sound/soc/sof/intel/lnl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ int sof_lnl_ops_init(struct snd_sof_dev *sdev)
133133

134134
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
135135

136+
ipc4_data->fw_context_save = true;
137+
136138
/* External library loading support */
137139
ipc4_data->load_library = hda_dsp_ipc4_load_library;
138140

sound/soc/sof/intel/mtl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,8 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev)
718718

719719
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
720720

721+
ipc4_data->fw_context_save = true;
722+
721723
/* External library loading support */
722724
ipc4_data->load_library = hda_dsp_ipc4_load_library;
723725

sound/soc/sof/intel/tgl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ int sof_tgl_ops_init(struct snd_sof_dev *sdev)
9191

9292
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
9393

94+
ipc4_data->fw_context_save = true;
95+
9496
/* External library loading support */
9597
ipc4_data->load_library = hda_dsp_ipc4_load_library;
9698

sound/soc/sof/ipc4-loader.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev)
391391
goto out;
392392
}
393393
break;
394+
case SOF_IPC4_FW_CONTEXT_SAVE:
395+
ipc4_data->fw_context_save = *tuple->value;
396+
break;
394397
default:
395398
break;
396399
}

sound/soc/sof/ipc4-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct sof_ipc4_fw_data {
8181
u32 mtrace_log_bytes;
8282
int max_num_pipelines;
8383
u32 max_libs_count;
84+
bool fw_context_save;
8485

8586
int (*load_library)(struct snd_sof_dev *sdev,
8687
struct sof_ipc4_fw_library *fw_lib, bool reload);

0 commit comments

Comments
 (0)