• Noralf Trønnes's avatar
    drm/mipi-dbi: Add support for DRM_FORMAT_RGB888 · 4aebb790
    Noralf Trønnes authored
    DRM_FORMAT_RGB888 is 24 bits per pixel and it would be natural to send it
    on the SPI bus using a 24 bits per word transfer. The problem with this
    is that not all SPI controllers support 24 bpw.
    
    Since DRM_FORMAT_RGB888 is stored in memory as little endian and the SPI
    bus is big endian we use 8 bpw to always get the same pixel format on the
    bus: b8g8r8.
    
    The MIPI DCS specification lists the standard commands that can be sent
    over the MIPI DBI interface. The set_address_mode (36h) command has one
    bit in the parameter that controls RGB/BGR order. This means that the
    controller can be configured to receive the pixel as BGR.
    
    RGB888 is rarely supported on these controllers but RGB666 is very common.
    All datasheets I have seen do at least support the pixel format option
    where each color is sent as one byte and the 6 MSB's are used.
    
    All this put together means that we can send each pixel as b8g8r8 and an
    RGB666 capable controller sees this as b6x2g6x2r6x2.
    
    v4:
    - s/emulation_format/pixel_format/ (Dmitry)
    Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240604-panel-mipi-dbi-rgb666-v4-4-d7c2bcb9b78d@tronnes.orgSigned-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
    4aebb790
drm_mipi_dbi.c 39 KB