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

OMAPDSS: HDMI: Add M2 divider while calculating clkout

While calculating regm and regmf value add using M2 divider in
the equation.
Formula for calculating:
Output clock on digital core domain:
CLKOUT = (M / (N+1))*CLKINP*(1/M2)
Internal oscillator output clock on internal LDO domain:
CLKDCOLDO = (M / (N+1))*CLKINP
The current code when allows variable M2 values as input
ignores using M2 divider values in calculation of regm and regmf.
so fix it by using M2 in calculation although the default value for
M2 is 1.

Signed-off-by: Mythri P K <mythripk@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Mythri P K and committed by
Tomi Valkeinen
dd2116a3 0ba86d7e

+8 -8
+8 -8
drivers/video/omap2/dss/hdmi.c
··· 278 278 279 279 refclk = clkin / pi->regn; 280 280 281 - /* 282 - * multiplier is pixel_clk/ref_clk 283 - * Multiplying by 100 to avoid fractional part removal 284 - */ 285 - pi->regm = (phy * 100 / (refclk)) / 100; 286 - 287 281 if (dssdev->clocks.hdmi.regm2 == 0) 288 282 pi->regm2 = HDMI_DEFAULT_REGM2; 289 283 else 290 284 pi->regm2 = dssdev->clocks.hdmi.regm2; 291 285 292 286 /* 287 + * multiplier is pixel_clk/ref_clk 288 + * Multiplying by 100 to avoid fractional part removal 289 + */ 290 + pi->regm = phy * pi->regm2 / refclk; 291 + 292 + /* 293 293 * fractional multiplier is remainder of the difference between 294 294 * multiplier and actual phy(required pixel clock thus should be 295 295 * multiplied by 2^18(262144) divided by the reference clock 296 296 */ 297 - mf = (phy - pi->regm * refclk) * 262144; 298 - pi->regmf = mf / (refclk); 297 + mf = (phy - pi->regm / pi->regm2 * refclk) * 262144; 298 + pi->regmf = pi->regm2 * mf / refclk; 299 299 300 300 /* 301 301 * Dcofreq should be set to 1 if required pixel clock