mbox series

[v8,00/12] mediatek: add HDMI pipeline support for MT8188 based boards

Message ID 20261002-add-genio-510-and-genio-700-hdmi-v8-0-2a6de7cf2a88@baylibre.com
Headers show
Series mediatek: add HDMI pipeline support for MT8188 based boards | expand

Message

Julien Stephan Oct. 2, 2026, 1:25 p.m. UTC
This series adds HDMI support for MT8188 based boards, such as the Genio
510 and Genio 700 EVKs, in order to display a boot logo over HDMI. It
builds on top of the HDMI PHY driver [1], the DDC (I2C) driver [2], the
clock series [3] and a clock fix [4] already sent earlier.

The drivers here were inspired by the corresponding kernel drivers, but
were largely modified, mainly because U-Boot has no DRM framework and
the goal is only to display a framebuffer. The HDMI driver locates each
pipeline component through the device-tree aliases the SoC dtsi already
provides and programs them directly. The framebuffer is allocated by
the video uclass.

The video pipeline looks like this:

             framebuffer (in DRAM)
                       |
          +------------+------------+
          v                         v
      mdp_rdma4                 mdp_rdma5      two DMA read engines,
     (left half)               (right half)   each fetching one frame half
          |                         |
       padding4                  padding5      (bypass)
          |                         |
          +------------+------------+
                       v
                  vpp merge (merge3)           recombine the two halves
                       |
                       v
                 ethdr mixer (ethdr0)
                       |
                       v
                  hdr back-end                  (bypass)
                       |
                       v
                  vpp merge (merge5)
                       |
                       v
                     dpi1                       timing generator -> HDMI TX
                       |
                       v
      ddc/i2c ---> hdmi tx controller
    (read EDID)        |
                       v
                   hdmi phy
                       |
                       v
              hdmi connector ---> sink

  mutex1  : hardware SOF synchronization across the pipeline
  vdosys1 : routing muxes (SEL_IN/SOUT) and the sizes of the
            clock-domain-crossing wrappers between the blocks above
  larb2/3 : SMI local arbiters gating the RDMAs' access to DRAM

The series adds the HDMI TX controller (UCLASS_VIDEO), a set of shared
display-component helpers and the individual pipeline components (ethdr,
merge, mutex, padding, rdma, dpi1), a minimal SMI local arbiter driver,
and the config that enables the pipeline.

Tested on a Genio 700 EVK: the U-Boot logo shows up on an HDMI display.

[1]: https://patchwork.ozlabs.org/project/uboot/patch/20260717-mt8188-add-hdmi-phy-driver-v1-1-4278457fe2cb@baylibre.com/
[2]: https://patchwork.ozlabs.org/project/uboot/cover/20260717-mt8188-add-ddc-i2c-driver-v1-0-e89ccd173567@baylibre.com/
[3]: https://patchwork.ozlabs.org/project/uboot/patch/20260715-mt8188-add-clk-add-display-related-clocks-v2-1-0aaf7accaeb0@baylibre.com/
[4]: https://patchwork.ozlabs.org/project/uboot/patch/20260728-mt8188-clk-fix-top0-gate-polarity-v1-1-56bc92ba6055@baylibre.com/

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
Changes in v8:
- SMI: on MT8188, take the larb out of the IOMMU through the secure
  monitor (SMC), as Linux does; select ARM_SMCCC; reword the Kconfig help
- mutex: rename mtk_disp_mutex_config_hdmi() to mt8188_mutex_config_hdmi()
- add <linux/types.h> to the new headers
- rdma: u32 byte offset
- merge: only unmute when mediatek,merge-mute is set
- hdmi: Kconfig: drop select MTK_POWER_DOMAIN, depend on ARM64 && CLK
- collect Ilias's Reviewed-by on get_unaligned_le24()
- Link to v7: https://patch.msgid.link/20260928-add-genio-510-and-genio-700-hdmi-v7-0-ee4a61a8ac1d@baylibre.com

Changes in v7:
- rename mtk-smi-larb to mtk-smi to align with kernel. Also update
  config symbol and alilgn description with kernel
- Link to v6: https://patch.msgid.link/20260925-add-genio-510-and-genio-700-hdmi-v6-0-29e626b213e9@baylibre.com

Changes in v6:
- dts: dropped the framebuffer reserved-memory patch; the framebuffer is
  now allocated by the video uclass, sized for the largest mode
- kernel-doc for the exported API and structures
- <linux/bitops.h> where BIT()/GENMASK() are used; MediaTek spelling
- SMI larb: refcount enable/disable
- component helpers: larb lookup moved here from rdma
- ethdr: program MIX_L_SRC_OFFSET(2); enable the mixer last
- merge: read-modify-write of CFG_37
- mutex: Linux names for the SOF and module indices
- rdma: retitled "add mdp rdma component"; datasheet names for the
  downstream-only fields
- dpi: fix inverted HSYNC/VSYNC polarity; clear YUV422_EN/CSC_ENABLE
- hdmi driver: DM_FLAG_PRE_RELOC; set priv->format; yuv420 bypass only
  clears HDMI_YUV420_MODE; document the HDR back-end routing, the VDOSYS1
  power dependency and the 4:3 VICs
- Link to v5: https://patch.msgid.link/20260904-add-genio-510-and-genio-700-hdmi-v5-0-dd9dde2f972e@baylibre.com

Changes in v5:
Across the whole series
- Dropped the dead colorspace/colorimetry handling: only RGB444 8bpc is ever produced, so set_csp_depth/csp, the YUV
cases of the AVI InfoFrame, the YUV420 downsample path and the DPI CSC are gone. That removed the only user of the
include/linux/hdmi.h added in v2, so that patch is dropped too.
- Programmed the resolution- and DRAM-latency-dependent registers the mainline kernel writes and this series skipped;
their reset values only work at the timing they happened to be tested at. Retested on a Genio 700 EVK.
- of_match tables consistently use "{ }".
- Include hygiene: <linux/bitops.h>, <errno.h> and <fdtdec.h> where needed, unused <video.h>/<asm/io.h> dropped, #endif
guards named, redundant "struct udevice;" forward declarations removed.

Per patch
- memory: new preparatory patch sorting drivers/memory/Makefile, so the larb entry lands in an ordered list.
- SMI larb: moved to drivers/memory/mtk-smi-larb.c with its own CONFIG_MTK_SMI_LARB and UCLASS_MEMORY
- component helpers: added mtk_disp_comp_update(), the read-modify-write counterpart of mtk_disp_comp_write().
- ethdr: put the HDR video back-end in bypass like Linux' mtk_ethdr_config() does; "vdo_be" mapped by reg-name.
- merge: mtk_disp_merge_config() reshaped to the kernel's (l_w, r_w, h) and CFG_1/25/27 written unconditionally;
documented that the single-input no-fifo mode is unreachable from this pipeline, hence untested.
- padding: clear all four registers in bypass mode, not only the picture size
- rdma:
  - program MDP_RDMA_GMCIF_CON and clear MDP_RDMA_COMP_CON and FLD_OUTPUT_ARGB
  - reject a stride too wide for FLD_MF_BKGD_WB;
  -print the framebuffer base with "%#lx" (it is a ulong);
  - resolve the larb in UCLASS_MEMORY.
