1 /* 2 * SPDX-License-Identifier: MIT 3 * 4 * Copyright © 2019 Intel Corporation 5 */ 6 7 #ifndef INTEL_GT_PM_H 8 #define INTEL_GT_PM_H 9 10 #include <linux/types.h> 11 12 #include "intel_gt_types.h" 13 #include "intel_wakeref.h" 14 intel_gt_pm_is_awake(const struct intel_gt * gt)15static inline bool intel_gt_pm_is_awake(const struct intel_gt *gt) 16 { 17 return intel_wakeref_is_active(>->wakeref); 18 } 19 intel_gt_pm_get(struct intel_gt * gt)20static inline void intel_gt_pm_get(struct intel_gt *gt) 21 { 22 intel_wakeref_get(>->wakeref); 23 } 24 __intel_gt_pm_get(struct intel_gt * gt)25static inline void __intel_gt_pm_get(struct intel_gt *gt) 26 { 27 __intel_wakeref_get(>->wakeref); 28 } 29 intel_gt_pm_get_if_awake(struct intel_gt * gt)30static inline bool intel_gt_pm_get_if_awake(struct intel_gt *gt) 31 { 32 return intel_wakeref_get_if_active(>->wakeref); 33 } 34 intel_gt_pm_put(struct intel_gt * gt)35static inline void intel_gt_pm_put(struct intel_gt *gt) 36 { 37 intel_wakeref_put(>->wakeref); 38 } 39 intel_gt_pm_put_async(struct intel_gt * gt)40static inline void intel_gt_pm_put_async(struct intel_gt *gt) 41 { 42 intel_wakeref_put_async(>->wakeref); 43 } 44 intel_gt_pm_wait_for_idle(struct intel_gt * gt)45static inline int intel_gt_pm_wait_for_idle(struct intel_gt *gt) 46 { 47 return intel_wakeref_wait_for_idle(>->wakeref); 48 } 49 50 void intel_gt_pm_init_early(struct intel_gt *gt); 51 void intel_gt_pm_init(struct intel_gt *gt); 52 void intel_gt_pm_fini(struct intel_gt *gt); 53 54 void intel_gt_suspend_prepare(struct intel_gt *gt); 55 void intel_gt_suspend_late(struct intel_gt *gt); 56 int intel_gt_resume(struct intel_gt *gt); 57 58 void intel_gt_runtime_suspend(struct intel_gt *gt); 59 int intel_gt_runtime_resume(struct intel_gt *gt); 60 is_mock_gt(const struct intel_gt * gt)61static inline bool is_mock_gt(const struct intel_gt *gt) 62 { 63 return I915_SELFTEST_ONLY(gt->awake == -ENODEV); 64 } 65 66 #endif /* INTEL_GT_PM_H */ 67