innolux p097pfg dpms off/on fails (on gru-scarlet)

2020-08-31 Thread Samuel Dionne-Riel
Hi,

I have an Asus Chromebook Tablet CT100PA, which I will refer to as
"dumo" from this point on, which is a specific variant of gru-scarlet.
As far as I am aware, all gru-scarlet are the same, except for the
display, and in turn the different scarlets with the innolux panel
are the same.

I do not have the hardware to verify the kingdisplay variant's
behaviour, though I don't really expect it to fail the same way, but it
is still a possibility that there is a root cause that could cause a
similar failure.

The display will apparently suspend (right wording?) fine with DPMS,
but will not resume (wording?) fine. This has been an issue since the
introduction of the driver and the introduction of the device (scarlet)
to the kernel, and is still on 5.9-rc2.

Doing the following:

  $ xset dpms force off # standby, or suspend
  $ xset dpms force on

Pretty much instantly the following messages are logged:

[   53.731851] dw-mipi-dsi-rockchip ff96.mipi: failed to write command FIFO
[   53.739815] panel-innolux-p079zca ff96.mipi.0: failed to write command 0

Then 120 seconds later, this pair of WARN:

[  173.754168] [ cut here ]
[  173.759343] pclk_mipi_dsi1 already disabled
[  173.764076] WARNING: CPU: 2 PID: 5182 at drivers/clk/clk.c:952 
clk_core_disable+0x2c/0x94
[  173.773216] Modules linked in:
[  173.776639] CPU: 2 PID: 5182 Comm: X Not tainted 5.9.0-rc2 #1-mobile-nixos
[  173.784323] Hardware name: Google Scarlet (DT)
[  173.789292] pstate: 4085 (nZcv daIf -PAN -UAO BTYPE=--)
[  173.795522] pc : clk_core_disable+0x2c/0x94
[  173.800199] lr : clk_core_disable+0x2c/0x94
[  173.804871] sp : 800011d3ba20
[  173.808573] x29: 800011d3ba20 x28: 0028
[  173.814514] x27: c32bdf00 x26: 0038
[  173.820455] x25: 800010d2e2eb x24: edece000
[  173.826395] x23: f0bea680 x22: 0001
[  173.832326] x21: ef82e0e0 x20: f0986500
[  173.838266] x19: f0986500 x18: 
[  173.844198] x17:  x16: 
[  173.850137] x15: 000a x14: 000b962f
[  173.856077] x13: 800091d3b76f x12: 0006
[  173.862008] x11:  x10: 0030
[  173.867939] x9 : 800011d3b77d x8 : 
[  173.873869] x7 : 0008 x6 : 80001118811e
[  173.879809] x5 : f5589e48 x4 : 
[  173.885741] x3 : 0027 x2 : 0027
[  173.891680] x1 : e5c3ee40 x0 : 001f
[  173.897612] Call trace:
[  173.900349]  clk_core_disable+0x2c/0x94
[  173.904637]  clk_core_disable_lock+0x20/0x34
[  173.909413]  clk_disable+0x1c/0x28
[  173.913220]  dw_mipi_dsi_bridge_post_disable+0x80/0x120
[  173.919065]  drm_atomic_bridge_chain_post_disable+0x74/0x98
[  173.925297]  drm_atomic_helper_commit_modeset_disables+0x3d8/0x3dc
[  173.932208]  drm_atomic_helper_commit_tail_rpm+0x20/0xa0
[  173.938138]  commit_tail+0x74/0xf8
[  173.941941]  drm_atomic_helper_commit+0x104/0x108
[  173.947203]  drm_atomic_commit+0x48/0x54
[  173.951590]  drm_atomic_connector_commit_dpms+0xa0/0x100
[  173.957531]  drm_mode_obj_set_property_ioctl+0xd4/0x2c8
[  173.963378]  drm_connector_property_set_ioctl+0x20/0x28
[  173.969220]  drm_ioctl_kernel+0xa0/0xdc
[  173.973507]  drm_ioctl+0x2c4/0x2ec
[  173.977312]  vfs_ioctl+0x24/0x40
[  173.980921]  __arm64_sys_ioctl+0x74/0xa4
[  173.985299]  el0_svc_common.constprop.0+0xe0/0x160
[  173.990655]  do_el0_svc+0x44/0x70
[  173.994362]  el0_sync_handler+0xc8/0x184
[  173.998747]  el0_sync+0x140/0x180
[  174.002450] ---[ end trace 6c6d0de3ca79ec7d ]---
[  174.007763] [ cut here ]
[  174.012925] pclk_mipi_dsi0 already disabled
[  174.017633] WARNING: CPU: 5 PID: 5182 at drivers/clk/clk.c:952 
clk_core_disable+0x2c/0x94
[  174.026770] Modules linked in:
[  174.030184] CPU: 5 PID: 5182 Comm: X Tainted: GW 5.9.0-rc2 
#1-mobile-nixos
[  174.039419] Hardware name: Google Scarlet (DT)
[  174.044382] pstate: 4085 (nZcv daIf -PAN -UAO BTYPE=--)
[  174.050608] pc : clk_core_disable+0x2c/0x94
[  174.055278] lr : clk_core_disable+0x2c/0x94
[  174.059948] sp : 800011d3ba20
[  174.063646] x29: 800011d3ba20 x28: 0028
[  174.069582] x27: c32bdf00 x26: 0038
[  174.075517] x25: 800010d2e2eb x24: edece000
[  174.081451] x23: f0bea680 x22: 0001
[  174.087385] x21: ef82e0e0 x20: f0986400
[  174.093319] x19: f0986400 x18: 
[  174.099254] x17:  x16: 
[  174.105187] x15: 000a x14: 327d
[  174.21] x13: 800091d3b76f x12: 0006
[  174.117055] x11:  x10: 0030
[  174.122989] x9 : 800011d3b77d x8 : 
[  174.128923] x7 : 0008 x6 : 80001118811e
[  174.134856] x5 : f55cbe48 x4 : 
[  

Re: innolux p097pfg dpms off/on fails (on gru-scarlet) with dw-mipi-dsi

2020-08-31 Thread Heiko Stuebner
Hi Samuel,

Am Montag, 31. August 2020, 02:47:56 CEST schrieb Samuel Dionne-Riel:
> I have an Asus Chromebook Tablet CT100PA, which I will refer to as
> "dumo" from this point on, which is a specific variant of gru-scarlet.
> As far as I am aware, all gru-scarlet are the same, except for the
> display, and in turn the different scarlets with the innolux panel
> are the same.
> 
> I do not have the hardware to verify the kingdisplay variant's
> behaviour, though I don't really expect it to fail the same way, but it
> is still a possibility that there is a root cause that could cause a
> similar failure.

as I said in that chat yesterday, this really looks like an issue
with how the dw-mipi-dsi handles powering on and off via the "hack"
in mode_set, which doesn't get called again in non-atomic contexts.

--- Reproducing the text from the paste from yesterday 
DRM component enablement is complex and runs in 3 stages:
- mode_set goes outwards from crtc -> bridges -> panel
- pre_enable goes inwards panel -> bridges -> crtc
- enables again goes outwards crtc -> bridges -> panel

The pre_enable callback for panels is meant to do its powerup which
includes sending its init-sequence - see struct drm_panel
documentation. But this in turn generally requires the dsi controller
to be up and running.

With pre_enable only running inwards the dsi-controller pre_enable
only runs _after_ the panel's pre_enable, making panels unable to
receive their init sequences.

dw_mipi_dsi solved this "creatively" by putting the relevant commands
into the mode_set (including clocks and phy setup) and in all-atomic
environments this seems to work "ok", as mode_set gets call on every
unblank of the display.

But this solution stops working once applications use non-atomic
modesetting, like X11 with the patch applied to v5.4 to block it from
using atomic modesetting or an old qt (v5.9) in this case.

Here only the pre_enable and enable callbacks gets called without
invoking mode_set before, resulting in display output breaking after
the first time the display gets disabled (like blanked due inactivity).

For the short term fix this by simply not disabling the dw-dsi parts.
---

And while I wanted to tackle that problem at some point, so far
I haven't found the time to do so. I've added Yannick and Angelo
who also worked on the driver, maybe they have more ideas.

Heiko


> The display will apparently suspend (right wording?) fine with DPMS,
> but will not resume (wording?) fine. This has been an issue since the
> introduction of the driver and the introduction of the device (scarlet)
> to the kernel, and is still on 5.9-rc2.
> 
> Doing the following:
> 
>   $ xset dpms force off # standby, or suspend
>   $ xset dpms force on
> 
> Pretty much instantly the following messages are logged:
> 
> [   53.731851] dw-mipi-dsi-rockchip ff96.mipi: failed to write command 
> FIFO
> [   53.739815] panel-innolux-p079zca ff96.mipi.0: failed to write command > 0
> 
> Then 120 seconds later, this pair of WARN:
> 
> [  173.754168] [ cut here ]
> [  173.759343] pclk_mipi_dsi1 already disabled
> [  173.764076] WARNING: CPU: 2 PID: 5182 at drivers/clk/clk.c:952 
> clk_core_disable+0x2c/0x94
> [  173.773216] Modules linked in:
> [  173.776639] CPU: 2 PID: 5182 Comm: X Not tainted 5.9.0-rc2 #1-mobile-nixos
> [  173.784323] Hardware name: Google Scarlet (DT)
> [  173.789292] pstate: 4085 (nZcv daIf -PAN -UAO BTYPE=--)
> [  173.795522] pc : clk_core_disable+0x2c/0x94
> [  173.800199] lr : clk_core_disable+0x2c/0x94
> [  173.804871] sp : 800011d3ba20
> [  173.808573] x29: 800011d3ba20 x28: 0028
> [  173.814514] x27: c32bdf00 x26: 0038
> [  173.820455] x25: 800010d2e2eb x24: edece000
> [  173.826395] x23: f0bea680 x22: 0001
> [  173.832326] x21: ef82e0e0 x20: f0986500
> [  173.838266] x19: f0986500 x18: 
> [  173.844198] x17:  x16: 
> [  173.850137] x15: 000a x14: 000b962f
> [  173.856077] x13: 800091d3b76f x12: 0006
> [  173.862008] x11:  x10: 0030
> [  173.867939] x9 : 800011d3b77d x8 : 
> [  173.873869] x7 : 0008 x6 : 80001118811e
> [  173.879809] x5 : f5589e48 x4 : 
> [  173.885741] x3 : 0027 x2 : 0027
> [  173.891680] x1 : e5c3ee40 x0 : 001f
> [  173.897612] Call trace:
> [  173.900349]  clk_core_disable+0x2c/0x94
> [  173.904637]  clk_core_disable_lock+0x20/0x34
> [  173.909413]  clk_disable+0x1c/0x28
> [  173.913220]  dw_mipi_dsi_bridge_post_disable+0x80/0x120
> [  173.919065]  drm_atomic_bridge_chain_post_disable+0x74/0x98