44e4d66cc3e1e307650fb9f225bccb5d0d421e83
[openwrt/staging/dedeckeh.git] /
1 From b30b747d76946fb176bb4b044c830415d551b7bb Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 19 Aug 2021 13:50:12 +0200
4 Subject: [PATCH] drm/vc4: hdmi: Actually check for the connector
5 status in hotplug
6
7 The drm_helper_hpd_irq_event() documentation states that this function
8 is "useful for drivers which can't or don't track hotplug interrupts for
9 each connector." and that "Drivers which support hotplug interrupts for
10 each connector individually and which have a more fine-grained detect
11 logic should bypass this code and directly call
12 drm_kms_helper_hotplug_event()". This is thus what we ended-up doing.
13
14 However, what this actually means, and is further explained in the
15 drm_kms_helper_hotplug_event() documentation, is that
16 drm_kms_helper_hotplug_event() should be called by drivers that can
17 track the connection status change, and if it has changed we should call
18 that function.
19
20 This underlying expectation we failed to provide is that the caller of
21 drm_kms_helper_hotplug_event() should call drm_helper_probe_detect() to
22 probe the new status of the connector.
23
24 Since we didn't do it, it meant that even though we were sending the
25 notification to user-space and the DRM clients that something changed we
26 never probed or updated our internal connector status ourselves.
27
28 This went mostly unnoticed since the detect callback usually doesn't
29 have any side-effect. Also, if we were using the DRM fbdev emulation
30 (which is a DRM client), or any user-space application that can deal
31 with hotplug events, chances are they would react to the hotplug event
32 by probing the connector status eventually.
33
34 However, now that we have to enable the scrambler in detect() if it was
35 enabled it has a side effect, and an application such as Kodi or
36 modetest doesn't deal with hotplug events. This resulted with a black
37 screen when Kodi or modetest was running when a screen was disconnected
38 and then reconnected, or switched off and on.
39
40 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
41 ---
42 drivers/gpu/drm/vc4/vc4_hdmi.c | 5 +++--
43 1 file changed, 3 insertions(+), 2 deletions(-)
44
45 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
46 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
47 @@ -1792,10 +1792,11 @@ static void vc4_hdmi_audio_exit(struct v
48 static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
49 {
50 struct vc4_hdmi *vc4_hdmi = priv;
51 - struct drm_device *dev = vc4_hdmi->connector.dev;
52 + struct drm_connector *connector = &vc4_hdmi->connector;
53 + struct drm_device *dev = connector->dev;
54
55 if (dev && dev->registered)
56 - drm_kms_helper_hotplug_event(dev);
57 + drm_connector_helper_hpd_irq_event(connector);
58
59 return IRQ_HANDLED;
60 }