drm/i915/lspcon: Add dp_to_lspcon helper()
authorImre Deak <imre.deak@intel.com>
Mon, 21 Nov 2016 19:15:05 +0000 (21:15 +0200)
committerImre Deak <imre.deak@intel.com>
Wed, 23 Nov 2016 11:31:55 +0000 (13:31 +0200)
We need to get to LSPCON in the next patch, so factor out the helper for
it. While at it also remove the redundant GEN9 check.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1479755707-29596-3-git-send-email-imre.deak@intel.com
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h

index 90283edcafba6786f79c509df64aa194e490bc3c..16c19d789c668844096eb0eee241ca64d416ee52 100644 (file)
@@ -4753,14 +4753,13 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
 void intel_dp_encoder_reset(struct drm_encoder *encoder)
 {
        struct drm_i915_private *dev_priv = to_i915(encoder->dev);
-       struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
-       struct intel_lspcon *lspcon = &intel_dig_port->lspcon;
-       struct intel_dp *intel_dp = &intel_dig_port->dp;
+       struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+       struct intel_lspcon *lspcon = dp_to_lspcon(intel_dp);
 
        if (!HAS_DDI(dev_priv))
                intel_dp->DP = I915_READ(intel_dp->output_reg);
 
-       if (IS_GEN9(dev_priv) && lspcon->active)
+       if (lspcon->active)
                lspcon_resume(lspcon);
 
        if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP)
index cd132c216a67decc86e4b1fbc22d544a8230b0ad..cf47e8a6c2fb711be27c5b5895350baf56e9e510 100644 (file)
@@ -1089,6 +1089,12 @@ dp_to_dig_port(struct intel_dp *intel_dp)
        return container_of(intel_dp, struct intel_digital_port, dp);
 }
 
+static inline struct intel_lspcon *
+dp_to_lspcon(struct intel_dp *intel_dp)
+{
+       return &dp_to_dig_port(intel_dp)->lspcon;
+}
+
 static inline struct intel_digital_port *
 hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
 {