Re: [BUG] i915 HDMI connector status is connected after disconnection

From: Jani Nikula
Date: Wed Sep 19 2018 - 08:08:56 EST


On Wed, 19 Sep 2018, Chris Chiu <chiu@xxxxxxxxxxxx> wrote:
> I tried to add a slight delay in the hotplug work as follows
>
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -378,6 +378,8 @@ static void do_i915_hotplug_check(struct work_struct *work,
>
> spin_unlock_irq(&dev_priv->irq_lock);
>
> + msleep(100);
> +
> drm_connector_list_iter_begin(dev, &conn_iter);
> drm_for_each_connector_iter(connector, &conn_iter) {
> intel_connector = to_intel_connector(connector);
>
> It does work in most cases, but still fail to update the status if I
> unplug the HDMI
> cable very slow. I basically pull the HDMI cable in loose connected
> state first, and
> hold in that state ~1 second, totally unplug after that. The status in
> sysfs will report
> connected as it used to. There was no problem when I tried the patch
> https://bugs.freedesktop.org/show_bug.cgi?id=107125#c8
>
> I'll try to modify this patch a little bit and send upstream for
> discussion later. Please
> advise if any. Thanks.

Please let's not add excessive msleeps in work functions.

My idea was more along the lines of making the hotplug function run in a
delayed work. After a chat with Ville, below is what I came up with.

Please let me know how it works. Feel free to toy with the
delay. However, 1-2 seconds or more seems too much.

BR,
Jani.