OpenCloudOS-Kernel/drivers/gpu/drm/exynos
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/exynos: Rename Exynos to lowercase 2020-01-21 09:09:42 +09:00
Makefile drm/exynos/iommu: merge IOMMU and DMA code 2018-12-04 13:23:17 +09:00
exynos7_drm_decon.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos5433_drm_decon.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_dp.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
exynos_drm_crtc.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_drm_crtc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_dma.c drm/exynos: drop drmP.h usage 2019-06-27 19:56:09 +09:00
exynos_drm_dpi.c drm/panel: decouple connector from drm_panel 2019-12-09 22:57:26 +01:00
exynos_drm_drv.c drm main pull for 5.4-rc1 2019-09-19 16:24:24 -07:00
exynos_drm_drv.h drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_drm_dsi.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
exynos_drm_fb.c drm/exynos: drop drmP.h usage 2019-06-27 19:56:09 +09:00
exynos_drm_fb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_fbdev.c drm: constify fb ops across all drivers 2019-12-05 10:57:42 +02:00
exynos_drm_fbdev.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_fimc.c drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_fimd.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_drm_g2d.c drm/exynos: remove redundant assignment to pointer 'node' 2019-08-02 15:28:47 +09:00
exynos_drm_g2d.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 423 2019-06-05 17:37:15 +02:00
exynos_drm_gem.c Revert "drm/gem: Rename drm_gem_dumb_map_offset() to drm_gem_map_offset()" 2019-08-07 11:56:48 -04:00
exynos_drm_gem.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_gsc.c drm/exynos: gsc: add missed component_del 2019-12-19 08:52:42 +09:00
exynos_drm_ipp.c drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_ipp.h drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_mic.c drm: Stop including drm_bridge.h from drm_crtc.h 2019-08-28 22:11:03 +02:00
exynos_drm_plane.c drm/exynos: drop drmP.h usage 2019-06-27 19:56:09 +09:00
exynos_drm_plane.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_rotator.c drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_scaler.c drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_vidi.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_drm_vidi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_hdmi.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
exynos_mixer.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
regs-decon7.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
regs-decon5433.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 423 2019-06-05 17:37:15 +02:00
regs-fimc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-gsc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-hdmi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-mixer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-rotator.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-scaler.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-vp.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00