// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) // // This file is provided under a dual BSD/GPLv2 license. When using or // redistributing this file, you may do so under either license. // // Copyright(c) 2018 Intel Corporation // // Author: Liam Girdwood <[email protected]> // #include <linux/firmware.h> #include <linux/module.h> #include <sound/soc.h> #include <sound/sof.h> #include "sof-priv.h" #include "sof-of-dev.h" #include "ops.h" #define CREATE_TRACE_POINTS #include <trace/events/sof.h> /* see SOF_DBG_ flags */ static int sof_core_debug = … IS_ENABLED(…); module_param_named(sof_debug, sof_core_debug, int, 0444); MODULE_PARM_DESC(…) …; /* SOF defaults if not provided by the platform in ms */ #define TIMEOUT_DEFAULT_IPC_MS … #define TIMEOUT_DEFAULT_BOOT_MS … /** * sof_debug_check_flag - check if a given flag(s) is set in sof_core_debug * @mask: Flag or combination of flags to check * * Returns true if all bits set in mask is also set in sof_core_debug, otherwise * false */ bool sof_debug_check_flag(int mask) { … } EXPORT_SYMBOL(…); /* * FW Panic/fault handling. */ struct sof_panic_msg { … }; /* standard FW panic types */ static const struct sof_panic_msg panic_msg[] = …; /** * sof_print_oops_and_stack - Handle the printing of DSP oops and stack trace * @sdev: Pointer to the device's sdev * @level: prink log level to use for the printing * @panic_code: the panic code * @tracep_code: tracepoint code * @oops: Pointer to DSP specific oops data * @panic_info: Pointer to the received panic information message * @stack: Pointer to the call stack data * @stack_words: Number of words in the stack data * * helper to be called from .dbg_dump callbacks. No error code is * provided, it's left as an exercise for the caller of .dbg_dump * (typically IPC or loader) */ void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level, u32 panic_code, u32 tracep_code, void *oops, struct sof_ipc_panic_info *panic_info, void *stack, size_t stack_words) { … } EXPORT_SYMBOL(…); /* Helper to manage DSP state */ void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state) { … } EXPORT_SYMBOL(…); static struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev) { … } /* SOF Driver enumeration */ static int sof_machine_check(struct snd_sof_dev *sdev) { … } static int sof_select_ipc_and_paths(struct snd_sof_dev *sdev) { … } static int validate_sof_ops(struct snd_sof_dev *sdev) { … } static int sof_init_sof_ops(struct snd_sof_dev *sdev) { … } static int sof_init_environment(struct snd_sof_dev *sdev) { … } /* * FW Boot State Transition Diagram * * +----------------------------------------------------------------------+ * | | * ------------------ ------------------ | * | | | | | * | BOOT_FAILED |<-------| READY_FAILED | | * | |<--+ | | ------------------ | * ------------------ | ------------------ | | | * ^ | ^ | CRASHED |---+ | * | | | | | | | * (FW Boot Timeout) | (FW_READY FAIL) ------------------ | | * | | | ^ | | * | | | |(DSP Panic) | | * ------------------ | | ------------------ | | * | | | | | | | | * | IN_PROGRESS |---------------+------------->| COMPLETE | | | * | | (FW Boot OK) (FW_READY OK) | | | | * ------------------ | ------------------ | | * ^ | | | | * | | | | | * (FW Loading OK) | (System Suspend/Runtime Suspend) * | | | | | * | (FW Loading Fail) | | | * ------------------ | ------------------ | | | * | | | | |<-----+ | | * | PREPARE |---+ | NOT_STARTED |<---------------------+ | * | | | |<--------------------------+ * ------------------ ------------------ * | ^ | ^ * | | | | * | +-----------------------+ | * | (DSP Probe OK) | * | | * | | * +------------------------------------+ * (System Suspend/Runtime Suspend) */ static int sof_probe_continue(struct snd_sof_dev *sdev) { … } static void sof_probe_work(struct work_struct *work) { … } int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) { … } EXPORT_SYMBOL(…); bool snd_sof_device_probe_completed(struct device *dev) { … } EXPORT_SYMBOL(…); int snd_sof_device_remove(struct device *dev) { … } EXPORT_SYMBOL(…); int snd_sof_device_shutdown(struct device *dev) { … } EXPORT_SYMBOL(…); /* Machine driver registering and unregistering */ int sof_machine_register(struct snd_sof_dev *sdev, void *pdata) { … } EXPORT_SYMBOL(…); void sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata) { … } EXPORT_SYMBOL(…); MODULE_AUTHOR(…) …; MODULE_LICENSE(…) …; MODULE_DESCRIPTION(…) …; MODULE_ALIAS(…) …; MODULE_IMPORT_NS(…);