867da1654c121c43c89c285ce6e33d3937bc0b19
[openwrt/staging/blocktrron.git] /
1 From c6e3f3b5ae58fc945bd73eb88a61a700f3219105 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 616/782] drm: vc4: handle the case where there are no
5 available displays
6
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.
10
11 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
12 ---
13 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 32 +++++++++++++++-----------
14 1 file changed, 18 insertions(+), 14 deletions(-)
15
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));
21
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
25 * set one display
26 */
27 - if (ret || num_displays == 0) {
28 + if (ret) {
29 num_displays = 1;
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");
32 ret = 0;
33 }
34
35 @@ -1344,17 +1344,21 @@ static int vc4_fkms_bind(struct device *
36 display_num);
37 }
38
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");
43 -
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",
47 - crtc_list);
48 - if (ret)
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");
55 +
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);
60 + if (ret)
61 + DRM_ERROR("Oh dear, failed to register IRQ\n");
62 + } else {
63 + DRM_WARN("No displays found. Consider forcing hotplug if HDMI is attached\n");
64 + }
65
66 platform_set_drvdata(pdev, crtc_list);
67