drm/panel: let the panels use the atomic state
Subsystems (36)
cover drm/panel: let the panels use the atomic state
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.
---
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,
Signature · 2 lines
With best wishes Dmitry
PATCH 1/35 drm/panel: remove the get_timings() callback
Nothing has ever called get_timings() since it was introduced in commit 2938931f3732 ("drm/panel: Add display timing support"). Remove it together with its three implementations.
--- drivers/gpu/drm/panel/panel-edp.c | 18 ------------------ drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------ drivers/gpu/drm/panel/panel-simple.c | 18 ------------------ include/drm/drm_panel.h | 12 ------------ 4 files changed, 66 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +0 -18
@@ -646,23 +646,6 @@ static int panel_edp_get_modes(struct drm_panel *panel,return num; } -static int panel_edp_get_timings (struct drm_panel *panel, -unsigned int num_timings, -struct display_timing *timings) -{ -struct panel_edp *p =to_panel_edp (panel); -unsigned int i; - -if (p->desc->num_timings < num_timings) - num_timings = p->desc->num_timings; - -if (timings) -for (i =0 ; i < num_timings; i++) - timings[i] = p->desc->timings[i]; - -return p->desc->num_timings; -} -static enum drm_panel_orientation panel_edp_get_orientation (struct drm_panel *panel) {struct panel_edp *p =to_panel_edp (panel);
@@ -699,7 +682,6 @@ static const struct drm_panel_funcs panel_edp_funcs = { .enable = panel_edp_enable, .get_modes = panel_edp_get_modes, .get_orientation = panel_edp_get_orientation, - .get_timings = panel_edp_get_timings, .debugfs_init = panel_edp_debugfs_init, };
drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +0 -18
@@ -174,28 +174,10 @@ static int seiko_panel_get_modes(struct drm_panel *panel,return seiko_panel_get_fixed_modes (p, connector); } -static int seiko_panel_get_timings (struct drm_panel *panel, -unsigned int num_timings, -struct display_timing *timings) -{ -struct seiko_panel *p =to_seiko_panel (panel); -unsigned int i; - -if (p->desc->num_timings < num_timings) - num_timings = p->desc->num_timings; - -if (timings) -for (i =0 ; i < num_timings; i++) - timings[i] = p->desc->timings[i]; - -return p->desc->num_timings; -} -static const struct drm_panel_funcs seiko_panel_funcs = { .unprepare = seiko_panel_unprepare, .prepare = seiko_panel_prepare, .get_modes = seiko_panel_get_modes, - .get_timings = seiko_panel_get_timings, }; static int seiko_panel_probe(struct device *dev,
drivers/gpu/drm/panel/panel-simple.c +0 -18
@@ -405,23 +405,6 @@ static int panel_simple_get_modes(struct drm_panel *panel,return num; } -static int panel_simple_get_timings (struct drm_panel *panel, -unsigned int num_timings, -struct display_timing *timings) -{ -struct panel_simple *p =to_panel_simple (panel); -unsigned int i; - -if (p->desc->num_timings < num_timings) - num_timings = p->desc->num_timings; - -if (timings) -for (i =0 ; i < num_timings; i++) - timings[i] = p->desc->timings[i]; - -return p->desc->num_timings; -} -static enum drm_panel_orientation panel_simple_get_orientation (struct drm_panel *panel) {struct panel_simple *p =to_panel_simple (panel);
@@ -436,7 +419,6 @@ static const struct drm_panel_funcs panel_simple_funcs = { .enable = panel_simple_enable, .get_modes = panel_simple_get_modes, .get_orientation = panel_simple_get_orientation, - .get_timings = panel_simple_get_timings, };static struct panel_desc *panel_dpi_probe (struct device *dev)
include/drm/drm_panel.h +0 -12
@@ -40,7 +40,6 @@ struct drm_connector;struct drm_device ;struct drm_panel_follower ;struct drm_panel ; -struct display_timing ;enum drm_panel_orientation ;
@@ -131,17 +130,6 @@ struct drm_panel_funcs {*/ enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel); -/** -* @get_timings: -* -* Copy display timings into the provided array and return -* the number of display timings available. -* -* This function is optional. -*/ -int (*get_timings)(struct drm_panel *panel,unsigned int num_timings, -struct display_timing *timings); -/** * @debugfs_init: *
Signature · 1 line
2.47.3
Re: [PATCH 01/35] drm/panel: remove the get_timings() callback
Quoted 3 lines
Nothing has ever called
get_timings()since it was introduced in commit2938931f3732("drm/panel: Add display timing support"). Remove it together with its three implementations.
Ah, interesting!
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 01/35] drm/panel: remove the get_timings() callback
Quoted 7 lines · Luca Ceresoli
Quoted 3 lines
Nothing has ever called
get_timings()since it was introduced in commit2938931f3732("drm/panel: Add display timing support"). Remove it together with its three implementations.Ah, interesting!
Reviewed-by Luca Ceresoli <[email protected]>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 2/35 drm/panel: remove the unused struct panel_bridge
In reply to Dmitry BaryshkovThe bridge is embedded into struct drm_panel now, nothing uses the separate wrapper struct any more.
--- drivers/gpu/drm/drm_panel.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/drm_panel.c +0 -7
@@ -50,13 +50,6 @@ drm_connector_to_panel(const struct drm_connector *connector) return container_of(connector, struct drm_panel, connector); } -struct panel_bridge { -struct drm_bridge bridge; -struct drm_connector connector; -struct drm_panel *panel; -u32 connector_type; -}; -static int panel_bridge_connector_get_modes (struct drm_connector *connector) {struct drm_panel *panel =drm_connector_to_panel (connector);
Signature · 1 line
2.47.3
Re: [PATCH 02/35] drm/panel: remove the unused struct panel_bridge
Quoted 2 lines · Dmitry Baryshkov
The bridge is embedded into struct
drm_panelnow, nothing uses the separate wrapper struct any more.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 02/35] drm/panel: remove the unused struct panel_bridge
Quoted 5 lines · Luca Ceresoli
Quoted 2 lines · Dmitry Baryshkov
The bridge is embedded into struct
drm_panelnow, nothing uses the separate wrapper struct any more.Reviewed-by Luca Ceresoli <[email protected]>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 3/35 drm/tidss: get the panel type from the embedded bridge
In reply to Dmitry BaryshkovThe connector type of a panel is also available as the type of the bridge embedded into it. Use that one, so that drm_panel.connector_type can go away.
--- drivers/gpu/drm/tidss/tidss_kms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_kms.c +2 -2
@@ -181,11 +181,11 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) goto put_panel; } -if (panel->connector_type != conn_type) { +if (panel->bridge.type != conn_type) {dev_err (dev,"%s: Panel %s has incompatible connector type for vp%d (%d != %d)\n" , __func__,dev_name (panel->dev), i, - panel->connector_type, conn_type); + panel->bridge.type, conn_type); ret = -EINVAL ; goto put_panel; }
Signature · 1 line
2.47.3
Re: [PATCH 03/35] drm/tidss: get the panel type from the embedded bridge
Quoted 3 lines · Dmitry Baryshkov
The connector type of a panel is also available as the type of the bridge embedded into it. Use that one, so that drm_panel.connector_type can go away.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/35 drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to devm_drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/bridge/lvds-codec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/lvds-codec.c +1 -2
@@ -154,8 +154,7 @@ static int lvds_codec_probe(struct platform_device *pdev) } lvds_codec->panel_bridge = -devm_drm_panel_bridge_add_typed (dev, panel, - lvds_codec->connector_type); +devm_drm_panel_bridge_add (dev, panel);drm_panel_put (panel);if (IS_ERR (lvds_codec->panel_bridge))return PTR_ERR (lvds_codec->panel_bridge);
Signature · 1 line
2.47.3
Re: [PATCH 04/35] drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
Quoted 12 lines
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>drivers/gpu/drm/bridge/lvds-codec.c +0
-0
drivers/gpu/drm/bridge/lvds-codec.c static int lvds_codec_probe(struct platform_device *pdev) · line 160
Quoted 9 lines
drivers/gpu/drm/bridge/lvds-codec.c +1
-2@@ -154,8 +154,7 @@ static int lvds_codec_probe(struct platform_device *pdev) } lvds_codec->panel_bridge = -devm_drm_panel_bridge_add_typed (dev, panel, - lvds_codec->connector_type); +devm_drm_panel_bridge_add (dev, panel);drm_panel_put (panel);if (IS_ERR (lvds_codec->panel_bridge))return PTR_ERR (lvds_codec->panel_bridge);
By now drm_of_find_panel_or_bridge() + devm_drm_panel_bridge_add_typed() is jsut a complicated wrapper to drm_bridge_get(), so this driver and those in the following commits could be simplified dramatically, without adding the deprecated devm_drm_panel_bridge_add().
However devm_drm_panel_bridge_add_typed() is _more_ deprecated than devm_drm_panel_bridge_add(), so this is already a good step forward.
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 04/35] drm/bridge: lvds-codec: use devm_drm_panel_bridge_add()
Quoted 27 lines · Luca Ceresoli
Quoted 12 lines
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>drivers/gpu/drm/bridge/lvds-codec.c +0
-0drivers/gpu/drm/bridge/lvds-codec.c static int lvds_codec_probe(struct platform_device *pdev) · line 160
Quoted 9 lines
drivers/gpu/drm/bridge/lvds-codec.c +1
-2@@ -154,8 +154,7 @@ static int lvds_codec_probe(struct platform_device *pdev) } lvds_codec->panel_bridge = -devm_drm_panel_bridge_add_typed (dev, panel, - lvds_codec->connector_type); +devm_drm_panel_bridge_add (dev, panel);drm_panel_put (panel);if (IS_ERR (lvds_codec->panel_bridge))return PTR_ERR (lvds_codec->panel_bridge);By now
drm_of_find_panel_or_bridge()+devm_drm_panel_bridge_add_typed()is jsut a complicated wrapper todrm_bridge_get(), so this driver and those in the following commits could be simplified dramatically, without adding the deprecateddevm_drm_panel_bridge_add().
Quoted 2 lines
However
devm_drm_panel_bridge_add_typed()is _more_ deprecated thandevm_drm_panel_bridge_add(), so this is already a good step forward.
Yes, I wanted to do a minimal steps, to simplify the reviews.
Quoted 10 lines
Reviewed-by Luca Ceresoli <[email protected]>Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Signature · 2 lines
With best wishes Dmitry
PATCH 5/35 drm/ingenic: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to devm_drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1 -2
@@ -1298,8 +1298,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) }if (panel) { - bridge =devm_drm_panel_bridge_add_typed (dev, panel, -DRM_MODE_CONNECTOR_DPI ); + bridge =devm_drm_panel_bridge_add (dev, panel);drm_panel_put (panel); }
Signature · 1 line
2.47.3
Re: [PATCH 05/35] drm/ingenic: use devm_drm_panel_bridge_add()
Hi Dmitry,
Le lundi 26 octobre 2026 à 13:09 +0200, Dmitry Baryshkov a écrit :
Quoted 8 lines
The connector type passed to
devm_drm_panel_bridge_add_typed()has been
ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto
everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
Cheers,
-Paul
Quoted 23 lines
---
drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-0@@ -1298,8 +1298,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) }
if (panel) {drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-1- bridge =devm_drm_panel_bridge_add_typed(dev, panel,
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-1-
DRM_MODE_CONNECTOR_DPI);drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1
-0+ bridge = devm_drm_panel_bridge_add(dev,panel);
drm_panel_put(panel);
}
Re: [PATCH 05/35] drm/ingenic: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovQuoted 3 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 6/35 drm: mxsfb: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to devm_drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +1 -2
@@ -129,8 +129,7 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)return ret;if (panel) { - bridge =devm_drm_panel_bridge_add_typed (drm->dev, panel, -DRM_MODE_CONNECTOR_DPI ); + bridge =devm_drm_panel_bridge_add (drm->dev, panel);drm_panel_put (panel);if (IS_ERR (bridge))return PTR_ERR (bridge);
Signature · 1 line
2.47.3
Re: [PATCH 06/35] drm: mxsfb: use devm_drm_panel_bridge_add()
Quoted 6 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
Signature · 2 lines
Thanks, Laurentiu
Re: [PATCH 06/35] drm: mxsfb: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovQuoted 3 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 7/35 drm: rcar-du: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to devm_drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c +2 -3
@@ -67,14 +67,13 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,if (IS_ERR (panel))return PTR_ERR (panel); - bridge =devm_drm_panel_bridge_add_typed (rcdu->dev, panel, -DRM_MODE_CONNECTOR_DPI ); + bridge =devm_drm_panel_bridge_add (rcdu->dev, panel);drm_panel_put (panel);if (IS_ERR (bridge))return PTR_ERR (no_free_ptr (bridge));/* -* The reference taken by devm_drm_panel_bridge_add_typed() is +* The reference taken by devm_drm_panel_bridge_add() is * released automatically. Take a second one for the __free() * when this function will return. */
Signature · 1 line
2.47.3
Re: [PATCH 07/35] drm: rcar-du: use devm_drm_panel_bridge_add()
Quoted 3 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 07/35] drm: rcar-du: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovQuoted 6 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
PATCH 8/35 drm: rz-du: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to devm_drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c +2 -3
@@ -112,14 +112,13 @@ int rzg2l_du_encoder_init(struct rzg2l_du_device *rcdu,if (IS_ERR (panel))return PTR_ERR (panel); - bridge =devm_drm_panel_bridge_add_typed (rcdu->dev, panel, -DRM_MODE_CONNECTOR_DPI ); + bridge =devm_drm_panel_bridge_add (rcdu->dev, panel);drm_panel_put (panel);if (IS_ERR (bridge))return PTR_ERR (no_free_ptr (bridge));/* -* The reference taken by devm_drm_panel_bridge_add_typed() is +* The reference taken by devm_drm_panel_bridge_add() is * released automatically. Take a second one for the __free() * when this function will return. */
Signature · 1 line
2.47.3
Re: [PATCH 08/35] drm: rz-du: use devm_drm_panel_bridge_add()
Quoted 3 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 08/35] drm: rz-du: use devm_drm_panel_bridge_add()
In reply to Dmitry BaryshkovQuoted 6 lines · Dmitry Baryshkov
The connector type passed to
devm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
PATCH 9/35 drm/mcde: use drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/mcde/mcde_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/mcde/mcde_drv.c +1 -2
@@ -151,8 +151,7 @@ static int mcde_modeset_init(struct drm_device *drm)return ret; }if (panel) { - bridge =drm_panel_bridge_add_typed (panel, -DRM_MODE_CONNECTOR_DPI ); + bridge =drm_panel_bridge_add (panel);drm_panel_put (panel);if (IS_ERR (bridge)) { dev_err(drm->dev,
Signature · 1 line
2.47.3
Re: [PATCH 09/35] drm/mcde: use drm_panel_bridge_add()
Quoted 6 lines · Dmitry Baryshkov
The connector type passed to
drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
Thanks for driving this patch series Dmitry!
Yours,
Linus Walleij
Re: [PATCH 09/35] drm/mcde: use drm_panel_bridge_add()
In reply to Dmitry BaryshkovQuoted 3 lines · Dmitry Baryshkov
The connector type passed to
drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 10/35 drm/pl111: use drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/pl111/pl111_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/pl111/pl111_drv.c +1 -2
@@ -143,8 +143,7 @@ static int pl111_modeset_init(struct drm_device *dev)return -EPROBE_DEFER ;if (panel) { - bridge =drm_panel_bridge_add_typed (panel, - DRM_MODE_CONNECTOR_Unknown); + bridge =drm_panel_bridge_add (panel);drm_panel_put (panel);if (IS_ERR (bridge)) { ret =PTR_ERR (bridge);
Signature · 1 line
2.47.3
Re: [PATCH 10/35] drm/pl111: use drm_panel_bridge_add()
Quoted 6 lines · Dmitry Baryshkov
The connector type passed to
drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
Yours,
Linus Walleij
Re: [PATCH 10/35] drm/pl111: use drm_panel_bridge_add()
In reply to Dmitry BaryshkovQuoted 3 lines · Dmitry Baryshkov
The connector type passed to
drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 11/35 drm/rockchip: lvds: use drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +1 -1
@@ -609,7 +609,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,drm_encoder_helper_add (encoder, lvds->soc_data->helper_funcs);if (lvds->panel) { - lvds->bridge =drm_panel_bridge_add_typed (lvds->panel,DRM_MODE_CONNECTOR_LVDS ); + lvds->bridge =drm_panel_bridge_add (lvds->panel);drm_panel_put (lvds->panel); lvds->panel =NULL ;if (IS_ERR (lvds->bridge)) {
Signature · 1 line
2.47.3
Re: [PATCH 11/35] drm/rockchip: lvds: use drm_panel_bridge_add()
Quoted 3 lines · Dmitry Baryshkov
The connector type passed to
drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 12/35 drm/rockchip: rgb: use drm_panel_bridge_add()
In reply to Dmitry BaryshkovThe connector type passed to drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), the bridge always has the type of the panel.
--- drivers/gpu/drm/rockchip/rockchip_rgb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/rockchip/rockchip_rgb.c +1 -2
@@ -143,8 +143,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,drm_encoder_helper_add (encoder, &rockchip_rgb_encoder_helper_funcs);if (panel) { - bridge =drm_panel_bridge_add_typed (panel, -DRM_MODE_CONNECTOR_LVDS ); + bridge =drm_panel_bridge_add (panel);drm_panel_put (panel);if (IS_ERR (bridge))return ERR_CAST (bridge);
Signature · 1 line
2.47.3
Re: [PATCH 12/35] drm/rockchip: rgb: use drm_panel_bridge_add()
Quoted 3 lines · Dmitry Baryshkov
The connector type passed to
drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), the bridge always has the type of the panel.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 13/35 drm/panel: remove the _typed() panel bridge functions
In reply to Dmitry BaryshkovThe connector type argument of drm_panel_bridge_add_typed() and devm_drm_panel_bridge_add_typed() has been ignored since commit b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel"), and they have no users left.
--- Documentation/gpu/todo.rst | 1 - drivers/gpu/drm/drm_panel.c | 55 ++++----------------------------------------- include/drm/drm_panel.h | 5 ----- 3 files changed, 4 insertions(+), 57 deletions(-)
Documentation/gpu/todo.rst +0 -1
@@ -475,7 +475,6 @@ not needed anymore. Its APIs are just accessing the embedded drm_bridge transparently, and the are deprecated. The funcions to remove are: - - drm_panel_bridge_add_typed() - devm_drm_of_get_bridge() - drmm_of_get_bridge() - drm_panel_bridge_remove()
drivers/gpu/drm/drm_panel.c +4 -51
87 lines not on this page · raw message
include/drm/drm_panel.h +0 -5
@@ -393,16 +393,11 @@ static inline int drm_panel_of_backlight(struct drm_panel *panel)#ifdef CONFIG_DRM_PANEL_BRIDGE bool drm_bridge_is_panel (const struct drm_bridge *bridge);struct drm_bridge *drm_panel_bridge_add (struct drm_panel *panel); -struct drm_bridge *drm_panel_bridge_add_typed (struct drm_panel *panel, -u32 connector_type);void drm_panel_bridge_remove (struct drm_bridge *bridge);int drm_panel_bridge_set_orientation (struct drm_connector *connector,struct drm_bridge *bridge);struct drm_bridge *devm_drm_panel_bridge_add (struct device *dev,struct drm_panel *panel); -struct drm_bridge *devm_drm_panel_bridge_add_typed (struct device *dev, -struct drm_panel *panel, -u32 connector_type);struct drm_bridge *drmm_panel_bridge_add (struct drm_device *drm,struct drm_panel *panel);struct drm_connector *drm_panel_bridge_connector (struct drm_bridge *bridge);
Signature · 1 line
2.47.3
Re: [PATCH 13/35] drm/panel: remove the _typed() panel bridge functions
Quoted 4 lines · Dmitry Baryshkov
The connector type argument of
drm_panel_bridge_add_typed()anddevm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), and they have no users left.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 13/35] drm/panel: remove the _typed() panel bridge functions
Quoted 7 lines · Luca Ceresoli
Quoted 4 lines · Dmitry Baryshkov
The connector type argument of
drm_panel_bridge_add_typed()anddevm_drm_panel_bridge_add_typed()has been ignored since commitb7797081ccfe("drm/panel: embed adrm_bridgeinto everydrm_panel"), and they have no users left.Reviewed-by Luca Ceresoli <[email protected]>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 14/35 drm/panel: remove drm_panel.connector_type
In reply to Dmitry BaryshkovThe connector type is stored twice, in the panel and in the bridge embedded into it. Keep only the bridge one, which is what the rest of the DRM core looks at.
--- drivers/gpu/drm/drm_panel.c | 9 ++++----- include/drm/drm_panel.h | 9 --------- 2 files changed, 4 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_panel.c +4 -5
@@ -86,7 +86,7 @@ static int panel_bridge_attach(struct drm_bridge *bridge, ret =drm_connector_init (bridge->dev, connector, &panel_bridge_connector_funcs, - panel->connector_type); + panel->bridge.type);if (ret) {DRM_ERROR ("Failed to initialize connector\n" );return ret;
@@ -258,7 +258,7 @@ EXPORT_SYMBOL(drm_bridge_is_panel);* drm_mode_config_cleanup() if the bridge has already been attached), then * drm_panel_bridge_remove() to free it. * -* The connector type is set to @panel->connector_type, which must be set to a +* The connector type is set to @panel->bridge.type, which must be set to a * known type. Calling this function with a panel whose connector type is * DRM_MODE_CONNECTOR_Unknown will return ERR_PTR(-EINVAL). *
@@ -267,7 +267,7 @@ EXPORT_SYMBOL(drm_bridge_is_panel);*/ struct drm_bridge *drm_panel_bridge_add (struct drm_panel *panel) { -if (WARN_ON (panel->connector_type == DRM_MODE_CONNECTOR_Unknown)) +if (WARN_ON (panel->bridge.type == DRM_MODE_CONNECTOR_Unknown))return ERR_PTR (-EINVAL );return drm_bridge_get (&panel->bridge);
@@ -527,7 +527,7 @@ static void drm_panel_init(struct drm_panel *panel, struct device *dev,mutex_init (&panel->follower_lock); panel->dev = dev; panel->funcs = funcs; - panel->connector_type = connector_type; + panel->bridge.type = connector_type; }/**
@@ -547,7 +547,6 @@ void drm_panel_add(struct drm_panel *panel) panel->bridge.of_node = panel->dev->of_node; panel->bridge.ops =DRM_BRIDGE_OP_MODES ; - panel->bridge.type = panel->connector_type; panel->bridge.pre_enable_prev_first = panel->prepare_prev_first;drm_bridge_add (&panel->bridge);
include/drm/drm_panel.h +0 -9
@@ -236,15 +236,6 @@ struct drm_panel {*/ struct drm_connector connector; -/** -* @connector_type: -* -* Type of the panel as a DRM_MODE_CONNECTOR_* value. This is used to -* initialise the drm_connector corresponding to the panel with the -* correct connector type. -*/ -int connector_type; -/** * @list: *
Signature · 1 line
2.47.3
Re: [PATCH 14/35] drm/panel: remove drm_panel.connector_type
Quoted 3 lines · Dmitry Baryshkov
The connector type is stored twice, in the panel and in the bridge embedded into it. Keep only the bridge one, which is what the rest of the DRM core looks at.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 15/35 drm/bridge: anx6345: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +5 -0
@@ -525,6 +525,11 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, anx6345->connector.polled =DRM_CONNECTOR_POLL_HPD ; + err =drm_connector_set_orientation_from_panel (&anx6345->connector, + anx6345->panel); +if (err) + goto connector_cleanup; + err =drm_connector_attach_encoder (&anx6345->connector, encoder);if (err) {
Signature · 1 line
2.47.3
Luca Ceresoli
reviewerRe: [PATCH 15/35] drm/bridge: anx6345: set the panel orientation on the connector
Quoted 12 lines
The panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the
get_modes()of some panel drivers, which runs too late.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +0
-0
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c static int anx6345_bridge_attach(struct drm_bridge *bridge, · line 531
Quoted 7 lines
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +4
-0@@ -525,6 +525,11 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, anx6345->connector.polled =DRM_CONNECTOR_POLL_HPD ; + err =drm_connector_set_orientation_from_panel (&anx6345->connector, + anx6345->panel); +if (err) + goto connector_cleanup;
Muy understanding is that this driver, and those in patches 15-21, should be eventually converted to use the bridge API instead of the panel API, but that's a significant work and so for now this small change is enough to get to patch 22 (workaround removal).
Correct?
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 15/35] drm/bridge: anx6345: set the panel orientation on the connector
Quoted 25 lines · Luca Ceresoli
Quoted 12 lines
The panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the
get_modes()of some panel drivers, which runs too late.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +0
-0drivers/gpu/drm/bridge/analogix/analogix-anx6345.c static int anx6345_bridge_attach(struct drm_bridge *bridge, · line 531
Quoted 7 lines
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +4
-0@@ -525,6 +525,11 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, anx6345->connector.polled =DRM_CONNECTOR_POLL_HPD ; + err =drm_connector_set_orientation_from_panel (&anx6345->connector, + anx6345->panel); +if (err) + goto connector_cleanup;Muy understanding is that this driver, and those in patches 15-21, should be eventually converted to use the bridge API instead of the panel API, but that's a significant work and so for now this small change is enough to get to patch 22 (workaround removal).
Quoted 1 line
Correct?
Yes. Refactoring the drivers to use bridge API is different, bigger project, which can be undertaken later (or in parallel).
Signature · 2 lines
With best wishes Dmitry
PATCH 16/35 drm/exynos: dpi: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/exynos/exynos_drm_dpi.c +1 -0
@@ -109,6 +109,7 @@ static int exynos_dpi_create_connector(struct drm_encoder *encoder) }drm_connector_helper_add (connector, &exynos_dpi_connector_helper_funcs); +drm_connector_set_orientation_from_panel (connector, ctx->panel);drm_connector_attach_encoder (connector, encoder);return 0 ;
Signature · 1 line
2.47.3
Luca Ceresoli
reviewerRe: [PATCH 16/35] drm/exynos: dpi: set the panel orientation on the connector
Quoted 12 lines
The panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the
get_modes()of some panel drivers, which runs too late.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>drivers/gpu/drm/exynos/exynos_drm_dpi.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_dpi.c static int exynos_dpi_create_connector(struct drm_encoder *encoder) · line 112
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_dpi.c +1
-0@@ -109,6 +109,7 @@ static int exynos_dpi_create_connector(struct drm_encoder *encoder) }drm_connector_helper_add (connector, &exynos_dpi_connector_helper_funcs); +drm_connector_set_orientation_from_panel (connector, ctx->panel);
Patches 15-21 are quite inconsistent in terms of error checking:
* some don't check for errors (like this one)
* some do and return silently on error
* some do and log an error before returning
I don't see a good reason, so I'd make them all log and return on error.
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 17/35 drm/fsl-dcu: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +5 -0
@@ -96,6 +96,11 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev,return ret;drm_connector_helper_add (connector, &connector_helper_funcs); + + ret =drm_connector_set_orientation_from_panel (connector, panel); +if (ret <0 ) + goto err_cleanup; + ret =drm_connector_register (connector);if (ret <0 ) goto err_cleanup;
Signature · 1 line
2.47.3
PATCH 18/35 drm/logicvc: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/logicvc/logicvc_interface.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/logicvc/logicvc_interface.c +7 -0
@@ -194,6 +194,13 @@ int logicvc_interface_init(struct logicvc_drm *logicvc)drm_connector_helper_add (&interface->drm_connector, &logicvc_connector_helper_funcs); + ret =drm_connector_set_orientation_from_panel (&interface->drm_connector, + interface->drm_panel); +if (ret) { +drm_err (drm_dev,"Failed to set panel orientation\n" ); + goto error_encoder; + } + ret =drm_connector_attach_encoder (&interface->drm_connector, &interface->drm_encoder);if (ret) {
Signature · 1 line
2.47.3
PATCH 19/35 drm/stm: lvds: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/stm/lvds.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/stm/lvds.c +4 -0
@@ -975,6 +975,10 @@ static int lvds_attach(struct drm_bridge *bridge, struct drm_encoder *encoder,drm_connector_helper_add (connector, &lvds_conn_helper_funcs); + ret =drm_connector_set_orientation_from_panel (connector, lvds->panel); +if (ret <0 ) +return ret; + ret =drm_connector_attach_encoder (connector, encoder);return ret;
Signature · 1 line
2.47.3
PATCH 20/35 drm/sun4i: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/sun4i/sun4i_lvds.c | 2 ++ drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/sun4i/sun4i_lvds.c +2 -0
@@ -153,6 +153,8 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon) goto err_cleanup_connector; } +drm_connector_set_orientation_from_panel (&lvds->connector, + lvds->panel);drm_connector_attach_encoder (&lvds->connector, &lvds->encoder); }
drivers/gpu/drm/sun4i/sun4i_rgb.c +2 -0
@@ -245,6 +245,8 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon) goto err_cleanup_connector; } +drm_connector_set_orientation_from_panel (&rgb->connector, + rgb->panel);drm_connector_attach_encoder (&rgb->connector, &rgb->encoder); }
Signature · 1 line
2.47.3
Re: [PATCH 20/35] drm/sun4i: set the panel orientation on the connector
Quoted 7 lines · Dmitry Baryshkov
The panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the
get_modes()of some panel drivers, which runs too late.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
Quoted 35 lines
--- drivers/gpu/drm/sun4i/sun4i_lvds.c | 2 ++ drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 ++ 2 files changed, 4 insertions(+)drivers/gpu/drm/sun4i/sun4i_lvds.c +2
-0@@ -153,6 +153,8 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon) goto err_cleanup_connector; } +drm_connector_set_orientation_from_panel (&lvds->connector, + lvds->panel);drm_connector_attach_encoder (&lvds->connector, &lvds->encoder); }drivers/gpu/drm/sun4i/sun4i_rgb.c +2
-1@@ -245,6 +245,8 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon) goto err_cleanup_connector; } +drm_connector_set_orientation_from_panel (&rgb->connector, + rgb->panel);drm_connector_attach_encoder (&rgb->connector, &rgb->encoder); } --2.47.3
PATCH 21/35 drm/tegra: sor: set the panel orientation on the connector
In reply to Dmitry BaryshkovThe panel is used directly, without the panel bridge, so nothing sets its orientation on the connector apart from the workaround in the get_modes() of some panel drivers, which runs too late.
--- drivers/gpu/drm/tegra/sor.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/tegra/sor.c +2 -0
@@ -3112,6 +3112,8 @@ static int tegra_sor_init(struct host1x_client *client)drm_connector_helper_add (&sor->output.connector, &tegra_sor_connector_helper_funcs); sor->output.connector.dpms =DRM_MODE_DPMS_OFF ; +drm_connector_set_orientation_from_panel (&sor->output.connector, + sor->output.panel);drm_encoder_init (drm, &sor->output.encoder, &tegra_sor_encoder_funcs_cleanup, encoder,NULL );
Signature · 1 line
2.47.3
PATCH 22/35 drm/panel: drop the orientation workaround from get_modes()
In reply to Dmitry BaryshkovSetting the orientation from get_modes() was a stopgap for the display drivers not calling drm_connector_set_orientation_from_panel(). It is also too late: by then the connector is registered and the property can no longer be attached properly.
drm_bridge_connector and the panel bridge set the orientation on their own, and the drivers using a panel directly do it when creating the connector now. The exceptions are sun6i_mipi_dsi, sti_dvo and the Tegra DSI, which get the panel only after the DRM device has been registered. None of the in-tree boards using them has a rotated panel.
--- drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 6 ------ drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 6 ------ drivers/gpu/drm/panel/panel-edp.c | 6 ------ drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 6 ------ drivers/gpu/drm/panel/panel-lvds.c | 6 ------ drivers/gpu/drm/panel/panel-simple.c | 6 ------ drivers/gpu/drm/panel/panel-sitronix-st7701.c | 6 ------ drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 6 ------ 8 files changed, 48 deletions(-)
drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c +0 -6
@@ -318,12 +318,6 @@ static int boe_th101mb31ig002_get_modes(struct drm_panel *panel,const struct drm_display_mode *desc_mode = ctx->desc->modes; connector->display_info.bpc =8 ; -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, ctx->orientation); -return drm_connector_helper_get_modes_fixed (connector, desc_mode); }
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +0 -6
@@ -1666,12 +1666,6 @@ static int boe_panel_get_modes(struct drm_panel *panel, connector->display_info.width_mm = boe->desc->size.width_mm; connector->display_info.height_mm = boe->desc->size.height_mm; connector->display_info.bpc = boe->desc->bpc; -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, boe->orientation); -return 1 ; }
drivers/gpu/drm/panel/panel-edp.c +0 -6
@@ -637,12 +637,6 @@ static int panel_edp_get_modes(struct drm_panel *panel,else if (!num)dev_warn (p->base.dev,"No display modes\n" ); -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, p->orientation); -return num; }
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +0 -6
@@ -2520,12 +2520,6 @@ static int ili9881c_get_modes(struct drm_panel *panel,else connector->display_info.subpixel_order = SubPixelHorizontalRGB; -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, ctx->orientation); -return 1 ; }
drivers/gpu/drm/panel/panel-lvds.c +0 -6
@@ -98,12 +98,6 @@ static int panel_lvds_get_modes(struct drm_panel *panel, &lvds->bus_format, 1); connector->display_info.bus_flags = lvds->bus_flags; -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, lvds->orientation); -return 1 ; }
drivers/gpu/drm/panel/panel-simple.c +0 -6
@@ -396,12 +396,6 @@ static int panel_simple_get_modes(struct drm_panel *panel,/* add hard-coded panel modes */ num +=panel_simple_get_non_edid_modes (p, connector); -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, p->orientation); -return num; }
drivers/gpu/drm/panel/panel-sitronix-st7701.c +0 -6
@@ -635,12 +635,6 @@ static int st7701_get_modes(struct drm_panel *panel, connector->display_info.width_mm = desc_mode->width_mm; connector->display_info.height_mm = desc_mode->height_mm; -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, st7701->orientation); -return 1 ; }
drivers/gpu/drm/panel/panel-sitronix-st7789v.c +0 -6
@@ -361,12 +361,6 @@ static int st7789v_get_modes(struct drm_panel *panel,drm_display_info_set_bus_formats (&connector->display_info, &ctx->info->bus_format,1 ); -/* -* TODO: Remove once all drm drivers call -* drm_connector_set_orientation_from_panel() -*/ -drm_connector_set_panel_orientation (connector, ctx->orientation); -return 1 ; }
Signature · 1 line
2.47.3
Re: [PATCH 22/35] drm/panel: drop the orientation workaround from get_modes()
Quoted 3 lines · Dmitry Baryshkov
The exceptions are
sun6i_mipi_dsi,sti_dvoand the Tegra DSI, which get the panel only after the DRM device has been registered. None of the in-tree boards using them has a rotated panel.
Two are on their way for sun6i_mipi_dsi, both A33 handhelds with the panel mounted for landscape use, rotation = <270>: the Miyoo PocketGo S30 (ILI9488, panel series at [1]) and the Miyoo A30 (ST7701, not posted yet).
I sent a fix for this gap on 1 November [2]: sun6i_dsi_bind() reads the rotation from the panel node, a child of the DSI node, and sets the orientation on the connector before the DRM device is registered. It does not rely on the panel driver, so it keeps working once the get_modes() workaround is gone, and it skips port/ports nodes, so it does not mind whether the board also links the panel through the graph. Tested on the S30; it still applies to drm-misc-next as of 12 November.
Could your repost of 15+ take it, or point at it for sun6i_mipi_dsi? It reads the DT itself rather than panel->orientation from your 23/35, because the panel is not there yet at bind time. I am happy to rebase it on top of your series if you prefer.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Romain
Re: [PATCH 22/35] drm/panel: drop the orientation workaround from get_modes()
In reply to Dmitry BaryshkovQuoted 5 lines · Dmitry Baryshkov
Setting the orientation from
get_modes()was a stopgap for the display drivers not callingdrm_connector_set_orientation_from_panel(). It is also too late: by then the connector is registered and the property can no longer be attached properly.
Quoted 8 lines
drm_bridge_connectorand the panel bridge set the orientation on their own, and the drivers using a panel directly do it when creating the connector now. The exceptions aresun6i_mipi_dsi,sti_dvoand the Tegra DSI, which get the panel only after the DRM device has been registered. None of the in-tree boards using them has a rotated panel.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>
Makes sense.
Yours,
Linus Walleij
PATCH 23/35 drm/panel: read the panel orientation in the core
In reply to Dmitry BaryshkovPanel orientation describes how the panel is mounted and comes from the common "rotation" DT property, yet each driver has to parse it and hand it back through get_orientation(). 24 drivers carry an identical copy of that code and the rest silently ignore the property.
Parse it once in devm_drm_panel_alloc(). The callback still takes precedence until the drivers are converted. An invalid value fails the allocation, just as it fails probe in those drivers today.
As a side effect all panels honour "rotation" now. Among the in-tree DTs this only changes the Motorola Mapphone panel (panel-dsi-cm, rotation = <90>).
--- drivers/gpu/drm/drm_connector.c | 5 ++++- drivers/gpu/drm/drm_panel.c | 9 +++++++++ include/drm/drm_panel.h | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +4 -1
@@ -3397,7 +3397,8 @@ EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);* @panel: panel that can provide orientation information. * * Drm drivers should call this function before drm_dev_register(). -* Orientation is obtained from panel's .get_orientation() callback. +* Orientation is obtained from panel's .get_orientation() callback, falling +* back to &drm_panel.orientation if the panel doesn't implement it. * * Returns: * Zero on success, negative errno on failure.
@@ -3410,6 +3411,8 @@ int drm_connector_set_orientation_from_panel(if (panel && panel->funcs && panel->funcs->get_orientation) orientation = panel->funcs->get_orientation (panel); +else if (panel) + orientation = panel->orientation;else orientation =DRM_MODE_PANEL_ORIENTATION_UNKNOWN ;
drivers/gpu/drm/drm_panel.c +9 -0
@@ -925,6 +925,15 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,drm_panel_init (panel, dev, funcs, connector_type); + panel->orientation =DRM_MODE_PANEL_ORIENTATION_UNKNOWN ; +if (dev->of_node) { + err =drm_of_get_panel_orientation (dev->of_node, + &panel->orientation); +if (err) +return ERR_PTR (dev_err_probe (dev, err, +"failed to get orientation\n" )); + } +return container; }EXPORT_SYMBOL (__devm_drm_panel_alloc);
include/drm/drm_panel.h +10 -0
@@ -236,6 +236,16 @@ struct drm_panel {*/ struct drm_connector connector; +/** +* @orientation: +* +* Orientation of the panel, used to set the panel orientation property +* of the connector. It is read from the "rotation" property of the +* panel's device tree node by devm_drm_panel_alloc(). Drivers can +* override it before calling drm_panel_add(). +*/ +enum drm_panel_orientation orientation; +/** * @list: *
Signature · 1 line
2.47.3
PATCH 24/35 drm/panel: use the orientation from the panel core
In reply to Dmitry BaryshkovThe panel core handles the "rotation" property now, so the drivers' own copies are redundant.
ili9881c keeps overriding the value for the 180 degree rotation, the panel performs that one in the hardware. The -ENODEV exemption in renesas-r63419 was dead code, drm_of_get_panel_orientation() never returns that.
--- drivers/gpu/drm/panel/panel-anbernic-td4310.c | 14 -------------- .../gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 19 ------------------- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 16 ---------------- drivers/gpu/drm/panel/panel-chipone-icna35xx.c | 16 ---------------- drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c | 16 ---------------- drivers/gpu/drm/panel/panel-edp.c | 16 ---------------- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 16 ---------------- drivers/gpu/drm/panel/panel-focaltech-ota7290b.c | 17 ----------------- drivers/gpu/drm/panel/panel-himax-hx83102.c | 14 -------------- drivers/gpu/drm/panel/panel-himax-hx8394.c | 16 ---------------- drivers/gpu/drm/panel/panel-ilitek-ili7836a.c | 16 ---------------- drivers/gpu/drm/panel/panel-ilitek-ili9488.c | 14 -------------- drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c | 14 -------------- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 21 ++------------------- drivers/gpu/drm/panel/panel-ilitek-ili9882t.c | 16 ---------------- drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c | 13 ------------- drivers/gpu/drm/panel/panel-lvds.c | 15 --------------- drivers/gpu/drm/panel/panel-novatek-nt36523.c | 16 ---------------- drivers/gpu/drm/panel/panel-renesas-r63419.c | 17 ----------------- drivers/gpu/drm/panel/panel-simple.c | 15 --------------- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 14 -------------- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 14 -------------- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 14 -------------- drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 16 ---------------- 24 files changed, 2 insertions(+), 373 deletions(-)
drivers/gpu/drm/panel/panel-anbernic-td4310.c +0 -14
@@ -12,7 +12,6 @@#include <linux/regulator/consumer.h> #include <drm/drm_mipi_dsi.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -42,7 +41,6 @@ struct anbernic_panel_td4310 {struct gpio_desc *reset_gpio;struct gpio_desc *enable_gpio;struct regulator *vdd; -enum drm_panel_orientation orientation; };static inline struct anbernic_panel_td4310 *panel_to_anbernic_panel_td4310 (struct drm_panel *panel)
@@ -134,18 +132,10 @@ static int panel_anbernic_td4310_get_mode(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, panel_info->display_mode); } -static enum drm_panel_orientation panel_anbernic_td4310_get_orientation (struct drm_panel *panel) -{ -struct anbernic_panel_td4310 *ctx =panel_to_anbernic_panel_td4310 (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs panel_anbernic_td4310_funcs = { .prepare = panel_anbernic_td4310_prepare, .unprepare = panel_anbernic_td4310_unprepare, .get_modes = panel_anbernic_td4310_get_mode, - .get_orientation = panel_anbernic_td4310_get_orientation, };static int panel_anbernic_td4310_probe (struct mipi_dsi_device *dsi)
@@ -166,10 +156,6 @@ static int panel_anbernic_td4310_probe(struct mipi_dsi_device *dsi)if (!ctx->panel_info)return -EINVAL ; - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 ) -return dev_err_probe (dev, ret,"Failed to get panel orientation\n" ); - ctx->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (ctx->reset_gpio)) return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c +0 -19
@@ -15,7 +15,6 @@#include <drm/drm_connector.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -46,7 +45,6 @@ struct boe_th101mb31ig002 {struct gpio_desc *enable;struct gpio_desc *reset; -enum drm_panel_orientation orientation; };static void boe_th101mb31ig002_reset (struct boe_th101mb31ig002 *ctx)
@@ -321,22 +319,11 @@ static int boe_th101mb31ig002_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, desc_mode); } -static enum drm_panel_orientation -boe_th101mb31ig002_get_orientation (struct drm_panel *panel) -{ -struct boe_th101mb31ig002 *ctx =container_of (panel, - struct boe_th101mb31ig002, - panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs boe_th101mb31ig002_funcs = { .prepare = boe_th101mb31ig002_prepare, .unprepare = boe_th101mb31ig002_unprepare, .disable = boe_th101mb31ig002_disable, .get_modes = boe_th101mb31ig002_get_modes, - .get_orientation = boe_th101mb31ig002_get_orientation, };static int boe_th101mb31ig002_dsi_probe (struct mipi_dsi_device *dsi)
@@ -375,12 +362,6 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)return dev_err_probe (&dsi->dev,PTR_ERR (ctx->reset),"Failed to get reset GPIO\n" ); - ret =drm_of_get_panel_orientation (dsi->dev.of_node, - &ctx->orientation); -if (ret) -return dev_err_probe (&dsi->dev, ret, -"Failed to get orientation\n" ); - ret =drm_panel_of_backlight (&ctx->panel);if (ret)return ret;
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +0 -16
@@ -13,7 +13,6 @@#include <drm/drm_connector.h> #include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <video/mipi_display.h>
@@ -47,7 +46,6 @@ struct boe_panel {const struct panel_desc *desc; -enum drm_panel_orientation orientation;struct regulator *pp3300;struct regulator *pp1800;struct regulator *avee;
@@ -1669,20 +1667,12 @@ static int boe_panel_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation boe_panel_get_orientation (struct drm_panel *panel) -{ -struct boe_panel *boe =to_boe_panel (panel); - -return boe->orientation; -} -static const struct drm_panel_funcs boe_panel_funcs = { .disable = boe_panel_disable, .unprepare = boe_panel_unprepare, .prepare = boe_panel_prepare, .enable = boe_panel_enable, .get_modes = boe_panel_get_modes, - .get_orientation = boe_panel_get_orientation, };static int boe_panel_add (struct boe_panel *boe)
@@ -1717,12 +1707,6 @@ static int boe_panel_add(struct boe_panel *boe) boe->base.prepare_prev_first = true; - err =drm_of_get_panel_orientation (dev->of_node, &boe->orientation); -if (err <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, err); -return err; - } - err =drm_panel_of_backlight (&boe->base);if (err)return err;
drivers/gpu/drm/panel/panel-chipone-icna35xx.c +0 -16
@@ -21,7 +21,6 @@#include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -30,7 +29,6 @@ struct panel_info {struct drm_connector *connector;struct mipi_dsi_device *dsi;struct panel_desc *desc; -enum drm_panel_orientation orientation;struct gpio_desc *reset_gpio;struct regulator_bulk_data *supplies;
@@ -284,19 +282,11 @@ static int icna35xx_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, pinfo->desc->modes); } -static enum drm_panel_orientation icna35xx_get_orientation (struct drm_panel *panel) -{ -struct panel_info *pinfo =to_panel_info (panel); - -return pinfo->orientation; -} -static const struct drm_panel_funcs icna35xx_panel_funcs = { .disable = icna35xx_disable, .prepare = icna35xx_prepare, .unprepare = icna35xx_unprepare, .get_modes = icna35xx_get_modes, - .get_orientation = icna35xx_get_orientation, };static int icna35xx_bl_update_status (struct backlight_device *bl)
@@ -375,12 +365,6 @@ static int icna35xx_probe(struct mipi_dsi_device *dsi) pinfo->dsi = dsi;mipi_dsi_set_drvdata (dsi, pinfo); - ret =drm_of_get_panel_orientation (dev->of_node, &pinfo->orientation); -if (ret <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, ret); -return ret; - } - pinfo->panel.prepare_prev_first = true; pinfo->panel.backlight =icna35xx_create_backlight (dsi);
drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c +0 -16
@@ -13,7 +13,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <video/mipi_display.h>
@@ -31,7 +30,6 @@ struct ch13726a_panel {struct regulator_bulk_data *supplies;struct gpio_desc *reset_gpio;struct ch13726a_desc *desc; -enum drm_panel_orientation orientation; };struct ch13726a_desc {
@@ -191,19 +189,11 @@ static int ch13726a_get_modes(struct drm_panel *panel,return ctx->desc->num_modes; } -static enum drm_panel_orientation ch13726a_get_orientation (struct drm_panel *panel) -{ -struct ch13726a_panel *ctx =to_ch13726a_panel (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs ch13726a_panel_funcs = { .prepare = ch13726a_prepare, .unprepare = ch13726a_unprepare, .disable = ch13726a_disable, .get_modes = ch13726a_get_modes, - .get_orientation = ch13726a_get_orientation, };static int ch13726a_bl_update_status (struct backlight_device *bl)
@@ -269,12 +259,6 @@ static int ch13726a_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset-gpios\n" ); - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, ret); -return ret; - } - ctx->dsi = dsi;mipi_dsi_set_drvdata (dsi, ctx);
drivers/gpu/drm/panel/panel-edp.c +0 -16
@@ -40,7 +40,6 @@#include <drm/drm_crtc.h> #include <drm/drm_device.h> #include <drm/drm_edid.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> /**
@@ -254,7 +253,6 @@ struct panel_edp {struct drm_display_mode override_mode; -enum drm_panel_orientation orientation; };static inline struct panel_edp *to_panel_edp (struct drm_panel *panel)
@@ -640,13 +638,6 @@ static int panel_edp_get_modes(struct drm_panel *panel,return num; } -static enum drm_panel_orientation panel_edp_get_orientation (struct drm_panel *panel) -{ -struct panel_edp *p =to_panel_edp (panel); - -return p->orientation; -} -static int detected_panel_show (struct seq_file *s,void *data) {struct drm_panel *panel = s->private;
@@ -675,7 +666,6 @@ static const struct drm_panel_funcs panel_edp_funcs = { .prepare = panel_edp_prepare, .enable = panel_edp_enable, .get_modes = panel_edp_get_modes, - .get_orientation = panel_edp_get_orientation, .debugfs_init = panel_edp_debugfs_init, };
@@ -863,12 +853,6 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,return dev_err_probe (dev,PTR_ERR (panel->enable_gpio),"failed to request GPIO\n" ); - err =drm_of_get_panel_orientation (dev->of_node, &panel->orientation); -if (err) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, err); -return err; - } - ddc =of_parse_phandle (dev->of_node,"ddc-i2c-bus" ,0 );if (ddc) { panel->ddc =of_get_i2c_adapter_by_node (ddc);
drivers/gpu/drm/panel/panel-elida-kd35t133.c +0 -16
@@ -21,7 +21,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> /* Manufacturer specific Commands send via DSI */
@@ -43,7 +42,6 @@ struct kd35t133 {struct gpio_desc *reset_gpio;struct regulator *vdd;struct regulator *iovcc; -enum drm_panel_orientation orientation; };static inline struct kd35t133 *panel_to_kd35t133 (struct drm_panel *panel)
@@ -187,18 +185,10 @@ static int kd35t133_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation kd35t133_get_orientation (struct drm_panel *panel) -{ -struct kd35t133 *ctx =panel_to_kd35t133 (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs kd35t133_funcs = { .unprepare = kd35t133_unprepare, .prepare = kd35t133_prepare, .get_modes = kd35t133_get_modes, - .get_orientation = kd35t133_get_orientation, };static int kd35t133_probe (struct mipi_dsi_device *dsi)
@@ -234,12 +224,6 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)return ret; } - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, ret); -return ret; - } -mipi_dsi_set_drvdata (dsi, ctx); ctx->dev = dev;
drivers/gpu/drm/panel/panel-focaltech-ota7290b.c +0 -17
@@ -17,7 +17,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -31,7 +30,6 @@ struct ota7290b {struct regulator *vdd;struct regulator *vcc; -enum drm_panel_orientation orientation; };static inline struct ota7290b *panel_to_ota (struct drm_panel *panel)
@@ -135,18 +133,10 @@ static int ota7290b_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, &waveshare_dsi_touch_8_8_a_mode); } -static enum drm_panel_orientation ota7290b_get_orientation (struct drm_panel *panel) -{ -struct ota7290b *ctx =panel_to_ota (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs ota7290b_funcs = { .prepare = ota7290b_prepare, .unprepare = ota7290b_unprepare, .get_modes = ota7290b_get_modes, - .get_orientation = ota7290b_get_orientation, };static int ota7290b_probe (struct mipi_dsi_device *dsi)
@@ -182,13 +172,6 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)return dev_err_probe (&dsi->dev,PTR_ERR (ctx->vdd),"Couldn't get our VDD supply\n" ); - ret =drm_of_get_panel_orientation (dsi->dev.of_node, &ctx->orientation); -if (ret) { -dev_err (&dsi->dev,"%pOF: failed to get orientation: %d\n" , - dsi->dev.of_node, ret); -return ret; - } - ret =drm_panel_of_backlight (&ctx->panel);if (ret)return ret;
drivers/gpu/drm/panel/panel-himax-hx83102.c +0 -14
@@ -17,7 +17,6 @@#include <drm/drm_connector.h> #include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <video/mipi_display.h>
@@ -62,7 +61,6 @@ struct hx83102 {const struct hx83102_panel_desc *desc; -enum drm_panel_orientation orientation;struct regulator *pp1800;struct regulator *avee;struct regulator *avdd;
@@ -1173,20 +1171,12 @@ static int hx83102_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation hx83102_get_orientation (struct drm_panel *panel) -{ -struct hx83102 *ctx =panel_to_hx83102 (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs hx83102_drm_funcs = { .disable = hx83102_disable, .unprepare = hx83102_unprepare, .prepare = hx83102_prepare, .enable = hx83102_enable, .get_modes = hx83102_get_modes, - .get_orientation = hx83102_get_orientation, };static int hx83102_bl_update_status (struct backlight_device *bl)
@@ -1265,10 +1255,6 @@ static int hx83102_panel_add(struct hx83102 *ctx) ctx->base.prepare_prev_first = true; - err =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (err <0 ) -return dev_err_probe (dev, err,"failed to get orientation\n" ); - err =drm_panel_of_backlight (&ctx->base);if (err)return err;
drivers/gpu/drm/panel/panel-himax-hx8394.c +0 -16
@@ -21,7 +21,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #define DRV_NAME "panel-himax-hx8394"
@@ -71,7 +70,6 @@ struct hx8394 {struct gpio_desc *reset_gpio;struct regulator *vcc;struct regulator *iovcc; -enum drm_panel_orientation orientation;const struct hx8394_panel_desc *desc; };
@@ -959,20 +957,12 @@ static int hx8394_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation hx8394_get_orientation (struct drm_panel *panel) -{ -struct hx8394 *ctx =panel_to_hx8394 (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs hx8394_drm_funcs = { .disable = hx8394_disable, .unprepare = hx8394_unprepare, .prepare = hx8394_prepare, .enable = hx8394_enable, .get_modes = hx8394_get_modes, - .get_orientation = hx8394_get_orientation, };static int hx8394_probe (struct mipi_dsi_device *dsi)
@@ -992,12 +982,6 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset gpio\n" ); - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, ret); -return ret; - } -mipi_dsi_set_drvdata (dsi, ctx); ctx->dev = dev;
drivers/gpu/drm/panel/panel-ilitek-ili7836a.c +0 -16
@@ -11,7 +11,6 @@#include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -29,7 +28,6 @@ struct ili7836a_panel {struct regulator_bulk_data *supplies;struct gpio_desc *reset_gpio;struct ili7836a_desc *desc; -enum drm_panel_orientation orientation; };struct ili7836a_desc {
@@ -172,19 +170,11 @@ static int ili7836a_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, ctx->desc->modes); } -static enum drm_panel_orientation ili7836a_get_orientation (struct drm_panel *panel) -{ -struct ili7836a_panel *ctx =to_ili7836a_panel (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs ili7836a_panel_funcs = { .prepare = ili7836a_prepare, .unprepare = ili7836a_unprepare, .disable = ili7836a_disable, .get_modes = ili7836a_get_modes, - .get_orientation = ili7836a_get_orientation, };static int ili7836a_bl_update_status (struct backlight_device *bl)
@@ -250,12 +240,6 @@ static int ili7836a_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset-gpios\n" ); - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, ret); -return ret; - } - ctx->dsi = dsi;mipi_dsi_set_drvdata (dsi, ctx);
drivers/gpu/drm/panel/panel-ilitek-ili9488.c +0 -14
@@ -13,7 +13,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -34,7 +33,6 @@ struct ili9488 {struct gpio_desc *reset;struct regulator_bulk_data supplies[2 ];const struct ili9488_desc *desc; -enum drm_panel_orientation orientation; };static const char *const regulator_names[] = {
@@ -193,18 +191,10 @@ static int ili9488_get_modes(struct drm_panel *panel, struct drm_connector *connreturn drm_connector_helper_get_modes_fixed (connector, mode); } -static enum drm_panel_orientation ili9488_get_orientation (struct drm_panel *panel) -{ -struct ili9488 *ili =panel_to_ili9488 (panel); - -return ili->orientation; -} -static const struct drm_panel_funcs ili9488_funcs = { .prepare = ili9488_prepare, .unprepare = ili9488_unprepare, .get_modes = ili9488_get_modes, - .get_orientation = ili9488_get_orientation, };static int ili9488_dsi_probe (struct mipi_dsi_device *dsi)
@@ -238,10 +228,6 @@ static int ili9488_dsi_probe(struct mipi_dsi_device *dsi)if (ret <0 )return dev_err_probe (dev, ret,"failed to get regulators\n" ); - ret =drm_of_get_panel_orientation (dev->of_node, &ili->orientation); -if (ret) -return dev_err_probe (dev, ret,"failed to get orientation\n" ); - ret =drm_panel_of_backlight (&ili->panel);if (ret)return dev_err_probe (dev, ret,"failed to get backlight\n" );
drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c +0 -14
@@ -9,7 +9,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -28,7 +27,6 @@ struct ili9806e_dsi_panel_desc {struct ili9806e_dsi_panel {struct mipi_dsi_device *dsi;const struct ili9806e_dsi_panel_desc *desc; -enum drm_panel_orientation orientation; };static int ili9806e_dsi_on (struct ili9806e_dsi_panel *ili9806e)
@@ -99,18 +97,10 @@ static int ili9806e_dsi_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, mode); } -static enum drm_panel_orientation ili9806e_dsi_get_orientation (struct drm_panel *panel) -{ -struct ili9806e_dsi_panel *ctx =ili9806e_get_transport (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs ili9806e_dsi_funcs = { .prepare = ili9806e_dsi_prepare, .unprepare = ili9806e_dsi_unprepare, .get_modes = ili9806e_dsi_get_modes, - .get_orientation = ili9806e_dsi_get_orientation, };static int ili9806e_dsi_probe (struct mipi_dsi_device *dsi)
@@ -132,10 +122,6 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi) dsi->format = ctx->desc->format; dsi->lanes = ctx->desc->lanes; - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret) -return dev_err_probe (dev, ret,"Failed to get orientation\n" ); - ret =ili9806e_probe (dev, ctx, &ili9806e_dsi_funcs,DRM_MODE_CONNECTOR_DSI );if (ret)
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +2 -19
@@ -16,7 +16,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <video/mipi_display.h>
@@ -56,7 +55,6 @@ struct ili9881c {struct regulator *iovcc;struct gpio_desc *reset; -enum drm_panel_orientation orientation;u8 address_mode; };
@@ -2523,18 +2521,10 @@ static int ili9881c_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation ili9881c_get_orientation (struct drm_panel *panel) -{ -struct ili9881c *ctx =panel_to_ili9881c (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs ili9881c_funcs = { .prepare = ili9881c_prepare, .unprepare = ili9881c_unprepare, .get_modes = ili9881c_get_modes, - .get_orientation = ili9881c_get_orientation, };static int ili9881c_dsi_probe (struct mipi_dsi_device *dsi)
@@ -2569,17 +2559,10 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)return dev_err_probe (&dsi->dev,PTR_ERR (ctx->reset),"Couldn't get our reset GPIO\n" ); - ret =drm_of_get_panel_orientation (dsi->dev.of_node, &ctx->orientation); -if (ret) { -dev_err (&dsi->dev,"%pOF: failed to get orientation: %d\n" , - dsi->dev.of_node, ret); -return ret; - } - ctx->address_mode = ctx->desc->default_address_mode; -if (ctx->orientation ==DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP ) { +if (ctx->panel.orientation ==DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP ) { ctx->address_mode ^=0x03 ; - ctx->orientation =DRM_MODE_PANEL_ORIENTATION_NORMAL ; + ctx->panel.orientation =DRM_MODE_PANEL_ORIENTATION_NORMAL ; } ctx->panel.prepare_prev_first = true;
drivers/gpu/drm/panel/panel-ilitek-ili9882t.c +0 -16
@@ -13,7 +13,6 @@#include <drm/drm_connector.h> #include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <video/mipi_display.h>
@@ -52,7 +51,6 @@ struct ili9882t {const struct panel_desc *desc; -enum drm_panel_orientation orientation;struct regulator *pp3300;struct regulator *pp1800;struct regulator *avee;
@@ -978,20 +976,12 @@ static int ili9882t_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation ili9882t_get_orientation (struct drm_panel *panel) -{ -struct ili9882t *ili =to_ili9882t (panel); - -return ili->orientation; -} -static const struct drm_panel_funcs ili9882t_funcs = { .disable = ili9882t_disable, .unprepare = ili9882t_unprepare, .prepare = ili9882t_prepare, .enable = ili9882t_enable, .get_modes = ili9882t_get_modes, - .get_orientation = ili9882t_get_orientation, };static int ili9882t_add (struct ili9882t *ili)
@@ -1024,12 +1014,6 @@ static int ili9882t_add(struct ili9882t *ili)gpiod_set_value_cansleep (ili->enable_gpio,0 ); - err =drm_of_get_panel_orientation (dev->of_node, &ili->orientation); -if (err <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, err); -return err; - } - err =drm_panel_of_backlight (&ili->base);if (err)return err;
drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c +0 -13
@@ -45,7 +45,6 @@ struct jadard {struct drm_panel panel;struct mipi_dsi_device *dsi;const struct jadard_panel_desc *desc; -enum drm_panel_orientation orientation;struct regulator *vdd;struct regulator *vccio;struct gpio_desc *reset;
@@ -164,19 +163,11 @@ static int jadard_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, jadard->desc->mode_4ln); } -static enum drm_panel_orientation jadard_panel_get_orientation (struct drm_panel *panel) -{ -struct jadard *jadard =panel_to_jadard (panel); - -return jadard->orientation; -} -static const struct drm_panel_funcs jadard_funcs = { .disable = jadard_disable, .unprepare = jadard_unprepare, .prepare = jadard_prepare, .get_modes = jadard_get_modes, - .get_orientation = jadard_panel_get_orientation, };static int radxa_display_8hd_ad002_init_cmds (struct jadard *jadard)
@@ -3235,10 +3226,6 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)return dev_err_probe (&dsi->dev,PTR_ERR (jadard->vccio),"failed to get vccio regulator\n" ); - ret =drm_of_get_panel_orientation (dev->of_node, &jadard->orientation); -if (ret <0 ) -return dev_err_probe (dev, ret,"failed to get orientation\n" ); - ret =drm_panel_of_backlight (&jadard->panel);if (ret)return ret;
drivers/gpu/drm/panel/panel-lvds.c +0 -15
@@ -37,7 +37,6 @@ struct panel_lvds {struct gpio_desc *enable_gpio;struct gpio_desc *reset_gpio; -enum drm_panel_orientation orientation; };static inline struct panel_lvds *to_panel_lvds (struct drm_panel *panel)
@@ -101,18 +100,10 @@ static int panel_lvds_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation panel_lvds_get_orientation (struct drm_panel *panel) -{ -struct panel_lvds *lvds =to_panel_lvds (panel); - -return lvds->orientation; -} -static const struct drm_panel_funcs panel_lvds_funcs = { .unprepare = panel_lvds_unprepare, .prepare = panel_lvds_prepare, .get_modes = panel_lvds_get_modes, - .get_orientation = panel_lvds_get_orientation, };static int panel_lvds_parse_dt (struct panel_lvds *lvds)
@@ -120,12 +111,6 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)struct device_node *np = lvds->dev->of_node;int ret; - ret =drm_of_get_panel_orientation (np, &lvds->orientation); -if (ret <0 ) { -dev_err (lvds->dev,"%pOF: failed to get orientation %d\n" , np, ret); -return ret; - } - ret =of_get_drm_panel_display_mode (np, &lvds->dmode, &lvds->bus_flags);if (ret <0 ) { dev_err(lvds->dev, "%pOF: problems parsing panel-timing (%d)\n",
drivers/gpu/drm/panel/panel-novatek-nt36523.c +0 -16
@@ -19,7 +19,6 @@#include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #define DSI_NUM_MIN 1
@@ -28,7 +27,6 @@ struct panel_info {struct drm_panel panel;struct mipi_dsi_device *dsi[2 ];const struct panel_desc *desc; -enum drm_panel_orientation orientation;struct gpio_desc *reset_gpio;struct backlight_device *backlight;
@@ -1087,19 +1085,11 @@ static int nt36523_get_modes(struct drm_panel *panel,return pinfo->desc->num_modes; } -static enum drm_panel_orientation nt36523_get_orientation (struct drm_panel *panel) -{ -struct panel_info *pinfo =to_panel_info (panel); - -return pinfo->orientation; -} -static const struct drm_panel_funcs nt36523_panel_funcs = { .disable = nt36523_disable, .prepare = nt36523_prepare, .unprepare = nt36523_unprepare, .get_modes = nt36523_get_modes, - .get_orientation = nt36523_get_orientation, };static int nt36523_bl_update_status (struct backlight_device *bl)
@@ -1207,12 +1197,6 @@ static int nt36523_probe(struct mipi_dsi_device *dsi) pinfo->dsi[0 ] = dsi;mipi_dsi_set_drvdata (dsi, pinfo); - ret =drm_of_get_panel_orientation (dev->of_node, &pinfo->orientation); -if (ret <0 ) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, ret); -return ret; - } - pinfo->panel.prepare_prev_first = true;if (pinfo->desc->has_dcs_backlight) {
drivers/gpu/drm/panel/panel-renesas-r63419.c +0 -17
@@ -20,7 +20,6 @@#include <drm/drm_connector.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h>
@@ -32,7 +31,6 @@ struct renesas_r63419_panel {struct gpio_desc *reset_gpio;struct regulator_bulk_data *vdd_supplies;struct regulator_bulk_data *vcc_supplies; -enum drm_panel_orientation orientation; };/* VDDIO/VDD Supplies */
@@ -215,20 +213,11 @@ static int renesas_r63419_get_modes(struct drm_panel *panel,return drm_connector_helper_get_modes_fixed (connector, mode); } -static enum drm_panel_orientation -renesas_r63419_get_orientation (struct drm_panel *panel) -{ -struct renesas_r63419_panel *ctx =to_renesas_r63419_panel (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs renesas_r63419_panel_funcs = { .disable = renesas_r63419_disable, .prepare = renesas_r63419_prepare, .unprepare = renesas_r63419_unprepare, .get_modes = renesas_r63419_get_modes, - .get_orientation = renesas_r63419_get_orientation, };static int renesas_r63419_probe (struct mipi_dsi_device *dsi)
@@ -292,12 +281,6 @@ static int renesas_r63419_probe(struct mipi_dsi_device *dsi) ctx->dsi[0 ] = dsi;mipi_dsi_set_drvdata (dsi, ctx); -/* Get panel orientation */ - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 && ret != -ENODEV ) -return dev_err_probe (dev, ret, -"Failed to get panel orientation\n" ); - ctx->panel.prepare_prev_first = true; ret =drm_panel_of_backlight (&ctx->panel);
drivers/gpu/drm/panel/panel-simple.c +0 -15
@@ -161,7 +161,6 @@ struct panel_simple {struct drm_display_mode override_mode; -enum drm_panel_orientation orientation; };static inline struct panel_simple *to_panel_simple (struct drm_panel *panel)
@@ -399,20 +398,12 @@ static int panel_simple_get_modes(struct drm_panel *panel,return num; } -static enum drm_panel_orientation panel_simple_get_orientation (struct drm_panel *panel) -{ -struct panel_simple *p =to_panel_simple (panel); - -return p->orientation; -} -static const struct drm_panel_funcs panel_simple_funcs = { .disable = panel_simple_disable, .unprepare = panel_simple_unprepare, .prepare = panel_simple_prepare, .enable = panel_simple_enable, .get_modes = panel_simple_get_modes, - .get_orientation = panel_simple_get_orientation, };static struct panel_desc *panel_dpi_probe (struct device *dev)
@@ -669,12 +660,6 @@ static struct panel_simple *panel_simple_probe(struct device *dev)return dev_err_cast_probe (dev, panel->enable_gpio,"failed to request GPIO\n" ); - err =drm_of_get_panel_orientation (dev->of_node, &panel->orientation); -if (err) { -dev_err (dev,"%pOF: failed to get orientation %d\n" , dev->of_node, err); -return ERR_PTR (err); - } - ddc =of_parse_phandle (dev->of_node,"ddc-i2c-bus" ,0 );if (ddc) { panel->ddc =of_find_i2c_adapter_by_node (ddc);
drivers/gpu/drm/panel/panel-sitronix-st7701.c +0 -14
@@ -7,7 +7,6 @@#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <linux/bitfield.h>
@@ -139,7 +138,6 @@ struct st7701 {struct regulator_bulk_data supplies[2 ];struct gpio_desc *reset;unsigned int sleep_delay; -enum drm_panel_orientation orientation;int (*write_command)(struct st7701 *st7701,u8 cmd,const u8 *seq,size_t len);
@@ -638,20 +636,12 @@ static int st7701_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation st7701_get_orientation (struct drm_panel *panel) -{ -struct st7701 *st7701 =panel_to_st7701 (panel); - -return st7701->orientation; -} -static const struct drm_panel_funcs st7701_funcs = { .disable = st7701_disable, .unprepare = st7701_unprepare, .prepare = st7701_prepare, .enable = st7701_enable, .get_modes = st7701_get_modes, - .get_orientation = st7701_get_orientation, };static const struct drm_display_mode ts8550b_mode = {
@@ -1291,10 +1281,6 @@ static int st7701_probe(struct device *dev, int connector_type)return PTR_ERR (st7701->reset); } - ret =drm_of_get_panel_orientation (dev->of_node, &st7701->orientation); -if (ret <0 ) -return dev_err_probe (dev, ret,"Failed to get orientation\n" ); - st7701->panel.prepare_prev_first = true;/**
drivers/gpu/drm/panel/panel-sitronix-st7703.c +0 -14
@@ -20,7 +20,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #define DRV_NAME "panel-sitronix-st7703"
@@ -62,7 +61,6 @@ struct st7703 {struct dentry *debugfs;const struct st7703_panel_desc *desc; -enum drm_panel_orientation orientation; };struct st7703_panel_desc {
@@ -878,20 +876,12 @@ static int st7703_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation st7703_get_orientation (struct drm_panel *panel) -{ -struct st7703 *st7703 =panel_to_st7703 (panel); - -return st7703->orientation; -} -static const struct drm_panel_funcs st7703_drm_funcs = { .disable = st7703_disable, .unprepare = st7703_unprepare, .prepare = st7703_prepare, .enable = st7703_enable, .get_modes = st7703_get_modes, - .get_orientation = st7703_get_orientation, };static int allpixelson_set (void *data,u64 val)
@@ -969,10 +959,6 @@ static int st7703_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->iovcc),"Failed to request iovcc regulator\n" ); - ret =drm_of_get_panel_orientation (dsi->dev.of_node, &ctx->orientation); -if (ret <0 ) -return dev_err_probe (&dsi->dev, ret,"Failed to get orientation\n" ); - ret =drm_panel_of_backlight (&ctx->panel);if (ret)return ret;
drivers/gpu/drm/panel/panel-sitronix-st7789v.c +0 -14
@@ -14,7 +14,6 @@#include <drm/drm_device.h> #include <drm/drm_modes.h> -#include <drm/drm_of.h> #include <drm/drm_panel.h> #define ST7789V_RAMCTRL_CMD 0xb0
@@ -130,7 +129,6 @@ struct st7789v {struct spi_device *spi;struct gpio_desc *reset;struct regulator *power; -enum drm_panel_orientation orientation; };enum st7789v_prefix {
@@ -364,13 +362,6 @@ static int st7789v_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation st7789v_get_orientation (struct drm_panel *p) -{ -struct st7789v *ctx =panel_to_st7789v (p); - -return ctx->orientation; -} -static int st7789v_prepare (struct drm_panel *panel) {struct st7789v *ctx =panel_to_st7789v (panel);
@@ -601,7 +592,6 @@ static const struct drm_panel_funcs st7789v_drm_funcs = { .disable = st7789v_disable, .enable = st7789v_enable, .get_modes = st7789v_get_modes, - .get_orientation = st7789v_get_orientation, .prepare = st7789v_prepare, .unprepare = st7789v_unprepare, };
@@ -641,10 +631,6 @@ static int st7789v_probe(struct spi_device *spi)if (ret)return dev_err_probe (dev, ret,"Failed to get backlight\n" ); - ret =drm_of_get_panel_orientation (spi->dev.of_node, &ctx->orientation); -if (ret) -return dev_err_probe (&spi->dev, ret,"Failed to get orientation\n" ); -drm_panel_add (&ctx->panel);return 0 ;
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +0 -16
@@ -11,7 +11,6 @@#include <drm/display/drm_dsc.h> #include <drm/display/drm_dsc_helper.h> #include <drm/drm_mipi_dsi.h> -#include <drm/drm_of.h> #include <drm/drm_modes.h> #include <drm/drm_panel.h>
@@ -22,7 +21,6 @@ struct visionox_vtdr6130 {struct mipi_dsi_device *dsi;struct gpio_desc *reset_gpio;struct regulator_bulk_data *supplies; -enum drm_panel_orientation orientation;struct visionox_vtdr6130_desc *desc; };
@@ -370,18 +368,10 @@ static int visionox_vtdr6130_get_modes(struct drm_panel *panel,return 1 ; } -static enum drm_panel_orientation visionox_vtdr6130_get_orientation (struct drm_panel *panel) -{ -struct visionox_vtdr6130 *ctx =to_visionox_vtdr6130 (panel); - -return ctx->orientation; -} -static const struct drm_panel_funcs visionox_vtdr6130_panel_funcs = { .prepare = visionox_vtdr6130_prepare, .unprepare = visionox_vtdr6130_unprepare, .get_modes = visionox_vtdr6130_get_modes, - .get_orientation = visionox_vtdr6130_get_orientation, };static int visionox_vtdr6130_bl_update_status (struct backlight_device *bl)
@@ -447,12 +437,6 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) dsi->mode_flags = ctx->desc->mode_flags; ctx->panel.prepare_prev_first = true; - ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); -if (ret <0 ) { -dev_err (dev,"Failed to get orientation %d\n" , ret); -return ret; - } - ctx->panel.backlight =visionox_vtdr6130_create_backlight (dsi);if (IS_ERR (ctx->panel.backlight)) return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
Signature · 1 line
2.47.3
PATCH 25/35 drm/panel: remove the get_orientation() callback
In reply to Dmitry BaryshkovAll implementations were copies of the code that lives in the panel core now, and none is left.
--- drivers/gpu/drm/drm_connector.c | 9 +++------ include/drm/drm_panel.h | 9 --------- 2 files changed, 3 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_connector.c +3 -6
@@ -3392,13 +3392,12 @@ EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);/** * drm_connector_set_orientation_from_panel - -* set the connector's panel_orientation from panel's callback. +* set the connector's panel_orientation from the panel. * @connector: connector for which to init the panel-orientation property. * @panel: panel that can provide orientation information. * * Drm drivers should call this function before drm_dev_register(). -* Orientation is obtained from panel's .get_orientation() callback, falling -* back to &drm_panel.orientation if the panel doesn't implement it. +* Orientation is obtained from &drm_panel.orientation. * * Returns: * Zero on success, negative errno on failure.
@@ -3409,9 +3408,7 @@ int drm_connector_set_orientation_from_panel( {enum drm_panel_orientation orientation; -if (panel && panel->funcs && panel->funcs->get_orientation) - orientation = panel->funcs->get_orientation (panel); -else if (panel) +if (panel) orientation = panel->orientation;else orientation =DRM_MODE_PANEL_ORIENTATION_UNKNOWN ;
include/drm/drm_panel.h +0 -9
@@ -121,15 +121,6 @@ struct drm_panel_funcs {int (*get_modes)(struct drm_panel *panel,struct drm_connector *connector); -/** -* @get_orientation: -* -* Return the panel orientation set by device tree or EDID. -* -* This function is optional. -*/ -enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel); -/** * @debugfs_init: *
Signature · 1 line
2.47.3
PATCH 26/35 drm/bridge: add the connector_init callback
In reply to Dmitry BaryshkovA bridge has no way to take part in setting up the connector created for its chain. Whatever a bridge needs on the connector ends up special-cased in the code creating it: drm_bridge_connector looks for a panel bridge in order to set the panel orientation and checks the dedicated drm_bridge.support_hdcp flag to attach the content protection property, the msm DP driver attaches the DP subconnector property after creating the bridge connector. A DP bridge which is not a part of the display driver cannot get the DP properties attached at all.
Add an optional callback for that and a function calling it for the whole chain. The function is separate from drm_bridge_connector, so that the drivers creating the connector on their own can use it too.
Only the panel orientation is going to be converted for now, support_hdcp and the DP properties are left for later.
--- drivers/gpu/drm/drm_bridge.c | 31 +++++++++++++++++++++++++++++++ include/drm/drm_bridge.h | 23 +++++++++++++++++++++++ 2 files changed, 54 insertions(+)
drivers/gpu/drm/drm_bridge.c +31 -0
@@ -846,6 +846,37 @@ void drm_bridge_chain_mode_set(struct drm_bridge *first_bridge, }EXPORT_SYMBOL (drm_bridge_chain_mode_set); +/** +* drm_bridge_chain_connector_init - let the bridges set up a connector +* @encoder: encoder the connector has been created for +* @connector: the connector +* +* Calls &drm_bridge_funcs.connector_init for all the bridges in the encoder +* chain, starting from the first bridge to the last. It should be called by +* the code creating a connector for the chain, after the connector has been +* initialized and before it is registered. +* +* RETURNS: +* 0 on success, a negative error code on failure +*/ +int drm_bridge_chain_connector_init (struct drm_encoder *encoder, +struct drm_connector *connector) +{ +drm_for_each_bridge_in_chain (encoder, bridge) { +int ret; + +if (!bridge->funcs->connector_init) +continue ; + + ret = bridge->funcs->connector_init (bridge, connector); +if (ret) +return ret; + } + +return 0 ; +} +EXPORT_SYMBOL (drm_bridge_chain_connector_init); +/** * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain * @bridge: bridge control structure
include/drm/drm_bridge.h +23 -0
@@ -881,6 +881,27 @@ struct drm_bridge_funcs {struct drm_connector *connector, bool enable, int direction); +/** +* @connector_init: +* +* Called when a connector is created for the encoder chain containing +* this bridge, before the connector is registered. This lets the bridge +* set up the parts of the connector it knows about, e.g. attach +* properties. +* +* The callback is invoked through drm_bridge_chain_connector_init(), +* it is not tied to the bridge being the last one in the chain or to +* the &drm_bridge.ops of the bridge. The bridge chain is locked while +* it runs, so it must not attach or detach bridges. +* +* This callback is optional. +* +* Returns: +* 0 on success, a negative error code otherwise +*/ +int (*connector_init)(struct drm_bridge *bridge, +struct drm_connector *connector); +/** * @debugfs_init: *
@@ -1484,6 +1505,8 @@ enum drm_mode_status drm_bridge_chain_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info, const struct drm_display_mode *mode); +int drm_bridge_chain_connector_init (struct drm_encoder *encoder, +struct drm_connector *connector);void drm_bridge_chain_mode_set (struct drm_bridge *bridge,const struct drm_display_mode *mode,const struct drm_display_mode *adjusted_mode);
Signature · 1 line
2.47.3
PATCH 27/35 drm/bridge-connector: let the bridges set up the connector
In reply to Dmitry BaryshkovCall drm_bridge_chain_connector_init() once the connector is initialized, so that the bridges implementing the connector_init callback get to set up their part of it.
--- drivers/gpu/drm/display/drm_bridge_connector.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/display/drm_bridge_connector.c +4 -0
@@ -1141,6 +1141,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ; + ret =drm_bridge_chain_connector_init (encoder, connector); +if (ret) +return ERR_PTR (ret); +if (panel_bridge)drm_panel_bridge_set_orientation (connector, panel_bridge);
Signature · 1 line
2.47.3
Maxime Ripard
maintainerRe: [PATCH 27/35] drm/bridge-connector: let the bridges set up the connector
Quoted 15 lines · Dmitry Baryshkov
Call
drm_bridge_chain_connector_init()once the connector is initialized, so that the bridges implementing theconnector_initcallback get to set up their part of it.Assisted-by LLMSigned-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/display/drm_bridge_connector.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/display/drm_bridge_connector.c +0
-0
drivers/gpu/drm/display/drm_bridge_connector.c struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, · line 1149
Quoted 9 lines
drivers/gpu/drm/display/drm_bridge_connector.c +4
-0@@ -1141,6 +1141,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ; + ret =drm_bridge_chain_connector_init (encoder, connector); +if (ret) +return ERR_PTR (ret); +if (panel_bridge)drm_panel_bridge_set_orientation (connector, panel_bridge);
I don't really mind this change, but we should have a user for it and it doesn't look like you have any in this series?
Maxime
Quoted 63 lines · Dmitry Baryshkov
The panel is the only element of the display pipeline which never sees the atomic commit. Its
prepare()andenable()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 inget_modes()and readsconnector->state->crtc->statewhile 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_bridgeembedded 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 structdrm_panel_funcsinto a copy of that, let the panel driver provide structdrm_bridge_funcsfor the embedded bridge. This is opt-in:
the panels which have no use for the atomic state keep using structdrm_panel_funcsand 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_funcsfor 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 newconnector_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()andunprepare()returned an error which nobody could act on. Worse, a failedunprepare()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_dvoand 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 fromget_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 callingdrm_panel_prepare()directly have no commit to pass.Signed-off-by Dmitry Baryshkov <[email protected]>
Quoted 15 lines
---
Dmitry Baryshkov (35):
drm/panel: remove theget_timings()callback drm/panel: remove the unused structpanel_bridgedrm/tidss: get the panel type from the embedded bridge drm/bridge: lvds-codec: usedevm_drm_panel_bridge_add()drm/ingenic: usedevm_drm_panel_bridge_add()
drm: mxsfb: usedevm_drm_panel_bridge_add()
drm: rcar-du: usedevm_drm_panel_bridge_add()
drm: rz-du: usedevm_drm_panel_bridge_add()drm/mcde: usedrm_panel_bridge_add()drm/pl111: usedrm_panel_bridge_add()drm/rockchip: lvds: usedrm_panel_bridge_add()drm/rockchip: rgb: usedrm_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.
Quoted 23 lines
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 fromget_modes()drm/panel: read the panel orientation in the core drm/panel: use the orientation from the panel core drm/panel: remove theget_orientation()callback drm/bridge: add theconnector_initcallback 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 theconnector_initcallback 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 structdrm_bridge_funcsdrm/panel: novatek-nt35950: provide structdrm_bridge_funcsdrm/panel: novatek-nt35950: use the atomic state to select the mode
Signature · 2 lines
With best wishes Dmitry
Luca Ceresoli
reviewerHi Dmitry,
Quoted 80 lines · Dmitry Baryshkov
Quoted 63 lines · Dmitry Baryshkov
The panel is the only element of the display pipeline which never sees the atomic commit. Its
prepare()andenable()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 inget_modes()and readsconnector->state->crtc->statewhile 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_bridgeembedded 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 structdrm_panel_funcsinto a copy of that, let the panel driver provide structdrm_bridge_funcsfor the embedded bridge. This is opt-in:
the panels which have no use for the atomic state keep using structdrm_panel_funcsand 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_funcsfor 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 newconnector_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()andunprepare()returned an error which nobody could act on. Worse, a failedunprepare()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_dvoand 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 fromget_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 callingdrm_panel_prepare()directly have no commit to pass.Signed-off-by Dmitry Baryshkov <[email protected]>Quoted 15 lines
---
Dmitry Baryshkov (35):
drm/panel: remove theget_timings()callback drm/panel: remove the unused structpanel_bridgedrm/tidss: get the panel type from the embedded bridge drm/bridge: lvds-codec: usedevm_drm_panel_bridge_add()drm/ingenic: usedevm_drm_panel_bridge_add()
drm: mxsfb: usedevm_drm_panel_bridge_add()
drm: rcar-du: usedevm_drm_panel_bridge_add()
drm: rz-du: usedevm_drm_panel_bridge_add()drm/mcde: usedrm_panel_bridge_add()drm/pl111: usedrm_panel_bridge_add()drm/rockchip: lvds: usedrm_panel_bridge_add()drm/rockchip: rgb: usedrm_panel_bridge_add()drm/panel: remove the_typed()panel bridge functions
Quoted 4 lines
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
Quoted 88 lines · Luca Ceresoli
Hi Dmitry,
Quoted 80 lines · Dmitry Baryshkov
Quoted 63 lines · Dmitry Baryshkov
The panel is the only element of the display pipeline which never sees the atomic commit. Its
prepare()andenable()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 inget_modes()and readsconnector->state->crtc->statewhile 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_bridgeembedded 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 structdrm_panel_funcsinto a copy of that, let the panel driver provide structdrm_bridge_funcsfor the embedded bridge. This is opt-in:
the panels which have no use for the atomic state keep using structdrm_panel_funcsand 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_funcsfor 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 newconnector_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()andunprepare()returned an error which nobody could act on. Worse, a failedunprepare()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_dvoand 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 fromget_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 callingdrm_panel_prepare()directly have no commit to pass.Signed-off-by Dmitry Baryshkov <[email protected]>Quoted 15 lines
---
Dmitry Baryshkov (35):
drm/panel: remove theget_timings()callback drm/panel: remove the unused structpanel_bridgedrm/tidss: get the panel type from the embedded bridge drm/bridge: lvds-codec: usedevm_drm_panel_bridge_add()drm/ingenic: usedevm_drm_panel_bridge_add()
drm: mxsfb: usedevm_drm_panel_bridge_add()
drm: rcar-du: usedevm_drm_panel_bridge_add()
drm: rz-du: usedevm_drm_panel_bridge_add()drm/mcde: usedrm_panel_bridge_add()drm/pl111: usedrm_panel_bridge_add()drm/rockchip: lvds: usedrm_panel_bridge_add()drm/rockchip: rgb: usedrm_panel_bridge_add()drm/panel: remove the_typed()panel bridge functionsQuoted 4 lines
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.
Quoted 4 lines
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+.
Signature · 2 lines
With best wishes Dmitry
Luca Ceresoli
reviewerHi Dmitry,
On Sat Oct 31, 2026 at 5:44 PM CET, Dmitry Baryshkov wrote:
...
Quoted 7 lines
Quoted 4 lines
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