drm/bridge: add connector_init interface in drm_bridge_funcs

Add the connector_init callback so a bridge is allowed to
initialize the connector passed to itself. This is useful
in certain cases like, the connector and bridge are created
in two different modules, while the connector funcs need
access extra information of the bridge. This callback offers
the opportunity to override the connector's behavior.

CRs-Fixed: 2140653
Change-Id: Iee228dd610d2e72d0a9e0bd960b0715b4ea6c644
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
Signed-off-by: Narendra Muppalla <NarendraM@codeaurora.org>
tirimbino
Ray Zhang 7 years ago committed by Narendra Muppalla
parent 87ef03a511
commit 3683e07313
  1. 26
      drivers/gpu/drm/drm_bridge.c
  2. 18
      include/drm/drm_bridge.h

@ -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
*

@ -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,

Loading…
Cancel
Save