@@ -1373,12 +1373,6 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
dw_hdmi_poweron(hdmi);
}
-static void dw_hdmi_bridge_destroy(struct drm_bridge *bridge)
-{
- drm_bridge_cleanup(bridge);
- kfree(bridge);
-}
-
static void dw_hdmi_bridge_nop(struct drm_bridge *bridge)
{
/* do nothing */
@@ -1468,7 +1462,6 @@ struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.post_disable = dw_hdmi_bridge_nop,
.mode_set = dw_hdmi_bridge_mode_set,
.mode_fixup = dw_hdmi_bridge_mode_fixup,
- .destroy = dw_hdmi_bridge_destroy,
};
static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id)
@@ -1532,7 +1525,15 @@ static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi)
hdmi->bridge = bridge;
bridge->driver_private = hdmi;
- ret = drm_bridge_init(drm, bridge, &dw_hdmi_bridge_funcs);
+ bridge->funcs = &dw_hdmi_bridge_funcs;
+ bridge->of_node = hdmi->dev->of_node;
+ ret = drm_bridge_add(bridge);
+ if (ret) {
+ DRM_ERROR("Failed to add bridge\n");
+ return ret;
+ }
+
+ ret = drm_bridge_attach(drm, bridge);
if (ret) {
DRM_ERROR("Failed to initialize bridge with drm\n");
return -EINVAL;
@@ -1700,6 +1701,8 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
hdmi->connector.funcs->destroy(&hdmi->connector);
hdmi->encoder->funcs->destroy(hdmi->encoder);
+ drm_bridge_remove(hdmi->encoder->bridge);
+
clk_disable_unprepare(hdmi->iahb_clk);
clk_disable_unprepare(hdmi->isfr_clk);
i2c_put_adapter(hdmi->ddc);
Commits 8eb17f05bc18 ("drm/bridge: do not pass drm_bridge_funcs to drm_bridge_init") and fbc4572e9c48 ("drm/bridge: make bridge registration independent of drm flow") changed the bridge API without taking into account the also newly introduced dw_hdmi bridge. Therefore adapt the dw_hdmi bridge to the new bridge API. The bridge struct is already allocated using devm_kzalloc, so the destroy function can go away completely. Signed-off-by: Heiko Stuebner <heiko@sntech.de> --- Tested on a rk3288-firefly board drivers/gpu/drm/bridge/dw_hdmi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)