Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tilcdc: Fix setting clock divider for omap-l138

This fixes setting the clock divider on the TI OMAP-L138 LCDK board.

The clock drivers for OMAP-L138 are being covernted to the common clock
framework. When this happens, clk_set_rate() will no longer return an
error. However, on this SoC, the clock rate cannot actually be changed
because the clock has to maintain a fixed ratio to the ARM clock. So
after attempting to set the clock rate, we need to check to see if the
new rate is actually close enough. If not, then follow the previous
error path to adjust the divider in LCDC IP block to compensate for not
being able to change the parent clock rate.

Tested working on a TI OMAP-L138 LCDK board.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>

authored by

David Lechner and committed by
Jyri Sarha
a88ad3de 6d08b06e

+1 -1
+1 -1
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
··· 224 224 225 225 ret = clk_set_rate(priv->clk, req_rate * clkdiv); 226 226 clk_rate = clk_get_rate(priv->clk); 227 - if (ret < 0) { 227 + if (ret < 0 || tilcdc_pclk_diff(req_rate, clk_rate) > 5) { 228 228 /* 229 229 * If we fail to set the clock rate (some architectures don't 230 230 * use the common clock framework yet and may not implement