Ander Conselvan de Oliveira | ac7f11c | 2016-03-08 17:46:19 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright © 2012-2016 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef _INTEL_DPLL_MGR_H_ |
| 26 | #define _INTEL_DPLL_MGR_H_ |
| 27 | |
| 28 | struct drm_i915_private; |
| 29 | |
| 30 | enum intel_dpll_id { |
| 31 | DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */ |
| 32 | /* real shared dpll ids must be >= 0 */ |
| 33 | DPLL_ID_PCH_PLL_A = 0, |
| 34 | DPLL_ID_PCH_PLL_B = 1, |
| 35 | /* hsw/bdw */ |
| 36 | DPLL_ID_WRPLL1 = 0, |
| 37 | DPLL_ID_WRPLL2 = 1, |
| 38 | DPLL_ID_SPLL = 2, |
| 39 | |
| 40 | /* skl */ |
| 41 | DPLL_ID_SKL_DPLL1 = 0, |
| 42 | DPLL_ID_SKL_DPLL2 = 1, |
| 43 | DPLL_ID_SKL_DPLL3 = 2, |
| 44 | }; |
| 45 | #define I915_NUM_PLLS 3 |
| 46 | |
| 47 | struct intel_dpll_hw_state { |
| 48 | /* i9xx, pch plls */ |
| 49 | uint32_t dpll; |
| 50 | uint32_t dpll_md; |
| 51 | uint32_t fp0; |
| 52 | uint32_t fp1; |
| 53 | |
| 54 | /* hsw, bdw */ |
| 55 | uint32_t wrpll; |
| 56 | uint32_t spll; |
| 57 | |
| 58 | /* skl */ |
| 59 | /* |
| 60 | * DPLL_CTRL1 has 6 bits for each each this DPLL. We store those in |
| 61 | * lower part of ctrl1 and they get shifted into position when writing |
| 62 | * the register. This allows us to easily compare the state to share |
| 63 | * the DPLL. |
| 64 | */ |
| 65 | uint32_t ctrl1; |
| 66 | /* HDMI only, 0 when used for DP */ |
| 67 | uint32_t cfgcr1, cfgcr2; |
| 68 | |
| 69 | /* bxt */ |
| 70 | uint32_t ebb0, ebb4, pll0, pll1, pll2, pll3, pll6, pll8, pll9, pll10, |
| 71 | pcsdw12; |
| 72 | }; |
| 73 | |
| 74 | struct intel_shared_dpll_config { |
| 75 | unsigned crtc_mask; /* mask of CRTCs sharing this PLL */ |
| 76 | struct intel_dpll_hw_state hw_state; |
| 77 | }; |
| 78 | |
| 79 | struct intel_shared_dpll { |
| 80 | struct intel_shared_dpll_config config; |
| 81 | |
| 82 | int active; /* count of number of active CRTCs (i.e. DPMS on) */ |
| 83 | bool on; /* is the PLL actually active? Disabled during modeset */ |
| 84 | const char *name; |
| 85 | /* should match the index in the dev_priv->shared_dplls array */ |
| 86 | enum intel_dpll_id id; |
| 87 | /* The mode_set hook is optional and should be used together with the |
| 88 | * intel_prepare_shared_dpll function. */ |
| 89 | void (*mode_set)(struct drm_i915_private *dev_priv, |
| 90 | struct intel_shared_dpll *pll); |
| 91 | void (*enable)(struct drm_i915_private *dev_priv, |
| 92 | struct intel_shared_dpll *pll); |
| 93 | void (*disable)(struct drm_i915_private *dev_priv, |
| 94 | struct intel_shared_dpll *pll); |
| 95 | bool (*get_hw_state)(struct drm_i915_private *dev_priv, |
| 96 | struct intel_shared_dpll *pll, |
| 97 | struct intel_dpll_hw_state *hw_state); |
| 98 | }; |
| 99 | |
| 100 | #define SKL_DPLL0 0 |
| 101 | #define SKL_DPLL1 1 |
| 102 | #define SKL_DPLL2 2 |
| 103 | #define SKL_DPLL3 3 |
| 104 | |
| 105 | |
| 106 | #endif /* _INTEL_DPLL_MGR_H_ */ |