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

clk: qcom: alpha-pll: Make error prints more informative

I recently ran across this printk error message spewing in my logs

Call set rate on the PLL with rounded rates!

and I had no idea what clk that was or what rate was failing to round
properly. Make the printk more informative by telling us what went wrong
and also add the name of the clk that's failing to change rate.
Furthermore, update the other printks in this file with the clk name
each time so we know what clk we're talking about.

Cc: Taniya Das <tdas@codeaurora.org>
Cc: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lkml.kernel.org/r/20200205065421.9426-1-swboyd@chromium.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Stephen Boyd and committed by
Stephen Boyd
f78f2907 1a615112

+10 -7
+10 -7
drivers/clk/qcom/clk-alpha-pll.c
··· 544 544 rate = alpha_pll_round_rate(rate, prate, &l, &a, alpha_width); 545 545 vco = alpha_pll_find_vco(pll, rate); 546 546 if (pll->vco_table && !vco) { 547 - pr_err("alpha pll not in a valid vco range\n"); 547 + pr_err("%s: alpha pll not in a valid vco range\n", 548 + clk_hw_get_name(hw)); 548 549 return -EINVAL; 549 550 } 550 551 ··· 723 722 */ 724 723 if (clk_alpha_pll_is_enabled(hw)) { 725 724 if (cur_alpha != a) { 726 - pr_err("clock needs to be gated %s\n", 725 + pr_err("%s: clock needs to be gated\n", 727 726 clk_hw_get_name(hw)); 728 727 return -EBUSY; 729 728 } ··· 1171 1170 struct clk_alpha_pll *pll = to_clk_alpha_pll(hw); 1172 1171 u32 l, alpha_width = pll_alpha_width(pll); 1173 1172 u64 a; 1174 - unsigned long rrate; 1173 + unsigned long rrate, max = rate + FABIA_PLL_RATE_MARGIN; 1175 1174 1176 1175 rrate = alpha_pll_round_rate(rate, prate, &l, &a, alpha_width); 1177 1176 ··· 1179 1178 * Due to limited number of bits for fractional rate programming, the 1180 1179 * rounded up rate could be marginally higher than the requested rate. 1181 1180 */ 1182 - if (rrate > (rate + FABIA_PLL_RATE_MARGIN) || rrate < rate) { 1183 - pr_err("Call set rate on the PLL with rounded rates!\n"); 1181 + if (rrate > max || rrate < rate) { 1182 + pr_err("%s: Rounded rate %lu not within range [%lu, %lu)\n", 1183 + clk_hw_get_name(hw), rrate, rate, max); 1184 1184 return -EINVAL; 1185 1185 } 1186 1186 ··· 1198 1196 struct clk_hw *parent_hw; 1199 1197 unsigned long cal_freq, rrate; 1200 1198 u32 cal_l, val, alpha_width = pll_alpha_width(pll); 1199 + const char *name = clk_hw_get_name(hw); 1201 1200 u64 a; 1202 1201 int ret; 1203 1202 ··· 1213 1210 1214 1211 vco = alpha_pll_find_vco(pll, clk_hw_get_rate(hw)); 1215 1212 if (!vco) { 1216 - pr_err("alpha pll: not in a valid vco range\n"); 1213 + pr_err("%s: alpha pll not in a valid vco range\n", name); 1217 1214 return -EINVAL; 1218 1215 } 1219 1216 ··· 1239 1236 /* Bringup the PLL at calibration frequency */ 1240 1237 ret = clk_alpha_pll_enable(hw); 1241 1238 if (ret) { 1242 - pr_err("alpha pll calibration failed\n"); 1239 + pr_err("%s: alpha pll calibration failed\n", name); 1243 1240 return ret; 1244 1241 } 1245 1242