[PATCH v3 07/14] drm/bridge: cadence: Convert to drm_output_color_format
Dmitry Baryshkov
dmitry.baryshkov at oss.qualcomm.com
Sun Mar 22 21:03:06 PDT 2026
On Thu, Mar 05, 2026 at 10:04:59AM +0100, Maxime Ripard wrote:
> 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 difference 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.
>
> Acked-by: Jani Nikula <jani.nikula at intel.com>
> Signed-off-by: Maxime Ripard <mripard at kernel.org>
> ---
> .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 24 +++++++++++-----------
> .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.h | 2 +-
> 2 files changed, 13 insertions(+), 13 deletions(-)
>
> switch (fmt->color_format) {
> - case DRM_COLOR_FORMAT_RGB444:
> - case DRM_COLOR_FORMAT_YCBCR444:
> + case DRM_OUTPUT_COLOR_FORMAT_RGB444:
> + case DRM_OUTPUT_COLOR_FORMAT_YCBCR444:
> bpp = fmt->bpc * 3;
> break;
> - case DRM_COLOR_FORMAT_YCBCR422:
> + case DRM_OUTPUT_COLOR_FORMAT_YCBCR422:
> bpp = fmt->bpc * 2;
> break;
> - case DRM_COLOR_FORMAT_YCBCR420:
> + case DRM_OUTPUT_COLOR_FORMAT_YCBCR420:
Nit: where are those values being set? I see only the RGB444 being set
in the probe function.
> bpp = fmt->bpc * 3 / 2;
> break;
> default:
> bpp = fmt->bpc * 3;
> WARN_ON(1);
> @@ -2479,11 +2479,11 @@ static int cdns_mhdp_probe(struct platform_device *pdev)
> mhdp->link.rate = mhdp->host.link_rate;
> mhdp->link.num_lanes = mhdp->host.lanes_cnt;
>
> /* The only currently supported format */
> mhdp->display_fmt.y_only = false;
> - mhdp->display_fmt.color_format = DRM_COLOR_FORMAT_RGB444;
> + mhdp->display_fmt.color_format = DRM_OUTPUT_COLOR_FORMAT_RGB444;
> mhdp->display_fmt.bpc = 8;
>
> mhdp->bridge.of_node = pdev->dev.of_node;
> mhdp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |
> DRM_BRIDGE_OP_HPD;
--
With best wishes
Dmitry
More information about the Linux-mediatek
mailing list