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

clk: qcom: Fix pre-divider usage for pixel RCG

The clk_rcg_pixel_set_rate clk_op sets up the pre-divider by reading
its current value from the NS register.

Using the pre-divider wasn't really intended when creating these ops.
The pixel RCG was only intended to achieve fractional multiplication
provided in the pixel_table array. Leaving the pre-divider to the
existing register value results in a wrong pixel clock when the
bootloader sets up the display. This was left unidentified because
the IFC6410 Plus board on which this was verified didn't have a
bootloader that configured the display.

Don't set the RCG pre-divider in freq_tbl to the existing NS register
value. Force it to 1 and only use the M/N counter to achieve the desired
fractional multiplication.

Cc: Vinay Simha <vinaysimha@inforcecomputing.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Archit Taneja and committed by
Stephen Boyd
811a498e d3622b58

+3 -1
+3 -1
drivers/clk/qcom/clk-rcg.c
··· 638 638 return ret; 639 639 640 640 src = ns_to_src(&rcg->s, ns); 641 - f.pre_div = ns_to_pre_div(&rcg->p, ns) + 1; 642 641 643 642 for (i = 0; i < num_parents; i++) { 644 643 if (src == rcg->s.parent_map[i].cfg) { ··· 645 646 break; 646 647 } 647 648 } 649 + 650 + /* bypass the pre divider */ 651 + f.pre_div = 1; 648 652 649 653 /* let us find appropriate m/n values for this */ 650 654 for (; frac->num; frac++) {