mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 1/2] video: panel-mipi-dbi: fix fake clock calculation
Date: Mon,  2 Jun 2025 08:16:09 +0200	[thread overview]
Message-ID: <20250602061610.752815-1-a.fatoum@barebox.org> (raw)

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




             reply	other threads:[~2025-06-02  6:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02  6:16 Ahmad Fatoum [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250602061610.752815-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox