mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] video: panel-mipi-dbi: fix fake clock calculation
@ 2025-06-02  6:16 Ahmad Fatoum
  2025-06-02  6:16 ` [PATCH 2/2] video: give struct fb_videomode::pixclock a strong picoseconds_t type Ahmad Fatoum
  2025-06-02  7:46 ` [PATCH 1/2] video: panel-mipi-dbi: fix fake clock calculation Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-06-02  6:16 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-02  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-02  6:16 [PATCH 1/2] video: panel-mipi-dbi: fix fake clock calculation Ahmad Fatoum
2025-06-02  6:16 ` [PATCH 2/2] video: give struct fb_videomode::pixclock a strong picoseconds_t type Ahmad Fatoum
2025-06-02  7:46 ` [PATCH 1/2] video: panel-mipi-dbi: fix fake clock calculation Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox