All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: clinton.a.taylor@intel.com
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/dp: Backlight PWM enable before BL Enable assert
Date: Wed, 20 Aug 2014 14:23:23 +0300	[thread overview]
Message-ID: <20140820112323.GF4193@intel.com> (raw)
In-Reply-To: <1408394915-21882-1-git-send-email-clinton.a.taylor@intel.com>

On Mon, Aug 18, 2014 at 01:48:35PM -0700, clinton.a.taylor@intel.com wrote:
> From: Clint Taylor <clinton.a.taylor@intel.com>
> 
> Backlight on delay uses PWM enable time to seperate PWM to
> backlight enable assert. Previous time difference used timing
> from VDD enable which occur several seconds before resulting
> in PWM starting 5ms after backlight enable. Changes to backlight
>  duty cycle take affect at the end of the current PWM cycle.
> Measured time for the PWM cycle is 5ms. 5 additional ms must be
> added to the backlight_on_delay to get correct VBT timing of
> PWM to backlight enable assert.
> 
> V2: Rebase to Jani Nikula backlight power patch 1/4
> 
> Change-Id: I2982f9785d92e8d64c04ca25c8bd4c5d1dc8067c
> Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c  | 6 ++++--
>  drivers/gpu/drm/i915/intel_drv.h | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index d8baf60..aed923b 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1141,7 +1141,7 @@ static void wait_panel_power_cycle(struct intel_dp *intel_dp)
>  
>  static void wait_backlight_on(struct intel_dp *intel_dp)
>  {
> -	wait_remaining_ms_from_jiffies(intel_dp->last_power_on,
> +	wait_remaining_ms_from_jiffies(intel_dp->last_backlight_on,
>  				       intel_dp->backlight_on_delay);
>  }
>  
> @@ -1418,6 +1418,7 @@ void intel_edp_backlight_on(struct intel_dp *intel_dp)
>  	DRM_DEBUG_KMS("\n");
>  
>  	intel_panel_enable_backlight(intel_dp->attached_connector);
> +	intel_dp->last_backlight_on = jiffies;

Seems to me we should just have a msleep(PWM_CYCLE_DELAY) here since
(assuming I understood correctly) only the PWM cycle time is important
between these two steps, and the "t8" (vbt spec says t7 actually) is
relevant only from end of link training to backlight on.

Hmm, no actually your idea might be better since on VLV/CHV we turn the
pipe on after link training, and I assume t7/t8 should really start
counting from the pipe on on those platforms. So I guess the most
appropriate solution might be somehting like

 {
   intel_dp->last_backlight_on = jiffies;
   intel_panel_enable_backlight(intel_dp->attached_connector);
   msleep(POWER_CYCLE_DELAY);
   _intel_edp_backlight_on(intel_dp);
 }

But I'm not sure the distinction makes any difference since
intel_panel_enable_backlight() shouldn't take a significant amount of
time, and msleep() is itself rather inaccurate.

So I guess your approach is the simplest option here.

>  	_intel_edp_backlight_on(intel_dp);
>  }
>  
> @@ -4256,9 +4257,10 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
>  	assign_final(t11_t12);
>  #undef assign_final
>  
> +#define PWM_CYCLE_DELAY 5

Shoduln't this be calculated from the PWM frequqncy? Not sure what a PWM
cycle here is exactly. Just one full period of the signal?

Also would be nice to have a comment in the code explaining what this is
and why we need to add it to the delay.

>  #define get_delay(field)	(DIV_ROUND_UP(final.field, 10))
>  	intel_dp->panel_power_up_delay = get_delay(t1_t3);
> -	intel_dp->backlight_on_delay = get_delay(t8);
> +	intel_dp->backlight_on_delay = get_delay(t8) + PWM_CYCLE_DELAY;
>  	intel_dp->backlight_off_delay = get_delay(t9);
>  	intel_dp->panel_power_down_delay = get_delay(t10);
>  	intel_dp->panel_power_cycle_delay = get_delay(t11_t12);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3abc915..ad6fcc1 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -556,6 +556,7 @@ struct intel_dp {
>  	bool want_panel_vdd;
>  	unsigned long last_power_cycle;
>  	unsigned long last_power_on;
> +	unsigned long last_backlight_on;
>  	unsigned long last_backlight_off;
>  
>  	struct notifier_block edp_notifier;
> -- 
> 1.8.3.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-08-20 11:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 20:48 [PATCH] drm/i915/dp: Backlight PWM enable before BL Enable assert clinton.a.taylor
2014-08-20 11:23 ` Ville Syrjälä [this message]
2014-08-21 17:23   ` Clint Taylor
2014-08-22 10:10     ` Ville Syrjälä
2014-08-22 13:07     ` Jani Nikula
2014-08-22 17:12       ` Runyan, Arthur J
2014-08-26  9:51         ` Daniel Vetter
2014-08-27 20:54           ` Runyan, Arthur J
2014-09-03  0:27             ` Clint Taylor
2014-09-03  0:50               ` Runyan, Arthur J
  -- strict thread matches above, loose matches on Subject: below --
2014-08-14 23:04 clinton.a.taylor
2014-08-15 12:14 ` 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=20140820112323.GF4193@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=clinton.a.taylor@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.