diff options
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 102 |
1 files changed, 78 insertions, 24 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 894091fe9dab..688fdb83fdbb 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -111,7 +111,6 @@ static void intel_begin_crtc_commit(struct drm_crtc *, struct drm_crtc_state *); | |||
111 | static void intel_finish_crtc_commit(struct drm_crtc *, struct drm_crtc_state *); | 111 | static void intel_finish_crtc_commit(struct drm_crtc *, struct drm_crtc_state *); |
112 | static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_crtc, | 112 | static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_crtc, |
113 | struct intel_crtc_state *crtc_state); | 113 | struct intel_crtc_state *crtc_state); |
114 | static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state); | ||
115 | static void skylake_pfit_enable(struct intel_crtc *crtc); | 114 | static void skylake_pfit_enable(struct intel_crtc *crtc); |
116 | static void ironlake_pfit_disable(struct intel_crtc *crtc, bool force); | 115 | static void ironlake_pfit_disable(struct intel_crtc *crtc, bool force); |
117 | static void ironlake_pfit_enable(struct intel_crtc *crtc); | 116 | static void ironlake_pfit_enable(struct intel_crtc *crtc); |
@@ -593,21 +592,17 @@ intel_limit(struct intel_crtc_state *crtc_state, int refclk) | |||
593 | struct drm_device *dev = crtc_state->base.crtc->dev; | 592 | struct drm_device *dev = crtc_state->base.crtc->dev; |
594 | const intel_limit_t *limit; | 593 | const intel_limit_t *limit; |
595 | 594 | ||
596 | if (IS_BROXTON(dev)) | 595 | if (IS_BROXTON(dev) || IS_CHERRYVIEW(dev) || IS_VALLEYVIEW(dev) || |
597 | limit = &intel_limits_bxt; | 596 | HAS_PCH_SPLIT(dev)) |
598 | else if (WARN_ON(HAS_PCH_SPLIT(dev))) | ||
599 | limit = NULL; | 597 | limit = NULL; |
600 | else if (IS_G4X(dev)) { | 598 | |
599 | if (IS_G4X(dev)) { | ||
601 | limit = intel_g4x_limit(crtc_state); | 600 | limit = intel_g4x_limit(crtc_state); |
602 | } else if (IS_PINEVIEW(dev)) { | 601 | } else if (IS_PINEVIEW(dev)) { |
603 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) | 602 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) |
604 | limit = &intel_limits_pineview_lvds; | 603 | limit = &intel_limits_pineview_lvds; |
605 | else | 604 | else |
606 | limit = &intel_limits_pineview_sdvo; | 605 | limit = &intel_limits_pineview_sdvo; |
607 | } else if (IS_CHERRYVIEW(dev)) { | ||
608 | limit = &intel_limits_chv; | ||
609 | } else if (IS_VALLEYVIEW(dev)) { | ||
610 | limit = &intel_limits_vlv; | ||
611 | } else if (!IS_GEN2(dev)) { | 606 | } else if (!IS_GEN2(dev)) { |
612 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) | 607 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) |
613 | limit = &intel_limits_i9xx_lvds; | 608 | limit = &intel_limits_i9xx_lvds; |
@@ -621,6 +616,9 @@ intel_limit(struct intel_crtc_state *crtc_state, int refclk) | |||
621 | else | 616 | else |
622 | limit = &intel_limits_i8xx_dac; | 617 | limit = &intel_limits_i8xx_dac; |
623 | } | 618 | } |
619 | |||
620 | WARN_ON(limit == NULL); | ||
621 | |||
624 | return limit; | 622 | return limit; |
625 | } | 623 | } |
626 | 624 | ||
@@ -939,6 +937,11 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq, | |||
939 | return *error_ppm + 10 < best_error_ppm; | 937 | return *error_ppm + 10 < best_error_ppm; |
940 | } | 938 | } |
941 | 939 | ||
940 | /* | ||
941 | * Returns a set of divisors for the desired target clock with the given | ||
942 | * refclk, or FALSE. The returned values represent the clock equation: | ||
943 | * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2. | ||
944 | */ | ||
942 | static bool | 945 | static bool |
943 | vlv_find_best_dpll(const intel_limit_t *limit, | 946 | vlv_find_best_dpll(const intel_limit_t *limit, |
944 | struct intel_crtc_state *crtc_state, | 947 | struct intel_crtc_state *crtc_state, |
@@ -993,6 +996,11 @@ vlv_find_best_dpll(const intel_limit_t *limit, | |||
993 | return found; | 996 | return found; |
994 | } | 997 | } |
995 | 998 | ||
999 | /* | ||
1000 | * Returns a set of divisors for the desired target clock with the given | ||
1001 | * refclk, or FALSE. The returned values represent the clock equation: | ||
1002 | * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2. | ||
1003 | */ | ||
996 | static bool | 1004 | static bool |
997 | chv_find_best_dpll(const intel_limit_t *limit, | 1005 | chv_find_best_dpll(const intel_limit_t *limit, |
998 | struct intel_crtc_state *crtc_state, | 1006 | struct intel_crtc_state *crtc_state, |
@@ -1054,9 +1062,10 @@ chv_find_best_dpll(const intel_limit_t *limit, | |||
1054 | bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state, int target_clock, | 1062 | bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state, int target_clock, |
1055 | intel_clock_t *best_clock) | 1063 | intel_clock_t *best_clock) |
1056 | { | 1064 | { |
1057 | int refclk = i9xx_get_refclk(crtc_state); | 1065 | int refclk = 100000; |
1066 | const intel_limit_t *limit = &intel_limits_bxt; | ||
1058 | 1067 | ||
1059 | return chv_find_best_dpll(intel_limit(crtc_state, refclk), crtc_state, | 1068 | return chv_find_best_dpll(limit, crtc_state, |
1060 | target_clock, refclk, NULL, best_clock); | 1069 | target_clock, refclk, NULL, best_clock); |
1061 | } | 1070 | } |
1062 | 1071 | ||
@@ -7046,9 +7055,7 @@ static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state) | |||
7046 | 7055 | ||
7047 | WARN_ON(!crtc_state->base.state); | 7056 | WARN_ON(!crtc_state->base.state); |
7048 | 7057 | ||
7049 | if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev) || IS_BROXTON(dev)) { | 7058 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS) && |
7050 | refclk = 100000; | ||
7051 | } else if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS) && | ||
7052 | intel_panel_use_ssc(dev_priv)) { | 7059 | intel_panel_use_ssc(dev_priv)) { |
7053 | refclk = dev_priv->vbt.lvds_ssc_freq; | 7060 | refclk = dev_priv->vbt.lvds_ssc_freq; |
7054 | DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); | 7061 | DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); |
@@ -7852,10 +7859,6 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc, | |||
7852 | 7859 | ||
7853 | if (IS_GEN2(dev)) { | 7860 | if (IS_GEN2(dev)) { |
7854 | i8xx_compute_dpll(crtc, crtc_state, NULL); | 7861 | i8xx_compute_dpll(crtc, crtc_state, NULL); |
7855 | } else if (IS_CHERRYVIEW(dev)) { | ||
7856 | chv_compute_dpll(crtc, crtc_state); | ||
7857 | } else if (IS_VALLEYVIEW(dev)) { | ||
7858 | vlv_compute_dpll(crtc, crtc_state); | ||
7859 | } else { | 7862 | } else { |
7860 | i9xx_compute_dpll(crtc, crtc_state, NULL); | 7863 | i9xx_compute_dpll(crtc, crtc_state, NULL); |
7861 | } | 7864 | } |
@@ -7863,6 +7866,54 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc, | |||
7863 | return 0; | 7866 | return 0; |
7864 | } | 7867 | } |
7865 | 7868 | ||
7869 | static int chv_crtc_compute_clock(struct intel_crtc *crtc, | ||
7870 | struct intel_crtc_state *crtc_state) | ||
7871 | { | ||
7872 | int refclk = 100000; | ||
7873 | const intel_limit_t *limit = &intel_limits_chv; | ||
7874 | |||
7875 | memset(&crtc_state->dpll_hw_state, 0, | ||
7876 | sizeof(crtc_state->dpll_hw_state)); | ||
7877 | |||
7878 | if (crtc_state->has_dsi_encoder) | ||
7879 | return 0; | ||
7880 | |||
7881 | if (!crtc_state->clock_set && | ||
7882 | !chv_find_best_dpll(limit, crtc_state, crtc_state->port_clock, | ||
7883 | refclk, NULL, &crtc_state->dpll)) { | ||
7884 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); | ||
7885 | return -EINVAL; | ||
7886 | } | ||
7887 | |||
7888 | chv_compute_dpll(crtc, crtc_state); | ||
7889 | |||
7890 | return 0; | ||
7891 | } | ||
7892 | |||
7893 | static int vlv_crtc_compute_clock(struct intel_crtc *crtc, | ||
7894 | struct intel_crtc_state *crtc_state) | ||
7895 | { | ||
7896 | int refclk = 100000; | ||
7897 | const intel_limit_t *limit = &intel_limits_vlv; | ||
7898 | |||
7899 | memset(&crtc_state->dpll_hw_state, 0, | ||
7900 | sizeof(crtc_state->dpll_hw_state)); | ||
7901 | |||
7902 | if (crtc_state->has_dsi_encoder) | ||
7903 | return 0; | ||
7904 | |||
7905 | if (!crtc_state->clock_set && | ||
7906 | !vlv_find_best_dpll(limit, crtc_state, crtc_state->port_clock, | ||
7907 | refclk, NULL, &crtc_state->dpll)) { | ||
7908 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); | ||
7909 | return -EINVAL; | ||
7910 | } | ||
7911 | |||
7912 | vlv_compute_dpll(crtc, crtc_state); | ||
7913 | |||
7914 | return 0; | ||
7915 | } | ||
7916 | |||
7866 | static void i9xx_get_pfit_config(struct intel_crtc *crtc, | 7917 | static void i9xx_get_pfit_config(struct intel_crtc *crtc, |
7867 | struct intel_crtc_state *pipe_config) | 7918 | struct intel_crtc_state *pipe_config) |
7868 | { | 7919 | { |
@@ -14724,10 +14775,6 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) | |||
14724 | { | 14775 | { |
14725 | if (HAS_PCH_SPLIT(dev_priv) || IS_G4X(dev_priv)) | 14776 | if (HAS_PCH_SPLIT(dev_priv) || IS_G4X(dev_priv)) |
14726 | dev_priv->display.find_dpll = g4x_find_best_dpll; | 14777 | dev_priv->display.find_dpll = g4x_find_best_dpll; |
14727 | else if (IS_CHERRYVIEW(dev_priv)) | ||
14728 | dev_priv->display.find_dpll = chv_find_best_dpll; | ||
14729 | else if (IS_VALLEYVIEW(dev_priv)) | ||
14730 | dev_priv->display.find_dpll = vlv_find_best_dpll; | ||
14731 | else if (IS_PINEVIEW(dev_priv)) | 14778 | else if (IS_PINEVIEW(dev_priv)) |
14732 | dev_priv->display.find_dpll = pnv_find_best_dpll; | 14779 | dev_priv->display.find_dpll = pnv_find_best_dpll; |
14733 | else | 14780 | else |
@@ -14757,11 +14804,18 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) | |||
14757 | ironlake_crtc_compute_clock; | 14804 | ironlake_crtc_compute_clock; |
14758 | dev_priv->display.crtc_enable = ironlake_crtc_enable; | 14805 | dev_priv->display.crtc_enable = ironlake_crtc_enable; |
14759 | dev_priv->display.crtc_disable = ironlake_crtc_disable; | 14806 | dev_priv->display.crtc_disable = ironlake_crtc_disable; |
14760 | } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { | 14807 | } else if (IS_CHERRYVIEW(dev_priv)) { |
14761 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; | 14808 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; |
14762 | dev_priv->display.get_initial_plane_config = | 14809 | dev_priv->display.get_initial_plane_config = |
14763 | i9xx_get_initial_plane_config; | 14810 | i9xx_get_initial_plane_config; |
14764 | dev_priv->display.crtc_compute_clock = i9xx_crtc_compute_clock; | 14811 | dev_priv->display.crtc_compute_clock = chv_crtc_compute_clock; |
14812 | dev_priv->display.crtc_enable = valleyview_crtc_enable; | ||
14813 | dev_priv->display.crtc_disable = i9xx_crtc_disable; | ||
14814 | } else if (IS_VALLEYVIEW(dev_priv)) { | ||
14815 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; | ||
14816 | dev_priv->display.get_initial_plane_config = | ||
14817 | i9xx_get_initial_plane_config; | ||
14818 | dev_priv->display.crtc_compute_clock = vlv_crtc_compute_clock; | ||
14765 | dev_priv->display.crtc_enable = valleyview_crtc_enable; | 14819 | dev_priv->display.crtc_enable = valleyview_crtc_enable; |
14766 | dev_priv->display.crtc_disable = i9xx_crtc_disable; | 14820 | dev_priv->display.crtc_disable = i9xx_crtc_disable; |
14767 | } else { | 14821 | } else { |