linux-stable/drivers/gpu/drm/rockchip
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
..
analogix_dp-rockchip.c drm main pull for 5.4-rc1 2019-09-19 16:24:24 -07:00
cdn-dp-core.c drm/rockchip: Avoid drm_dp_link helpers 2019-10-23 18:21:01 +02:00
cdn-dp-core.h drm/rockchip: fix integer type used for storing dp data rate 2020-01-13 14:31:59 +01:00
cdn-dp-reg.c drm/rockchip: Avoid drm_dp_link helpers 2019-10-23 18:21:01 +02:00
cdn-dp-reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
dw-mipi-dsi-rockchip.c drm/rockchip: dsi: add px30 support 2019-12-16 12:03:49 +01:00
dw_hdmi-rockchip.c drm/rockchip: Enable DRM InfoFrame support on RK3328 and RK3399 2019-10-10 12:50:01 +02:00
inno_hdmi.c drm: rockchip: Provide ddc symlink in inno_hdmi sysfs directory 2019-11-07 15:07:28 +01:00
inno_hdmi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
Kconfig drm/bridge/synopsys: dsi: driver-specific configuration of phy timings 2019-12-16 12:01:58 +01:00
Makefile drm/rockchip: Use the helpers for PSR 2019-07-26 14:48:03 -04:00
rk3066_hdmi.c drm: rockchip: rk3066_hdmi: set edid fifo address 2020-01-06 12:22:29 +01:00
rk3066_hdmi.h
rockchip_drm_drv.c drm main pull for 5.4-rc1 2019-09-19 16:24:24 -07:00
rockchip_drm_drv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
rockchip_drm_fb.c drm/rockchip: Use drm_gem_fb_create_with_dirty 2019-11-29 09:58:28 +01:00
rockchip_drm_fb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
rockchip_drm_fbdev.c drm: constify fb ops across all drivers 2019-12-05 10:57:42 +02:00
rockchip_drm_fbdev.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
rockchip_drm_gem.c drm/rockchip: Add missing vmalloc header 2020-01-13 14:54:35 +01:00
rockchip_drm_gem.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
rockchip_drm_vop.c drm/rockchip: plane_state->fb iff plane_state->crtc 2020-01-28 15:42:23 +01:00
rockchip_drm_vop.h drm/rockchip: use DIV_ROUND_UP macro for calculations. 2020-01-13 14:04:00 +01:00
rockchip_lvds.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
rockchip_lvds.h drm/rockchip: lvds: Add PX30 support 2020-01-06 11:56:02 +01:00
rockchip_rgb.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
rockchip_rgb.h
rockchip_vop_reg.c drm/rockchip: vop: add the definition of dclk_pol 2019-10-13 23:56:17 +02:00
rockchip_vop_reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00