Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/dp: Flush any outstanding work to turn the VDD off
Date: Mon, 16 Apr 2012 22:39:51 +0200	[thread overview]
Message-ID: <20120416203951.GH4199@phenom.ffwll.local> (raw)
In-Reply-To: <1334585913-9831-1-git-send-email-chris@chris-wilson.co.uk>

On Mon, Apr 16, 2012 at 03:18:33PM +0100, Chris Wilson wrote:
> As we may kick off a delayed workqueue task to switch of the VDD lines, we
> need to complete that task prior to turning off the panel (which itself
> depends upon VDD being off).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Keith Packard <keithp@keithp.com>

I've looked a bit at this and I think we just need a call to
ironlake_panel_vdd_off_sync instead of the WARN. The work will do the
right thing when the vdd is already off, so no problem there.

What problem we have though is that when we call cancel_work_sync we're
holding the config mutex, which the vdd work needs, too. Which is a nice
deadlock (which can currently only happen at module unload). I guess we
need a vdd_power mutex in the intel_dp struct just for this, so that we
can cancel the work without holding it, but protect all the vdd state
tracking from concurrent changes, still. The work would the only grab the
vdd_power mutex.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_dp.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f07652b..7c2b5e1 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1040,6 +1040,12 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
>  	}
>  }
>  
> +static void ironlake_panel_vdd_off_flush(struct intel_dp *intel_dp)
> +{
> +	cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
> +	ironlake_panel_vdd_off_sync(intel_dp);
> +}
> +
>  static void ironlake_panel_vdd_work(struct work_struct *__work)
>  {
>  	struct intel_dp *intel_dp = container_of(to_delayed_work(__work),
> @@ -1128,6 +1134,7 @@ static void ironlake_edp_panel_off(struct intel_dp *intel_dp)
>  	DRM_DEBUG_KMS("Turn eDP power off\n");
>  
>  	WARN(intel_dp->want_panel_vdd, "Cannot turn power off while VDD is on\n");
> +	ironlake_panel_vdd_off_flush(intel_dp);
>  
>  	pp = ironlake_get_pp_control(dev_priv);
>  	pp &= ~(POWER_TARGET_ON | EDP_FORCE_VDD | PANEL_POWER_RESET | EDP_BLC_ENABLE);
> -- 
> 1.7.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

  reply	other threads:[~2012-04-16 20:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 14:18 [PATCH] drm/i915/dp: Flush any outstanding work to turn the VDD off Chris Wilson
2012-04-16 20:39 ` Daniel Vetter [this message]
2012-04-16 21:01   ` Chris Wilson
2012-04-16 21:53     ` Daniel Vetter
2012-04-16 21:43   ` Chris Wilson
2012-04-16 22:35     ` Daniel Vetter

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=20120416203951.GH4199@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox