Lines Matching refs:temp_setup
113 struct clk_sscg_pll_setup *temp_setup) in clk_sscg_pll2_check_match() argument
115 int new_diff = temp_setup->fout - temp_setup->fout_request; in clk_sscg_pll2_check_match()
116 int diff = temp_setup->fout_error; in clk_sscg_pll2_check_match()
119 temp_setup->fout_error = new_diff; in clk_sscg_pll2_check_match()
120 memcpy(setup, temp_setup, sizeof(struct clk_sscg_pll_setup)); in clk_sscg_pll2_check_match()
122 if (temp_setup->fout_request == temp_setup->fout) in clk_sscg_pll2_check_match()
129 struct clk_sscg_pll_setup *temp_setup) in clk_sscg_divq_lookup() argument
133 for (temp_setup->divq = 0; temp_setup->divq <= PLL_DIVQ_MAX; in clk_sscg_divq_lookup()
134 temp_setup->divq++) { in clk_sscg_divq_lookup()
135 temp_setup->vco2 = temp_setup->vco1; in clk_sscg_divq_lookup()
136 do_div(temp_setup->vco2, temp_setup->divr2 + 1); in clk_sscg_divq_lookup()
137 temp_setup->vco2 *= 2; in clk_sscg_divq_lookup()
138 temp_setup->vco2 *= temp_setup->divf2 + 1; in clk_sscg_divq_lookup()
139 if (temp_setup->vco2 >= PLL_STAGE2_MIN_FREQ && in clk_sscg_divq_lookup()
140 temp_setup->vco2 <= PLL_STAGE2_MAX_FREQ) { in clk_sscg_divq_lookup()
141 temp_setup->fout = temp_setup->vco2; in clk_sscg_divq_lookup()
142 do_div(temp_setup->fout, 2 * (temp_setup->divq + 1)); in clk_sscg_divq_lookup()
144 ret = clk_sscg_pll2_check_match(setup, temp_setup); in clk_sscg_divq_lookup()
146 temp_setup->bypass = PLL_BYPASS1; in clk_sscg_divq_lookup()
156 struct clk_sscg_pll_setup *temp_setup) in clk_sscg_divf2_lookup() argument
160 for (temp_setup->divf2 = 0; temp_setup->divf2 <= PLL_DIVF2_MAX; in clk_sscg_divf2_lookup()
161 temp_setup->divf2++) { in clk_sscg_divf2_lookup()
162 ret = clk_sscg_divq_lookup(setup, temp_setup); in clk_sscg_divf2_lookup()
171 struct clk_sscg_pll_setup *temp_setup) in clk_sscg_divr2_lookup() argument
175 for (temp_setup->divr2 = 0; temp_setup->divr2 <= PLL_DIVR2_MAX; in clk_sscg_divr2_lookup()
176 temp_setup->divr2++) { in clk_sscg_divr2_lookup()
177 temp_setup->ref_div2 = temp_setup->vco1; in clk_sscg_divr2_lookup()
178 do_div(temp_setup->ref_div2, temp_setup->divr2 + 1); in clk_sscg_divr2_lookup()
179 if (temp_setup->ref_div2 >= PLL_STAGE2_REF_MIN_FREQ && in clk_sscg_divr2_lookup()
180 temp_setup->ref_div2 <= PLL_STAGE2_REF_MAX_FREQ) { in clk_sscg_divr2_lookup()
181 ret = clk_sscg_divf2_lookup(setup, temp_setup); in clk_sscg_divr2_lookup()
191 struct clk_sscg_pll_setup *temp_setup, in clk_sscg_pll2_find_setup() argument
199 temp_setup->vco1 = ref; in clk_sscg_pll2_find_setup()
201 ret = clk_sscg_divr2_lookup(setup, temp_setup); in clk_sscg_pll2_find_setup()
206 struct clk_sscg_pll_setup *temp_setup) in clk_sscg_divf1_lookup() argument
210 for (temp_setup->divf1 = 0; temp_setup->divf1 <= PLL_DIVF1_MAX; in clk_sscg_divf1_lookup()
211 temp_setup->divf1++) { in clk_sscg_divf1_lookup()
212 uint64_t vco1 = temp_setup->ref; in clk_sscg_divf1_lookup()
214 do_div(vco1, temp_setup->divr1 + 1); in clk_sscg_divf1_lookup()
216 vco1 *= temp_setup->divf1 + 1; in clk_sscg_divf1_lookup()
218 ret = clk_sscg_pll2_find_setup(setup, temp_setup, vco1); in clk_sscg_divf1_lookup()
220 temp_setup->bypass = PLL_BYPASS_NONE; in clk_sscg_divf1_lookup()
229 struct clk_sscg_pll_setup *temp_setup) in clk_sscg_divr1_lookup() argument
233 for (temp_setup->divr1 = 0; temp_setup->divr1 <= PLL_DIVR1_MAX; in clk_sscg_divr1_lookup()
234 temp_setup->divr1++) { in clk_sscg_divr1_lookup()
235 temp_setup->ref_div1 = temp_setup->ref; in clk_sscg_divr1_lookup()
236 do_div(temp_setup->ref_div1, temp_setup->divr1 + 1); in clk_sscg_divr1_lookup()
237 if (temp_setup->ref_div1 >= PLL_STAGE1_REF_MIN_FREQ && in clk_sscg_divr1_lookup()
238 temp_setup->ref_div1 <= PLL_STAGE1_REF_MAX_FREQ) { in clk_sscg_divr1_lookup()
239 ret = clk_sscg_divf1_lookup(setup, temp_setup); in clk_sscg_divr1_lookup()
249 struct clk_sscg_pll_setup *temp_setup, in clk_sscg_pll1_find_setup() argument
257 temp_setup->ref = ref; in clk_sscg_pll1_find_setup()
259 ret = clk_sscg_divr1_lookup(setup, temp_setup); in clk_sscg_pll1_find_setup()
268 struct clk_sscg_pll_setup temp_setup; in clk_sscg_pll_find_setup() local
271 memset(&temp_setup, 0, sizeof(struct clk_sscg_pll_setup)); in clk_sscg_pll_find_setup()
274 temp_setup.fout_error = PLL_OUT_MAX_FREQ; in clk_sscg_pll_find_setup()
275 temp_setup.fout_request = rate; in clk_sscg_pll_find_setup()
286 ret = clk_sscg_pll2_find_setup(setup, &temp_setup, prate); in clk_sscg_pll_find_setup()
289 ret = clk_sscg_pll1_find_setup(setup, &temp_setup, prate); in clk_sscg_pll_find_setup()