From 169b43f3f4eb6f0e5ab577ee888c6f89f6638603 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 21 Oct 2020 18:33:02 +0100 Subject: [PATCH 1/3] dtoverlays: Correct CSI2 settings for ov9281 OV9281 appears to drop the clock to LP mode between frames, but the overlay didn't define this at both ends of the CSI2 link. The overlay also had an incorrect link frequency defined, not that the driver ever checked for one. Fix both issues. Signed-off-by: Dave Stevenson --- arch/arm/boot/dts/overlays/ov9281-overlay.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/overlays/ov9281-overlay.dts b/arch/arm/boot/dts/overlays/ov9281-overlay.dts index 4411c9d9656465..40b298d3dd86d8 100644 --- a/arch/arm/boot/dts/overlays/ov9281-overlay.dts +++ b/arch/arm/boot/dts/overlays/ov9281-overlay.dts @@ -34,7 +34,7 @@ data-lanes = <1 2>; clock-noncontinuous; link-frequencies = - /bits/ 64 <456000000>; + /bits/ 64 <400000000>; }; }; }; @@ -50,6 +50,7 @@ csi1_ep: endpoint { remote-endpoint = <&ov9281_0>; data-lanes = <1 2>; + clock-noncontinuous; }; }; }; From 7b36217a7b78004b09595c135163a8ca99831f93 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 22 Oct 2020 12:05:43 +0100 Subject: [PATCH 2/3] drm/vc4: Reading the hotplug register is only valid if no GPIO defined The order of precedence should be: - hotplug GPIO being defined - DDC probe - hotplug register In particular the hotplug register is not valid if a GPIO is defined (eg on Pi0-3), but was being checked. Fixes "943f078 vc4: cec: Restore cec physical address on reconnect" Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index efecd5fc051803..1679cbb0d45b67 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -442,8 +442,9 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) connected = true; } else if (drm_probe_ddc(vc4_hdmi->ddc)) connected = true; - if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) + else if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) connected = true; + if (connected) { if (connector->status != connector_status_connected) { struct edid *edid = drm_get_edid(connector, vc4_hdmi->ddc); From 7b845b5204be8f7c968fe7ed22741f9decee44a3 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 21 Oct 2020 18:34:56 +0100 Subject: [PATCH 3/3] drm/vc4: Add all the HDMI registers into the debugfs dumps The vc5 HDMI registers hadn't been added into the debugfs register sets, therefore weren't dumped on request. Add them in. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hdmi.c | 44 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 9 +++++++ 2 files changed, 53 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1679cbb0d45b67..f9d8105ada6280 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -401,6 +401,13 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) drm_print_regset32(&p, &vc4_hdmi->hdmi_regset); drm_print_regset32(&p, &vc4_hdmi->hd_regset); + drm_print_regset32(&p, &vc4_hdmi->cec_regset); + drm_print_regset32(&p, &vc4_hdmi->csc_regset); + drm_print_regset32(&p, &vc4_hdmi->dvp_regset); + drm_print_regset32(&p, &vc4_hdmi->intr2_regset); + drm_print_regset32(&p, &vc4_hdmi->phy_regset); + drm_print_regset32(&p, &vc4_hdmi->ram_regset); + drm_print_regset32(&p, &vc4_hdmi->rm_regset); return 0; } @@ -2183,6 +2190,7 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) struct platform_device *pdev = vc4_hdmi->pdev; struct device *dev = &pdev->dev; struct resource *res; + int ret; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi"); if (!res) @@ -2281,6 +2289,42 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) return PTR_ERR(vc4_hdmi->reset); } + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->hdmi_regset, VC4_HDMI); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->hd_regset, VC4_HD); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->cec_regset, VC5_CEC); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->csc_regset, VC5_CSC); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->dvp_regset, VC5_DVP); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->phy_regset, VC5_PHY); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->ram_regset, VC5_RAM); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->rm_regset, VC5_RM); + if (ret) + return ret; + + ret = vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->intr2_regset, VC5_INTR2); + if (ret) + return ret; + return 0; } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index 657c0f660438e3..3e50303692195c 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -167,8 +167,17 @@ struct vc4_hdmi { struct reset_control *reset; + /* Common debugfs regset */ struct debugfs_regset32 hdmi_regset; struct debugfs_regset32 hd_regset; + /* VC5 debugfs regset */ + struct debugfs_regset32 cec_regset; + struct debugfs_regset32 csc_regset; + struct debugfs_regset32 dvp_regset; + struct debugfs_regset32 intr2_regset; + struct debugfs_regset32 phy_regset; + struct debugfs_regset32 ram_regset; + struct debugfs_regset32 rm_regset; }; static inline struct vc4_hdmi *