Skip to content

Commit b2c22c7

Browse files
popcornmixgregkh
authored andcommitted
drm/vc4: hdmi: Restore cec physical address on reconnect
[ Upstream commit 4d8602b ] Currently we call cec_phys_addr_invalidate on a hotplug deassert. That may be due to a TV power cycling, or an AVR being switched on (and switching edid). This makes CEC unusable since our controller wouldn't have a physical address anymore. Set it back up again on the hotplug assert. Fixes: 15b4511 ("drm/vc4: add HDMI CEC support") Signed-off-by: Dom Cobley <popcornmix@gmail.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Link: https://patchwork.freedesktop.org/patch/msgid/20210111142309.193441-6-maxime@cerno.tech (cherry picked from commit b06eecb) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5ef6d3b commit b2c22c7

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,32 @@ static enum drm_connector_status
123123
vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
124124
{
125125
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
126+
bool connected = false;
126127

127128
if (vc4_hdmi->hpd_gpio) {
128129
if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^
129130
vc4_hdmi->hpd_active_low)
130-
return connector_status_connected;
131-
cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
132-
return connector_status_disconnected;
131+
connected = true;
132+
} else if (drm_probe_ddc(vc4_hdmi->ddc)) {
133+
connected = true;
134+
} else if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) {
135+
connected = true;
133136
}
134137

135-
if (drm_probe_ddc(vc4_hdmi->ddc))
136-
return connector_status_connected;
138+
if (connected) {
139+
if (connector->status != connector_status_connected) {
140+
struct edid *edid = drm_get_edid(connector, vc4_hdmi->ddc);
141+
142+
if (edid) {
143+
cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid);
144+
vc4_hdmi->encoder.hdmi_monitor = drm_detect_hdmi_monitor(edid);
145+
kfree(edid);
146+
}
147+
}
137148

138-
if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED)
139149
return connector_status_connected;
150+
}
151+
140152
cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
141153
return connector_status_disconnected;
142154
}

0 commit comments

Comments
 (0)