Skip to contentSkip to conversation

drm/mgag200: Fix PLL setup for G200_SE_A rev >=4

PATCH In review Jocelyn Falempe 2 participants 3 messages Oct 13, 2022 – Oct 18, 2022

Subsystems (4)
lore
Share & tools
lore

Jocelyn Falempe

author reviewer
#0 lore raw

PATCH v2 1/1 drm/mgag200: Fix PLL setup for G200_SE_A rev >=4

For G200_SE_A, PLL M setting is wrong, which leads to blank screen, or "signal out of range" on VGA display.
previous code had "m |= 0x80" which was changed to
m |= ((pixpllcn & BIT(8)) >> 1);

Tested on G200_SE_A rev 42

This line of code was moved to another file with
commit 85397f6bc4ff ("drm/mgag200: Initialize each model in separate function") but can be easily backported before this commit.

v2: * put BIT(7) First to respect MSB-to-LSB (Thomas)
* Add a comment to explain that this bit must be set (Thomas)

Fixes 2dd040946ecf ("drm/mgag200: Store values (not bits) in struct mgag200_pll_values")
---
 drivers/gpu/drm/mgag200/mgag200_g200se.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_g200se.c +2 -1
index be389ed91cbd..bd6e573c9a1a 100644
@@ -284,7 +284,8 @@ static void mgag200_g200se_04_pixpllc_atomic_update(struct drm_crtc *crtc,
 	pixpllcp = pixpllc->p - 1;
 	pixpllcs = pixpllc->s;
 
-	xpixpllcm = pixpllcm | ((pixpllcn & BIT(8)) >> 1);
+	// For G200SE A, BIT(7) should be set unconditionally.
+	xpixpllcm = BIT(7) | pixpllcm;
 	xpixpllcn = pixpllcn;
 	xpixpllcp = (pixpllcs << 3) | pixpllcp;
 
Signature · 1 line
2.37.3
maintainer Reviewed-by on v2 1/1
#1 lore raw

Am 13.10.22 um 15:28 schrieb Jocelyn Falempe:

Quoted 11 lines

For G200_SE_A, PLL M setting is wrong, which leads to blank screen, or "signal out of range" on VGA display.
previous code had "m |= 0x80" which was changed to
m |= ((pixpllcn & BIT(8)) >> 1);

Tested on G200_SE_A rev 42

This line of code was moved to another file with
commit 85397f6bc4ff ("drm/mgag200: Initialize each model in separate function") but can be easily backported before this commit.

Quoted 6 lines

v2: * put BIT(7) First to respect MSB-to-LSB (Thomas)
* Add a comment to explain that this bit must be set (Thomas)

Fixes 2dd040946ecf ("drm/mgag200: Store values (not bits) in struct mgag200_pll_values")
Quoted 18 lines
---
  drivers/gpu/drm/mgag200/mgag200_g200se.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_g200se.c +2 -1
index be389ed91cbd..bd6e573c9a1a 100644
@@ -284,7 +284,8 @@ static void mgag200_g200se_04_pixpllc_atomic_update(struct drm_crtc *crtc,
  	pixpllcp = pixpllc->p - 1;
  	pixpllcs = pixpllc->s;
 
-	xpixpllcm = pixpllcm | ((pixpllcn & BIT(8)) >> 1);
+	// For G200SE A, BIT(7) should be set unconditionally.
+	xpixpllcm = BIT(7) | pixpllcm;
  	xpixpllcn = pixpllcn;
  	xpixpllcp = (pixpllcs << 3) | pixpllcp;
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
author reviewer
#2 lore raw

I just pushed it to drm-misc-next.

I also fixed the commit message a bit, the commit moving this line of code is in fact:

commit 877507bb954e ("drm/mgag200: Provide per-device callbacks for PIXPLLC")

Best Regards

Signature · 1 line
Jocelyn
Quoted 41 lines · Thomas Zimmermann

Am 13.10.22 um 15:28 schrieb Jocelyn Falempe:

Quoted 11 lines

For G200_SE_A, PLL M setting is wrong, which leads to blank screen, or "signal out of range" on VGA display.
previous code had "m |= 0x80" which was changed to
m |= ((pixpllcn & BIT(8)) >> 1);

Tested on G200_SE_A rev 42

This line of code was moved to another file with
commit 85397f6bc4ff ("drm/mgag200: Initialize each model in separate function") but can be easily backported before this commit.

Quoted 6 lines

v2: * put BIT(7) First to respect MSB-to-LSB (Thomas)
     * Add a comment to explain that this bit must be set (Thomas)

Fixes 2dd040946ecf ("drm/mgag200: Store values (not bits) in struct mgag200_pll_values")
Quoted 17 lines

---
  drivers/gpu/drm/mgag200/mgag200_g200se.c | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_g200se.c +2 -1
index be389ed91cbd..bd6e573c9a1a 100644
@@ -284,7 +284,8 @@ static void 
 mgag200_g200se_04_pixpllc_atomic_update(struct drm_crtc *crtc,
       pixpllcp = pixpllc->p - 1;
       pixpllcs = pixpllc->s;
-    xpixpllcm = pixpllcm | ((pixpllcn & BIT(8)) >> 1);
+    // For G200SE A, BIT(7) should be set unconditionally.
+    xpixpllcm = BIT(7) | pixpllcm;
       xpixpllcn = pixpllcn;
       xpixpllcp = (pixpllcs << 3) | pixpllcp;