Skip to content

Commit ce9ef74

Browse files
committed
ASoC: SOF: Fixes for suspend after firmware crash
Merge series from Peter Ujfalusi <[email protected]>: This series contails 2 patches to fix device suspend after a firmware crash and another patch to allow reading the FW state from debugfs.
2 parents 3e78986 + 9a9134f commit ce9ef74

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

sound/soc/sof/debug.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev)
353353
return err;
354354
}
355355

356-
return 0;
356+
return snd_sof_debugfs_buf_item(sdev, &sdev->fw_state,
357+
sizeof(sdev->fw_state),
358+
"fw_state", 0444);
357359
}
358360
EXPORT_SYMBOL_GPL(snd_sof_dbg_init);
359361

sound/soc/sof/pm.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
182182
const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm;
183183
const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
184184
pm_message_t pm_state;
185-
u32 target_state = 0;
185+
u32 target_state = snd_sof_dsp_power_target(sdev);
186186
int ret;
187187

188188
/* do nothing if dsp suspend callback is not set */
@@ -192,6 +192,9 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
192192
if (runtime_suspend && !sof_ops(sdev)->runtime_suspend)
193193
return 0;
194194

195+
if (tplg_ops && tplg_ops->tear_down_all_pipelines)
196+
tplg_ops->tear_down_all_pipelines(sdev, false);
197+
195198
if (sdev->fw_state != SOF_FW_BOOT_COMPLETE)
196199
goto suspend;
197200

@@ -206,7 +209,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
206209
}
207210
}
208211

209-
target_state = snd_sof_dsp_power_target(sdev);
210212
pm_state.event = target_state;
211213

212214
/* Skip to platform-specific suspend if DSP is entering D0 */
@@ -217,9 +219,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
217219
goto suspend;
218220
}
219221

220-
if (tplg_ops->tear_down_all_pipelines)
221-
tplg_ops->tear_down_all_pipelines(sdev, false);
222-
223222
/* suspend DMA trace */
224223
sof_fw_trace_suspend(sdev, pm_state);
225224

0 commit comments

Comments
 (0)