linux/drivers/gpu/drm/rcar-du
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: rcar-du: Add support for CMM 2019-12-18 02:40:03 +02:00
Makefile drm: rcar-du: Add support for CMM 2019-12-18 02:40:03 +02:00
rcar_cmm.c drm: rcar-du: Add support for CMM 2019-12-18 02:40:03 +02:00
rcar_cmm.h drm: rcar-du: Add support for CMM 2019-12-18 02:40:03 +02:00
rcar_du_crtc.c R-Car Display Unit changes: 2019-12-18 16:19:26 +01:00
rcar_du_crtc.h drm: rcar-du: kms: Initialize CMM instances 2019-12-18 02:40:04 +02:00
rcar_du_drv.c drm: rcar-du: Add r8a77980 support 2019-12-18 02:40:29 +02:00
rcar_du_drv.h drm: rcar-du: kms: Initialize CMM instances 2019-12-18 02:40:04 +02:00
rcar_du_encoder.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
rcar_du_encoder.h drm: rcar-du: Simplify encoder registration 2019-02-08 02:25:55 +02:00
rcar_du_group.c drm: rcar-du: crtc: Control CMM operations 2019-12-18 02:40:05 +02:00
rcar_du_group.h drm: rcar-du: kms: Initialize CMM instances 2019-12-18 02:40:04 +02:00
rcar_du_kms.c drm: rcar-du: Recognize "renesas,vsps" in addition to "vsps" 2019-12-18 02:40:10 +02:00
rcar_du_kms.h drm: rcar-du: Store V4L2 fourcc in rcar_du_format_info structure 2019-03-18 17:24:45 +02:00
rcar_du_of_lvds_r8a7790.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7791.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7793.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7795.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7796.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of.c drm: rcar-du: of: Include header to define prototypes 2018-05-05 17:11:15 +03:00
rcar_du_of.h drm: rcar-du: Fix rcar_du_of_init() stub 2018-05-17 15:03:32 +10:00
rcar_du_plane.c drm/rcar-du: prepare for drmP.h removal from drm_modeset_helper.h 2019-02-07 21:48:19 +01:00
rcar_du_plane.h drm: rcar-du: Remove inclusion of drmP.h 2019-01-14 03:51:33 +02:00
rcar_du_regs.h drm: rcar-du: crtc: Control CMM operations 2019-12-18 02:40:05 +02:00
rcar_du_vsp.c drm: rcar-du: Link CRTCs to the DU device 2019-03-28 06:06:33 +02:00
rcar_du_vsp.h drm: rcar-du: vsp: Extract framebuffer (un)mapping to separate functions 2019-03-18 17:24:46 +02:00
rcar_du_writeback.c drm: Free the writeback_job when it with an empty fb 2019-09-23 15:31:53 +08:00
rcar_du_writeback.h drm: rcar-du: Add writeback support for R-Car Gen3 2019-03-18 17:24:51 +02:00
rcar_dw_hdmi.c drm-misc-next for 5.1: 2019-01-18 09:31:28 +10:00
rcar_lvds_regs.h drm: rcar-du: lvds: D3/E3 support 2018-09-25 00:40:56 +03:00
rcar_lvds.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
rcar_lvds.h drm: rcar-du: lvds: Add support for dual-link mode 2019-06-08 02:36:04 +03:00