Lines Matching +full:pll +full:- +full:in

6  * to deal in the Software without restriction, including without limitation
11 * The above copyright notice and this permission notice shall be included in
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
33 * amdgpu_pll_reduce_ratio - fractional number reduction
70 * amdgpu_pll_get_fb_ref_div - feedback and ref divider calculation
91 if (adev->family == AMDGPU_FAMILY_SI) in amdgpu_pll_get_fb_ref_div()
108 * amdgpu_pll_compute - compute PLL paramaters
111 * @pll: information about the PLL
119 * Try to calculate the PLL parameters to generate the given frequency:
123 struct amdgpu_pll *pll, in amdgpu_pll_compute() argument
131 unsigned target_clock = pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV ? in amdgpu_pll_compute()
141 fb_div_min = pll->min_feedback_div; in amdgpu_pll_compute()
142 fb_div_max = pll->max_feedback_div; in amdgpu_pll_compute()
144 if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV) { in amdgpu_pll_compute()
150 if (pll->flags & AMDGPU_PLL_USE_REF_DIV) in amdgpu_pll_compute()
151 ref_div_min = pll->reference_div; in amdgpu_pll_compute()
153 ref_div_min = pll->min_ref_div; in amdgpu_pll_compute()
155 if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV && in amdgpu_pll_compute()
156 pll->flags & AMDGPU_PLL_USE_REF_DIV) in amdgpu_pll_compute()
157 ref_div_max = pll->reference_div; in amdgpu_pll_compute()
159 ref_div_max = pll->max_ref_div; in amdgpu_pll_compute()
162 if (pll->flags & AMDGPU_PLL_USE_POST_DIV) { in amdgpu_pll_compute()
163 post_div_min = pll->post_div; in amdgpu_pll_compute()
164 post_div_max = pll->post_div; in amdgpu_pll_compute()
168 if (pll->flags & AMDGPU_PLL_IS_LCD) { in amdgpu_pll_compute()
169 vco_min = pll->lcd_pll_out_min; in amdgpu_pll_compute()
170 vco_max = pll->lcd_pll_out_max; in amdgpu_pll_compute()
172 vco_min = pll->pll_out_min; in amdgpu_pll_compute()
173 vco_max = pll->pll_out_max; in amdgpu_pll_compute()
176 if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV) { in amdgpu_pll_compute()
184 if (post_div_min < pll->min_post_div) in amdgpu_pll_compute()
185 post_div_min = pll->min_post_div; in amdgpu_pll_compute()
189 --post_div_max; in amdgpu_pll_compute()
190 if (post_div_max > pll->max_post_div) in amdgpu_pll_compute()
191 post_div_max = pll->max_post_div; in amdgpu_pll_compute()
196 den = pll->reference_freq; in amdgpu_pll_compute()
202 if (pll->flags & AMDGPU_PLL_PREFER_MINM_OVER_MAXP) in amdgpu_pll_compute()
212 diff = abs(target_clock - (pll->reference_freq * fb_div) / in amdgpu_pll_compute()
216 !(pll->flags & AMDGPU_PLL_PREFER_MINM_OVER_MAXP))) { in amdgpu_pll_compute()
233 if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV && (fb_div % 10)) { in amdgpu_pll_compute()
234 fb_div_min = max(fb_div_min, (9 - (fb_div % 10)) * 20 + 60); in amdgpu_pll_compute()
243 if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV) { in amdgpu_pll_compute()
251 *dot_clock_p = ((pll->reference_freq * *fb_div_p * 10) + in amdgpu_pll_compute()
252 (pll->reference_freq * *frac_fb_div_p)) / in amdgpu_pll_compute()
257 DRM_DEBUG_KMS("%d - %d, pll dividers - fb: %d.%d ref: %d, post %d\n", in amdgpu_pll_compute()
263 * amdgpu_pll_get_use_mask - look up a mask of which pplls are in use
267 * Returns the mask of which PPLLs (Pixel PLLs) are in use.
271 struct drm_device *dev = crtc->dev; in amdgpu_pll_get_use_mask()
276 list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) { in amdgpu_pll_get_use_mask()
281 if (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID) in amdgpu_pll_get_use_mask()
282 pll_in_use |= (1 << test_amdgpu_crtc->pll_id); in amdgpu_pll_get_use_mask()
288 * amdgpu_pll_get_shared_dp_ppll - return the PPLL used by another crtc for DP
292 * Returns the PPLL (Pixel PLL) used by another crtc/encoder which is
293 * also in DP mode. For DP, a single PPLL can be used for all DP
298 struct drm_device *dev = crtc->dev; in amdgpu_pll_get_shared_dp_ppll()
302 list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) { in amdgpu_pll_get_shared_dp_ppll()
306 if (test_amdgpu_crtc->encoder && in amdgpu_pll_get_shared_dp_ppll()
307 ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(test_amdgpu_crtc->encoder))) { in amdgpu_pll_get_shared_dp_ppll()
308 /* for DP use the same PLL for all */ in amdgpu_pll_get_shared_dp_ppll()
309 if (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID) in amdgpu_pll_get_shared_dp_ppll()
310 return test_amdgpu_crtc->pll_id; in amdgpu_pll_get_shared_dp_ppll()
317 * amdgpu_pll_get_shared_nondp_ppll - return the PPLL used by another non-DP crtc
321 * Returns the PPLL (Pixel PLL) used by another non-DP crtc/encoder which can
327 struct drm_device *dev = crtc->dev; in amdgpu_pll_get_shared_nondp_ppll()
332 adjusted_clock = amdgpu_crtc->adjusted_clock; in amdgpu_pll_get_shared_nondp_ppll()
337 list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) { in amdgpu_pll_get_shared_nondp_ppll()
341 if (test_amdgpu_crtc->encoder && in amdgpu_pll_get_shared_nondp_ppll()
342 !ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(test_amdgpu_crtc->encoder))) { in amdgpu_pll_get_shared_nondp_ppll()
344 if (test_amdgpu_crtc->connector == amdgpu_crtc->connector) { in amdgpu_pll_get_shared_nondp_ppll()
345 /* if we are, return that pll */ in amdgpu_pll_get_shared_nondp_ppll()
346 if (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID) in amdgpu_pll_get_shared_nondp_ppll()
347 return test_amdgpu_crtc->pll_id; in amdgpu_pll_get_shared_nondp_ppll()
349 /* for non-DP check the clock */ in amdgpu_pll_get_shared_nondp_ppll()
350 test_adjusted_clock = test_amdgpu_crtc->adjusted_clock; in amdgpu_pll_get_shared_nondp_ppll()
351 if ((crtc->mode.clock == test_crtc->mode.clock) && in amdgpu_pll_get_shared_nondp_ppll()
353 (amdgpu_crtc->ss_enabled == test_amdgpu_crtc->ss_enabled) && in amdgpu_pll_get_shared_nondp_ppll()
354 (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID)) in amdgpu_pll_get_shared_nondp_ppll()
355 return test_amdgpu_crtc->pll_id; in amdgpu_pll_get_shared_nondp_ppll()