Commit 2a51835f authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

drm/i915/skl: Introduce enable_requested and is_enabled in the power well code

Just like what we do for HSW/BDW, having those variables makes it a bit
easier to parse the code.
Suggested-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4c6c03be
...@@ -294,7 +294,7 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, ...@@ -294,7 +294,7 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv,
{ {
uint32_t tmp, fuse_status; uint32_t tmp, fuse_status;
uint32_t req_mask, state_mask; uint32_t req_mask, state_mask;
bool check_fuse_status = false; bool is_enabled, enable_requested, check_fuse_status = false;
tmp = I915_READ(HSW_PWR_WELL_DRIVER); tmp = I915_READ(HSW_PWR_WELL_DRIVER);
fuse_status = I915_READ(SKL_FUSE_STATUS); fuse_status = I915_READ(SKL_FUSE_STATUS);
...@@ -325,15 +325,17 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, ...@@ -325,15 +325,17 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv,
} }
req_mask = SKL_POWER_WELL_REQ(power_well->data); req_mask = SKL_POWER_WELL_REQ(power_well->data);
enable_requested = tmp & req_mask;
state_mask = SKL_POWER_WELL_STATE(power_well->data); state_mask = SKL_POWER_WELL_STATE(power_well->data);
is_enabled = tmp & state_mask;
if (enable) { if (enable) {
if (!(tmp & req_mask)) { if (!enable_requested) {
I915_WRITE(HSW_PWR_WELL_DRIVER, tmp | req_mask); I915_WRITE(HSW_PWR_WELL_DRIVER, tmp | req_mask);
DRM_DEBUG_KMS("Enabling %s\n", power_well->name); DRM_DEBUG_KMS("Enabling %s\n", power_well->name);
} }
if (!(tmp & state_mask)) { if (!is_enabled) {
if (wait_for((I915_READ(HSW_PWR_WELL_DRIVER) & if (wait_for((I915_READ(HSW_PWR_WELL_DRIVER) &
state_mask), 1)) state_mask), 1))
DRM_ERROR("%s enable timeout\n", DRM_ERROR("%s enable timeout\n",
...@@ -341,7 +343,7 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, ...@@ -341,7 +343,7 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv,
check_fuse_status = true; check_fuse_status = true;
} }
} else { } else {
if (tmp & req_mask) { if (enable_requested) {
I915_WRITE(HSW_PWR_WELL_DRIVER, tmp & ~req_mask); I915_WRITE(HSW_PWR_WELL_DRIVER, tmp & ~req_mask);
POSTING_READ(HSW_PWR_WELL_DRIVER); POSTING_READ(HSW_PWR_WELL_DRIVER);
DRM_DEBUG_KMS("Disabling %s\n", power_well->name); DRM_DEBUG_KMS("Disabling %s\n", power_well->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment