[PATCH 09/14] drm/bridge: synopsys: dw-hdmi: Convert to drm_output_color_format

Maxime Ripard
2026-02-24T10:59:20Z

Now that we introduced a new drm_output_color_format enum to represent
what DRM_COLOR_FORMAT_* bits were representing, we can switch to the new
enum.

The main different is that while DRM_COLOR_FORMAT_ was a bitmask,
drm_output_color_format is a proper enum. However, the enum was done is
such a way than DRM_COLOR_FORMAT_X = BIT(DRM_OUTPUT_COLOR_FORMAT_X) so
the transitition is easier.

The only thing we need to consider is if the original code meant to use
that value as a bitmask, in which case we do need to keep the bit shift,
or as a discriminant in which case we don't.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index ee88c0e793b0416d20105a43448cb4037402e64b..0296e110ce65ffc284e120f4e3f92052474e83e5 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2662,11 +2662,11 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
struct drm_connector *conn = conn_state->connector;
struct drm_display_info *info = &conn->display_info;
struct drm_display_mode *mode = &crtc_state->mode;
u8 max_bpc = conn_state->max_requested_bpc;
bool is_hdmi2_sink = info->hdmi.scdc.supported ||
- (info->color_formats & DRM_COLOR_FORMAT_YCBCR420);
+ (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420));
u32 *output_fmts;
unsigned int i = 0;

*num_output_fmts = 0;

@@ -2721,40 +2721,40 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,

/* Default 8bit RGB fallback */
output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;

if (max_bpc >= 16 && info->bpc == 16) {
- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444))
output_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48;

output_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48;
}

if (max_bpc >= 12 && info->bpc >= 12) {
- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))
output_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24;

- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444))
output_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36;

output_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36;
}

if (max_bpc >= 10 && info->bpc >= 10) {
- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))
output_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20;

- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444))
output_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30;

output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
}

- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))
output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;

- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
+ if (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444))
output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;

*num_output_fmts = i;

return output_fmts;

--
2.52.0