| Message ID | 20210203091306.140518-1-jagan@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD7MFH7A7EEBBO6S5GAAMGQEFIJSYPA@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 569DA3F082 for <linux-amarula@patchwork.amarulasolutions.com>; Wed, 3 Feb 2021 10:13:33 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id fv24sf4203419pjb.9 for <linux-amarula@patchwork.amarulasolutions.com>; Wed, 03 Feb 2021 01:13:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1612343611; cv=pass; d=google.com; s=arc-20160816; b=bYN/XBfRriUMDZda3v46oqR7NydsANO1e8HfSM57yJPhC0qV7w1vF4kKYWkYdL29Yw qJzZPEDLRDLWp3EQlQvbBJy1ZwcIXpNX4xY7Qy4bkjm9DBsSEabXct31o4p4TpgIsr2Q 0ZCPTejsWx3cfvvVp8mNIXtNp6iZuh43BuTs93h8faZssl1nZPMVQH1jVNrhKzfSW5fK GNE2RagRG0+oRmua2BWq5Zc3PI3weMDoHL6wOvj8o7B+UU52yf5xxdRPCNgr/ND6jPY2 36GS7wTNBNKRroKR/n6kvR7qSjGAcQHybTSEwR/YQl8vsGyh2r0dRDbdR8UBi3h6FrC6 Oo2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=vj5pawagH9isRhUsFFK8rPL0akkULTnuqSeSPK3layk=; b=XYQhayV17rhbF2/mu1z0trVykZFzjlZp0fI69LRIqEuXlQMWYyTxEadHlx1HTiyI1G Pr84FJ6QtJv9+QIz8S2Vw6nGzSuTSvmnOSI3RNAWONHHoPQ3Ttp6IGfjxTUXZeR42+LR n+60zEBrIyEegQ8bnjC6Rjgtv1rlp8Zm1SNuJUWsPhhn7AAs4Kg7zIvWen0n+DUBzDO/ hPZncHIsqrlOSj8jVPvTl+rrpgPTVnVcfVoVnYyERekWHLBc0/FFamow85kazKRuhOwV Z1inyUJoUYMHA0VG7Crkl7rz95fSNPZZSTXaUPjFbAmlMx0FPMGYSO26VUvYJqSFe+C0 83lA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FWgUNKiS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=vj5pawagH9isRhUsFFK8rPL0akkULTnuqSeSPK3layk=; b=Kczy54ZhKSLH/f640yL5F309uZ+yd2ummA85TR642qtYRiubrPY7LsqSaLJSC0POoE IUut10k1ww3LxmbiEZVxRNpVAO849yVZ117nuzyXP7BLKijlpf7HxtC7nr4it62C2osS jU3LfEs/eBDMBwq+DeAQ5gUG5zYFjxHAgzmGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=vj5pawagH9isRhUsFFK8rPL0akkULTnuqSeSPK3layk=; b=TpLPpj1oTy1uHbfTUfFGpsuM3wHo6HzTzmgJHgIL4M+2UElOsEsg+RP0OVpIOcm2jb Ncgvcgl19mzTTNTXJacW/h8xEBtDLwENp0L0JEpvTP0UjygQf49Vv/OPAIfL2RW/Ei+R sBiMZYDvP3NmUeQysfPbtOnH7oqI8L0CdG1nCLv7RIjqHU+OTI6LlDrE94O4edr+o272 IsGC908j6YU+FliaVy4bdWreXX3qP6i42lYqkhKEFEygQbpYc1vXe0rpyvdVgpePO/Yt 87jSd5rYRGqBDiJO8854B1570hV8kARAe+WGLlo3A73eev5nBTIHt2OzZOuchpcBngaT /DvQ== X-Gm-Message-State: AOAM532QGR5VdQzq8+CeSLWkc1vuUHdevGdiVzcDJFMgHwgsPzkcOswN T3hEKGfa36EOnPIigHorV1Rnn4yX X-Google-Smtp-Source: ABdhPJyYgRzEs/Xsqq0zefRGb7ji9I+SQAziphNpKGG8sw+K++rACc2GKM/Of2GGfzcvmsxQx1MvYg== X-Received: by 2002:a17:90a:4148:: with SMTP id m8mr2245760pjg.184.1612343611149; Wed, 03 Feb 2021 01:13:31 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:3583:: with SMTP id c125ls697916pfa.2.gmail; Wed, 03 Feb 2021 01:13:30 -0800 (PST) X-Received: by 2002:a63:551f:: with SMTP id j31mr2591807pgb.432.1612343610447; Wed, 03 Feb 2021 01:13:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612343610; cv=none; d=google.com; s=arc-20160816; b=h5ebq85TWML8moMCiAbvBRdKvMc0GWp0lh8ZBxO4351xjrbSYL1UoAatJyT4yZZR64 BQOqZ4vfZFNrAPk1ENBcjwEc5Ev5abcZ7oRq/VM4D66iLmctm6tLOdD/GqqhDFSakLJh sFgJ3HMERu6dN7bT+sPp3XNLpjAtemkP9mOiIYWx+Cb1NhIz54NEBGWSjLZ35UhjLD/c lfSuolE1Al7/F405lG1KkcHAkYaAh8tmw8o2yeGdJcgOz9paMQ3DsnhjZ+pRrP1Xva/+ 4+H8ojFIH6nuSXX18TLqRaojtx+/66qSXjkYAeUfvN4MPLlVrEQT/a9STHlZY9q/oNXy 1bng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=blstrkczrF0azHzWZ1ftNKo3a6psEv5FLcX/MloVE5M=; b=J/q9U6bfPDUGvMvgFI7eSrzucQoi2yDRIU8DvjdfENboJdKISWZAq2bZlrJvnHxkhF zw7w5Z70vd7b7mNGrRzvFVSON4xlHO6cRydUjmtcwOHzeHynh4odiA3WwGFmV7O077pM o8AHG3wXUHHV+1NRkFFbS9u04tun1auFmgIFahOoto/1IHir5UfxQcv1BGzsLy1sr8JL 9mXiEO/5ycBZn8pnHr6lwvbbZix0uSOzInFk0OZhEaDjlBkkc5m7zB6T24Vwk4kFBjYS R1FG5pfiUQT6m3+usWTW5Zbfi2+YhEvOn8mytZLZOE+JYPJBwrIUwruhSU7KuxNvPrK5 GFLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FWgUNKiS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id t10sor802830pji.10.2021.02.03.01.13.29 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Wed, 03 Feb 2021 01:13:29 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90a:6589:: with SMTP id k9mr2260723pjj.100.1612343608990; Wed, 03 Feb 2021 01:13:28 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id l3sm1794520pgn.8.2021.02.03.01.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 01:13:27 -0800 (PST) From: Jagan Teki <jagan@amarulasolutions.com> To: 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>, Benjamin Gaignard <benjamin.gaignard@linaro.org>, Vincent Abriou <vincent.abriou@st.com> Cc: Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@siol.net>, Sam Ravnborg <sam@ravnborg.org>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-amarula@amarulasolutions.com, Jagan Teki <jagan@amarulasolutions.com> Subject: [PATCH] drm/bridge: dw-mipi-dsi: Move drm_bridge_add into probe Date: Wed, 3 Feb 2021 14:43:06 +0530 Message-Id: <20210203091306.140518-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FWgUNKiS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
drm/bridge: dw-mipi-dsi: Move drm_bridge_add into probe
|
|
Commit Message
Jagan Teki
Feb. 3, 2021, 9:13 a.m. UTC
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(-)
Comments
Am Mittwoch, 3. Februar 2021, 10:13:06 CET schrieb Jagan Teki: > 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. Shouldn't the STM drm driver not simply defer if it's missing a bridge that is referenced in the devicetree or somewhere? > 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. personally I'd like number (3) a lot ;-) . With your approach, at least the component-based variants would end up with multiple probe cycles, getting clocks etc until at some point the panel has probed, where in the current way of things, the probe is done once and we continue bringup once the panel has probed and called dsi-attach to signal it is present. Which was actually what Andrzej wished for, when I moved the Rockchip dsi to the common driver. Or at least make it configurable via a param to the common dw-dsi probe function. Especially as I also need the dsi bridge-less when used as a simple means for the configuring the internal dphy to rx-mode, see [0] Heiko [0] https://lore.kernel.org/dri-devel/20210202145632.1263136-1-heiko@sntech.de/ > 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; > } >
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; > } >
Hi Heiko, On Wed, Feb 03, 2021 at 01:05:43PM +0100, Heiko Stübner wrote: > Am Mittwoch, 3. Februar 2021, 10:13:06 CET schrieb Jagan Teki: > > 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. > > Shouldn't the STM drm driver not simply defer if it's missing > a bridge that is referenced in the devicetree or somewhere? > > > 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. > > personally I'd like number (3) a lot ;-) . We have different opinions on this topic :-) The component framework adds a layer of complexity that can be avoided with probe deferral in most cases. The main reason why probe deferral isn't always enough is circular dependencies, which unless I'm mistaken isn't an issue here. > With your approach, at least the component-based variants would > end up with multiple probe cycles, getting clocks etc until at some point > the panel has probed, where in the current way of things, the probe is > done once and we continue bringup once the panel has probed and called > dsi-attach to signal it is present. > > Which was actually what Andrzej wished for, when I moved the Rockchip > dsi to the common driver. > > Or at least make it configurable via a param to the common dw-dsi probe > function. Especially as I also need the dsi bridge-less when used as a > simple means for the configuring the internal dphy to rx-mode, see [0] > > Heiko > > [0] https://lore.kernel.org/dri-devel/20210202145632.1263136-1-heiko@sntech.de/ > > > 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; > > }
Hi Yannick, Thanks for testing this change. On Mon, Feb 15, 2021 at 1:39 PM yannick Fertre <yannick.fertre@foss.st.com> wrote: > > 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. 1. All non-I2C bridges are attaching dsi via mipi_dsi_attach during the bridge controller probe and that would be expecting panel_or_bridge need to be in DSI host attach. 2. I2C bridges are attaching dsi via mipi_dsi_attach during the bridge attach function and that would be expecting panel_or_bridge need to be in DSI probe. I believe these types of DSI controllers followed by DSI panels, bridges are not available in Mainline. if I'm not mistaken. Adding component bindings in this regards never helps, this seems to be common for component or non-components DSI host drivers. One way to handle this issue can be during drm helper initialization, like attaching the dsi host instead of calling directly from bridge or panel drivers. Laurent, Heiko - let me know your suggestions if it make sense, thanks. Jagan.
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; }