notro / fbtft

Linux Framebuffer drivers for small TFT LCD display modules. Development has moved to https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fbtft?h=staging-testing
1.85k stars 493 forks source link

Is there a way to re-initialize a screen? #542

Closed jamesfowkes closed 3 years ago

jamesfowkes commented 5 years ago

I am doing development and prototyping using fbtft (using an ILI9341 based screen, though I don't think that particularly matters to the question).

Because of some issues with our test setup, it would be really useful to be able to re-initialise the attached screen if it gets power cycled. Currently doesn't work being power cycled as it won't be re-initialised by fbtft, which (understandably) assumes everything is fine.

Is there a way to do this?

notro commented 5 years ago

You can either unload and reload the driver module, or you can unbind and (re)bind the driver to the device:

$ ls -l /sys/bus/spi/drivers/<driver>/*bind
--w------- 1 root root 4096 Aug 26 15:06 /sys/bus/spi/drivers/<driver>/bind
--w------- 1 root root 4096 Aug 26 15:06 /sys/bus/spi/drivers/<driver>/unbind

If you can use any of the ili9341 drm drivers, they will reinitialize if needed when the display pipeline is enabled: https://elixir.bootlin.com/linux/v5.2/source/drivers/gpu/drm/tinydrm/ili9341.c https://elixir.bootlin.com/linux/v5.2/source/drivers/gpu/drm/tinydrm/mi0283qt.c

jamesfowkes commented 5 years ago

OK, so just to check, the commands for bind and unbind would be (for my screen on SPI0.0):

echo "spi0.0" | /sys/bus/spi/drivers/fb_ili9341/bind
echo "spi0.0" | /sys/bus/spi/drivers/fb_ili9341/unbind

Is that correct?

notro commented 5 years ago

Yeah, I think so.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.