drm/bridge: tc358775: Register and attach our DSI device at probe
In order to avoid any probe ordering issue, the best practice is to move the secondary MIPI-DSI device registration and attachment to the MIPI-DSI host at probe time. Let's do this. Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-20-maxime@cerno.tech
This commit is contained in:
parent
526dcedf87
commit
4d77688ff2
@ -594,11 +594,26 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
|
||||
enum drm_bridge_attach_flags flags)
|
||||
{
|
||||
struct tc_data *tc = bridge_to_tc(bridge);
|
||||
|
||||
/* Attach the panel-bridge to the dsi bridge */
|
||||
return drm_bridge_attach(bridge->encoder, tc->panel_bridge,
|
||||
&tc->bridge, flags);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs tc_bridge_funcs = {
|
||||
.attach = tc_bridge_attach,
|
||||
.pre_enable = tc_bridge_pre_enable,
|
||||
.enable = tc_bridge_enable,
|
||||
.mode_valid = tc_mode_valid,
|
||||
.post_disable = tc_bridge_post_disable,
|
||||
};
|
||||
|
||||
static int tc_attach_host(struct tc_data *tc)
|
||||
{
|
||||
struct device *dev = &tc->i2c->dev;
|
||||
struct mipi_dsi_host *host;
|
||||
struct mipi_dsi_device *dsi;
|
||||
int ret;
|
||||
|
||||
const struct mipi_dsi_device_info info = { .type = "tc358775",
|
||||
.channel = 0,
|
||||
.node = NULL,
|
||||
@ -628,19 +643,9 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Attach the panel-bridge to the dsi bridge */
|
||||
return drm_bridge_attach(bridge->encoder, tc->panel_bridge,
|
||||
&tc->bridge, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs tc_bridge_funcs = {
|
||||
.attach = tc_bridge_attach,
|
||||
.pre_enable = tc_bridge_pre_enable,
|
||||
.enable = tc_bridge_enable,
|
||||
.mode_valid = tc_mode_valid,
|
||||
.post_disable = tc_bridge_post_disable,
|
||||
};
|
||||
|
||||
static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
@ -704,7 +709,15 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
|
||||
i2c_set_clientdata(client, tc);
|
||||
|
||||
ret = tc_attach_host(tc);
|
||||
if (ret)
|
||||
goto err_bridge_remove;
|
||||
|
||||
return 0;
|
||||
|
||||
err_bridge_remove:
|
||||
drm_bridge_remove(&tc->bridge);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tc_remove(struct i2c_client *client)
|
||||
|
Loading…
x
Reference in New Issue
Block a user