- rdma: kept the datasheet name BGRA8888 over the kernel's RDMA_INPUT_FORMAT_RGBA8888 (same byte order, i.e.
DRM_FORMAT_XRGB8888) and TRANSFORM_0 bit 15 over MDP_RDMA_CON's FLD_OUTPUT_10B (that bit is in neither kernel driver, it
came with the downstream U-Boot code). Both documented in comments.
- dpi: the CSC/matrix path went with the colorspace handling, and MATRIX_SEL_RGB_TO_BT709 with it; mtk_dpi_hw_disable()
is now used, in the HDMI probe unwind; mtk_dpi_mask() replaced by mtk_disp_comp_update(); local types renamed
mtk_dpintf_* -> mtk_dpi_* (this node is mediatek,mt8195-dpi, not the dp-intf variant) and the config parameters const.
- get_unaligned_le24(): moved between the le16 and le32 helpers to keep the file ordered, and split into
__get_unaligned_le24()/get_unaligned_le24() as Linux has it.
- hdmi driver: above 340 MHz, tell the sink to scramble and use the 1/40 bit clock ratio through its SCDC TMDS_Config
(offset 0x20 at I2C 0x54).
- hdmi driver: sink type taken from the EDID (hdmi_monitor) instead of always assuming HDMI, and no InfoFrames sent to a
DVI sink.
- hdmi driver: zero the EDID extension block when reading it fails, so the parser cannot pick a timing out of
uninitialised stack
- hdmi driver: propagate the generic_phy_configure()/_power_on() failures instead of logging and carrying on.
- hdmi driver: clear the GCP AVMUTE, in case an earlier boot stage left the sink muted.
- hdmi driver: the VIC is now looked up in a table keyed on the timing's exact rounded refresh rate; an unknown timing
reports VIC 0 and no aspect ratio rather than a wrong one, and the AVI colorimetry is "No Data" as CTA-861 wants for
RGB. Also set A0 in the AVI InfoFrame, the active format R3..R0 is only valid with it.
- hdmi driver: mtk_hdmi_mode_valid() also rejects interlaced timings, odd widths and pixel clocks outside 25-594 MHz.
The pipeline reads the frame as two halves and feeds the DPI two pixels per clock, and the PHY will not lock outside
that range; rejecting them here lets the EDID parser fall back to the next detailed timing instead of failing.
- hdmi driver: no data islands towards a DVI sink either, the GCP and null packets are gated on hdmi_monitor like the
InfoFrames.
- hdmi driver: dropped the infoframe buffer size checks, which cannot fail, and collapsed the three-way HPD state into
a bool.
- hdmi driver: program the vdosys1 clock-domain-crossing wrapper sizes and the mixer input padding. The alpha half of
the kernel's mtk_mmsys_mixer_in_config() is left alone: the mixer layer runs with MIXER_ALPHA_AEN clear.
- hdmi driver: zero the framebuffer before the RDMAs start and enable the DPI last, so a stale reserved region is never
scanned out; video_post_probe() only clears the framebuffer after probe returns.
- hdmi driver: dev_remap_addr() and a void __iomem * for the register window; extension_flag instead of a raw 0x7e
offset; the 150 us settle delay moved back where the kernel has it, so it does not fire on the disable path; "display is
not connected" demoted to debug; the cached struct display_timing dropped, timing and buffer parameters const, "inline"
dropped from the two static helpers, includes sorted.
- hdmi driver: retitled "video: mediatek: add hdmi driver".
- mtk_hdmi_regs_v2.h is a verbatim copy of the kernel header except VID_DOWNSAMPLE_CONFIG, at 0x8f0 per the MT8390/MT8188 datasheet and not the
0x8d0 Linux uses (a patch was sent to fix this on kernel side)
- dts: the reserved-memory and the hdmi "memory-region" phandle are a single patch now; SPDX (GPL-2.0 OR MIT) ->
(GPL-2.0-only OR MIT), node renamed framebuffer@72000000, 32 MiB size documented.
- configs: drop CONFIG_CMD_I2C, the DDC transfers go through DM_I2C inside the driver; the commit message notes that
CONFIG_VIDEO_LOGO is "default y if !SPLASH_SCREEN", so CONFIG_VIDEO=y already brings it in.
- Link to v4: https://patch.msgid.link/20260902-add-genio-510-and-genio-700-hdmi-v4-0-7c3b4f068a56@baylibre.com

Changes in v4:
- refresh config fragment with savedefconfig: remove CONFIG_VIDEO_LOGO,
  correctly place CONFIG_WATCHDOG_AUTOSTART
  that is enabled by default
- reword commit message on patch 13: remove useless mentions to larb/vdosys1 aliases that were removed in v3
- Link to v3: https://patch.msgid.link/20260901-add-genio-510-and-genio-700-hdmi-v3-0-38194a531b9f@baylibre.com

Changes in v3:
Across the whole series
- Re-based every register definition on the mainline Linux kernel definitions (upstream names, values and
BIT()/GENMASK()/FIELD_PREP()) instead of the downstream U-Boot ones.
- SPDX fixes: GPL-2.0 / GPL-2.0+ -> GPL-2.0-only on all new driver files, Makefile and Kconfig; relicensed
include/linux/hdmi.h to MIT (it's a partial port of Linux' MIT-licensed header) and added the full MIT permission text.
- Bind on the generic mediatek,mt8195-* fallback compatible (shared IP) rather than the SoC-specific mediatek,mt8188-*:
dpi, ethdr, merge, rdma.
- Makefile/Kconfig header cleanup: copyright set to BayLibre and the obj- list sorted alphabetically.

