drm/i915: Markup paired operations on display power domains
The majority of runtime-pm operations are bounded and scoped within a function; these are easy to verify that the wakeref are handled correctly. We can employ the compiler to help us, and reduce the number of wakerefs tracked when debugging, by passing around cookies provided by the various rpm_get functions to their rpm_put counterpart. This makes the pairing explicit, and given the required wakeref cookie the compiler can verify that we pass an initialised value to the rpm_put (quite handy for double checking error paths). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190114142129.24398-16-chris@chris-wilson.co.uk
This commit is contained in:
@@ -520,6 +520,7 @@ static void vlv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
int cdclk = cdclk_state->cdclk;
|
||||
u32 val, cmd = cdclk_state->voltage_level;
|
||||
intel_wakeref_t wakeref;
|
||||
|
||||
switch (cdclk) {
|
||||
case 400000:
|
||||
@@ -539,7 +540,7 @@ static void vlv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
* a system suspend. So grab the PIPE-A domain, which covers
|
||||
* the HW blocks needed for the following programming.
|
||||
*/
|
||||
intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE_A);
|
||||
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE_A);
|
||||
|
||||
mutex_lock(&dev_priv->pcu_lock);
|
||||
val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
|
||||
@@ -593,7 +594,7 @@ static void vlv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
|
||||
vlv_program_pfi_credits(dev_priv);
|
||||
|
||||
intel_display_power_put(dev_priv, POWER_DOMAIN_PIPE_A);
|
||||
intel_display_power_put(dev_priv, POWER_DOMAIN_PIPE_A, wakeref);
|
||||
}
|
||||
|
||||
static void chv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
@@ -601,6 +602,7 @@ static void chv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
int cdclk = cdclk_state->cdclk;
|
||||
u32 val, cmd = cdclk_state->voltage_level;
|
||||
intel_wakeref_t wakeref;
|
||||
|
||||
switch (cdclk) {
|
||||
case 333333:
|
||||
@@ -619,7 +621,7 @@ static void chv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
* a system suspend. So grab the PIPE-A domain, which covers
|
||||
* the HW blocks needed for the following programming.
|
||||
*/
|
||||
intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE_A);
|
||||
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE_A);
|
||||
|
||||
mutex_lock(&dev_priv->pcu_lock);
|
||||
val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
|
||||
@@ -637,7 +639,7 @@ static void chv_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
|
||||
vlv_program_pfi_credits(dev_priv);
|
||||
|
||||
intel_display_power_put(dev_priv, POWER_DOMAIN_PIPE_A);
|
||||
intel_display_power_put(dev_priv, POWER_DOMAIN_PIPE_A, wakeref);
|
||||
}
|
||||
|
||||
static int bdw_calc_cdclk(int min_cdclk)
|
||||
|
Reference in New Issue
Block a user