• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5 
6 #ifndef INTEL_RPS_H
7 #define INTEL_RPS_H
8 
9 #include "intel_rps_types.h"
10 
11 struct i915_request;
12 
13 void intel_rps_init_early(struct intel_rps *rps);
14 void intel_rps_init(struct intel_rps *rps);
15 void intel_rps_sanitize(struct intel_rps *rps);
16 
17 void intel_rps_driver_register(struct intel_rps *rps);
18 void intel_rps_driver_unregister(struct intel_rps *rps);
19 
20 void intel_rps_enable(struct intel_rps *rps);
21 void intel_rps_disable(struct intel_rps *rps);
22 
23 void intel_rps_park(struct intel_rps *rps);
24 void intel_rps_unpark(struct intel_rps *rps);
25 void intel_rps_boost(struct i915_request *rq);
26 
27 int intel_rps_set(struct intel_rps *rps, u8 val);
28 void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive);
29 
30 int intel_gpu_freq(struct intel_rps *rps, int val);
31 int intel_freq_opcode(struct intel_rps *rps, int val);
32 u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat1);
33 u32 intel_rps_read_actual_frequency(struct intel_rps *rps);
34 u32 intel_rps_get_requested_frequency(struct intel_rps *rps);
35 u32 intel_rps_get_min_frequency(struct intel_rps *rps);
36 int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val);
37 u32 intel_rps_get_max_frequency(struct intel_rps *rps);
38 int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val);
39 u32 intel_rps_get_rp0_frequency(struct intel_rps *rps);
40 u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
41 u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
42 u32 intel_rps_read_punit_req(struct intel_rps *rps);
43 u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
44 
45 void gen5_rps_irq_handler(struct intel_rps *rps);
46 void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir);
47 void gen11_rps_irq_handler(struct intel_rps *rps, u32 pm_iir);
48 
intel_rps_is_enabled(const struct intel_rps * rps)49 static inline bool intel_rps_is_enabled(const struct intel_rps *rps)
50 {
51 	return test_bit(INTEL_RPS_ENABLED, &rps->flags);
52 }
53 
intel_rps_set_enabled(struct intel_rps * rps)54 static inline void intel_rps_set_enabled(struct intel_rps *rps)
55 {
56 	set_bit(INTEL_RPS_ENABLED, &rps->flags);
57 }
58 
intel_rps_clear_enabled(struct intel_rps * rps)59 static inline void intel_rps_clear_enabled(struct intel_rps *rps)
60 {
61 	clear_bit(INTEL_RPS_ENABLED, &rps->flags);
62 }
63 
intel_rps_is_active(const struct intel_rps * rps)64 static inline bool intel_rps_is_active(const struct intel_rps *rps)
65 {
66 	return test_bit(INTEL_RPS_ACTIVE, &rps->flags);
67 }
68 
intel_rps_set_active(struct intel_rps * rps)69 static inline void intel_rps_set_active(struct intel_rps *rps)
70 {
71 	set_bit(INTEL_RPS_ACTIVE, &rps->flags);
72 }
73 
intel_rps_clear_active(struct intel_rps * rps)74 static inline bool intel_rps_clear_active(struct intel_rps *rps)
75 {
76 	return test_and_clear_bit(INTEL_RPS_ACTIVE, &rps->flags);
77 }
78 
intel_rps_has_interrupts(const struct intel_rps * rps)79 static inline bool intel_rps_has_interrupts(const struct intel_rps *rps)
80 {
81 	return test_bit(INTEL_RPS_INTERRUPTS, &rps->flags);
82 }
83 
intel_rps_set_interrupts(struct intel_rps * rps)84 static inline void intel_rps_set_interrupts(struct intel_rps *rps)
85 {
86 	set_bit(INTEL_RPS_INTERRUPTS, &rps->flags);
87 }
88 
intel_rps_clear_interrupts(struct intel_rps * rps)89 static inline void intel_rps_clear_interrupts(struct intel_rps *rps)
90 {
91 	clear_bit(INTEL_RPS_INTERRUPTS, &rps->flags);
92 }
93 
intel_rps_uses_timer(const struct intel_rps * rps)94 static inline bool intel_rps_uses_timer(const struct intel_rps *rps)
95 {
96 	return test_bit(INTEL_RPS_TIMER, &rps->flags);
97 }
98 
intel_rps_set_timer(struct intel_rps * rps)99 static inline void intel_rps_set_timer(struct intel_rps *rps)
100 {
101 	set_bit(INTEL_RPS_TIMER, &rps->flags);
102 }
103 
intel_rps_clear_timer(struct intel_rps * rps)104 static inline void intel_rps_clear_timer(struct intel_rps *rps)
105 {
106 	clear_bit(INTEL_RPS_TIMER, &rps->flags);
107 }
108 
109 #endif /* INTEL_RPS_H */
110