Skip to content

Commit c67f7fb

Browse files
Jonathan Bellpopcornmix
authored andcommitted
drm: vc4: handle the case where there are no available displays
It's reasonable for the firmware to return zero as the number of attached displays. Handle this case as otherwise drm thinks that the DSI panel is attached, which is nonsense. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
1 parent ab7b3e5 commit c67f7fb

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

‎drivers/gpu/drm/vc4/vc4_firmware_kms.c‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,13 +1303,13 @@ static int vc4_fkms_bind(struct device *dev, struct device *master, void *data)
13031303
RPI_FIRMWARE_FRAMEBUFFER_GET_NUM_DISPLAYS,
13041304
&num_displays, sizeof(u32));
13051305

1306-
/* If we fail to get the number of displays, or it returns 0, then
1306+
/* If we fail to get the number of displays, then
13071307
* assume old firmware that doesn't have the mailbox call, so just
13081308
* set one display
13091309
*/
1310-
if (ret || num_displays == 0) {
1310+
if (ret) {
13111311
num_displays = 1;
1312-
DRM_WARN("Unable to determine number of displays's. Assuming 1\n");
1312+
DRM_WARN("Unable to determine number of displays - assuming 1\n");
13131313
ret = 0;
13141314
}
13151315

@@ -1338,17 +1338,21 @@ static int vc4_fkms_bind(struct device *dev, struct device *master, void *data)
13381338
display_num);
13391339
}
13401340

1341-
/* Map the SMI interrupt reg */
1342-
crtc_list[0]->regs = vc4_ioremap_regs(pdev, 0);
1343-
if (IS_ERR(crtc_list[0]->regs))
1344-
DRM_ERROR("Oh dear, failed to map registers\n");
1345-
1346-
writel(0, crtc_list[0]->regs + SMICS);
1347-
ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
1348-
vc4_crtc_irq_handler, 0, "vc4 firmware kms",
1349-
crtc_list);
1350-
if (ret)
1351-
DRM_ERROR("Oh dear, failed to register IRQ\n");
1341+
if (num_displays > 0) {
1342+
/* Map the SMI interrupt reg */
1343+
crtc_list[0]->regs = vc4_ioremap_regs(pdev, 0);
1344+
if (IS_ERR(crtc_list[0]->regs))
1345+
DRM_ERROR("Oh dear, failed to map registers\n");
1346+
1347+
writel(0, crtc_list[0]->regs + SMICS);
1348+
ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
1349+
vc4_crtc_irq_handler, 0,
1350+
"vc4 firmware kms", crtc_list);
1351+
if (ret)
1352+
DRM_ERROR("Oh dear, failed to register IRQ\n");
1353+
} else {
1354+
DRM_WARN("No displays found. Consider forcing hotplug if HDMI is attached\n");
1355+
}
13521356

13531357
platform_set_drvdata(pdev, crtc_list);
13541358

0 commit comments

Comments
 (0)