diff mbox series

drm/bridge: fix anx6345 power up sequence

Message ID 20220417181538.57fa1303@blackhole
State New
Headers show
Series drm/bridge: fix anx6345 power up sequence | expand

Commit Message

Torsten Duwe April 17, 2022, 4:15 p.m. UTC
Align the power-up sequence with the known-good procedure documented in [1]:
un-swap dvdd12 and dvdd25, and allow a little extra time for them to settle
before de-asserting reset.
Fixes: 6aa192698089b ("drm/bridge: Add Analogix anx6345 support")

[1] https://github.com/OLIMEX/DIY-LAPTOP/blob/master/
HARDWARE/A64-TERES/TERES-PCB1-A64-MAIN/Rev.C/TERES_PCB1-A64-MAIN_Rev.C.pdf
(page 5, blue comment down left)

Reported-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Torsten Duwe <duwe@lst.de>
Cc: stable@vger.kernel.org

---

This fixes the problem that e.g. X screensaver turns the screen black,
and it stays black until the next reboot; definitely on the Teres-I,
probably on the pinebook64, too.

Comments

Torsten Duwe April 28, 2022, 3:57 p.m. UTC | #1
On Mon, 18 Apr 2022 17:25:57 -0700
Vasily Khoruzhick <anarsoul@gmail.com> wrote:

> On Sun, Apr 17, 2022 at 11:52 AM Vasily Khoruzhick
> <anarsoul@gmail.com> wrote:

> > The change looks good to me, but I'll need some time to actually
> > test it. If you don't hear from me for longer than a week please
> > ping me.
> 
> Your change doesn't fix the issue for me. Running "xrandr --output
> eDP-1 --off; xrandr --output eDP-1 --auto" in a loop triggers the
> issue pretty quickly even with the patch.

Nope, even that works fine here. Side question: how do you initially
power on the eDP bridge? Could there be any leftovers from that
mechanism? I use a hacked-up U-Boot with a procedure similar to the
kernel driver as fixed by this change.

But the main question is: does this patch in any way worsen the
situation on the pinebook?

	Torsten
diff mbox series

Patch

--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -309,27 +309,27 @@  static void anx6345_poweron(struct anx63
 	gpiod_set_value_cansleep(anx6345->gpiod_reset, 1);
 	usleep_range(1000, 2000);
 
-	err = regulator_enable(anx6345->dvdd12);
+	err = regulator_enable(anx6345->dvdd25);
 	if (err) {
-		DRM_ERROR("Failed to enable dvdd12 regulator: %d\n",
+		DRM_ERROR("Failed to enable dvdd25 regulator: %d\n",
 			  err);
 		return;
 	}
 
-	/* T1 - delay between VDD12 and VDD25 should be 0-2ms */
+	/* T1 - delay between VDD25 and VDD12 should be 0-2ms */
 	usleep_range(1000, 2000);
 
-	err = regulator_enable(anx6345->dvdd25);
+	err = regulator_enable(anx6345->dvdd12);
 	if (err) {
-		DRM_ERROR("Failed to enable dvdd25 regulator: %d\n",
+		DRM_ERROR("Failed to enable dvdd12 regulator: %d\n",
 			  err);
 		return;
 	}
 
 	/* T2 - delay between RESETN and all power rail stable,
-	 * should be 2-5ms
+	 * should be at least 2-5ms, 10ms to be safe.
 	 */
-	usleep_range(2000, 5000);
+	usleep_range(9000, 11000);
 
 	gpiod_set_value_cansleep(anx6345->gpiod_reset, 0);