* [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
@ 2025-07-14 10:43 Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names Javier Martinez Canillas
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 10:43 UTC (permalink / raw)
To: linux-kernel
Cc: ipedrosa, Javier Martinez Canillas, Conor Dooley, David Airlie,
Krzysztof Kozlowski, Maarten Lankhorst, Marcus Folkesson,
Maxime Ripard, Rob Herring, Simona Vetter, Thomas Zimmermann,
devicetree, dri-devel
This patch-series adds support for the Sitronix ST7567 Controller, which is a
monochrome Dot Matrix LCD Controller that has SPI, I2C and parallel interfaces.
The st7571-i2c driver only has support for I2C so displays using other transport
interfaces are currently not supported.
The DRM_FORMAT_R1 pixel format and data commands are the same than what is used
by the ST7571 controller, so only is needed a different callback that implements
the expected initialization sequence for the ST7567 chip and a different callback
to parse the sub-set of DT properties needed by the ST7567.
Patches #1 and #2 are some trivial cleanups for the driver.
Patch #3 is a preparatory change that adds the level of indirection for the DT
parsing logic.
Patch #4 adds a Device Tree binding schema for the ST7567 Controller.
Patch #5 finally extends the st7571-i2c driver to also support the ST7567 device.
Changes in v2:
- Use a different parse DT function (Thomas Zimmermann).
Javier Martinez Canillas (5):
drm/sitronix/st7571-i2c: Fix encoder callbacks function names
drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure
drm/sitronix/st7571-i2c: Add an indirection level to parse DT
dt-bindings: display: Add Sitronix ST7567 LCD Controller
drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
.../bindings/display/sitronix,st7567.yaml | 63 +++++++++++++
MAINTAINERS | 1 +
drivers/gpu/drm/sitronix/st7571-i2c.c | 94 +++++++++++++++++--
3 files changed, 150 insertions(+), 8 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7567.yaml
--
2.49.0
base-commit: 8f80b1d66f927e818e5205fccf572b2adc5e318b
branch: drm-st7567-v2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names
2025-07-14 10:43 [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
@ 2025-07-14 10:44 ` Javier Martinez Canillas
2025-07-14 12:06 ` Marcus Folkesson
2025-07-14 10:44 ` [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure Javier Martinez Canillas
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 10:44 UTC (permalink / raw)
To: linux-kernel
Cc: ipedrosa, Javier Martinez Canillas, David Airlie,
Maarten Lankhorst, Marcus Folkesson, Maxime Ripard, Simona Vetter,
Thomas Zimmermann, dri-devel
It seems the driver took some inspiration from ssd130x and some of the
functions (encoder callbacks) were not renamed to use a st7571_ prefix.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
(no changes since v1)
drivers/gpu/drm/sitronix/st7571-i2c.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
index eec846892962..634b426e2874 100644
--- a/drivers/gpu/drm/sitronix/st7571-i2c.c
+++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
@@ -550,8 +550,8 @@ static const struct drm_crtc_funcs st7571_crtc_funcs = {
* Encoder
*/
-static void ssd130x_encoder_atomic_enable(struct drm_encoder *encoder,
- struct drm_atomic_state *state)
+static void st7571_encoder_atomic_enable(struct drm_encoder *encoder,
+ struct drm_atomic_state *state)
{
struct drm_device *drm = encoder->dev;
struct st7571_device *st7571 = drm_to_st7571(drm);
@@ -565,8 +565,8 @@ static void ssd130x_encoder_atomic_enable(struct drm_encoder *encoder,
st7571_send_command_list(st7571, &command, 1);
}
-static void ssd130x_encoder_atomic_disable(struct drm_encoder *encoder,
- struct drm_atomic_state *state)
+static void st7571_encoder_atomic_disable(struct drm_encoder *encoder,
+ struct drm_atomic_state *state)
{
struct drm_device *drm = encoder->dev;
struct st7571_device *st7571 = drm_to_st7571(drm);
@@ -581,8 +581,8 @@ static const struct drm_encoder_funcs st7571_encoder_funcs = {
};
static const struct drm_encoder_helper_funcs st7571_encoder_helper_funcs = {
- .atomic_enable = ssd130x_encoder_atomic_enable,
- .atomic_disable = ssd130x_encoder_atomic_disable,
+ .atomic_enable = st7571_encoder_atomic_enable,
+ .atomic_disable = st7571_encoder_atomic_disable,
};
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure
2025-07-14 10:43 [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names Javier Martinez Canillas
@ 2025-07-14 10:44 ` Javier Martinez Canillas
2025-07-14 12:04 ` Marcus Folkesson
2025-07-14 10:44 ` [PATCH v2 3/5] drm/sitronix/st7571-i2c: Add an indirection level to parse DT Javier Martinez Canillas
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 10:44 UTC (permalink / raw)
To: linux-kernel
Cc: ipedrosa, Javier Martinez Canillas, David Airlie,
Maarten Lankhorst, Marcus Folkesson, Maxime Ripard, Simona Vetter,
Thomas Zimmermann, dri-devel
The driver already uses the dev_err_probe() helper (that only prints error
messages for the -EPROBE_DEFER case) when fails to get any other resource.
Also do the same when it fails to obtain the rest GPIO.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
(no changes since v1)
drivers/gpu/drm/sitronix/st7571-i2c.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
index 634b426e2874..fd9d6c701cc4 100644
--- a/drivers/gpu/drm/sitronix/st7571-i2c.c
+++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
@@ -804,7 +804,9 @@ static int st7571_parse_dt(struct st7571_device *st7571)
st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(st7571->reset))
- return PTR_ERR(st7571->reset);
+ return dev_err_probe(dev, PTR_ERR(st7571->reset),
+ "Failed to get reset gpio\n");
+
return 0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 3/5] drm/sitronix/st7571-i2c: Add an indirection level to parse DT
2025-07-14 10:43 [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure Javier Martinez Canillas
@ 2025-07-14 10:44 ` Javier Martinez Canillas
2025-07-14 12:08 ` Marcus Folkesson
2025-07-14 10:44 ` [PATCH v2 4/5] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
4 siblings, 1 reply; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 10:44 UTC (permalink / raw)
To: linux-kernel
Cc: ipedrosa, Javier Martinez Canillas, Thomas Zimmermann,
David Airlie, Maarten Lankhorst, Marcus Folkesson, Maxime Ripard,
Simona Vetter, dri-devel
Other Sitronix display controllers might need a different parsing DT
logic, so lets add a .parse_dt callback to struct st7571_panel_data.
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
(no changes since v1)
drivers/gpu/drm/sitronix/st7571-i2c.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
index fd9d6c701cc4..f9c4fedb3cca 100644
--- a/drivers/gpu/drm/sitronix/st7571-i2c.c
+++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
@@ -92,6 +92,7 @@ struct st7571_panel_constraints {
struct st7571_panel_data {
int (*init)(struct st7571_device *st7571);
+ int (*parse_dt)(struct st7571_device *st7571);
struct st7571_panel_constraints constraints;
};
@@ -881,7 +882,7 @@ static int st7571_probe(struct i2c_client *client)
i2c_set_clientdata(client, st7571);
st7571->pdata = device_get_match_data(&client->dev);
- ret = st7571_parse_dt(st7571);
+ ret = st7571->pdata->parse_dt(st7571);
if (ret)
return ret;
@@ -964,6 +965,7 @@ static void st7571_remove(struct i2c_client *client)
struct st7571_panel_data st7571_config = {
.init = st7571_lcd_init,
+ .parse_dt = st7571_parse_dt,
.constraints = {
.min_nlines = 1,
.max_nlines = 128,
--
2.49.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 4/5] dt-bindings: display: Add Sitronix ST7567 LCD Controller
2025-07-14 10:43 [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
` (2 preceding siblings ...)
2025-07-14 10:44 ` [PATCH v2 3/5] drm/sitronix/st7571-i2c: Add an indirection level to parse DT Javier Martinez Canillas
@ 2025-07-14 10:44 ` Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
4 siblings, 0 replies; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 10:44 UTC (permalink / raw)
To: linux-kernel
Cc: ipedrosa, Javier Martinez Canillas, Rob Herring (Arm),
Marcus Folkesson, Conor Dooley, David Airlie, Krzysztof Kozlowski,
Maarten Lankhorst, Maxime Ripard, Simona Vetter,
Thomas Zimmermann, devicetree, dri-devel
Sitronix ST7567 is a monochrome Dot Matrix LCD Controller.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
(no changes since v1)
.../bindings/display/sitronix,st7567.yaml | 63 +++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 64 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7567.yaml
diff --git a/Documentation/devicetree/bindings/display/sitronix,st7567.yaml b/Documentation/devicetree/bindings/display/sitronix,st7567.yaml
new file mode 100644
index 000000000000..e8a5b8ad18fe
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/sitronix,st7567.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sitronix,st7567.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sitronix ST7567 Display Controller
+
+maintainers:
+ - Javier Martinez Canillas <javierm@redhat.com>
+
+description:
+ Sitronix ST7567 is a driver and controller for monochrome
+ dot matrix LCD panels.
+
+allOf:
+ - $ref: panel/panel-common.yaml#
+
+properties:
+ compatible:
+ const: sitronix,st7567
+
+ reg:
+ maxItems: 1
+
+ width-mm: true
+ height-mm: true
+ panel-timing: true
+
+required:
+ - compatible
+ - reg
+ - width-mm
+ - height-mm
+ - panel-timing
+
+additionalProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ display@3f {
+ compatible = "sitronix,st7567";
+ reg = <0x3f>;
+ width-mm = <37>;
+ height-mm = <27>;
+
+ panel-timing {
+ hactive = <128>;
+ vactive = <64>;
+ hback-porch = <0>;
+ vback-porch = <0>;
+ clock-frequency = <0>;
+ hfront-porch = <0>;
+ hsync-len = <0>;
+ vfront-porch = <0>;
+ vsync-len = <0>;
+ };
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index ee2ef9d9db2a..d97e091b1742 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7835,6 +7835,7 @@ F: drivers/gpu/drm/sitronix/st7586.c
DRM DRIVER FOR SITRONIX ST7571 PANELS
M: Marcus Folkesson <marcus.folkesson@gmail.com>
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
--
2.49.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
2025-07-14 10:43 [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
` (3 preceding siblings ...)
2025-07-14 10:44 ` [PATCH v2 4/5] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
@ 2025-07-14 10:44 ` Javier Martinez Canillas
2025-07-14 12:11 ` Thomas Zimmermann
4 siblings, 1 reply; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 10:44 UTC (permalink / raw)
To: linux-kernel
Cc: ipedrosa, Javier Martinez Canillas, Marcus Folkesson,
David Airlie, Maarten Lankhorst, Maxime Ripard, Simona Vetter,
Thomas Zimmermann, dri-devel
The Sitronix ST7567 is a monochrome Dot Matrix LCD Controller that has SPI,
I2C and parallel interfaces. The st7571-i2c driver only has support for I2C
so displays using other transport interfaces are currently not supported.
The DRM_FORMAT_R1 pixel format and data commands are the same than what
is used by the ST7571 controller, so only is needed a different callback
that implements the expected initialization sequence for the ST7567 chip.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
Changes in v2:
- Use a different parse DT function (Thomas Zimmermann).
drivers/gpu/drm/sitronix/st7571-i2c.c | 74 +++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
index f9c4fedb3cca..1b820ff6a9dd 100644
--- a/drivers/gpu/drm/sitronix/st7571-i2c.c
+++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
@@ -68,6 +68,9 @@
#define ST7571_SET_COLOR_MODE(c) (0x10 | FIELD_PREP(GENMASK(0, 0), (c)))
#define ST7571_COMMAND_SET_NORMAL (0x00)
+/* ST7567 commands */
+#define ST7567_SET_LCD_BIAS(m) (0xa2 | FIELD_PREP(GENMASK(0, 0), (m)))
+
#define ST7571_PAGE_HEIGHT 8
#define DRIVER_NAME "st7571"
@@ -774,6 +777,32 @@ static int st7571_validate_parameters(struct st7571_device *st7571)
return 0;
}
+static int st7567_parse_dt(struct st7571_device *st7567)
+{
+ struct device *dev = &st7567->client->dev;
+ struct device_node *np = dev->of_node;
+ struct display_timing dt;
+ int ret;
+
+ ret = of_get_display_timing(np, "panel-timing", &dt);
+ if (ret) {
+ dev_err(dev, "Failed to get display timing from DT\n");
+ return ret;
+ }
+
+ of_property_read_u32(np, "width-mm", &st7567->width_mm);
+ of_property_read_u32(np, "height-mm", &st7567->height_mm);
+
+ st7567->pformat = &st7571_monochrome;
+ st7567->bpp = 1;
+
+ st7567->startline = dt.vfront_porch.typ;
+ st7567->nlines = dt.vactive.typ;
+ st7567->ncols = dt.hactive.typ;
+
+ return 0;
+}
+
static int st7571_parse_dt(struct st7571_device *st7571)
{
struct device *dev = &st7571->client->dev;
@@ -819,6 +848,37 @@ static void st7571_reset(struct st7571_device *st7571)
gpiod_set_value_cansleep(st7571->reset, 0);
}
+static int st7567_lcd_init(struct st7571_device *st7567)
+{
+ /*
+ * Most of the initialization sequence is taken directly from the
+ * referential initial code in the ST7567 datasheet.
+ */
+ u8 commands[] = {
+ ST7571_DISPLAY_OFF,
+
+ ST7567_SET_LCD_BIAS(1),
+
+ ST7571_SET_SEG_SCAN_DIR(0),
+ ST7571_SET_COM_SCAN_DIR(1),
+
+ ST7571_SET_REGULATOR_REG(4),
+ ST7571_SET_CONTRAST_MSB,
+ ST7571_SET_CONTRAST_LSB(0x20),
+
+ ST7571_SET_START_LINE_MSB,
+ ST7571_SET_START_LINE_LSB(st7567->startline),
+
+ ST7571_SET_POWER(0x4), /* Power Control, VC: ON, VR: OFF, VF: OFF */
+ ST7571_SET_POWER(0x6), /* Power Control, VC: ON, VR: ON, VF: OFF */
+ ST7571_SET_POWER(0x7), /* Power Control, VC: ON, VR: ON, VF: ON */
+
+ ST7571_SET_ENTIRE_DISPLAY_ON(0),
+ };
+
+ return st7571_send_command_list(st7567, commands, ARRAY_SIZE(commands));
+}
+
static int st7571_lcd_init(struct st7571_device *st7571)
{
/*
@@ -963,6 +1023,18 @@ static void st7571_remove(struct i2c_client *client)
drm_dev_unplug(&st7571->dev);
}
+struct st7571_panel_data st7567_config = {
+ .init = st7567_lcd_init,
+ .parse_dt = st7567_parse_dt,
+ .constraints = {
+ .min_nlines = 1,
+ .max_nlines = 64,
+ .min_ncols = 128,
+ .max_ncols = 128,
+ .support_grayscale = false,
+ },
+};
+
struct st7571_panel_data st7571_config = {
.init = st7571_lcd_init,
.parse_dt = st7571_parse_dt,
@@ -976,12 +1048,14 @@ struct st7571_panel_data st7571_config = {
};
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 i2c_device_id st7571_id[] = {
+ { "st7567", 0 },
{ "st7571", 0 },
{ }
};
--
2.49.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure
2025-07-14 10:44 ` [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure Javier Martinez Canillas
@ 2025-07-14 12:04 ` Marcus Folkesson
2025-07-14 15:54 ` Javier Martinez Canillas
0 siblings, 1 reply; 12+ messages in thread
From: Marcus Folkesson @ 2025-07-14 12:04 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, ipedrosa, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann, dri-devel
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
On Mon, Jul 14, 2025 at 12:44:01PM +0200, Javier Martinez Canillas wrote:
> The driver already uses the dev_err_probe() helper (that only prints error
> messages for the -EPROBE_DEFER case) when fails to get any other resource.
>
> Also do the same when it fails to obtain the rest GPIO.
reset GPIO
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names
2025-07-14 10:44 ` [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names Javier Martinez Canillas
@ 2025-07-14 12:06 ` Marcus Folkesson
2025-07-14 15:54 ` Javier Martinez Canillas
0 siblings, 1 reply; 12+ messages in thread
From: Marcus Folkesson @ 2025-07-14 12:06 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, ipedrosa, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann, dri-devel
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
On Mon, Jul 14, 2025 at 12:44:00PM +0200, Javier Martinez Canillas wrote:
> It seems the driver took some inspiration from ssd130x and some of the
> functions (encoder callbacks) were not renamed to use a st7571_ prefix.
Outch, shame on me.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/5] drm/sitronix/st7571-i2c: Add an indirection level to parse DT
2025-07-14 10:44 ` [PATCH v2 3/5] drm/sitronix/st7571-i2c: Add an indirection level to parse DT Javier Martinez Canillas
@ 2025-07-14 12:08 ` Marcus Folkesson
0 siblings, 0 replies; 12+ messages in thread
From: Marcus Folkesson @ 2025-07-14 12:08 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, ipedrosa, Thomas Zimmermann, David Airlie,
Maarten Lankhorst, Maxime Ripard, Simona Vetter, dri-devel
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
On Mon, Jul 14, 2025 at 12:44:02PM +0200, Javier Martinez Canillas wrote:
> Other Sitronix display controllers might need a different parsing DT
> logic, so lets add a .parse_dt callback to struct st7571_panel_data.
>
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
2025-07-14 10:44 ` [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
@ 2025-07-14 12:11 ` Thomas Zimmermann
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2025-07-14 12:11 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: ipedrosa, Marcus Folkesson, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, dri-devel
Am 14.07.25 um 12:44 schrieb Javier Martinez Canillas:
> The Sitronix ST7567 is a monochrome Dot Matrix LCD Controller that has SPI,
> I2C and parallel interfaces. The st7571-i2c driver only has support for I2C
> so displays using other transport interfaces are currently not supported.
>
> The DRM_FORMAT_R1 pixel format and data commands are the same than what
> is used by the ST7571 controller, so only is needed a different callback
> that implements the expected initialization sequence for the ST7567 chip.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>
> Changes in v2:
> - Use a different parse DT function (Thomas Zimmermann).
>
> drivers/gpu/drm/sitronix/st7571-i2c.c | 74 +++++++++++++++++++++++++++
> 1 file changed, 74 insertions(+)
>
> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
> index f9c4fedb3cca..1b820ff6a9dd 100644
> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
> @@ -68,6 +68,9 @@
> #define ST7571_SET_COLOR_MODE(c) (0x10 | FIELD_PREP(GENMASK(0, 0), (c)))
> #define ST7571_COMMAND_SET_NORMAL (0x00)
>
> +/* ST7567 commands */
> +#define ST7567_SET_LCD_BIAS(m) (0xa2 | FIELD_PREP(GENMASK(0, 0), (m)))
> +
> #define ST7571_PAGE_HEIGHT 8
>
> #define DRIVER_NAME "st7571"
> @@ -774,6 +777,32 @@ static int st7571_validate_parameters(struct st7571_device *st7571)
> return 0;
> }
>
> +static int st7567_parse_dt(struct st7571_device *st7567)
> +{
> + struct device *dev = &st7567->client->dev;
> + struct device_node *np = dev->of_node;
> + struct display_timing dt;
> + int ret;
> +
> + ret = of_get_display_timing(np, "panel-timing", &dt);
> + if (ret) {
> + dev_err(dev, "Failed to get display timing from DT\n");
> + return ret;
> + }
> +
> + of_property_read_u32(np, "width-mm", &st7567->width_mm);
> + of_property_read_u32(np, "height-mm", &st7567->height_mm);
> +
> + st7567->pformat = &st7571_monochrome;
> + st7567->bpp = 1;
> +
> + st7567->startline = dt.vfront_porch.typ;
> + st7567->nlines = dt.vactive.typ;
> + st7567->ncols = dt.hactive.typ;
> +
> + return 0;
> +}
> +
> static int st7571_parse_dt(struct st7571_device *st7571)
> {
> struct device *dev = &st7571->client->dev;
> @@ -819,6 +848,37 @@ static void st7571_reset(struct st7571_device *st7571)
> gpiod_set_value_cansleep(st7571->reset, 0);
> }
>
> +static int st7567_lcd_init(struct st7571_device *st7567)
> +{
> + /*
> + * Most of the initialization sequence is taken directly from the
> + * referential initial code in the ST7567 datasheet.
> + */
> + u8 commands[] = {
> + ST7571_DISPLAY_OFF,
> +
> + ST7567_SET_LCD_BIAS(1),
> +
> + ST7571_SET_SEG_SCAN_DIR(0),
> + ST7571_SET_COM_SCAN_DIR(1),
> +
> + ST7571_SET_REGULATOR_REG(4),
> + ST7571_SET_CONTRAST_MSB,
> + ST7571_SET_CONTRAST_LSB(0x20),
> +
> + ST7571_SET_START_LINE_MSB,
> + ST7571_SET_START_LINE_LSB(st7567->startline),
> +
> + ST7571_SET_POWER(0x4), /* Power Control, VC: ON, VR: OFF, VF: OFF */
> + ST7571_SET_POWER(0x6), /* Power Control, VC: ON, VR: ON, VF: OFF */
> + ST7571_SET_POWER(0x7), /* Power Control, VC: ON, VR: ON, VF: ON */
> +
> + ST7571_SET_ENTIRE_DISPLAY_ON(0),
> + };
> +
> + return st7571_send_command_list(st7567, commands, ARRAY_SIZE(commands));
> +}
> +
> static int st7571_lcd_init(struct st7571_device *st7571)
> {
> /*
> @@ -963,6 +1023,18 @@ static void st7571_remove(struct i2c_client *client)
> drm_dev_unplug(&st7571->dev);
> }
>
> +struct st7571_panel_data st7567_config = {
> + .init = st7567_lcd_init,
> + .parse_dt = st7567_parse_dt,
> + .constraints = {
> + .min_nlines = 1,
> + .max_nlines = 64,
> + .min_ncols = 128,
> + .max_ncols = 128,
> + .support_grayscale = false,
> + },
> +};
> +
> struct st7571_panel_data st7571_config = {
> .init = st7571_lcd_init,
> .parse_dt = st7571_parse_dt,
> @@ -976,12 +1048,14 @@ struct st7571_panel_data st7571_config = {
> };
>
> 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 i2c_device_id st7571_id[] = {
> + { "st7567", 0 },
> { "st7571", 0 },
> { }
> };
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names
2025-07-14 12:06 ` Marcus Folkesson
@ 2025-07-14 15:54 ` Javier Martinez Canillas
0 siblings, 0 replies; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 15:54 UTC (permalink / raw)
To: Marcus Folkesson
Cc: linux-kernel, ipedrosa, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann, dri-devel
Marcus Folkesson <marcus.folkesson@gmail.com> writes:
Hello Marcus,
> On Mon, Jul 14, 2025 at 12:44:00PM +0200, Javier Martinez Canillas wrote:
>> It seems the driver took some inspiration from ssd130x and some of the
>> functions (encoder callbacks) were not renamed to use a st7571_ prefix.
>
> Outch, shame on me.
On the contrary, I'm glad to know that the ssd130x driver was useful :)
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>
> Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>
Thanks for your review!
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure
2025-07-14 12:04 ` Marcus Folkesson
@ 2025-07-14 15:54 ` Javier Martinez Canillas
0 siblings, 0 replies; 12+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 15:54 UTC (permalink / raw)
To: Marcus Folkesson
Cc: linux-kernel, ipedrosa, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann, dri-devel
Marcus Folkesson <marcus.folkesson@gmail.com> writes:
> On Mon, Jul 14, 2025 at 12:44:01PM +0200, Javier Martinez Canillas wrote:
>> The driver already uses the dev_err_probe() helper (that only prints error
>> messages for the -EPROBE_DEFER case) when fails to get any other resource.
>>
>> Also do the same when it fails to obtain the rest GPIO.
> reset GPIO
Ups, I'll fix the typo when applying the patches.
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>
> Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-07-14 15:54 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 10:43 [PATCH v2 0/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 1/5] drm/sitronix/st7571-i2c: Fix encoder callbacks function names Javier Martinez Canillas
2025-07-14 12:06 ` Marcus Folkesson
2025-07-14 15:54 ` Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 2/5] drm/sitronix/st7571-i2c: Log probe deferral cause for GPIO get failure Javier Martinez Canillas
2025-07-14 12:04 ` Marcus Folkesson
2025-07-14 15:54 ` Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 3/5] drm/sitronix/st7571-i2c: Add an indirection level to parse DT Javier Martinez Canillas
2025-07-14 12:08 ` Marcus Folkesson
2025-07-14 10:44 ` [PATCH v2 4/5] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
2025-07-14 10:44 ` [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-14 12:11 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).