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

[media] smiapp-pll: Add a few comments to PLL calculation

The PLL calculation heuristics is rather complicated and and is often
difficult to understand to its original author.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
367da7a3 7be5c289

+17
+17
drivers/media/i2c/smiapp-pll.c
··· 87 87 dev_dbg(dev, "vt_pix_clk_freq_hz \t%d\n", pll->vt_pix_clk_freq_hz); 88 88 } 89 89 90 + /* 91 + * Heuristically guess the PLL tree for a given common multiplier and 92 + * divisor. Begin with the operational timing and continue to video 93 + * timing once operational timing has been verified. 94 + * 95 + * @mul is the PLL multiplier and @div is the common divisor 96 + * (pre_pll_clk_div and op_sys_clk_div combined). The final PLL 97 + * multiplier will be a multiple of @mul. 98 + * 99 + * @return Zero on success, error code on error. 100 + */ 90 101 static int __smiapp_pll_calculate(struct device *dev, 91 102 const struct smiapp_pll_limits *limits, 92 103 struct smiapp_pll *pll, uint32_t mul, ··· 106 95 uint32_t sys_div; 107 96 uint32_t best_pix_div = INT_MAX >> 1; 108 97 uint32_t vt_op_binning_div; 98 + /* 99 + * Higher multipliers (and divisors) are often required than 100 + * necessitated by the external clock and the output clocks. 101 + * There are limits for all values in the clock tree. These 102 + * are the minimum and maximum multiplier for mul. 103 + */ 109 104 uint32_t more_mul_min, more_mul_max; 110 105 uint32_t more_mul_factor; 111 106 uint32_t min_vt_div, max_vt_div, vt_div;