[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF6AEGvQzyzNs57nCuR5ZRC14kB8CscykJ+4=gmZB6==OXCQEA@mail.gmail.com>
Date: Thu, 21 Oct 2021 09:30:39 -0700
From: Rob Clark <robdclark@...il.com>
To: Maxime Ripard <maxime@...no.tech>
Cc: Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Sam Ravnborg <sam@...nborg.org>,
Daniel Vetter <daniel.vetter@...el.com>,
David Airlie <airlied@...ux.ie>,
Thierry Reding <thierry.reding@...il.com>,
Andrzej Hajda <a.hajda@...sung.com>,
Robert Foss <robert.foss@...aro.org>,
Neil Armstrong <narmstrong@...libre.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Seung-Woo Kim <sw0312.kim@...sung.com>,
Xinliang Liu <xinliang.liu@...aro.org>,
"moderated list:ARM/S5P EXYNOS AR..."
<linux-samsung-soc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Tian Tao <tiantao6@...ilicon.com>,
freedreno <freedreno@...ts.freedesktop.org>,
Chen Feng <puck.chen@...ilicon.com>,
Joonyoung Shim <jy0922.shim@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
John Stultz <john.stultz@...aro.org>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Sean Paul <sean@...rly.run>, Inki Dae <inki.dae@...sung.com>,
Xinwei Kong <kong.kongxinwei@...ilicon.com>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Rob Clark <robdclark@...omium.org>,
Amit Pundir <amit.pundir@...aro.org>,
Caleb Connolly <caleb.connolly@...aro.org>
Subject: Re: [PATCH v5 21/21] drm/msm/dsi: Adjust probe order
On Thu, Oct 21, 2021 at 12:41 AM Maxime Ripard <maxime@...no.tech> wrote:
>
> From: Rob Clark <robdclark@...omium.org>
>
> Switch to the documented order dsi-host vs bridge probe.
>
> Tested-by: Amit Pundir <amit.pundir@...aro.org>
> Tested-by: Caleb Connolly <caleb.connolly@...aro.org>
> Tested-by: John Stultz <john.stultz@...aro.org>
> Signed-off-by: Rob Clark <robdclark@...omium.org>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
I guess this should probably land together w/ the rest of the series,
so a-b for merging thru drm-misc
BR,
-R
> ---
> drivers/gpu/drm/msm/dsi/dsi.c | 50 ++++++++++++++++-----------
> drivers/gpu/drm/msm/dsi/dsi.h | 2 +-
> drivers/gpu/drm/msm/dsi/dsi_host.c | 22 ++++--------
> drivers/gpu/drm/msm/dsi/dsi_manager.c | 6 ++--
> drivers/gpu/drm/msm/msm_drv.h | 2 ++
> 5 files changed, 43 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
> index 614dc7f26f2c..ad73ebb84b2d 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi.c
> @@ -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);
> }
>
> -static int dsi_dev_remove(struct platform_device *pdev)
> +void dsi_dev_detach(struct platform_device *pdev)
> {
> - DBG("");
> 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("");
> + dsi_destroy(msm_dsi);
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
> index b50db91cb8a7..83787cbee419 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.h
> +++ b/drivers/gpu/drm/msm/dsi/dsi.h
> @@ -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);
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index e269df285136..f741494b1bf6 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -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;
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index c41d39f5b7cf..fc949a84cef6 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -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;
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index 8b005d1ac899..31d50e98a723 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -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,
> --
> 2.31.1
>
Powered by blists - more mailing lists