[00/35] drm/panel: let the panels use the atomic state

Message ID 20261026-drm-panel-funcs-v1-0-5e3070a3478f@oss.qualcomm.com (mailing list archive)
Headers
Series drm/panel: let the panels use the atomic state |

Message

Dmitry Baryshkov Oct. 26, 2026, 11:09 a.m. UTC
The panel is the only element of the display pipeline which never sees
the atomic commit. Its prepare() and enable() callbacks get nothing but
the panel, so a panel which has to be programmed differently depending
on the mode can only guess it. The NT35950 driver, for example, saves
the connector in get_modes() and reads connector->state->crtc->state
while being prepared: without the locks, from the current state rather
than from the one being committed, and with no way to reject a mode it
doesn't know.

Every panel has a struct drm_bridge embedded into it, and the bridge
already has all the missing parts: atomic_check(), a state object which
can be subclassed and the commit passed to the callbacks. Rather than
growing struct drm_panel_funcs into a copy of that, let the panel driver
provide struct drm_bridge_funcs for the embedded bridge. This is opt-in:
the panels which have no use for the atomic state keep using struct
drm_panel_funcs and are not touched by it.

To get there the bridge callbacks become the entry point to the panel,
with drm_panel_prepare() and friends calling them rather than the other
way around. The panel core still has to track the panel state, notify
the panel followers and handle the backlight, so the driver doesn't fill
in the power callbacks directly, it wraps its functions with the macros
doing that part. NT35950 is converted as the first user.

The bulk of the series is the cleanup of what the panel core and the
bridge need from the panel driver, so that a panel providing the bridge
callbacks doesn't need struct drm_panel_funcs for anything:

- get_timings() had no callers.

- The connector type was stored both in the panel and in its bridge, and
  the display drivers could override it while creating the panel bridge.

- The orientation was read from the DT, stored and returned by nearly
  identical code in more than twenty panel drivers, and some of them
  also had to set it on the connector from get_modes(), with a TODO
  asking for a better place. The core reads it now. It is applied to the
  connector from the new connector_init() bridge callback, which is not
  specific to the panels: other bridges have properties to set up on the
  connector being created too (HDCP, DP link properties), and currently
  have nowhere to do it.

- disable() and unprepare() returned an error which nobody could act on.
  Worse, a failed unprepare() left the panel marked as prepared, so it
  was never initialised again.

Behaviour changes worth knowing about:

- Panels with the rotation property whose driver ignored it now get the
  orientation property. In the tree this is the Motorola Mapphone panel
  (panel-dsi-cm).

- sun6i_mipi_dsi, sti_dvo and the Tegra DSI get their panel after the
  DRM device has been registered, which is too late to create the
  property, so they lose the orientation which the panel drivers used to
  set from get_modes(). None of the rotated panels in the tree are used
  with them.

- A panel implementing atomic_check() can only be driven through the
  bridge chain. The display drivers calling drm_panel_prepare() directly
  have no commit to pass.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
