Commit 61712618 authored by Lyude Paul's avatar Lyude Paul

drm/bridge/ti-sn65dsi86: (Un)register aux device on bridge attach/detach

Since we're about to add a back-pointer to drm_dev in drm_dp_aux, let's
move the AUX adapter registration to the first point where we know which
DRM device we'll be working with - when the drm_bridge is attached.
Likewise, we unregister the AUX adapter on bridge detachment by adding a
ti_sn_bridge_detach() callback.
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210219215326.2227596-7-lyude@redhat.com
parent 85ddbe2c
...@@ -362,12 +362,18 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, ...@@ -362,12 +362,18 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
return -EINVAL; return -EINVAL;
} }
ret = drm_dp_aux_register(&pdata->aux);
if (ret < 0) {
drm_err(bridge->dev, "Failed to register DP AUX channel: %d\n", ret);
return ret;
}
ret = drm_connector_init(bridge->dev, &pdata->connector, ret = drm_connector_init(bridge->dev, &pdata->connector,
&ti_sn_bridge_connector_funcs, &ti_sn_bridge_connector_funcs,
DRM_MODE_CONNECTOR_eDP); DRM_MODE_CONNECTOR_eDP);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize connector with drm\n"); DRM_ERROR("Failed to initialize connector with drm\n");
return ret; goto err_conn_init;
} }
drm_connector_helper_add(&pdata->connector, drm_connector_helper_add(&pdata->connector,
...@@ -424,9 +430,16 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, ...@@ -424,9 +430,16 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
mipi_dsi_device_unregister(dsi); mipi_dsi_device_unregister(dsi);
err_dsi_host: err_dsi_host:
drm_connector_cleanup(&pdata->connector); drm_connector_cleanup(&pdata->connector);
err_conn_init:
drm_dp_aux_unregister(&pdata->aux);
return ret; return ret;
} }
static void ti_sn_bridge_detach(struct drm_bridge *bridge)
{
drm_dp_aux_unregister(&bridge_to_ti_sn_bridge(bridge)->aux);
}
static void ti_sn_bridge_disable(struct drm_bridge *bridge) static void ti_sn_bridge_disable(struct drm_bridge *bridge)
{ {
struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge); struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge);
...@@ -863,6 +876,7 @@ static void ti_sn_bridge_post_disable(struct drm_bridge *bridge) ...@@ -863,6 +876,7 @@ static void ti_sn_bridge_post_disable(struct drm_bridge *bridge)
static const struct drm_bridge_funcs ti_sn_bridge_funcs = { static const struct drm_bridge_funcs ti_sn_bridge_funcs = {
.attach = ti_sn_bridge_attach, .attach = ti_sn_bridge_attach,
.detach = ti_sn_bridge_detach,
.pre_enable = ti_sn_bridge_pre_enable, .pre_enable = ti_sn_bridge_pre_enable,
.enable = ti_sn_bridge_enable, .enable = ti_sn_bridge_enable,
.disable = ti_sn_bridge_disable, .disable = ti_sn_bridge_disable,
...@@ -1287,7 +1301,7 @@ static int ti_sn_bridge_probe(struct i2c_client *client, ...@@ -1287,7 +1301,7 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
pdata->aux.name = "ti-sn65dsi86-aux"; pdata->aux.name = "ti-sn65dsi86-aux";
pdata->aux.dev = pdata->dev; pdata->aux.dev = pdata->dev;
pdata->aux.transfer = ti_sn_aux_transfer; pdata->aux.transfer = ti_sn_aux_transfer;
drm_dp_aux_register(&pdata->aux); drm_dp_aux_init(&pdata->aux);
pdata->bridge.funcs = &ti_sn_bridge_funcs; pdata->bridge.funcs = &ti_sn_bridge_funcs;
pdata->bridge.of_node = client->dev.of_node; pdata->bridge.of_node = client->dev.of_node;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment