Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2035993ybv; Fri, 14 Feb 2020 10:13:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyg9k2keZIIMmuCSSWlNuclLtESTrz14bLsHC9uJsTQonXn8+LG0hLBPGOBJ3osOZ9JmINz X-Received: by 2002:a05:6830:612:: with SMTP id w18mr3381879oti.160.1581703987848; Fri, 14 Feb 2020 10:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581703987; cv=none; d=google.com; s=arc-20160816; b=Ut+XqdUzmr4F6OWTGBJjnLuWD67l9eWx8uRuI086DVZ1Xy831e2mjincsV+vHPQDun +d1PfjoPW9pJ5+j1dIR+Y4jMn+IMy6icki5rMdojb5P3Fm8A+JTny1z4uPis8+eD3dgT yfM8p1heZVsexK4SlYHwQ5Qlah7QCPJmWf4zNcxiUI//UgpzEis56AkTJ97QHZRRsXih 6CciXPiZPVyOAWQ7B7PXR1yAblyb6uU9C4k90HyBiCa6t0JNt1V0d4HTWGycmnaNdsaD e4//l1fH3Yah9gBStU1uhopnSSoXnMKHrrQtr6H0slxTykra5HmnExItpn734fYu87Am sSnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=h2qlm6t/hu6CqBbg48hNvHNt7D07ztgDSjHXZv3f8lQ=; b=Emv08zEUQFdUUddOudGy5zExFEyzzm5Ho1jG9u1snlTpT99EFLyCS/q+xGnqnaE6f4 +Aj6hU5nvYz4dn2SsacHE/RiA6esoSPS0UXYsSMsRgYcZvDyK3bbCi45QTcDeyCo4O5q 0AudIrrhSFJSAzqyyuuuToPnXGLlYGPYxNG1WCR9i8764mXDHCoSXAPESEoDuKyAh9Wm VzXxsFI2h/0gpwrqG6xTShvFYZ8EDZS6HNG7hTORUeXuSb5i6AnxizebI1xKR6CIFjlF PWhy3KK8sRkE0T6gg5IIptwDDHqjMt5maR6XHrTAykpfGAFXtfZpXfgIy0hEDweWfPCf bb2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 194si2995206oii.2.2020.02.14.10.12.55; Fri, 14 Feb 2020 10:13:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393249AbgBNSMQ (ORCPT + 99 others); Fri, 14 Feb 2020 13:12:16 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:32993 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393208AbgBNSMN (ORCPT ); Fri, 14 Feb 2020 13:12:13 -0500 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j2fD2-0005g2-9K; Fri, 14 Feb 2020 17:57:01 +0000 From: Kai-Heng Feng To: jani.nikula@linux.intel.com, ville.syrjala@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com Cc: Kai-Heng Feng , David Airlie , Daniel Vetter , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Lucas De Marchi , Imre Deak , Chris Wilson , Manasi Navare , Gwan-gyeong Mun , Matt Roper , Maarten Lankhorst , Ramalingam C , Uma Shankar , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4] drm/i915: Init lspcon after HPD in intel_dp_detect() Date: Sat, 15 Feb 2020 01:56:27 +0800 Message-Id: <20200214175646.25532-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On HP 800 G4 DM, if HDMI cable isn't plugged before boot, the HDMI port becomes useless and never responds to cable hotplugging: [ 3.031904] [drm:lspcon_init [i915]] *ERROR* Failed to probe lspcon [ 3.031945] [drm:intel_ddi_init [i915]] *ERROR* LSPCON init failed on port D Seems like the lspcon chip on the system in question only gets powered after the cable is plugged. So let's call lspcon_init() dynamically to properly initialize the lspcon chip and make HDMI port work. Signed-off-by: Kai-Heng Feng --- v4: - Trust VBT in intel_infoframe_init(). - Init lspcon in intel_dp_detect(). v3: - Make sure it's handled under long HPD case. v2: - Move lspcon_init() inside of intel_dp_hpd_pulse(). drivers/gpu/drm/i915/display/intel_ddi.c | 17 +---------------- drivers/gpu/drm/i915/display/intel_dp.c | 13 ++++++++++++- drivers/gpu/drm/i915/display/intel_hdmi.c | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 33f1dc3d7c1a..ca717434b406 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -4741,7 +4741,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) &dev_priv->vbt.ddi_port_info[port]; struct intel_digital_port *intel_dig_port; struct intel_encoder *encoder; - bool init_hdmi, init_dp, init_lspcon = false; + bool init_hdmi, init_dp; enum phy phy = intel_port_to_phy(dev_priv, port); init_hdmi = port_info->supports_dvi || port_info->supports_hdmi; @@ -4754,7 +4754,6 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) * is initialized before lspcon. */ init_dp = true; - init_lspcon = true; init_hdmi = false; DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port)); } @@ -4833,20 +4832,6 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) goto err; } - if (init_lspcon) { - if (lspcon_init(intel_dig_port)) - /* TODO: handle hdmi info frame part */ - DRM_DEBUG_KMS("LSPCON init success on port %c\n", - port_name(port)); - else - /* - * LSPCON init faied, but DP init was success, so - * lets try to drive as DP++ port. - */ - DRM_ERROR("LSPCON init failed on port %c\n", - port_name(port)); - } - intel_infoframe_init(intel_dig_port); return; diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index c7424e2a04a3..43117aa86292 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5663,8 +5663,19 @@ intel_dp_detect(struct drm_connector *connector, /* Can't disconnect eDP */ if (intel_dp_is_edp(intel_dp)) status = edp_detect(intel_dp); - else if (intel_digital_port_connected(encoder)) + else if (intel_digital_port_connected(encoder)) { + if (intel_bios_is_lspcon_present(dev_priv, dig_port->base.port) && + !dig_port->lspcon.active) { + if (lspcon_init(dig_port)) + DRM_DEBUG_KMS("LSPCON init success on port %c\n", + port_name(dig_port->base.port)); + else + DRM_DEBUG_KMS("LSPCON init failed on port %c\n", + port_name(dig_port->base.port)); + } + status = intel_dp_detect_dpcd(intel_dp); + } else status = connector_status_disconnected; diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 93ac0f296852..27a5aa8cefc9 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -3100,7 +3100,7 @@ void intel_infoframe_init(struct intel_digital_port *intel_dig_port) intel_dig_port->set_infoframes = g4x_set_infoframes; intel_dig_port->infoframes_enabled = g4x_infoframes_enabled; } else if (HAS_DDI(dev_priv)) { - if (intel_dig_port->lspcon.active) { + if (intel_bios_is_lspcon_present(dev_priv, intel_dig_port->base.port)) { intel_dig_port->write_infoframe = lspcon_write_infoframe; intel_dig_port->read_infoframe = lspcon_read_infoframe; intel_dig_port->set_infoframes = lspcon_set_infoframes; -- 2.17.1