linux/drivers/gpu/drm/sun4i
Laurent Pinchart a25b988ff8 drm/bridge: Extend bridge API to disable connector creation
Most bridge drivers create a DRM connector to model the connector at the
output of the bridge. This model is historical and has worked pretty
well so far, but causes several issues:

- It prevents supporting more complex display pipelines where DRM
connector operations are split over multiple components. For instance a
pipeline with a bridge connected to the DDC signals to read EDID data,
and another one connected to the HPD signal to detect connection and
disconnection, will not be possible to support through this model.

- It requires every bridge driver to implement similar connector
handling code, resulting in code duplication.

- It assumes that a bridge will either be wired to a connector or to
another bridge, but doesn't support bridges that can be used in both
positions very well (although there is some ad-hoc support for this in
the analogix_dp bridge driver).

In order to solve these issues, ownership of the connector should be
moved to the display controller driver (where it can be implemented
using helpers provided by the core).

Extend the bridge API to allow disabling connector creation in bridge
drivers as a first step towards the new model. The new flags argument to
the bridge .attach() operation allows instructing the bridge driver to
skip creating a connector. Unconditionally set the new flags argument to
0 for now to keep the existing behaviour, and modify all existing bridge
drivers to return an error when connector creation is not requested as
they don't support this feature yet.

The change is based on the following semantic patch, with manual review
and edits.

@ rule1 @
identifier funcs;
identifier fn;
@@
 struct drm_bridge_funcs funcs = {
 	...,
 	.attach = fn
 };

@ depends on rule1 @
identifier rule1.fn;
identifier bridge;
statement S, S1;
@@
 int fn(
 	struct drm_bridge *bridge
+	, enum drm_bridge_attach_flags flags
 )
 {
 	... when != S
+	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
+		DRM_ERROR("Fix bridge driver to make connector optional!");
+		return -EINVAL;
+	}
+
 	S1
 	...
 }

@ depends on rule1 @
identifier rule1.fn;
identifier bridge, flags;
expression E1, E2, E3;
@@
 int fn(
 	struct drm_bridge *bridge,
 	enum drm_bridge_attach_flags flags
 ) {
 <...
 drm_bridge_attach(E1, E2, E3
+	, flags
 )
 ...>
 }

@@
expression E1, E2, E3;
@@
 drm_bridge_attach(E1, E2, E3
+	, 0
 )

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-10-laurent.pinchart@ideasonboard.com
2020-02-26 13:31:23 +02:00
..
Kconfig drm/sun4i: Fix Kconfig indentation 2019-11-25 10:04:41 +01:00
Makefile
sun4i_backend.c drm/sun4i: backend: Make sure we enforce the clock rate 2020-01-08 09:13:47 +01:00
sun4i_backend.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_crtc.c drm/sun4i: drop use of drmP.h 2019-07-17 12:52:45 +02:00
sun4i_crtc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_dotclock.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_dotclock.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_drv.c Fixes for v5.6: 2020-02-14 12:53:00 +10:00
sun4i_drv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_framebuffer.c drm/sun4i: drop use of drmP.h 2019-07-17 12:52:45 +02:00
sun4i_framebuffer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_frontend.c drm/sun4i: drop use of drmP.h 2019-07-17 12:52:45 +02:00
sun4i_frontend.h
sun4i_hdmi_ddc_clk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_hdmi_enc.c drm/sun4i: hdmi: Remove duplicate cleanup calls 2019-12-18 23:17:32 +01:00
sun4i_hdmi_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_hdmi_tmds_clk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_hdmi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_layer.c drm/sun4i: Remove unneeded semicolon in sun4i_layer.c 2019-12-14 18:48:15 +01:00
sun4i_layer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_lvds.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
sun4i_lvds.h
sun4i_rgb.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
sun4i_rgb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun4i_tcon.c drm/sun4i: tcon: Support LVDS on the A33 2020-02-21 14:14:02 +01:00
sun4i_tcon.h drm/sun4i: tcon: Support LVDS output on Allwinner A20 2020-02-20 18:25:36 +01:00
sun4i_tv.c drm/sun4i: drop use of drmP.h 2019-07-17 12:52:45 +02:00
sun6i_drc.c drm/sun4i: drc: Make sure we enforce the clock rate 2020-01-08 09:14:08 +01:00
sun6i_mipi_dsi.c drm/sun4i: dsi: Avoid hotplug race with DRM driver bind 2020-02-19 16:56:57 +01:00
sun6i_mipi_dsi.h drm/sun4i: dsi: Allow binding the host without a panel 2020-02-14 16:20:27 +01:00
sun8i_csc.c drm/sun4i: sun8i-csc: Add support for color encoding and range 2019-07-20 07:38:09 +02:00
sun8i_csc.h drm/sun4i: sun8i-csc: Add support for color encoding and range 2019-07-20 07:38:09 +02:00
sun8i_dw_hdmi.c drm/sun4i: Enable DRM InfoFrame support on H6 2019-10-10 12:50:03 +02:00
sun8i_dw_hdmi.h drm/sun4i: Enable DRM InfoFrame support on H6 2019-10-10 12:50:03 +02:00
sun8i_hdmi_phy_clk.c
sun8i_hdmi_phy.c drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz 2019-05-16 10:44:52 +02:00
sun8i_mixer.c drm/sun4i: Remove unneeded semicolon in sun8i_mixer.c 2019-12-14 18:48:07 +01:00
sun8i_mixer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun8i_tcon_top.c drm/sun4i: drop use of drmP.h 2019-07-17 12:52:45 +02:00
sun8i_tcon_top.h
sun8i_ui_layer.c drm/sun4i: drop use of drmP.h 2019-07-17 12:52:45 +02:00
sun8i_ui_layer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun8i_ui_scaler.c
sun8i_ui_scaler.h
sun8i_vi_layer.c drm/sun4i: sun8i-csc: Add support for color encoding and range 2019-07-20 07:38:09 +02:00
sun8i_vi_layer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sun8i_vi_scaler.c
sun8i_vi_scaler.h
sunxi_engine.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00