Commit 8f59ee9a authored by Rob Clark's avatar Rob Clark Committed by Maxime Ripard

drm/msm/dsi: Adjust probe order

Switch to the documented order dsi-host vs bridge probe.
Tested-by: default avatarAmit Pundir <amit.pundir@linaro.org>
Tested-by: default avatarCaleb Connolly <caleb.connolly@linaro.org>
Tested-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-22-maxime@cerno.tech
parent 4280e1a0
......@@ -112,18 +112,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
{
struct drm_device *drm = dev_get_drvdata(master);
struct msm_drm_private *priv = drm->dev_private;
struct platform_device *pdev = to_platform_device(dev);
struct msm_dsi *msm_dsi;
DBG("");
msm_dsi = dsi_init(pdev);
if (IS_ERR(msm_dsi)) {
/* Don't fail the bind if the dsi port is not connected */
if (PTR_ERR(msm_dsi) == -ENODEV)
return 0;
else
return PTR_ERR(msm_dsi);
}
struct msm_dsi *msm_dsi = dev_get_drvdata(dev);
priv->dsi[msm_dsi->id] = msm_dsi;
......@@ -136,12 +125,8 @@ static void dsi_unbind(struct device *dev, struct device *master,
struct drm_device *drm = dev_get_drvdata(master);
struct msm_drm_private *priv = drm->dev_private;
struct msm_dsi *msm_dsi = dev_get_drvdata(dev);
int id = msm_dsi->id;
if (priv->dsi[id]) {
dsi_destroy(msm_dsi);
priv->dsi[id] = NULL;
}
priv->dsi[msm_dsi->id] = NULL;
}
static const struct component_ops dsi_ops = {
......@@ -149,15 +134,40 @@ static const struct component_ops dsi_ops = {
.unbind = dsi_unbind,
};
static int dsi_dev_probe(struct platform_device *pdev)
int dsi_dev_attach(struct platform_device *pdev)
{
return component_add(&pdev->dev, &dsi_ops);
}
void dsi_dev_detach(struct platform_device *pdev)
{
component_del(&pdev->dev, &dsi_ops);
}
static int dsi_dev_probe(struct platform_device *pdev)
{
struct msm_dsi *msm_dsi;
DBG("");
msm_dsi = dsi_init(pdev);
if (IS_ERR(msm_dsi)) {
/* Don't fail the bind if the dsi port is not connected */
if (PTR_ERR(msm_dsi) == -ENODEV)
return 0;
else
return PTR_ERR(msm_dsi);
}
return 0;
}
static int dsi_dev_remove(struct platform_device *pdev)
{
struct msm_dsi *msm_dsi = platform_get_drvdata(pdev);
DBG("");
component_del(&pdev->dev, &dsi_ops);
dsi_destroy(msm_dsi);
return 0;
}
......
......@@ -116,7 +116,7 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host);
unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host);
struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host);
int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer);
int msm_dsi_host_register(struct mipi_dsi_host *host);
void msm_dsi_host_unregister(struct mipi_dsi_host *host);
int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host,
struct msm_dsi_phy *src_phy);
......
......@@ -1624,6 +1624,10 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
if (ret)
return ret;
ret = dsi_dev_attach(msm_host->pdev);
if (ret)
return ret;
DBG("id=%d", msm_host->id);
if (msm_host->dev)
queue_work(msm_host->workqueue, &msm_host->hpd_work);
......@@ -1636,6 +1640,8 @@ static int dsi_host_detach(struct mipi_dsi_host *host,
{
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
dsi_dev_detach(msm_host->pdev);
msm_host->device_node = NULL;
DBG("id=%d", msm_host->id);
......@@ -1970,7 +1976,7 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
return 0;
}
int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer)
int msm_dsi_host_register(struct mipi_dsi_host *host)
{
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
int ret;
......@@ -1984,20 +1990,6 @@ int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer)
return ret;
msm_host->registered = true;
/* If the panel driver has not been probed after host register,
* we should defer the host's probe.
* It makes sure panel is connected when fbcon detects
* connector status and gets the proper display mode to
* create framebuffer.
* Don't try to defer if there is nothing connected to the dsi
* output
*/
if (check_defer && msm_host->device_node) {
if (IS_ERR(of_drm_find_panel(msm_host->device_node)))
if (!of_drm_find_bridge(msm_host->device_node))
return -EPROBE_DEFER;
}
}
return 0;
......
......@@ -72,7 +72,7 @@ static int dsi_mgr_setup_components(int id)
int ret;
if (!IS_BONDED_DSI()) {
ret = msm_dsi_host_register(msm_dsi->host, true);
ret = msm_dsi_host_register(msm_dsi->host);
if (ret)
return ret;
......@@ -92,10 +92,10 @@ static int dsi_mgr_setup_components(int id)
* because only master DSI device adds the panel to global
* panel list. The panel's device is the master DSI device.
*/
ret = msm_dsi_host_register(slave_link_dsi->host, false);
ret = msm_dsi_host_register(slave_link_dsi->host);
if (ret)
return ret;
ret = msm_dsi_host_register(master_link_dsi->host, true);
ret = msm_dsi_host_register(master_link_dsi->host);
if (ret)
return ret;
......
......@@ -344,6 +344,8 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
struct msm_dsi;
#ifdef CONFIG_DRM_MSM_DSI
int dsi_dev_attach(struct platform_device *pdev);
void dsi_dev_detach(struct platform_device *pdev);
void __init msm_dsi_register(void);
void __exit msm_dsi_unregister(void);
int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
......
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