The HDMI block was never included in the display snapshot, so its
register state is missing when a snapshot is captured for debugging.

Fill in the previously empty HDMI snapshot callback to dump the HDMI core
register block. The size of the block is now obtained via
msm_ioremap_size() at probe time and stored in the hdmi structure. As
with DP, the registers are only accessed while the block is powered on,
to avoid an unclocked access.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Dmitry Baryshkov <[email protected]>
---
 drivers/gpu/drm/msm/hdmi/hdmi.c | 14 +++++++++++++-
 drivers/gpu/drm/msm/hdmi/hdmi.h |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 350867ada0cf..72ab2e92964e 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -17,6 +17,7 @@
 
 #include "msm_kms.h"
 #include "hdmi.h"
+#include "disp/msm_disp_snapshot.h"
 
 void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on)
 {
@@ -214,6 +215,17 @@ static int msm_hdmi_modeset_init(struct msm_display 
*display,
 static void msm_hdmi_snapshot(struct msm_display *display,
                              struct msm_disp_state *disp_state)
 {
+       struct hdmi *hdmi = container_of(display, struct hdmi, display);
+
+       /*
+        * Accessing the HDMI registers requires the clocks to be running,
+        * which is only guaranteed while the block is powered on.
+        */
+       if (!hdmi->power_on)
+               return;
+
+       msm_disp_snapshot_add_block(disp_state, hdmi->mmio_size,
+                                   hdmi->mmio, "hdmi");
 }
 
 static const struct msm_display_funcs msm_hdmi_display_funcs = {
@@ -310,7 +322,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
                hdmi->next_bridge = NULL;
        }
 
-       hdmi->mmio = msm_ioremap(pdev, "core_physical");
+       hdmi->mmio = msm_ioremap_size(pdev, "core_physical", &hdmi->mmio_size);
        if (IS_ERR(hdmi->mmio)) {
                ret = PTR_ERR(hdmi->mmio);
                goto err_put_bridge;
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h
index f24444610fe1..869f55d4704a 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.h
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.h
@@ -48,6 +48,7 @@ struct hdmi {
        unsigned long pixclock;
 
        void __iomem *mmio;
+       phys_addr_t mmio_size;
        void __iomem *qfprom_mmio;
        phys_addr_t mmio_phy_addr;
 

-- 
2.47.3

Reply via email to