Per patch
- display pipeline component helpers: reworded the commit message (probe and enable sequence).
- ethdr: use the kernel's parameterized MIX_L_SRC_CON(n)/MIX_L_SRC_SIZE(n) macros, drop the unused *_CK_EN defines, add
BACKGROUND_RELAY to the datapath write; keep the downstream-only L2 select bits behind a comment.
- merge: rename registers to the kernel's DISP_REG_MERGE_* / MERGE_EN; keep the downstream-only CFG_30 behind a comment.
- mutex: make the register offsets index-based (DISP_MUTEX_*(id)) and rename the helper to mtk_disp_mutex_config_hdmi()
so a future DSI user can reuse it.
- padding: rename registers to the kernel's PADDING_CONTROL_REG / PADDING_ENABLE / PADDING_PIC_SIZE_REG.
- rdma: use the kernel's FLD_* fields with FIELD_PREP(); take the stride from the framebuffer line_length instead of
recomputing it; error out if the framebuffer base is above 4 GB (the source-base register is 32-bit), add larb configuration.
- dpi: import mtk_dpi_regs.h verbatim from the mainline kernel and adjust the driver to the upstream names (DPI_RET,
DPI_INPUT_2P_EN, DPI_OUTPUT_1T1P_EN); keep the one downstream-only matrix value (MATRIX_SEL_RGB_TO_BT709) locally.
- include/linux/hdmi.h: MIT relicense (see above).
- hdmi driver: move the register defines into a new mtk_hdmi_regs_v2.h imported verbatim from the mainline kernel;
correct VID_DOWNSAMPLE_CONFIG to 0x8f0 per the MT8390 datasheet (mainline has a wrong 0x8d0 — a separate kernel fix was
sent); remove the dead deep-color code path (the driver only ever drives 8 bpc); drop the unused length argument of the
infoframe helpers; check the RDMA config return value; resolve the vdosys1 syscon via ofnode_by_compatible() instead of
a U-Boot-invented alias.
- dts (reserved-memory): drop the unused splashscreen carveout, keep only the framebuffer region; retitle the patch to
"add framebuffer reserved-memory".
- dts (hdmi override): drop the U-Boot-invented vdosys1 alias (resolved by compatible now) and larb2/larb3 aliases
now resolved using iommus and DT directly inside rdma component.
- configs: use CONFIG_VIDEO_LOGO (show the U-Boot logo) instead of CONFIG_SPLASH_SCREEN, since upstream lacks the
plumbing to make the splash actually work — this also keeps CONFIG_EXPO enabled and drops the now-unneeded CMD_BMP /
BMP_24BPP.
- Link to v2: https://patch.msgid.link/20260826-add-genio-510-and-genio-700-hdmi-v2-0-68ebb1bf17df@baylibre.com

Changes in v2:
- Add a common `get_unaligned_le24()` helper for reading 24-bit little-endian values, ported from kernel
- Add a common `linux/hdmi.h` header with HDMI colorspace and colorimetry enums, based on the corresponding Linux header.
- Refactor the HDMI driver to use the new common HDMI definitions and unaligned access helper.
- Rename the mixer component to ETHDR and configure the ETHDR before the remaining display pipeline components.
- Add the SMI LARB components and configure the VDOSYS1 routing directly from the HDMI driver.
- Switch display component lookup from phandles to DT aliases and add proper error unwinding for component clocks, HDMI PHY power, and clock resources.
- Refactor HDMI register access and InfoFrame handling.
- Improve HDMI mode handling, YUV420 downsampling, TMDS scrambling, deep-color handling, and InfoFrame generation.
- Move framebuffer/splash reserved-memory definitions to the Genio common U-Boot DTSI and add the corresponding HDMI override node for MT8390/Genio EVKs.
- Drop the dedicated MT8188 VDOSYS1 pipeline component and its corresponding DTS node, to avoid having 2 nodes with same reg address.
- Remove the unnecessary `dm_scan_fdt_dev` bind hook from the HDMI driver.
- Link to v1: https://patch.msgid.link/20260728-add-genio-510-and-genio-700-hdmi-v1-0-ac54bd75f960@baylibre.com

To: u-boot@lists.u-boot-project.org
Cc: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Anatolij Gustschin <ag.dev.uboot@gmail.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Igor Belwon <igor.belwon@mentallysanemainliners.org>
Cc: David Lechner <dlechner@baylibre.com>
Cc: Julien Stephan <jstephan@baylibre.com>
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Johan Jonker <jbx6244@gmail.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Pavlo Yadvychuk <pyadvychuk@baylibre.com>
Cc: Macpaul Lin <Macpaul.Lin@mediatek.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Carlo Caione <ccaione@baylibre.com>
Cc: Anshul Dalal <anshuld@ti.com>
Cc: Rasmus Villemoes <ravi@prevas.dk>
Cc: Neha Malcom Francis <n-francis@ti.com>
Cc: Siddharth Vadapalli <s-vadapalli@ti.com>

