gpu: ipu-v3: Fix dev_dbg frequency output
Subsystems (2)
PATCH 1/1 gpu: ipu-v3: Fix dev_dbg frequency output
From: Leo Ruan <[email protected]>
This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%.
Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz
After:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz
--- drivers/gpu/ipu-v3/ipu-di.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/ipu-v3/ipu-di.c +3 -2
@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di, error = rate / (sig->mode.pixelclock /1000 ); -dev_dbg (di->ipu->dev," IPU clock can give %lu with divider %u, error %d.%u%%\n" , - rate, div, (signed )(error -1000 ) /10 , error %10 ); +dev_dbg (di->ipu->dev," IPU clock can give %lu with divider %u, error %c%d.%d%%\n" , + rate, div, error <1000 ?'-' :'+' , +abs (error -1000 ) /10 ,abs (error -1000 ) %10 );/* Allow a 1% error */ if (error <1010 && error >=990 ) {
Signature · 1 line
2.17.1
Hi,
Quoted 41 lines
From: Leo Ruan <[email protected]>
This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%.
Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU,
27000000HzAfter:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU,
27000000HzSigned-off-by Leo Ruan <[email protected]>Signed-off-by Mark Jonas <[email protected]>--- drivers/gpu/ipu-v3/ipu-di.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/ipu-v3/ipu-di.c index renamed from drivers/gpu/ipu-v3/ipu-di.c +0
-0
b4a31d506fcc..74eca68891ad100644drivers/gpu/ipu-v3/ipu-di.c +3
-2@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di, error = rate / (sig->mode.pixelclock /1000 ); - dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", - rate, div, (signed )(error -1000 ) /10 , error %10 ); + dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n", + rate, div, error <1000 ?'-' :'+' , +abs (error -1000 ) /10 ,abs (error -1000 ) %10 );
drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_config_clock(struct ipu_di *di, · line 459
Quoted 2 lines
drivers/gpu/ipu-v3/ipu-di.c +0
-0/* Allow a 1% error */ if (error <1010 && error >=990 ) {
Is there anything I can do to help getting this patch mainline?
Cheers,
Mark
Mark Jonas
Building Technologies, Panel Software Fire (BT-FIR/ENG1-Grb)
Bosch Sicherheitssysteme GmbH | Postfach 11 11 | 85626 Grasbrunn | GERMANY | www.boschsecurity.com
Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart HRB 23118
Aufsichtsratsvorsitzender: Christian Fischer; Geschäftsführung: Thomas Quante, Peter Löffler, Henrik Siegle
Am Montag, dem 14.02.2022 um 16:44 +0000 schrieb Jonas Mark (BT-FIR/ENG1-Grb):
Quoted 43 lines
Hi,
Quoted 41 lines
From: Leo Ruan <[email protected]>
This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%.
Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU,
27000000HzAfter:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU,
27000000HzSigned-off-by Leo Ruan <[email protected]>Signed-off-by Mark Jonas <[email protected]>--- drivers/gpu/ipu-v3/ipu-di.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/ipu-v3/ipu-di.c index renamed from drivers/gpu/ipu-v3/ipu-di.c +0
-0
b4a31d506fcc..74eca68891ad100644drivers/gpu/ipu-v3/ipu-di.c +3
-2@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di, error = rate / (sig->mode.pixelclock /1000 ); - dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", - rate, div, (signed )(error -1000 ) /10 , error %10 ); + dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n", + rate, div, error <1000 ?'-' :'+' , +abs (error -1000 ) /10 ,abs (error -1000 ) %10 );
Quoted 4 lines
drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_config_clock(struct ipu_di *di, · line 459
Quoted 2 lines
drivers/gpu/ipu-v3/ipu-di.c +0
-0/* Allow a 1% error */ if (error <1010 && error >=990 ) {Is there anything I can do to help getting this patch mainline?
Philipp is still on vacation, but will be back in a few days. I guess he will take a look at those patches then.
Regards,
Lucas
Hi Mark,
Quoted 31 lines · Mark Jonas
From: Leo Ruan <[email protected]>
This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%.
Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000HzAfter:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000HzSigned-off-by Leo Ruan <[email protected]>Signed-off-by Mark Jonas <[email protected]>---
drivers/gpu/ipu-v3/ipu-di.c | 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/ipu-v3/ipu-di.c +0
-0@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di,
error = rate / (sig->mode.pixelclock/ 1000);
Quoted 8 lines
- dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", - rate, div, (signed)(error - 1000) / 10, error % 10);
+ dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n", + rate, div, error < 1000 ? '-' : '+',
+ abs(error - 1000) / 10, abs(error - 1000) % 10);
/* Allow a 1% error */
if (error < 1010 && error >= 990) {
Rounding (always down) is still a bit unintuitive, but this certainly improves things.
regards
Philipp
Hi,
Quoted 42 lines
Quoted 3 lines
This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -
0.8%.
Quoted 6 lines
But the fixed point math had a flaw and calculated error of 0.2%.
Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU,27000000Hz
Quoted 5 lines
After:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU,27000000Hz
Quoted 25 lines
Signed-off-by Leo Ruan <[email protected]>Signed-off-by Mark Jonas <[email protected]>---
drivers/gpu/ipu-v3/ipu-di.c | 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/ipu-v3/ipu-di.c +5
-2@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di, error = rate / (sig->mode.pixelclock / 1000); - dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", - rate, div, (signed)(error - 1000) / 10, error % 10); + dev_dbg(di->ipu->dev, " IPU clock can give %lu with +divider %u, error %c%d.%d%%\n", + rate, div, error < 1000 ? '-' : '+', + abs(error - 1000) / 10, abs(error - 1000) % +10 );
Quoted 7 lines
Quoted 2 lines
/* Allow a 1% error */
if (error < 1010 && error >= 990) {Rounding (always down) is still a bit unintuitive, but this certainly improves things.
Reviewed-by Philipp Zabel <[email protected]>
What are the chances of getting this patch into 5.18?
Can I do something to support the process?
Cheers,
Mark
Quoted 39 lines · Mark Jonas
From: Leo Ruan <[email protected]>
This commit corrects the printing of the IPU clock error percentage if
it is between -0.1% to -0.9%. For example, if the pixel clock requested
is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%.Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000HzAfter:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000HzSigned-off-by Leo Ruan <[email protected]>Signed-off-by Mark Jonas <[email protected]>---
drivers/gpu/ipu-v3/ipu-di.c | 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/ipu-v3/ipu- renamed from drivers/gpu/ipu-v3/ipu-di.c +0
-0
di.c
indexb4a31d506fcc..74eca68891ad100644drivers/gpu/ipu-v3/ipu-di.c +0
-0@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di,
error = rate / (sig->mode.pixelclock/ 1000);
- dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n",
- rate, div, (signed)(error - 1000) / 10, error % 10);
Quoted 8 lines
+ dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n",
+ rate, div, error < 1000 ? '-' : '+', + abs(error - 1000) / 10, abs(error - 1000) % 10);
/* Allow a 1% error */
if (error < 1010 && error >= 990) {
Thank you, applied to imx-drm/fixes.
regards
Philipp