Skip to content

Commit 3f5eb32

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: Intel: lnl: Disable DMIC/SSP offload on remove
During probe the DMIC/SSP offload is enabled and it is not reversed on remove. Add a remove wrapper for LNL to disable the offload for DMIC and SSP similarly to what is done during probe. Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 09bbc4f commit 3f5eb32

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

sound/soc/sof/intel/lnl.c

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ static const struct snd_sof_debugfs_map lnl_dsp_debugfs[] = {
2929
};
3030

3131
/* this helps allows the DSP to setup DMIC/SSP */
32-
static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus)
32+
static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus, bool enable)
3333
{
3434
int ret;
3535

36-
ret = hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_SSP, true);
36+
ret = hdac_bus_eml_enable_offload(bus, true,
37+
AZX_REG_ML_LEPTR_ID_INTEL_SSP, enable);
3738
if (ret < 0)
3839
return ret;
3940

40-
ret = hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_DMIC, true);
41+
ret = hdac_bus_eml_enable_offload(bus, true,
42+
AZX_REG_ML_LEPTR_ID_INTEL_DMIC, enable);
4143
if (ret < 0)
4244
return ret;
4345

@@ -52,7 +54,19 @@ static int lnl_hda_dsp_probe(struct snd_sof_dev *sdev)
5254
if (ret < 0)
5355
return ret;
5456

55-
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev));
57+
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
58+
}
59+
60+
static void lnl_hda_dsp_remove(struct snd_sof_dev *sdev)
61+
{
62+
int ret;
63+
64+
ret = hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), false);
65+
if (ret < 0)
66+
dev_warn(sdev->dev,
67+
"Failed to disable offload for DMIC/SSP: %d\n", ret);
68+
69+
hda_dsp_remove(sdev);
5670
}
5771

5872
static int lnl_hda_dsp_resume(struct snd_sof_dev *sdev)
@@ -63,7 +77,7 @@ static int lnl_hda_dsp_resume(struct snd_sof_dev *sdev)
6377
if (ret < 0)
6478
return ret;
6579

66-
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev));
80+
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
6781
}
6882

6983
static int lnl_hda_dsp_runtime_resume(struct snd_sof_dev *sdev)
@@ -74,7 +88,7 @@ static int lnl_hda_dsp_runtime_resume(struct snd_sof_dev *sdev)
7488
if (ret < 0)
7589
return ret;
7690

77-
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev));
91+
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
7892
}
7993

8094
static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)
@@ -97,9 +111,11 @@ int sof_lnl_ops_init(struct snd_sof_dev *sdev)
97111
/* common defaults */
98112
memcpy(&sof_lnl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
99113

100-
/* probe */
101-
if (!sdev->dspless_mode_selected)
114+
/* probe/remove */
115+
if (!sdev->dspless_mode_selected) {
102116
sof_lnl_ops.probe = lnl_hda_dsp_probe;
117+
sof_lnl_ops.remove = lnl_hda_dsp_remove;
118+
}
103119

104120
/* shutdown */
105121
sof_lnl_ops.shutdown = hda_dsp_shutdown;

0 commit comments

Comments
 (0)