Skip to contentSkip to conversation

drm/bridge: ps8640: Use constant sleep time for polling hpd

PATCH Applied Pin-yen Lin 3 participants 4 messages Mar 31, 2023 – Apr 5, 2023

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

PATCH 1/1 drm/bridge: ps8640: Use constant sleep time for polling hpd

The default hpd_wait_us in panel_edp.c is 2 seconds. This makes the sleep time in the polling of _ps8640_wait_hpd_asserted become 200ms. Change it to a constant 20ms to speed up the function.

---

 drivers/gpu/drm/bridge/parade-ps8640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/parade-ps8640.c +1 -1
index b823e55650b1..c3eb45179405 100644
@@ -184,7 +184,7 @@ static int _ps8640_wait_hpd_asserted(struct ps8640 *ps_bridge, unsigned long wai
 	 * actually connected to GPIO9).
 	 */
 	ret = regmap_read_poll_timeout(map, PAGE2_GPIO_H, status,
-				       status & PS_GPIO9, wait_us / 10, wait_us);
+				       status & PS_GPIO9, 20000, wait_us);
 
 	/*
 	 * The first time we see HPD go high after a reset we delay an extra
Signature · 1 line
2.40.0.348.gf938b09366-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Pin-yen Lin

The default hpd_wait_us in panel_edp.c is 2 seconds. This makes the sleep time in the polling of _ps8640_wait_hpd_asserted become 200ms. Change it to a constant 20ms to speed up the function.

---

 drivers/gpu/drm/bridge/parade-ps8640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/parade-ps8640.c +1 -2
index b823e55650b1..c3eb45179405 100644
@@ -184,7 +184,7 @@ static int _ps8640_wait_hpd_asserted(struct ps8640 *ps_bridge, unsigned long wai
         * actually connected to GPIO9).
         */
        ret = regmap_read_poll_timeout(map, PAGE2_GPIO_H, status,
-                                      status & PS_GPIO9, wait_us / 10, wait_us);
+                                      status & PS_GPIO9, 20000, wait_us);
 
        /*
         * The first time we see HPD go high after a reset we delay an extra
--
Quoted 2 lines

2.40.0.348.gf938b09366-goog

Snoozing for a few days before applying.

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Pin-yen Lin

Hi,

Quoted 4 lines · Pin-yen Lin

The default hpd_wait_us in panel_edp.c is 2 seconds. This makes the sleep time in the polling of _ps8640_wait_hpd_asserted become 200ms. Change it to a constant 20ms to speed up the function.

Ah, I see why I never ran into this. All the panels I worked with specified "hpd_absent" of 200 and thus I've always been using 20.

Quoted 11 lines

---

 drivers/gpu/drm/bridge/parade-ps8640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/parade-ps8640.c +0 -0
index b823e55650b1..c3eb45179405 100644

drivers/gpu/drm/bridge/parade-ps8640.c static int _ps8640_wait_hpd_asserted(struct ps8640 *ps_bridge, unsigned long wai · line 187

Quoted 5 lines
drivers/gpu/drm/bridge/parade-ps8640.c +1 -1
@@ -184,7 +184,7 @@ static int _ps8640_wait_hpd_asserted(struct ps8640 *ps_bridge, unsigned long wai
         * actually connected to GPIO9).
         */
        ret = regmap_read_poll_timeout(map, PAGE2_GPIO_H, status,
-                                      status & PS_GPIO9, wait_us / 10, wait_us);
+                                      status & PS_GPIO9, 20000, wait_us);

I'd have been tempted to go even lower at 10ms. Waiting for HPD isn't something that we do all the time during a normal running system and thus it's not something we have to optimize every last bit of power out of. The user would generally rather have the system boot up or switch modes 10ms faster. ;-)

In any case, either at 10ms or 20ms:

-Doug

maintainer Applied
#3 lore raw
In reply to Pin-yen Lin

From: Robert Foss <[email protected]>

Quoted 5 lines · Pin-yen Lin

The default hpd_wait_us in panel_edp.c is 2 seconds. This makes the sleep time in the polling of _ps8640_wait_hpd_asserted become 200ms. Change it to a constant 20ms to speed up the function.

Applied, thanks!

[1/1] drm/bridge: ps8640: Use constant sleep time for polling hpd

      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=4224011374d1

Rob