From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 7/8] drm/i915: add a default always-on power well
Date: Fri, 1 Nov 2013 19:19:53 +0200 [thread overview]
Message-ID: <1383326394-3933-8-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1383326394-3933-1-git-send-email-imre.deak@intel.com>
So far we distinguished platforms without a dynamic power well with
the HAS_POWER_WELL macro and for such platforms we didn't call any power
domain functions. Instead of doing this check we can add an always-on
power well for these platforms and call the power domain functions
unconditionally. For always-on power wells we only increase/decrease
their refcounts, otherwise they are a nop.
This makes high level driver code more readable and as a bonus provides
some idea of the current power domains state for all platforms (once
the relevant debugfs entry is added).
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/i915_dma.c | 18 +++++++-----------
drivers/gpu/drm/i915/i915_drv.h | 1 -
drivers/gpu/drm/i915/intel_pm.c | 29 ++++++++++-------------------
3 files changed, 17 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 0cab2d0..b57c3da 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1639,8 +1639,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
goto out_gem_unload;
}
- if (HAS_POWER_WELL(dev))
- intel_power_domains_init(dev);
+ intel_power_domains_init(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = i915_load_modeset_init(dev);
@@ -1667,8 +1666,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
return 0;
out_power_well:
- if (HAS_POWER_WELL(dev))
- intel_power_domains_remove(dev);
+ intel_power_domains_remove(dev);
drm_vblank_cleanup(dev);
out_gem_unload:
if (dev_priv->mm.inactive_shrinker.scan_objects)
@@ -1706,13 +1704,11 @@ int i915_driver_unload(struct drm_device *dev)
intel_gpu_ips_teardown();
- if (HAS_POWER_WELL(dev)) {
- /* The i915.ko module is still not prepared to be loaded when
- * the power well is not enabled, so just enable it in case
- * we're going to unload/reload. */
- intel_display_set_init_power(dev, true);
- intel_power_domains_remove(dev);
- }
+ /* The i915.ko module is still not prepared to be loaded when
+ * the power well is not enabled, so just enable it in case
+ * we're going to unload/reload. */
+ intel_display_set_init_power(dev, true);
+ intel_power_domains_remove(dev);
i915_teardown_sysfs(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 555a6fc..05365e3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1795,7 +1795,6 @@ struct drm_i915_file_private {
#define HAS_IPS(dev) (IS_ULT(dev))
#define HAS_DDI(dev) (INTEL_INFO(dev)->has_ddi)
-#define HAS_POWER_WELL(dev) (IS_HASWELL(dev))
#define HAS_FPGA_DBG_UNCLAIMED(dev) (INTEL_INFO(dev)->has_fpga_dbg)
#define HAS_PSR(dev) (IS_HASWELL(dev))
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index ba4baf1..f35cb5d 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5540,9 +5540,6 @@ bool intel_display_power_enabled(struct drm_device *dev,
bool is_enabled;
int i;
- if (!HAS_POWER_WELL(dev))
- return true;
-
power_domains = &dev_priv->power_domains;
is_enabled = true;
@@ -5634,9 +5631,6 @@ void intel_display_power_get(struct drm_device *dev,
struct i915_power_well *power_well;
int i;
- if (!HAS_POWER_WELL(dev))
- return;
-
power_domains = &dev_priv->power_domains;
mutex_lock(&power_domains->lock);
@@ -5653,9 +5647,6 @@ void intel_display_power_put(struct drm_device *dev,
struct i915_power_well *power_well;
int i;
- if (!HAS_POWER_WELL(dev))
- return;
-
power_domains = &dev_priv->power_domains;
mutex_lock(&power_domains->lock);
@@ -5694,6 +5685,14 @@ void i915_release_power_well(void)
}
EXPORT_SYMBOL_GPL(i915_release_power_well);
+static struct i915_power_well intel_power_wells[] = {
+ {
+ .name = "always-on",
+ .always_on = 1,
+ .domains = POWER_DOMAIN_MASK,
+ },
+};
+
static struct i915_power_well hsw_power_wells[] = {
{
.name = "always-on",
@@ -5713,9 +5712,6 @@ int intel_power_domains_init(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
struct i915_power_domains *power_domains = &dev_priv->power_domains;
- if (!HAS_POWER_WELL(dev))
- return 0;
-
mutex_init(&power_domains->lock);
/*
@@ -5728,7 +5724,8 @@ int intel_power_domains_init(struct drm_device *dev)
hsw_pwr = power_domains;
} else {
- WARN_ON(1);
+ power_domains->power_wells = intel_power_wells;
+ power_domains->power_well_count = ARRAY_SIZE(intel_power_wells);
}
return 0;
@@ -5746,9 +5743,6 @@ static void intel_power_domains_resume(struct drm_device *dev)
struct i915_power_well *power_well;
int i;
- if (!HAS_POWER_WELL(dev))
- return;
-
mutex_lock(&power_domains->lock);
for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) {
if (power_well->set)
@@ -5767,9 +5761,6 @@ void intel_power_domains_init_hw(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- if (!HAS_POWER_WELL(dev))
- return;
-
/* For now, we need the power well to be always enabled. */
intel_display_set_init_power(dev, true);
intel_power_domains_resume(dev);
--
1.8.4
next prev parent reply other threads:[~2013-11-01 17:20 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 ` Imre Deak [this message]
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 ` [PATCH v3 3/8] drm/i915: add always-on power wells instead of special casing them Imre Deak
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=1383326394-3933-8-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