On Sun, Mar 12, 2017 at 08:14:40PM +0100, gregkh@xxxxxxxxxxxxxxxxxxx wrote: > > The patch below does not apply to the 4.10-stable tree. > If someone wants it applied there, or to any other stable or longterm > tree, then please email the backport, including the original git commit > id to <stable@xxxxxxxxxxxxxxx>. This failed due to the upstream s/IS_BROXTON/IS_GEN9_LP/ change missing from 4.10. Backporting that is non-trivial (has its own dependencies) and is just a semantic change, I'd instead do a trivial rebase for this fix on 4.10. Also, I only noticed now, that this fix has the following functional dependency: commit d0480efb672485cd032e3d9cf0023583d86945b9 Author: Imre Deak <imre.deak@xxxxxxxxx> Date: Tue Nov 29 21:40:29 2016 +0200 drm/i915/lspcon: Enable AUX interrupts for resume time initialization which needs a trivial rebasing on 4.10 due to s/dev/dev_priv/ upstream change. If no objections, I'll resend the above patch and the 2 patches in this patchset for 4.10 with the trival rebases. The fix isn't needed for 4.9 since LSPCON was added only in 4.10, I'll fix the Cc: stable tag accordingly. --Imre > > thanks, > > greg k-h > > ------------------ original commit in Linus's tree ------------------ > > From 2a57d9cce1c08578097d965468e37f06d71fa495 Mon Sep 17 00:00:00 2001 > From: Imre Deak <imre.deak@xxxxxxxxx> > Date: Fri, 27 Jan 2017 11:39:18 +0200 > Subject: [PATCH] drm/i915/gen9+: Enable hotplug detection early > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > For LSPCON resume time initialization we need to sample the > corresponding pin's HPD level, but this is only available when HPD > detection is enabled. Currently we enable detection only when enabling > HPD interrupts which is too late, so bring the enabling of detection > earlier. > > This is needed by the next patch. > > Cc: Shashank Sharma <shashank.sharma@xxxxxxxxx> > Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> > Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> # v4.9+ > Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx> > Reviewed-by: Shashank Sharma <shashank.sharma@xxxxxxxxx> > Link: http://patchwork.freedesktop.org/patch/msgid/1485509961-9010-2-git-send-email-imre.deak@xxxxxxxxx > (cherry picked from commit 7fff8126d9cc902b2636d05d5d34894a75174993) > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> > > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c > index 6fefc34ef602..7dba148ca792 100644 > --- a/drivers/gpu/drm/i915/i915_irq.c > +++ b/drivers/gpu/drm/i915/i915_irq.c > @@ -3123,19 +3123,16 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv) > I915_WRITE(PCH_PORT_HOTPLUG, hotplug); > } > > -static void spt_hpd_irq_setup(struct drm_i915_private *dev_priv) > +static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv) > { > - u32 hotplug_irqs, hotplug, enabled_irqs; > - > - hotplug_irqs = SDE_HOTPLUG_MASK_SPT; > - enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_spt); > - > - ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs); > + u32 hotplug; > > /* Enable digital hotplug on the PCH */ > hotplug = I915_READ(PCH_PORT_HOTPLUG); > - hotplug |= PORTD_HOTPLUG_ENABLE | PORTC_HOTPLUG_ENABLE | > - PORTB_HOTPLUG_ENABLE | PORTA_HOTPLUG_ENABLE; > + hotplug |= PORTA_HOTPLUG_ENABLE | > + PORTB_HOTPLUG_ENABLE | > + PORTC_HOTPLUG_ENABLE | > + PORTD_HOTPLUG_ENABLE; > I915_WRITE(PCH_PORT_HOTPLUG, hotplug); > > hotplug = I915_READ(PCH_PORT_HOTPLUG2); > @@ -3143,6 +3140,18 @@ static void spt_hpd_irq_setup(struct drm_i915_private *dev_priv) > I915_WRITE(PCH_PORT_HOTPLUG2, hotplug); > } > > +static void spt_hpd_irq_setup(struct drm_i915_private *dev_priv) > +{ > + u32 hotplug_irqs, enabled_irqs; > + > + hotplug_irqs = SDE_HOTPLUG_MASK_SPT; > + enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_spt); > + > + ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs); > + > + spt_hpd_detection_setup(dev_priv); > +} > + > static void ilk_hpd_irq_setup(struct drm_i915_private *dev_priv) > { > u32 hotplug_irqs, hotplug, enabled_irqs; > @@ -3177,18 +3186,15 @@ static void ilk_hpd_irq_setup(struct drm_i915_private *dev_priv) > ibx_hpd_irq_setup(dev_priv); > } > > -static void bxt_hpd_irq_setup(struct drm_i915_private *dev_priv) > +static void __bxt_hpd_detection_setup(struct drm_i915_private *dev_priv, > + u32 enabled_irqs) > { > - u32 hotplug_irqs, hotplug, enabled_irqs; > - > - enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_bxt); > - hotplug_irqs = BXT_DE_PORT_HOTPLUG_MASK; > - > - bdw_update_port_irq(dev_priv, hotplug_irqs, enabled_irqs); > + u32 hotplug; > > hotplug = I915_READ(PCH_PORT_HOTPLUG); > - hotplug |= PORTC_HOTPLUG_ENABLE | PORTB_HOTPLUG_ENABLE | > - PORTA_HOTPLUG_ENABLE; > + hotplug |= PORTA_HOTPLUG_ENABLE | > + PORTB_HOTPLUG_ENABLE | > + PORTC_HOTPLUG_ENABLE; > > DRM_DEBUG_KMS("Invert bit setting: hp_ctl:%x hp_port:%x\n", > hotplug, enabled_irqs); > @@ -3198,7 +3204,6 @@ static void bxt_hpd_irq_setup(struct drm_i915_private *dev_priv) > * For BXT invert bit has to be set based on AOB design > * for HPD detection logic, update it based on VBT fields. > */ > - > if ((enabled_irqs & BXT_DE_PORT_HP_DDIA) && > intel_bios_is_port_hpd_inverted(dev_priv, PORT_A)) > hotplug |= BXT_DDIA_HPD_INVERT; > @@ -3212,6 +3217,23 @@ static void bxt_hpd_irq_setup(struct drm_i915_private *dev_priv) > I915_WRITE(PCH_PORT_HOTPLUG, hotplug); > } > > +static void bxt_hpd_detection_setup(struct drm_i915_private *dev_priv) > +{ > + __bxt_hpd_detection_setup(dev_priv, BXT_DE_PORT_HOTPLUG_MASK); > +} > + > +static void bxt_hpd_irq_setup(struct drm_i915_private *dev_priv) > +{ > + u32 hotplug_irqs, enabled_irqs; > + > + enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_bxt); > + hotplug_irqs = BXT_DE_PORT_HOTPLUG_MASK; > + > + bdw_update_port_irq(dev_priv, hotplug_irqs, enabled_irqs); > + > + __bxt_hpd_detection_setup(dev_priv, enabled_irqs); > +} > + > static void ibx_irq_postinstall(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = to_i915(dev); > @@ -3227,6 +3249,12 @@ static void ibx_irq_postinstall(struct drm_device *dev) > > gen5_assert_iir_is_zero(dev_priv, SDEIIR); > I915_WRITE(SDEIMR, ~mask); > + > + if (HAS_PCH_IBX(dev_priv) || HAS_PCH_CPT(dev_priv) || > + HAS_PCH_LPT(dev_priv)) > + ; /* TODO: Enable HPD detection on older PCH platforms too */ > + else > + spt_hpd_detection_setup(dev_priv); > } > > static void gen5_gt_irq_postinstall(struct drm_device *dev) > @@ -3438,6 +3466,9 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) > > GEN5_IRQ_INIT(GEN8_DE_PORT_, ~de_port_masked, de_port_enables); > GEN5_IRQ_INIT(GEN8_DE_MISC_, ~de_misc_masked, de_misc_masked); > + > + if (IS_GEN9_LP(dev_priv)) > + bxt_hpd_detection_setup(dev_priv); > } > > static int gen8_irq_postinstall(struct drm_device *dev) >