@@ -101,7 +101,9 @@ static void mxsfb_set_bus_fmt(struct mxsfb_drm_private *mxsfb)
ctrl = readl(mxsfb->base + LCDC_CTRL);
- if (mxsfb->connector.display_info.num_bus_formats)
+ if (mxsfb->bus_format_override)
+ bus_format = mxsfb->bus_format_override;
+ else if (mxsfb->connector.display_info.num_bus_formats)
bus_format = mxsfb->connector.display_info.bus_formats[0];
ctrl &= ~CTRL_BUS_WIDTH_MASK;
@@ -182,6 +182,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
struct platform_device *pdev = to_platform_device(drm->dev);
struct mxsfb_drm_private *mxsfb;
struct resource *res;
+ const char *fmt;
int ret;
mxsfb = devm_kzalloc(&pdev->dev, sizeof(*mxsfb), GFP_KERNEL);
@@ -208,6 +209,18 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
if (IS_ERR(mxsfb->clk_disp_axi))
mxsfb->clk_disp_axi = NULL;
+ ret = of_property_read_string(drm->dev->of_node, "interface-pix-fmt", &fmt);
+ if (!ret) {
+ if (!strcmp(fmt, "rgb24"))
+ mxsfb->bus_format_override = MEDIA_BUS_FMT_RGB888_1X24;
+ else if (!strcmp(fmt, "bgr24"))
+ mxsfb->bus_format_override = MEDIA_BUS_FMT_BGR888_1X24;
+ else if (!strcmp(fmt, "rbg24"))
+ mxsfb->bus_format_override = MEDIA_BUS_FMT_RBG888_1X24;
+ else if (!strcmp(fmt, "gbr24"))
+ mxsfb->bus_format_override = MEDIA_BUS_FMT_GBR888_1X24;
+ }
+
ret = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
@@ -40,6 +40,7 @@ struct mxsfb_drm_private {
struct drm_connector connector;
struct drm_panel *panel;
struct drm_fbdev_cma *fbdev;
+ unsigned int bus_format_override;
};
int mxsfb_setup_crtc(struct drm_device *dev);
This way hardware that has the LCD signal lines swapped can express so in the device tree and existing panel support can be reused unmodified. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 4 +++- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 13 +++++++++++++ drivers/gpu/drm/mxsfb/mxsfb_drv.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-)