ASoC: SOF: hda: don't use the core op for power up/power down
The core_power_up/down() ops will be deprecated. Use the HDA platform-specific functions for powering up/down the cores during probe/suspend/remove. The enabled_cores_mask and the core ref_count's are manually updated in each of these functions. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20211119192621.4096077-9-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
b2ebcf42a4
commit
d416519982
|
@ -614,7 +614,7 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
|
||||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
|
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
|
||||||
struct hdac_bus *bus = sof_to_bus(sdev);
|
struct hdac_bus *bus = sof_to_bus(sdev);
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret, j;
|
||||||
|
|
||||||
hda_sdw_int_enable(sdev, false);
|
hda_sdw_int_enable(sdev, false);
|
||||||
|
|
||||||
|
@ -629,13 +629,17 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* power down DSP */
|
/* power down DSP */
|
||||||
ret = snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask);
|
ret = hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(sdev->dev,
|
dev_err(sdev->dev,
|
||||||
"error: failed to power down core during suspend\n");
|
"error: failed to power down core during suspend\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* reset ref counts for all cores */
|
||||||
|
for (j = 0; j < chip->cores_num; j++)
|
||||||
|
sdev->dsp_core_ref_count[j] = 0;
|
||||||
|
|
||||||
/* disable ppcap interrupt */
|
/* disable ppcap interrupt */
|
||||||
hda_dsp_ctrl_ppcap_enable(sdev, false);
|
hda_dsp_ctrl_ppcap_enable(sdev, false);
|
||||||
hda_dsp_ctrl_ppcap_int_enable(sdev, false);
|
hda_dsp_ctrl_ppcap_int_enable(sdev, false);
|
||||||
|
|
|
@ -88,12 +88,13 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
|
||||||
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
||||||
const struct sof_intel_dsp_desc *chip = hda->desc;
|
const struct sof_intel_dsp_desc *chip = hda->desc;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
u32 flags;
|
unsigned long mask;
|
||||||
|
u32 flags, j;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* step 1: power up corex */
|
/* step 1: power up corex */
|
||||||
ret = snd_sof_dsp_core_power_up(sdev, chip->host_managed_cores_mask);
|
ret = hda_dsp_enable_core(sdev, chip->host_managed_cores_mask);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
||||||
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
|
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
|
||||||
|
@ -148,8 +149,8 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
|
||||||
chip->ipc_ack_mask);
|
chip->ipc_ack_mask);
|
||||||
|
|
||||||
/* step 5: power down cores that are no longer needed */
|
/* step 5: power down cores that are no longer needed */
|
||||||
ret = snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask &
|
ret = hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask &
|
||||||
~(chip->init_core_mask));
|
~(chip->init_core_mask));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
||||||
dev_err(sdev->dev,
|
dev_err(sdev->dev,
|
||||||
|
@ -168,8 +169,14 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
|
||||||
HDA_DSP_REG_POLL_INTERVAL_US,
|
HDA_DSP_REG_POLL_INTERVAL_US,
|
||||||
chip->rom_init_timeout *
|
chip->rom_init_timeout *
|
||||||
USEC_PER_MSEC);
|
USEC_PER_MSEC);
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
|
/* set enabled cores mask and increment ref count for cores in init_core_mask */
|
||||||
|
sdev->enabled_cores_mask |= chip->init_core_mask;
|
||||||
|
mask = sdev->enabled_cores_mask;
|
||||||
|
for_each_set_bit(j, &mask, SOF_MAX_DSP_NUM_CORES)
|
||||||
|
sdev->dsp_core_ref_count[j]++;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
||||||
dev_err(sdev->dev,
|
dev_err(sdev->dev,
|
||||||
|
@ -184,7 +191,7 @@ err:
|
||||||
flags &= ~SOF_DBG_DUMP_OPTIONAL;
|
flags &= ~SOF_DBG_DUMP_OPTIONAL;
|
||||||
|
|
||||||
snd_sof_dsp_dbg_dump(sdev, flags);
|
snd_sof_dsp_dbg_dump(sdev, flags);
|
||||||
snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask);
|
hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -501,12 +508,15 @@ int hda_dsp_post_fw_run_icl(struct snd_sof_dev *sdev)
|
||||||
* the host whereas on TGL it is handled by the firmware.
|
* the host whereas on TGL it is handled by the firmware.
|
||||||
*/
|
*/
|
||||||
if (!hda->clk_config_lpro) {
|
if (!hda->clk_config_lpro) {
|
||||||
ret = snd_sof_dsp_core_power_up(sdev, BIT(3));
|
ret = hda_dsp_enable_core(sdev, BIT(3));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(sdev->dev, "error: dsp core power up failed on core 3\n");
|
dev_err(sdev->dev, "error: dsp core power up failed on core 3\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sdev->enabled_cores_mask |= BIT(3);
|
||||||
|
sdev->dsp_core_ref_count[3]++;
|
||||||
|
|
||||||
snd_sof_dsp_stall(sdev, BIT(3));
|
snd_sof_dsp_stall(sdev, BIT(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1034,9 +1034,9 @@ err:
|
||||||
int hda_dsp_remove(struct snd_sof_dev *sdev)
|
int hda_dsp_remove(struct snd_sof_dev *sdev)
|
||||||
{
|
{
|
||||||
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
||||||
|
const struct sof_intel_dsp_desc *chip = hda->desc;
|
||||||
struct hdac_bus *bus = sof_to_bus(sdev);
|
struct hdac_bus *bus = sof_to_bus(sdev);
|
||||||
struct pci_dev *pci = to_pci_dev(sdev->dev);
|
struct pci_dev *pci = to_pci_dev(sdev->dev);
|
||||||
const struct sof_intel_dsp_desc *chip = hda->desc;
|
|
||||||
|
|
||||||
/* cancel any attempt for DSP D0I3 */
|
/* cancel any attempt for DSP D0I3 */
|
||||||
cancel_delayed_work_sync(&hda->d0i3_work);
|
cancel_delayed_work_sync(&hda->d0i3_work);
|
||||||
|
@ -1061,7 +1061,7 @@ int hda_dsp_remove(struct snd_sof_dev *sdev)
|
||||||
|
|
||||||
/* disable cores */
|
/* disable cores */
|
||||||
if (chip)
|
if (chip)
|
||||||
snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask);
|
hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask);
|
||||||
|
|
||||||
/* disable DSP */
|
/* disable DSP */
|
||||||
snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL,
|
snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL,
|
||||||
|
|
Loading…
Reference in New Issue