https://bugzilla.kernel.org/show_bug.cgi?id=71461
--- Comment #26 from Tom Yan tom.ty89@gmail.com --- (In reply to Alex Deucher from comment #24)
It works for the vast majority of users and removing it would break unplug and replug of DP displays. Without that code you would have to manually disable and re-enable the display using xrandr every time you connect or disconnect a DP display. It would also break disconnect and reconnect of dp displays for the console.
In my case removing it breaks nothing. So there's a chance my board has a non-standard dp?
In your case we need to find out why it's not working properly for you. You mentioned that it works properly in the console but not in X. That sounds like maybe your desktop environment is trying to do something special which causes the problem. Does it work properly with a bare X server? E.g., just run Xorg without a desktop environment.
Indeed with or without the code it works the same in console. I am with GNOME and I may try a wm with startx later, but I doubt it has anything to do with the problem. Some have same experiences test it already: https://bugs.freedesktop.org/show_bug.cgi?id=46711