From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH v3 2/2] drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init() Date: Mon, 18 Apr 2016 18:09:25 +0300 Message-ID: <20160418150925.GG4329@intel.com> References: <20160418083434.GA4329@intel.com> <1460988036-26226-1-git-send-email-cpaul@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <1460988036-26226-1-git-send-email-cpaul@redhat.com> Sender: stable-owner@vger.kernel.org To: Lyude Cc: stable@vger.kernel.org, Daniel Vetter , Jani Nikula , David Airlie , "open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...), dri-devel@lists.freedesktop.org (open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...), linux-kernel@vger.kernel.org (open list))" List-Id: intel-gfx@lists.freedesktop.org On Mon, Apr 18, 2016 at 10:00:36AM -0400, Lyude wrote: > While VGA hotplugging worked(ish) before, it looks like that was main= ly > because we'd unintentionally enable it in > valleyview_crt_detect_hotplug() when we did a force trigger. This > doesn't work reliably enough because whenever the display powerwell o= n > vlv gets disabled, the values set in VLV_ADPA get cleared and > consequently VGA hotplugging gets disabled. This causes bugs such as = one > we found on an Intel NUC, where doing the following sequence of > hotplugs: >=20 > - Disconnect all monitors > - Connect VGA > - Disconnect VGA > - Connect HDMI >=20 > Would result in VGA hotplugging becoming disabled, due to the powerwe= lls > getting toggled in the process of connecting HDMI. >=20 > Changes since v2: > - Use intel_encoder structs instead of drm_encoder structs >=20 > Changes since v1: > - Instead of handling the register writes ourself, we just reuse > intel_crt_detect() > - Instead of resetting the ADPA during display IRQ installation, we = now > reset them in vlv_display_power_well_init() >=20 > CC: stable@vger.kernel.org > Signed-off-by: Lyude > --- > drivers/gpu/drm/i915/intel_runtime_pm.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/dr= m/i915/intel_runtime_pm.c > index 80e8bd4..0eae08a 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c > @@ -902,6 +902,7 @@ static bool vlv_power_well_enabled(struct drm_i91= 5_private *dev_priv, > =20 > static void vlv_display_power_well_init(struct drm_i915_private *dev= _priv) > { > + struct intel_encoder *encoder; > enum pipe pipe; > =20 > /* > @@ -935,6 +936,12 @@ static void vlv_display_power_well_init(struct d= rm_i915_private *dev_priv) > =20 > intel_hpd_init(dev_priv); > =20 > + /* Re-enable the ADPA, if we have one */ > + for_each_intel_encoder(dev_priv->dev, encoder) { > + if (encoder->type =3D=3D INTEL_OUTPUT_ANALOG) > + encoder->base.funcs->reset(&encoder->base); intel_crt_reset(&encoder->base) would be much easier to navigate. Or if we want to be a bit more verbose we could call it intel_crt_hpd_init() or somesuch. With that=20 Reviewed-by: Ville Syrj=E4l=E4 Before we push these, I think we'll need to do a bit more work to make sure we don't end up in an infinite crt hpd loop (already happend to me a few times). I'll polish up my hacks for that and send them out... > + } > + > i915_redisable_vga_power_on(dev_priv->dev); > } > =20 > --=20 > 2.5.5 --=20 Ville Syrj=E4l=E4 Intel OTC From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com ([134.134.136.24]:27438 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbcDRPJa (ORCPT ); Mon, 18 Apr 2016 11:09:30 -0400 Date: Mon, 18 Apr 2016 18:09:25 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Lyude Cc: stable@vger.kernel.org, Daniel Vetter , Jani Nikula , David Airlie , "open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...), dri-devel@lists.freedesktop.org (open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...), linux-kernel@vger.kernel.org (open list))" Subject: Re: [PATCH v3 2/2] drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init() Message-ID: <20160418150925.GG4329@intel.com> References: <20160418083434.GA4329@intel.com> <1460988036-26226-1-git-send-email-cpaul@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1460988036-26226-1-git-send-email-cpaul@redhat.com> Sender: stable-owner@vger.kernel.org List-ID: On Mon, Apr 18, 2016 at 10:00:36AM -0400, Lyude wrote: > While VGA hotplugging worked(ish) before, it looks like that was mainly > because we'd unintentionally enable it in > valleyview_crt_detect_hotplug() when we did a force trigger. This > doesn't work reliably enough because whenever the display powerwell on > vlv gets disabled, the values set in VLV_ADPA get cleared and > consequently VGA hotplugging gets disabled. This causes bugs such as one > we found on an Intel NUC, where doing the following sequence of > hotplugs: > > - Disconnect all monitors > - Connect VGA > - Disconnect VGA > - Connect HDMI > > Would result in VGA hotplugging becoming disabled, due to the powerwells > getting toggled in the process of connecting HDMI. > > Changes since v2: > - Use intel_encoder structs instead of drm_encoder structs > > Changes since v1: > - Instead of handling the register writes ourself, we just reuse > intel_crt_detect() > - Instead of resetting the ADPA during display IRQ installation, we now > reset them in vlv_display_power_well_init() > > CC: stable@vger.kernel.org > Signed-off-by: Lyude > --- > drivers/gpu/drm/i915/intel_runtime_pm.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c > index 80e8bd4..0eae08a 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c > @@ -902,6 +902,7 @@ static bool vlv_power_well_enabled(struct drm_i915_private *dev_priv, > > static void vlv_display_power_well_init(struct drm_i915_private *dev_priv) > { > + struct intel_encoder *encoder; > enum pipe pipe; > > /* > @@ -935,6 +936,12 @@ static void vlv_display_power_well_init(struct drm_i915_private *dev_priv) > > intel_hpd_init(dev_priv); > > + /* Re-enable the ADPA, if we have one */ > + for_each_intel_encoder(dev_priv->dev, encoder) { > + if (encoder->type == INTEL_OUTPUT_ANALOG) > + encoder->base.funcs->reset(&encoder->base); intel_crt_reset(&encoder->base) would be much easier to navigate. Or if we want to be a bit more verbose we could call it intel_crt_hpd_init() or somesuch. With that Reviewed-by: Ville Syrj�l� Before we push these, I think we'll need to do a bit more work to make sure we don't end up in an infinite crt hpd loop (already happend to me a few times). I'll polish up my hacks for that and send them out... > + } > + > i915_redisable_vga_power_on(dev_priv->dev); > } > > -- > 2.5.5 -- Ville Syrj�l� Intel OTC