Re: [PATCH] drm/i915: edp resume/On time optimization.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/16/2015 03:46 AM, abhay.kumar@xxxxxxxxx wrote:
From: Abhay Kumar <abhay.kumar@xxxxxxxxx>

Make resume codepath not to wait for panel_power_cycle_delay(t11_t12)
if this time is already spent in suspend/poweron time.

Signed-off-by: Abhay Kumar <abhay.kumar@xxxxxxxxx>
---
  drivers/gpu/drm/i915/intel_ddi.c |  3 +++
  drivers/gpu/drm/i915/intel_dp.c  | 18 ++++++++++++++++++
  drivers/gpu/drm/i915/intel_drv.h |  2 ++
  3 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index f00a3c9..d2a5a89 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
  		intel_edp_panel_vdd_on(intel_dp);
  		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */
+		do_gettimeofday(&intel_dp->panel_power_off_timestamp);

Store this in edp_panel_off where "last_power_cycle" is initialized. This would be generic optimization and not specific only to ddi.

  	}

  	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0f1eb96..1ca01b1 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2032,6 +2032,9 @@ static void edp_panel_on(struct intel_dp *intel_dp)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	u32 pp;
  	i915_reg_t pp_ctrl_reg;
+	u32 panel_power_off_duration;
+	u32 temp_power_cycle_delay;
+

  	lockdep_assert_held(&dev_priv->pps_mutex);

@@ -2045,8 +2048,22 @@ static void edp_panel_on(struct intel_dp *intel_dp)
  		 "eDP port %c panel power already on\n",
  		 port_name(dp_to_dig_port(intel_dp)->port)))
  		return;
+	/* taking the diffrence of currrent time and panel power off time
+	   and then make panel to wait for T12 if needed */
+	do_gettimeofday(&intel_dp->panel_power_on_timestamp);
+
+	panel_power_off_duration  = (intel_dp->panel_power_on_timestamp.tv_sec-intel_dp->panel_power_off_timestamp.tv_sec) * 1000000 +  intel_dp->panel_power_on_timestamp.tv_usec-intel_dp->panel_power_off_timestamp.tv_usec;
+	panel_power_off_duration = panel_power_off_duration / 1000 ;
+	temp_power_cycle_delay = intel_dp->panel_power_cycle_delay;
+
+	if(panel_power_off_duration >= intel_dp->panel_power_cycle_delay) {
+		intel_dp->panel_power_cycle_delay = 0;
+	} else {
+		intel_dp->panel_power_cycle_delay = intel_dp->panel_power_cycle_delay - panel_power_off_duration;
+	}


Moving all adjustment inside wait_panel_power_cycle looks better to me. Also checkout timeval_to_jiffies to simplify the code.

  	wait_panel_power_cycle(intel_dp);
+	intel_dp->panel_power_cycle_delay = temp_power_cycle_delay;

  	pp_ctrl_reg = _pp_ctrl_reg(intel_dp);
  	pp = ironlake_get_pp_control(intel_dp);
@@ -5127,6 +5144,7 @@ static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
  	intel_dp->last_power_cycle = jiffies;
  	intel_dp->last_power_on = jiffies;
  	intel_dp->last_backlight_off = jiffies;
+	do_gettimeofday(&intel_dp->panel_power_off_timestamp);
  }

  static void
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 76dfa28..66ed2cb 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -769,6 +769,8 @@ struct intel_dp {
  	unsigned long last_power_cycle;
  	unsigned long last_power_on;
  	unsigned long last_backlight_off;
+	struct timeval panel_power_off_timestamp;
+	struct timeval panel_power_on_timestamp;

panel_power_on_timestamp is not needed to be stored in the structure. What we need is current time which can be locally obtained and consumed in wait_panel_power_cycle

Regards
Shobhit

  	struct notifier_block edp_notifier;


_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux