1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2019 Intel Corporation
5  */
6 
7 #ifndef INTEL_ENGINE_PM_H
8 #define INTEL_ENGINE_PM_H
9 
10 #include "intel_engine_types.h"
11 #include "intel_wakeref.h"
12 
13 static inline bool
14 intel_engine_pm_is_awake(const struct intel_engine_cs *engine)
15 {
16 	return intel_wakeref_is_active(&engine->wakeref);
17 }
18 
19 static inline void intel_engine_pm_get(struct intel_engine_cs *engine)
20 {
21 	intel_wakeref_get(&engine->wakeref);
22 }
23 
24 static inline bool intel_engine_pm_get_if_awake(struct intel_engine_cs *engine)
25 {
26 	return intel_wakeref_get_if_active(&engine->wakeref);
27 }
28 
29 static inline void intel_engine_pm_put(struct intel_engine_cs *engine)
30 {
31 	intel_wakeref_put(&engine->wakeref);
32 }
33 
34 static inline void intel_engine_pm_put_async(struct intel_engine_cs *engine)
35 {
36 	intel_wakeref_put_async(&engine->wakeref);
37 }
38 
39 static inline void intel_engine_pm_flush(struct intel_engine_cs *engine)
40 {
41 	intel_wakeref_unlock_wait(&engine->wakeref);
42 }
43 
44 void intel_engine_init__pm(struct intel_engine_cs *engine);
45 
46 #endif /* INTEL_ENGINE_PM_H */
47