MLK-20781-3 mx7ulp: clock: adjust LCDIF pixclock algorithm
authorYe Li <ye.li@nxp.com>
Mon, 21 Jan 2019 03:48:08 +0000 (19:48 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:46 +0000 (04:28 -0700)
commit8c4b25ae95112bfaba8b21b5056f17a82971c2ce
tree1fc1c18396ec4a4f59a6a0acbfff231e9028c81a
parent47b06e5926be48a206b5f3b708010702de82015f
MLK-20781-3 mx7ulp: clock: adjust LCDIF pixclock algorithm

Since LCDIF does not have a dedicated PLL as its source, we have to
find a best frequency closed to the target frequency. The previous
method is finding a closed clock with actual frequency higher than target.
But this causes problem to DSI PHY clock which uses target frequency to
calculate its clock parameters.  When the actaul pixclock is higher,
it may violates the requirement between DSI PHY clock and LCDIF pixclock clock.
clk_byte_freq >= dpi_pclk_freq * DPI_pixel_size / ( 8 * (cfg_num_lanes + 1))

So we'd better selecting a LCDIF clock not exceed the target frequency.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit fcd5fac9eb68c3bfed27c5a613315414f37b5990)
(cherry picked from commit ce59d991d21eaa929b20a50f168fde6d6bbfaaf4)
arch/arm/mach-imx/mx7ulp/clock.c