Dmitry Baryshkov (35):
      drm/panel: remove the get_timings() callback
      drm/panel: remove the unused struct panel_bridge
      drm/tidss: get the panel type from the embedded bridge
      drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
      drm/ingenic: use devm_drm_panel_bridge_add()
      drm: mxsfb: use devm_drm_panel_bridge_add()
      drm: rcar-du: use devm_drm_panel_bridge_add()
      drm: rz-du: use devm_drm_panel_bridge_add()
      drm/mcde: use drm_panel_bridge_add()
      drm/pl111: use drm_panel_bridge_add()
      drm/rockchip: lvds: use drm_panel_bridge_add()
      drm/rockchip: rgb: use drm_panel_bridge_add()
      drm/panel: remove the _typed() panel bridge functions
      drm/panel: remove drm_panel.connector_type
      drm/bridge: anx6345: set the panel orientation on the connector
      drm/exynos: dpi: set the panel orientation on the connector
      drm/fsl-dcu: set the panel orientation on the connector
      drm/logicvc: set the panel orientation on the connector
      drm/stm: lvds: set the panel orientation on the connector
      drm/sun4i: set the panel orientation on the connector
      drm/tegra: sor: set the panel orientation on the connector
      drm/panel: drop the orientation workaround from get_modes()
      drm/panel: read the panel orientation in the core
      drm/panel: use the orientation from the panel core
      drm/panel: remove the get_orientation() callback
      drm/bridge: add the connector_init callback
      drm/bridge-connector: let the bridges set up the connector
      drm/panel: let the bridges set up the panel connector
      drm/panel: set the orientation from the connector_init callback
      drm/panel: make the disable and unprepare callbacks return void
      drm/panel: don't hold the follower lock over the panel callbacks
      drm/panel: route the panel calls through the bridge callbacks
      drm/panel: let the panel drivers provide struct drm_bridge_funcs
      drm/panel: novatek-nt35950: provide struct drm_bridge_funcs
      drm/panel: novatek-nt35950: use the atomic state to select the mode

 Documentation/gpu/todo.rst                         |   1 -
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |   5 +
 drivers/gpu/drm/bridge/lvds-codec.c                |   3 +-
 drivers/gpu/drm/display/drm_bridge_connector.c     |  12 +-
 drivers/gpu/drm/drm_bridge.c                       |  31 +
 drivers/gpu/drm/drm_connector.c                    |   8 +-
 drivers/gpu/drm/drm_panel.c                        | 653 +++++++++++++--------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c            |   1 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |   5 +
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c          |   3 +-
 drivers/gpu/drm/logicvc/logicvc_interface.c        |   7 +
 drivers/gpu/drm/mcde/mcde_drv.c                    |   3 +-
 drivers/gpu/drm/mxsfb/mxsfb_drv.c                  |   3 +-
 drivers/gpu/drm/panel/panel-abt-y030xx067a.c       |   8 +-
 drivers/gpu/drm/panel/panel-anbernic-td4310.c      |  18 +-
 drivers/gpu/drm/panel/panel-arm-versatile.c        |   4 +-
 .../gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c   |   4 +-
 drivers/gpu/drm/panel/panel-auo-a030jtn01.c        |   8 +-
 drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c     |   4 +-
 drivers/gpu/drm/panel/panel-boe-himax8279d.c       |  12 +-
 drivers/gpu/drm/panel/panel-boe-td4320.c           |   4 +-
 .../gpu/drm/panel/panel-boe-th101mb31ig002-28a.c   |  33 +-
 drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c     |   4 +-
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c     |  30 +-
 drivers/gpu/drm/panel/panel-chipone-icna35xx.c     |  24 +-
 drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c  |  24 +-
 drivers/gpu/drm/panel/panel-dsi-cm.c               |  11 +-
 drivers/gpu/drm/panel/panel-ebbg-ft8719.c          |   8 +-
 drivers/gpu/drm/panel/panel-edp.c                  |  53 +-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c       |  22 +-
 drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c  |   8 +-
 .../gpu/drm/panel/panel-feiyang-fy07024di26a30d.c  |   8 +-
 drivers/gpu/drm/panel/panel-focaltech-ota7290b.c   |  21 +-
 drivers/gpu/drm/panel/panel-himax-hx8279.c         |   8 +-
 drivers/gpu/drm/panel/panel-himax-hx83102.c        |  22 +-
 drivers/gpu/drm/panel/panel-himax-hx83112a.c       |   8 +-
 drivers/gpu/drm/panel/panel-himax-hx83112b.c       |   4 +-
 drivers/gpu/drm/panel/panel-himax-hx83121a.c       |   4 +-
 drivers/gpu/drm/panel/panel-himax-hx8394.c         |  24 +-
 drivers/gpu/drm/panel/panel-hydis-hv101hd1.c       |   8 +-
 drivers/gpu/drm/panel/panel-ilitek-ili7807s.c      |   4 +-
 drivers/gpu/drm/panel/panel-ilitek-ili7836a.c      |  24 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c       |  12 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c       |   7 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9488.c       |  18 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9805.c       |   4 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c  |  18 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c  |   4 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c      |  31 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9882t.c      |  24 +-
 drivers/gpu/drm/panel/panel-innolux-ej030na.c      |   8 +-
 drivers/gpu/drm/panel/panel-innolux-p079zca.c      |  10 +-
 drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c   |  21 +-
 drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c       |   4 +-
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c      |  12 +-
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     |   8 +-
 drivers/gpu/drm/panel/panel-khadas-ts050.c         |  12 +-
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |  14 +-
 drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c |   6 +-
 drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c |   4 +-
 drivers/gpu/drm/panel/panel-lg-lb035q02.c          |   4 +-
 drivers/gpu/drm/panel/panel-lg-ld070wx3.c          |   4 +-
 drivers/gpu/drm/panel/panel-lg-lg4573.c            |   4 +-
 drivers/gpu/drm/panel/panel-lg-sw43408.c           |   7 +-
 drivers/gpu/drm/panel/panel-lincolntech-lcd197.c   |   8 +-
 drivers/gpu/drm/panel/panel-lvds.c                 |  25 +-
 drivers/gpu/drm/panel/panel-lxd-m9189a.c           |   8 +-
 .../gpu/drm/panel/panel-magnachip-d53e6ea8966.c    |   8 +-
 drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c   |   8 +-
 drivers/gpu/drm/panel/panel-motorola-mot.c         |   8 +-
 drivers/gpu/drm/panel/panel-nec-nl8048hl11.c       |   4 +-
 drivers/gpu/drm/panel/panel-newvision-nv3051d.c    |   6 +-
 drivers/gpu/drm/panel/panel-newvision-nv3052c.c    |  12 +-
 drivers/gpu/drm/panel/panel-novatek-nt35510.c      |  12 +-
 drivers/gpu/drm/panel/panel-novatek-nt35532.c      |   4 +-
 drivers/gpu/drm/panel/panel-novatek-nt35560.c      |   6 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c      | 168 ++++--
 drivers/gpu/drm/panel/panel-novatek-nt36523.c      |  24 +-
 drivers/gpu/drm/panel/panel-novatek-nt36532.c      |   4 +-
 drivers/gpu/drm/panel/panel-novatek-nt36536.c      |   4 +-
 drivers/gpu/drm/panel/panel-novatek-nt36672a.c     |   4 +-
 drivers/gpu/drm/panel/panel-novatek-nt36672e.c     |   4 +-
 drivers/gpu/drm/panel/panel-novatek-nt37700f.c     |   8 +-
 drivers/gpu/drm/panel/panel-novatek-nt37801.c      |   4 +-
 drivers/gpu/drm/panel/panel-novatek-nt39016.c      |  12 +-
 drivers/gpu/drm/panel/panel-novatek-nt51021.c      |   4 +-
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c |   4 +-
 drivers/gpu/drm/panel/panel-orisetech-ota5601a.c   |  12 +-
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   |   8 +-
 drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c |   8 +-
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   |   7 +-
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  |   7 +-
 drivers/gpu/drm/panel/panel-raydium-rm67191.c      |  16 +-
 drivers/gpu/drm/panel/panel-raydium-rm67200.c      |   8 +-
 drivers/gpu/drm/panel/panel-raydium-rm68200.c      |   4 +-
 drivers/gpu/drm/panel/panel-raydium-rm69220.c      |   4 +-
 drivers/gpu/drm/panel/panel-raydium-rm692e5.c      |   8 +-
 drivers/gpu/drm/panel/panel-raydium-rm69380.c      |   4 +-
 drivers/gpu/drm/panel/panel-renesas-r61307.c       |   8 +-
 drivers/gpu/drm/panel/panel-renesas-r63419.c       |  25 +-
 drivers/gpu/drm/panel/panel-renesas-r69328.c       |   8 +-
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c       |   7 +-
 drivers/gpu/drm/panel/panel-samsung-ams581vf01.c   |   4 +-
 drivers/gpu/drm/panel/panel-samsung-ams639rq08.c   |   4 +-
 drivers/gpu/drm/panel/panel-samsung-atna33xc20.c   |  14 +-
 drivers/gpu/drm/panel/panel-samsung-db7430.c       |   8 +-
 drivers/gpu/drm/panel/panel-samsung-ld9040.c       |   7 +-
 drivers/gpu/drm/panel/panel-samsung-ltl106hl02.c   |   4 +-
 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c      |   8 +-
 drivers/gpu/drm/panel/panel-samsung-s6d27a1.c      |   8 +-
 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c      |   8 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c      |   8 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c   |   8 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      |  16 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c      |   8 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   |  14 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c      |  13 +-
 .../drm/panel/panel-samsung-s6e88a0-ams427ap24.c   |   4 +-
 .../drm/panel/panel-samsung-s6e88a0-ams452ef01.c   |   4 +-
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c      |   7 +-
 .../panel/panel-samsung-s6e8aa5x01-ams561ra01.c    |   8 +-
 .../gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c  |   4 +-
 drivers/gpu/drm/panel/panel-samsung-sofef00.c      |   8 +-
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c        |  22 +-
 drivers/gpu/drm/panel/panel-sharp-lq079l1sx01.c    |   4 +-
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c    |   4 +-
 drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c    |   7 +-
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c    |   6 +-
 drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c    |   4 +-
 drivers/gpu/drm/panel/panel-simple.c               |  53 +-
 drivers/gpu/drm/panel/panel-sitronix-st7701.c      |  28 +-
 drivers/gpu/drm/panel/panel-sitronix-st7703.c      |  22 +-
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c     |  35 +-
 drivers/gpu/drm/panel/panel-sony-acx565akm.c       |   4 +-
 drivers/gpu/drm/panel/panel-sony-td4353-jdi.c      |   4 +-
 .../gpu/drm/panel/panel-sony-tulip-truly-nt35521.c |   8 +-
 .../gpu/drm/panel/panel-startek-kd070fhfid015.c    |   4 +-
 drivers/gpu/drm/panel/panel-synaptics-r63353.c     |   4 +-
 drivers/gpu/drm/panel/panel-synaptics-tddi.c       |   8 +-
 drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c       |   4 +-
 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c       |   8 +-
 drivers/gpu/drm/panel/panel-tpo-td043mtea1.c       |   4 +-
 drivers/gpu/drm/panel/panel-tpo-tpg110.c           |   4 +-
 drivers/gpu/drm/panel/panel-truly-nt35597.c        |   8 +-
 drivers/gpu/drm/panel/panel-visionox-g2647fb105.c  |   4 +-
 drivers/gpu/drm/panel/panel-visionox-r66451.c      |   8 +-
 drivers/gpu/drm/panel/panel-visionox-rm69299.c     |   4 +-
 drivers/gpu/drm/panel/panel-visionox-rm692e5.c     |   8 +-
 drivers/gpu/drm/panel/panel-visionox-vtdr6130.c    |  20 +-
 drivers/gpu/drm/panel/panel-widechips-ws2401.c     |   8 +-
 drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c   |   6 +-
 drivers/gpu/drm/pl111/pl111_drv.c                  |   3 +-
 drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c  |   5 +-
 drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c   |   5 +-
 drivers/gpu/drm/rockchip/rockchip_lvds.c           |   2 +-
 drivers/gpu/drm/rockchip/rockchip_rgb.c            |   3 +-
 drivers/gpu/drm/stm/lvds.c                         |   4 +
 drivers/gpu/drm/sun4i/sun4i_lvds.c                 |   2 +
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   2 +
 drivers/gpu/drm/tegra/sor.c                        |   2 +
 drivers/gpu/drm/tidss/tidss_kms.c                  |   4 +-
 include/drm/drm_bridge.h                           |  23 +
 include/drm/drm_panel.h                            | 219 +++++--
 163 files changed, 1080 insertions(+), 1532 deletions(-)
---
base-commit: 4305aa866f20288739b680c75fd44d9f029b0c0b
change-id: 20261013-drm-panel-funcs-0fbc59bd8790

Best regards,
--  
With best wishes
Dmitry
  

Comments

Dmitry Baryshkov Oct. 27, 2026, 12:02 p.m. UTC | #1
On Mon, Oct 26, 2026 at 01:09:49PM +0200, Dmitry Baryshkov wrote:
> The panel is the only element of the display pipeline which never sees
> the atomic commit. Its prepare() and enable() callbacks get nothing but
> the panel, so a panel which has to be programmed differently depending
> on the mode can only guess it. The NT35950 driver, for example, saves
> the connector in get_modes() and reads connector->state->crtc->state
> while being prepared: without the locks, from the current state rather
> than from the one being committed, and with no way to reject a mode it
> doesn't know.
> 
> Every panel has a struct drm_bridge embedded into it, and the bridge
> already has all the missing parts: atomic_check(), a state object which
> can be subclassed and the commit passed to the callbacks. Rather than
> growing struct drm_panel_funcs into a copy of that, let the panel driver
> provide struct drm_bridge_funcs for the embedded bridge. This is opt-in:
> the panels which have no use for the atomic state keep using struct
> drm_panel_funcs and are not touched by it.
> 
> To get there the bridge callbacks become the entry point to the panel,
> with drm_panel_prepare() and friends calling them rather than the other
> way around. The panel core still has to track the panel state, notify
> the panel followers and handle the backlight, so the driver doesn't fill
> in the power callbacks directly, it wraps its functions with the macros
> doing that part. NT35950 is converted as the first user.
> 
> The bulk of the series is the cleanup of what the panel core and the
> bridge need from the panel driver, so that a panel providing the bridge
> callbacks doesn't need struct drm_panel_funcs for anything:
> 
> - get_timings() had no callers.
> 
> - The connector type was stored both in the panel and in its bridge, and
>   the display drivers could override it while creating the panel bridge.
> 
> - The orientation was read from the DT, stored and returned by nearly
>   identical code in more than twenty panel drivers, and some of them
>   also had to set it on the connector from get_modes(), with a TODO
>   asking for a better place. The core reads it now. It is applied to the
>   connector from the new connector_init() bridge callback, which is not
>   specific to the panels: other bridges have properties to set up on the
>   connector being created too (HDCP, DP link properties), and currently
>   have nowhere to do it.
> 
> - disable() and unprepare() returned an error which nobody could act on.
>   Worse, a failed unprepare() left the panel marked as prepared, so it
>   was never initialised again.
> 
> Behaviour changes worth knowing about:
> 
> - Panels with the rotation property whose driver ignored it now get the
>   orientation property. In the tree this is the Motorola Mapphone panel
>   (panel-dsi-cm).
> 
> - sun6i_mipi_dsi, sti_dvo and the Tegra DSI get their panel after the
>   DRM device has been registered, which is too late to create the
>   property, so they lose the orientation which the panel drivers used to
>   set from get_modes(). None of the rotated panels in the tree are used
>   with them.
> 
> - A panel implementing atomic_check() can only be driven through the
>   bridge chain. The display drivers calling drm_panel_prepare() directly
>   have no commit to pass.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> Dmitry Baryshkov (35):
>       drm/panel: remove the get_timings() callback
>       drm/panel: remove the unused struct panel_bridge
>       drm/tidss: get the panel type from the embedded bridge
>       drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
>       drm/ingenic: use devm_drm_panel_bridge_add()
>       drm: mxsfb: use devm_drm_panel_bridge_add()
>       drm: rcar-du: use devm_drm_panel_bridge_add()
>       drm: rz-du: use devm_drm_panel_bridge_add()
>       drm/mcde: use drm_panel_bridge_add()
>       drm/pl111: use drm_panel_bridge_add()
>       drm/rockchip: lvds: use drm_panel_bridge_add()
>       drm/rockchip: rgb: use drm_panel_bridge_add()
>       drm/panel: remove the _typed() panel bridge functions

Gmail barked at me for sending too many emails for too many recipients
in the middle of the series. I guess, I'll have to split the series into
smaller parts. Please consider reviewing the posted patches, letting me
split / land the series in parts.

>       drm/panel: remove drm_panel.connector_type
>       drm/bridge: anx6345: set the panel orientation on the connector
>       drm/exynos: dpi: set the panel orientation on the connector
>       drm/fsl-dcu: set the panel orientation on the connector
>       drm/logicvc: set the panel orientation on the connector
>       drm/stm: lvds: set the panel orientation on the connector
>       drm/sun4i: set the panel orientation on the connector
>       drm/tegra: sor: set the panel orientation on the connector
>       drm/panel: drop the orientation workaround from get_modes()
>       drm/panel: read the panel orientation in the core
>       drm/panel: use the orientation from the panel core
>       drm/panel: remove the get_orientation() callback
>       drm/bridge: add the connector_init callback
>       drm/bridge-connector: let the bridges set up the connector
>       drm/panel: let the bridges set up the panel connector
>       drm/panel: set the orientation from the connector_init callback
>       drm/panel: make the disable and unprepare callbacks return void
>       drm/panel: don't hold the follower lock over the panel callbacks
>       drm/panel: route the panel calls through the bridge callbacks
>       drm/panel: let the panel drivers provide struct drm_bridge_funcs
>       drm/panel: novatek-nt35950: provide struct drm_bridge_funcs
>       drm/panel: novatek-nt35950: use the atomic state to select the mode
>
  
