Commit 0be67e05 authored by Brian Norris's avatar Brian Norris Committed by Heiko Stuebner

drm/rockchip: dsi: Clean up 'usage_mode' when failing to attach

If we fail to attach the first time (especially: EPROBE_DEFER), we fail
to clean up 'usage_mode', and thus will fail to attach on any subsequent
attempts, with "dsi controller already in use".

Re-set to DW_DSI_USAGE_IDLE on attach failure.

This is especially common to hit when enabling asynchronous probe on a
duel-DSI system (such as RK3399 Gru/Scarlet), such that we're more
likely to fail dw_mipi_dsi_rockchip_find_second() the first time.

Fixes: 71f68fe7 ("drm/rockchip: dsi: add ability to work as a phy instead of full dsi")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019170255.1.Ia68dfb27b835d31d22bfe23812baf366ee1c6eac@changeid
parent bfab00b9
...@@ -1051,23 +1051,31 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data, ...@@ -1051,23 +1051,31 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
if (ret) { if (ret) {
DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n",
ret); ret);
return ret; goto out;
} }
second = dw_mipi_dsi_rockchip_find_second(dsi); second = dw_mipi_dsi_rockchip_find_second(dsi);
if (IS_ERR(second)) if (IS_ERR(second)) {
return PTR_ERR(second); ret = PTR_ERR(second);
goto out;
}
if (second) { if (second) {
ret = component_add(second, &dw_mipi_dsi_rockchip_ops); ret = component_add(second, &dw_mipi_dsi_rockchip_ops);
if (ret) { if (ret) {
DRM_DEV_ERROR(second, DRM_DEV_ERROR(second,
"Failed to register component: %d\n", "Failed to register component: %d\n",
ret); ret);
return ret; goto out;
} }
} }
return 0; return 0;
out:
mutex_lock(&dsi->usage_mutex);
dsi->usage_mode = DW_DSI_USAGE_IDLE;
mutex_unlock(&dsi->usage_mutex);
return ret;
} }
static int dw_mipi_dsi_rockchip_host_detach(void *priv_data, static int dw_mipi_dsi_rockchip_host_detach(void *priv_data,
......
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