1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright(c) 2020 Intel Corporation. 4 */ 5 6 #include "i915_drv.h" 7 8 #include "intel_pxp.h" 9 #include "intel_pxp_irq.h" 10 #include "intel_pxp_pm.h" 11 #include "intel_pxp_session.h" 12 #include "intel_pxp_types.h" 13 14 void intel_pxp_suspend_prepare(struct intel_pxp *pxp) 15 { 16 if (!intel_pxp_is_enabled(pxp)) 17 return; 18 19 intel_pxp_end(pxp); 20 21 intel_pxp_invalidate(pxp); 22 } 23 24 void intel_pxp_suspend(struct intel_pxp *pxp) 25 { 26 intel_wakeref_t wakeref; 27 28 if (!intel_pxp_is_enabled(pxp)) 29 return; 30 31 with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref) { 32 intel_pxp_fini_hw(pxp); 33 pxp->hw_state_invalidated = false; 34 } 35 } 36 37 void intel_pxp_resume_complete(struct intel_pxp *pxp) 38 { 39 if (!intel_pxp_is_enabled(pxp)) 40 return; 41 42 /* 43 * The PXP component gets automatically unbound when we go into S3 and 44 * re-bound after we come out, so in that scenario we can defer the 45 * hw init to the bind call. 46 */ 47 if (!pxp->pxp_component) 48 return; 49 50 intel_pxp_init_hw(pxp); 51 } 52 53 void intel_pxp_runtime_suspend(struct intel_pxp *pxp) 54 { 55 if (!intel_pxp_is_enabled(pxp)) 56 return; 57 58 pxp->arb_is_valid = false; 59 60 intel_pxp_fini_hw(pxp); 61 62 pxp->hw_state_invalidated = false; 63 } 64