[PATCH] gpu: ipu-v3: ipu-di: Print the generated pixelclock error

Philipp Zabel p.zabel at pengutronix.de
Wed Sep 3 06:06:01 PDT 2014


Hi Fabio,

Am Dienstag, den 02.09.2014, 10:31 -0300 schrieb Fabio Estevam:
> For debug purposes it is useful to know how far away the generated pixelclock is
> from the desired rate, so print the amount of error.
> 
> After adding this patch and with debug enabled we have:
> 
> imx-ipuv3 2400000.ipu: disp 0: panel size = 1920 x 1080
> imx-ipuv3 2400000.ipu: Clocks: IPU 264000000Hz DI 24000000Hz Needed 138500000Hz
> imx-ipuv3 2400000.ipu:   IPU clock can give 132000000 with divider 2, error -4.3%
> imx-ipuv3 2400000.ipu: Want 138500000Hz IPU 264000000Hz DI 138500000Hz using DI, 138500000Hz, error 0.0%
> imx-ipuv3 2400000.ipu: disp 1: panel size = 1024 x 768
> imx-ipuv3 2400000.ipu: Clocks: IPU 264000000Hz DI 64999999Hz Needed 65000000Hz
> imx-ipuv3 2400000.ipu: Want 65000000Hz IPU 264000000Hz DI 64999999Hz using DI, 64999999Hz, error 0.9%

As this example shows ...

[...]
> -	dev_dbg(di->ipu->dev, "Want %luHz IPU %luHz DI %luHz using %s, %luHz\n",
> +	error = (clk_get_rate(di->clk_di_pixel) / (clkgen0 >> 4)) / (sig->pixelclock / 1000);
> +
> +	dev_dbg(di->ipu->dev, "Want %luHz IPU %luHz DI %luHz using %s, %luHz, error %d.%u%%\n",
>  		sig->pixelclock,
>  		clk_get_rate(di->clk_ipu),
>  		clk_get_rate(di->clk_di),
>  		clk == di->clk_di ? "DI" : "IPU",
> -		clk_get_rate(di->clk_di_pixel) / (clkgen0 >> 4));
> +		clk_get_rate(di->clk_di_pixel) / (clkgen0 >> 4),
> +		(signed)(error - 1000) / 10, error % 10);

... this only works for positive deviations. If error < 1000, error % 10
will return the wrong value and for 990 < error < 1000 the sign is
missing.

Also you are losing a lot of presicion. the real error in the example is
more like 0.000002%, so I wonder how useful this really is.

regards
Philipp



More information about the dri-devel mailing list