The color block is one of the components of the video pipeline on some MediaTek SoCs, such as the MT8365. It provides the picture quality adjustments of the pipeline, such as contrast, hue and saturation.
None of them is needed to display a splash screen, so the driver programs the frame size and starts the block with all the adjustments bypassed. The driver matches "mediatek,mt8173-disp-color", the generic fallback the MT8365 color0 node carries behind "mediatek,mt8365-disp-color", so a single entry covers every SoC reusing that block. Signed-off-by: Julien Stephan <[email protected]> --- drivers/video/mediatek/mtk_disp_color.c | 50 +++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_color.h | 31 ++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/drivers/video/mediatek/mtk_disp_color.c b/drivers/video/mediatek/mtk_disp_color.c new file mode 100644 index 00000000000..759e7c800b4 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_color.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video Color support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson <[email protected]> + * Julien Stephan <[email protected]> + */ + +#include <dm/device.h> +#include <fdtdec.h> +#include <linux/bitops.h> + +#include "mtk_disp_color.h" +#include "mtk_disp_comp.h" + +#define DISP_COLOR_CFG_MAIN 0x400 +#define COLOR_BYPASS_ALL BIT(7) +#define COLOR_SEQ_SEL BIT(13) + +#define DISP_COLOR_START 0xc00 + +#define DISP_COLOR_WIDTH 0xc50 +#define DISP_COLOR_HEIGHT 0xc54 + +void mtk_color_config(struct udevice *dev, const struct display_timing *timing) +{ + mtk_disp_comp_write(dev, DISP_COLOR_WIDTH, timing->hactive.typ); + mtk_disp_comp_write(dev, DISP_COLOR_HEIGHT, timing->vactive.typ); +} + +void mtk_color_start(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_COLOR_CFG_MAIN, + COLOR_BYPASS_ALL | COLOR_SEQ_SEL); + mtk_disp_comp_write(dev, DISP_COLOR_START, 1); +} + +static const struct udevice_id mtk_disp_color_ids[] = { + { .compatible = "mediatek,mt8173-disp-color" }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_color) = { + .name = "mtk_disp_color", + .id = UCLASS_MISC, + .of_match = mtk_disp_color_ids, + .probe = mtk_disp_comp_probe, + .priv_auto = sizeof(struct mtk_disp_comp_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_color.h b/drivers/video/mediatek/mtk_disp_color.h new file mode 100644 index 00000000000..9858ee95d5b --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_color.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson <[email protected]> + * Julien Stephan <[email protected]> + */ + +#ifndef _MTK_DISP_COLOR_H +#define _MTK_DISP_COLOR_H + +struct display_timing; +struct udevice; + +/** + * mtk_color_config() - configure the color block + * @dev: color device + * @timing: display timing, giving the frame size + * + * Set the frame size of the color block. + */ +void mtk_color_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_color_start() - start the color block + * @dev: color device + * + * Start the color block with every color adjustment bypassed. + */ +void mtk_color_start(struct udevice *dev); + +#endif /* _MTK_DISP_COLOR_H */ -- 2.55.0
