• Marek Vasut's avatar
    drm/stm: Fix bus_flags handling · 99e36044
    Marek Vasut authored
    The drm_display_mode_to_videomode() does not populate DISPLAY_FLAGS_DE_LOW
    or DISPLAY_FLAGS_PIXDATA_NEGEDGE flags in struct videomode. Therefore, no
    matter what polarity the next bridge or display might require, these flags
    are never set, and thus the LTDC GCR_DEPOL and GCR_PCPOL bits are never set
    and the LTDC behaves as if both DISPLAY_FLAGS_PIXDATA_POSEDGE and
    DISPLAY_FLAGS_DE_HIGH were always set.
    
    The fix for this problem is taken almost verbatim from MXSFB driver. In
    case there is a bridge attached to the LTDC, the bridge might have extra
    polarity requirements, so extract bus_flags from the bridge and use them
    for LTDC configuration. Otherwise, extract bus_flags from the connector,
    which is the display.
    
    Fixes: b759012c ("drm/stm: Add STM32 LTDC driver")
    Signed-off-by: default avatarMarek Vasut <marex@denx.de>
    Signed-off-by: default avatarYannick Fertre <yannick.fertre@st.com>
    Cc: Alexandre Torgue <alexandre.torgue@st.com>
    Cc: Antonio Borneo <antonio.borneo@st.com>
    Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
    Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
    Cc: Philippe Cornu <philippe.cornu@st.com>
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Cc: Vincent Abriou <vincent.abriou@st.com>
    Cc: Yannick Fertre <yannick.fertre@st.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-stm32@st-md-mailman.stormreply.com
    To: dri-devel@lists.freedesktop.org
    Tested-by: default avatarYannick Fertre <yannick.fertre@foss.st.com>
    Signed-off-by: default avatarPhilippe Cornu <philippe.cornu@foss.st.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210127110756.125570-1-marex@denx.de
    99e36044
ltdc.c 38.6 KB