Skip to contentSkip to conversation

drm/sitronix/st7920: Add support for the ST7920 controller

PATCH Applied Iker Pedrosa 2 participants 5 messages Dec 15, 2025

Subsystems (4)
lore
Share & tools
lore

Iker Pedrosa

author maintainer
#0 lore raw

v7 cover drm/sitronix/st7920: Add support for the ST7920 controller

This patch-series adds support for the Sitronix ST7920 controller, which is a monochrome dot-matrix graphical LCD controller that has SPI and parallel interfaces.

The st7920 driver only has support for SPI so displays using other transport protocols are currently not supported.

* Patch #1 adds the driver.
* Patch #2 adds the DT binding schema.
* Patch #3 adds the MAINTAINERS information.

---
Changes in v7:
- Fix Makefile typo and checkpatch --strict warnings.
- Update header paths and add missing includes.
- Remove unused DRIVER_DATE.
- Link to v6: https://lore.kernel.org/r/[email protected]

Changes in v6:
- Initialize spi7920_error structure.
- Call drm_dev_exit() when appropriate.
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- Remove unused device variant structures and hard-code display resolution.
- Fix GPIO reset logic to correctly handle logical levels.
- Use kzalloc() instead of kmemdup() for atomic state duplication.
- Refactor atomic update to integrate cpu access with the damage loop.
- Rename macros to avoid the reserved DRM_ prefix.
- Use DRM logging helpers instead of generic device logging.
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Added definitions for the VDD power supply and the XRESET GPIO line, which were identified as minimum requirements from the datasheet.
- The error handling strategy has been refactored to propagate an error-tracking struct from the caller.
- The atomic enable/disable logic has been correctly moved from drm_encoder_helper_funcs to drm_crtc_helper_funcs, as the functionality is bound to the CRTC.
- Added drm_dev_enter() and drm_dev_exit() calls to the atomic_enable and atomic_disable helpers to correctly manage the device's runtime power state.
- Renamed macro definitions to match the correct terminology.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Reorganize the patch documenting compatible (DT bindings) before their use.
- Drop reduntant information from DT bindings.
- Use a goto label to ensure drm_dev_exit() is called in the error path of drm_gem_fb_begin_cpu_access().
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Refactor SPI communication:
* Internalize error handling and delays within the st7920_spi_write() helper.
* Split the main SPI write function into smaller, command-specific helpers for clarity.
- Improve DRM/KMS logic:
* Relocate CPU access calls (drm_gem_fb...) to the atomic_update hook.
* Use standard DRM helpers (drm_crtc_helper_mode_valid_fixed and drm_connector_helper_get_modes_fixed) for mode validation and creation.
- General code cleanup:
* Remove dead code related to ST7920_FAMILY.
* Replace WARN_ON() with drm_WARN_ON_ONCE().
* Ensure single variable assignments per line.
- Fix probe initialization order:
* Move spi_set_drvdata() and st7920_init() to occur before device registration.
- Devicetree:
* Update bindings to address feedback from review (e.g., reference common SPI properties).
- MAINTAINERS:
* Add a proper commit message to the patch.
- Link to v1: https://lore.kernel.org/r/[email protected]
---

---
Iker Pedrosa (3):
dt-bindings: display: sitronix,st7920: Add DT schema
drm: Add driver for Sitronix ST7920 LCD displays
MAINTAINERS: Add entry for Sitronix ST7920 driver

 .../bindings/display/sitronix,st7920.yaml          |  58 ++
 MAINTAINERS                                        |   7 +
 drivers/gpu/drm/sitronix/Kconfig                   |  10 +
 drivers/gpu/drm/sitronix/Makefile                  |   1 +
 drivers/gpu/drm/sitronix/st7920.c                  | 867 +++++++++++++++++++++
 5 files changed, 943 insertions(+)

---
base-commit: c571cb70e1ed43ee543c70151e61a001ab2eefa2
change-id: 20250806-st7920-e7aba32b3ab6

Best regards,

Signature · 1 line
Iker Pedrosa <[email protected]>
author maintainer
#1 lore raw

PATCH v7 1/3 dt-bindings: display: sitronix,st7920: Add DT schema

Add binding for Sitronix ST7920 display.

---
 .../bindings/display/sitronix,st7920.yaml          | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
