From: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> Signed-off-by: Wayne Boyer <wayne.boyer@xxxxxxxxx> Change-Id: I0838b7c84f1913e1026ad98b8b2e79eb133d17e3 Reviewed-on: https://chromium-review.googlesource.com/192468 Reviewed-by: Stéphane Marchesin <marcheu@xxxxxxxxxxxx> Reviewed-by: Aaron Durbin <adurbin@xxxxxxxxxxxx> Tested-by: Wayne Boyer <wayne.boyer@xxxxxxxxx> Commit-Queue: Wayne Boyer <wayne.boyer@xxxxxxxxx> Conflicts: drivers/gpu/drm/i915/intel_dp.c --- drivers/gpu/drm/i915/intel_dp.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2adb727..90b24f6 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -369,6 +369,21 @@ static int edp_notify_handler(struct notifier_block *this, unsigned long code, return 0; } +static void assert_pwm(struct drm_i915_private *dev_priv, + struct intel_connector *connector, + bool expected_state) +{ + bool state; + + state = dev_priv->display.get_backlight(connector); + + WARN(state != expected_state, "pwm state failure, expected %d, found " + "%d\n", expected_state, state); +} + +#define assert_pwm_enabled(d, p) assert_pwm((d), (p), true) +#define assert_pwm_disabled(d, p) assert_pwm((d), (p), false) + static bool edp_have_panel_power(struct intel_dp *intel_dp) { struct drm_device *dev = intel_dp_to_dev(intel_dp); @@ -1351,6 +1366,8 @@ void intel_edp_panel_off(struct intel_dp *intel_dp) WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); + assert_pwm_disabled(dev_priv, intel_dp->attached_connector); + pp = ironlake_get_pp_control(intel_dp); /* We need to switch off panel power _and_ force vdd, for otherwise some * panels get very unhappy and cease to work. */ @@ -1387,6 +1404,8 @@ void intel_edp_backlight_on(struct intel_dp *intel_dp) intel_panel_enable_backlight(intel_dp->attached_connector); + assert_pwm_disabled(dev_priv, intel_dp->attached_connector); + /* * If we enable the backlight right away following a panel power * on, we may see slight flicker as the panel syncs with the eDP @@ -1415,6 +1434,9 @@ void intel_edp_backlight_off(struct intel_dp *intel_dp) DRM_DEBUG_KMS("\n"); pp = ironlake_get_pp_control(intel_dp); + + assert_pwm_enabled(dev_priv, intel_dp->attached_connector); + pp &= ~EDP_BLC_ENABLE; pp_ctrl_reg = _pp_ctrl_reg(intel_dp); -- 1.7.9.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx