[PATCH v2 00/30] drm/sun4i: Refactor layer code for proper DE33 support

Jernej Skrabec
2025-11-04T18:10:03Z

Current DE33 support in sun4i-drm driver is based on my PoC code. It was
written with *a lot* of hacks, because it was never meant to be upstreamed.
Fortunately, DT parts were never merged which give us a chance to do it
right.

This is first of three series with proper DE33 support for H616 SoC. It's
the longest, since it prepares terrain for new drivers in remaining series.
Point of this work is to completely decouple mixer and layer code. Till
DE3, mixer and layers were intimately connected. However, from DE33
onwards, this is no longer the case. DE33 and upcoming DE35 planes are
shared comodity between all mixers and can be assigned in any way driver
(or user) prefers. This requires planes code to be completely independent
from mixer. The only exception is mixer clock frequency which is used in
VI scaler, but in that case mixer pointer is obtained through currently
assigned CRTC.

Second series will introduce separate driver for DE33 planes and adjust
mixer code to new DT bindings. Third series will introduce TCON(-TOP)
adjustments, HDMI PHY and finally, DT updates for several boards.

Current WIP code for remaining two series can be found at [1]. Code has
been tested on Tanix TX6, which has DE3, for any regressions and on Myir
MYD-YT507H board [2], which has DE33, with HDMI and LVDS panel outputs
running simultaneously and independently. This confirms that plane code
is properly decoupled.

Please review.

Best regards,
Jernej

[1] https://github.com/jernejsk/linux-1/commits/sun4i-drm-refactor/
[2] https://github.com/jernejsk/linux-1/commits/okt507c-v3

Changes from v1:
- collected tags
- updated commit messages
- added missing kerneldoc description
- moved vi_scaler_num position

Link: https://lore.kernel.org/linux-sunxi/64c0a4e1-15a5-4f41-9fba-852b0e83fd6f@app.fastmail.com/T/#t

Jernej Skrabec (30):
drm/sun4i: mixer: Fix up DE33 channel macros
drm/sun4i: mixer: Remove ccsc cfg for >= DE3
drm/sun4i: de2: Initialize layer fields earlier
drm/sun4i: ui_layer: Move check from update to check callback
drm/sun4i: vi_layer: Move check from update to check callback
drm/sun4i: layers: Make atomic commit functions void
drm/sun4i: Move blender config from layers to mixer
drm/sun4i: ui layer: Write attributes in one go
drm/sun4i: vi layer: Write attributes in one go
drm/sun4i: mixer: Move layer enabling to atomic_update
drm/sun4i: de2/de3: Simplify CSC config interface
drm/sun4i: csc: Simplify arguments with taking plane state
drm/sun4i: de2/de3: Move plane type determination to mixer
drm/sun4i: ui_layer: Change index meaning
drm/sun4i: layer: move num of planes calc out of layer code
drm/sun4i: ui_layer: use layer struct instead of multiple args
drm/sun4i: vi_layer: use layer struct instead of multiple args
drm/sun4i: ui_scaler: use layer instead of mixer for args
drm/sun4i: vi_scaler: use layer instead of mixer for args
drm/sun4i: layers: Make regmap for layers configurable
drm/sun4i: csc: use layer arg instead of mixer
drm/sun4i: layers: add physical index arg
drm/sun4i: vi_scaler: Update DE33 base calculation
drm/sun4i: mixer: Convert heuristics to quirk
drm/sun4i: ui_scaler: drop sanity checks
drm/sun4i: mixer: Add quirk for number of VI scalers
drm/sun4i: mixer: split out layer config
drm/sun4i: layer: replace mixer with layer struct
drm/sun4i: vi_scaler: Find mixer from crtc
drm/sun4i: Nuke mixer pointer from layer code

drivers/gpu/drm/sun4i/sun8i_csc.c | 113 ++++++-----
drivers/gpu/drm/sun4i/sun8i_csc.h | 16 +-
drivers/gpu/drm/sun4i/sun8i_mixer.c | 217 +++++++++++++--------
drivers/gpu/drm/sun4i/sun8i_mixer.h | 65 ++++---
drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 183 +++++++-----------
drivers/gpu/drm/sun4i/sun8i_ui_layer.h | 7 +-
drivers/gpu/drm/sun4i/sun8i_ui_scaler.c | 44 ++---
drivers/gpu/drm/sun4i/sun8i_ui_scaler.h | 4 +-
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 244 +++++++++---------------
drivers/gpu/drm/sun4i/sun8i_vi_layer.h | 7 +-
drivers/gpu/drm/sun4i/sun8i_vi_scaler.c | 51 ++---
drivers/gpu/drm/sun4i/sun8i_vi_scaler.h | 6 +-
12 files changed, 475 insertions(+), 482 deletions(-)

--
2.51.2