Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: panel: simple: Warn in case of incorrect bus format for LVDS panels

Only the MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
MEDIA_BUS_FMT_RGB888_1X7X4_SPWG and MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA bus
formats are valid for LVDS panels. Warn at probe time to catch the
common mistake of using an incorrect format, as well as discrepancies
between the bus format and the reported bpc.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200629233320.8774-5-laurent.pinchart+renesas@ideasonboard.com

authored by

Laurent Pinchart and committed by
Sam Ravnborg
1185c406 c4715837

+10 -1
+10 -1
drivers/gpu/drm/panel/panel-simple.c
··· 549 549 panel_simple_parse_panel_timing_node(dev, panel, &dt); 550 550 } 551 551 552 - if (desc->connector_type == DRM_MODE_CONNECTOR_LVDS) 552 + if (desc->connector_type == DRM_MODE_CONNECTOR_LVDS) { 553 553 /* Catch common mistakes for LVDS panels. */ 554 554 WARN_ON(desc->bus_flags & 555 555 ~(DRM_BUS_FLAG_DE_LOW | 556 556 DRM_BUS_FLAG_DE_HIGH | 557 557 DRM_BUS_FLAG_DATA_MSB_TO_LSB | 558 558 DRM_BUS_FLAG_DATA_LSB_TO_MSB)); 559 + WARN_ON(desc->bus_format != MEDIA_BUS_FMT_RGB666_1X7X3_SPWG && 560 + desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_SPWG && 561 + desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA); 562 + WARN_ON(desc->bus_format == MEDIA_BUS_FMT_RGB666_1X7X3_SPWG && 563 + desc->bpc != 6); 564 + WARN_ON((desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG || 565 + desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA) && 566 + desc->bpc != 8); 567 + } 559 568 560 569 drm_panel_init(&panel->base, dev, &panel_simple_funcs, 561 570 desc->connector_type);