From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paulo Zanoni Subject: [PATCH 3/6] drm/i915: reset eDP timestamps on resume Date: Fri, 17 Jan 2014 18:17:42 -0200 Message-ID: <1389989862-1904-1-git-send-email-przanoni@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-qe0-f45.google.com (mail-qe0-f45.google.com [209.85.128.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 66825FD0F7 for ; Fri, 17 Jan 2014 12:17:54 -0800 (PST) Received: by mail-qe0-f45.google.com with SMTP id x7so1919211qeu.32 for ; Fri, 17 Jan 2014 12:17:52 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org From: Paulo Zanoni The eDP code records a few timestamps containing the last time we took some actions, because we need to wait before doing some other actions. The problem is that if we store a timestamp when suspending and then look at it when resuming, we'll ignore the unknown amount of time we actually were suspended. This happens with the panel power cycle delay: it's 500ms on my machine, and it's delaying the resume sequence by 200ms due to a timestamp we recorded before suspending. This patch should solve this problem by resetting the timestamps. v2: - Fix the madatory jiffies/milliseconds bug. v3: - We can use drm_connector->reset after Daniel's recent refactor. Signed-off-by: Paulo Zanoni --- 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 55c43cf..001fb06 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3302,12 +3302,34 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) kfree(intel_dig_port); } +void intel_dp_reset(struct drm_connector *connector) +{ + struct intel_dp *intel_dp = intel_attached_dp(connector); + unsigned long tmp_jiffies = jiffies; + + if (!is_edp(intel_dp)) + return; + + /* + * Reset everything, otherwise when suspend/resume gets very fast, we + * delay the resume based on the values that were set when we were still + * suspending. + */ + intel_dp->last_power_on = tmp_jiffies - + msecs_to_jiffies(intel_dp->backlight_on_delay); + intel_dp->last_power_cycle = tmp_jiffies - + msecs_to_jiffies(intel_dp->panel_power_cycle_delay); + intel_dp->last_backlight_off = tmp_jiffies - + msecs_to_jiffies(intel_dp->backlight_off_delay); +} + static const struct drm_connector_funcs intel_dp_connector_funcs = { .dpms = intel_connector_dpms, .detect = intel_dp_detect, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_set_property, .destroy = intel_dp_connector_destroy, + .reset = intel_dp_reset, }; static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = { -- 1.8.4.2