Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASoC: SOF: pm: check if core is powered up before performing resume s… #473

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sound/soc/sof/intel/apl.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = {
/* dsp core power up/down */
.core_power_up = hda_dsp_enable_core,
.core_power_down = hda_dsp_core_reset_power_down,
.is_core_enabled = hda_dsp_core_is_enabled,

/* trace callback */
.trace_init = hda_dsp_trace_init,
Expand Down
9 changes: 9 additions & 0 deletions sound/soc/sof/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ static inline int snd_sof_dsp_core_power_down(struct snd_sof_dev *sdev,
return 0;
}

static inline int snd_sof_dsp_core_is_enabled(struct snd_sof_dev *sdev,
unsigned int core_mask)
{
if (sdev->ops->is_core_enabled)
return sdev->ops->is_core_enabled(sdev, core_mask);

return 0;
}

/* pre/post fw load */
static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev)
{
Expand Down
9 changes: 9 additions & 0 deletions sound/soc/sof/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ static int sof_resume(struct device *dev, bool runtime_resume)
if (!sdev->ops->resume || !sdev->ops->runtime_resume)
return 0;

/*
* If for some reason, the cores were not powered off
* during suspend, powering them up again will lead to
* DSP panic. So check if core 0 is powered off to make
* sure before proceeding further.
*/
if (snd_sof_dsp_core_is_enabled(sdev, BIT(0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is starting to look like a hardware-dependent work-around in the framework. Can it be moved to the hardware or abstracted away?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart sure. let me try to move it around. But I also feel like we are trying to hide the real issue with this hack. I am having second thoughts about it.

return 0;

/*
* if the runtime_resume flag is set, call the runtime_resume routine
* or else call the system resume routine
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ struct snd_sof_dsp_ops {
unsigned int core_mask);
int (*core_power_down)(struct snd_sof_dev *sof_dev,
unsigned int core_mask);
bool (*is_core_enabled)(struct snd_sof_dev *sof_dev,
unsigned int core_mask);

/* pre/post firmware run */
int (*pre_fw_run)(struct snd_sof_dev *sof_dev);
Expand Down