Skip to contentSkip to conversation

drm/radeon/kms: add new PREFER_CLOSEST_HIGHER pll flag

PATCH In review Alex Deucher 1 participant 3 messages Jan 10, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/radeon/kms: add new PREFER_CLOSEST_HIGHER pll flag

Partner to the existing PREFER_CLOSEST_LOWER. A new flag to prefer slightly higher target frequencies if the target cannot be hit exactly.

---
 drivers/gpu/drm/radeon/radeon_display.c |    5 +++++
 drivers/gpu/drm/radeon/radeon_mode.h    |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +5 -0
index 5c9451e..0eae4a4 100644
@@ -908,6 +908,11 @@ void radeon_compute_pll(struct radeon_pll *pll,
 							error = 0xffffffff;
 						else
 							error = freq - current_freq;
+					} else if (pll->flags & RADEON_PLL_PREFER_CLOSEST_HIGHER) {
+						if (freq > current_freq)
+							error = 0xffffffff;
+						else
+							error = current_freq - freq;
 					} else
 						error = abs(current_freq - freq);
 					vco_diff = abs(vco - best_vco);
drivers/gpu/drm/radeon/radeon_mode.h +3 -2
index 162f36b..6b92dec 100644
@@ -147,8 +147,9 @@ struct radeon_tmds_pll {
 #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_PREFER_CLOSEST_HIGHER (1 << 12)
+#define RADEON_PLL_USE_POST_DIV         (1 << 13)
+#define RADEON_PLL_IS_LCD               (1 << 14)
 
 struct radeon_pll {
 	/* reference frequency */
Signature · 1 line
1.7.1.1
#1 lore raw

PATCH 2/2 drm/radeon/kms: ppll stability fixes for rs690

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=32556

---
 drivers/gpu/drm/radeon/atombios_crtc.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +14 -2
index b0ab185..0ed2469 100644
@@ -524,8 +524,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
 		if ((rdev->family == CHIP_RS600) ||
 		    (rdev->family == CHIP_RS690) ||
 		    (rdev->family == CHIP_RS740))
-			pll->flags |= (/*RADEON_PLL_USE_FRAC_FB_DIV |*/
-				       RADEON_PLL_PREFER_CLOSEST_LOWER);
+			pll->flags |= (RADEON_PLL_USE_FRAC_FB_DIV |
+				       RADEON_PLL_PREFER_CLOSEST_HIGHER);
 
 		if (ASIC_IS_DCE32(rdev) && mode->clock > 200000)	/* range limits??? */
 			pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
@@ -578,6 +578,18 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
 				if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS)
 					pll->flags |= RADEON_PLL_USE_REF_DIV;
 			}
+
+			if ((rdev->family == CHIP_RS600) ||
+			    (rdev->family == CHIP_RS690) ||
+			    (rdev->family == CHIP_RS740)) {
+				/* TMDS on these chips seems to prefer a slightly higher clock and
+				 * even post dividers
+				 */
+				if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) {
+					adjusted_clock += 50;
+					pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
+				}
+			}
 			break;
 		}
 	}
Signature · 1 line
1.7.1.1
#2 lore raw

Re: [PATCH 2/2] drm/radeon/kms: ppll stability fixes for rs690

Ignore this one for now. there are still some issues I need to resolve.

Alex

Quoted 46 lines · Alex Deucher

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=32556

---
 drivers/gpu/drm/radeon/atombios_crtc.c |   16 ++++++++++++++--

 1 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +0 -0
index b0ab185..0ed2469 100644
@@ -524,8 +524,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,

               if ((rdev->family == CHIP_RS600) || (rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740))
-                       pll->flags |= (/*RADEON_PLL_USE_FRAC_FB_DIV |*/
-                                      RADEON_PLL_PREFER_CLOSEST_LOWER);
+                       pll->flags |= (RADEON_PLL_USE_FRAC_FB_DIV |
+                                      RADEON_PLL_PREFER_CLOSEST_HIGHER);

               if (ASIC_IS_DCE32(rdev) && mode->clock > 200000)        /* range limits??? */ pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;

drivers/gpu/drm/radeon/atombios_crtc.c +12 -1
@@ -578,6 +578,18 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
                                if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS)
                                        pll->flags |= RADEON_PLL_USE_REF_DIV;
                        }
+
+                       if ((rdev->family == CHIP_RS600) ||
+                           (rdev->family == CHIP_RS690) ||
+                           (rdev->family == CHIP_RS740)) {
+                               /* TMDS on these chips seems to prefer a slightly higher clock and
+                                * even post dividers
+                                */
+                               if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) {
+                                       adjusted_clock += 50;
+                                       pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
+                               }
+                       }
                        break;
                }
        }
--

1.7.1.1