Skip to content

Commit 57d98e8

Browse files
Taniya Dasbebarino
authored andcommitted
clk: qcom: clk-alpha-pll: Use common names for defines
The PLL run and standby modes are similar across the PLLs, thus rename them to common names and update the use of these. Signed-off-by: Taniya Das <[email protected]> Signed-off-by: Venkata Narendra Kumar Gutta <[email protected]> Signed-off-by: Vinod Koul <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Reviewed-by: Bryan O'Donoghue <[email protected]> Tested-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent cd5d5d8 commit 57d98e8

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

drivers/clk/qcom/clk-alpha-pll.c

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,10 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
134134
#define PLL_HUAYRA_N_MASK 0xff
135135
#define PLL_HUAYRA_ALPHA_WIDTH 16
136136

137-
#define FABIA_OPMODE_STANDBY 0x0
138-
#define FABIA_OPMODE_RUN 0x1
139-
140-
#define FABIA_PLL_OUT_MASK 0x7
141-
#define FABIA_PLL_RATE_MARGIN 500
142-
143-
#define TRION_PLL_STANDBY 0x0
144-
#define TRION_PLL_RUN 0x1
145-
#define TRION_PLL_OUT_MASK 0x7
137+
#define PLL_STANDBY 0x0
138+
#define PLL_RUN 0x1
139+
#define PLL_OUT_MASK 0x7
140+
#define PLL_RATE_MARGIN 500
146141

147142
#define pll_alpha_width(p) \
148143
((PLL_ALPHA_VAL_U(p) - PLL_ALPHA_VAL(p) == 4) ? \
@@ -766,7 +761,7 @@ static int trion_pll_is_enabled(struct clk_alpha_pll *pll,
766761
if (ret)
767762
return 0;
768763

769-
return ((opmode_regval & TRION_PLL_RUN) && (mode_regval & PLL_OUTCTRL));
764+
return ((opmode_regval & PLL_RUN) && (mode_regval & PLL_OUTCTRL));
770765
}
771766

772767
static int clk_trion_pll_is_enabled(struct clk_hw *hw)
@@ -796,15 +791,15 @@ static int clk_trion_pll_enable(struct clk_hw *hw)
796791
}
797792

798793
/* Set operation mode to RUN */
799-
regmap_write(regmap, PLL_OPMODE(pll), TRION_PLL_RUN);
794+
regmap_write(regmap, PLL_OPMODE(pll), PLL_RUN);
800795

801796
ret = wait_for_pll_enable_lock(pll);
802797
if (ret)
803798
return ret;
804799

805800
/* Enable the PLL outputs */
806801
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll),
807-
TRION_PLL_OUT_MASK, TRION_PLL_OUT_MASK);
802+
PLL_OUT_MASK, PLL_OUT_MASK);
808803
if (ret)
809804
return ret;
810805

@@ -837,12 +832,12 @@ static void clk_trion_pll_disable(struct clk_hw *hw)
837832

838833
/* Disable the PLL outputs */
839834
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll),
840-
TRION_PLL_OUT_MASK, 0);
835+
PLL_OUT_MASK, 0);
841836
if (ret)
842837
return;
843838

844839
/* Place the PLL mode in STANDBY */
845-
regmap_write(regmap, PLL_OPMODE(pll), TRION_PLL_STANDBY);
840+
regmap_write(regmap, PLL_OPMODE(pll), PLL_STANDBY);
846841
regmap_update_bits(regmap, PLL_MODE(pll), PLL_RESET_N, PLL_RESET_N);
847842
}
848843

@@ -1089,14 +1084,14 @@ static int alpha_pll_fabia_enable(struct clk_hw *hw)
10891084
return ret;
10901085

10911086
/* Skip If PLL is already running */
1092-
if ((opmode_val & FABIA_OPMODE_RUN) && (val & PLL_OUTCTRL))
1087+
if ((opmode_val & PLL_RUN) && (val & PLL_OUTCTRL))
10931088
return 0;
10941089

10951090
ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, 0);
10961091
if (ret)
10971092
return ret;
10981093

1099-
ret = regmap_write(regmap, PLL_OPMODE(pll), FABIA_OPMODE_STANDBY);
1094+
ret = regmap_write(regmap, PLL_OPMODE(pll), PLL_STANDBY);
11001095
if (ret)
11011096
return ret;
11021097

@@ -1105,7 +1100,7 @@ static int alpha_pll_fabia_enable(struct clk_hw *hw)
11051100
if (ret)
11061101
return ret;
11071102

1108-
ret = regmap_write(regmap, PLL_OPMODE(pll), FABIA_OPMODE_RUN);
1103+
ret = regmap_write(regmap, PLL_OPMODE(pll), PLL_RUN);
11091104
if (ret)
11101105
return ret;
11111106

@@ -1114,7 +1109,7 @@ static int alpha_pll_fabia_enable(struct clk_hw *hw)
11141109
return ret;
11151110

11161111
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll),
1117-
FABIA_PLL_OUT_MASK, FABIA_PLL_OUT_MASK);
1112+
PLL_OUT_MASK, PLL_OUT_MASK);
11181113
if (ret)
11191114
return ret;
11201115

@@ -1144,13 +1139,12 @@ static void alpha_pll_fabia_disable(struct clk_hw *hw)
11441139
return;
11451140

11461141
/* Disable main outputs */
1147-
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll), FABIA_PLL_OUT_MASK,
1148-
0);
1142+
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll), PLL_OUT_MASK, 0);
11491143
if (ret)
11501144
return;
11511145

11521146
/* Place the PLL in STANDBY */
1153-
regmap_write(regmap, PLL_OPMODE(pll), FABIA_OPMODE_STANDBY);
1147+
regmap_write(regmap, PLL_OPMODE(pll), PLL_STANDBY);
11541148
}
11551149

11561150
static unsigned long alpha_pll_fabia_recalc_rate(struct clk_hw *hw,
@@ -1171,7 +1165,7 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate,
11711165
struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
11721166
u32 l, alpha_width = pll_alpha_width(pll);
11731167
u64 a;
1174-
unsigned long rrate, max = rate + FABIA_PLL_RATE_MARGIN;
1168+
unsigned long rrate, max = rate + PLL_RATE_MARGIN;
11751169

11761170
rrate = alpha_pll_round_rate(rate, prate, &l, &a, alpha_width);
11771171

@@ -1230,7 +1224,7 @@ static int alpha_pll_fabia_prepare(struct clk_hw *hw)
12301224
* Due to a limited number of bits for fractional rate programming, the
12311225
* rounded up rate could be marginally higher than the requested rate.
12321226
*/
1233-
if (rrate > (cal_freq + FABIA_PLL_RATE_MARGIN) || rrate < cal_freq)
1227+
if (rrate > (cal_freq + PLL_RATE_MARGIN) || rrate < cal_freq)
12341228
return -EINVAL;
12351229

12361230
/* Setup PLL for calibration frequency */

0 commit comments

Comments
 (0)