1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef _INTEL_DPLL_H_
7 #define _INTEL_DPLL_H_
8 
9 #include <linux/types.h>
10 
11 struct dpll;
12 struct drm_i915_private;
13 struct intel_atomic_state;
14 struct intel_crtc;
15 struct intel_crtc_state;
16 struct intel_display;
17 struct intel_dpll_hw_state;
18 enum pipe;
19 
20 void intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv);
21 int intel_dpll_crtc_compute_clock(struct intel_atomic_state *state,
22 				  struct intel_crtc *crtc);
23 int intel_dpll_crtc_get_shared_dpll(struct intel_atomic_state *state,
24 				    struct intel_crtc *crtc);
25 int i9xx_calc_dpll_params(int refclk, struct dpll *clock);
26 u32 i9xx_dpll_compute_fp(const struct dpll *dpll);
27 void i9xx_dpll_get_hw_state(struct intel_crtc *crtc,
28 			    struct intel_dpll_hw_state *dpll_hw_state);
29 void vlv_compute_dpll(struct intel_crtc_state *crtc_state);
30 void chv_compute_dpll(struct intel_crtc_state *crtc_state);
31 
32 int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,
33 		     const struct dpll *dpll);
34 void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe);
35 
36 void chv_enable_pll(const struct intel_crtc_state *crtc_state);
37 void chv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe);
38 void vlv_enable_pll(const struct intel_crtc_state *crtc_state);
39 void vlv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe);
40 void i9xx_enable_pll(const struct intel_crtc_state *crtc_state);
41 void i9xx_disable_pll(const struct intel_crtc_state *crtc_state);
42 bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state,
43 			struct dpll *best_clock);
44 int chv_calc_dpll_params(int refclk, struct dpll *pll_clock);
45 
46 void i9xx_crtc_clock_get(struct intel_crtc_state *crtc_state);
47 void vlv_crtc_clock_get(struct intel_crtc_state *crtc_state);
48 void chv_crtc_clock_get(struct intel_crtc_state *crtc_state);
49 
50 void assert_pll_enabled(struct intel_display *display, enum pipe pipe);
51 void assert_pll_disabled(struct intel_display *display, enum pipe pipe);
52 
53 #endif
54