Lines Matching refs:sdev

45 static void hda_get_interfaces(struct snd_sof_dev *sdev, u32 *interface_mask)  in hda_get_interfaces()  argument
49 chip = get_chip_info(sdev->pdata); in hda_get_interfaces()
85 u32 hda_get_interface_mask(struct snd_sof_dev *sdev) in hda_get_interface_mask() argument
89 hda_get_interfaces(sdev, interface_mask); in hda_get_interface_mask()
91 return interface_mask[sdev->dspless_mode_selected]; in hda_get_interface_mask()
95 bool hda_is_chain_dma_supported(struct snd_sof_dev *sdev, u32 dai_type) in hda_is_chain_dma_supported() argument
100 if (sdev->dspless_mode_selected) in hda_is_chain_dma_supported()
103 hda_get_interfaces(sdev, interface_mask); in hda_is_chain_dma_supported()
115 chip = get_chip_info(sdev->pdata); in hda_is_chain_dma_supported()
129 static int hda_dsp_core_reset_enter(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_reset_enter() argument
137 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in hda_dsp_core_reset_enter()
142 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in hda_dsp_core_reset_enter()
148 dev_err(sdev->dev, in hda_dsp_core_reset_enter()
155 adspcs = snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_dsp_core_reset_enter()
159 dev_err(sdev->dev, in hda_dsp_core_reset_enter()
168 static int hda_dsp_core_reset_leave(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_reset_leave() argument
175 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in hda_dsp_core_reset_leave()
182 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in hda_dsp_core_reset_leave()
189 dev_err(sdev->dev, in hda_dsp_core_reset_leave()
196 adspcs = snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_dsp_core_reset_leave()
199 dev_err(sdev->dev, in hda_dsp_core_reset_leave()
208 int hda_dsp_core_stall_reset(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_stall_reset() argument
211 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in hda_dsp_core_stall_reset()
217 return hda_dsp_core_reset_enter(sdev, core_mask); in hda_dsp_core_stall_reset()
221 bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_is_enabled() argument
226 val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS); in hda_dsp_core_is_enabled()
240 dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", in hda_dsp_core_is_enabled()
247 int hda_dsp_core_run(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_run() argument
252 ret = hda_dsp_core_reset_leave(sdev, core_mask); in hda_dsp_core_run()
257 dev_dbg(sdev->dev, "unstall/run core: core_mask = %x\n", core_mask); in hda_dsp_core_run()
258 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in hda_dsp_core_run()
264 if (!hda_dsp_core_is_enabled(sdev, core_mask)) { in hda_dsp_core_run()
265 hda_dsp_core_stall_reset(sdev, core_mask); in hda_dsp_core_run()
266 dev_err(sdev->dev, "error: DSP start core failed: core_mask %x\n", in hda_dsp_core_run()
279 int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_power_up() argument
281 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_core_power_up()
294 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS, in hda_dsp_core_power_up()
300 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in hda_dsp_core_power_up()
306 dev_err(sdev->dev, in hda_dsp_core_power_up()
313 adspcs = snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_dsp_core_power_up()
317 dev_err(sdev->dev, in hda_dsp_core_power_up()
327 static int hda_dsp_core_power_down(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_power_down() argument
333 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in hda_dsp_core_power_down()
337 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in hda_dsp_core_power_down()
343 dev_err(sdev->dev, in hda_dsp_core_power_down()
350 int hda_dsp_enable_core(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_enable_core() argument
352 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_enable_core()
360 if (!core_mask || hda_dsp_core_is_enabled(sdev, core_mask)) in hda_dsp_enable_core()
364 ret = hda_dsp_core_power_up(sdev, core_mask); in hda_dsp_enable_core()
366 dev_err(sdev->dev, "error: dsp core power up failed: core_mask %x\n", in hda_dsp_enable_core()
371 return hda_dsp_core_run(sdev, core_mask); in hda_dsp_enable_core()
375 int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev, in hda_dsp_core_reset_power_down() argument
378 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_core_reset_power_down()
390 ret = hda_dsp_core_stall_reset(sdev, core_mask); in hda_dsp_core_reset_power_down()
392 dev_err(sdev->dev, "error: dsp core reset failed: core_mask %x\n", in hda_dsp_core_reset_power_down()
398 ret = hda_dsp_core_power_down(sdev, core_mask); in hda_dsp_core_reset_power_down()
400 dev_err(sdev->dev, "error: dsp core power down fail mask %x: %d\n", in hda_dsp_core_reset_power_down()
406 if (hda_dsp_core_is_enabled(sdev, core_mask)) { in hda_dsp_core_reset_power_down()
407 dev_err(sdev->dev, "error: dsp core disable fail mask %x: %d\n", in hda_dsp_core_reset_power_down()
416 void hda_dsp_ipc_int_enable(struct snd_sof_dev *sdev) in hda_dsp_ipc_int_enable() argument
418 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_ipc_int_enable()
421 if (sdev->dspless_mode_selected) in hda_dsp_ipc_int_enable()
425 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl, in hda_dsp_ipc_int_enable()
430 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIC, in hda_dsp_ipc_int_enable()
435 void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev) in hda_dsp_ipc_int_disable() argument
437 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_ipc_int_disable()
440 if (sdev->dspless_mode_selected) in hda_dsp_ipc_int_disable()
444 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIC, in hda_dsp_ipc_int_disable()
448 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl, in hda_dsp_ipc_int_disable()
453 static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev) in hda_dsp_wait_d0i3c_done() argument
456 struct snd_sof_pdata *pdata = sdev->pdata; in hda_dsp_wait_d0i3c_done()
460 while (snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset) & in hda_dsp_wait_d0i3c_done()
470 static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags) in hda_dsp_send_pm_gate_ipc() argument
472 const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm); in hda_dsp_send_pm_gate_ipc()
475 return pm_ops->set_pm_gate(sdev, flags); in hda_dsp_send_pm_gate_ipc()
480 static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value) in hda_dsp_update_d0i3c_register() argument
482 struct snd_sof_pdata *pdata = sdev->pdata; in hda_dsp_update_d0i3c_register()
490 ret = hda_dsp_wait_d0i3c_done(sdev); in hda_dsp_update_d0i3c_register()
492 dev_err(sdev->dev, "CIP timeout before D0I3C update!\n"); in hda_dsp_update_d0i3c_register()
497 snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset, in hda_dsp_update_d0i3c_register()
507 ret = hda_dsp_wait_d0i3c_done(sdev); in hda_dsp_update_d0i3c_register()
509 dev_err(sdev->dev, "CIP timeout after D0I3C update!\n"); in hda_dsp_update_d0i3c_register()
513 reg = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset); in hda_dsp_update_d0i3c_register()
516 dev_err(sdev->dev, "failed to update D0I3C!\n"); in hda_dsp_update_d0i3c_register()
520 trace_sof_intel_D0I3C_updated(sdev, reg); in hda_dsp_update_d0i3c_register()
529 static bool hda_dsp_d0i3_streaming_applicable(struct snd_sof_dev *sdev) in hda_dsp_d0i3_streaming_applicable() argument
536 list_for_each_entry(spcm, &sdev->pcm_list, list) { in hda_dsp_d0i3_streaming_applicable()
553 static int hda_dsp_set_D0_state(struct snd_sof_dev *sdev, in hda_dsp_set_D0_state() argument
567 switch (sdev->dsp_power_state.state) { in hda_dsp_set_D0_state()
575 dev_err(sdev->dev, "error: transition from %d to %d not allowed\n", in hda_dsp_set_D0_state()
576 sdev->dsp_power_state.state, target_state->state); in hda_dsp_set_D0_state()
590 if (!sdev->fw_trace_is_supported || in hda_dsp_set_D0_state()
592 sdev->system_suspend_target != SOF_SUSPEND_NONE) in hda_dsp_set_D0_state()
595 if (hda_dsp_d0i3_streaming_applicable(sdev)) in hda_dsp_set_D0_state()
603 ret = hda_dsp_update_d0i3c_register(sdev, value); in hda_dsp_set_D0_state()
612 ret = hda_dsp_send_pm_gate_ipc(sdev, flags); in hda_dsp_set_D0_state()
614 dev_err(sdev->dev, in hda_dsp_set_D0_state()
629 hda_dsp_update_d0i3c_register(sdev, value); in hda_dsp_set_D0_state()
635 static void hda_dsp_state_log(struct snd_sof_dev *sdev) in hda_dsp_state_log() argument
637 switch (sdev->dsp_power_state.state) { in hda_dsp_state_log()
639 switch (sdev->dsp_power_state.substate) { in hda_dsp_state_log()
641 dev_dbg(sdev->dev, "Current DSP power state: D0I0\n"); in hda_dsp_state_log()
644 dev_dbg(sdev->dev, "Current DSP power state: D0I3\n"); in hda_dsp_state_log()
647 dev_dbg(sdev->dev, "Unknown DSP D0 substate: %d\n", in hda_dsp_state_log()
648 sdev->dsp_power_state.substate); in hda_dsp_state_log()
653 dev_dbg(sdev->dev, "Current DSP power state: D1\n"); in hda_dsp_state_log()
656 dev_dbg(sdev->dev, "Current DSP power state: D2\n"); in hda_dsp_state_log()
659 dev_dbg(sdev->dev, "Current DSP power state: D3\n"); in hda_dsp_state_log()
662 dev_dbg(sdev->dev, "Unknown DSP power state: %d\n", in hda_dsp_state_log()
663 sdev->dsp_power_state.state); in hda_dsp_state_log()
675 static int hda_dsp_set_power_state(struct snd_sof_dev *sdev, in hda_dsp_set_power_state() argument
682 ret = hda_dsp_set_D0_state(sdev, target_state); in hda_dsp_set_power_state()
686 if (sdev->dsp_power_state.state == SOF_DSP_PM_D0 && in hda_dsp_set_power_state()
687 sdev->dsp_power_state.substate == SOF_HDA_DSP_PM_D0I0) in hda_dsp_set_power_state()
690 dev_err(sdev->dev, in hda_dsp_set_power_state()
692 sdev->dsp_power_state.state, target_state->state); in hda_dsp_set_power_state()
695 dev_err(sdev->dev, "error: target state unsupported %d\n", in hda_dsp_set_power_state()
700 dev_err(sdev->dev, in hda_dsp_set_power_state()
706 sdev->dsp_power_state = *target_state; in hda_dsp_set_power_state()
707 hda_dsp_state_log(sdev); in hda_dsp_set_power_state()
711 int hda_dsp_set_power_state_ipc3(struct snd_sof_dev *sdev, in hda_dsp_set_power_state_ipc3() argument
722 sdev->system_suspend_target == SOF_SUSPEND_S0IX) in hda_dsp_set_power_state_ipc3()
723 return hda_dsp_set_power_state(sdev, target_state); in hda_dsp_set_power_state_ipc3()
729 if (target_state->state == sdev->dsp_power_state.state && in hda_dsp_set_power_state_ipc3()
730 target_state->substate == sdev->dsp_power_state.substate) in hda_dsp_set_power_state_ipc3()
733 return hda_dsp_set_power_state(sdev, target_state); in hda_dsp_set_power_state_ipc3()
737 int hda_dsp_set_power_state_ipc4(struct snd_sof_dev *sdev, in hda_dsp_set_power_state_ipc4() argument
741 if (target_state->state == sdev->dsp_power_state.state && in hda_dsp_set_power_state_ipc4()
742 target_state->substate == sdev->dsp_power_state.substate) in hda_dsp_set_power_state_ipc4()
745 return hda_dsp_set_power_state(sdev, target_state); in hda_dsp_set_power_state_ipc4()
779 static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend) in hda_suspend() argument
781 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_suspend()
783 struct hdac_bus *bus = sof_to_bus(sdev); in hda_suspend()
795 if (sdev->system_suspend_target > SOF_SUSPEND_S3 || in hda_suspend()
797 sdev->system_suspend_target == SOF_SUSPEND_S3)) in hda_suspend()
804 if (imr_lost || sdev->fw_state == SOF_FW_CRASHED || in hda_suspend()
805 sdev->fw_state == SOF_FW_BOOT_FAILED) in hda_suspend()
808 ret = chip->disable_interrupts(sdev); in hda_suspend()
813 synchronize_irq(sdev->ipc_irq); in hda_suspend()
815 hda_codec_jack_wake_enable(sdev, runtime_suspend); in hda_suspend()
820 if (sdev->dspless_mode_selected) in hda_suspend()
823 ret = chip->power_down_dsp(sdev); in hda_suspend()
825 dev_err(sdev->dev, "failed to power down DSP during suspend\n"); in hda_suspend()
831 sdev->dsp_core_ref_count[j] = 0; in hda_suspend()
834 hda_dsp_ctrl_ppcap_enable(sdev, false); in hda_suspend()
835 hda_dsp_ctrl_ppcap_int_enable(sdev, false); in hda_suspend()
839 hda_dsp_ctrl_stop_chip(sdev); in hda_suspend()
842 snd_sof_pci_update_bits(sdev, PCI_PGCTL, in hda_suspend()
846 ret = hda_dsp_ctrl_link_reset(sdev, true); in hda_suspend()
848 dev_err(sdev->dev, in hda_suspend()
854 hda_codec_i915_display_power(sdev, false); in hda_suspend()
859 static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) in hda_resume() argument
864 hda_codec_i915_display_power(sdev, true); in hda_resume()
870 snd_sof_pci_update_bits(sdev, PCI_TCSEL, 0x07, 0); in hda_resume()
873 ret = hda_dsp_ctrl_init_chip(sdev); in hda_resume()
875 dev_err(sdev->dev, in hda_resume()
882 hda_codec_jack_wake_enable(sdev, false); in hda_resume()
883 if (sdev->system_suspend_target == SOF_SUSPEND_NONE) in hda_resume()
884 hda_codec_jack_check(sdev); in hda_resume()
887 if (!sdev->dspless_mode_selected) { in hda_resume()
889 hda_dsp_ctrl_ppcap_enable(sdev, true); in hda_resume()
890 hda_dsp_ctrl_ppcap_int_enable(sdev, true); in hda_resume()
895 hda_codec_i915_display_power(sdev, false); in hda_resume()
900 int hda_dsp_resume(struct snd_sof_dev *sdev) in hda_dsp_resume() argument
902 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_resume()
903 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_resume()
904 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_resume()
912 if (sdev->dsp_power_state.state == SOF_DSP_PM_D0) { in hda_dsp_resume()
915 dev_err(sdev->dev, in hda_dsp_resume()
922 hda_codec_resume_cmd_io(sdev); in hda_dsp_resume()
925 ret = snd_sof_dsp_set_power_state(sdev, &target_state); in hda_dsp_resume()
927 dev_err(sdev->dev, "error: setting dsp state %d substate %d\n", in hda_dsp_resume()
934 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_resume()
945 ret = hda_resume(sdev, false); in hda_dsp_resume()
949 return snd_sof_dsp_set_power_state(sdev, &target_state); in hda_dsp_resume()
953 int hda_dsp_runtime_resume(struct snd_sof_dev *sdev) in hda_dsp_runtime_resume() argument
961 ret = hda_resume(sdev, true); in hda_dsp_runtime_resume()
965 return snd_sof_dsp_set_power_state(sdev, &target_state); in hda_dsp_runtime_resume()
969 int hda_dsp_runtime_idle(struct snd_sof_dev *sdev) in hda_dsp_runtime_idle() argument
971 struct hdac_bus *hbus = sof_to_bus(sdev); in hda_dsp_runtime_idle()
974 dev_dbg(sdev->dev, "some codecs still powered (%08X), not idle\n", in hda_dsp_runtime_idle()
983 int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev) in hda_dsp_runtime_suspend() argument
985 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_runtime_suspend()
991 if (!sdev->dspless_mode_selected) { in hda_dsp_runtime_suspend()
997 ret = hda_suspend(sdev, true); in hda_dsp_runtime_suspend()
1001 return snd_sof_dsp_set_power_state(sdev, &target_state); in hda_dsp_runtime_suspend()
1005 int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state) in hda_dsp_suspend() argument
1007 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_suspend()
1008 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_suspend()
1009 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_suspend()
1017 if (!sdev->dspless_mode_selected) { in hda_dsp_suspend()
1024 ret = snd_sof_dsp_set_power_state(sdev, &target_dsp_state); in hda_dsp_suspend()
1026 dev_err(sdev->dev, "error: setting dsp state %d substate %d\n", in hda_dsp_suspend()
1034 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, HDA_VS_INTEL_EM2, in hda_dsp_suspend()
1038 hda_codec_suspend_cmd_io(sdev); in hda_dsp_suspend()
1043 dev_err(sdev->dev, in hda_dsp_suspend()
1056 ret = hda_suspend(sdev, false); in hda_dsp_suspend()
1062 return snd_sof_dsp_set_power_state(sdev, &target_dsp_state); in hda_dsp_suspend()
1066 static unsigned int hda_dsp_check_for_dma_streams(struct snd_sof_dev *sdev) in hda_dsp_check_for_dma_streams() argument
1068 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_check_for_dma_streams()
1076 val = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, in hda_dsp_check_for_dma_streams()
1085 static int hda_dsp_s5_quirk(struct snd_sof_dev *sdev) in hda_dsp_s5_quirk() argument
1101 ret = hda_dsp_ctrl_link_reset(sdev, false); in hda_dsp_s5_quirk()
1108 ret = hda_dsp_ctrl_link_reset(sdev, true); in hda_dsp_s5_quirk()
1115 int hda_dsp_shutdown_dma_flush(struct snd_sof_dev *sdev) in hda_dsp_shutdown_dma_flush() argument
1121 active_streams = hda_dsp_check_for_dma_streams(sdev); in hda_dsp_shutdown_dma_flush()
1123 sdev->system_suspend_target = SOF_SUSPEND_S3; in hda_dsp_shutdown_dma_flush()
1124 ret = snd_sof_suspend(sdev->dev); in hda_dsp_shutdown_dma_flush()
1127 dev_warn(sdev->dev, in hda_dsp_shutdown_dma_flush()
1130 ret2 = hda_dsp_s5_quirk(sdev); in hda_dsp_shutdown_dma_flush()
1132 dev_err(sdev->dev, "shutdown recovery failed (%d)\n", ret2); in hda_dsp_shutdown_dma_flush()
1139 int hda_dsp_shutdown(struct snd_sof_dev *sdev) in hda_dsp_shutdown() argument
1141 sdev->system_suspend_target = SOF_SUSPEND_S3; in hda_dsp_shutdown()
1142 return snd_sof_suspend(sdev->dev); in hda_dsp_shutdown()
1146 int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev) in hda_dsp_set_hw_params_upon_resume() argument
1151 ret = hda_dsp_dais_suspend(sdev); in hda_dsp_set_hw_params_upon_resume()
1153 dev_warn(sdev->dev, "%s: failure in hda_dsp_dais_suspend\n", __func__); in hda_dsp_set_hw_params_upon_resume()
1165 struct snd_sof_dev *sdev = dev_get_drvdata(bus->dev); in hda_dsp_d0i3_work() local
1173 if (!snd_sof_dsp_only_d0i3_compatible_stream_active(sdev)) in hda_dsp_d0i3_work()
1178 ret = snd_sof_dsp_set_power_state(sdev, &target_state); in hda_dsp_d0i3_work()
1180 dev_err_ratelimited(sdev->dev, in hda_dsp_d0i3_work()
1186 int hda_dsp_core_get(struct snd_sof_dev *sdev, int core) in hda_dsp_core_get() argument
1188 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; in hda_dsp_core_get()
1192 ret = hda_dsp_enable_core(sdev, BIT(core)); in hda_dsp_core_get()
1194 dev_err(sdev->dev, "failed to power up core %d with err: %d\n", in hda_dsp_core_get()
1200 if (sdev->fw_state != SOF_FW_BOOT_COMPLETE || core == SOF_DSP_PRIMARY_CORE) in hda_dsp_core_get()
1208 ret = pm_ops->set_core_state(sdev, core, true); in hda_dsp_core_get()
1210 dev_err(sdev->dev, "failed to enable secondary core '%d' failed with %d\n", in hda_dsp_core_get()
1219 ret1 = hda_dsp_core_reset_power_down(sdev, BIT(core)); in hda_dsp_core_get()
1221 dev_err(sdev->dev, "failed to power down core: %d with err: %d\n", core, ret1); in hda_dsp_core_get()
1228 void hda_common_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable) in hda_common_enable_sdw_irq() argument
1232 hdev = sdev->pdata->hw_pdata; in hda_common_enable_sdw_irq()
1237 snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIC2, in hda_common_enable_sdw_irq()
1243 void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) in hda_sdw_int_enable() argument
1245 u32 interface_mask = hda_get_interface_mask(sdev); in hda_sdw_int_enable()
1251 chip = get_chip_info(sdev->pdata); in hda_sdw_int_enable()
1253 chip->enable_sdw_irq(sdev, enable); in hda_sdw_int_enable()
1257 int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev) in hda_sdw_check_lcount_common() argument
1263 hdev = sdev->pdata->hw_pdata; in hda_sdw_check_lcount_common()
1266 caps = snd_sof_dsp_read(sdev, HDA_DSP_BAR, ctx->shim_base + SDW_SHIM_LCAP); in hda_sdw_check_lcount_common()
1271 dev_err(sdev->dev, in hda_sdw_check_lcount_common()
1281 int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev) in hda_sdw_check_lcount_ext() argument
1288 bus = sof_to_bus(sdev); in hda_sdw_check_lcount_ext()
1290 hdev = sdev->pdata->hw_pdata; in hda_sdw_check_lcount_ext()
1297 dev_err(sdev->dev, in hda_sdw_check_lcount_ext()
1307 int hda_sdw_check_lcount(struct snd_sof_dev *sdev) in hda_sdw_check_lcount() argument
1311 chip = get_chip_info(sdev->pdata); in hda_sdw_check_lcount()
1313 return chip->read_sdw_lcount(sdev); in hda_sdw_check_lcount()
1319 void hda_sdw_process_wakeen(struct snd_sof_dev *sdev) in hda_sdw_process_wakeen() argument
1321 u32 interface_mask = hda_get_interface_mask(sdev); in hda_sdw_process_wakeen()
1327 chip = get_chip_info(sdev->pdata); in hda_sdw_process_wakeen()
1329 chip->sdw_process_wakeen(sdev); in hda_sdw_process_wakeen()
1335 int hda_dsp_disable_interrupts(struct snd_sof_dev *sdev) in hda_dsp_disable_interrupts() argument
1337 hda_sdw_int_enable(sdev, false); in hda_dsp_disable_interrupts()
1338 hda_dsp_ipc_int_disable(sdev); in hda_dsp_disable_interrupts()
1483 void hda_dsp_get_state(struct snd_sof_dev *sdev, const char *level) in hda_dsp_get_state() argument
1485 const struct sof_intel_dsp_desc *chip = get_chip_info(sdev->pdata); in hda_dsp_get_state()
1489 fsr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, chip->rom_status_reg); in hda_dsp_get_state()
1515 dev_printk(level, sdev->dev, "%#010x: unknown ROM status value\n", fsr); in hda_dsp_get_state()
1527 dev_printk(level, sdev->dev, in hda_dsp_get_state()
1532 dev_printk(level, sdev->dev, "%#010x: module: %s, state: %s, %s\n", in hda_dsp_get_state()
1537 error_code = snd_sof_dsp_read(sdev, HDA_DSP_BAR, chip->rom_status_reg + 4); in hda_dsp_get_state()
1547 dev_printk(level, sdev->dev, "status code: %#x (%s)\n", error_code, in hda_dsp_get_state()
1550 dev_printk(level, sdev->dev, "error code: %#x (%s)\n", error_code, in hda_dsp_get_state()
1555 static void hda_dsp_get_registers(struct snd_sof_dev *sdev, in hda_dsp_get_registers() argument
1560 u32 offset = sdev->dsp_oops_offset; in hda_dsp_get_registers()
1563 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); in hda_dsp_get_registers()
1569 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in hda_dsp_get_registers()
1574 sof_block_read(sdev, sdev->mmio_bar, offset, in hda_dsp_get_registers()
1579 sof_block_read(sdev, sdev->mmio_bar, offset, stack, in hda_dsp_get_registers()
1584 void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, const char *level, in hda_dsp_dump_ext_rom_status() argument
1593 chip = get_chip_info(sdev->pdata); in hda_dsp_dump_ext_rom_status()
1595 value = snd_sof_dsp_read(sdev, HDA_DSP_BAR, chip->rom_status_reg + i * 0x4); in hda_dsp_dump_ext_rom_status()
1599 dev_printk(level, sdev->dev, "extended rom status: %s", msg); in hda_dsp_dump_ext_rom_status()
1603 void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags) in hda_dsp_dump() argument
1611 hda_dsp_get_state(sdev, level); in hda_dsp_dump()
1614 if (flags & SOF_DBG_DUMP_REGS && sdev->pdata->ipc_type == SOF_IPC_TYPE_3) { in hda_dsp_dump()
1615 u32 status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_STATUS); in hda_dsp_dump()
1616 u32 panic = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_TRACEP); in hda_dsp_dump()
1618 hda_dsp_get_registers(sdev, &xoops, &panic_info, stack, in hda_dsp_dump()
1620 sof_print_oops_and_stack(sdev, level, status, panic, &xoops, in hda_dsp_dump()
1623 hda_dsp_dump_ext_rom_status(sdev, level, flags); in hda_dsp_dump()