[PATCH 1/2] video: panel-mipi-dbi: fix fake clock calculation

Ahmad Fatoum a.fatoum at barebox.org
Sun Jun 1 23:16:09 PDT 2025


pixclock is supposed to be in picoseconds, not Hz and panel-mipi-dbi.c
got that wrong. According to the comment the value isn't used, so this
fix only ensures sane values are read while debugging.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 drivers/video/panel-mipi-dbi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/video/panel-mipi-dbi.c b/drivers/video/panel-mipi-dbi.c
index fecb232796cc..10812c9d7bbd 100644
--- a/drivers/video/panel-mipi-dbi.c
+++ b/drivers/video/panel-mipi-dbi.c
@@ -248,10 +248,12 @@ static int panel_mipi_dbi_get_mode(struct mipi_dbi_dev *dbidev, struct fb_videom
 
 	/* The driver doesn't use the pixel clock but it is mandatory so fake one if not set */
 	if (!mode->pixclock) {
-		mode->pixclock =
-			(mode->left_margin + mode->xres + mode->right_margin + mode->hsync_len) *
-			(mode->upper_margin + mode->yres + mode->lower_margin + mode->vsync_len) *
-			60 / 1000;
+		unsigned htotal = mode->left_margin + mode->xres +
+				mode->right_margin + mode->hsync_len;
+		unsigned vtotal = mode->upper_margin + mode->yres +
+			mode->lower_margin + mode->vsync_len;
+
+		mode->pixclock = KHZ2PICOS(htotal * vtotal * 60 / 1000);
 	}
 
 	return 0;
-- 
2.39.5




More information about the barebox mailing list