| From 3e3fc7cebc1c398779837011c75b18b230239154 Mon Sep 17 00:00:00 2001 |
| From: Rodrigo Vivi <rodrigo.vivi@gmail.com> |
| Date: Thu, 11 Jul 2013 18:45:01 -0300 |
| Subject: drm/i915: add update function to disable/enable-back PSR |
| |
| Required function to disable PSR when going to console mode. |
| But also can be used whenever PSR mode entry conditions changed. |
| |
| v2: Add it before PSR Hook. Update function not really been called yet. |
| v3: Fix coding style detected by checkpatch by Paulo Zanoni. |
| v4: do_enable must be static as Paulo noticed. |
| |
| Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> |
| Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> |
| Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> |
| Reviewed-by: Shobhit Kumar <shobhit.kumar@intel.com> |
| Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> |
| (cherry picked from commit 3d739d92d9cbce6cdaf101fe78870f97fcbf5349) |
| Signed-off-by: Darren Hart <dvhart@linux.intel.com> |
| --- |
| drivers/gpu/drm/i915/intel_dp.c | 31 ++++++++++++++++++++++++++++++- |
| drivers/gpu/drm/i915/intel_drv.h | 1 + |
| 2 files changed, 31 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c |
| index 74e81383eddb..55f3c970a766 100644 |
| --- a/drivers/gpu/drm/i915/intel_dp.c |
| +++ b/drivers/gpu/drm/i915/intel_dp.c |
| @@ -1578,7 +1578,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) |
| return true; |
| } |
| |
| -void intel_edp_psr_enable(struct intel_dp *intel_dp) |
| +static void intel_edp_psr_do_enable(struct intel_dp *intel_dp) |
| { |
| struct drm_device *dev = intel_dp_to_dev(intel_dp); |
| |
| @@ -1596,6 +1596,15 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp) |
| intel_edp_psr_enable_source(intel_dp); |
| } |
| |
| +void intel_edp_psr_enable(struct intel_dp *intel_dp) |
| +{ |
| + struct drm_device *dev = intel_dp_to_dev(intel_dp); |
| + |
| + if (intel_edp_psr_match_conditions(intel_dp) && |
| + !intel_edp_is_psr_enabled(dev)) |
| + intel_edp_psr_do_enable(intel_dp); |
| +} |
| + |
| void intel_edp_psr_disable(struct intel_dp *intel_dp) |
| { |
| struct drm_device *dev = intel_dp_to_dev(intel_dp); |
| @@ -1612,6 +1621,26 @@ void intel_edp_psr_disable(struct intel_dp *intel_dp) |
| DRM_ERROR("Timed out waiting for PSR Idle State\n"); |
| } |
| |
| +void intel_edp_psr_update(struct drm_device *dev) |
| +{ |
| + struct intel_encoder *encoder; |
| + struct intel_dp *intel_dp = NULL; |
| + |
| + list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) |
| + if (encoder->type == INTEL_OUTPUT_EDP) { |
| + intel_dp = enc_to_intel_dp(&encoder->base); |
| + |
| + if (!is_edp_psr(intel_dp)) |
| + return; |
| + |
| + if (!intel_edp_psr_match_conditions(intel_dp)) |
| + intel_edp_psr_disable(intel_dp); |
| + else |
| + if (!intel_edp_is_psr_enabled(dev)) |
| + intel_edp_psr_do_enable(intel_dp); |
| + } |
| +} |
| + |
| static void intel_disable_dp(struct intel_encoder *encoder) |
| { |
| struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
| diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
| index 9b0ac47a565e..31087ff6d871 100644 |
| --- a/drivers/gpu/drm/i915/intel_drv.h |
| +++ b/drivers/gpu/drm/i915/intel_drv.h |
| @@ -837,5 +837,6 @@ extern bool intel_set_pch_fifo_underrun_reporting(struct drm_device *dev, |
| |
| extern void intel_edp_psr_enable(struct intel_dp *intel_dp); |
| extern void intel_edp_psr_disable(struct intel_dp *intel_dp); |
| +extern void intel_edp_psr_update(struct drm_device *dev); |
| |
| #endif /* __INTEL_DRV_H__ */ |
| -- |
| 1.8.5.rc3 |
| |