1 // SPDX-License-Identifier: MIT
3 * Copyright(c) 2020 Intel Corporation.
9 #include "intel_pxp_irq.h"
10 #include "intel_pxp_pm.h"
11 #include "intel_pxp_session.h"
12 #include "intel_pxp_types.h"
14 void intel_pxp_suspend_prepare(struct intel_pxp *pxp)
16 if (!intel_pxp_is_enabled(pxp))
21 intel_pxp_invalidate(pxp);
24 void intel_pxp_suspend(struct intel_pxp *pxp)
26 intel_wakeref_t wakeref;
28 if (!intel_pxp_is_enabled(pxp))
31 with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref) {
32 intel_pxp_fini_hw(pxp);
33 pxp->hw_state_invalidated = false;
37 static void _pxp_resume(struct intel_pxp *pxp, bool take_wakeref)
39 intel_wakeref_t wakeref;
41 if (!intel_pxp_is_enabled(pxp))
45 * The PXP component gets automatically unbound when we go into S3 and
46 * re-bound after we come out, so in that scenario we can defer the
47 * hw init to the bind call.
48 * NOTE: GSC-CS backend doesn't rely on components.
50 if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
54 wakeref = intel_runtime_pm_get(&pxp->ctrl_gt->i915->runtime_pm);
55 intel_pxp_init_hw(pxp);
57 intel_runtime_pm_put(&pxp->ctrl_gt->i915->runtime_pm, wakeref);
60 void intel_pxp_resume_complete(struct intel_pxp *pxp)
62 _pxp_resume(pxp, true);
65 void intel_pxp_runtime_resume(struct intel_pxp *pxp)
67 _pxp_resume(pxp, false);
70 void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
72 if (!intel_pxp_is_enabled(pxp))
75 pxp->arb_is_valid = false;
77 intel_pxp_fini_hw(pxp);
79 pxp->hw_state_invalidated = false;