Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 150
SOF client support (auxiliary bus) - take3#3136
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
8e852085952651f835b455031443f06c6446168615ee7113a8061191c01419cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -39,6 +39,14 @@ enum sof_fw_state { | ||
| SOF_FW_CRASHED, | ||
| }; | ||
| /* DSP power states */ | ||
| enum sof_dsp_power_states { | ||
| SOF_DSP_PM_D0, | ||
| SOF_DSP_PM_D1, | ||
| SOF_DSP_PM_D2, | ||
| SOF_DSP_PM_D3, | ||
| }; | ||
plbossart marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /* | ||
| * SOF Platform data. | ||
| */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,36 @@ | ||
| # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) | ||
| snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\ | ||
| control.o trace.o utils.o sof-audio.o stream-ipc.o ipc4.o | ||
| control.o trace.o iomem-utils.o sof-audio.o stream-ipc.o ipc4.o | ||
plbossart marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| snd-sof-$(CONFIG_SND_SOC_SOF_CLIENT) += sof-client.o | ||
| snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += sof-probes.o | ||
| snd-sof-$(CONFIG_SND_SOC_SOF_COMPRESS) += compress.o | ||
| snd-sof-pci-objs := sof-pci-dev.o | ||
| snd-sof-acpi-objs := sof-acpi-dev.o | ||
| snd-sof-of-objs := sof-of-dev.o | ||
| snd-sof-ipc-flood-test-objs := sof-client-ipc-flood-test.o | ||
| snd-sof-ipc-msg-injector-objs := sof-client-ipc-msg-injector.o | ||
| snd-sof-probes-objs := sof-client-probes.o | ||
| snd-sof-nocodec-objs := nocodec.o | ||
| snd-sof-utils-objs := sof-utils.o | ||
| obj-$(CONFIG_SND_SOC_SOF) += snd-sof.o | ||
| obj-$(CONFIG_SND_SOC_SOF_NOCODEC) += snd-sof-nocodec.o | ||
| obj-$(CONFIG_SND_SOC_SOF) += snd-sof-utils.o | ||
| obj-$(CONFIG_SND_SOC_SOF_ACPI_DEV) += snd-sof-acpi.o | ||
| obj-$(CONFIG_SND_SOC_SOF_OF_DEV) += snd-sof-of.o | ||
| obj-$(CONFIG_SND_SOC_SOF_PCI_DEV) += snd-sof-pci.o | ||
| obj-$(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST) += snd-sof-ipc-flood-test.o | ||
| obj-$(CONFIG_SND_SOC_SOF_DEBUG_IPC_MSG_INJECTOR) += snd-sof-ipc-msg-injector.o | ||
| obj-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += snd-sof-probes.o | ||
| obj-$(CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL) += intel/ | ||
| obj-$(CONFIG_SND_SOC_SOF_IMX_TOPLEVEL) += imx/ | ||
| obj-$(CONFIG_SND_SOC_SOF_AMD_TOPLEVEL) += amd/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,9 +14,6 @@ | ||
| #include <sound/sof.h> | ||
| #include "sof-priv.h" | ||
| #include "ops.h" | ||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES) | ||
| #include "sof-probes.h" | ||
| #endif | ||
| /* see SOF_DBG_ flags */ | ||
| static int sof_core_debug = IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE); | ||
| @@ -122,6 +119,27 @@ void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level, | ||
| } | ||
| EXPORT_SYMBOL(sof_print_oops_and_stack); | ||
| /* Helper to manage DSP state */ | ||
| void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state) | ||
| { | ||
| if (sdev->fw_state == new_state) | ||
| return; | ||
| dev_dbg(sdev->dev, "fw_state change: %d -> %d\n", sdev->fw_state, new_state); | ||
| sdev->fw_state = new_state; | ||
| switch (new_state) { | ||
| case SOF_FW_BOOT_NOT_STARTED: | ||
| case SOF_FW_BOOT_COMPLETE: | ||
| case SOF_FW_CRASHED: | ||
| sof_client_fw_state_dispatcher(sdev); | ||
| fallthrough; | ||
| default: | ||
| break; | ||
plbossart marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| } | ||
| EXPORT_SYMBOL(sof_set_fw_state); | ||
| /* | ||
| * FW Boot State Transition Diagram | ||
| * | ||
| @@ -266,6 +284,12 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) | ||
| goto fw_trace_err; | ||
| } | ||
| ret = sof_register_clients(sdev); | ||
| if (ret < 0) { | ||
| dev_err(sdev->dev, "failed to register clients %d\n", ret); | ||
| goto sof_machine_err; | ||
| } | ||
| /* | ||
| * Some platforms in SOF, ex: BYT, may not have their platform PM | ||
| * callbacks set. Increment the usage count so as to | ||
| @@ -281,6 +305,8 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) | ||
| return 0; | ||
| sof_machine_err: | ||
| snd_sof_machine_unregister(sdev, plat_data); | ||
| fw_trace_err: | ||
| snd_sof_free_trace(sdev); | ||
| fw_run_err: | ||
| @@ -329,10 +355,6 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) | ||
| sdev->pdata = plat_data; | ||
| sdev->first_boot = true; | ||
| sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); | ||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES) | ||
| sdev->extractor_stream_tag = SOF_PROBE_INVALID_NODE_ID; | ||
| #endif | ||
| dev_set_drvdata(dev, sdev); | ||
| /* check all mandatory ops */ | ||
| @@ -350,9 +372,14 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) | ||
| INIT_LIST_HEAD(&sdev->widget_list); | ||
| INIT_LIST_HEAD(&sdev->dai_list); | ||
| INIT_LIST_HEAD(&sdev->route_list); | ||
| INIT_LIST_HEAD(&sdev->ipc_client_list); | ||
| INIT_LIST_HEAD(&sdev->ipc_rx_handler_list); | ||
| INIT_LIST_HEAD(&sdev->fw_state_handler_list); | ||
| spin_lock_init(&sdev->ipc_lock); | ||
| spin_lock_init(&sdev->hw_lock); | ||
| mutex_init(&sdev->power_state_access); | ||
| mutex_init(&sdev->ipc_client_mutex); | ||
| mutex_init(&sdev->client_event_handler_mutex); | ||
| /* set default timeouts if none provided */ | ||
| if (plat_data->desc->ipc_timeout == 0) | ||
| @@ -364,6 +391,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) | ||
| else | ||
| sdev->boot_timeout = plat_data->desc->boot_timeout; | ||
| sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); | ||
| if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) { | ||
| INIT_WORK(&sdev->probe_work, sof_probe_work); | ||
| schedule_work(&sdev->probe_work); | ||
| @@ -391,6 +420,12 @@ int snd_sof_device_remove(struct device *dev) | ||
| if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) | ||
| cancel_work_sync(&sdev->probe_work); | ||
| /* | ||
| * Unregister any registered client device first before IPC and debugfs | ||
| * to allow client drivers to be removed cleanly | ||
| */ | ||
| sof_unregister_clients(sdev); | ||
| /* | ||
| * Unregister machine driver. This will unbind the snd_card which | ||
| * will remove the component driver and unload the topology | ||
| @@ -443,3 +478,4 @@ MODULE_AUTHOR("Liam Girdwood"); | ||
| MODULE_DESCRIPTION("Sound Open Firmware (SOF) Core"); | ||
| MODULE_LICENSE("Dual BSD/GPL"); | ||
| MODULE_ALIAS("platform:sof-audio"); | ||
| MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT); | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.