Skip to content

Commit 3404b39

Browse files
6by9mripard
authored andcommitted
drm/vc4: hdmi: Ensure we don't use 2711 HPD registers on Pi0-3
The existing logic was flawed in that it could try reading the 2711 specific registers for HPD on a CM1/3 where the HPD GPIO hadn't been defined in DT. Ensure we don't do the 2711 register read on invalid hardware, and then Signed-off-by: Dave Stevenson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 68e8cc2 commit 3404b39

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
196196
if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))
197197
connected = true;
198198
} else {
199-
unsigned long flags;
200-
u32 hotplug;
201-
202-
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
203-
hotplug = HDMI_READ(HDMI_HOTPLUG);
204-
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
205-
206-
if (hotplug & VC4_HDMI_HOTPLUG_CONNECTED)
199+
if (vc4_hdmi->variant->hp_detect &&
200+
vc4_hdmi->variant->hp_detect(vc4_hdmi))
207201
connected = true;
208202
}
209203

@@ -1343,6 +1337,18 @@ static u32 vc5_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask)
13431337
return channel_map;
13441338
}
13451339

1340+
static bool vc5_hdmi_hp_detect(struct vc4_hdmi *vc4_hdmi)
1341+
{
1342+
unsigned long flags;
1343+
u32 hotplug;
1344+
1345+
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
1346+
hotplug = HDMI_READ(HDMI_HOTPLUG);
1347+
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
1348+
1349+
return !!(hotplug & VC4_HDMI_HOTPLUG_CONNECTED);
1350+
}
1351+
13461352
/* HDMI audio codec callbacks */
13471353
static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi,
13481354
unsigned int samplerate)
@@ -2723,6 +2729,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
27232729
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
27242730
.channel_map = vc5_hdmi_channel_map,
27252731
.supports_hdr = true,
2732+
.hp_detect = vc5_hdmi_hp_detect,
27262733
};
27272734

27282735
static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
@@ -2751,6 +2758,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
27512758
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
27522759
.channel_map = vc5_hdmi_channel_map,
27532760
.supports_hdr = true,
2761+
.hp_detect = vc5_hdmi_hp_detect,
27542762
};
27552763

27562764
static const struct of_device_id vc4_hdmi_dt_match[] = {

drivers/gpu/drm/vc4/vc4_hdmi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ struct vc4_hdmi_variant {
102102

103103
/* Enables HDR metadata */
104104
bool supports_hdr;
105+
106+
/* Callback for hardware specific hotplug detect */
107+
bool (*hp_detect)(struct vc4_hdmi *vc4_hdmi);
105108
};
106109

107110
/* HDMI audio information */

0 commit comments

Comments
 (0)