Luca Ceresoli Oct. 30, 2026, 5:31 p.m. UTC | #2
Hi Dmitry,

On Tue Oct 27, 2026 at 1:02 PM CET, Dmitry Baryshkov wrote:
> On Mon, Oct 26, 2026 at 01:09:49PM +0200, Dmitry Baryshkov wrote:
>> The panel is the only element of the display pipeline which never sees
>> the atomic commit. Its prepare() and enable() callbacks get nothing but
>> the panel, so a panel which has to be programmed differently depending
>> on the mode can only guess it. The NT35950 driver, for example, saves
>> the connector in get_modes() and reads connector->state->crtc->state
>> while being prepared: without the locks, from the current state rather
>> than from the one being committed, and with no way to reject a mode it
>> doesn't know.
>>
>> Every panel has a struct drm_bridge embedded into it, and the bridge
>> already has all the missing parts: atomic_check(), a state object which
>> can be subclassed and the commit passed to the callbacks. Rather than
>> growing struct drm_panel_funcs into a copy of that, let the panel driver
>> provide struct drm_bridge_funcs for the embedded bridge. This is opt-in:
>> the panels which have no use for the atomic state keep using struct
>> drm_panel_funcs and are not touched by it.
>>
>> To get there the bridge callbacks become the entry point to the panel,
>> with drm_panel_prepare() and friends calling them rather than the other
>> way around. The panel core still has to track the panel state, notify
>> the panel followers and handle the backlight, so the driver doesn't fill
>> in the power callbacks directly, it wraps its functions with the macros
>> doing that part. NT35950 is converted as the first user.
>>
>> The bulk of the series is the cleanup of what the panel core and the
>> bridge need from the panel driver, so that a panel providing the bridge
>> callbacks doesn't need struct drm_panel_funcs for anything:
>>
>> - get_timings() had no callers.
>>
>> - The connector type was stored both in the panel and in its bridge, and
>>   the display drivers could override it while creating the panel bridge.
>>
>> - The orientation was read from the DT, stored and returned by nearly
>>   identical code in more than twenty panel drivers, and some of them
>>   also had to set it on the connector from get_modes(), with a TODO
>>   asking for a better place. The core reads it now. It is applied to the
>>   connector from the new connector_init() bridge callback, which is not
>>   specific to the panels: other bridges have properties to set up on the
>>   connector being created too (HDCP, DP link properties), and currently
>>   have nowhere to do it.
>>
>> - disable() and unprepare() returned an error which nobody could act on.
>>   Worse, a failed unprepare() left the panel marked as prepared, so it
>>   was never initialised again.
>>
>> Behaviour changes worth knowing about:
>>
>> - Panels with the rotation property whose driver ignored it now get the
>>   orientation property. In the tree this is the Motorola Mapphone panel
>>   (panel-dsi-cm).
>>
>> - sun6i_mipi_dsi, sti_dvo and the Tegra DSI get their panel after the
>>   DRM device has been registered, which is too late to create the
>>   property, so they lose the orientation which the panel drivers used to
>>   set from get_modes(). None of the rotated panels in the tree are used
>>   with them.
>>
>> - A panel implementing atomic_check() can only be driven through the
>>   bridge chain. The display drivers calling drm_panel_prepare() directly
>>   have no commit to pass.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> ---
>> Dmitry Baryshkov (35):
>>       drm/panel: remove the get_timings() callback
>>       drm/panel: remove the unused struct panel_bridge
>>       drm/tidss: get the panel type from the embedded bridge
>>       drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
>>       drm/ingenic: use devm_drm_panel_bridge_add()
>>       drm: mxsfb: use devm_drm_panel_bridge_add()
>>       drm: rcar-du: use devm_drm_panel_bridge_add()
>>       drm: rz-du: use devm_drm_panel_bridge_add()
>>       drm/mcde: use drm_panel_bridge_add()
>>       drm/pl111: use drm_panel_bridge_add()
>>       drm/rockchip: lvds: use drm_panel_bridge_add()
>>       drm/rockchip: rgb: use drm_panel_bridge_add()
>>       drm/panel: remove the _typed() panel bridge functions
>
> Gmail barked at me for sending too many emails for too many recipients
> in the middle of the series. I guess, I'll have to split the series into
> smaller parts. Please consider reviewing the posted patches, letting me
> split / land the series in parts.

The first 13~14 patches are nice and fairly independent cleanups. I guess
they can be sent separately, or just be applied. However I'd still want to
review patch 14 and do some testing next week before I consider them ready
for applying.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
  
Dmitry Baryshkov Oct. 31, 2026, 4:44 p.m. UTC | #3
On Fri, Oct 30, 2026 at 06:31:02PM +0100, Luca Ceresoli wrote:
> Hi Dmitry,
> 
> On Tue Oct 27, 2026 at 1:02 PM CET, Dmitry Baryshkov wrote:
> > On Mon, Oct 26, 2026 at 01:09:49PM +0200, Dmitry Baryshkov wrote:
> >> The panel is the only element of the display pipeline which never sees
> >> the atomic commit. Its prepare() and enable() callbacks get nothing but
> >> the panel, so a panel which has to be programmed differently depending
> >> on the mode can only guess it. The NT35950 driver, for example, saves
> >> the connector in get_modes() and reads connector->state->crtc->state
> >> while being prepared: without the locks, from the current state rather
> >> than from the one being committed, and with no way to reject a mode it
> >> doesn't know.
> >>
> >> Every panel has a struct drm_bridge embedded into it, and the bridge
> >> already has all the missing parts: atomic_check(), a state object which
> >> can be subclassed and the commit passed to the callbacks. Rather than
> >> growing struct drm_panel_funcs into a copy of that, let the panel driver
> >> provide struct drm_bridge_funcs for the embedded bridge. This is opt-in:
> >> the panels which have no use for the atomic state keep using struct
> >> drm_panel_funcs and are not touched by it.
> >>
> >> To get there the bridge callbacks become the entry point to the panel,
> >> with drm_panel_prepare() and friends calling them rather than the other
> >> way around. The panel core still has to track the panel state, notify
> >> the panel followers and handle the backlight, so the driver doesn't fill
> >> in the power callbacks directly, it wraps its functions with the macros
> >> doing that part. NT35950 is converted as the first user.
> >>
> >> The bulk of the series is the cleanup of what the panel core and the
> >> bridge need from the panel driver, so that a panel providing the bridge
> >> callbacks doesn't need struct drm_panel_funcs for anything:
> >>
> >> - get_timings() had no callers.
> >>
> >> - The connector type was stored both in the panel and in its bridge, and
> >>   the display drivers could override it while creating the panel bridge.
> >>
> >> - The orientation was read from the DT, stored and returned by nearly
> >>   identical code in more than twenty panel drivers, and some of them
> >>   also had to set it on the connector from get_modes(), with a TODO
> >>   asking for a better place. The core reads it now. It is applied to the
> >>   connector from the new connector_init() bridge callback, which is not
> >>   specific to the panels: other bridges have properties to set up on the
> >>   connector being created too (HDCP, DP link properties), and currently
> >>   have nowhere to do it.
> >>
> >> - disable() and unprepare() returned an error which nobody could act on.
> >>   Worse, a failed unprepare() left the panel marked as prepared, so it
> >>   was never initialised again.
> >>
> >> Behaviour changes worth knowing about:
> >>
> >> - Panels with the rotation property whose driver ignored it now get the
> >>   orientation property. In the tree this is the Motorola Mapphone panel
> >>   (panel-dsi-cm).
> >>
> >> - sun6i_mipi_dsi, sti_dvo and the Tegra DSI get their panel after the
> >>   DRM device has been registered, which is too late to create the
> >>   property, so they lose the orientation which the panel drivers used to
> >>   set from get_modes(). None of the rotated panels in the tree are used
> >>   with them.
> >>
> >> - A panel implementing atomic_check() can only be driven through the
> >>   bridge chain. The display drivers calling drm_panel_prepare() directly
> >>   have no commit to pass.
> >>
> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> >> ---
> >> Dmitry Baryshkov (35):
> >>       drm/panel: remove the get_timings() callback
> >>       drm/panel: remove the unused struct panel_bridge
> >>       drm/tidss: get the panel type from the embedded bridge
> >>       drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
> >>       drm/ingenic: use devm_drm_panel_bridge_add()
> >>       drm: mxsfb: use devm_drm_panel_bridge_add()
> >>       drm: rcar-du: use devm_drm_panel_bridge_add()
> >>       drm: rz-du: use devm_drm_panel_bridge_add()
> >>       drm/mcde: use drm_panel_bridge_add()
> >>       drm/pl111: use drm_panel_bridge_add()
> >>       drm/rockchip: lvds: use drm_panel_bridge_add()
> >>       drm/rockchip: rgb: use drm_panel_bridge_add()
> >>       drm/panel: remove the _typed() panel bridge functions
> >
> > Gmail barked at me for sending too many emails for too many recipients
> > in the middle of the series. I guess, I'll have to split the series into
> > smaller parts. Please consider reviewing the posted patches, letting me
> > split / land the series in parts.
> 
> The first 13~14 patches are nice and fairly independent cleanups. I guess
> they can be sent separately, or just be applied. However I'd still want to
> review patch 14 and do some testing next week before I consider them ready
> for applying.

