Re: [PATCH v3 2/3] drm/st7571-i2c: add support for Sitronix ST7571 LCD controller

From: Thomas Zimmermann
Date: Wed Apr 09 2025 - 03:22:45 EST


Hi

Am 08.04.25 um 16:58 schrieb Marcus Folkesson:
Hi,

On Tue, Apr 08, 2025 at 03:57:22PM +0200, Thomas Zimmermann wrote:
Hi

Am 08.04.25 um 15:20 schrieb Marcus Folkesson:
[...]
+static int st7571_set_pixel_format(struct st7571_device *st7571,
+ u32 pixel_format)
+{
+ switch (pixel_format) {
+ case DRM_FORMAT_C1:
+ return st7571_set_color_mode(st7571, ST7571_COLOR_MODE_BLACKWHITE);
+ case DRM_FORMAT_C2:
+ return st7571_set_color_mode(st7571, ST7571_COLOR_MODE_GRAY);
+ default:
+ return -EINVAL;
+ }
These should be DRM_FORMAT_R1 and DRM_FORMAT_R2 and not C{1,2}. The former
is for displays have a single color (i.e: grey) while the latter is when a
pixel can have different color, whose values are defined by a CLUT table.

I see.
Does fbdev only works with CLUT formats? I get this error when I switch
to DRM_FORMAT_R{1,2}:

[drm] Initialized st7571 1.0.0 for 0-003f on minor 0
st7571 0-003f: [drm] format C1 little-endian (0x20203143) not supported
st7571 0-003f: [drm] No compatible format found
st7571 0-003f: [drm] *ERROR* fbdev: Failed to setup emulation (ret=-22)
For testing purposes, you can add the _R formats to the switch case at

https://elixir.bootlin.com/linux/v6.13.7/source/drivers/gpu/drm/drm_fb_helper.c#L1246

and see how it goes.
Still no penguin (same error as above).

The problem is that drm_mode_legacy_fb_format(), which is called from
drm_fbdev_shmem_driver_fbdev_probe -> drm_driver_legacy_fb_format -> drm_mode_legacy_fb_format

In addition to the other change, you could change the _C formats to _R formats in that helper for testing.

Best regards
Thomas


Sets the pixel format DRM_FORMAT_C{1,2} when bpp is 1 or 2.
So I don't think it is possible to use the _R formats with fbdev.
But I'm not sure?

Best regards
Thomas
Best regards,
Marcus Folkesson

--
--
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)