Documentation/devicetree/bindings/display/sitronix,st7920.yaml new file +58 -0
new file mode 100644
index 0000000000000000000000000000000000000000..c4f006fc41e1f472939725bd82b86a649f9b3f56
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sitronix,st7920.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sitronix ST7920 LCD Display Controllers
+
+maintainers:
+  - Iker Pedrosa <[email protected]>
+
+description:
+  The Sitronix ST7920 is a controller for monochrome dot-matrix graphical LCDs,
+  most commonly used for 128x64 pixel displays.
+
+properties:
+  compatible:
+    const: sitronix,st7920
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: Regulator that provides 5V Vdd power supply
+
+  reset-gpios:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 600000
+
+required:
+  - compatible
+  - reg
+  - spi-max-frequency
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        display@0 {
+            compatible = "sitronix,st7920";
+            reg = <0>;
+            vdd-supply = <&reg_5v>;
+            reset-gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
+            spi-max-frequency = <600000>;
+            spi-cs-high;
+        };
+    };
Signature · 1 line
2.52.0
author maintainer
#2 lore raw

PATCH v7 2/3 drm: Add driver for Sitronix ST7920 LCD displays

In reply to Iker Pedrosa

Add a new DRM/KMS driver for displays using the Sitronix ST7920 controller connected via the SPI bus. This provides a standard framebuffer interface for these common monochrome LCDs.

---
 drivers/gpu/drm/sitronix/Kconfig  |  10 +
 drivers/gpu/drm/sitronix/Makefile |   1 +
 drivers/gpu/drm/sitronix/st7920.c | 867 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 878 insertions(+)
drivers/gpu/drm/sitronix/Kconfig +10 -0
index 6de7d92d9b74c72746915b945869dba91f161d2b..f14115350069849b668d75188f6d504d56fa3dda 100644
@@ -40,3 +40,13 @@ config DRM_ST7735R
 
 	  If M is selected the module will be called st7735r.
 
+config DRM_ST7920
+	tristate "DRM support for Sitronix ST7920 LCD displays"
+	depends on DRM && SPI && MMU
+	select DRM_GEM_SHMEM_HELPER
+	select DRM_KMS_HELPER
+	select REGMAP_SPI
+	help
+	  DRM driver for the ST7920 Sitronix LCD controllers.
+
+	  If M is selected the module will be called st7920.
drivers/gpu/drm/sitronix/Makefile +1 -0
index bd139e5a6995fa026cc635b3c29782473d1efad7..495fc4a2989da5cb2280023a52ed7d3ed1c1e3c9 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_DRM_ST7571_I2C)		+= st7571-i2c.o
 obj-$(CONFIG_DRM_ST7586)		+= st7586.o
 obj-$(CONFIG_DRM_ST7735R)		+= st7735r.o
+obj-$(CONFIG_DRM_ST7920)		+= st7920.o
drivers/gpu/drm/sitronix/st7920.c new file +867 -0

867 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#3 lore raw

PATCH v7 3/3 MAINTAINERS: Add entry for Sitronix ST7920 driver

In reply to Iker Pedrosa

Add Iker as ST7920 driver maintainer.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 5ddf37f0acc960039422ef988cadfa7176972fc5..79b8a277e38b55ebcff05450d6c565c0d87c6b51 100644
@@ -7861,6 +7861,13 @@ T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
 F:	Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
 F:	drivers/gpu/drm/sitronix/st7735r.c
 
+DRM DRIVER FOR SITRONIX ST7920 LCD DISPLAYS
+M:	Iker Pedrosa <[email protected]>
+S:	Maintained
+T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
+F:	Documentation/devicetree/bindings/display/sitronix,st7920.yaml
+F:	drivers/gpu/drm/sitronix/st7920.c
+
 DRM DRIVER FOR SOLOMON SSD130X OLED DISPLAYS
 M:	Javier Martinez Canillas <[email protected]>
 S:	Maintained
Signature · 1 line
2.52.0
#4 lore raw
In reply to Iker Pedrosa

Iker Pedrosa <[email protected]> writes:

Hello Iker,

Quoted 11 lines

This patch-series adds support for the Sitronix ST7920 controller, which is a monochrome dot-matrix graphical LCD controller that has SPI and parallel interfaces.

The st7920 driver only has support for SPI so displays using other transport protocols are currently not supported.

* Patch #1 adds the driver.
* Patch #2 adds the DT binding schema.
* Patch #3 adds the MAINTAINERS information.

Quoted 7 lines

---
Changes in v7:
- Fix Makefile typo and checkpatch --strict warnings.
- Update header paths and add missing includes.
- Remove unused DRIVER_DATE.
- Link to v6: https://lore.kernel.org/r/[email protected]

Pushed to drm-misc (drm-misc-next). Thanks!

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat