Skip to content

Commit c8a3b2a

Browse files
Laurent Pinchartthierryreding
authored andcommitted
drm/bridge: Make (pre/post) enable/disable callbacks optional
Instead of forcing bridges to implement empty callbacks make them all optional. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 06a9dc6 commit c8a3b2a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

drivers/gpu/drm/drm_bridge.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ void drm_bridge_disable(struct drm_bridge *bridge)
186186

187187
drm_bridge_disable(bridge->next);
188188

189-
bridge->funcs->disable(bridge);
189+
if (bridge->funcs->disable)
190+
bridge->funcs->disable(bridge);
190191
}
191192
EXPORT_SYMBOL(drm_bridge_disable);
192193

@@ -206,7 +207,8 @@ void drm_bridge_post_disable(struct drm_bridge *bridge)
206207
if (!bridge)
207208
return;
208209

209-
bridge->funcs->post_disable(bridge);
210+
if (bridge->funcs->post_disable)
211+
bridge->funcs->post_disable(bridge);
210212

211213
drm_bridge_post_disable(bridge->next);
212214
}
@@ -256,7 +258,8 @@ void drm_bridge_pre_enable(struct drm_bridge *bridge)
256258

257259
drm_bridge_pre_enable(bridge->next);
258260

259-
bridge->funcs->pre_enable(bridge);
261+
if (bridge->funcs->pre_enable)
262+
bridge->funcs->pre_enable(bridge);
260263
}
261264
EXPORT_SYMBOL(drm_bridge_pre_enable);
262265

@@ -276,7 +279,8 @@ void drm_bridge_enable(struct drm_bridge *bridge)
276279
if (!bridge)
277280
return;
278281

279-
bridge->funcs->enable(bridge);
282+
if (bridge->funcs->enable)
283+
bridge->funcs->enable(bridge);
280284

281285
drm_bridge_enable(bridge->next);
282286
}

include/drm/drm_crtc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,8 @@ struct drm_bridge_funcs {
15811581
*
15821582
* The bridge can assume that the display pipe (i.e. clocks and timing
15831583
* signals) feeding it is still running when this callback is called.
1584+
*
1585+
* The disable callback is optional.
15841586
*/
15851587
void (*disable)(struct drm_bridge *bridge);
15861588

@@ -1597,6 +1599,8 @@ struct drm_bridge_funcs {
15971599
* The bridge must assume that the display pipe (i.e. clocks and timing
15981600
* singals) feeding it is no longer running when this callback is
15991601
* called.
1602+
*
1603+
* The post_disable callback is optional.
16001604
*/
16011605
void (*post_disable)(struct drm_bridge *bridge);
16021606

@@ -1625,6 +1629,8 @@ struct drm_bridge_funcs {
16251629
* will not yet be running when this callback is called. The bridge must
16261630
* not enable the display link feeding the next bridge in the chain (if
16271631
* there is one) when this callback is called.
1632+
*
1633+
* The pre_enable callback is optional.
16281634
*/
16291635
void (*pre_enable)(struct drm_bridge *bridge);
16301636

@@ -1642,6 +1648,8 @@ struct drm_bridge_funcs {
16421648
* signals) feeding it is running when this callback is called. This
16431649
* callback must enable the display link feeding the next bridge in the
16441650
* chain if there is one.
1651+
*
1652+
* The enable callback is optional.
16451653
*/
16461654
void (*enable)(struct drm_bridge *bridge);
16471655
};

0 commit comments

Comments
 (0)