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