From patchwork Thu Mar 31 15:44:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1894 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id F3EDA3F0D7 for ; Thu, 31 Mar 2022 17:45:21 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id s5-20020a170902b18500b00155d6fbf4d4sf6555823plr.18 for ; Thu, 31 Mar 2022 08:45:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648741520; cv=pass; d=google.com; s=arc-20160816; b=bO2vxu3qAz4ApkZwup0ObfUM5x04tuJfUpmQgOMVqzrn6Gzbb6GU1vwIyIEfpfATqD Mvc9i0QtjB6TMetAEnSWVLnBCqron5k0s83BgAsJFv50HSZYuMOjoU0LBnETM5zg1wBa 93KQCqMGzeKPZ6929Gf14xl7oi46c5xiVHO5vXU0l0pQCeDY7GImyaFUcHIoLS+fm1Pg aA8HdAdi4BsB+NoXMymSnhGlyJpzLj45YyJABTnrqtiOU5CjDPFbUFVDOFKo9UuaqIdy DWqDYI6CwZAolLtQP3Mt+WgERDY1gxXjcMTNLAAmA9bw7dsGz6rcSpK+RvEor9vkIpkC pRLg== 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:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FfwcbhxSYzUndtzznqk3lZMPY3APqhpaOLKCHaenCjU=; b=M7QDMUJOCp0/KwE2eBrgntbz8dE/BisVQkZciWcF33DOwLN2RPaD+EYFbd5pIpZlOF WPWXxG3O9gIH2lOEfE3CVRLJkAA1b4QUQSkpuou0MNprT0reGhgMBRLF4szQ9zqC/Hpp pPAtH7CRocVbmDBRqMi0A1CuR6ZjkEBLd5QVfrelZXSeJJ5/ssg38cRuMlKKMZaW9on1 ie6O3ieVnG9TRG11jloZWhx+TXh4+/gqDkqhEIXdrsARZDbx+tvB8iij3YPMNi7BThR+ IWmgG9flDmo4pestZuvLu5W7mgN4VbIRMH0QKdp/nbj/R2zrmGlgtEK+5p/XYwC0jNwY hfnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ke7OiYmn; 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 :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=FfwcbhxSYzUndtzznqk3lZMPY3APqhpaOLKCHaenCjU=; b=XLzheuBdSbidP+6PcrKwohP6dlDuQohD80J11BPrw527aElRLHjmEIwfOuG2G1yNU3 v90gA5ESIomvU8gOqWUWKiRlmTP/GUfB9IaJbsS47lCik87KiwF5MlHML461o+6YZQz+ 0vKwvY0kCMddC9AihCRrVuDBdZsxtrm/RqaCw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding: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=FfwcbhxSYzUndtzznqk3lZMPY3APqhpaOLKCHaenCjU=; b=3xrRAO0EeyfWGaEilRFQ8IMYNv36Ks255T5gyvxqeozoTQulz9RJoO4wfldSVPV3+g bH5FuIzM+xBzs08NfaehzpbMVRPaQ0qznQfahH9M3MnUZIDRs3P4R+PSD8b6MLJPWv3V 9/9yIaGdjRxIfucDmA/agd+64Ya98SYML39OY0q7nLTIn8jk+rbqAPbhCsSLPOLw/MQ1 B97Y88HNMLGuGdRRKc3qsNArjAZ+VNWJlOn0KKPCi9lkoUArGnbav/V8vGZUTTg4ZIk7 HcKUBfxwuoauFjzoTfNqL3i9TKtst8BGQnQIi22E6t9CgEFx6Nbz5JpQaQ8DsxE69cVo Rz0Q== X-Gm-Message-State: AOAM531Mj6wUPqIVuJKvt2WCi8boFLWMxTGhsIaHXfecpGgyyW2CIlIu +dSefIRGBZbTybL9SzB5DYM+xAqU X-Google-Smtp-Source: ABdhPJwipY2fzSEJCO2Z21M2QOrAsy4+xb/z/vG0sxrp3Q1LWmw+HGYC3KfsVa4JVwToe9Tiq6WqtQ== X-Received: by 2002:a17:90a:c246:b0:1c9:7d32:640f with SMTP id d6-20020a17090ac24600b001c97d32640fmr6863772pjx.182.1648741520638; Thu, 31 Mar 2022 08:45:20 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:bb8c:b0:14d:d65a:dbdb with SMTP id m12-20020a170902bb8c00b0014dd65adbdbls4665036pls.6.gmail; Thu, 31 Mar 2022 08:45:20 -0700 (PDT) X-Received: by 2002:a17:902:f54d:b0:154:6794:ab38 with SMTP id h13-20020a170902f54d00b001546794ab38mr5846626plf.114.1648741519776; Thu, 31 Mar 2022 08:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648741519; cv=none; d=google.com; s=arc-20160816; b=rn2szIpq01hwr5dMzxda+GrPL0GI1iIFVqjKP01+R8TqJs2RvjgTQPnizOV5TQnLm5 zA9oFfd8vcgDUkTZhHqUSdfTvccmwGfD3TfLOh/VpFsuKNjnjm1wscF47WF+A9nnOd7T WU0Zvom4ixhUVfty50PF9IbSOX4KhtiL1QRN7/vYeB++R98qjUPJ4J76X0AsBl7pBmhN bFqq4AZI7tSZsc25BA6UPI6c75ewHK5ywmXSNvBYgmR/Hm56V0xl+tbo0oGVoysHe0Zc NEuNMPERPxf1Cf1R6/b7h1thH/eltHZbd8amB+7s+10xZn+cJh4ALqvBCuMlzwLyIhMD 2xWw== 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=p4j3Qt6w8Esn9msyNRh1aWfBBelNHCS4Qddf02urjTE=; b=pZcS6ZQHrqebhhHEO1RvLjprxaTzDKrqV2RCquDvc1j/5Xer3eWbWC8hmHrLGrXZKq GBSxt3kVPR3DAGZ8ShKnnyYcm4SKBEVbhrfTtPJa6CCWllt3c5DKWltjEitkEYcBMB58 AYLtv82jGEbM4j4bbxHWu4zwyH9iYlsruXcbe+wnhcA4S6glaFvhRsybxBrd6L0RWPiS 14xPX08uLcnhheQ1tPXxqVKCxeF57v1IVHm4GBB+2u4O4QgMgy8azuvCrtctXvbGXfTT 3tBbVs2ssUa+3KiLji3tUM6Q2vrui0Rwny13g/XPfeZRBgiaiJC19zDPTqrqE4Trf4tI 6VpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ke7OiYmn; 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 h4-20020a636c04000000b003983e505d3dsor6135188pgc.66.2022.03.31.08.45.19 for (Google Transport Security); Thu, 31 Mar 2022 08:45:19 -0700 (PDT) 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:a63:c015:0:b0:385:fe06:eb86 with SMTP id h21-20020a63c015000000b00385fe06eb86mr6426559pgg.132.1648741519413; Thu, 31 Mar 2022 08:45:19 -0700 (PDT) Received: from localhost.localdomain ([183.83.137.38]) by smtp.gmail.com with ESMTPSA id g1-20020a17090adac100b001c67cedd84esm10205684pjx.42.2022.03.31.08.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 08:45:18 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart Cc: Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v4 1/5] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Date: Thu, 31 Mar 2022 21:14:59 +0530 Message-Id: <20220331154503.66054-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ke7OiYmn; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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: , This reverts commit c206c7faeb3263a7cc7b4de443a3877cd7a5e74b. In order to avoid any probe ordering issues, the I2C based downstream bridge drivers now register and attach the DSI devices at the probe instead of doing it on drm_bridge_function.attach(). Examples of those commits are: commit <6ef7ee48765f> ("drm/bridge: sn65dsi83: Register and attach our DSI device at probe") commit ("drm/bridge: lt8912b: Register and attach our DSI device at probe") commit <864c49a31d6b> ("drm/bridge: adv7511: Register and attach our DSI device at probe") dw-mipi-dsi has panel or bridge finding code based on previous downstream bridges, so revert the same and make the panel or bridge funding in host attach as before. Signed-off-by: Jagan Teki Reviewed-by: Robert Foss --- Changes for v4, v3, v2: - none drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 58 +++++-------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 11d20b8638cd..1cc912b6e1f8 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -246,7 +246,6 @@ struct dw_mipi_dsi { struct clk *pclk; - bool device_found; unsigned int lane_mbps; /* per lane */ u32 channel; u32 lanes; @@ -310,37 +309,13 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg) return readl(dsi->base + reg); } -static int dw_mipi_dsi_panel_or_bridge(struct dw_mipi_dsi *dsi, - struct device_node *node) -{ - struct drm_bridge *bridge; - struct drm_panel *panel; - int ret; - - ret = drm_of_find_panel_or_bridge(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; - - if (!dsi->panel_bridge) - return -EPROBE_DEFER; - - return 0; -} - static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { 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) { @@ -354,14 +329,22 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->format = device->format; dsi->mode_flags = device->mode_flags; - if (!dsi->device_found) { - ret = dw_mipi_dsi_panel_or_bridge(dsi, host->dev->of_node); - if (ret) - return ret; + ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0, + &panel, &bridge); + if (ret) + return ret; - dsi->device_found = true; + 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) @@ -1021,16 +1004,6 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge, /* Set the encoder type as caller does not know it */ bridge->encoder->encoder_type = DRM_MODE_ENCODER_DSI; - if (!dsi->device_found) { - int ret; - - ret = dw_mipi_dsi_panel_or_bridge(dsi, dsi->dev->of_node); - if (ret) - return ret; - - dsi->device_found = true; - } - /* Attach the panel-bridge to the dsi bridge */ return drm_bridge_attach(bridge->encoder, dsi->panel_bridge, bridge, flags); @@ -1217,7 +1190,6 @@ __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; }