Migrate RAiO RA8875 from fbtft to DRM
Subsystems (4)
cover Migrate RAiO RA8875 from fbtft to DRM
This is a resend — the original submission on Monday did not go through as I was not yet subscribed to the list.
This RFC migrates the old fbtft fb_ra8875 (drivers/staging/fbtft/) to a proper DRM/KMS driver. The RA8875 has a 2D Block Transfer Engine (BTE), a touch controller, and PWM backlight control. This driver currently implements only basic display pipe, with BTE and other subsystems as planned follow-up work.
This driver does not use drm_mipi_dbi. The RA8875 SPI protocol is structurally incompatible with both Type C options drm_mipi_dbi supports. Type C1 encodes command/data as a 9th bit within a 9-bit SPI word. The RA8875 uses a full prefix byte (0x80 = command write, 0x00 = data write, 0x40 = data read, 0xC0 = status read) sent as a separate 8-bit transaction. These are not the same thing and cannot be mapped to each other.
Type C3 models two transfer types via a D/CX GPIO. The RA8875 has four transfer cycle types and no D/CX pin. More critically, the GRAM write path is stateful: an MRWC register-address transaction followed by a streaming pixel pump under a single CS assertion. There is no way to express this through the dbi->command() dispatch model without either abusing the abstraction or reimplementing the transfer layer underneath it anyway.
Other than that, forcing DBI would actively obstruct the BTE implementation, which requires direct control of the SPI bus at the transaction level. A direct SPI implementation keeps this path clean. Any feedback on these would be valuable.
Tested on Raspberry Pi 3B, 5" 800x480 display, kernel 7.0.0-rc3.
Currently placed in drm/tiny for review purposes. The intention is to move to drivers/gpu/drm/ra8875/ in v2 to accommodate future BTE plane support and the touch input subsystem on the same SPI device node.
Known limitation: at 25MHz SPI, full-screen throughput for 800x480 RGB565 is physically capped at ~4-5fps. The driver mitigates this with damage tracking so only dirty regions are transferred. Full-screen animation and video are not achievable over SPI at this resolution and are not intended use cases for this hardware.
Some questions:
1. Register writes are currently capped at 1MHz. The datasheet allows higher but some boards have signal integrity issues. Should this be a DT property or is 1MHz a reasonable default?
2. PLL initialization hardcodes a 20MHz crystal assumption (PLLC1=0x0B, PLLC2=0x02). Should this be derived from a clock subsystem node or a DT property?
3. Currently using display-timings in the DT binding with of_get_videomode(OF_USE_NATIVE_MODE) in the driver. Should this use panel-timings instead, or is display-timings the correct choice for a controller-level binding like this?
4. Given planned BTE support as a DRM plane, is drm_simple_display_pipe the right foundation or should this be a full drm_driver from the start? Happy to restructure in v2 if consensus is to go full split now.
Future work: PWM backlight via DRM backlight interface, BTE as a DRM plane or through drm_rect operations, touchscreen via input subsystem.
Adam Azuddin (2):
dt-bindings: display: panel: Add RAiO RA8875 display controller drm/tiny: Add RAiO RA8875 display controller driver
.../bindings/display/panel/raio,ra8875.yaml | 76 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 14 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/ra8875.c | 681 ++++++++++++++++++ 6 files changed, 780 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raio,ra8875.yaml create mode 100644 drivers/gpu/drm/tiny/ra8875.c
Signature · 1 line
2.54.0
RFC PATCH 1/2 dt-bindings: display: panel: Add RAiO RA8875 display controller
The RA8875 is an SPI-connected TFT display controller by RAiO Technology Inc. It supports display resolutions of up to 800x480.
Add YAML binding schema for the RA8875 controller, along with the raio vendor prefix for RAiO Technology Inc.
--- .../bindings/display/panel/raio,ra8875.yaml | 76 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + 2 files changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raio,ra8875.yaml
Documentation/devicetree/bindings/display/panel/raio,ra8875.yaml new file +76 -0
@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/raio,ra8875.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RAiO RA8875 Display Controller + +maintainers: + - Adam Azuddin <[email protected]> + +description: | + This binding is for display panels using an RAiO RA8875 controller + connected via SPI. + +allOf: + - $ref: panel-common.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + const: raio,ra8875 + + reg: + maxItems: 1 + + spi-max-frequency: + maximum: 25000000 + + reset-gpios: + maxItems: 1 + description: GPIO used to reset the controller, optional + + vcc-supply: + description: Regulator that provides the VCC voltage, optional + + display-timings: + $ref: /schemas/display/panel/display-timings.yaml# + +required: + - compatible + - reg + - display-timings + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + ra8875: ra8875@0 { + compatible = "raio,ra8875"; + reg = <0>; + spi-max-frequency = <16000000>; + reset-gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + + display-timings { + native-mode = <&timing0>; + timing0: timing0 { + clock-frequency = <25000000>; + hactive = <800>; + vactive = <480>; + hfront-porch = <40>; + hsync-len = <40>; + hback-porch = <40>; + vfront-porch = <10>; + vsync-len = <10>; + vback-porch = <20>; + }; + }; + }; + };
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1361,6 +1361,8 @@ patternProperties: description: Radxa "^raidsonic,.*": description: RaidSonic Technology GmbH + "^raio,.*": + description: RAiO Technology Inc. "^ralink,.*": description: Mediatek/Ralink Technology Corp. "^ramtron,.*":
Signature · 1 line
2.54.0
RFC PATCH 2/2 drm/tiny: Add RAiO RA8875 display controller driver
In reply to Adam AzuddinAdd a DRM tiny driver for the RAiO RA8875 SPI-connected TFT display controller. The driver supports display resolutions up to 800x480 and uses the GEM shmem helper for buffer management.
--- MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 14 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/ra8875.c | 681 ++++++++++++++++++++++++++++++++++ 4 files changed, 702 insertions(+) create mode 100644 drivers/gpu/drm/tiny/ra8875.c
MAINTAINERS +6 -0
@@ -8268,6 +8268,12 @@ S: Maintained F: Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml F: drivers/gpu/drm/panel/panel-raydium-rm67191.c +DRM DRIVER FOR RAIO RA8875 PANELS +M: Adam Azuddin <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/display/panel/raio,ra8875.yaml +F: drivers/gpu/drm/tiny/ra8875.c + DRM DRIVER FOR SAMSUNG DB7430 PANELS M: Linus Walleij <[email protected]> S: Maintained
drivers/gpu/drm/tiny/Kconfig +14 -0
@@ -195,6 +195,20 @@ config TINYDRM_REPAPER If M is selected the module will be called repaper. +config TINYDRM_RA8875 + tristate "DRM support for RA8875 display panels" + depends on DRM && SPI + select DRM_CLIENT_SELECTION + select DRM_KMS_HELPER + select DRM_GEM_SHMEM_HELPER + select BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + help + DRM driver for the following RAiO RA8875 based LCD panels: + * East Rising 5.00" TFT LCD (ER-TFTM070-5V4) + + If M is selected the module will be called ra8875. + config TINYDRM_SHARP_MEMORY tristate "DRM support for Sharp Memory LCD panels" depends on DRM && SPI
drivers/gpu/drm/tiny/Makefile +1 -0
@@ -14,4 +14,5 @@ obj-$(CONFIG_TINYDRM_ILI9341) += ili9341.o obj-$(CONFIG_TINYDRM_ILI9486) += ili9486.o obj-$(CONFIG_TINYDRM_MI0283QT) += mi0283qt.o obj-$(CONFIG_TINYDRM_REPAPER) += repaper.o +obj-$(CONFIG_TINYDRM_RA8875) += ra8875.o obj-$(CONFIG_TINYDRM_SHARP_MEMORY) += sharp-memory.o
drivers/gpu/drm/tiny/ra8875.c new file +681 -0
681 lines not on this page · raw message
Signature · 1 line
2.54.0
Hi everyone,
Just a quick ping to see if anyone has had a chance to review this RFC. Any feedback or guidance on the driver would be greatly appreciated.
Thanks,
Adam