Commit ee941880 authored by Maxime Ripard's avatar Maxime Ripard

drm/bridge: adv7533: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device. This also avoids leaking the device when we detach
the bridge.
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Tested-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-2-maxime@cerno.tech
parent b9971e54
...@@ -401,7 +401,6 @@ void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode); ...@@ -401,7 +401,6 @@ void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode);
int adv7533_patch_registers(struct adv7511 *adv); int adv7533_patch_registers(struct adv7511 *adv);
int adv7533_patch_cec_registers(struct adv7511 *adv); int adv7533_patch_cec_registers(struct adv7511 *adv);
int adv7533_attach_dsi(struct adv7511 *adv); int adv7533_attach_dsi(struct adv7511 *adv);
void adv7533_detach_dsi(struct adv7511 *adv);
int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv); int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv);
#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO #ifdef CONFIG_DRM_I2C_ADV7511_AUDIO
......
...@@ -1307,8 +1307,6 @@ static int adv7511_remove(struct i2c_client *i2c) ...@@ -1307,8 +1307,6 @@ static int adv7511_remove(struct i2c_client *i2c)
{ {
struct adv7511 *adv7511 = i2c_get_clientdata(i2c); struct adv7511 *adv7511 = i2c_get_clientdata(i2c);
if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
adv7533_detach_dsi(adv7511);
i2c_unregister_device(adv7511->i2c_cec); i2c_unregister_device(adv7511->i2c_cec);
clk_disable_unprepare(adv7511->cec_clk); clk_disable_unprepare(adv7511->cec_clk);
......
...@@ -153,11 +153,10 @@ int adv7533_attach_dsi(struct adv7511 *adv) ...@@ -153,11 +153,10 @@ int adv7533_attach_dsi(struct adv7511 *adv)
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
dsi = mipi_dsi_device_register_full(host, &info); dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
if (IS_ERR(dsi)) { if (IS_ERR(dsi)) {
dev_err(dev, "failed to create dsi device\n"); dev_err(dev, "failed to create dsi device\n");
ret = PTR_ERR(dsi); return PTR_ERR(dsi);
goto err_dsi_device;
} }
adv->dsi = dsi; adv->dsi = dsi;
...@@ -167,24 +166,13 @@ int adv7533_attach_dsi(struct adv7511 *adv) ...@@ -167,24 +166,13 @@ int adv7533_attach_dsi(struct adv7511 *adv)
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE; MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
ret = mipi_dsi_attach(dsi); ret = devm_mipi_dsi_attach(dev, dsi);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to attach dsi to host\n"); dev_err(dev, "failed to attach dsi to host\n");
goto err_dsi_attach; return ret;
} }
return 0; return 0;
err_dsi_attach:
mipi_dsi_device_unregister(dsi);
err_dsi_device:
return ret;
}
void adv7533_detach_dsi(struct adv7511 *adv)
{
mipi_dsi_detach(adv->dsi);
mipi_dsi_device_unregister(adv->dsi);
} }
int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv) int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv)
......
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