Skip to content

Commit c70087e

Browse files
drm/drm_of: add drm_of_panel_bridge_remove function
This function is the pendant of drm_of_find_panel_or_bridge() to remove a previously allocated panel_bridge. Given a specific port and endpoint it remove the panel bridge. Since drm_panel_bridge_remove() will check that bridge parameter is not NULL and is a real drm_panel_bridge and no a simple bridge it is safe to call it directly. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Reviewed-by: Philippe Cornu <philippe.cornu@st.com> Tested-by: Philippe Cornu <philippe.cornu@st.com> Link: https://patchwork.freedesktop.org/patch/msgid/1506936888-23844-3-git-send-email-benjamin.gaignard@linaro.org
1 parent 6b0e284 commit c70087e

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_of.c‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,36 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
262262
return ret;
263263
}
264264
EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
265+
266+
#ifdef CONFIG_DRM_PANEL_BRIDGE
267+
/*
268+
* drm_of_panel_bridge_remove - remove panel bridge
269+
* @np: device tree node containing panel bridge output ports
270+
*
271+
* Remove the panel bridge of a given DT node's port and endpoint number
272+
*
273+
* Returns zero if successful, or one of the standard error codes if it fails.
274+
*/
275+
int drm_of_panel_bridge_remove(const struct device_node *np,
276+
int port, int endpoint)
277+
{
278+
struct drm_bridge *bridge;
279+
struct device_node *remote;
280+
281+
remote = of_graph_get_remote_node(np, port, endpoint);
282+
if (!remote)
283+
return -ENODEV;
284+
285+
bridge = of_drm_find_bridge(remote);
286+
drm_panel_bridge_remove(bridge);
287+
288+
return 0;
289+
}
290+
#else
291+
int drm_of_panel_bridge_remove(const struct device_node *np,
292+
int port, int endpoint)
293+
{
294+
return -EINVAL;
295+
}
296+
#endif
297+
EXPORT_SYMBOL_GPL(drm_of_panel_bridge_remove);

‎include/drm/drm_of.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
2929
int port, int endpoint,
3030
struct drm_panel **panel,
3131
struct drm_bridge **bridge);
32+
int drm_of_panel_bridge_remove(const struct device_node *np,
33+
int port, int endpoint);
3234
#else
3335
static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
3436
struct device_node *port)
@@ -65,6 +67,12 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
6567
{
6668
return -EINVAL;
6769
}
70+
71+
static inline int drm_of_panel_bridge_remove(const struct device_node *np,
72+
int port, int endpoint)
73+
{
74+
return -EINVAL;
75+
}
6876
#endif
6977

7078
static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,

0 commit comments

Comments
 (0)