xref: /linux/drivers/gpu/drm/xe/display/xe_display_rpm.c (revision e21354aea4b4420b53c44e36828607a7c94a994c)
1 // SPDX-License-Identifier: MIT
2 /* Copyright © 2025 Intel Corporation */
3 
4 #include "intel_display_core.h"
5 #include "intel_display_rpm.h"
6 #include "xe_device.h"
7 #include "xe_device_types.h"
8 #include "xe_pm.h"
9 
10 static struct xe_device *display_to_xe(struct intel_display *display)
11 {
12 	return to_xe_device(display->drm);
13 }
14 
15 struct ref_tracker *intel_display_rpm_get_raw(struct intel_display *display)
16 {
17 	return intel_display_rpm_get(display);
18 }
19 
20 void intel_display_rpm_put_raw(struct intel_display *display, struct ref_tracker *wakeref)
21 {
22 	intel_display_rpm_put(display, wakeref);
23 }
24 
25 struct ref_tracker *intel_display_rpm_get(struct intel_display *display)
26 {
27 	return xe_pm_runtime_resume_and_get(display_to_xe(display)) ? INTEL_WAKEREF_DEF : NULL;
28 }
29 
30 struct ref_tracker *intel_display_rpm_get_if_in_use(struct intel_display *display)
31 {
32 	return xe_pm_runtime_get_if_in_use(display_to_xe(display)) ? INTEL_WAKEREF_DEF : NULL;
33 }
34 
35 struct ref_tracker *intel_display_rpm_get_noresume(struct intel_display *display)
36 {
37 	xe_pm_runtime_get_noresume(display_to_xe(display));
38 
39 	return INTEL_WAKEREF_DEF;
40 }
41 
42 void intel_display_rpm_put(struct intel_display *display, struct ref_tracker *wakeref)
43 {
44 	if (wakeref)
45 		xe_pm_runtime_put(display_to_xe(display));
46 }
47 
48 void intel_display_rpm_put_unchecked(struct intel_display *display)
49 {
50 	xe_pm_runtime_put(display_to_xe(display));
51 }
52 
53 bool intel_display_rpm_suspended(struct intel_display *display)
54 {
55 	struct xe_device *xe = display_to_xe(display);
56 
57 	return pm_runtime_suspended(xe->drm.dev);
58 }
59 
60 void assert_display_rpm_held(struct intel_display *display)
61 {
62 	/* FIXME */
63 }
64 
65 void intel_display_rpm_assert_block(struct intel_display *display)
66 {
67 	/* FIXME */
68 }
69 
70 void intel_display_rpm_assert_unblock(struct intel_display *display)
71 {
72 	/* FIXME */
73 }
74