From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
linux-kernel@vger.kernel.org
Cc: ipedrosa@redhat.com,
Marcus Folkesson <marcus.folkesson@gmail.com>,
David Airlie <airlied@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Simona Vetter <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 5/5] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller
Date: Mon, 14 Jul 2025 14:11:07 +0200 [thread overview]
Message-ID: <678d7564-3736-4c5e-9d32-d107eb76af28@suse.de> (raw)
In-Reply-To: <20250714104421.323753-6-javierm@redhat.com>
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)
prev parent reply other threads:[~2025-07-14 12:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 10:43 [PATCH v2 0/5] " 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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=678d7564-3736-4c5e-9d32-d107eb76af28@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ipedrosa@redhat.com \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marcus.folkesson@gmail.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®