mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
b362de167d
commit
052039e3fe
|
|
@ -8201,6 +8201,7 @@ S: Maintained
|
|||
F: Documentation/devicetree/bindings/display/sitronix,st7567.yaml
|
||||
F: Documentation/devicetree/bindings/display/sitronix,st7571.yaml
|
||||
F: drivers/gpu/drm/sitronix/st7571-i2c.c
|
||||
F: drivers/gpu/drm/sitronix/st7571-spi.c
|
||||
F: drivers/gpu/drm/sitronix/st7571.c
|
||||
F: drivers/gpu/drm/sitronix/st7571.h
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,18 @@ config DRM_ST7571_I2C
|
|||
|
||||
if M is selected the module will be called st7571-i2c.
|
||||
|
||||
config DRM_ST7571_SPI
|
||||
tristate "DRM support for Sitronix ST7567/ST7571 display panels (SPI)"
|
||||
depends on DRM_ST7571 && SPI
|
||||
select REGMAP_SPI
|
||||
help
|
||||
Sitronix ST7571 is a driver and controller for 4-level gray
|
||||
scale and monochrome dot matrix LCD panels.
|
||||
|
||||
DRM driver for Sitronix ST7565/ST7571 panels connected via SPI bus.
|
||||
|
||||
if M is selected the module will be called st7571-spi.
|
||||
|
||||
config DRM_ST7586
|
||||
tristate "DRM support for Sitronix ST7586 display panels"
|
||||
depends on DRM && SPI
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
obj-$(CONFIG_DRM_ST7571) += st7571.o
|
||||
obj-$(CONFIG_DRM_ST7571_I2C) += st7571-i2c.o
|
||||
obj-$(CONFIG_DRM_ST7571_SPI) += st7571-spi.o
|
||||
obj-$(CONFIG_DRM_ST7586) += st7586.o
|
||||
obj-$(CONFIG_DRM_ST7735R) += st7735r.o
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Driver for Sitronix ST7571 connected via SPI bus.
|
||||
*
|
||||
* Copyright (C) 2025 Marcus Folkesson <marcus.folkesson@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include "st7571.h"
|
||||
|
||||
static const struct regmap_config st7571_spi_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.can_multi_write = true,
|
||||
};
|
||||
|
||||
static int st7571_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
struct st7571_device *st7571;
|
||||
struct regmap *regmap;
|
||||
|
||||
regmap = devm_regmap_init_spi(spi, &st7571_spi_regmap_config);
|
||||
if (IS_ERR(regmap)) {
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(regmap),
|
||||
"Failed to initialize regmap\n");
|
||||
}
|
||||
|
||||
st7571 = st7571_probe(&spi->dev, regmap);
|
||||
if (IS_ERR(st7571))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st7571),
|
||||
"Failed to initialize regmap\n");
|
||||
|
||||
spi_set_drvdata(spi, st7571);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void st7571_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
struct st7571_device *st7571 = spi_get_drvdata(spi);
|
||||
|
||||
st7571_remove(st7571);
|
||||
}
|
||||
|
||||
static const struct of_device_id st7571_of_match[] = {
|
||||
{ .compatible = "sitronix,st7567", .data = &st7567_config },
|
||||
{ .compatible = "sitronix,st7571", .data = &st7571_config },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, st7571_of_match);
|
||||
|
||||
static const struct spi_device_id st7571_spi_id[] = {
|
||||
{ "st7567", 0 },
|
||||
{ "st7571", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, st7571_spi_id);
|
||||
|
||||
static struct spi_driver st7571_spi_driver = {
|
||||
.driver = {
|
||||
.name = "st7571-spi",
|
||||
.of_match_table = st7571_of_match,
|
||||
},
|
||||
.probe = st7571_spi_probe,
|
||||
.remove = st7571_spi_remove,
|
||||
.id_table = st7571_spi_id,
|
||||
};
|
||||
|
||||
module_spi_driver(st7571_spi_driver);
|
||||
|
||||
MODULE_AUTHOR("Marcus Folkesson <marcus.folkesson@gmail.com>");
|
||||
MODULE_DESCRIPTION("DRM Driver for Sitronix ST7571 LCD controller (SPI)");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_IMPORT_NS("DRM_ST7571");
|
||||
Loading…
Reference in New Issue