Lines Matching +full:power +full:- +full:gated
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
16 #include "../ipc4-priv.h"
19 #include "hda-ipc.h"
20 #include "../sof-audio.h"
49 * set DONE bit - tell DSP we have received the reply msg from DSP, and processed it, in mtl_ipc_dsp_done()
66 if (sdev->dspless_mode_selected) in mtl_dsp_check_ipc_irq()
100 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in mtl_ipc_send_msg()
101 struct sof_ipc4_msg *msg_data = msg->msg_data; in mtl_ipc_send_msg()
104 hdev->delayed_ipc_tx_msg = msg; in mtl_ipc_send_msg()
108 hdev->delayed_ipc_tx_msg = NULL; in mtl_ipc_send_msg()
111 if (msg_data->data_size) in mtl_ipc_send_msg()
112 sof_mailbox_write(sdev, sdev->host_box.offset, msg_data->data_ptr, in mtl_ipc_send_msg()
113 msg_data->data_size); in mtl_ipc_send_msg()
116 msg_data->extension); in mtl_ipc_send_msg()
118 msg_data->primary | MTL_DSP_REG_HFIPCXIDR_BUSY); in mtl_ipc_send_msg()
128 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in mtl_enable_ipc_interrupts()
129 const struct sof_intel_dsp_desc *chip = hda->desc; in mtl_enable_ipc_interrupts()
131 if (sdev->dspless_mode_selected) in mtl_enable_ipc_interrupts()
135 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl, in mtl_enable_ipc_interrupts()
142 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in mtl_disable_ipc_interrupts()
143 const struct sof_intel_dsp_desc *chip = hda->desc; in mtl_disable_ipc_interrupts()
145 if (sdev->dspless_mode_selected) in mtl_disable_ipc_interrupts()
149 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl, in mtl_disable_ipc_interrupts()
161 if (sdev->dspless_mode_selected) in mtl_enable_sdw_irq()
178 dev_err(sdev->dev, "failed to set SoundWire IPC interrupt %s\n", in mtl_enable_sdw_irq()
191 if (sdev->dspless_mode_selected) in mtl_enable_interrupts()
211 dev_err(sdev->dev, "failed to %s Host IPC and/or SOUNDWIRE\n", in mtl_enable_interrupts()
230 dev_err(sdev->dev, "failed to set Host IPC interrupt %s\n", in mtl_enable_interrupts()
242 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in mtl_dsp_pre_fw_run()
252 chip = get_chip_info(sdev->pdata); in mtl_dsp_pre_fw_run()
253 if (chip->hw_ip_version > SOF_INTEL_ACE_2_0) { in mtl_dsp_pre_fw_run()
261 /* Set the DSP subsystem power on */ in mtl_dsp_pre_fw_run()
274 dev_err(sdev->dev, "failed to enable DSP subsystem\n"); in mtl_dsp_pre_fw_run()
278 /* Power up gated-DSP-0 domain in order to access the DSP shim register block. */ in mtl_dsp_pre_fw_run()
291 dev_err(sdev->dev, "failed to power up gated DSP domain\n"); in mtl_dsp_pre_fw_run()
293 /* if SoundWire is used, make sure it is not power-gated */ in mtl_dsp_pre_fw_run()
294 if (hdev->info.handle && hdev->info.link_mask > 0) in mtl_dsp_pre_fw_run()
306 if (sdev->first_boot) { in mtl_dsp_post_fw_run()
307 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in mtl_dsp_post_fw_run()
311 dev_err(sdev->dev, "could not startup SoundWire links\n"); in mtl_dsp_post_fw_run()
317 hdev->imrboot_supported = true; in mtl_dsp_post_fw_run()
319 0644, sdev->debugfs_root, in mtl_dsp_post_fw_run()
320 &hdev->skip_imr_boot); in mtl_dsp_post_fw_run()
340 dev_err(sdev->dev, "Firmware state: %#x, status/error code: %#x\n", in mtl_dsp_dump()
387 dev_err(sdev->dev, "%s: timeout on MTL_DSP2CXCTL_PRIMARY_CORE read\n", in mtl_dsp_core_power_up()
393 sdev->enabled_cores_mask = BIT(SOF_DSP_PRIMARY_CORE); in mtl_dsp_core_power_up()
394 sdev->dsp_core_ref_count[SOF_DSP_PRIMARY_CORE] = 1; in mtl_dsp_core_power_up()
420 dev_err(sdev->dev, "failed to power down primary core\n"); in mtl_dsp_core_power_down()
424 sdev->enabled_cores_mask = 0; in mtl_dsp_core_power_down()
425 sdev->dsp_core_ref_count[SOF_DSP_PRIMARY_CORE] = 0; in mtl_dsp_core_power_down()
435 /* first power down core */ in mtl_power_down_dsp()
438 dev_err(sdev->dev, "mtl dsp power down error, %d\n", ret); in mtl_power_down_dsp()
442 /* Set the DSP subsystem power down */ in mtl_power_down_dsp()
460 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in mtl_dsp_cl_init()
461 const struct sof_intel_dsp_desc *chip = hda->desc; in mtl_dsp_cl_init()
468 ipc_hdr = chip->ipc_req_mask | HDA_DSP_ROM_IPC_CONTROL; in mtl_dsp_cl_init()
470 ipc_hdr |= HDA_DSP_ROM_IPC_PURGE_FW | ((stream_tag - 1) << 9); in mtl_dsp_cl_init()
472 snd_sof_dsp_write(sdev, HDA_DSP_BAR, chip->ipc_req, ipc_hdr); in mtl_dsp_cl_init()
474 /* step 2: power up primary core */ in mtl_dsp_cl_init()
477 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in mtl_dsp_cl_init()
478 dev_err(sdev->dev, "dsp core 0/1 power up failed\n"); in mtl_dsp_cl_init()
482 dev_dbg(sdev->dev, "Primary core power up successful\n"); in mtl_dsp_cl_init()
485 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, chip->ipc_ack, status, in mtl_dsp_cl_init()
486 ((status & chip->ipc_ack_mask) == chip->ipc_ack_mask), in mtl_dsp_cl_init()
489 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in mtl_dsp_cl_init()
490 dev_err(sdev->dev, "timeout waiting for purge IPC done\n"); in mtl_dsp_cl_init()
495 snd_sof_dsp_update_bits_forced(sdev, HDA_DSP_BAR, chip->ipc_ack, chip->ipc_ack_mask, in mtl_dsp_cl_init()
496 chip->ipc_ack_mask); in mtl_dsp_cl_init()
501 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in mtl_dsp_cl_init()
502 dev_err(sdev->dev, "%s: failed to enable interrupts\n", __func__); in mtl_dsp_cl_init()
508 if (chip->rom_status_reg == MTL_DSP_ROM_STS) { in mtl_dsp_cl_init()
520 * - Cold/Full boot: wait for ROM init to proceed to download the firmware in mtl_dsp_cl_init()
521 * - IMR boot: wait for ROM firmware entered (firmware booted up from IMR) in mtl_dsp_cl_init()
529 chip->rom_status_reg, status, in mtl_dsp_cl_init()
532 chip->rom_init_timeout * in mtl_dsp_cl_init()
538 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in mtl_dsp_cl_init()
539 dev_err(sdev->dev, in mtl_dsp_cl_init()
541 __func__, chip->rom_status_reg); in mtl_dsp_cl_init()
547 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in mtl_dsp_cl_init()
551 hda->boot_iteration, HDA_FW_BOOT_ATTEMPTS); in mtl_dsp_cl_init()
596 if (likely(sdev->fw_state == SOF_FW_BOOT_COMPLETE)) { in mtl_ipc_irq_thread()
597 struct sof_ipc4_msg *data = sdev->ipc->msg.reply_data; in mtl_ipc_irq_thread()
599 data->primary = primary; in mtl_ipc_irq_thread()
600 data->extension = extension; in mtl_ipc_irq_thread()
602 spin_lock_irq(&sdev->ipc_lock); in mtl_ipc_irq_thread()
606 snd_sof_ipc_reply(sdev, data->primary); in mtl_ipc_irq_thread()
608 spin_unlock_irq(&sdev->ipc_lock); in mtl_ipc_irq_thread()
610 dev_dbg_ratelimited(sdev->dev, in mtl_ipc_irq_thread()
619 sdev->ipc->msg.rx_data = ¬ification_data; in mtl_ipc_irq_thread()
621 sdev->ipc->msg.rx_data = NULL; in mtl_ipc_irq_thread()
631 dev_dbg_ratelimited(sdev->dev, "nothing to do in IPC IRQ thread\n"); in mtl_ipc_irq_thread()
635 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in mtl_ipc_irq_thread()
637 if (hdev->delayed_ipc_tx_msg) in mtl_ipc_irq_thread()
638 mtl_ipc_send_msg(sdev, hdev->delayed_ipc_tx_msg); in mtl_ipc_irq_thread()
669 dev_err(sdev->dev, in mtl_ipc_dump()
684 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; in mtl_dsp_core_get()
689 if (pm_ops->set_core_state) in mtl_dsp_core_get()
690 return pm_ops->set_core_state(sdev, core, true); in mtl_dsp_core_get()
698 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; in mtl_dsp_core_put()
701 if (pm_ops->set_core_state) { in mtl_dsp_core_put()
702 ret = pm_ops->set_core_state(sdev, core, false); in mtl_dsp_core_put()
752 sdev->private = kzalloc(sizeof(struct sof_ipc4_fw_data), GFP_KERNEL); in sof_mtl_ops_init()
753 if (!sdev->private) in sof_mtl_ops_init()
754 return -ENOMEM; in sof_mtl_ops_init()
756 ipc4_data = sdev->private; in sof_mtl_ops_init()
757 ipc4_data->manifest_fw_hdr_offset = SOF_MAN4_FW_HDR_OFFSET; in sof_mtl_ops_init()
759 ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; in sof_mtl_ops_init()
761 ipc4_data->fw_context_save = true; in sof_mtl_ops_init()
764 ipc4_data->load_library = hda_dsp_ipc4_load_library; in sof_mtl_ops_init()