[PATCH 09/15] drm/i915: Fix intel_psr_is_enabled function and document it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This function can be used to check if psr feature got enabled.
However on HSW and BDW we currently force psr exit by disabling
EDP_PSR_ENABLE bit at EDP_PSR_CTL(dev). So this function was actually
returning the active/inactive state that is different from the enable/disable
meaning and had the risk of false negative.

So let's just return the presence of intel_dp at dev_priv->psr.enabled.

It would be more easy to just check this presence directly but let's keep
it more organized.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_psr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index 66d24c2..c296a89 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -61,6 +61,16 @@ static bool is_edp_psr(struct intel_dp *intel_dp)
 	return intel_dp->psr_dpcd[0] & DP_PSR_IS_SUPPORTED;
 }
 
+/**
+ * intel_psr_is_enabled - Is PSR enabled?
+ * @dev: DRM Device
+ *
+ * This function can be used to verify if PSR feature is enabled.
+ * Since on Haswell+ we force the exit by disabling
+ * EDP_PSR_ENABLE bit at EDP_PSR_CTL(dev)
+ * the most reliable way to export if psr feature is enabled is to
+ * check the presence of intel_dp at dev_priv->psr.enabled.
+ */
 bool intel_psr_is_enabled(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -68,7 +78,7 @@ bool intel_psr_is_enabled(struct drm_device *dev)
 	if (!HAS_PSR(dev))
 		return false;
 
-	return I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE;
+	return (bool)dev_priv->psr.enabled;
 }
 
 static void intel_psr_write_vsc(struct intel_dp *intel_dp,
-- 
1.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux