notro / panel-mipi-dbi

13 stars 1 forks source link

Any way to re-initialize display? #9

Closed mattfbacon closed 8 months ago

mattfbacon commented 8 months ago

Sometimes my display gets disconnected or loses power for whatever reason. Currently my only option to re-initialize the display is to reboot. I tried unloading and reloading the kernel modules but it didn't do anything. Is there a way to manually trigger a re-initialization of the display?

notro commented 8 months ago

Can you try setting drm.debug=0x2 as described here: https://github.com/notro/panel-mipi-dbi/wiki/Debugging#drmdebug

See if you get a Display is ON message from mipi_dbi_display_is_on() indicating that the driver thinks the controller is already initialised.

More info here: https://github.com/notro/panel-mipi-dbi/wiki#controller-reset

If you get that you can write command 0x28 to the controller as shown here: https://github.com/notro/panel-mipi-dbi/wiki/Debugging#debugfs

This will turn off all pixels and the driver should detect that the controller needs initialisation the next time the display pipeline is enabled.

You can also manually write the whole init sequence to the command file.

Finally, if you set the write-only DT property the display controller is initialised every time the pipeline is enabled. Or you can just not wire up MISO so it can't read from the controller (it just reads zeroes, I think).

mattfbacon commented 8 months ago

I have enabled write-only. I am using the screen via the /dev/fb0 interface. Can you clarify what you mean by "pipeline is enabled"?

notro commented 8 months ago

If I remember correctly you can echo 4 > /sys/class/graphics/fbX/blank and it should disable the display pipeline by calling mipi_dbi_pipe_disable().

echo 0 > /sys/class/graphics/fbX/blank should turn it on by calling panel_mipi_dbi_enable()

You can verify this by setting drm.debug=0x2 and look at at the kernel log.

mattfbacon commented 8 months ago

Perfect, that works, thanks.