mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
68 lines
2.0 KiB
Diff
68 lines
2.0 KiB
Diff
|
From c5d701eb75738920ea659f0e6a7ddf8bcf9d5729 Mon Sep 17 00:00:00 2001
|
||
|
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
||
|
Date: Fri, 10 May 2024 11:30:25 +0100
|
||
|
Subject: [PATCH 1093/1135] drm/vc4: dpi: Add override for RGB order
|
||
|
|
||
|
There are no MEDIA_BUS_FMT_* defines for GRB or BRG, and adding
|
||
|
them is a pain.
|
||
|
|
||
|
Add a DT override to allow setting the order.
|
||
|
|
||
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
||
|
---
|
||
|
drivers/gpu/drm/vc4/vc4_dpi.c | 22 ++++++++++++++++++++++
|
||
|
1 file changed, 22 insertions(+)
|
||
|
|
||
|
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
|
||
|
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
|
||
|
@@ -95,6 +95,8 @@ struct vc4_dpi {
|
||
|
struct clk *core_clock;
|
||
|
|
||
|
struct debugfs_regset32 regset;
|
||
|
+
|
||
|
+ int rgb_order_override;
|
||
|
};
|
||
|
|
||
|
#define to_vc4_dpi(_encoder) \
|
||
|
@@ -205,6 +207,11 @@ static void vc4_dpi_encoder_enable(struc
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+ if (dpi->rgb_order_override >= 0) {
|
||
|
+ dpi_c &= ~DPI_ORDER_MASK;
|
||
|
+ dpi_c |= VC4_SET_FIELD(dpi->rgb_order_override, DPI_ORDER);
|
||
|
+ }
|
||
|
+
|
||
|
if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
|
||
|
dpi_c |= DPI_PIXEL_CLK_INVERT;
|
||
|
|
||
|
@@ -313,6 +320,7 @@ static int vc4_dpi_bind(struct device *d
|
||
|
{
|
||
|
struct platform_device *pdev = to_platform_device(dev);
|
||
|
struct drm_device *drm = dev_get_drvdata(master);
|
||
|
+ const char *rgb_order = NULL;
|
||
|
struct vc4_dpi *dpi;
|
||
|
int ret;
|
||
|
|
||
|
@@ -361,6 +369,20 @@ static int vc4_dpi_bind(struct device *d
|
||
|
if (ret)
|
||
|
return ret;
|
||
|
|
||
|
+ dpi->rgb_order_override = -1;
|
||
|
+ if (!of_property_read_string(dev->of_node, "rgb_order", &rgb_order)) {
|
||
|
+ if (!strcmp(rgb_order, "rgb"))
|
||
|
+ dpi->rgb_order_override = DPI_ORDER_RGB;
|
||
|
+ else if (!strcmp(rgb_order, "bgr"))
|
||
|
+ dpi->rgb_order_override = DPI_ORDER_BGR;
|
||
|
+ else if (!strcmp(rgb_order, "grb"))
|
||
|
+ dpi->rgb_order_override = DPI_ORDER_GRB;
|
||
|
+ else if (!strcmp(rgb_order, "brg"))
|
||
|
+ dpi->rgb_order_override = DPI_ORDER_BRG;
|
||
|
+ else
|
||
|
+ DRM_ERROR("Invalid dpi order %s - ignored\n", rgb_order);
|
||
|
+ }
|
||
|
+
|
||
|
ret = drmm_encoder_init(drm, &dpi->encoder.base,
|
||
|
&vc4_dpi_encoder_funcs,
|
||
|
DRM_MODE_ENCODER_DPI,
|