drm/msm/dsi: Implement reset correctly
PATCH 1/1 drm/msm/dsi: Implement reset correctly
On msm8998, vblank timeouts are observed because the DSI controller is not reset properly, which ends up stalling the MDP. This is because the reset logic is not correct per the hardware documentation.
The documentation states that after asserting reset, software should wait some time (no indication of how long), or poll the status register until it returns 0 before deasserting reset.
wmb() is insufficient for this purpose since it just ensures ordering, not timing between writes. Since asserting and deasserting reset occurs on the same register, ordering is already guaranteed by the architecture, making the wmb extraneous.
Since we would define a timeout for polling the status register to avoid a possible infinite loop, lets just use a static delay of 20 ms, since 16.666 ms is the time available to process one frame at 60 fps.
---
Rob et al, is it possible for this to go into a 5.4-rc?
drivers/gpu/drm/msm/dsi/dsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -2
@@ -986,7 +986,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)wmb ();/* clocks need to be enabled before reset */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 ); }
@@ -1396,7 +1396,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)/* dsi controller can only be reset while clocks are running */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 );wmb ();/* controller out of reset */ dsi_write (msm_host,REG_DSI_CTRL , data0);
Signature · 6 lines
2.17.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Sean Paul
reviewerQuoted 31 lines · Jeffrey Hugo
On msm8998, vblank timeouts are observed because the DSI controller is not reset properly, which ends up stalling the MDP. This is because the reset logic is not correct per the hardware documentation.
The documentation states that after asserting reset, software should wait some time (no indication of how long), or poll the status register until it returns 0 before deasserting reset.
wmb()is insufficient for this purpose since it just ensures ordering, not timing between writes. Since asserting and deasserting reset occurs on the same register, ordering is already guaranteed by the architecture, making the wmb extraneous.Since we would define a timeout for polling the status register to avoid a possible infinite loop, lets just use a static delay of 20 ms, since 16.666 ms is the time available to process one frame at 60 fps.
Fixes a689554ba6ed (drm/msm: Initial add DSI connector support)Signed-off-by Jeffrey Hugo <[email protected]>---
Rob et al, is it possible for this to go into a 5.4-rc?
drivers/gpu/drm/msm/dsi/dsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_sw_reset(struct msm_dsi_host *msm_host) · line 989
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-1@@ -986,7 +986,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)wmb ();/* clocks need to be enabled before reset */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */
Could you please pull this out into a #define used for both in case we decide to tweak it? I don't want these 2 values to drift.
Thanks,
Sean
Quoted 15 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-1dsi_write (msm_host,REG_DSI_RESET ,0 ); }@@ -1396,7 +1396,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)/* dsi controller can only be reset while clocks are running */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 );wmb ();/* controller out of reset */ dsi_write (msm_host,REG_DSI_CTRL , data0);Signature · 1 line
2.17.1
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Quoted 19 lines · Sean Paul
Quoted 17 lines · Jeffrey Hugo
On msm8998, vblank timeouts are observed because the DSI controller is not reset properly, which ends up stalling the MDP. This is because the reset logic is not correct per the hardware documentation.
The documentation states that after asserting reset, software should wait some time (no indication of how long), or poll the status register until it returns 0 before deasserting reset.
wmb()is insufficient for this purpose since it just ensures ordering, not timing between writes. Since asserting and deasserting reset occurs on the same register, ordering is already guaranteed by the architecture, making the wmb extraneous.Since we would define a timeout for polling the status register to avoid a possible infinite loop, lets just use a static delay of 20 ms, since 16.666 ms is the time available to process one frame at 60 fps.
Quoted 5 lines
Quoted 5 lines
Fixes a689554ba6ed (drm/msm: Initial add DSI connector support)Signed-off-by Jeffrey Hugo <[email protected]>---
Rob et al, is it possible for this to go into a 5.4-rc?
Sorry, I missed this on the first go-around, I'm Ok with this getting into 5.4. Rob, if you're Ok with this, I can send it through -misc unless you're planning an msm-fixes PR.
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/msm/dsi/dsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -986,7 +986,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)wmb ();/* clocks need to be enabled before reset */
Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_sw_reset(struct msm_dsi_host *msm_host) · line 989
Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-1dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ Could you please pull this out into a #define used for both in case we decide to tweak it? I don't want these 2 values to drift.
oh yeah, and with that fixed,
Quoted 8 lines
Thanks,
SeanQuoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0dsi_write (msm_host,REG_DSI_RESET ,0 ); }@@ -1396,7 +1396,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)
Quoted 13 lines
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-2/* dsi controller can only be reset while clocks are running */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 );wmb ();/* controller out of reset */ dsi_write (msm_host,REG_DSI_CTRL , data0); --2.17.1
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Quoted 25 lines · Sean Paul
Quoted 23 lines · Sean Paul
Quoted 21 lines · Jeffrey Hugo
On msm8998, vblank timeouts are observed because the DSI controller is not reset properly, which ends up stalling the MDP. This is because the reset logic is not correct per the hardware documentation.
The documentation states that after asserting reset, software should wait some time (no indication of how long), or poll the status register until it returns 0 before deasserting reset.
wmb()is insufficient for this purpose since it just ensures ordering, not timing between writes. Since asserting and deasserting reset occurs on the same register, ordering is already guaranteed by the architecture, making the wmb extraneous.Since we would define a timeout for polling the status register to avoid a possible infinite loop, lets just use a static delay of 20 ms, since 16.666 ms is the time available to process one frame at 60 fps.
Fixes a689554ba6ed (drm/msm: Initial add DSI connector support)Signed-off-by Jeffrey Hugo <[email protected]>---
Quoted 24 lines
Quoted 1 line
Quoted 1 line
Rob et al, is it possible for this to go into a 5.4-rc?
Sorry, I missed this on the first go-around, I'm Ok with this getting into 5.4. Rob, if you're Ok with this, I can send it through -misc unless you're planning an msm-fixes PR.
Quoted 18 lines
Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_sw_reset(struct msm_dsi_host *msm_host) · line 989
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-1@@ -986,7 +986,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)wmb ();/* clocks need to be enabled before reset */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ Could you please pull this out into a #define used for both in case we decide to tweak it? I don't want these 2 values to drift.
Oh, yeah. That's a really good point. Will fix.
Quoted 4 lines
oh yeah, and with that fixed,
Reviewed-by Sean Paul <[email protected]>
Thanks.
Quoted 22 lines
Quoted 22 lines
Thanks,
SeanQuoted 13 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-2dsi_write (msm_host,REG_DSI_RESET ,0 ); }@@ -1396,7 +1396,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)/* dsi controller can only be reset while clocks are running */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (20 );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 );wmb ();/* controller out of reset */ dsi_write (msm_host,REG_DSI_CTRL , data0); --Quoted 2 lines
2.17.1
--
Sean Paul, Software Engineer, Google / Chromium OS