diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index dc8cdfe1dcac..83933522496d 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -161,6 +161,32 @@ void drm_bridge_detach(struct drm_bridge *bridge) bridge->dev = NULL; } +/** + * drm_bridge_connector_init - call bridge's connector_init callback to allow + * the bridge to update connector's behavior. + * @bridge: bridge control structure + * @connector: connector control structure + * + * Calls ->connector_init() &drm_bridge_funcs op for the bridge. + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_bridge_connector_init(struct drm_bridge *bridge, + struct drm_connector *connector) +{ + int ret = 0; + + if (!bridge || !connector) + return -EINVAL; + + if (bridge->funcs->connector_init) + ret = bridge->funcs->connector_init(bridge, connector); + + return ret; +} +EXPORT_SYMBOL(drm_bridge_connector_init); + /** * DOC: bridge callbacks * diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 6522d4cbc9d9..a76bf45acd67 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -92,6 +92,22 @@ struct drm_bridge_funcs { */ enum drm_mode_status (*mode_valid)(struct drm_bridge *crtc, const struct drm_display_mode *mode); + /** + * @connector_init: + * + * This callback is used to init the connector from bridge side. In some + * cases connector and bridge are created in different modules, and the + * connector ops might need extra info from bridge. This callback offers + * the opportunity to overwrite connector's behavior in external bridge. + * + * The connector_init callback is optional. + * + * RETURNS: + * + * Zero on success, error code on failure. + */ + int (*connector_init)(struct drm_bridge *bridge, + struct drm_connector *connector); /** * @mode_fixup: @@ -263,6 +279,8 @@ void drm_bridge_mode_set(struct drm_bridge *bridge, struct drm_display_mode *adjusted_mode); void drm_bridge_pre_enable(struct drm_bridge *bridge); void drm_bridge_enable(struct drm_bridge *bridge); +int drm_bridge_connector_init(struct drm_bridge *bridge, + struct drm_connector *connector); #ifdef CONFIG_DRM_PANEL_BRIDGE struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel,