HACK: DEBUG patch for sorting out valid modes w/ 4.9

Message ID 1507577867-6968-1-git-send-email-john.stultz@linaro.org
State New
Headers show
Series
  • HACK: DEBUG patch for sorting out valid modes w/ 4.9
Related show

Commit Message

John Stultz Oct. 9, 2017, 7:37 p.m.
We have a better solution upstream but for older
kernels this can let folks figure out if a mode
is valid or not.

Signed-off-by: John Stultz <john.stultz@linaro.org>

---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c    |  8 ++++----
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c    | 12 ++++++++++--
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c |  3 +++
 3 files changed, 17 insertions(+), 6 deletions(-)

-- 
2.7.4

Patch

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 3bd1ce7..d066342 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -642,7 +642,7 @@  static int adv7511_mode_valid(struct adv7511 *adv7511,
 	/*
 	 * some work well modes which want to put in the front of the mode list.
 	 */
-	DRM_DEBUG("Checking mode %ix%i@%i clock: %i...",
+	printk("JDB: Checking mode %ix%i@%i clock: %i...",
 		  mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), mode->clock);
 	if ((mode->hdisplay == 1920 && mode->vdisplay == 1080 && mode->clock == 148500) ||
 	    (mode->hdisplay == 1280 && mode->vdisplay == 800 && mode->clock == 83496) ||
@@ -652,11 +652,11 @@  static int adv7511_mode_valid(struct adv7511 *adv7511,
 	    (mode->hdisplay == 1024 && mode->vdisplay == 768 && mode->clock == 81833) ||
 	    (mode->hdisplay == 800 && mode->vdisplay == 600 && mode->clock == 40000)) {
 		mode->type |= DRM_MODE_TYPE_PREFERRED;
-		DRM_DEBUG("OK\n");
+		printk("Whitelist OK\n");
 		return MODE_OK;
 	}
-	DRM_DEBUG("BAD\n");
-	return MODE_BAD;
+	printk("Witelist BAD (still reporting OK)\n");
+	return MODE_OK;
 }
 
 static void adv7511_mode_set(struct adv7511 *adv7511,
diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index 998452a..5963996 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -563,8 +563,16 @@  static void dsi_mipi_init(struct dw_dsi *dsi)
 	/* dsi wake up */
 	writel(POWERUP, base + PWR_UP);
 
-	DRM_DEBUG_DRIVER("lanes=%d, pixel_clk=%d kHz, bytes_freq=%d kHz\n",
-			 dsi->lanes, mode->clock, phy->lane_byte_clk_kHz);
+	printk("JDB: %s: lanes=%d, pixel_clk=%d kHz, req_kHz=%d kHz, bytes_freq=%d kHz\n",
+			 __func__, dsi->lanes, mode->clock, dphy_req_kHz, phy->lane_byte_clk_kHz);
+
+	printk("JDB: %s: %d/%d =?= %d/3 .... ", __func__, mode->clock, dsi->lanes, phy->lane_byte_clk_kHz);
+	if (mode->clock/dsi->lanes == phy->lane_byte_clk_kHz/3)
+		printk("JDB: MATCHED GOOD!\n");
+	else
+		printk("JDB: DOES NOT MATCH, BAD!\n");
+
+
 }
 
 static void dsi_encoder_disable(struct drm_encoder *encoder)
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 7e7a4d4..b371e4c 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -193,6 +193,9 @@  static void ade_set_pix_clk(struct ade_hw_ctx *ctx,
 	if (ret)
 		DRM_ERROR("failed to set pixel clk %dHz (%d)\n", clk_Hz, ret);
 	adj_mode->clock = clk_get_rate(ctx->ade_pix_clk) / 1000;
+
+	printk("JDB: %s: %ix%i@%i  requested clock: %ld, adjusted clock: %ld\n", __func__,  mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), mode->clock, adj_mode->clock);
+
 }
 
 static void ade_ldi_set_mode(struct ade_crtc *acrtc,