Sounds like a plan. Would you ack the patch 14? I'll review and repost
patches 15+.
  
Luca Ceresoli Nov. 4, 2026, 5:14 p.m. UTC | #4
Hi Dmitry,

On Sat Oct 31, 2026 at 5:44 PM CET, Dmitry Baryshkov wrote:
...
>> The first 13~14 patches are nice and fairly independent cleanups. I guess
>> they can be sent separately, or just be applied. However I'd still want to
>> review patch 14 and do some testing next week before I consider them ready
>> for applying.
>
> Sounds like a plan. Would you ack the patch 14? I'll review and repost
> patches 15+.

Just did that, and also reuntime tested patches 1-14.

Aren't patches 15-25 another self-contained batch, that might be sent on
its own?

Ah, hopefully if you repost the series without parthes 1-14 (after they are
applied I mean) this will reduce the Cc list too.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
  
Luca Ceresoli Nov. 23, 2026, 12:49 p.m. UTC | #5
On Mon, 26 Oct 2026 13:09:49 +0200, Dmitry Baryshkov wrote:
> The panel is the only element of the display pipeline which never sees
> the atomic commit. Its prepare() and enable() callbacks get nothing but
> the panel, so a panel which has to be programmed differently depending
> on the mode can only guess it. The NT35950 driver, for example, saves
> the connector in get_modes() and reads connector->state->crtc->state
> while being prepared: without the locks, from the current state rather
> than from the one being committed, and with no way to reject a mode it
> doesn't know.
> 
> [...]

