]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/dp: Enable/Disable DSC in DP Sink
authorGaurav K Singh <gaurav.k.singh@intel.com>
Wed, 28 Nov 2018 20:26:17 +0000 (12:26 -0800)
committerManasi Navare <manasi.d.navare@intel.com>
Thu, 29 Nov 2018 20:23:23 +0000 (12:23 -0800)
This patch enables decompression support in sink device
before link training and disables the same during the
DDI disabling.

v3 (From manasi):
* Pass bool state to enable/disable (Ville)
v2:(From Manasi)
* Change the enable/disable function to take crtc_state
instead of intel_dp as an argument (Manasi)
* Use the compression_enable flag as part of crtc_state (Manasi)

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Gaurav K Singh <gaurav.k.singh@intel.com>
Signed-off-by: Gaurav K Singh <gaurav.k.singh@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181128202628.20238-6-manasi.d.navare@intel.com
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h

index ad11540ac4360574793c34843dd826d31119855f..fa5ad62cd0db558369f859cbc36d52c070065294 100644 (file)
@@ -3134,6 +3134,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
        intel_ddi_init_dp_buf_reg(encoder);
        if (!is_mst)
                intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
+       intel_dp_sink_set_decompression_state(intel_dp, crtc_state,
+                                             true);
        intel_dp_start_link_train(intel_dp);
        if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
                intel_dp_stop_link_train(intel_dp);
@@ -3491,6 +3493,9 @@ static void intel_disable_ddi_dp(struct intel_encoder *encoder,
        intel_edp_drrs_disable(intel_dp, old_crtc_state);
        intel_psr_disable(intel_dp, old_crtc_state);
        intel_edp_backlight_off(old_conn_state);
+       /* Disable the decompression in DP Sink */
+       intel_dp_sink_set_decompression_state(intel_dp, old_crtc_state,
+                                             false);
 }
 
 static void intel_disable_ddi_hdmi(struct intel_encoder *encoder,
index 3b612eb134e7cb03e3f97fffa42392c92f666bf0..4e65dd1a6c073a655af1515020e51b7931f6fe8a 100644 (file)
@@ -2857,6 +2857,22 @@ static bool downstream_hpd_needs_d0(struct intel_dp *intel_dp)
                intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
 }
 
+void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
+                                          const struct intel_crtc_state *crtc_state,
+                                          bool enable)
+{
+       int ret;
+
+       if (!crtc_state->dsc_params.compression_enable)
+               return;
+
+       ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_DSC_ENABLE,
+                                enable ? DP_DECOMPRESSION_EN : 0);
+       if (ret < 0)
+               DRM_DEBUG_KMS("Failed to %s sink decompression state\n",
+                             enable ? "enable" : "disable");
+}
+
 /* If the sink supports it, try to set the power state appropriately */
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode)
 {
index 44a5b21799f5fd9d542c6c1156255e3c46fff4b9..36e756e1512497766ab5ec42b5f4ec8991bbd5dd 100644 (file)
@@ -1802,6 +1802,9 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 int intel_dp_retrain_link(struct intel_encoder *encoder,
                          struct drm_modeset_acquire_ctx *ctx);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
+void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
+                                          const struct intel_crtc_state *crtc_state,
+                                          bool enable);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);