Commit c27032b4 authored by Mark Brown's avatar Mark Brown

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.
parents e7a4a2fd 3a0e7bb8
...@@ -423,6 +423,12 @@ enum sof_ipc4_fw_config_params { ...@@ -423,6 +423,12 @@ enum sof_ipc4_fw_config_params {
SOF_IPC4_FW_CFG_RESERVED, SOF_IPC4_FW_CFG_RESERVED,
SOF_IPC4_FW_CFG_POWER_GATING_POLICY, SOF_IPC4_FW_CFG_POWER_GATING_POLICY,
SOF_IPC4_FW_CFG_ASSERT_MODE, SOF_IPC4_FW_CFG_ASSERT_MODE,
SOF_IPC4_FW_RESERVED1,
SOF_IPC4_FW_RESERVED2,
SOF_IPC4_FW_RESERVED3,
SOF_IPC4_FW_RESERVED4,
SOF_IPC4_FW_RESERVED5,
SOF_IPC4_FW_CONTEXT_SAVE
}; };
struct sof_ipc4_fw_version { struct sof_ipc4_fw_version {
......
...@@ -519,14 +519,15 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev, ...@@ -519,14 +519,15 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_library *fw_lib, bool reload) struct sof_ipc4_fw_library *fw_lib, bool reload)
{ {
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
struct hdac_ext_stream *hext_stream; struct hdac_ext_stream *hext_stream;
struct firmware stripped_firmware; struct firmware stripped_firmware;
struct sof_ipc4_msg msg = {}; struct sof_ipc4_msg msg = {};
struct snd_dma_buffer dmab; struct snd_dma_buffer dmab;
int ret, ret1; int ret, ret1;
/* IMR booting will restore the libraries as well, skip the loading */ /* if IMR booting is enabled and fw context is saved for D3 state, skip the loading */
if (reload && hda->booted_from_imr) if (reload && hda->booted_from_imr && ipc4_data->fw_context_save)
return 0; return 0;
/* the fw_lib has been verified during loading, we can trust the validity here */ /* the fw_lib has been verified during loading, we can trust the validity here */
......
...@@ -133,6 +133,8 @@ int sof_lnl_ops_init(struct snd_sof_dev *sdev) ...@@ -133,6 +133,8 @@ int sof_lnl_ops_init(struct snd_sof_dev *sdev)
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
ipc4_data->fw_context_save = true;
/* External library loading support */ /* External library loading support */
ipc4_data->load_library = hda_dsp_ipc4_load_library; ipc4_data->load_library = hda_dsp_ipc4_load_library;
......
...@@ -718,6 +718,8 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev) ...@@ -718,6 +718,8 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev)
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
ipc4_data->fw_context_save = true;
/* External library loading support */ /* External library loading support */
ipc4_data->load_library = hda_dsp_ipc4_load_library; ipc4_data->load_library = hda_dsp_ipc4_load_library;
......
...@@ -91,6 +91,8 @@ int sof_tgl_ops_init(struct snd_sof_dev *sdev) ...@@ -91,6 +91,8 @@ int sof_tgl_ops_init(struct snd_sof_dev *sdev)
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
ipc4_data->fw_context_save = true;
/* External library loading support */ /* External library loading support */
ipc4_data->load_library = hda_dsp_ipc4_load_library; ipc4_data->load_library = hda_dsp_ipc4_load_library;
......
...@@ -391,6 +391,9 @@ int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev) ...@@ -391,6 +391,9 @@ int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev)
goto out; goto out;
} }
break; break;
case SOF_IPC4_FW_CONTEXT_SAVE:
ipc4_data->fw_context_save = *tuple->value;
break;
default: default:
break; break;
} }
......
...@@ -81,6 +81,7 @@ struct sof_ipc4_fw_data { ...@@ -81,6 +81,7 @@ struct sof_ipc4_fw_data {
u32 mtrace_log_bytes; u32 mtrace_log_bytes;
int max_num_pipelines; int max_num_pipelines;
u32 max_libs_count; u32 max_libs_count;
bool fw_context_save;
int (*load_library)(struct snd_sof_dev *sdev, int (*load_library)(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_library *fw_lib, bool reload); struct sof_ipc4_fw_library *fw_lib, bool reload);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment