mirror of https://gitee.com/openkylin/linux.git
drm/i915: get a permanent RPM reference on platforms w/o RPM support
Currently we disable RPM functionality on platforms that doesn't support this by not putting/getting the RPM reference we receive from the RPM core during driver loading/unloading respectively. This is somewhat obscure, so make it more explicit by keeping a reference dedicated for this particular purpose whenever the driver is loaded. This makes it possible to remove the HAS_RUNTIME_PM() special casing from every other places in the next patch. v2: - fix intel_runtime_pm_get vs. intel_runtime_pm_put in intel_power_domains_fini() v3: - take only a low level RPM reference so the ref tracking asserts continue to work (Ville) - update the commit message - move the patch earlier for bisectability Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1450352696-16135-1-git-send-email-imre.deak@intel.com
This commit is contained in:
parent
b268c699ac
commit
25b181b46e
|
@ -1975,6 +1975,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
|
||||||
*/
|
*/
|
||||||
void intel_power_domains_fini(struct drm_i915_private *dev_priv)
|
void intel_power_domains_fini(struct drm_i915_private *dev_priv)
|
||||||
{
|
{
|
||||||
|
struct device *device = &dev_priv->dev->pdev->dev;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The i915.ko module is still not prepared to be loaded when
|
* The i915.ko module is still not prepared to be loaded when
|
||||||
* the power well is not enabled, so just enable it in case
|
* the power well is not enabled, so just enable it in case
|
||||||
|
@ -1989,6 +1991,13 @@ void intel_power_domains_fini(struct drm_i915_private *dev_priv)
|
||||||
/* Remove the refcount we took to keep power well support disabled. */
|
/* Remove the refcount we took to keep power well support disabled. */
|
||||||
if (!i915.disable_power_well)
|
if (!i915.disable_power_well)
|
||||||
intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
|
intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove the refcount we took in intel_runtime_pm_enable() in case
|
||||||
|
* the platform doesn't support runtime PM.
|
||||||
|
*/
|
||||||
|
if (!HAS_RUNTIME_PM(dev_priv))
|
||||||
|
pm_runtime_put(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv)
|
static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv)
|
||||||
|
@ -2303,8 +2312,14 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
|
||||||
struct drm_device *dev = dev_priv->dev;
|
struct drm_device *dev = dev_priv->dev;
|
||||||
struct device *device = &dev->pdev->dev;
|
struct device *device = &dev->pdev->dev;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Take a permanent reference to disable the RPM functionality and drop
|
||||||
|
* it only when unloading the driver. Use the low level get/put helpers,
|
||||||
|
* so the driver's own RPM reference tracking asserts also work on
|
||||||
|
* platforms without RPM support.
|
||||||
|
*/
|
||||||
if (!HAS_RUNTIME_PM(dev))
|
if (!HAS_RUNTIME_PM(dev))
|
||||||
return;
|
pm_runtime_get_sync(device);
|
||||||
|
|
||||||
pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
|
pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
|
||||||
pm_runtime_mark_last_busy(device);
|
pm_runtime_mark_last_busy(device);
|
||||||
|
|
Loading…
Reference in New Issue