mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
drm/bridge: panel: Introduce drmm_panel_bridge_add
Unlike what can be found for other entities, there's no DRM-managed function to create a panel_bridge instance from a panel. Let's introduce one. Acked-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220711173939.1132294-11-maxime@cerno.tech
This commit is contained in:
parent
35a3b82f1b
commit
abea75e920
@ -8,6 +8,7 @@
|
|||||||
#include <drm/drm_bridge.h>
|
#include <drm/drm_bridge.h>
|
||||||
#include <drm/drm_connector.h>
|
#include <drm/drm_connector.h>
|
||||||
#include <drm/drm_encoder.h>
|
#include <drm/drm_encoder.h>
|
||||||
|
#include <drm/drm_managed.h>
|
||||||
#include <drm/drm_modeset_helper_vtables.h>
|
#include <drm/drm_modeset_helper_vtables.h>
|
||||||
#include <drm/drm_of.h>
|
#include <drm/drm_of.h>
|
||||||
#include <drm/drm_panel.h>
|
#include <drm/drm_panel.h>
|
||||||
@ -367,6 +368,44 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(devm_drm_panel_bridge_add_typed);
|
EXPORT_SYMBOL(devm_drm_panel_bridge_add_typed);
|
||||||
|
|
||||||
|
static void drmm_drm_panel_bridge_release(struct drm_device *drm, void *ptr)
|
||||||
|
{
|
||||||
|
struct drm_bridge *bridge = ptr;
|
||||||
|
|
||||||
|
drm_panel_bridge_remove(bridge);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* drmm_panel_bridge_add - Creates a DRM-managed &drm_bridge and
|
||||||
|
* &drm_connector that just calls the
|
||||||
|
* appropriate functions from &drm_panel.
|
||||||
|
*
|
||||||
|
* @drm: DRM device to tie the bridge lifetime to
|
||||||
|
* @panel: The drm_panel being wrapped. Must be non-NULL.
|
||||||
|
*
|
||||||
|
* This is the DRM-managed version of drm_panel_bridge_add() which
|
||||||
|
* automatically calls drm_panel_bridge_remove() when @dev is cleaned
|
||||||
|
* up.
|
||||||
|
*/
|
||||||
|
struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm,
|
||||||
|
struct drm_panel *panel)
|
||||||
|
{
|
||||||
|
struct drm_bridge *bridge;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
bridge = drm_panel_bridge_add_typed(panel, panel->connector_type);
|
||||||
|
if (IS_ERR(bridge))
|
||||||
|
return bridge;
|
||||||
|
|
||||||
|
ret = drmm_add_action_or_reset(drm, drmm_drm_panel_bridge_release,
|
||||||
|
bridge);
|
||||||
|
if (ret)
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
|
||||||
|
return bridge;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(drmm_panel_bridge_add);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_panel_bridge_connector - return the connector for the panel bridge
|
* drm_panel_bridge_connector - return the connector for the panel bridge
|
||||||
* @bridge: The drm_bridge.
|
* @bridge: The drm_bridge.
|
||||||
|
@ -930,6 +930,8 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
|
|||||||
struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
|
struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
|
||||||
struct drm_panel *panel,
|
struct drm_panel *panel,
|
||||||
u32 connector_type);
|
u32 connector_type);
|
||||||
|
struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm,
|
||||||
|
struct drm_panel *panel);
|
||||||
struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
|
struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
|
||||||
#else
|
#else
|
||||||
static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge)
|
static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge)
|
||||||
|
Loading…
Reference in New Issue
Block a user