clk: qcom: fix 16 bit alpha support calculation
authorAbhishek Sahu <absahu@codeaurora.org>
Thu, 28 Sep 2017 17:50:41 +0000 (23:20 +0530)
committerStephen Boyd <sboyd@codeaurora.org>
Wed, 13 Dec 2017 21:45:31 +0000 (13:45 -0800)
commit1e859d3e03f0ac97d15e1952bddda4b29de1c71c
tree5ba5a79a34e0d4e8b3b7b5ef2e7ddab6428a153f
parent28d3f06e56baa9c6e2c8e1d9e5fd663138c08b92
clk: qcom: fix 16 bit alpha support calculation

The alpha value calculation has been written for 40-bit alpha
values which doesn't work work properly for 16-bit ones. The
alpha value is calculated on the basis of ALPHA_BITWIDTH to make
the computation easy for 40 bit alpha. After calculating the 32
bit alpha, it is converted to 40 bit alpha by making lower bits
zero. But if actual alpha register width is less than
ALPHA_BITWIDTH, then the actual width can be used for
calculation. This also means, during the 40 bit alpha pll set
rate path, the lower alpha register is not configured

Change the code to calculate the rate and register values from
'alpha_width' instead of hard-coding it so that it can work for
the different widths that are supported.

Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/qcom/clk-alpha-pll.c
drivers/clk/qcom/clk-alpha-pll.h