Applied, thanks!

[01/35] drm/panel: remove the get_timings() callback
        commit: 874b9d3ad6e0087ea21aafcb2ada3f6a6a8c5a1c
[02/35] drm/panel: remove the unused struct panel_bridge
        commit: 83fa60df1302667ce139457208aee277067732db
[03/35] drm/tidss: get the panel type from the embedded bridge
        commit: eb5352d63fee9733f798f53e0418c17a5184d258
[04/35] drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
        commit: 4afe0e580a135dd4917486ccf7cff3442b6596ff
[05/35] drm/ingenic: use devm_drm_panel_bridge_add()
        commit: cfac2956bdaabec099fdc471ebd9ae9ac0defd65
[06/35] drm: mxsfb: use devm_drm_panel_bridge_add()
        commit: f88a377f94b03796ea5c7d62fb3b061f6a0bb040
[07/35] drm: rcar-du: use devm_drm_panel_bridge_add()
        commit: a57b24576b38dafdcd859aff8f129c0c0a29fd04
[08/35] drm: rz-du: use devm_drm_panel_bridge_add()
        commit: 666e1e77703cbcff43d48e77a24f72e4147510d8
[09/35] drm/mcde: use drm_panel_bridge_add()
        commit: 0f7bcd3b5439845acfa6a381a7cc314262b2d4fe
[10/35] drm/pl111: use drm_panel_bridge_add()
        commit: 3f603bf783886f681721218aae4c8c709ee961bf
[11/35] drm/rockchip: lvds: use drm_panel_bridge_add()
        commit: 8165f8e83c3a660b7311337aae0469d760ff5f26
[12/35] drm/rockchip: rgb: use drm_panel_bridge_add()
        commit: 66acc28d44cd41d9ad63be5840556450f84f6b50
[13/35] drm/panel: remove the _typed() panel bridge functions
        commit: bbdf706498e19c35c56e3d69178c3e833f014e06
[14/35] drm/panel: remove drm_panel.connector_type
        commit: 5888187709034391aaf7f1ab8d4910285f0b404f

Best regards,