Lines Matching +full:powered +full:- +full:off

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
21 #include "../sof-audio.h"
24 #include "hda-ipc.h"
56 dev_err(sdev->dev, in hda_dsp_core_reset_enter()
67 dev_err(sdev->dev, in hda_dsp_core_reset_enter()
70 ret = -EIO; in hda_dsp_core_reset_enter()
97 dev_err(sdev->dev, in hda_dsp_core_reset_leave()
107 dev_err(sdev->dev, in hda_dsp_core_reset_leave()
110 ret = -EIO; in hda_dsp_core_reset_leave()
138 dev_dbg(sdev->dev, "unstall/run core: core_mask = %x\n", core_mask); in hda_dsp_core_run()
147 dev_err(sdev->dev, "error: DSP start core failed: core_mask %x\n", in hda_dsp_core_run()
149 ret = -EIO; in hda_dsp_core_run()
178 dev_err(sdev->dev, in hda_dsp_core_power_up()
189 dev_err(sdev->dev, in hda_dsp_core_power_up()
192 ret = -EIO; in hda_dsp_core_power_up()
214 dev_err(sdev->dev, in hda_dsp_core_power_down()
241 dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", in hda_dsp_core_is_enabled()
249 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_enable_core()
250 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_dsp_enable_core()
254 core_mask &= chip->host_managed_cores_mask; in hda_dsp_enable_core()
263 dev_err(sdev->dev, "error: dsp core power up failed: core_mask %x\n", in hda_dsp_enable_core()
274 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_core_reset_power_down()
275 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_dsp_core_reset_power_down()
279 core_mask &= chip->host_managed_cores_mask; in hda_dsp_core_reset_power_down()
288 dev_err(sdev->dev, "error: dsp core reset failed: core_mask %x\n", in hda_dsp_core_reset_power_down()
296 dev_err(sdev->dev, "error: dsp core power down fail mask %x: %d\n", in hda_dsp_core_reset_power_down()
301 /* make sure we are in OFF state */ in hda_dsp_core_reset_power_down()
303 dev_err(sdev->dev, "error: dsp core disable fail mask %x: %d\n", in hda_dsp_core_reset_power_down()
305 ret = -EIO; in hda_dsp_core_reset_power_down()
313 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_ipc_int_enable()
314 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_dsp_ipc_int_enable()
317 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl, in hda_dsp_ipc_int_enable()
328 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_ipc_int_disable()
329 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_dsp_ipc_int_disable()
336 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl, in hda_dsp_ipc_int_disable()
346 if (!retry--) in hda_dsp_wait_d0i3c_done()
347 return -ETIMEDOUT; in hda_dsp_wait_d0i3c_done()
367 return sof_ipc_tx_message_no_pm(sdev->ipc, pm_gate.hdr.cmd, in hda_dsp_send_pm_gate_ipc()
377 /* Write to D0I3C after Command-In-Progress bit is cleared */ in hda_dsp_update_d0i3c_register()
380 dev_err(bus->dev, "CIP timeout before D0I3C update!\n"); in hda_dsp_update_d0i3c_register()
390 dev_err(bus->dev, "CIP timeout after D0I3C update!\n"); in hda_dsp_update_d0i3c_register()
394 dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n", in hda_dsp_update_d0i3c_register()
410 * 1. D3 -> D0I0 in hda_dsp_set_D0_state()
411 * 2. D0I0 -> D0I3 in hda_dsp_set_D0_state()
412 * 3. D0I3 -> D0I0 in hda_dsp_set_D0_state()
414 switch (sdev->dsp_power_state.state) { in hda_dsp_set_D0_state()
419 /* Follow regular flow for D3 -> D0 transition */ in hda_dsp_set_D0_state()
422 dev_err(sdev->dev, "error: transition from %d to %d not allowed\n", in hda_dsp_set_D0_state()
423 sdev->dsp_power_state.state, target_state->state); in hda_dsp_set_D0_state()
424 return -EINVAL; in hda_dsp_set_D0_state()
428 if (target_state->substate == SOF_HDA_DSP_PM_D0I3) { in hda_dsp_set_D0_state()
437 if (!sdev->dtrace_is_supported || in hda_dsp_set_D0_state()
439 sdev->system_suspend_target != SOF_SUSPEND_NONE) in hda_dsp_set_D0_state()
458 dev_err(sdev->dev, in hda_dsp_set_D0_state()
481 switch (sdev->dsp_power_state.state) { in hda_dsp_state_log()
483 switch (sdev->dsp_power_state.substate) { in hda_dsp_state_log()
485 dev_dbg(sdev->dev, "Current DSP power state: D0I0\n"); in hda_dsp_state_log()
488 dev_dbg(sdev->dev, "Current DSP power state: D0I3\n"); in hda_dsp_state_log()
491 dev_dbg(sdev->dev, "Unknown DSP D0 substate: %d\n", in hda_dsp_state_log()
492 sdev->dsp_power_state.substate); in hda_dsp_state_log()
497 dev_dbg(sdev->dev, "Current DSP power state: D1\n"); in hda_dsp_state_log()
500 dev_dbg(sdev->dev, "Current DSP power state: D2\n"); in hda_dsp_state_log()
503 dev_dbg(sdev->dev, "Current DSP power state: D3_HOT\n"); in hda_dsp_state_log()
506 dev_dbg(sdev->dev, "Current DSP power state: D3\n"); in hda_dsp_state_log()
509 dev_dbg(sdev->dev, "Current DSP power state: D3_COLD\n"); in hda_dsp_state_log()
512 dev_dbg(sdev->dev, "Unknown DSP power state: %d\n", in hda_dsp_state_log()
513 sdev->dsp_power_state.state); in hda_dsp_state_log()
537 if (target_state->substate == SOF_HDA_DSP_PM_D0I3 && in hda_dsp_set_power_state()
538 sdev->system_suspend_target == SOF_SUSPEND_S0IX) in hda_dsp_set_power_state()
545 if (target_state->state == sdev->dsp_power_state.state && in hda_dsp_set_power_state()
546 target_state->substate == sdev->dsp_power_state.substate) in hda_dsp_set_power_state()
550 switch (target_state->state) { in hda_dsp_set_power_state()
555 /* The only allowed transition is: D0I0 -> D3 */ in hda_dsp_set_power_state()
556 if (sdev->dsp_power_state.state == SOF_DSP_PM_D0 && in hda_dsp_set_power_state()
557 sdev->dsp_power_state.substate == SOF_HDA_DSP_PM_D0I0) in hda_dsp_set_power_state()
560 dev_err(sdev->dev, in hda_dsp_set_power_state()
562 sdev->dsp_power_state.state, target_state->state); in hda_dsp_set_power_state()
563 return -EINVAL; in hda_dsp_set_power_state()
565 dev_err(sdev->dev, "error: target state unsupported %d\n", in hda_dsp_set_power_state()
566 target_state->state); in hda_dsp_set_power_state()
567 return -EINVAL; in hda_dsp_set_power_state()
570 dev_err(sdev->dev, in hda_dsp_set_power_state()
572 target_state->state, target_state->substate); in hda_dsp_set_power_state()
576 sdev->dsp_power_state = *target_state; in hda_dsp_set_power_state()
582 * Audio DSP states may transform as below:-
585 * Runtime +---------------------+ Delayed D0i3 work timeout
586 * suspend | +--------------------+
587 * +------------+ D0I0(active) | |
588 * | | <---------------+ |
589 * | +--------> | New IPC | |
590 * | |Runtime +--^--+---------^--+--+ (via mailbox) | |
599 * +-v---+-----------+--v-------+ | | +------+----v----+
600 * | | | +-----------> |
602 * | | +--------------+ |
604 * +----------------------------+ +----------------+
606 * S0IX suspend: The DSP is in D0I3 if any D0I3-compatible streams
613 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_suspend()
614 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_suspend()
634 ret = snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask); in hda_suspend()
636 dev_err(sdev->dev, in hda_suspend()
655 dev_err(sdev->dev, in hda_suspend()
660 /* display codec can powered off after link reset */ in hda_suspend()
674 /* display codec must be powered before link reset */ in hda_resume()
686 dev_err(sdev->dev, in hda_resume()
695 if (sdev->system_suspend_target == SOF_SUSPEND_NONE) in hda_resume()
699 /* turn off the links that were off before suspend */ in hda_resume()
700 list_for_each_entry(hlink, &bus->hlink_list, list) { in hda_resume()
701 if (!hlink->ref_count) in hda_resume()
706 if (!bus->cmd_dma_state) in hda_resume()
715 /* display codec can powered off after controller init */ in hda_resume()
723 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_resume()
724 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_resume()
736 if (sdev->dsp_power_state.state == SOF_DSP_PM_D0) { in hda_dsp_resume()
739 list_for_each_entry(hlink, &bus->hlink_list, list) { in hda_dsp_resume()
740 if (hlink->ref_count) { in hda_dsp_resume()
743 dev_dbg(sdev->dev, in hda_dsp_resume()
752 if (bus->cmd_dma_state) in hda_dsp_resume()
759 dev_err(sdev->dev, "error: setting dsp state %d substate %d\n", in hda_dsp_resume()
765 if (hda->l1_support_changed) in hda_dsp_resume()
772 disable_irq_wake(pci->irq); in hda_dsp_resume()
776 /* init hda controller. DSP cores will be powered up during fw boot */ in hda_dsp_resume()
791 /* init hda controller. DSP cores will be powered up during fw boot */ in hda_dsp_runtime_resume()
803 if (hbus->codec_powered) { in hda_dsp_runtime_idle()
804 dev_dbg(sdev->dev, "some codecs still powered (%08X), not idle\n", in hda_dsp_runtime_idle()
805 (unsigned int)hbus->codec_powered); in hda_dsp_runtime_idle()
806 return -EBUSY; in hda_dsp_runtime_idle()
814 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_runtime_suspend()
821 cancel_delayed_work_sync(&hda->d0i3_work); in hda_dsp_runtime_suspend()
823 /* stop hda controller and power dsp off */ in hda_dsp_runtime_suspend()
833 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_suspend()
835 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_suspend()
844 cancel_delayed_work_sync(&hda->d0i3_work); in hda_dsp_suspend()
850 dev_err(sdev->dev, "error: setting dsp state %d substate %d\n", in hda_dsp_suspend()
857 hda->l1_support_changed = in hda_dsp_suspend()
865 if (bus->cmd_dma_state) in hda_dsp_suspend()
868 /* no link can be powered in s0ix state */ in hda_dsp_suspend()
871 dev_dbg(sdev->dev, in hda_dsp_suspend()
879 enable_irq_wake(pci->irq); in hda_dsp_suspend()
884 /* stop hda controller and power dsp off */ in hda_dsp_suspend()
887 dev_err(bus->dev, "error: suspending dsp\n"); in hda_dsp_suspend()
896 sdev->system_suspend_target = SOF_SUSPEND_S3; in hda_dsp_shutdown()
897 return snd_sof_suspend(sdev->dev); in hda_dsp_shutdown()
912 list_for_each_entry(s, &bus->stream_list, list) { in hda_dsp_set_hw_params_upon_resume()
921 if (stream->link_substream) { in hda_dsp_set_hw_params_upon_resume()
922 rtd = asoc_substream_to_rtd(stream->link_substream); in hda_dsp_set_hw_params_upon_resume()
923 name = asoc_rtd_to_codec(rtd, 0)->component->name; in hda_dsp_set_hw_params_upon_resume()
926 return -EINVAL; in hda_dsp_set_hw_params_upon_resume()
928 stream->link_prepared = 0; in hda_dsp_set_hw_params_upon_resume()
930 if (hdac_stream(stream)->direction == in hda_dsp_set_hw_params_upon_resume()
934 stream_tag = hdac_stream(stream)->stream_tag; in hda_dsp_set_hw_params_upon_resume()
947 struct hdac_bus *bus = &hdev->hbus.core; in hda_dsp_d0i3_work()
948 struct snd_sof_dev *sdev = dev_get_drvdata(bus->dev); in hda_dsp_d0i3_work()
955 /* DSP can enter D0I3 iff only D0I3-compatible streams are active */ in hda_dsp_d0i3_work()
963 dev_err_ratelimited(sdev->dev, in hda_dsp_d0i3_work()