xref: /linux/drivers/gpu/drm/i915/display/intel_pps.h (revision ca220141fa8ebae09765a242076b2b77338106b0)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef __INTEL_PPS_H__
7 #define __INTEL_PPS_H__
8 
9 #include <linux/types.h>
10 
11 enum pipe;
12 struct intel_connector;
13 struct intel_crtc_state;
14 struct intel_display;
15 struct intel_dp;
16 struct intel_encoder;
17 struct ref_tracker;
18 
19 struct ref_tracker *intel_pps_lock(struct intel_dp *intel_dp);
20 struct ref_tracker *intel_pps_unlock(struct intel_dp *intel_dp, struct ref_tracker *wakeref);
21 
22 #define __with_intel_pps_lock(dp, wf) \
23 	for (struct ref_tracker *(wf) = intel_pps_lock(dp); (wf); (wf) = intel_pps_unlock((dp), (wf)))
24 
25 #define with_intel_pps_lock(dp) \
26 	__with_intel_pps_lock((dp), __UNIQUE_ID(wakeref))
27 
28 void intel_pps_backlight_on(struct intel_dp *intel_dp);
29 void intel_pps_backlight_off(struct intel_dp *intel_dp);
30 void intel_pps_backlight_power(struct intel_connector *connector, bool enable);
31 
32 bool intel_pps_vdd_on_unlocked(struct intel_dp *intel_dp);
33 void intel_pps_vdd_off_unlocked(struct intel_dp *intel_dp, bool sync);
34 void intel_pps_on_unlocked(struct intel_dp *intel_dp);
35 void intel_pps_off_unlocked(struct intel_dp *intel_dp);
36 void intel_pps_check_power_unlocked(struct intel_dp *intel_dp);
37 
38 void intel_pps_vdd_on(struct intel_dp *intel_dp);
39 void intel_pps_vdd_off(struct intel_dp *intel_dp);
40 void intel_pps_on(struct intel_dp *intel_dp);
41 void intel_pps_off(struct intel_dp *intel_dp);
42 void intel_pps_vdd_off_sync(struct intel_dp *intel_dp);
43 bool intel_pps_have_panel_power_or_vdd(struct intel_dp *intel_dp);
44 void intel_pps_wait_power_cycle(struct intel_dp *intel_dp);
45 
46 bool intel_pps_init(struct intel_dp *intel_dp);
47 void intel_pps_init_late(struct intel_dp *intel_dp);
48 void intel_pps_encoder_reset(struct intel_dp *intel_dp);
49 
50 void vlv_pps_pipe_init(struct intel_dp *intel_dp);
51 void vlv_pps_pipe_reset(struct intel_dp *intel_dp);
52 enum pipe vlv_pps_backlight_initial_pipe(struct intel_dp *intel_dp);
53 void vlv_pps_port_enable_unlocked(struct intel_encoder *encoder,
54 				  const struct intel_crtc_state *crtc_state);
55 void vlv_pps_port_disable(struct intel_encoder *encoder,
56 			  const struct intel_crtc_state *crtc_state);
57 void vlv_pps_reset_all(struct intel_display *display);
58 void bxt_pps_reset_all(struct intel_display *display);
59 
60 void intel_pps_unlock_regs_wa(struct intel_display *display);
61 void intel_pps_setup(struct intel_display *display);
62 
63 void intel_pps_connector_debugfs_add(struct intel_connector *connector);
64 
65 void assert_pps_unlocked(struct intel_display *display, enum pipe pipe);
66 
67 #endif /* __INTEL_PPS_H__ */
68