Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp461863ybh; Wed, 11 Mar 2020 04:36:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsvAPa3GEGAnaIXDuavh0jOF2/ZX8PjBq1I7VniyCMr07uvwv8vuWDfes/6enFWMw6626Wl X-Received: by 2002:a9d:6418:: with SMTP id h24mr1952591otl.172.1583926607581; Wed, 11 Mar 2020 04:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583926607; cv=none; d=google.com; s=arc-20160816; b=jv9maM6Pp6opLds7d1tbyB0vOmrVb0hkZAHbqtWuFFv0sam4mSOPxRUjJQWne38626 z0/F5SwybBqUfFKD63BDhum+7x2YkA5JbR3WgOKX4XpuLHx7xIX0pZqssK0j+DnBanUo XSaRpqgSpRpNfZ6GUvsZ0Kd7IdG0Q22h92bfGpLESC0rcxtUHynuQKInhUG4zLkE1vR5 ORlVqMzWhss90B2ixmEAYw//Q8skBm1+Ff9PMJf9ub6DFSJCVLyNwGQHFvfOpKNly36/ pgFC2KKvBoRBX4XJlnWov6GMtDnVyD+kt6ghh12fhtaJnO/8PCiJuxJ9dgQSU9UisrA9 3U2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=9gnK+1wn2hapR3AWdgzlz1KslYJfn2+aCDzOME3odc4=; b=cpMMtwT8r+kaPlM3dHhHEXdXaKl0L1t1Wq4sn3ND2qE9+ht/9HBGQRV+9Y8HNWzXEo JWSuUb7UsvSRmLw25LMOYw1hbrSeUJaoDX59uDptbFLmzg78rPWZUKqnB5ZUH0p5zV+A nupofcV9x+iAEU3SeBFrJyLz9Hjlz3NYoMidpXCxbAn/8zcfbRzOy+MrNaVZgzL6xvYL RyNkspO5+O1dbveLxEt1FKP4NYI+t+mYfSlI1fEfd/mUwmDkJB8iOlo83a01qt9vcw64 o+bbtiSaPVRpXlYG/4y9JfCNn9RpVFO6k/hRSOP3N3Xp5sM8uHWuX/5ozcm9X0K16LLZ eUeg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si999546otr.78.2020.03.11.04.36.35; Wed, 11 Mar 2020 04:36:47 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729140AbgCKLgL (ORCPT + 99 others); Wed, 11 Mar 2020 07:36:11 -0400 Received: from mga07.intel.com ([134.134.136.100]:61402 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbgCKLgL (ORCPT ); Wed, 11 Mar 2020 07:36:11 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2020 04:36:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,540,1574150400"; d="scan'208";a="353866031" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by fmsmga001.fm.intel.com with SMTP; 11 Mar 2020 04:36:04 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 11 Mar 2020 13:36:03 +0200 Date: Wed, 11 Mar 2020 13:36:03 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Kai-Heng Feng Cc: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, David Airlie , Daniel Vetter , =?iso-8859-1?Q?Jos=E9?= Roberto de Souza , 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, "open list:DRM DRIVERS" , open list Subject: Re: [PATCH v4] drm/i915: Init lspcon after HPD in intel_dp_detect() Message-ID: <20200311113603.GU13686@intel.com> References: <20200214175646.25532-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200214175646.25532-1-kai.heng.feng@canonical.com> X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 15, 2020 at 01:56:27AM +0800, Kai-Heng Feng wrote: > 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)); > + } I was going to ask what happens when you unplug+replug, but looks like we already have lspcon_resume()in intel_dp_detect_dpcd(). This should be there as well. In fact I think we should just move all the logic into the lspcon code and let it decide on its own whether to take the init path or the resume path (assuming there is even any difference between the two). Not sure what we should do with the lspcon_resume() call in intel_dp_encoder_reset()... > + > 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 -- Ville Syrj?l? Intel