diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-01-04 11:41:10 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-01-04 11:41:10 +0100 |
commit | ef426c103892eed94a9bb0ee59c2d0e6eac5179f (patch) | |
tree | 2d998f23fa6e3b3c51f4829f1f881b42e79b7c04 /drivers/gpu/drm/drm_bridge.c | |
parent | a402eae64d0ad12b1c4a411f250d6c161e67f623 (diff) | |
parent | 9b8b75de4cb379187c481a5332a12429f31c0887 (diff) | |
download | talos-obmc-linux-ef426c103892eed94a9bb0ee59c2d0e6eac5179f.tar.gz talos-obmc-linux-ef426c103892eed94a9bb0ee59c2d0e6eac5179f.zip |
Merge tag 'drm-misc-next-2016-12-30' of git://anongit.freedesktop.org/git/drm-misc into drm-intel-next-queued
Directly merge drm-misc into drm-intel since Dave is on vacation and
we need the various drm-misc patches (fb format rework, drm mm fixes,
selftest framework and others). Also pulled back -rc2 in first to
resync with drm-intel-fixes and make sure I can reuse the exact rerere
solutions from drm-tip for safety, and because I'm lazy.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/gpu/drm/drm_bridge.c')
-rw-r--r-- | drivers/gpu/drm/drm_bridge.c | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 0ee052b7c21a..cd10095e8d00 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -26,6 +26,9 @@ #include <linux/mutex.h> #include <drm/drm_bridge.h> +#include <drm/drm_encoder.h> + +#include "drm_crtc_internal.h" /** * DOC: overview @@ -92,47 +95,58 @@ void drm_bridge_remove(struct drm_bridge *bridge) EXPORT_SYMBOL(drm_bridge_remove); /** - * drm_bridge_attach - associate given bridge to our DRM device + * drm_bridge_attach - attach the bridge to an encoder's chain * - * @dev: DRM device - * @bridge: bridge control structure + * @encoder: DRM encoder + * @bridge: bridge to attach + * @previous: previous bridge in the chain (optional) * - * Called by a kms driver to link one of our encoder/bridge to the given - * bridge. + * Called by a kms driver to link the bridge to an encoder's chain. The previous + * argument specifies the previous bridge in the chain. If NULL, the bridge is + * linked directly at the encoder's output. Otherwise it is linked at the + * previous bridge's output. * - * Note that setting up links between the bridge and our encoder/bridge - * objects needs to be handled by the kms driver itself. + * If non-NULL the previous bridge must be already attached by a call to this + * function. * * RETURNS: * Zero on success, error code on failure */ -int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge) +int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, + struct drm_bridge *previous) { - if (!dev || !bridge) + int ret; + + if (!encoder || !bridge) + return -EINVAL; + + if (previous && (!previous->dev || previous->encoder != encoder)) return -EINVAL; if (bridge->dev) return -EBUSY; - bridge->dev = dev; + bridge->dev = encoder->dev; + bridge->encoder = encoder; + + if (bridge->funcs->attach) { + ret = bridge->funcs->attach(bridge); + if (ret < 0) { + bridge->dev = NULL; + bridge->encoder = NULL; + return ret; + } + } - if (bridge->funcs->attach) - return bridge->funcs->attach(bridge); + if (previous) + previous->next = bridge; + else + encoder->bridge = bridge; return 0; } EXPORT_SYMBOL(drm_bridge_attach); -/** - * drm_bridge_detach - deassociate given bridge from its DRM device - * - * @bridge: bridge control structure - * - * Called by a kms driver to unlink the given bridge from its DRM device. - * - * Note that tearing down links between the bridge and our encoder/bridge - * objects needs to be handled by the kms driver itself. - */ void drm_bridge_detach(struct drm_bridge *bridge) { if (WARN_ON(!bridge)) @@ -146,7 +160,6 @@ void drm_bridge_detach(struct drm_bridge *bridge) bridge->dev = NULL; } -EXPORT_SYMBOL(drm_bridge_detach); /** * DOC: bridge callbacks |