]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Add helper to get a display power ref if it was already enabled
authorImre Deak <imre.deak@intel.com>
Wed, 17 Feb 2016 12:17:42 +0000 (14:17 +0200)
committerImre Deak <imre.deak@intel.com>
Wed, 17 Feb 2016 14:07:17 +0000 (16:07 +0200)
commit6f4872eba6370fb13ea4a64bc1d6217e811858ae
tree87e83ae95851ee6c558fb620585b7bceeef7cc46
parentb44207c0aff1c764bb3df21b6ef08be4f2fa0f30
drm/i915: Add helper to get a display power ref if it was already enabled

We have many places in the code where we check if a given display power
domain is enabled and if so access registers backed by this power
domain. We assumed that some modeset lock will prevent the power
reference from vanishing in the middle of the HW access, but this
assumption doesn't always hold. In such cases we get either the wakeref
not held, or an unclaimed register access error message. To fix this in
a future-proof way that's independent of other locks wrap any such
access with a get_ref_if_enabled()/put_ref() pair.

Kudos to Ville and Joonas for the ideas of this new interface.

v2:
- init the power_domains ptr when declaring it everywhere (Joonas)
v3:
- don't report the device to be powered if runtime PM is disabled

CC: Mika Kuoppala <mika.kuoppala@intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1455711462-7442-1-git-send-email-imre.deak@intel.com
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_runtime_pm.c