media: staging/ipu7: use 64-bit macro for post delay calculation
Subsystems (3)
PATCH 1/1 media: staging/ipu7: use 64-bit macro for post delay calculation
From: Bingbu Cao <[email protected]>
When build ipu7 driver with i386 config, it will report error:
ERROR: modpost: "__udivdi3" [../intel-ipu7-isys.ko] undefined!
This patch fix the problem by using correct math macro to implement the 64-bit value division instead of C divide operator.
This patch also update the calculation to make it aligned with the formula in the specification.
--- drivers/staging/media/ipu7/ipu7-isys-csi-phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c +2 -3
@@ -731,6 +731,7 @@ static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,u16 delay_thresh;u16 reset_thresh;u16 cap_prog =6U ; +u32 t3 =224U ;u16 reg;u16 val;u32 i;
@@ -815,9 +816,7 @@ static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,dwc_phy_write_mask (isys, id, reg +0x400 * i, deass_thresh,0 ,7 ); - delay_thresh = - ((224U - (9U *7U )) *1000U ) / (5U * mbps) -7U ; - + delay_thresh =div64_u64 ((t3 -63U ) *1000U ,5U * mbps) -7U ;if (delay_thresh <1 ) delay_thresh =1 ;
Signature · 1 line
2.34.1
Sakari Ailus
maintainerHi Bingbu,
Thanks for the patch.
Quoted 32 lines · On Mon, Jul 07, 2025 at 05:58:06PM +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
When build ipu7 driver with i386 config, it will report error:
ERROR: modpost: "__udivdi3" [../intel-ipu7-isys.ko] undefined!This patch fix the problem by using correct math macro to implement the 64-bit value division instead of C divide operator.
This patch also update the calculation to make it aligned with the formula in the specification.
Reported-by kernel test robot <[email protected]>Signed-off-by Bingbu Cao <[email protected]>--- drivers/staging/media/ipu7/ipu7-isys-csi-phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/media/ipu7/ipu7-isys-csi-phy.c +1
-0@@ -731,6 +731,7 @@ static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,u16 delay_thresh;u16 reset_thresh;u16 cap_prog =6U ; +u32 t3 =224U ;u16 reg;u16 val;u32 i;
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes, · line 819
Quoted 7 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c +1
-3@@ -815,9 +816,7 @@ static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,dwc_phy_write_mask (isys, id, reg +0x400 * i, deass_thresh,0 ,7 ); - delay_thresh = - ((224U - (9U *7U )) *1000U ) / (5U * mbps) -7U ; - + delay_thresh =div64_u64 ((t3 -63U ) *1000U ,5U * mbps) -7U ;
Not directly related to this patch, but what these values signify?
Moving 224U to a new local variable named t3 doesn't really change this. I.e. I'd just use the plain value here, too, and have some explanation added for these later on.
Quoted 3 lines
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c +0
-0if (delay_thresh <1 ) delay_thresh =1 ;
Signature · 3 lines
Kind regards, Sakari Ailus