diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-06-01 11:16:20 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-06-04 08:00:09 -0400 |
commit | 7c62a164faea430c6e4c411eb0870640cf51a6e5 (patch) | |
tree | 487f1bd6f9893a24b3cac55e36784d7f01ee51a9 /drivers | |
parent | 2bd89a07db684573d2fce0d5148103c3dcfb0873 (diff) |
drm/i915: refactor cpu eDP PLL handling a bit
This prepares a bit for the next big patch, where we switch the
semantics of the different clocks in the pipe config around.
Since I've broken cpu eDP PLL handling in the first version I've
figured some refactoring is in order.
Split out on request from Paulo Zanoni.
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a899f93cb0ee..3b490c097400 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -780,24 +780,29 @@ void intel_dp_init_link_config(struct intel_dp *intel_dp) | |||
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | static void ironlake_set_pll_edp(struct drm_crtc *crtc, int clock) | 783 | static void ironlake_set_pll_cpu_edp(struct intel_dp *intel_dp) |
784 | { | 784 | { |
785 | struct drm_device *dev = crtc->dev; | 785 | struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); |
786 | struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc); | ||
787 | struct drm_device *dev = crtc->base.dev; | ||
786 | struct drm_i915_private *dev_priv = dev->dev_private; | 788 | struct drm_i915_private *dev_priv = dev->dev_private; |
787 | u32 dpa_ctl; | 789 | u32 dpa_ctl; |
788 | 790 | ||
789 | DRM_DEBUG_KMS("eDP PLL enable for clock %d\n", clock); | 791 | DRM_DEBUG_KMS("eDP PLL enable for clock %d\n", |
792 | crtc->config.adjusted_mode.clock); | ||
790 | dpa_ctl = I915_READ(DP_A); | 793 | dpa_ctl = I915_READ(DP_A); |
791 | dpa_ctl &= ~DP_PLL_FREQ_MASK; | 794 | dpa_ctl &= ~DP_PLL_FREQ_MASK; |
792 | 795 | ||
793 | if (clock < 200000) { | 796 | if (crtc->config.adjusted_mode.clock == 162000) { |
794 | /* For a long time we've carried around a ILK-DevA w/a for the | 797 | /* For a long time we've carried around a ILK-DevA w/a for the |
795 | * 160MHz clock. If we're really unlucky, it's still required. | 798 | * 160MHz clock. If we're really unlucky, it's still required. |
796 | */ | 799 | */ |
797 | DRM_DEBUG_KMS("160MHz cpu eDP clock, might need ilk devA w/a\n"); | 800 | DRM_DEBUG_KMS("160MHz cpu eDP clock, might need ilk devA w/a\n"); |
798 | dpa_ctl |= DP_PLL_FREQ_160MHZ; | 801 | dpa_ctl |= DP_PLL_FREQ_160MHZ; |
802 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
799 | } else { | 803 | } else { |
800 | dpa_ctl |= DP_PLL_FREQ_270MHZ; | 804 | dpa_ctl |= DP_PLL_FREQ_270MHZ; |
805 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
801 | } | 806 | } |
802 | 807 | ||
803 | I915_WRITE(DP_A, dpa_ctl); | 808 | I915_WRITE(DP_A, dpa_ctl); |
@@ -814,8 +819,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
814 | struct drm_i915_private *dev_priv = dev->dev_private; | 819 | struct drm_i915_private *dev_priv = dev->dev_private; |
815 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 820 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
816 | enum port port = dp_to_dig_port(intel_dp)->port; | 821 | enum port port = dp_to_dig_port(intel_dp)->port; |
817 | struct drm_crtc *crtc = encoder->crtc; | 822 | struct intel_crtc *crtc = to_intel_crtc(encoder->crtc); |
818 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
819 | 823 | ||
820 | /* | 824 | /* |
821 | * There are four kinds of DP registers: | 825 | * There are four kinds of DP registers: |
@@ -845,7 +849,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
845 | 849 | ||
846 | if (intel_dp->has_audio) { | 850 | if (intel_dp->has_audio) { |
847 | DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n", | 851 | DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n", |
848 | pipe_name(intel_crtc->pipe)); | 852 | pipe_name(crtc->pipe)); |
849 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; | 853 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; |
850 | intel_write_eld(encoder, adjusted_mode); | 854 | intel_write_eld(encoder, adjusted_mode); |
851 | } | 855 | } |
@@ -864,13 +868,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
864 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) | 868 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) |
865 | intel_dp->DP |= DP_ENHANCED_FRAMING; | 869 | intel_dp->DP |= DP_ENHANCED_FRAMING; |
866 | 870 | ||
867 | intel_dp->DP |= intel_crtc->pipe << 29; | 871 | intel_dp->DP |= crtc->pipe << 29; |
868 | |||
869 | /* don't miss out required setting for eDP */ | ||
870 | if (adjusted_mode->clock < 200000) | ||
871 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
872 | else | ||
873 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
874 | } else if (!HAS_PCH_CPT(dev) || port == PORT_A) { | 872 | } else if (!HAS_PCH_CPT(dev) || port == PORT_A) { |
875 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev)) | 873 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev)) |
876 | intel_dp->DP |= intel_dp->color_range; | 874 | intel_dp->DP |= intel_dp->color_range; |
@@ -884,22 +882,14 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
884 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) | 882 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) |
885 | intel_dp->DP |= DP_ENHANCED_FRAMING; | 883 | intel_dp->DP |= DP_ENHANCED_FRAMING; |
886 | 884 | ||
887 | if (intel_crtc->pipe == 1) | 885 | if (crtc->pipe == 1) |
888 | intel_dp->DP |= DP_PIPEB_SELECT; | 886 | intel_dp->DP |= DP_PIPEB_SELECT; |
889 | |||
890 | if (port == PORT_A && !IS_VALLEYVIEW(dev)) { | ||
891 | /* don't miss out required setting for eDP */ | ||
892 | if (adjusted_mode->clock < 200000) | ||
893 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
894 | else | ||
895 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
896 | } | ||
897 | } else { | 887 | } else { |
898 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | 888 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; |
899 | } | 889 | } |
900 | 890 | ||
901 | if (port == PORT_A && !IS_VALLEYVIEW(dev)) | 891 | if (port == PORT_A && !IS_VALLEYVIEW(dev)) |
902 | ironlake_set_pll_edp(crtc, adjusted_mode->clock); | 892 | ironlake_set_pll_cpu_edp(intel_dp); |
903 | } | 893 | } |
904 | 894 | ||
905 | #define IDLE_ON_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | 0 | PP_SEQUENCE_STATE_MASK) | 895 | #define IDLE_ON_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | 0 | PP_SEQUENCE_STATE_MASK) |