1 From a39d6a00d02a2e1d1afce976ded233bc40bf6b33 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.org>
3 Date: Tue, 28 May 2019 13:56:06 +0100
4 Subject: [PATCH 617/773] drm: vc4: handle the case where there are no
7 It's reasonable for the firmware to return zero as the number of
8 attached displays. Handle this case as otherwise drm thinks that
9 the DSI panel is attached, which is nonsense.
11 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
13 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 32 +++++++++++++++-----------
14 1 file changed, 18 insertions(+), 14 deletions(-)
16 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
17 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
18 @@ -1309,13 +1309,13 @@ static int vc4_fkms_bind(struct device *
19 RPI_FIRMWARE_FRAMEBUFFER_GET_NUM_DISPLAYS,
20 &num_displays, sizeof(u32));
22 - /* If we fail to get the number of displays, or it returns 0, then
23 + /* If we fail to get the number of displays, then
24 * assume old firmware that doesn't have the mailbox call, so just
27 - if (ret || num_displays == 0) {
30 - DRM_WARN("Unable to determine number of displays's. Assuming 1\n");
31 + DRM_WARN("Unable to determine number of displays - assuming 1\n");
35 @@ -1344,17 +1344,21 @@ static int vc4_fkms_bind(struct device *
39 - /* Map the SMI interrupt reg */
40 - crtc_list[0]->regs = vc4_ioremap_regs(pdev, 0);
41 - if (IS_ERR(crtc_list[0]->regs))
42 - DRM_ERROR("Oh dear, failed to map registers\n");
44 - writel(0, crtc_list[0]->regs + SMICS);
45 - ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
46 - vc4_crtc_irq_handler, 0, "vc4 firmware kms",
49 - DRM_ERROR("Oh dear, failed to register IRQ\n");
50 + if (num_displays > 0) {
51 + /* Map the SMI interrupt reg */
52 + crtc_list[0]->regs = vc4_ioremap_regs(pdev, 0);
53 + if (IS_ERR(crtc_list[0]->regs))
54 + DRM_ERROR("Oh dear, failed to map registers\n");
56 + writel(0, crtc_list[0]->regs + SMICS);
57 + ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
58 + vc4_crtc_irq_handler, 0,
59 + "vc4 firmware kms", crtc_list);
61 + DRM_ERROR("Oh dear, failed to register IRQ\n");
63 + DRM_WARN("No displays found. Consider forcing hotplug if HDMI is attached\n");
66 platform_set_drvdata(pdev, crtc_list);