drm/bridge: adv7511: Reset registers on hotplug
authorSean Paul <seanpaul@chromium.org>
Tue, 3 Jul 2018 16:56:03 +0000 (12:56 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2018 07:26:24 +0000 (09:26 +0200)
[ Upstream commit 5f3417569165a8ee57654217f73e0160312f409c ]

The bridge loses its hw state when the cable is unplugged. If we detect
this case in the hpd handler, reset its state.

Reported-by: Rob Clark <robdclark@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703165648.120401-1-seanpaul@chromium.org
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

index b2431aee788795cfa078dbf4b5515c75dbe1961c..f5091827628ab2ab9d6040b42786b5231cffa13e 100644 (file)
@@ -424,6 +424,18 @@ static void adv7511_hpd_work(struct work_struct *work)
        else
                status = connector_status_disconnected;
 
+       /*
+        * The bridge resets its registers on unplug. So when we get a plug
+        * event and we're already supposed to be powered, cycle the bridge to
+        * restore its state.
+        */
+       if (status == connector_status_connected &&
+           adv7511->connector.status == connector_status_disconnected &&
+           adv7511->powered) {
+               regcache_mark_dirty(adv7511->regmap);
+               adv7511_power_on(adv7511);
+       }
+
        if (adv7511->connector.status != status) {
                adv7511->connector.status = status;
                drm_kms_helper_hotplug_event(adv7511->connector.dev);