1 // SPDX-License-Identifier: MIT 2 /* Copyright © 2025 Intel Corporation */ 3 4 #include <drm/intel/display_parent_interface.h> 5 6 #include "intel_display_core.h" 7 #include "intel_display_rpm.h" 8 #include "xe_device.h" 9 #include "xe_device_types.h" 10 #include "xe_pm.h" 11 12 static struct ref_tracker *xe_display_rpm_get(const struct drm_device *drm) 13 { 14 return xe_pm_runtime_resume_and_get(to_xe_device(drm)) ? INTEL_WAKEREF_DEF : NULL; 15 } 16 17 static struct ref_tracker *xe_display_rpm_get_if_in_use(const struct drm_device *drm) 18 { 19 return xe_pm_runtime_get_if_in_use(to_xe_device(drm)) ? INTEL_WAKEREF_DEF : NULL; 20 } 21 22 static struct ref_tracker *xe_display_rpm_get_noresume(const struct drm_device *drm) 23 { 24 xe_pm_runtime_get_noresume(to_xe_device(drm)); 25 26 return INTEL_WAKEREF_DEF; 27 } 28 29 static void xe_display_rpm_put(const struct drm_device *drm, struct ref_tracker *wakeref) 30 { 31 if (wakeref) 32 xe_pm_runtime_put(to_xe_device(drm)); 33 } 34 35 static void xe_display_rpm_put_unchecked(const struct drm_device *drm) 36 { 37 xe_pm_runtime_put(to_xe_device(drm)); 38 } 39 40 static bool xe_display_rpm_suspended(const struct drm_device *drm) 41 { 42 struct xe_device *xe = to_xe_device(drm); 43 44 return pm_runtime_suspended(xe->drm.dev); 45 } 46 47 static void xe_display_rpm_assert_held(const struct drm_device *drm) 48 { 49 /* FIXME */ 50 } 51 52 static void xe_display_rpm_assert_block(const struct drm_device *drm) 53 { 54 /* FIXME */ 55 } 56 57 static void xe_display_rpm_assert_unblock(const struct drm_device *drm) 58 { 59 /* FIXME */ 60 } 61 62 const struct intel_display_rpm_interface xe_display_rpm_interface = { 63 .get = xe_display_rpm_get, 64 .get_raw = xe_display_rpm_get, 65 .get_if_in_use = xe_display_rpm_get_if_in_use, 66 .get_noresume = xe_display_rpm_get_noresume, 67 .put = xe_display_rpm_put, 68 .put_raw = xe_display_rpm_put, 69 .put_unchecked = xe_display_rpm_put_unchecked, 70 .suspended = xe_display_rpm_suspended, 71 .assert_held = xe_display_rpm_assert_held, 72 .assert_block = xe_display_rpm_assert_block, 73 .assert_unblock = xe_display_rpm_assert_unblock 74 }; 75