@@ -845,33 +845,12 @@ static unsigned long
845
845
clk_trion_pll_recalc_rate (struct clk_hw * hw , unsigned long parent_rate )
846
846
{
847
847
struct clk_alpha_pll * pll = to_clk_alpha_pll (hw );
848
- struct regmap * regmap = pll -> clkr .regmap ;
849
- u32 l , frac ;
850
- u64 prate = parent_rate ;
851
-
852
- regmap_read (regmap , PLL_L_VAL (pll ), & l );
853
- regmap_read (regmap , PLL_ALPHA_VAL (pll ), & frac );
854
-
855
- return alpha_pll_calc_rate (prate , l , frac , ALPHA_REG_16BIT_WIDTH );
856
- }
857
-
858
- static long clk_trion_pll_round_rate (struct clk_hw * hw , unsigned long rate ,
859
- unsigned long * prate )
860
- {
861
- struct clk_alpha_pll * pll = to_clk_alpha_pll (hw );
862
- unsigned long min_freq , max_freq ;
863
- u32 l ;
864
- u64 a ;
865
-
866
- rate = alpha_pll_round_rate (rate , * prate ,
867
- & l , & a , ALPHA_REG_16BIT_WIDTH );
868
- if (!pll -> vco_table || alpha_pll_find_vco (pll , rate ))
869
- return rate ;
848
+ u32 l , frac , alpha_width = pll_alpha_width (pll );
870
849
871
- min_freq = pll -> vco_table [ 0 ]. min_freq ;
872
- max_freq = pll -> vco_table [ pll -> num_vco - 1 ]. max_freq ;
850
+ regmap_read ( pll -> clkr . regmap , PLL_L_VAL ( pll ), & l ) ;
851
+ regmap_read ( pll -> clkr . regmap , PLL_ALPHA_VAL ( pll ), & frac ) ;
873
852
874
- return clamp ( rate , min_freq , max_freq );
853
+ return alpha_pll_calc_rate ( parent_rate , l , frac , alpha_width );
875
854
}
876
855
877
856
const struct clk_ops clk_alpha_pll_fixed_ops = {
@@ -917,7 +896,7 @@ const struct clk_ops clk_trion_fixed_pll_ops = {
917
896
.disable = clk_trion_pll_disable ,
918
897
.is_enabled = clk_trion_pll_is_enabled ,
919
898
.recalc_rate = clk_trion_pll_recalc_rate ,
920
- .round_rate = clk_trion_pll_round_rate ,
899
+ .round_rate = clk_alpha_pll_round_rate ,
921
900
};
922
901
EXPORT_SYMBOL_GPL (clk_trion_fixed_pll_ops );
923
902
@@ -1173,7 +1152,7 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate,
1173
1152
* Due to limited number of bits for fractional rate programming, the
1174
1153
* rounded up rate could be marginally higher than the requested rate.
1175
1154
*/
1176
- if (rrate > max || rrate < rate ) {
1155
+ if (rrate > ( rate + PLL_RATE_MARGIN ) || rrate < rate ) {
1177
1156
pr_err ("%s: Rounded rate %lu not within range [%lu, %lu)\n" ,
1178
1157
clk_hw_get_name (hw ), rrate , rate , max );
1179
1158
return - EINVAL ;
0 commit comments