From patchwork Wed Feb 3 09:13:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1625 Return-Path: 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 ; Wed, 3 Feb 2021 10:13:33 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id fv24sf4203419pjb.9 for ; 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 (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 To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Sandy Huang , Heiko Stubner , Yannick Fertre , Philippe Cornu , Benjamin Gaignard , Vincent Abriou Cc: Jonas Karlman , Jernej Skrabec , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-amarula@amarulasolutions.com, Jagan Teki 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: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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; }