drm/radeon/kms: prefer high post dividers in legacy pll algo
Subsystems (2)
PATCH 1/3 drm/radeon/kms: prefer high post dividers in legacy pll algo
the hw prefers higher post dividers
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +1 -1
@@ -513,7 +513,7 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll, max_fractional_feed_div = pll->max_frac_feedback_div; } -for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { +for (post_div = max_post_div; post_div >= min_post_div; --post_div) {uint32_t ref_div;if ((pll->flags &RADEON_PLL_NO_ODD_POST_DIV ) && (post_div &1 ))
Signature · 1 line
1.7.1.1
PATCH 2/3 drm/radeon/kms: remove some pll algo flags
These shouldn't be needed with the post div changes in the last patch.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/radeon/atombios_crtc.c | 14 +------------- drivers/gpu/drm/radeon/radeon_display.c | 26 ++------------------------ drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 5 ----- drivers/gpu/drm/radeon/radeon_mode.h | 14 ++++---------- 4 files changed, 7 insertions(+), 52 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +1 -13
@@ -501,21 +501,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, (rdev->family == CHIP_RS740)) pll->flags |= (/*RADEON_PLL_USE_FRAC_FB_DIV |*/ RADEON_PLL_PREFER_CLOSEST_LOWER ); - -if (ASIC_IS_DCE32 (rdev) && mode->clock >200000 )/* range limits??? */ - pll->flags |=RADEON_PLL_PREFER_HIGH_FB_DIV ; -else - pll->flags |=RADEON_PLL_PREFER_LOW_REF_DIV ; - }else { + }else pll->flags |=RADEON_PLL_LEGACY ; -if (mode->clock >200000 )/* range limits??? */ - pll->flags |=RADEON_PLL_PREFER_HIGH_FB_DIV ; -else - pll->flags |=RADEON_PLL_PREFER_LOW_REF_DIV ; - - } -list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {if (encoder->crtc == crtc) { radeon_encoder =to_radeon_encoder (encoder);
drivers/gpu/drm/radeon/radeon_display.c +2 -24
@@ -579,7 +579,8 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll,if ((best_vco ==0 && error < best_error) || (best_vco !=0 && ((best_error >100 && error < best_error -100 ) || - (abs (error - best_error) <100 && vco_diff < best_vco_diff)))) { + (abs (error - best_error) <100 && + vco_diff < best_vco_diff)))) { best_post_div = post_div; best_ref_div = ref_div; best_feedback_div = feedback_div;
@@ -587,29 +588,6 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll, best_freq = current_freq; best_error = error; best_vco_diff = vco_diff; - }else if (current_freq == freq) { -if (best_freq ==-1 ) { - best_post_div = post_div; - best_ref_div = ref_div; - best_feedback_div = feedback_div; - best_frac_feedback_div = frac_feedback_div; - best_freq = current_freq; - best_error = error; - best_vco_diff = vco_diff; - }else if (((pll->flags &RADEON_PLL_PREFER_LOW_REF_DIV ) && (ref_div < best_ref_div)) || - ((pll->flags &RADEON_PLL_PREFER_HIGH_REF_DIV ) && (ref_div > best_ref_div)) || - ((pll->flags &RADEON_PLL_PREFER_LOW_FB_DIV ) && (feedback_div < best_feedback_div)) || - ((pll->flags &RADEON_PLL_PREFER_HIGH_FB_DIV ) && (feedback_div > best_feedback_div)) || - ((pll->flags &RADEON_PLL_PREFER_LOW_POST_DIV ) && (post_div < best_post_div)) || - ((pll->flags &RADEON_PLL_PREFER_HIGH_POST_DIV ) && (post_div > best_post_div))) { - best_post_div = post_div; - best_ref_div = ref_div; - best_feedback_div = feedback_div; - best_frac_feedback_div = frac_feedback_div; - best_freq = current_freq; - best_error = error; - best_vco_diff = vco_diff; - } }if (current_freq < freq) min_frac_feed_div = frac_feedback_div +1 ;
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +0 -5
@@ -722,11 +722,6 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)else pll->algo =PLL_ALGO_LEGACY ; -if (mode->clock >200000 )/* range limits??? */ - pll->flags |=RADEON_PLL_PREFER_HIGH_FB_DIV ; -else - pll->flags |=RADEON_PLL_PREFER_LOW_REF_DIV ; -list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {if (encoder->crtc == crtc) {struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);
drivers/gpu/drm/radeon/radeon_mode.h +4 -10
@@ -139,16 +139,10 @@ struct radeon_tmds_pll {#define RADEON_PLL_NO_ODD_POST_DIV (1 << 1)#define RADEON_PLL_USE_REF_DIV (1 << 2)#define RADEON_PLL_LEGACY (1 << 3) -#define RADEON_PLL_PREFER_LOW_REF_DIV (1 << 4) -#define RADEON_PLL_PREFER_HIGH_REF_DIV (1 << 5) -#define RADEON_PLL_PREFER_LOW_FB_DIV (1 << 6) -#define RADEON_PLL_PREFER_HIGH_FB_DIV (1 << 7) -#define RADEON_PLL_PREFER_LOW_POST_DIV (1 << 8) -#define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9) -#define RADEON_PLL_USE_FRAC_FB_DIV (1 << 10) -#define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) -#define RADEON_PLL_USE_POST_DIV (1 << 12) -#define RADEON_PLL_IS_LCD (1 << 13) +#define RADEON_PLL_USE_FRAC_FB_DIV (1 << 4) +#define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 5) +#define RADEON_PLL_USE_POST_DIV (1 << 6) +#define RADEON_PLL_IS_LCD (1 << 7)/* pll algo */ enum radeon_pll_algo {
Signature · 1 line
1.7.1.1
PATCH 3/3 drm/radeon/kms: remove new pll algo
In reply to Alex DeucherThe recent changes to the old algo (prefer high post div) coupled with the range and precision limitations of using fixed point with the new algo make the new algo less useful. So drop the new algo. This should work as well or better than the old new/old combinations and simplifies the code a lot.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=30218
among others.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/radeon/atombios_crtc.c | 32 +---- drivers/gpu/drm/radeon/radeon.h | 1 - drivers/gpu/drm/radeon/radeon_atombios.c | 15 +-- drivers/gpu/drm/radeon/radeon_display.c | 222 +-------------------------- drivers/gpu/drm/radeon/radeon_drv.c | 4 - drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 4 - drivers/gpu/drm/radeon/radeon_mode.h | 9 - 7 files changed, 9 insertions(+), 278 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +1 -31
@@ -482,19 +482,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,/* reset the pll flags */ pll->flags =0 ; -/* select the PLL algo */ -if (ASIC_IS_AVIVO (rdev)) { -if (radeon_new_pll ==0 ) - pll->algo =PLL_ALGO_LEGACY ; -else - pll->algo =PLL_ALGO_NEW ; - }else { -if (radeon_new_pll ==1 ) - pll->algo =PLL_ALGO_NEW ; -else - pll->algo =PLL_ALGO_LEGACY ; - } -if (ASIC_IS_AVIVO (rdev)) { if ((rdev->family == CHIP_RS600) || (rdev->family == CHIP_RS690) ||
@@ -523,25 +510,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,/* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ if (radeon_encoder->encoder_id ==ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 ) adjusted_clock = mode->clock *2 ; -if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT )) { - pll->algo =PLL_ALGO_LEGACY ; +if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT )) pll->flags |=RADEON_PLL_PREFER_CLOSEST_LOWER ; - } -/* There is some evidence (often anecdotal) that RV515/RV620 LVDS -* (on some boards at least) prefers the legacy algo. I'm not -* sure whether this should handled generically or on a -* case-by-case quirk basis. Both algos should work fine in the -* majority of cases. -*/ -if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT )) && - ((rdev->family ==CHIP_RV515 ) || - (rdev->family ==CHIP_RV620 ))) { -/* allow the user to overrride just in case */ -if (radeon_new_pll ==1 ) - pll->algo =PLL_ALGO_NEW ; -else - pll->algo =PLL_ALGO_LEGACY ; - } }else {if (encoder->encoder_type !=DRM_MODE_ENCODER_DAC ) pll->flags |=RADEON_PLL_NO_ODD_POST_DIV ;
drivers/gpu/drm/radeon/radeon.h +0 -1
@@ -88,7 +88,6 @@ extern int radeon_benchmarking;extern int radeon_testing;extern int radeon_connector_table;extern int radeon_tv; -extern int radeon_new_pll;extern int radeon_audio;extern int radeon_disp_priority;extern int radeon_hw_i2c;
drivers/gpu/drm/radeon/radeon_atombios.c +1 -14
@@ -1112,8 +1112,7 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)* pre-DCE 3.0 r6xx hardware. This might need to be adjusted per * family. */ -if (!radeon_new_pll) - p1pll->pll_out_min =64800 ; + p1pll->pll_out_min =64800 ; } p1pll->pll_in_min =
@@ -1390,18 +1389,6 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct lvds->ss =radeon_atombios_get_ss_info (encoder, lvds_info->info.ucSS_Id); -if (ASIC_IS_AVIVO (rdev)) { -if (radeon_new_pll ==0 ) - lvds->pll_algo =PLL_ALGO_LEGACY ; -else - lvds->pll_algo =PLL_ALGO_NEW ; - }else { -if (radeon_new_pll ==1 ) - lvds->pll_algo =PLL_ALGO_NEW ; -else - lvds->pll_algo =PLL_ALGO_LEGACY ; - } - encoder->native_mode = lvds->native_mode;if (encoder_enum ==2 )
drivers/gpu/drm/radeon/radeon_display.c +7 -215
234 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_drv.c +0 -4
@@ -93,7 +93,6 @@ int radeon_benchmarking = 0;int radeon_testing =0 ;int radeon_connector_table =0 ;int radeon_tv =1 ; -int radeon_new_pll =-1 ;int radeon_audio =1 ;int radeon_disp_priority =0 ;int radeon_hw_i2c =0 ;
@@ -131,9 +130,6 @@ module_param_named(connector_table, radeon_connector_table, int, 0444);MODULE_PARM_DESC (tv,"TV enable (0 = disable)" );module_param_named (tv, radeon_tv, int,0444 ); -MODULE_PARM_DESC (new_pll,"Select new PLL code" ); -module_param_named (new_pll, radeon_new_pll, int,0444 ); -MODULE_PARM_DESC (audio,"Audio enable (0 = disable)" );module_param_named (audio, radeon_audio, int,0444 );
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +0 -4
@@ -717,10 +717,6 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) pll = &rdev->clock.p1pll; pll->flags =RADEON_PLL_LEGACY ; -if (radeon_new_pll ==1 ) - pll->algo =PLL_ALGO_NEW ; -else - pll->algo =PLL_ALGO_LEGACY ;list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {if (encoder->crtc == crtc) {
drivers/gpu/drm/radeon/radeon_mode.h +0 -9
@@ -144,12 +144,6 @@ struct radeon_tmds_pll {#define RADEON_PLL_USE_POST_DIV (1 << 6)#define RADEON_PLL_IS_LCD (1 << 7) -/* pll algo */ -enum radeon_pll_algo { -PLL_ALGO_LEGACY , -PLL_ALGO_NEW -}; -struct radeon_pll {/* reference frequency */ uint32_t reference_freq;
@@ -182,8 +176,6 @@ struct radeon_pll {/* pll id */ uint32_t id; -/* pll algo */ -enum radeon_pll_algo algo; };struct radeon_i2c_chan {
@@ -344,7 +336,6 @@ struct radeon_encoder_atom_dig {/* atom lvds */ uint32_t lvds_misc;uint16_t panel_pwr_delay; -enum radeon_pll_algo pll_algo;struct radeon_atom_ss *ss;/* panel mode */ struct drm_display_mode native_mode;
Signature · 1 line
1.7.1.1