* [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
@ 2025-07-10 10:24 Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-10 10:24 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 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.
Patch #1 adds a Device Tree binding schema for the ST7567 Controller.
Patch #2 makes the "reset-gpios" property in the driver to be optional since that
isn't needed for the ST7567.
Patch #3 finally extends the st7571-i2c driver to also support the ST7567 device.
Javier Martinez Canillas (3):
dt-bindings: display: Add Sitronix ST7567 LCD Controller
drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
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 | 55 +++++++++++++++-
3 files changed, 117 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7567.yaml
--
2.49.0
base-commit: 93eacfcdfbb590d9ed6889d381d5a586dd1ac860
branch: drm-st7567
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller
2025-07-10 10:24 [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
@ 2025-07-10 10:24 ` Javier Martinez Canillas
2025-07-10 22:51 ` Rob Herring (Arm)
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-10 10:24 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
Sitronix ST7567 is a monochrome Dot Matrix LCD Controller.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
.../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] 15+ messages in thread
* [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 10:24 [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
@ 2025-07-10 10:24 ` Javier Martinez Canillas
2025-07-10 10:47 ` Marcus Folkesson
` (2 more replies)
2025-07-10 10:24 ` [PATCH 3/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-11 20:23 ` [PATCH 0/3] " Marcus Folkesson
3 siblings, 3 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-10 10:24 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
Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
so lets relax this in the driver and make the reset GPIO to be optional.
The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
returns NULL when there isn't a reset-gpios property defined in a DT node.
The DT binding schema for "sitronix,st7571" that require a reset GPIO will
enforce the "reset-gpios" to be present, due being a required DT property.
But in the driver itself the property can be made optional if not defined.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
index eec846892962..73e8db25f895 100644
--- a/drivers/gpu/drm/sitronix/st7571-i2c.c
+++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
@@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
st7571->nlines = dt.vactive.typ;
st7571->ncols = dt.hactive.typ;
- st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+ st7571->reset = devm_gpiod_get_optional(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;
}
static void st7571_reset(struct st7571_device *st7571)
{
+ if (!st7571->reset)
+ return;
+
gpiod_set_value_cansleep(st7571->reset, 1);
fsleep(20);
gpiod_set_value_cansleep(st7571->reset, 0);
--
2.49.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
2025-07-10 10:24 [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
@ 2025-07-10 10:24 ` Javier Martinez Canillas
2025-07-11 20:23 ` [PATCH 0/3] " Marcus Folkesson
3 siblings, 0 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-10 10:24 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 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>
---
drivers/gpu/drm/sitronix/st7571-i2c.c | 47 +++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
index 73e8db25f895..ea915bd5deeb 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"
@@ -820,6 +823,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)
{
/*
@@ -964,6 +998,17 @@ static void st7571_remove(struct i2c_client *client)
drm_dev_unplug(&st7571->dev);
}
+struct st7571_panel_data st7567_config = {
+ .init = st7567_lcd_init,
+ .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,
.constraints = {
@@ -976,12 +1021,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] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
@ 2025-07-10 10:47 ` Marcus Folkesson
2025-07-10 11:00 ` Javier Martinez Canillas
2025-07-14 8:45 ` Thomas Zimmermann
2025-07-14 8:55 ` Thomas Zimmermann
2 siblings, 1 reply; 15+ messages in thread
From: Marcus Folkesson @ 2025-07-10 10:47 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: 1784 bytes --]
On Thu, Jul 10, 2025 at 12:24:34PM +0200, Javier Martinez Canillas wrote:
> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
> so lets relax this in the driver and make the reset GPIO to be optional.
>
> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
> returns NULL when there isn't a reset-gpios property defined in a DT node.
>
> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
> enforce the "reset-gpios" to be present, due being a required DT property.
> But in the driver itself the property can be made optional if not defined.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
> index eec846892962..73e8db25f895 100644
> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
> st7571->nlines = dt.vactive.typ;
> st7571->ncols = dt.hactive.typ;
>
> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> + st7571->reset = devm_gpiod_get_optional(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");
devm_gpiod_get_optional() returns -ENOENT when the GPIO is not found,
and that is no error we want to propagage upwards.
Maybe something like this instead:
if (IS_ERR(st7571->reset) && IS_ERR(st7571->reset) != -ENOENT)
Best regards,
Marcus Folkesson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 10:47 ` Marcus Folkesson
@ 2025-07-10 11:00 ` Javier Martinez Canillas
2025-07-10 11:10 ` Marcus Folkesson
0 siblings, 1 reply; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-10 11:00 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,
Thanks for your feedback.
> On Thu, Jul 10, 2025 at 12:24:34PM +0200, Javier Martinez Canillas wrote:
>> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
>> so lets relax this in the driver and make the reset GPIO to be optional.
>>
>> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
>> returns NULL when there isn't a reset-gpios property defined in a DT node.
>>
>> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
>> enforce the "reset-gpios" to be present, due being a required DT property.
>> But in the driver itself the property can be made optional if not defined.
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>> ---
>>
>> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> index eec846892962..73e8db25f895 100644
>> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
>> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
>> st7571->nlines = dt.vactive.typ;
>> st7571->ncols = dt.hactive.typ;
>>
>> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
>> + st7571->reset = devm_gpiod_get_optional(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");
>
> devm_gpiod_get_optional() returns -ENOENT when the GPIO is not found,
> and that is no error we want to propagage upwards.
>
> Maybe something like this instead:
> if (IS_ERR(st7571->reset) && IS_ERR(st7571->reset) != -ENOENT)
>
Are you sure about that? As far as I know, that is exactly the
difference between gpiod_get() and gpiod_get_optional() variants.
From the gpiod_get_optional() function helper kernel-doc [0]:
/**
* gpiod_get_optional - obtain an optional GPIO for a given GPIO function
* @dev: GPIO consumer, can be NULL for system-global GPIOs
* @con_id: function within the GPIO consumer
* @flags: optional GPIO initialization flags
*
* This is equivalent to gpiod_get(), except that when no GPIO was assigned to
* the requested function it will return NULL. This is convenient for drivers
* that need to handle optional GPIOs.
*
* Returns:
* The GPIO descriptor corresponding to the function @con_id of device
* dev, NULL if no GPIO has been assigned to the requested function, or
* another IS_ERR() code if an error occurred while trying to acquire the GPIO.
*/
while the gpiod_get() kernel-doc says the following:
/**
* gpiod_get - obtain a GPIO for a given GPIO function
* @dev: GPIO consumer, can be NULL for system-global GPIOs
* @con_id: function within the GPIO consumer
* @flags: optional GPIO initialization flags
*
* Returns:
* The GPIO descriptor corresponding to the function @con_id of device
* dev, -ENOENT if no GPIO has been assigned to the requested function, or
* another IS_ERR() code if an error occurred while trying to acquire the GPIO.
*/
[0]: https://elixir.bootlin.com/linux/v6.16-rc5/source/drivers/gpio/gpiolib.c#L4755
>
> Best regards,
> Marcus Folkesson
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 11:00 ` Javier Martinez Canillas
@ 2025-07-10 11:10 ` Marcus Folkesson
2025-07-11 19:25 ` Javier Martinez Canillas
0 siblings, 1 reply; 15+ messages in thread
From: Marcus Folkesson @ 2025-07-10 11:10 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: 1956 bytes --]
Hello Javier,
On Thu, Jul 10, 2025 at 01:00:41PM +0200, Javier Martinez Canillas wrote:
> >
> > devm_gpiod_get_optional() returns -ENOENT when the GPIO is not found,
> > and that is no error we want to propagage upwards.
> >
> > Maybe something like this instead:
> > if (IS_ERR(st7571->reset) && IS_ERR(st7571->reset) != -ENOENT)
> >
>
> Are you sure about that? As far as I know, that is exactly the
> difference between gpiod_get() and gpiod_get_optional() variants.
>
> From the gpiod_get_optional() function helper kernel-doc [0]:
>
> /**
> * gpiod_get_optional - obtain an optional GPIO for a given GPIO function
> * @dev: GPIO consumer, can be NULL for system-global GPIOs
> * @con_id: function within the GPIO consumer
> * @flags: optional GPIO initialization flags
> *
> * This is equivalent to gpiod_get(), except that when no GPIO was assigned to
> * the requested function it will return NULL. This is convenient for drivers
> * that need to handle optional GPIOs.
> *
> * Returns:
> * The GPIO descriptor corresponding to the function @con_id of device
> * dev, NULL if no GPIO has been assigned to the requested function, or
> * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
> */
>
> while the gpiod_get() kernel-doc says the following:
>
> /**
> * gpiod_get - obtain a GPIO for a given GPIO function
> * @dev: GPIO consumer, can be NULL for system-global GPIOs
> * @con_id: function within the GPIO consumer
> * @flags: optional GPIO initialization flags
> *
> * Returns:
> * The GPIO descriptor corresponding to the function @con_id of device
> * dev, -ENOENT if no GPIO has been assigned to the requested function, or
> * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
> */
>
You are completely righ.
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Best regards,
Marcus Folkesson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller
2025-07-10 10:24 ` [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
@ 2025-07-10 22:51 ` Rob Herring (Arm)
0 siblings, 0 replies; 15+ messages in thread
From: Rob Herring (Arm) @ 2025-07-10 22:51 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: David Airlie, Thomas Zimmermann, linux-kernel, devicetree,
ipedrosa, Marcus Folkesson, Simona Vetter, dri-devel,
Conor Dooley, Maarten Lankhorst, Krzysztof Kozlowski,
Maxime Ripard
On Thu, 10 Jul 2025 12:24:33 +0200, Javier Martinez Canillas wrote:
> Sitronix ST7567 is a monochrome Dot Matrix LCD Controller.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> .../bindings/display/sitronix,st7567.yaml | 63 +++++++++++++++++++
> MAINTAINERS | 1 +
> 2 files changed, 64 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7567.yaml
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 11:10 ` Marcus Folkesson
@ 2025-07-11 19:25 ` Javier Martinez Canillas
0 siblings, 0 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-11 19:25 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,
> Hello Javier,
>
> On Thu, Jul 10, 2025 at 01:00:41PM +0200, Javier Martinez Canillas wrote:
>> >
>> > devm_gpiod_get_optional() returns -ENOENT when the GPIO is not found,
>> > and that is no error we want to propagage upwards.
>> >
>> > Maybe something like this instead:
>> > if (IS_ERR(st7571->reset) && IS_ERR(st7571->reset) != -ENOENT)
>> >
>>
>> Are you sure about that? As far as I know, that is exactly the
>> difference between gpiod_get() and gpiod_get_optional() variants.
>>
>> From the gpiod_get_optional() function helper kernel-doc [0]:
>>
>> /**
>> * gpiod_get_optional - obtain an optional GPIO for a given GPIO function
>> * @dev: GPIO consumer, can be NULL for system-global GPIOs
>> * @con_id: function within the GPIO consumer
>> * @flags: optional GPIO initialization flags
>> *
>> * This is equivalent to gpiod_get(), except that when no GPIO was assigned to
>> * the requested function it will return NULL. This is convenient for drivers
>> * that need to handle optional GPIOs.
>> *
>> * Returns:
>> * The GPIO descriptor corresponding to the function @con_id of device
>> * dev, NULL if no GPIO has been assigned to the requested function, or
>> * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
>> */
>>
>> while the gpiod_get() kernel-doc says the following:
>>
>> /**
>> * gpiod_get - obtain a GPIO for a given GPIO function
>> * @dev: GPIO consumer, can be NULL for system-global GPIOs
>> * @con_id: function within the GPIO consumer
>> * @flags: optional GPIO initialization flags
>> *
>> * Returns:
>> * The GPIO descriptor corresponding to the function @con_id of device
>> * dev, -ENOENT if no GPIO has been assigned to the requested function, or
>> * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
>> */
>>
>
> You are completely righ.
>
> Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>
Thanks for your review! Do you plan to look at the other patches too ?
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
2025-07-10 10:24 [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
` (2 preceding siblings ...)
2025-07-10 10:24 ` [PATCH 3/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
@ 2025-07-11 20:23 ` Marcus Folkesson
2025-07-11 20:51 ` Javier Martinez Canillas
3 siblings, 1 reply; 15+ messages in thread
From: Marcus Folkesson @ 2025-07-11 20:23 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, ipedrosa, Conor Dooley, David Airlie,
Krzysztof Kozlowski, Maarten Lankhorst, Maxime Ripard,
Rob Herring, Simona Vetter, Thomas Zimmermann, devicetree,
dri-devel
[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]
Hello Javier,
On Thu, Jul 10, 2025 at 12:24:32PM +0200, Javier Martinez Canillas wrote:
> This patch-series adds support for the Sitronix ST7567 Controller, which is 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.
>
> Patch #1 adds a Device Tree binding schema for the ST7567 Controller.
>
> Patch #2 makes the "reset-gpios" property in the driver to be optional since that
> isn't needed for the ST7567.
>
> Patch #3 finally extends the st7571-i2c driver to also support the ST7567 device.
>
>
> Javier Martinez Canillas (3):
> dt-bindings: display: Add Sitronix ST7567 LCD Controller
> drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
> drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
For all patches in this series:
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
2025-07-11 20:23 ` [PATCH 0/3] " Marcus Folkesson
@ 2025-07-11 20:51 ` Javier Martinez Canillas
0 siblings, 0 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-11 20:51 UTC (permalink / raw)
To: Marcus Folkesson
Cc: linux-kernel, ipedrosa, Conor Dooley, David Airlie,
Krzysztof Kozlowski, Maarten Lankhorst, Maxime Ripard,
Rob Herring, Simona Vetter, Thomas Zimmermann, devicetree,
dri-devel
Marcus Folkesson <marcus.folkesson@gmail.com> writes:
Hello Marcus,
> Hello Javier,
>
>
> On Thu, Jul 10, 2025 at 12:24:32PM +0200, Javier Martinez Canillas wrote:
>> This patch-series adds support for the Sitronix ST7567 Controller, which is 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.
>>
>> Patch #1 adds a Device Tree binding schema for the ST7567 Controller.
>>
>> Patch #2 makes the "reset-gpios" property in the driver to be optional since that
>> isn't needed for the ST7567.
>>
>> Patch #3 finally extends the st7571-i2c driver to also support the ST7567 device.
>>
>>
>> Javier Martinez Canillas (3):
>> dt-bindings: display: Add Sitronix ST7567 LCD Controller
>> drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
>> drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
>
> For all patches in this series:
>
> Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Thanks! I'll merge this patch series next week then, since I also got an
ack from a DT maintainer.
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
2025-07-10 10:47 ` Marcus Folkesson
@ 2025-07-14 8:45 ` Thomas Zimmermann
2025-07-14 9:42 ` Javier Martinez Canillas
2025-07-14 8:55 ` Thomas Zimmermann
2 siblings, 1 reply; 15+ messages in thread
From: Thomas Zimmermann @ 2025-07-14 8:45 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: ipedrosa, David Airlie, Maarten Lankhorst, Marcus Folkesson,
Maxime Ripard, Simona Vetter, dri-devel
Hi
Am 10.07.25 um 12:24 schrieb Javier Martinez Canillas:
> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
> so lets relax this in the driver and make the reset GPIO to be optional.
>
> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
> returns NULL when there isn't a reset-gpios property defined in a DT node.
>
> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
> enforce the "reset-gpios" to be present, due being a required DT property.
> But in the driver itself the property can be made optional if not defined.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
> index eec846892962..73e8db25f895 100644
> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
> st7571->nlines = dt.vactive.typ;
> st7571->ncols = dt.hactive.typ;
>
> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> + st7571->reset = devm_gpiod_get_optional(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;
> }
>
> static void st7571_reset(struct st7571_device *st7571)
> {
> + if (!st7571->reset)
> + return;
> +
My interpretation of this function is that calling it guarantees a
device reset (or an error). So I'd push this test into the caller.
Best regards
Thomas
> gpiod_set_value_cansleep(st7571->reset, 1);
> fsleep(20);
> gpiod_set_value_cansleep(st7571->reset, 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] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
2025-07-10 10:47 ` Marcus Folkesson
2025-07-14 8:45 ` Thomas Zimmermann
@ 2025-07-14 8:55 ` Thomas Zimmermann
2025-07-14 9:47 ` Javier Martinez Canillas
2 siblings, 1 reply; 15+ messages in thread
From: Thomas Zimmermann @ 2025-07-14 8:55 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: ipedrosa, David Airlie, Maarten Lankhorst, Marcus Folkesson,
Maxime Ripard, Simona Vetter, dri-devel
Hi
Am 10.07.25 um 12:24 schrieb Javier Martinez Canillas:
> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
> so lets relax this in the driver and make the reset GPIO to be optional.
>
> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
> returns NULL when there isn't a reset-gpios property defined in a DT node.
>
> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
> enforce the "reset-gpios" to be present, due being a required DT property.
> But in the driver itself the property can be made optional if not defined.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
> index eec846892962..73e8db25f895 100644
> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
> st7571->nlines = dt.vactive.typ;
> st7571->ncols = dt.hactive.typ;
>
> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> + st7571->reset = devm_gpiod_get_optional(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");
There's struct st7571_panel_data. It could store a flag signalling the
expected behavior.
With more effort the panel_data could store a dedicated parse_dt pointer
for each panel type. ASAICT the st7567 features a subset of the other
type. So there might not be much code duplication.
Best regards
Thomas
>
> return 0;
> }
>
> static void st7571_reset(struct st7571_device *st7571)
> {
> + if (!st7571->reset)
> + return;
> +
> gpiod_set_value_cansleep(st7571->reset, 1);
> fsleep(20);
> gpiod_set_value_cansleep(st7571->reset, 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] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-14 8:45 ` Thomas Zimmermann
@ 2025-07-14 9:42 ` Javier Martinez Canillas
0 siblings, 0 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 9:42 UTC (permalink / raw)
To: Thomas Zimmermann, linux-kernel
Cc: ipedrosa, David Airlie, Maarten Lankhorst, Marcus Folkesson,
Maxime Ripard, Simona Vetter, dri-devel
Thomas Zimmermann <tzimmermann@suse.de> writes:
Hello Thomas,
> Hi
>
> Am 10.07.25 um 12:24 schrieb Javier Martinez Canillas:
>> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
>> so lets relax this in the driver and make the reset GPIO to be optional.
>>
>> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
>> returns NULL when there isn't a reset-gpios property defined in a DT node.
>>
>> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
>> enforce the "reset-gpios" to be present, due being a required DT property.
>> But in the driver itself the property can be made optional if not defined.
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>> ---
>>
>> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> index eec846892962..73e8db25f895 100644
>> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
>> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
>> st7571->nlines = dt.vactive.typ;
>> st7571->ncols = dt.hactive.typ;
>>
>> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
>> + st7571->reset = devm_gpiod_get_optional(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;
>> }
>>
>> static void st7571_reset(struct st7571_device *st7571)
>> {
>> + if (!st7571->reset)
>> + return;
>> +
>
> My interpretation of this function is that calling it guarantees a
> device reset (or an error). So I'd push this test into the caller.
>
That's a good point. I'll then do the check in the caller.
Actually... at the end I didn't need a st7571_reset() call for ST7567
since it has its own struct st7571_panel_data .init callback function.
So I can just drop the test for st7571->reset being NULL.
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
2025-07-14 8:55 ` Thomas Zimmermann
@ 2025-07-14 9:47 ` Javier Martinez Canillas
0 siblings, 0 replies; 15+ messages in thread
From: Javier Martinez Canillas @ 2025-07-14 9:47 UTC (permalink / raw)
To: Thomas Zimmermann, linux-kernel
Cc: ipedrosa, David Airlie, Maarten Lankhorst, Marcus Folkesson,
Maxime Ripard, Simona Vetter, dri-devel
Thomas Zimmermann <tzimmermann@suse.de> writes:
> Hi
>
> Am 10.07.25 um 12:24 schrieb Javier Martinez Canillas:
>> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
>> so lets relax this in the driver and make the reset GPIO to be optional.
>>
>> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
>> returns NULL when there isn't a reset-gpios property defined in a DT node.
>>
>> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
>> enforce the "reset-gpios" to be present, due being a required DT property.
>> But in the driver itself the property can be made optional if not defined.
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>> ---
>>
>> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> index eec846892962..73e8db25f895 100644
>> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
>> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
>> st7571->nlines = dt.vactive.typ;
>> st7571->ncols = dt.hactive.typ;
>>
>> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
>> + st7571->reset = devm_gpiod_get_optional(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");
>
> There's struct st7571_panel_data. It could store a flag signalling the
> expected behavior.
>
Indeed.
> With more effort the panel_data could store a dedicated parse_dt pointer
> for each panel type. ASAICT the st7567 features a subset of the other
> type. So there might not be much code duplication.
>
This is a good idea too. I think that will do that for v2.
Thanks a lot for your feedback!
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-07-14 9:47 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 10:24 [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
2025-07-10 22:51 ` Rob Herring (Arm)
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
2025-07-10 10:47 ` Marcus Folkesson
2025-07-10 11:00 ` Javier Martinez Canillas
2025-07-10 11:10 ` Marcus Folkesson
2025-07-11 19:25 ` Javier Martinez Canillas
2025-07-14 8:45 ` Thomas Zimmermann
2025-07-14 9:42 ` Javier Martinez Canillas
2025-07-14 8:55 ` Thomas Zimmermann
2025-07-14 9:47 ` Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 3/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-11 20:23 ` [PATCH 0/3] " Marcus Folkesson
2025-07-11 20:51 ` Javier Martinez Canillas
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).