From: Imre Deak <imre.deak@intel.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 19/19] drm/i915: power domains: add vlv power wells
Date: Wed, 26 Feb 2014 20:02:19 +0200 [thread overview]
Message-ID: <1393437739.29921.10.camel@intelbox> (raw)
In-Reply-To: <20140220115832.54d27680@jbarnes-desktop>
[-- Attachment #1.1: Type: text/plain, Size: 5333 bytes --]
On Thu, 2014-02-20 at 11:58 -0800, Jesse Barnes wrote:
> On Wed, 19 Feb 2014 14:29:44 +0200
> Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
>
> > On Tue, Feb 18, 2014 at 12:02:20AM +0200, Imre Deak wrote:
> > > Based on an early draft from Jesse.
> > >
> > > Add support for powering on/off the dynamic power wells on VLV by
> > > registering its display and dpio dynamic power wells with the power
> > > domain framework.
> > >
> > > For now power on all PHY TX lanes regardless of the actual lane
> > > configuration. Later this can be optimized when the PHY side setup
> > > enables only the required lanes. Atm, it enables all lanes in all
> > > cases.
> > >
> > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > ---
> > > drivers/gpu/drm/i915/i915_dma.c | 1 -
> > > drivers/gpu/drm/i915/i915_drv.h | 2 +-
> > > drivers/gpu/drm/i915/intel_display.c | 1 +
> > > drivers/gpu/drm/i915/intel_pm.c | 228 +++++++++++++++++++++++++++++++++++
> > > 4 files changed, 230 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > > index dca4dc3..f8f7a59 100644
> > > --- a/drivers/gpu/drm/i915/i915_dma.c
> > > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > > @@ -1668,7 +1668,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> > > goto out_mtrrfree;
> > > }
> > >
> > > - dev_priv->display_irqs_enabled = true;
> > > intel_irq_init(dev);
> > > intel_uncore_sanitize(dev);
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > > index 227c349..804334e 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -1053,7 +1053,7 @@ struct i915_power_well {
> > > /* power well enable/disable usage count */
> > > int count;
> > > unsigned long domains;
> > > - void *data;
> > > + unsigned long data;
> > > const struct i915_power_well_ops *ops;
> > > };
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > > index ea00878..d6661c4 100644
> > > --- a/drivers/gpu/drm/i915/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/intel_display.c
> > > @@ -4224,6 +4224,7 @@ static void valleyview_modeset_global_resources(struct drm_device *dev)
> > >
> > > if (req_cdclk != cur_cdclk)
> > > valleyview_set_cdclk(dev, req_cdclk);
> > > + modeset_update_power_wells(dev);
> > > }
> > >
> > > static void valleyview_crtc_enable(struct drm_crtc *crtc)
> > > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > > index 68f58e5..e4416a7 100644
> > > --- a/drivers/gpu/drm/i915/intel_pm.c
> > > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > > @@ -5344,6 +5344,133 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
> > > hsw_enable_package_c8(dev_priv);
> > > }
> > >
> > > +static void vlv_set_power_well(struct drm_i915_private *dev_priv,
> > > + struct i915_power_well *power_well, bool enable)
> > > +{
> > > + enum punit_power_well power_well_id = power_well->data;
> > > + u32 mask;
> > > + u32 state;
> > > + u32 ctrl;
> > > +
> > > + mask = PUNIT_PWRGT_MASK(power_well_id);
> > > + state = enable ? PUNIT_PWRGT_PWR_ON(power_well_id) :
> > > + PUNIT_PWRGT_PWR_GATE(power_well_id);
> > > +
> > > + mutex_lock(&dev_priv->rps.hw_lock);
> > > +
> > > +#define COND \
> > > + ((vlv_punit_read(dev_priv, PUNIT_REG_PWRGT_STATUS) & mask) == state)
> > > +
> > > + if (COND)
> > > + goto out;
> > > +
> > > + ctrl = vlv_punit_read(dev_priv, PUNIT_REG_PWRGT_CTRL);
> > > + ctrl &= ~mask;
> > > + ctrl |= state;
> > > + vlv_punit_write(dev_priv, PUNIT_REG_PWRGT_CTRL, ctrl);
> > > +
> > > + if (wait_for(COND, 100))
> > > + DRM_ERROR("timout setting power well state %08x (%08x)\n",
> > > + state,
> > > + vlv_punit_read(dev_priv, PUNIT_REG_PWRGT_CTRL));
> >
> > #undef COND somewhere to avoid suprises further down in the code?
> >
> > > +
> > > +out:
> > > + mutex_unlock(&dev_priv->rps.hw_lock);
> > > +}
> > > +
> > <snip>
> >
>
> I'd like to see the code for re-enabling the display state land
> eventually too, so we can get savings when userspace uses DPMS instead
> of NULL mode sets for things. But to do that nicely requires some more
> work in the mode set code to pull out more PLL bits (also needed for
> atomic mode setting).
I guess you meant here the drm connector->funcs->dpms() callback, that's
called when setting the connector's dpms property. But I'm not sure what
you meant by re-enabling the display state.
I was thinking that we need to get/put the power domains around setting
DPMS off/on via the above property, but we actually don't need that.
Internally the dpms callback just calls the
display.disable_crtc/enable_crtc() which will disable/enable the pipes
but won't do anything with the power domains (which is only updated
during a normal modeset through display.modeset_global_resources().
This isn't optimal power-wise, but it's a separate issue. I think Daniel
had the idea of converting the dpms callback to be a proper NULL
modeset. In that case too the power domains will be get/put correctly.
--Imre
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-02-26 18:03 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 22:02 [PATCH 00/19] drm/i915: vlv power domains support Imre Deak
2014-02-17 22:02 ` [PATCH 01/19] drm/i915: use drm_i915_private everywhere in the power domain api Imre Deak
2014-02-20 19:16 ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 02/19] drm/i915: fold in __intel_power_well_get/put functions Imre Deak
2014-02-20 19:17 ` Jesse Barnes
2014-02-20 19:44 ` Chris Wilson
2014-02-24 13:23 ` Paulo Zanoni
2014-02-24 14:07 ` Imre Deak
2014-02-17 22:02 ` [PATCH 03/19] drm/i915: move modeset_update_power_wells earlier Imre Deak
2014-02-20 19:18 ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 04/19] drm/i915: move power domain macros to intel_pm.c Imre Deak
2014-02-20 19:21 ` Jesse Barnes
2014-02-24 13:38 ` Paulo Zanoni
2014-02-24 13:54 ` Imre Deak
2014-02-17 22:02 ` [PATCH 05/19] drm/i915: power domains: add power well ops Imre Deak
2014-02-20 19:26 ` Jesse Barnes
2014-02-24 11:42 ` Imre Deak
2014-02-17 22:02 ` [PATCH 06/19] drm/i915: remove power_well->always_on flag Imre Deak
2014-02-20 19:27 ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 07/19] drm/i915: add port power domains Imre Deak
2014-02-20 19:31 ` Jesse Barnes
2014-02-24 11:52 ` Imre Deak
2014-03-05 10:11 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 08/19] drm/i915: get port power domain in connector detect Imre Deak
2014-02-19 12:35 ` Ville Syrjälä
2014-02-19 12:39 ` Imre Deak
2014-02-20 19:33 ` Jesse Barnes
2014-02-24 11:56 ` Imre Deak
2014-03-05 10:15 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 09/19] drm/i915: check port power domain when reading the encoder hw state Imre Deak
2014-02-20 19:36 ` Jesse Barnes
2014-02-24 12:53 ` Imre Deak
2014-03-05 10:21 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 10/19] drm/i915: check pipe power domain when reading its " Imre Deak
2014-02-20 19:37 ` Jesse Barnes
2014-03-05 10:24 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 11/19] drm/i915: vlv: keep first level vblank IRQs masked Imre Deak
2014-02-18 16:54 ` Ville Syrjälä
2014-02-17 22:02 ` [PATCH 12/19] drm/i915: sanitize PUNIT register macro definitions Imre Deak
2014-02-20 19:46 ` Jesse Barnes
2014-02-24 13:12 ` Imre Deak
2014-02-17 22:02 ` [PATCH 13/19] drm/i915: factor out reset_vblank_counter Imre Deak
2014-02-18 16:55 ` Ville Syrjälä
2014-02-17 22:02 ` [PATCH 14/19] drm/i915: switch order of power domain init wrt. irq install Imre Deak
2014-02-20 19:48 ` Jesse Barnes
2014-02-24 13:23 ` Imre Deak
2014-03-05 10:29 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 15/19] drm/i915: use power domain api to check vga power state Imre Deak
2014-02-20 19:51 ` Jesse Barnes
2014-03-05 10:31 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 16/19] drm/i915: sanity check power well sw state against hw state Imre Deak
2014-02-18 16:55 ` Ville Syrjälä
2014-02-18 17:37 ` Imre Deak
2014-02-18 17:59 ` Ville Syrjälä
2014-03-05 10:32 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 17/19] drm/i915: vlv: factor out valleyview_display_irq_install Imre Deak
2014-02-20 19:56 ` Jesse Barnes
2014-02-24 13:34 ` Imre Deak
2014-02-17 22:02 ` [PATCH 18/19] drm/i915: move hsw power domain comment to its right place Imre Deak
2014-02-20 19:53 ` Jesse Barnes
2014-03-05 10:34 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 19/19] drm/i915: power domains: add vlv power wells Imre Deak
2014-02-19 12:29 ` Ville Syrjälä
2014-02-20 19:58 ` Jesse Barnes
2014-02-26 18:02 ` Imre Deak [this message]
2014-02-26 19:52 ` Jesse Barnes
2014-02-27 10:03 ` Imre Deak
2014-03-05 10:38 ` 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=1393437739.29921.10.camel@intelbox \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.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