aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-11-01 22:34:06 -0400
committerKeith Packard <keithp@keithp.com>2011-11-16 23:26:25 -0500
commit832dd3c17f7829fe8e4c257531d6c5c9e19bd7ac (patch)
tree8b1f37958d0e2e285fb792f4796d9b520beea77b /drivers
parent4415e63b13c68c2f56d16d400a1ae345f68cf655 (diff)
drm/i915: Move common PCH_PP_CONTROL setup to ironlake_get_pp_control
Every usage of PCH_PP_CONTROL sets the PANEL_UNLOCK_REGS value to ensure that writes will be respected, move this to a common function to make the driver cleaner. No functional changes. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 7259034b33d1..efe5f9e0de9e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -906,6 +906,19 @@ static void ironlake_wait_panel_off(struct intel_dp *intel_dp)
906 msleep(delay); 906 msleep(delay);
907} 907}
908 908
909/* Read the current pp_control value, unlocking the register if it
910 * is locked
911 */
912
913static u32 ironlake_get_pp_control(struct drm_i915_private *dev_priv)
914{
915 u32 control = I915_READ(PCH_PP_CONTROL);
916
917 control &= ~PANEL_UNLOCK_MASK;
918 control |= PANEL_UNLOCK_REGS;
919 return control;
920}
921
909static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp) 922static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
910{ 923{
911 struct drm_device *dev = intel_dp->base.base.dev; 924 struct drm_device *dev = intel_dp->base.base.dev;
@@ -926,9 +939,7 @@ static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
926 } 939 }
927 940
928 ironlake_wait_panel_off(intel_dp); 941 ironlake_wait_panel_off(intel_dp);
929 pp = I915_READ(PCH_PP_CONTROL); 942 pp = ironlake_get_pp_control(dev_priv);
930 pp &= ~PANEL_UNLOCK_MASK;
931 pp |= PANEL_UNLOCK_REGS;
932 pp |= EDP_FORCE_VDD; 943 pp |= EDP_FORCE_VDD;
933 I915_WRITE(PCH_PP_CONTROL, pp); 944 I915_WRITE(PCH_PP_CONTROL, pp);
934 POSTING_READ(PCH_PP_CONTROL); 945 POSTING_READ(PCH_PP_CONTROL);
@@ -951,9 +962,7 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
951 u32 pp; 962 u32 pp;
952 963
953 if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) { 964 if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) {
954 pp = I915_READ(PCH_PP_CONTROL); 965 pp = ironlake_get_pp_control(dev_priv);
955 pp &= ~PANEL_UNLOCK_MASK;
956 pp |= PANEL_UNLOCK_REGS;
957 pp &= ~EDP_FORCE_VDD; 966 pp &= ~EDP_FORCE_VDD;
958 I915_WRITE(PCH_PP_CONTROL, pp); 967 I915_WRITE(PCH_PP_CONTROL, pp);
959 POSTING_READ(PCH_PP_CONTROL); 968 POSTING_READ(PCH_PP_CONTROL);
@@ -1012,9 +1021,7 @@ static void ironlake_edp_panel_on(struct intel_dp *intel_dp)
1012 return; 1021 return;
1013 1022
1014 ironlake_wait_panel_off(intel_dp); 1023 ironlake_wait_panel_off(intel_dp);
1015 pp = I915_READ(PCH_PP_CONTROL); 1024 pp = ironlake_get_pp_control(dev_priv);
1016 pp &= ~PANEL_UNLOCK_MASK;
1017 pp |= PANEL_UNLOCK_REGS;
1018 1025
1019 if (IS_GEN5(dev)) { 1026 if (IS_GEN5(dev)) {
1020 /* ILK workaround: disable reset around power sequence */ 1027 /* ILK workaround: disable reset around power sequence */
@@ -1049,9 +1056,7 @@ static void ironlake_edp_panel_off(struct drm_encoder *encoder)
1049 1056
1050 if (!is_edp(intel_dp)) 1057 if (!is_edp(intel_dp))
1051 return; 1058 return;
1052 pp = I915_READ(PCH_PP_CONTROL); 1059 pp = ironlake_get_pp_control(dev_priv);
1053 pp &= ~PANEL_UNLOCK_MASK;
1054 pp |= PANEL_UNLOCK_REGS;
1055 1060
1056 if (IS_GEN5(dev)) { 1061 if (IS_GEN5(dev)) {
1057 /* ILK workaround: disable reset around power sequence */ 1062 /* ILK workaround: disable reset around power sequence */
@@ -1098,9 +1103,7 @@ static void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
1098 * allowing it to appear. 1103 * allowing it to appear.
1099 */ 1104 */
1100 msleep(intel_dp->backlight_on_delay); 1105 msleep(intel_dp->backlight_on_delay);
1101 pp = I915_READ(PCH_PP_CONTROL); 1106 pp = ironlake_get_pp_control(dev_priv);
1102 pp &= ~PANEL_UNLOCK_MASK;
1103 pp |= PANEL_UNLOCK_REGS;
1104 pp |= EDP_BLC_ENABLE; 1107 pp |= EDP_BLC_ENABLE;
1105 I915_WRITE(PCH_PP_CONTROL, pp); 1108 I915_WRITE(PCH_PP_CONTROL, pp);
1106 POSTING_READ(PCH_PP_CONTROL); 1109 POSTING_READ(PCH_PP_CONTROL);
@@ -1116,9 +1119,7 @@ static void ironlake_edp_backlight_off(struct intel_dp *intel_dp)
1116 return; 1119 return;
1117 1120
1118 DRM_DEBUG_KMS("\n"); 1121 DRM_DEBUG_KMS("\n");
1119 pp = I915_READ(PCH_PP_CONTROL); 1122 pp = ironlake_get_pp_control(dev_priv);
1120 pp &= ~PANEL_UNLOCK_MASK;
1121 pp |= PANEL_UNLOCK_REGS;
1122 pp &= ~EDP_BLC_ENABLE; 1123 pp &= ~EDP_BLC_ENABLE;
1123 I915_WRITE(PCH_PP_CONTROL, pp); 1124 I915_WRITE(PCH_PP_CONTROL, pp);
1124 POSTING_READ(PCH_PP_CONTROL); 1125 POSTING_READ(PCH_PP_CONTROL);