dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: yannick Fertre <yannick.fertre@foss.st.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	Sandy Huang <hjc@rock-chips.com>, Heiko Stubner <heiko@sntech.de>,
	Yannick Fertre <yannick.fertre@st.com>,
	Philippe Cornu <philippe.cornu@st.com>
Cc: Marek Vasut <marex@denx.de>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Jonas Karlman <jonas@kwiboo.se>,
	Vincent Abriou <vincent.abriou@st.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-amarula@amarulasolutions.com
Subject: Re: [PATCH] drm/bridge: dw-mipi-dsi: Move drm_bridge_add into probe
Date: Mon, 15 Feb 2021 09:09:00 +0100	[thread overview]
Message-ID: <f9cfa159-ac88-325b-d971-7c860fa722ff@foss.st.com> (raw)
In-Reply-To: <20210203091306.140518-1-jagan@amarulasolutions.com>

Hello Jagan, I tested your patch on the stm32mp1 board.
Unfortunately, the dsi panel does not probe well with this patch. The 
problem is due to the panel which is placed in the node of the dsi 
bridge (no problem with i2c devices).

Regarding component bindings for stm drivers, I am currently working on 
a new version.

Best regards

Yannick



On 2/3/21 10:13 AM, Jagan Teki wrote:
> Usual I2C configured DSI bridge drivers have drm_bridge_add
> in probe and mipi_dsi_attach in bridge attach functions.
> 
> With, this approach the drm pipeline is unable to find the
> dsi bridge in stm drm drivers since the dw-mipi-dsi bridge is
> adding drm bridge during bridge attach operations instead of
> the probe.
> 
> This specific issue may not encounter for rockchip drm dsi
> drivers, since rockchip drm uses component binding operations,
> unlike stm drm drivers.
> 
> So, possible solutions are
> 1. Move drm_bridge_add into the dw-mipi-dsi probe.
> 2. Add mipi_dsi_attach in the bridge drivers probe.
> 3. Add component binding operations for stm drm drivers.
> 
> Option 1 is a relatively possible solution as most of the
> mainline drm dsi with bridge drivers have a similar approach
> to their dsi host vs bridge registration.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 35 +++++++++----------
>   1 file changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index 6b268f9445b3..8a535041f071 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -314,8 +314,6 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
>   {
>   	struct dw_mipi_dsi *dsi = host_to_dsi(host);
>   	const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
> -	struct drm_bridge *bridge;
> -	struct drm_panel *panel;
>   	int ret;
>   
>   	if (device->lanes > dsi->plat_data->max_data_lanes) {
> @@ -329,22 +327,6 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
>   	dsi->format = device->format;
>   	dsi->mode_flags = device->mode_flags;
>   
> -	ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0,
> -					  &panel, &bridge);
> -	if (ret)
> -		return ret;
> -
> -	if (panel) {
> -		bridge = drm_panel_bridge_add_typed(panel,
> -						    DRM_MODE_CONNECTOR_DSI);
> -		if (IS_ERR(bridge))
> -			return PTR_ERR(bridge);
> -	}
> -
> -	dsi->panel_bridge = bridge;
> -
> -	drm_bridge_add(&dsi->bridge);
> -
>   	if (pdata->host_ops && pdata->host_ops->attach) {
>   		ret = pdata->host_ops->attach(pdata->priv_data, device);
>   		if (ret < 0)
> @@ -1105,6 +1087,8 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>   	struct device *dev = &pdev->dev;
>   	struct reset_control *apb_rst;
>   	struct dw_mipi_dsi *dsi;
> +	struct drm_bridge *bridge;
> +	struct drm_panel *panel;
>   	int ret;
>   
>   	dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
> @@ -1167,6 +1151,20 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>   	dw_mipi_dsi_debugfs_init(dsi);
>   	pm_runtime_enable(dev);
>   
> +	ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0,
> +					  &panel, &bridge);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
> +	if (panel) {
> +		bridge = drm_panel_bridge_add_typed(panel,
> +						    DRM_MODE_CONNECTOR_DSI);
> +		if (IS_ERR(bridge))
> +			return ERR_PTR(-ENODEV);
> +	}
> +
> +	dsi->panel_bridge = bridge;
> +
>   	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
>   	dsi->dsi_host.dev = dev;
>   	ret = mipi_dsi_host_register(&dsi->dsi_host);
> @@ -1181,6 +1179,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>   #ifdef CONFIG_OF
>   	dsi->bridge.of_node = pdev->dev.of_node;
>   #endif
> +	drm_bridge_add(&dsi->bridge);
>   
>   	return dsi;
>   }
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2021-02-15  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  9:13 [PATCH] drm/bridge: dw-mipi-dsi: Move drm_bridge_add into probe Jagan Teki
2021-02-03 12:05 ` Heiko Stübner
2021-02-15 11:32   ` Laurent Pinchart
2021-02-15  8:09 ` yannick Fertre [this message]
2021-02-24 17:01   ` Jagan Teki
2021-06-18 13:10 ` Jonathan Liu
2021-06-24 12:34   ` Jagan Teki
2021-06-24 12:39     ` Jonathan Liu
2021-06-24 12:51       ` Laurent Pinchart
2021-06-28 10:12         ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9cfa159-ac88-325b-d971-7c860fa722ff@foss.st.com \
    --to=yannick.fertre@foss.st.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=narmstrong@baylibre.com \
    --cc=philippe.cornu@st.com \
    --cc=sam@ravnborg.org \
    --cc=vincent.abriou@st.com \
    --cc=yannick.fertre@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).