Skip to content

Commit 6a58cb8

Browse files
6by9pelwell
authored andcommitted
drm/vc4: Ensure vc4_hdmi doesn'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]>
1 parent 02db56c commit 6a58cb8

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
@@ -208,14 +208,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
208208
vc4_hdmi->hpd_active_low)
209209
connected = true;
210210
} else {
211-
unsigned long flags;
212-
u32 hotplug;
213-
214-
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
215-
hotplug = HDMI_READ(HDMI_HOTPLUG);
216-
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
217-
218-
if (hotplug & VC4_HDMI_HOTPLUG_CONNECTED)
211+
if (vc4_hdmi->variant->hp_detect &&
212+
vc4_hdmi->variant->hp_detect(vc4_hdmi))
219213
connected = true;
220214
}
221215

@@ -1388,6 +1382,18 @@ static u32 vc5_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask)
13881382
return channel_map;
13891383
}
13901384

1385+
static bool vc5_hdmi_hp_detect(struct vc4_hdmi *vc4_hdmi)
1386+
{
1387+
unsigned long flags;
1388+
u32 hotplug;
1389+
1390+
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
1391+
hotplug = HDMI_READ(HDMI_HOTPLUG);
1392+
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
1393+
1394+
return !!(hotplug & VC4_HDMI_HOTPLUG_CONNECTED);
1395+
}
1396+
13911397
/* HDMI audio codec callbacks */
13921398
static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi,
13931399
unsigned int samplerate)
@@ -2851,6 +2857,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
28512857
.calc_hsm_clock = vc5_hdmi_calc_hsm_clock,
28522858
.channel_map = vc5_hdmi_channel_map,
28532859
.supports_hdr = true,
2860+
.hp_detect = vc5_hdmi_hp_detect,
28542861
};
28552862

28562863
static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
@@ -2880,6 +2887,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
28802887
.calc_hsm_clock = vc5_hdmi_calc_hsm_clock,
28812888
.channel_map = vc5_hdmi_channel_map,
28822889
.supports_hdr = true,
2890+
.hp_detect = vc5_hdmi_hp_detect,
28832891
};
28842892

28852893
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
@@ -105,6 +105,9 @@ struct vc4_hdmi_variant {
105105

106106
/* Enables HDR metadata */
107107
bool supports_hdr;
108+
109+
/* Callback for hardware specific hotplug detect */
110+
bool (*hp_detect)(struct vc4_hdmi *vc4_hdmi);
108111
};
109112

110113
/* HDMI audio information */

0 commit comments

Comments
 (0)