Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/sitronix/st7571-spi: add support for SPI interface

Add support for ST7561/ST7571 connected to SPI bus.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Link: https://patch.msgid.link/20251215-st7571-split-v3-6-d5f3205c3138@gmail.com
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

authored by

Marcus Folkesson and committed by
Javier Martinez Canillas
052039e3 b362de16

+90
+1
MAINTAINERS
··· 8201 8201 F: Documentation/devicetree/bindings/display/sitronix,st7567.yaml 8202 8202 F: Documentation/devicetree/bindings/display/sitronix,st7571.yaml 8203 8203 F: drivers/gpu/drm/sitronix/st7571-i2c.c 8204 + F: drivers/gpu/drm/sitronix/st7571-spi.c 8204 8205 F: drivers/gpu/drm/sitronix/st7571.c 8205 8206 F: drivers/gpu/drm/sitronix/st7571.h 8206 8207
+12
drivers/gpu/drm/sitronix/Kconfig
··· 27 27 28 28 if M is selected the module will be called st7571-i2c. 29 29 30 + config DRM_ST7571_SPI 31 + tristate "DRM support for Sitronix ST7567/ST7571 display panels (SPI)" 32 + depends on DRM_ST7571 && SPI 33 + select REGMAP_SPI 34 + help 35 + Sitronix ST7571 is a driver and controller for 4-level gray 36 + scale and monochrome dot matrix LCD panels. 37 + 38 + DRM driver for Sitronix ST7565/ST7571 panels connected via SPI bus. 39 + 40 + if M is selected the module will be called st7571-spi. 41 + 30 42 config DRM_ST7586 31 43 tristate "DRM support for Sitronix ST7586 display panels" 32 44 depends on DRM && SPI
+1
drivers/gpu/drm/sitronix/Makefile
··· 1 1 obj-$(CONFIG_DRM_ST7571) += st7571.o 2 2 obj-$(CONFIG_DRM_ST7571_I2C) += st7571-i2c.o 3 + obj-$(CONFIG_DRM_ST7571_SPI) += st7571-spi.o 3 4 obj-$(CONFIG_DRM_ST7586) += st7586.o 4 5 obj-$(CONFIG_DRM_ST7735R) += st7735r.o
+76
drivers/gpu/drm/sitronix/st7571-spi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Driver for Sitronix ST7571 connected via SPI bus. 4 + * 5 + * Copyright (C) 2025 Marcus Folkesson <marcus.folkesson@gmail.com> 6 + */ 7 + 8 + #include <linux/spi/spi.h> 9 + #include <linux/module.h> 10 + #include <linux/regmap.h> 11 + 12 + #include "st7571.h" 13 + 14 + static const struct regmap_config st7571_spi_regmap_config = { 15 + .reg_bits = 8, 16 + .val_bits = 8, 17 + .can_multi_write = true, 18 + }; 19 + 20 + static int st7571_spi_probe(struct spi_device *spi) 21 + { 22 + struct st7571_device *st7571; 23 + struct regmap *regmap; 24 + 25 + regmap = devm_regmap_init_spi(spi, &st7571_spi_regmap_config); 26 + if (IS_ERR(regmap)) { 27 + return dev_err_probe(&spi->dev, PTR_ERR(regmap), 28 + "Failed to initialize regmap\n"); 29 + } 30 + 31 + st7571 = st7571_probe(&spi->dev, regmap); 32 + if (IS_ERR(st7571)) 33 + return dev_err_probe(&spi->dev, PTR_ERR(st7571), 34 + "Failed to initialize regmap\n"); 35 + 36 + spi_set_drvdata(spi, st7571); 37 + return 0; 38 + } 39 + 40 + static void st7571_spi_remove(struct spi_device *spi) 41 + { 42 + struct st7571_device *st7571 = spi_get_drvdata(spi); 43 + 44 + st7571_remove(st7571); 45 + } 46 + 47 + static const struct of_device_id st7571_of_match[] = { 48 + { .compatible = "sitronix,st7567", .data = &st7567_config }, 49 + { .compatible = "sitronix,st7571", .data = &st7571_config }, 50 + {}, 51 + }; 52 + MODULE_DEVICE_TABLE(of, st7571_of_match); 53 + 54 + static const struct spi_device_id st7571_spi_id[] = { 55 + { "st7567", 0 }, 56 + { "st7571", 0 }, 57 + { } 58 + }; 59 + MODULE_DEVICE_TABLE(spi, st7571_spi_id); 60 + 61 + static struct spi_driver st7571_spi_driver = { 62 + .driver = { 63 + .name = "st7571-spi", 64 + .of_match_table = st7571_of_match, 65 + }, 66 + .probe = st7571_spi_probe, 67 + .remove = st7571_spi_remove, 68 + .id_table = st7571_spi_id, 69 + }; 70 + 71 + module_spi_driver(st7571_spi_driver); 72 + 73 + MODULE_AUTHOR("Marcus Folkesson <marcus.folkesson@gmail.com>"); 74 + MODULE_DESCRIPTION("DRM Driver for Sitronix ST7571 LCD controller (SPI)"); 75 + MODULE_LICENSE("GPL"); 76 + MODULE_IMPORT_NS("DRM_ST7571");