summaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorAndrea Merello <andrea.merello@gmail.com>2016-08-25 11:04:32 +0200
committerArchit Taneja <architt@codeaurora.org>2016-08-29 09:13:00 +0530
commitcf3bef95e1014233cb1ce89da8cfa5cd22e7412c (patch)
treeaa79bd6123a9669499178ee470ec3bd333b486bd /include/drm
parent6dcf0de7ef10244b17442f47956a1d9fabe2abe1 (diff)
downloadop-kernel-dev-cf3bef95e1014233cb1ce89da8cfa5cd22e7412c.zip
op-kernel-dev-cf3bef95e1014233cb1ce89da8cfa5cd22e7412c.tar.gz
drm/bridge: introduce bridge detaching mechanism
Up to now, once a bridge has been attached to a DRM device, it cannot be undone. In particular you couldn't rmmod/insmod a DRM driver that uses a bridge, because the bridge would remain bound to the first (dead) driver instance. This patch fixes this by introducing drm_encoder_detach() and a ->detach callback in drm_bridge_funcs for the bridge to be notified about detaches. It's DRM/KMS driver responsibility to call drm_encoder_detach(). While adding the bridge detach callback, with its kerneldoc, I also added kerneldoc for attach callback. Few other kerneldocs fixes around there are included. Suggested-by: Daniel Vetter <daniel@ffwll.ch> Suggested-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Archit Taneja <architt@codeaurora.org> Link: http://patchwork.freedesktop.org/patch/msgid/1472115874-6219-1-git-send-email-andrea.merello@gmail.com
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_crtc.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3fa0275..bb214a1 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1118,12 +1118,33 @@ struct drm_plane {
/**
* struct drm_bridge_funcs - drm_bridge control functions
- * @attach: Called during drm_bridge_attach
*/
struct drm_bridge_funcs {
+ /**
+ * @attach:
+ *
+ * This callback is invoked whenever our bridge is being attached to a
+ * &drm_encoder.
+ *
+ * The attach callback is optional.
+ *
+ * RETURNS:
+ *
+ * Zero on success, error code on failure.
+ */
int (*attach)(struct drm_bridge *bridge);
/**
+ * @detach:
+ *
+ * This callback is invoked whenever our bridge is being detached from a
+ * &drm_encoder.
+ *
+ * The detach callback is optional.
+ */
+ void (*detach)(struct drm_bridge *bridge);
+
+ /**
* @mode_fixup:
*
* This callback is used to validate and adjust a mode. The paramater
@@ -1137,6 +1158,8 @@ struct drm_bridge_funcs {
* this function passes all other callbacks must succeed for this
* configuration.
*
+ * The mode_fixup callback is optional.
+ *
* NOTE:
*
* This function is called in the check phase of atomic modesets, which
@@ -2426,6 +2449,7 @@ extern int drm_bridge_add(struct drm_bridge *bridge);
extern void drm_bridge_remove(struct drm_bridge *bridge);
extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
+extern void drm_bridge_detach(struct drm_bridge *bridge);
bool drm_bridge_mode_fixup(struct drm_bridge *bridge,
const struct drm_display_mode *mode,
OpenPOWER on IntegriCloud