Skip to content

Commit

Permalink
drm/vc4: dpi: Add override for RGB order
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
6by9 committed May 10, 2024
1 parent e0c78d5 commit 20800a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/gpu/drm/vc4/vc4_dpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ struct vc4_dpi {
struct clk *core_clock;

struct debugfs_regset32 regset;

u32 rgb_order_override;
};

#define to_vc4_dpi(_encoder) \
Expand Down Expand Up @@ -205,6 +207,11 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
}
}

if (dpi->rgb_order_override) {
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;

Expand Down Expand Up @@ -361,6 +368,12 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;

of_property_read_u32(dev->of_node, "rgb_order", &dpi->rgb_order_override);
if (dpi->rgb_order_override > DPI_ORDER_BRG) {
DRM_ERROR("DPI rgb_order override invalid - ignored\n");
dpi->rgb_order_override = 0;
}

ret = drmm_encoder_init(drm, &dpi->encoder.base,
&vc4_dpi_encoder_funcs,
DRM_MODE_ENCODER_DPI,
Expand Down

0 comments on commit 20800a7

Please sign in to comment.