Commit 9eb4826f authored by Jani Nikula's avatar Jani Nikula

drm/i915/opregion: abstract ASLE presence check

Add a function to check the opregion ASLE presence instead of accessing
the opregion structures directly.

Reorder the checks in i915_has_asle() to avoid the function call if
possible.

Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: default avatarRadhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1829415d3e7b29e78c46b20bca8175ef373bcd92.1704992868.git.jani.nikula@intel.com
parent 37e21003
......@@ -266,12 +266,12 @@ void i915_disable_pipestat(struct drm_i915_private *dev_priv,
intel_uncore_posting_read(&dev_priv->uncore, reg);
}
static bool i915_has_asle(struct drm_i915_private *dev_priv)
static bool i915_has_asle(struct drm_i915_private *i915)
{
if (!dev_priv->display.opregion.asle)
if (!IS_PINEVIEW(i915) && !IS_MOBILE(i915))
return false;
return IS_PINEVIEW(dev_priv) || IS_MOBILE(dev_priv);
return intel_opregion_asle_present(i915);
}
/**
......
......@@ -632,6 +632,11 @@ static void asle_work(struct work_struct *work)
asle->aslc = aslc_stat;
}
bool intel_opregion_asle_present(struct drm_i915_private *i915)
{
return i915->display.opregion.asle;
}
void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
{
if (dev_priv->display.opregion.asle)
......
......@@ -69,6 +69,7 @@ void intel_opregion_resume(struct drm_i915_private *dev_priv);
void intel_opregion_suspend(struct drm_i915_private *dev_priv,
pci_power_t state);
bool intel_opregion_asle_present(struct drm_i915_private *i915);
void intel_opregion_asle_intr(struct drm_i915_private *dev_priv);
int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
bool enable);
......@@ -111,6 +112,11 @@ static inline void intel_opregion_suspend(struct drm_i915_private *dev_priv,
{
}
static inline bool intel_opregion_asle_present(struct drm_i915_private *i915)
{
return false;
}
static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
{
}
......
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