---
Julien Stephan (12):
      memory: sort the Makefile alphabetically
      memory: mediatek: add SMI larb driver
      video: mediatek: add display pipeline component helpers
      video: mediatek: add ethdr component
      video: mediatek: add merge component
      video: mediatek: add mutex component
      video: mediatek: add padding component
      video: mediatek: add mdp rdma component
      video: mediatek: add dpi1 component
      asm-generic: unaligned: add get_unaligned_le24()
      video: mediatek: add hdmi driver
      configs: mediatek: mt8188: enable hdmi pipeline

 configs/mt8188.config                     |    4 +
 drivers/memory/Kconfig                    |   12 +
 drivers/memory/Makefile                   |    3 +-
 drivers/memory/mtk-smi.c                  |  164 +++++
 drivers/video/Kconfig                     |    1 +
 drivers/video/Makefile                    |    1 +
 drivers/video/mediatek/Kconfig            |   21 +
 drivers/video/mediatek/Makefile           |   15 +
 drivers/video/mediatek/mtk_disp_comp.c    |  123 ++++
 drivers/video/mediatek/mtk_disp_comp.h    |   96 +++
 drivers/video/mediatek/mtk_disp_merge.c   |  155 +++++
 drivers/video/mediatek/mtk_disp_merge.h   |   49 ++
 drivers/video/mediatek/mtk_disp_mutex.c   |   79 +++
 drivers/video/mediatek/mtk_disp_mutex.h   |   21 +
 drivers/video/mediatek/mtk_disp_padding.c |   49 ++
 drivers/video/mediatek/mtk_disp_padding.h |   20 +
 drivers/video/mediatek/mtk_dpi.c          |  372 +++++++++++
 drivers/video/mediatek/mtk_dpi.h          |   34 +
 drivers/video/mediatek/mtk_dpi_regs.h     |  247 +++++++
 drivers/video/mediatek/mtk_ethdr.c        |  106 +++
 drivers/video/mediatek/mtk_ethdr.h        |   39 ++
 drivers/video/mediatek/mtk_hdmi.c         | 1027 +++++++++++++++++++++++++++++
 drivers/video/mediatek/mtk_hdmi_regs_v2.h |  263 ++++++++
 drivers/video/mediatek/mtk_mdp_rdma.c     |  185 ++++++
 drivers/video/mediatek/mtk_mdp_rdma.h     |   36 +
 include/asm-generic/unaligned.h           |   10 +
 include/mtk_smi.h                         |   37 ++
 27 files changed, 3168 insertions(+), 1 deletion(-)
---
base-commit: 677a768c91b2baaefdf09633d1fdb5c9f758674f
change-id: 20260701-add-genio-510-and-genio-700-hdmi-ca62c6b8210c

Best regards,
--  
Julien Stephan <jstephan@baylibre.com>

Comments

David Lechner Oct. 22, 2026, 9:05 p.m. UTC | #1
On Fri, 02 Oct 2026 15:25:34 +0200, Julien Stephan wrote:
> mediatek: add HDMI pipeline support for MT8188 based boards
> 
> This series adds HDMI support for MT8188 based boards, such as the Genio
> 510 and Genio 700 EVKs, in order to display a boot logo over HDMI. It
> builds on top of the HDMI PHY driver [1], the DDC (I2C) driver [2], the
> clock series [3] and a clock fix [4] already sent earlier.
> 
> [...]

Applied to mediatek-for-main, thanks!

[01/12] memory: sort the Makefile alphabetically
        commit: 5fd68a4100e60551dffdf08ba639f431d057bc3e
[02/12] memory: mediatek: add SMI larb driver
        commit: ed242b1b97df91d1a1eef476d782a10ae8d7e4eb
[03/12] video: mediatek: add display pipeline component helpers
        commit: 9d4cb1a32db890945452038737b56b55a445dd1f
[04/12] video: mediatek: add ethdr component
        commit: 53658988ea77f894ac92a90a89ccf698d9e41663
[05/12] video: mediatek: add merge component
        commit: 429aad8d80d0ddd2998057c2f98e0c3513cb01fc
[06/12] video: mediatek: add mutex component
        commit: 07ac492f6563abbc98a2db3d61c3dc17a2d5b354
[07/12] video: mediatek: add padding component
        commit: 3d5c58c3d9405f24563212980efa70079768dcdb
[08/12] video: mediatek: add mdp rdma component
        commit: faa8a32143306c5eb2f3da5d79a6341cd564b85f
[09/12] video: mediatek: add dpi1 component
        commit: 8531c3648904e9a9151635952d570b4e46be3dbc
[10/12] asm-generic: unaligned: add get_unaligned_le24()
        commit: 690fbabbbc8de8a86ab5e41d36fba2431bea5ddd
[11/12] video: mediatek: add hdmi driver
        commit: 7911e0d2f2d7cab4b6fc942c6633fe15983a0f67
[12/12] configs: mediatek: mt8188: enable hdmi pipeline
        commit: 5ce47efe819e2d57dad39f0e4f95881c33be0a51

Best regards,