Commit a4169609 authored by Tomasz Figa's avatar Tomasz Figa Committed by Andrzej Hajda

drm/rockchip: analogix_dp: Do not call Analogix code before bind

Driver callbacks, such as system suspend or resume can be called any
time, specifically they can be called before the component bind
callback. Let's use dp->adp pointer as a safeguard and skip calling
Analogix entry points if it is an ERR_PTR().
Signed-off-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180423105003.9004-24-enric.balletbo@collabora.com
parent 7bb3bb4d
...@@ -368,6 +368,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, ...@@ -368,6 +368,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master,
analogix_dp_unbind(dp->adp); analogix_dp_unbind(dp->adp);
rockchip_drm_psr_unregister(&dp->encoder); rockchip_drm_psr_unregister(&dp->encoder);
dp->encoder.funcs->destroy(&dp->encoder); dp->encoder.funcs->destroy(&dp->encoder);
dp->adp = ERR_PTR(-ENODEV);
} }
static const struct component_ops rockchip_dp_component_ops = { static const struct component_ops rockchip_dp_component_ops = {
...@@ -391,6 +393,7 @@ static int rockchip_dp_probe(struct platform_device *pdev) ...@@ -391,6 +393,7 @@ static int rockchip_dp_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
dp->dev = dev; dp->dev = dev;
dp->adp = ERR_PTR(-ENODEV);
dp->plat_data.panel = panel; dp->plat_data.panel = panel;
ret = rockchip_dp_of_probe(dp); ret = rockchip_dp_of_probe(dp);
...@@ -414,6 +417,9 @@ static int rockchip_dp_suspend(struct device *dev) ...@@ -414,6 +417,9 @@ static int rockchip_dp_suspend(struct device *dev)
{ {
struct rockchip_dp_device *dp = dev_get_drvdata(dev); struct rockchip_dp_device *dp = dev_get_drvdata(dev);
if (IS_ERR(dp->adp))
return 0;
return analogix_dp_suspend(dp->adp); return analogix_dp_suspend(dp->adp);
} }
...@@ -421,6 +427,9 @@ static int rockchip_dp_resume(struct device *dev) ...@@ -421,6 +427,9 @@ static int rockchip_dp_resume(struct device *dev)
{ {
struct rockchip_dp_device *dp = dev_get_drvdata(dev); struct rockchip_dp_device *dp = dev_get_drvdata(dev);
if (IS_ERR(dp->adp))
return 0;
return analogix_dp_resume(dp->adp); return analogix_dp_resume(dp->adp);
} }
#endif #endif
......
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