All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 8/8] drm/i915/icl+: Sanitize port to PLL mapping
Date: Tue, 30 Oct 2018 17:40:51 +0200	[thread overview]
Message-ID: <20181030154051.30851-9-imre.deak@intel.com> (raw)
In-Reply-To: <20181030154051.30851-1-imre.deak@intel.com>

BIOS can leave the PLL to port mapping enabled, even if the
corresponding encoder is disabled. Disable the port mapping in this
case.

Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c     | 23 +++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  4 ++++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index bf58816ed59c..8b7289af7558 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2822,6 +2822,29 @@ void icl_unmap_plls_to_ports(struct drm_crtc *crtc,
 	}
 }
 
+void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	u32 val = I915_READ(DPCLKA_CFGCR0_ICL);
+	enum port port = encoder->port;
+	bool clk_enabled = !(val & icl_dpclka_cfgcr0_clk_off(dev_priv, port));
+
+	if (clk_enabled == !!encoder->base.crtc)
+		return;
+
+	/*
+	 * Punt on the case now where clock is disabled, but the encoder is
+	 * enabled, something else is really broken then.
+	 */
+	if (WARN_ON(!clk_enabled))
+		return;
+
+	DRM_NOTE("Port %c is disabled but it has a mapped PLL, unmap it\n",
+		 port_name(port));
+	val |= icl_dpclka_cfgcr0_clk_off(dev_priv, port);
+	I915_WRITE(DPCLKA_CFGCR0_ICL, val);
+}
+
 static void intel_ddi_clk_select(struct intel_encoder *encoder,
 				 const struct intel_crtc_state *crtc_state)
 {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 12ba2b923e6b..2534263ebb41 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15368,6 +15368,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc,
 
 static void intel_sanitize_encoder(struct intel_encoder *encoder)
 {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_connector *connector;
 
 	/* We need to check both for a crtc link (meaning that the
@@ -15409,6 +15410,9 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
 
 	/* notify opregion of the sanitized encoder state */
 	intel_opregion_notify_encoder(encoder, connector && has_active_crtc);
+
+	if (INTEL_GEN(dev_priv) >= 11)
+		icl_sanitize_encoder_pll_mapping(encoder);
 }
 
 void i915_redisable_vga_power_on(struct drm_i915_private *dev_priv)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a3d7b93ecddd..224edb1a95d5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1519,6 +1519,7 @@ void icl_map_plls_to_ports(struct drm_crtc *crtc,
 void icl_unmap_plls_to_ports(struct drm_crtc *crtc,
 			     struct intel_crtc_state *crtc_state,
 			     struct drm_atomic_state *old_state);
+void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
 
 unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
 				   int color_plane, unsigned int height);
-- 
2.13.2

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

  parent reply	other threads:[~2018-10-30 15:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 15:40 [PATCH 0/8] drm/i915/icl: Fix HDMI on TypeC static ports Imre Deak
2018-10-30 15:40 ` [PATCH 1/8] drm/i915: Move intel_aux_ch() to intel_bios.c Imre Deak
2018-10-30 22:36   ` Souza, Jose
2018-10-30 15:40 ` [PATCH 2/8] drm/i915: Move aux_ch to intel_digital_port Imre Deak
2018-10-30 22:36   ` Souza, Jose
2018-10-31 13:36     ` Imre Deak
2018-10-30 15:40 ` [PATCH 3/8] drm/i915: Init aux_ch for HDMI ports too Imre Deak
2018-10-30 22:32   ` Souza, Jose
2018-10-30 22:38     ` Imre Deak
2018-10-31  0:03       ` Souza, Jose
2018-10-30 15:40 ` [PATCH 4/8] drm/i915: Use a helper to get the aux power domain Imre Deak
2018-10-30 21:16   ` Lucas De Marchi
2018-10-30 21:31     ` Imre Deak
2018-10-30 15:40 ` [PATCH 5/8] drm/i915: Enable AUX power earlier Imre Deak
2018-10-30 19:05   ` [PATCH v2 " Imre Deak
2018-10-30 21:55     ` Manasi Navare
2018-10-30 22:04       ` Imre Deak
2018-10-30 23:07   ` [PATCH " Souza, Jose
2018-10-30 23:12     ` Imre Deak
2018-10-30 23:18       ` Souza, Jose
2018-10-30 23:28         ` Imre Deak
2018-10-30 23:52           ` Souza, Jose
2018-10-31  0:04             ` Imre Deak
2018-10-31  0:17               ` Souza, Jose
2018-10-31  0:33                 ` Imre Deak
2018-10-31  0:40                   ` Souza, Jose
2018-10-30 15:40 ` [PATCH 6/8] drm/i915: Enable AUX power for HDMI DDI/TypeC main link too Imre Deak
2018-10-30 23:08   ` Souza, Jose
2018-10-30 15:40 ` [PATCH 7/8] drm/i915: Configure AUX_CH_CTL when enabling the AUX power domain Imre Deak
2018-10-30 21:57   ` Lucas De Marchi
2018-10-31 13:30     ` Imre Deak
2018-10-30 23:28   ` Souza, Jose
2018-10-31 13:34     ` Imre Deak
2018-10-30 15:40 ` Imre Deak [this message]
2018-10-30 23:57   ` [PATCH 8/8] drm/i915/icl+: Sanitize port to PLL mapping Souza, Jose
2018-10-30 16:09 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl: Fix HDMI on TypeC static ports Patchwork
2018-10-30 16:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-30 16:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-10-30 19:32 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl: Fix HDMI on TypeC static ports (rev2) Patchwork
2018-10-30 19:35 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-30 19:50 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-31  0:36 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181030154051.30851-9-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.