Skip to contentSkip to conversation

media: platform: synopsys: hdmirx: Fix compilation on 32bit arches

PATCH In review Dmitry Osipenko 2 participants 3 messages Mar 7, 2025

Subsystems (3)
lore
Share & tools
lore

Dmitry Osipenko

author maintainer
#0 lore raw

PATCH 1/1 media: platform: synopsys: hdmirx: Fix compilation on 32bit arches

The pixelclock is specified as 64bit integer and for this driver it won't be above 600MHz. Fix the 64bit division of the pixclock for 32bit kernel builds.

---
 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +1 -1
index 4d42da7255f3..7e342bbde967 100644
@@ -291,7 +291,7 @@ static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev,
 	hfp = htotal - hact - hs - hbp;
 	vfp = vtotal - vact - vs - vbp;
 
-	fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
+	fps = ((u32)bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
 	bt->width = hact;
 	bt->height = vact;
 	bt->hfrontporch = hfp;
Signature · 1 line
2.48.1
#1 lore raw

Hi Dmitry,

Quoted 16 lines · Dmitry Osipenko

The pixelclock is specified as 64bit integer and for this driver it won't be above 600MHz. Fix the 64bit division of the pixclock for 32bit kernel builds.

---
 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +0 -0
index 4d42da7255f3..7e342bbde967 100644

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev, · line 294

Quoted 5 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +1 -1
@@ -291,7 +291,7 @@ static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev,
 	hfp = htotal - hact - hs - hbp;
 	vfp = vtotal - vact - vs - vbp;
 
-	fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
+	fps = ((u32)bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);

I just merged:

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/

So you can either leave that patch in, or provide a patch on top.

Regards,

Hans

Quoted 3 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +0 -0
 	bt->width = hact;
 	bt->height = vact;
 	bt->hfrontporch = hfp;
author maintainer
#2 lore raw
Quoted 22 lines · Hans Verkuil

Hi Dmitry,

Quoted 19 lines · Dmitry Osipenko

The pixelclock is specified as 64bit integer and for this driver it won't be above 600MHz. Fix the 64bit division of the pixclock for 32bit kernel builds.

---
 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +0 -0
index 4d42da7255f3..7e342bbde967 100644
@@ -291,7 +291,7 @@ static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev,
 	hfp = htotal - hact - hs - hbp;
 	vfp = vtotal - vact - vs - vbp;
 
Quoted 8 lines

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev, · line 294

Quoted 2 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +1 -1
-	fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
+	fps = ((u32)bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);

I just merged:

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/

So you can either leave that patch in, or provide a patch on top.

Missed that patch you merged. No need to do anything then, thanks!

Signature · 7 lines
Best regards,
Dmitry

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip