Sure. In next patch set will get rid of jiffies altogether and will use 
getboottime() instead of do_gettimeofday() for panel_power_cycle_delay.

Does this make sense?


-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]] 
Sent: Wednesday, December 16, 2015 2:56 AM
To: Kumar, Abhay
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: edp resume/On time optimization.

On Tue, Dec 15, 2015 at 02:16:38PM -0800, [email protected] wrote:
> From: Abhay Kumar <[email protected]>
> 
> 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 <[email protected]>
> ---
>  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);

I think what we want to use is CLOCK_BOOTTIME. It's like MONOTONIC, except it 
counts the suspend time too.

Initially I figured we'd use REALTIME, and only do the adjustment around 
suspend/resume. But actually BOOTTIME should be perfectly safe to use all the 
time (changing the system time doesn't affect it). So maybe we just want to 
convert the power cycle delay handling entirely over to using the BOOTTIME 
clock instead of jiffies?

>       }
>  
>       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;
> +     }
>  
>       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;
>  
>       struct notifier_block edp_notifier;
>  
> --
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to