Re: [PATCH] [RFC] drm/i915: Handle HPD when it has actually occurred

Ville Syrjälä
2015-07-06T08:49:29Z

On Mon, Jul 06, 2015 at 11:23:53AM +0530, Sonika Jindal wrote:
> Writing to PCH_PORT_HOTPLUG for each interrupt is not required.
> Handle it only if hpd has actually occurred like we handle other
> interrupts.
>
> Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
> ---
> Hi,
>
> I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
> For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out.
> If I put this check before handling HPD, hotplug behaves fine.
> Please let me know if you see any issue with this approach.
>
> Thanks,
> Sonika
>
> drivers/gpu/drm/i915/i915_irq.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index a6fbe64..2d47372 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
> u32 dig_hotplug_reg;
> u32 pin_mask, long_mask;
>
> - dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
> - I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
> -
> - pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
> - intel_hpd_irq_handler(dev, pin_mask, long_mask);
> + if (hotplug_trigger) {
> + dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
> + I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
> + pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
> + intel_hpd_irq_handler(dev, pin_mask, long_mask);
> + }

Deja vu. I think I have the same patch (also for IBX) in my stalled
(and never posted) port A HPD branch. So yeah, I think this
makes sense.

You can also move the dig_hotplug_reg, pin_mask, and long_mask declarations
into the if block since they're not needed elsewhere.

>
> if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
> int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
> --
> 1.7.10.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel OTC