Commit 1da51943 authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Mark Brown

ASoC: SOF: Intel: hda: init NHLT for IPC4

Init and save the BIOS NHLT as part of the IPC4 FW data.
Add a kernel module param to override the BIOS NHLT with the NHLT from
the topology. Also, add the ops_free callback for all HDA platforms to
free the NHLT.
Co-developed-by: default avatarJaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: default avatarJaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-19-ranjani.sridharan@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent bc433fd7
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/hdaudio_ext.h> #include <sound/hdaudio_ext.h>
#include <sound/intel-nhlt.h>
#include <sound/sof/ipc4/header.h> #include <sound/sof/ipc4/header.h>
#include <uapi/sound/sof/header.h> #include <uapi/sound/sof/header.h>
#include "../ipc4-priv.h" #include "../ipc4-priv.h"
...@@ -18,6 +19,14 @@ ...@@ -18,6 +19,14 @@
#include "../sof-audio.h" #include "../sof-audio.h"
#include "hda.h" #include "hda.h"
/*
* The default method is to fetch NHLT from BIOS. With this parameter set
* it is possible to override that with NHLT in the SOF topology manifest.
*/
static bool hda_use_tplg_nhlt;
module_param_named(sof_use_tplg_nhlt, hda_use_tplg_nhlt, bool, 0444);
MODULE_PARM_DESC(sof_use_tplg_nhlt, "SOF topology nhlt override");
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
struct hda_pipe_params { struct hda_pipe_params {
...@@ -777,6 +786,9 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops) ...@@ -777,6 +786,9 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops)
} }
break; break;
case SOF_INTEL_IPC4: case SOF_INTEL_IPC4:
{
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
for (i = 0; i < ops->num_drv; i++) { for (i = 0; i < ops->num_drv; i++) {
if (strstr(ops->drv[i].name, "DMIC")) { if (strstr(ops->drv[i].name, "DMIC")) {
ops->drv[i].ops = &ipc4_dmic_dai_ops; ops->drv[i].ops = &ipc4_dmic_dai_ops;
...@@ -793,12 +805,28 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops) ...@@ -793,12 +805,28 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops)
ops->drv[i].ops = &ipc4_hda_dai_ops; ops->drv[i].ops = &ipc4_hda_dai_ops;
#endif #endif
} }
if (!hda_use_tplg_nhlt)
ipc4_data->nhlt = intel_nhlt_init(sdev->dev);
break; break;
}
default: default:
break; break;
} }
} }
void hda_ops_free(struct snd_sof_dev *sdev)
{
if (sdev->pdata->ipc_type == SOF_INTEL_IPC4) {
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
if (!hda_use_tplg_nhlt)
intel_nhlt_free(ipc4_data->nhlt);
}
}
EXPORT_SYMBOL_NS(hda_ops_free, SND_SOC_SOF_INTEL_HDA_COMMON);
/* /*
* common dai driver for skl+ platforms. * common dai driver for skl+ platforms.
* some products who use this DAI array only physically have a subset of * some products who use this DAI array only physically have a subset of
......
...@@ -763,6 +763,7 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f ...@@ -763,6 +763,7 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f
extern int sof_hda_position_quirk; extern int sof_hda_position_quirk;
void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops); void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops);
void hda_ops_free(struct snd_sof_dev *sdev);
/* IPC4 */ /* IPC4 */
irqreturn_t cnl_ipc4_irq_thread(int irq, void *context); irqreturn_t cnl_ipc4_irq_thread(int irq, void *context);
......
...@@ -44,6 +44,7 @@ static const struct sof_dev_desc bxt_desc = { ...@@ -44,6 +44,7 @@ static const struct sof_dev_desc bxt_desc = {
.nocodec_tplg_filename = "sof-apl-nocodec.tplg", .nocodec_tplg_filename = "sof-apl-nocodec.tplg",
.ops = &sof_apl_ops, .ops = &sof_apl_ops,
.ops_init = sof_apl_ops_init, .ops_init = sof_apl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc glk_desc = { static const struct sof_dev_desc glk_desc = {
......
...@@ -73,6 +73,7 @@ static const struct sof_dev_desc cfl_desc = { ...@@ -73,6 +73,7 @@ static const struct sof_dev_desc cfl_desc = {
.nocodec_tplg_filename = "sof-cnl-nocodec.tplg", .nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
.ops = &sof_cnl_ops, .ops = &sof_cnl_ops,
.ops_init = sof_cnl_ops_init, .ops_init = sof_cnl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc cml_desc = { static const struct sof_dev_desc cml_desc = {
......
...@@ -45,6 +45,7 @@ static const struct sof_dev_desc icl_desc = { ...@@ -45,6 +45,7 @@ static const struct sof_dev_desc icl_desc = {
.nocodec_tplg_filename = "sof-icl-nocodec.tplg", .nocodec_tplg_filename = "sof-icl-nocodec.tplg",
.ops = &sof_icl_ops, .ops = &sof_icl_ops,
.ops_init = sof_icl_ops_init, .ops_init = sof_icl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc jsl_desc = { static const struct sof_dev_desc jsl_desc = {
......
...@@ -73,6 +73,7 @@ static const struct sof_dev_desc tglh_desc = { ...@@ -73,6 +73,7 @@ static const struct sof_dev_desc tglh_desc = {
.nocodec_tplg_filename = "sof-tgl-nocodec.tplg", .nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc ehl_desc = { static const struct sof_dev_desc ehl_desc = {
......
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
* @manifest_fw_hdr_offset: FW header offset in the manifest * @manifest_fw_hdr_offset: FW header offset in the manifest
* @num_fw_modules : Number of modules in base FW * @num_fw_modules : Number of modules in base FW
* @fw_modules: Array of base FW modules * @fw_modules: Array of base FW modules
* @nhlt: NHLT table either from the BIOS or the topology manifest
*/ */
struct sof_ipc4_fw_data { struct sof_ipc4_fw_data {
u32 manifest_fw_hdr_offset; u32 manifest_fw_hdr_offset;
int num_fw_modules; int num_fw_modules;
void *fw_modules; void *fw_modules;
void *nhlt;
}; };
/** /**
......
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