fbtft - notro/tinydrm GitHub Wiki

tinydrm was written to provide a foundation for converting the fbtft drivers to drm.

In my first fbtft commit I had drivers for displays: adafruit22fb and sainsmart18fb. Later I made the mistake of writing drivers for the display controllers instead (fb_hx8340bn and fb_st7735r). It was a mistake because I didn't understand that the initialization sequence was panel specific, so later I had to add a platform data variable to hold this sequence. Another problem was the rotation code in the controller drivers was also panel specific, no solution to this was added. The flexfb driver could be used if the driver messed up this register, because flexfb didn't have rotation support (flexfb was an experiment to see if all drivers could me merged into one).

Another thing that I learned much later on, was that many of the fbtft supported controllers were MIPI DCS compatible, sharing the same base command set. If the driver uses the default set_addr_win() or one like it, it's compatible.

MIPI DCS compatible fbtft drivers:

  • fb_ili9341
  • fb_st7735r
  • fb_s6d02a1
  • fb_s6d02a1
  • fb_ili9481
  • fb_hx8357d
  • fb_hx8340bn
  • fb_ili9340
  • fb_tinylcd (one of very few display drivers, seller wouldn't tell which controller they used)
  • fb_ili9486
  • fb_ili9163

So the situation is: The fbtft drivers are display controller drivers written for a specific panel.

All fbtft drivers support parallel I80 bus and SPI, even if the actual controller doesn't support I80. Parallel gpio bus is really slow compared to DMA SPI.

If the led gpio is set, a backlight device is created. No support for the 'backlight' DT property.

Later when Device Tree support was added, all platform variables were converted to Device Tree properties.

Device Tree properties supported by the fbtft module in fbtft_probe_dt():

  • width
  • height
  • regwidth (8 or 16)
  • buswidth (8, 9 or 16)
  • backlight
  • bpp
  • debug
  • rotate
  • bgr
  • fps
  • txbuflen
  • startbyte (enables ILI9325 SPI mode type bus functions)
  • gamma (values as string)
  • init
  • reset-gpios
  • dc-gpios
  • cs-gpios
  • wr-gpios
  • rd-gpios (not used)
  • latch-gpios (not used)
  • db-gpios
  • led-gpios

The 'init' property contains a coded sequence of init values and delays. It's an array of u32 values.

  • Values OR'ed with 0x1000000 are commands or register numbers and the following values are written as data.
  • Values OR'ed with 0x2000000 are delays in milliseconds.

See fbtft_init_display_dt().

The problem with the 'init' property is that DT maintainers won't have it, at least on new drivers (I've lost the reference to a discussion about this).

Here's an old writeup about fbtft internals: How-it-works