Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 3/8] drm/i915: add always-on power wells instead of special casing them
Date: Mon, 25 Nov 2013 17:15:30 +0200	[thread overview]
Message-ID: <1385392535-3794-4-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1385392535-3794-1-git-send-email-imre.deak@intel.com>
In-Reply-To: <1384434623-2954-1-git-send-email-imre.deak@intel.com>

Instead of using a separate function to check whether a power domain is
is always on, add an always-on power well covering all these power
domains and do the usual get/put on these unconditionally. Since we
don't assign a .set handler for these the get/put won't have any effect
besides the adjusted refcount.

This makes the code more readable and provides debug info also on the
use of always-on power wells (once the relevant debugfs entry is added.)

v3: make is_always_on to be bool instead of a bit field (Paulo)

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 41 +++++++++++++----------------------------
 2 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b20016c..701a7fb 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -946,6 +946,7 @@ struct intel_ilk_power_mgmt {
 /* Power well structure for haswell */
 struct i915_power_well {
 	const char *name;
+	bool always_on;
 	/* power well enable/disable usage count */
 	int count;
 	unsigned long domains;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 2b39a9c..ee5aeb1 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5606,25 +5606,6 @@ void intel_suspend_hw(struct drm_device *dev)
 		lpt_suspend_hw(dev);
 }
 
-static bool is_always_on_power_domain(struct drm_device *dev,
-				      enum intel_display_power_domain domain)
-{
-	unsigned long always_on_domains;
-
-	BUG_ON(BIT(domain) & ~POWER_DOMAIN_MASK);
-
-	if (IS_BROADWELL(dev)) {
-		always_on_domains = BDW_ALWAYS_ON_POWER_DOMAINS;
-	} else if (IS_HASWELL(dev)) {
-		always_on_domains = HSW_ALWAYS_ON_POWER_DOMAINS;
-	} else {
-		WARN_ON(1);
-		return true;
-	}
-
-	return BIT(domain) & always_on_domains;
-}
-
 #define for_each_power_well(i, power_well, domain_mask, power_domains)	\
 	for (i = 0;							\
 	     i < (power_domains)->power_well_count &&			\
@@ -5664,15 +5645,15 @@ bool intel_display_power_enabled(struct drm_device *dev,
 	if (!HAS_POWER_WELL(dev))
 		return true;
 
-	if (is_always_on_power_domain(dev, domain))
-		return true;
-
 	power_domains = &dev_priv->power_domains;
 
 	is_enabled = true;
 
 	mutex_lock(&power_domains->lock);
 	for_each_power_well_rev(i, power_well, BIT(domain), power_domains) {
+		if (power_well->always_on)
+			continue;
+
 		if (!power_well->is_enabled(dev, power_well)) {
 			is_enabled = false;
 			break;
@@ -5774,9 +5755,6 @@ void intel_display_power_get(struct drm_device *dev,
 	if (!HAS_POWER_WELL(dev))
 		return;
 
-	if (is_always_on_power_domain(dev, domain))
-		return;
-
 	power_domains = &dev_priv->power_domains;
 
 	mutex_lock(&power_domains->lock);
@@ -5796,9 +5774,6 @@ void intel_display_power_put(struct drm_device *dev,
 	if (!HAS_POWER_WELL(dev))
 		return;
 
-	if (is_always_on_power_domain(dev, domain))
-		return;
-
 	power_domains = &dev_priv->power_domains;
 
 	mutex_lock(&power_domains->lock);
@@ -5839,6 +5814,11 @@ EXPORT_SYMBOL_GPL(i915_release_power_well);
 
 static struct i915_power_well hsw_power_wells[] = {
 	{
+		.name = "always-on",
+		.always_on = 1,
+		.domains = HSW_ALWAYS_ON_POWER_DOMAINS,
+	},
+	{
 		.name = "display",
 		.domains = POWER_DOMAIN_MASK & ~HSW_ALWAYS_ON_POWER_DOMAINS,
 		.is_enabled = hsw_power_well_enabled,
@@ -5848,6 +5828,11 @@ static struct i915_power_well hsw_power_wells[] = {
 
 static struct i915_power_well bdw_power_wells[] = {
 	{
+		.name = "always-on",
+		.always_on = 1,
+		.domains = BDW_ALWAYS_ON_POWER_DOMAINS,
+	},
+	{
 		.name = "display",
 		.domains = POWER_DOMAIN_MASK & ~BDW_ALWAYS_ON_POWER_DOMAINS,
 		.is_enabled = hsw_power_well_enabled,
-- 
1.8.4

  parent reply	other threads:[~2013-11-25 15:15 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 17:19 [PATCH 0/8] support for multiple power wells Imre Deak
2013-11-01 17:19 ` [PATCH 1/8] drm/i915: add audio power domain Imre Deak
2013-11-04 16:23   ` Paulo Zanoni
2013-11-01 17:19 ` [PATCH 2/8] drm/i915: support for multiple power wells Imre Deak
2013-11-01 17:19 ` [PATCH 3/8] drm/i915: add always-on power wells instead of special casing them Imre Deak
2013-11-01 17:19 ` [PATCH 4/8] drm/i915: s/HAS_POWER_WELL/IS_HASWELL/ in intel_display_capture_error_state Imre Deak
2013-11-01 19:41   ` Daniel Vetter
2013-11-01 20:37     ` Imre Deak
2013-11-01 17:19 ` [PATCH 5/8] drm/i915: protect HSW power well check with IS_HASWELL in redisable_vga Imre Deak
2013-11-01 17:19 ` [PATCH 6/8] drm/i915: restrict HSW specific powerdomains HW init to HSW Imre Deak
2013-11-01 17:19 ` [PATCH 7/8] drm/i915: add a default always-on power well Imre Deak
2013-11-01 17:19 ` [PATCH 8/8] drm/i915: add a debugfs entry for power domain info Imre Deak
2013-11-14 13:10 ` [PATCH v2 0/8] support for multiple power wells Imre Deak
2013-11-25 15:15   ` [PATCH v3 " Imre Deak
2013-11-26 18:46     ` Paulo Zanoni
2013-11-26 19:09       ` Daniel Vetter
2013-11-25 15:15   ` [PATCH v3 1/8] drm/i915: add audio power domain Imre Deak
2013-11-25 15:15   ` [PATCH v3 2/8] drm/i915: support for multiple power wells Imre Deak
2013-11-25 15:15   ` Imre Deak [this message]
2013-11-25 15:15   ` [PATCH v3 4/8] drm/i915: use IS_HASWELL/BROADWELL instead of HAS_POWER_WELL Imre Deak
2013-11-25 15:15   ` [PATCH v3 5/8] drm/i915: protect HSW power well check with IS_HASWELL in redisable_vga Imre Deak
2013-11-25 15:15   ` [PATCH v3 6/8] drm/i915: don't do BDW/HSW specific powerdomains init on other platforms Imre Deak
2013-11-25 15:15   ` [PATCH v3 7/8] drm/i915: add a default always-on power well Imre Deak
2013-11-25 15:15   ` [PATCH v3 8/8] drm/i915: add a debugfs entry for power domain info Imre Deak
2013-11-14 13:10 ` [PATCH v2 1/8] drm/i915: add audio power domain Imre Deak
2013-11-14 13:10 ` [PATCH v2 2/8] drm/i915: support for multiple power wells Imre Deak
2013-11-22 15:53   ` Paulo Zanoni
2013-11-22 18:36     ` Imre Deak
2013-11-22 18:59       ` Paulo Zanoni
2013-11-14 13:10 ` [PATCH v2 3/8] drm/i915: add always-on power wells instead of special casing them Imre Deak
2013-11-22 16:04   ` Paulo Zanoni
2013-11-22 16:11     ` Ville Syrjälä
2013-11-14 13:10 ` [PATCH v2 4/8] drm/i915: use IS_HASWELL/BROADWELL instead of HAS_POWER_WELL Imre Deak
2013-11-22 15:41   ` Paulo Zanoni
2013-11-22 18:42     ` Imre Deak
2013-11-14 13:10 ` [PATCH v2 5/8] drm/i915: protect HSW power well check with IS_HASWELL in redisable_vga Imre Deak
2013-11-14 13:10 ` [PATCH v2 6/8] drm/i915: don't do BDW/HSW specific powerdomains init on other platforms Imre Deak
2013-11-22 16:09   ` Paulo Zanoni
2013-11-22 18:54     ` Imre Deak
2013-11-14 13:10 ` [PATCH v2 7/8] drm/i915: add a default always-on power well Imre Deak
2013-11-22 16:24   ` Paulo Zanoni
2013-11-14 13:11 ` [PATCH v2 8/8] drm/i915: add a debugfs entry for power domain info Imre Deak
2013-11-22 17:32   ` Paulo Zanoni
2013-11-22 19:04     ` Imre Deak
2013-11-25 14:37       ` Imre Deak

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=1385392535-3794-4-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --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