All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 3/6] drm/i915: reset eDP timestamps on resume
Date: Fri, 17 Jan 2014 18:17:42 -0200	[thread overview]
Message-ID: <1389989862-1904-1-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <CA+gsUGSKkuBLrNXYo39Cn1XmMovN+R_7c3fzVNQcJBhT9D7-5g@mail.gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

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 <paulo.r.zanoni@intel.com>
---
 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

  reply	other threads:[~2014-01-17 20:17 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 16:29 [PATCH 0/6] eDP panel power sequencing optimizations Paulo Zanoni
2013-12-19 16:29 ` [PATCH 1/6] drm/i915: init the DP panel power seq variables earlier Paulo Zanoni
2013-12-19 17:24   ` Jesse Barnes
2013-12-19 16:29 ` [PATCH 2/6] drm/i915: save some time when waiting the eDP timings Paulo Zanoni
2013-12-19 17:32   ` Jesse Barnes
2013-12-20  9:30   ` Jani Nikula
2013-12-20 14:24     ` Daniel Vetter
2014-01-03 18:27     ` Paulo Zanoni
2014-01-03 19:45       ` Paulo Zanoni
2014-01-17 13:09   ` Jani Nikula
2014-01-17 13:29     ` Daniel Vetter
2014-01-17 13:53       ` Daniel Vetter
2013-12-19 16:29 ` [PATCH 3/6] drm/i915: reset eDP timestamps on resume Paulo Zanoni
2013-12-19 17:35   ` Jesse Barnes
2014-01-03 19:46     ` Paulo Zanoni
2014-01-15 18:21       ` Jesse Barnes
2014-01-15 23:36         ` Daniel Vetter
2014-01-16 14:26           ` Paulo Zanoni
2014-01-17 20:17             ` Paulo Zanoni [this message]
2014-01-17 20:22               ` Chris Wilson
2014-01-17 21:11                 ` Paulo Zanoni
2014-01-17 21:21                   ` Chris Wilson
2014-01-17 21:34                     ` Daniel Vetter
2014-01-20 15:47                       ` Paulo Zanoni
2014-01-20 16:10                         ` Daniel Vetter
2013-12-19 16:29 ` [PATCH 4/6] drm/i915: remove a column of zeros from the eDP wait definitions Paulo Zanoni
2013-12-19 17:36   ` Jesse Barnes
2013-12-19 16:29 ` [PATCH 5/6] drm/i915: don't wait for power cycle when waiting for power off Paulo Zanoni
2013-12-19 17:38   ` Jesse Barnes
2013-12-19 18:34     ` Jesse Barnes
2013-12-19 16:29 ` [PATCH 6/6] drm/i915: set the backlight panel delays registers to 1 Paulo Zanoni
2013-12-19 17:39   ` Jesse Barnes
2014-01-17 13:57     ` Daniel Vetter
2014-01-20 16:12       ` Daniel Vetter
2014-01-28  7:57   ` Jani Nikula
2014-01-28  8:02     ` Daniel Vetter
2014-01-28  8:23       ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389989862-1904-1-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.