Re: [PATCH v5 2/3] drm/panel: Add Samsung S6D7AA0 panel controller driver

Nathan Chancellor
2023-05-23T18:02:19Z

Hi Artur,

On Fri, May 19, 2023 at 07:03:53PM +0200, Artur Weber wrote:
> Initial driver for S6D7AA0-controlled panels. Currently, the following
> panels are supported:
>
> - S6D7AA0-LSL080AL02 (Samsung Galaxy Tab 3 8.0)
> - S6D7AA0-LSL080AL03 (Samsung Galaxy Tab A 8.0 2015)
> - S6D7AA0-LTL101AT01 (Samsung Galaxy Tab A 9.7 2015)
>
> It should be possible to extend this driver to work with other panels
> using this IC.
>
> Tested-by: Nikita Travkin <nikita@trvn.ru> #ltl101at01
> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>

<snip>

This change as commit 6810bb390282 ("drm/panel: Add Samsung S6D7AA0
panel controller driver") in -next causes the following build errors
with clang and GCC older than 8.x (the kernel supports back to GCC 5.1).

With clang:

drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:312:14: error: initializer element is not a compile-time constant
.drm_mode = s6d7aa0_lsl080al02_mode,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:415:14: error: initializer element is not a compile-time constant
.drm_mode = s6d7aa0_lsl080al03_mode,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:443:14: error: initializer element is not a compile-time constant
.drm_mode = s6d7aa0_ltl101at01_mode,
^~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.

With GCC:

drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:312:14: error: initializer element is not constant
.drm_mode = s6d7aa0_lsl080al02_mode,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:312:14: note: (near initialization for 's6d7aa0_lsl080al02_desc.drm_mode')
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:415:14: error: initializer element is not constant
.drm_mode = s6d7aa0_lsl080al03_mode,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:415:14: note: (near initialization for 's6d7aa0_lsl080al03_desc.drm_mode')
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:443:14: error: initializer element is not constant
.drm_mode = s6d7aa0_ltl101at01_mode,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:443:14: note: (near initialization for 's6d7aa0_ltl101at01_desc.drm_mode')

You can find these toolchains at
https://mirrors.edge.kernel.org/pub/tools/crosstool/ and
https://mirrors.edge.kernel.org/pub/tools/llvm/ if you need help
testing.

clang may eventually match GCC's newer behavior but there appears to be
some unresolved concerns around the proposed implementation and we have
not been able to double back to it:
https://reviews.llvm.org/D76096

> +static const struct drm_display_mode s6d7aa0_lsl080al03_mode = {
> + .clock = (768 + 18 + 16 + 126) * (1024 + 8 + 2 + 6) * 60 / 1000,
> + .hdisplay = 768,
> + .hsync_start = 768 + 18,
> + .hsync_end = 768 + 18 + 16,
> + .htotal = 768 + 18 + 16 + 126,
> + .vdisplay = 1024,
> + .vsync_start = 1024 + 8,
> + .vsync_end = 1024 + 8 + 2,
> + .vtotal = 1024 + 8 + 2 + 6,
> + .width_mm = 122,
> + .height_mm = 163,
> +};
> +
> +static const struct s6d7aa0_panel_desc s6d7aa0_lsl080al03_desc = {
> + .panel_type = S6D7AA0_PANEL_LSL080AL03,
> + .init_func = s6d7aa0_lsl080al03_init,
> + .off_func = s6d7aa0_lsl080al03_off,
> + .drm_mode = s6d7aa0_lsl080al03_mode,
> + .mode_flags = MIPI_DSI_MODE_NO_EOT_PACKET,
> + .bus_flags = 0,
> +
> + .has_backlight = true,
> + .use_passwd3 = true,
> +};
> +
> +/* Initialization structures for LTL101AT01 panel */
> +
> +static const struct drm_display_mode s6d7aa0_ltl101at01_mode = {
> + .clock = (768 + 96 + 16 + 184) * (1024 + 8 + 2 + 6) * 60 / 1000,
> + .hdisplay = 768,
> + .hsync_start = 768 + 96,
> + .hsync_end = 768 + 96 + 16,
> + .htotal = 768 + 96 + 16 + 184,
> + .vdisplay = 1024,
> + .vsync_start = 1024 + 8,
> + .vsync_end = 1024 + 8 + 2,
> + .vtotal = 1024 + 8 + 2 + 6,
> + .width_mm = 148,
> + .height_mm = 197,
> +};
> +
> +static const struct s6d7aa0_panel_desc s6d7aa0_ltl101at01_desc = {
> + .panel_type = S6D7AA0_PANEL_LTL101AT01,
> + .init_func = s6d7aa0_lsl080al03_init, /* Similar init to LSL080AL03 */
> + .off_func = s6d7aa0_lsl080al03_off,
> + .drm_mode = s6d7aa0_ltl101at01_mode,
> + .mode_flags = MIPI_DSI_MODE_NO_EOT_PACKET,
> + .bus_flags = 0,
> +
> + .has_backlight = true,
> + .use_passwd3 = true,
> +};

Cheers,
Nathan