trace.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright(c) 2022 Intel Corporation
  4. #include "sof-priv.h"
  5. int sof_fw_trace_init(struct snd_sof_dev *sdev)
  6. {
  7. const struct sof_ipc_fw_tracing_ops *fw_tracing = sof_ipc_get_ops(sdev, fw_tracing);
  8. if (!fw_tracing) {
  9. dev_info(sdev->dev, "Firmware tracing is not available\n");
  10. sdev->fw_trace_is_supported = false;
  11. return 0;
  12. }
  13. return fw_tracing->init(sdev);
  14. }
  15. void sof_fw_trace_free(struct snd_sof_dev *sdev)
  16. {
  17. if (!sdev->fw_trace_is_supported)
  18. return;
  19. if (sdev->ipc->ops->fw_tracing->free)
  20. sdev->ipc->ops->fw_tracing->free(sdev);
  21. }
  22. void sof_fw_trace_fw_crashed(struct snd_sof_dev *sdev)
  23. {
  24. if (!sdev->fw_trace_is_supported)
  25. return;
  26. if (sdev->ipc->ops->fw_tracing->fw_crashed)
  27. sdev->ipc->ops->fw_tracing->fw_crashed(sdev);
  28. }
  29. void sof_fw_trace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state)
  30. {
  31. if (!sdev->fw_trace_is_supported)
  32. return;
  33. sdev->ipc->ops->fw_tracing->suspend(sdev, pm_state);
  34. }
  35. int sof_fw_trace_resume(struct snd_sof_dev *sdev)
  36. {
  37. if (!sdev->fw_trace_is_supported)
  38. return 0;
  39. return sdev->ipc->ops->fw_tracing->resume(sdev);
  40. }