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

From: Chris Chiu
Date: Wed Sep 19 2018 - 07:20:08 EST

On Tue, Sep 11, 2018 at 6:25 PM, Chris Chiu <chiu@xxxxxxxxxxxx> wrote:
> On Fri, Aug 24, 2018 at 11:04 PM, Jani Nikula <jani.nikula@xxxxxxxxx> wrote:
>> On Wed, 22 Aug 2018, Chris Chiu <chiu@xxxxxxxxxxxx> wrote:
>>> On Fri, Jul 6, 2018 at 2:44 PM, Chris Chiu <chiu@xxxxxxxxxxxx> wrote:
>>>> On Thu, Jul 5, 2018 at 10:40 PM, Ville SyrjÃlÃ
>>>> <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
>>>>> On Thu, Jul 05, 2018 at 03:58:36PM +0800, Chris Chiu wrote:
>>>>>> Hi,
>>>>>> We have few ASUS laptops X705FD (The new WiskyLake), X560UD (intel
>>>>>> i5-8250U), X530UN (intel i7-8550U) share the same problem, which is
>>>>>> the HDMI connector status stays connected even the HDMI cable has been
>>>>>> unplugged. Look into the "/sys/class/drm/card0-HDMI-A-1/status" for
>>>>>> checking the status while plug/unplug the HDMI, it shows
>>>>>> "disconnected" before plug in HDMI cable, then switch to "connected"
>>>>>> after plugin, and still stay "connected" after unplug. This would
>>>>>> cause the audio output path cannot correctly switch from HDMI to
>>>>>> internal speaker after unplugging the HDMI.
>>>>>> I then try to verify with the latest kernel 4.18.0-rc3+, the bug still
>>>>>> present. The full "dmesg" log is here.
>>>>>> The HDMI cable is plugged in at ~26th second.
>>>>>> "[ 26.214371] [drm:drm_detect_monitor_audio [drm]] Monitor has basic
>>>>>> audio support"
>>>>>> then unplug the HDMI at ~73th second.
>>>>>> "[ 73.328361] [drm:drm_detect_monitor_audio [drm]] Monitor has basic
>>>>>> audio support"
>>>>>> Please advise what I can do to fix this. Thanks
>>>>> Pull the cable out faster?
>>>>> I presume this is the same old case of hpd disconnecting slightly
>>>>> before ddc and we still manage to read the EDID when processing
>>>>> the hpd irq. We kinda tried to fix that with the live status
>>>>> check but that thing failed spectacularly.
>>>>> --
>>>>> Ville SyrjÃlÃ
>>>>> Intel
>>> There's a patch
>>> And I verified on the X705FD/X560UD which were easy to reproduce, the patch
>>> works as expected. Can anyone kindly give comments about this patch?
>>> We can do anything to help fix this issue upstream. Thanks
>> Seems like a hack. Should look into hw based debouncing or a slight
>> delay in the hotplug work processing I think.
>> BR,
>> Jani.

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,


+ 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

I'll try to modify this patch a little bit and send upstream for
discussion later. Please
advise if any. Thanks.


> So you're suggesting to add a slight delay directly in i915_hotplug_work_func()?
> And any suggestion about the 'hw based' debouncing? Maybe some examples
> that I can refer to?
> Thanks
>>> Chris
>>>> Thanks for the suggestion. I tried pulling the cable out faster, the status
>>>> shows correctly. I also tried branch drm-tip of
>>>> but the symptom persists.
>>>> Anything I can help here? Or any old commit/patch I can try to do some
>>>> experiments?
>>>> Chris
>> --
>> Jani Nikula, Intel Open Source Graphics Center