| 1 | /* SPDX-License-Identifier: MIT */ |
| 2 | /* Copyright © 2025 Intel Corporation */ |
| 3 | |
| 4 | #ifndef __INTEL_DISPLAY_RPM__ |
| 5 | #define __INTEL_DISPLAY_RPM__ |
| 6 | |
| 7 | #include <linux/types.h> |
| 8 | |
| 9 | struct intel_display; |
| 10 | struct ref_tracker; |
| 11 | |
| 12 | struct ref_tracker *intel_display_rpm_get(struct intel_display *display); |
| 13 | void intel_display_rpm_put(struct intel_display *display, struct ref_tracker *wakeref); |
| 14 | |
| 15 | #define __with_intel_display_rpm(__display, __wakeref) \ |
| 16 | for (struct ref_tracker *(__wakeref) = intel_display_rpm_get(__display); (__wakeref); \ |
| 17 | intel_display_rpm_put((__display), (__wakeref)), (__wakeref) = NULL) |
| 18 | |
| 19 | #define with_intel_display_rpm(__display) \ |
| 20 | __with_intel_display_rpm((__display), __UNIQUE_ID(wakeref)) |
| 21 | |
| 22 | /* Only for special cases. */ |
| 23 | bool intel_display_rpm_suspended(struct intel_display *display); |
| 24 | |
| 25 | void assert_display_rpm_held(struct intel_display *display); |
| 26 | void intel_display_rpm_assert_block(struct intel_display *display); |
| 27 | void intel_display_rpm_assert_unblock(struct intel_display *display); |
| 28 | |
| 29 | /* Only for display power implementation. */ |
| 30 | struct ref_tracker *intel_display_rpm_get_raw(struct intel_display *display); |
| 31 | void intel_display_rpm_put_raw(struct intel_display *display, struct ref_tracker *wakeref); |
| 32 | |
| 33 | struct ref_tracker *intel_display_rpm_get_if_in_use(struct intel_display *display); |
| 34 | struct ref_tracker *intel_display_rpm_get_noresume(struct intel_display *display); |
| 35 | void intel_display_rpm_put_unchecked(struct intel_display *display); |
| 36 | |
| 37 | #endif /* __INTEL_DISPLAY_RPM__ */ |
| 38 | |