From patchwork Tue Mar 8 08:27:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1868 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 2427F3F067 for ; Tue, 8 Mar 2022 09:28:00 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id ds4-20020a17090b08c400b001bc1dee733esf1125107pjb.0 for ; Tue, 08 Mar 2022 00:28:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646728079; cv=pass; d=google.com; s=arc-20160816; b=zkz+vh1dyWBaCRcGvVb8q6p6vcF7saHJGtApGtQFnwJ1RUW/3fyhZAqBbjJuU8ivS7 Jz2t+Xp7Y3ruawXHm6FmsfSZ/oKduhplwqCvG7BQiYExhChUB+6o9sWowNzLx2l9FHE8 DybG/fQ7eOhzPjJptyKsr7dXcobkCbXWBBbmsERUVFwKptR97Hi5hp7koYDRd0sGdtq6 5A+oZWQn0agGoPf6QdDrfy+HcPZQUQhLJ60Et1iYNGcbz+WZIpIkohnMPwA8Z7e+moHk bqH4H2L+OH5VpyQM+E4RNK5AemVXmwr1GOw5cDhQRqgMObODNBP+/C2A1XxLjTxgLy6g bltQ== 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:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vyspdEHuaVJ4hkVk3psjL1Q2RnQ/GW+hr048b2cfiX4=; b=jpnlRoJ2IdMuB46gffcvajvMyCoqQMrRs2PEcD2DEn8B5txTYUa6uv7dJ1Jn2Nmu8V cqOfXVfczy4IoIn58Mtvku90+6Ifq87pBWlhu/P6YfOYFKckyrUJY72rXJfQNmiF2gbD dIqvRATEnzkKQiwVMJpEkf+Xi0Ui45ETjhh2svfgIBlsgHwK/WpR6zX7lINI5JP95rtU 6E8xBCs8t0b7ujGfgGoCfrQuKbnuaLcMUcz7UGLN/pE0JQ/V2F3zwVWIvGGTXZSnQvsQ cwn2eN1fDgc42oVryb0342gmZtM5gGtFZE4DG3uxWVfMUY0res/acE5Z+xbR2VaarEpD gWrw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZF2eH5yH; 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:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=vyspdEHuaVJ4hkVk3psjL1Q2RnQ/GW+hr048b2cfiX4=; b=BVwNjXjMbJAb7dHV3gxj1D4shDfpYqNW+zFRX/mkChjVyXIT29Isxao61+EIufsz7O EodkqXnZ/qTfw5BVow+reF036ocwbA7dRKvaT/5B0fiJ8Wbbc2CpER/QVuDMg9WZxeFH lrFyXmFogILcThCCJI2XS7T9VNLR2oplJv8IA= 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:in-reply-to :references: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=vyspdEHuaVJ4hkVk3psjL1Q2RnQ/GW+hr048b2cfiX4=; b=hVOm3i0x2W3w62dNzrOQbUCzZInep2+xcnLK9xR4uf3lLRCIujzNfB+p4PU1ArW3qq sNJ5X4D4Vey2UWeDqgWhJAqkzWbM/JGTxBwpdDINxxP8EiSp3RON2taJeicNfS7sga2Z xQ96zSLtPoxzY33p8+SrODA9Dp+kJ7qjQ8L+k26dWtAjEpeqFp5+ReI1pcr45O4rpZdi I3eYISSIjmDFXSdofcCEGnuq770UtBZAuq2l88EBePtPzPRuTykmJxVXbYG4zaKalyyx /6LFf0LSiUhgbSiAr/E/FfBLcQ0PbUqf1J67Huh7dcGtB3Tl+61ZxqFwjDgoplHVNcHH GVSQ== X-Gm-Message-State: AOAM533HDn9tBGKcgNfEoz3l84cPXjZ1SqJe5sexTG8H6kuDWETjMk19 uw3FFlLANqZB8GFOAdOiIPlqurTO X-Google-Smtp-Source: ABdhPJz5m5jqYQJD0pjZJ1Ypi8+46yrASAb8NKabqzDRAaYeOhsiG5LgEHNqSUdd11PuJiu3ToHZPQ== X-Received: by 2002:a17:902:eb84:b0:151:c730:c9a3 with SMTP id q4-20020a170902eb8400b00151c730c9a3mr16658998plg.144.1646728078959; Tue, 08 Mar 2022 00:27:58 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:f20c:0:b0:4e1:2ff1:c729 with SMTP id m12-20020a62f20c000000b004e12ff1c729ls7234518pfh.8.gmail; Tue, 08 Mar 2022 00:27:58 -0800 (PST) X-Received: by 2002:a05:6a00:218a:b0:4e1:9ed6:c399 with SMTP id h10-20020a056a00218a00b004e19ed6c399mr17120701pfi.8.1646728078090; Tue, 08 Mar 2022 00:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646728078; cv=none; d=google.com; s=arc-20160816; b=XiooaAdaQn1Nra6mrAq+i2L8Bs0lNhk1k4n0knqSPn315z1pbG9lvfUiot99g3CRno 2xWeMvWo8iDyazSGKB0EBWOT7Bc/h1HeZlfozutY+C15pT2IjMev4nQ9q+x0w75s59Vc T4ry3AnkZZ0SiXfVPAwarTo7w7ksI52obWo1N2n6KRLsobpaq5Mxhb6WIFayhN7Gv0tj obPJaKhOsATxABoirrbuRr5TWnNYAc24VTkDHTiwWf7ZiC8mIf2Nd2L3tufN0TRsIq0Q hoRTItQMfHmrRuYAczRqVhqG0QCs7q0vnHiaS7+0Kq5E8rnhtukUXqEx7Iub4YC4CrUz /pcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jKy7I9I8Tl8QKPFeqo0bxcmj+twFQO/bhH9VV5YQjBM=; b=Hpi45WHBuXAYEJYw9ezS02HbG3g1ljpqcfYdGyI3LUebazWLGiFwawNPKdhpUV8S8z 9fJzAHt0x6WyaTfzjZq3hx3O4CUtf3O2XSVcH0hvJD6oUzV3P3HVDWAGijbgAe3HoI6y 9Lt5aKR5XNu5JCQj3o5kx1PXIkxQ3qKoHX5sSp8lk5KC2AKybq9YZ8hFpVNPVYom7nVF xRNUYWLdn70inxz3SgG1iIJNx+w574A2hlOqOQOgnOL/scA74uHzu9dlaVUMcbm8acEo AZ74kFHLM8ZKcEqKNXAEQuxehiEX7cRBjGYR/jv2i+f+0OgRZvN2vK0xv5LkWo8fe3Ud CI0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZF2eH5yH; 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 21-20020a17090a191500b001bf30dd1245sor644652pjg.40.2022.03.08.00.27.58 for (Google Transport Security); Tue, 08 Mar 2022 00:27:58 -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:90b:1b04:b0:1bf:4ad2:8b2a with SMTP id nu4-20020a17090b1b0400b001bf4ad28b2amr3457850pjb.184.1646728077832; Tue, 08 Mar 2022 00:27:57 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c770:6f0b:21a:8de4]) by smtp.gmail.com with ESMTPSA id r1-20020a17090a560100b001bf72b5af97sm2000671pjf.13.2022.03.08.00.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:27:57 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki , Linus Walleij Subject: [PATCH v3 8/8] drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge Date: Tue, 8 Mar 2022 13:57:26 +0530 Message-Id: <20220308082726.77482-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308082726.77482-1-jagan@amarulasolutions.com> References: <20220308082726.77482-1-jagan@amarulasolutions.com> 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=ZF2eH5yH; 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: , devm_drm_of_get_bridge is capable of looking up the downstream bridge and panel and trying to add a panel bridge if the panel is found. Replace explicit finding calls with devm_drm_of_get_bridge. Cc: Linus Walleij Signed-off-by: Jagan Teki Reviewed-by: Linus Walleij --- Changes for v3: - fix commit head - drop panel.h - use drm_bridge_remove Changes for v2: - split the patch drivers/gpu/drm/mcde/mcde_dsi.c | 44 +++++---------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c index 5651734ce977..083a4728654d 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -39,7 +38,6 @@ struct mcde_dsi { struct device *dev; struct mcde *mcde; struct drm_bridge bridge; - struct drm_panel *panel; struct drm_bridge *bridge_out; struct mipi_dsi_host dsi_host; struct mipi_dsi_device *mdsi; @@ -1073,9 +1071,7 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, struct drm_device *drm = data; struct mcde *mcde = to_mcde(drm); struct mcde_dsi *d = dev_get_drvdata(dev); - struct device_node *child; - struct drm_panel *panel = NULL; - struct drm_bridge *bridge = NULL; + struct drm_bridge *bridge; if (!of_get_available_child_count(dev->of_node)) { dev_info(dev, "unused DSI interface\n"); @@ -1100,37 +1096,10 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, return PTR_ERR(d->lp_clk); } - /* Look for a panel as a child to this node */ - for_each_available_child_of_node(dev->of_node, child) { - panel = of_drm_find_panel(child); - if (IS_ERR(panel)) { - dev_err(dev, "failed to find panel try bridge (%ld)\n", - PTR_ERR(panel)); - panel = NULL; - - bridge = of_drm_find_bridge(child); - if (!bridge) { - dev_err(dev, "failed to find bridge\n"); - return -EINVAL; - } - } - } - if (panel) { - bridge = drm_panel_bridge_add_typed(panel, - DRM_MODE_CONNECTOR_DSI); - if (IS_ERR(bridge)) { - dev_err(dev, "error adding panel bridge\n"); - return PTR_ERR(bridge); - } - dev_info(dev, "connected to panel\n"); - d->panel = panel; - } else if (bridge) { - /* TODO: AV8100 HDMI encoder goes here for example */ - dev_info(dev, "connected to non-panel bridge (unsupported)\n"); - return -ENODEV; - } else { - dev_err(dev, "no panel or bridge\n"); - return -ENODEV; + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); + if (IS_ERR(bridge)) { + dev_err(dev, "error to get bridge\n"); + return PTR_ERR(bridge); } d->bridge_out = bridge; @@ -1153,8 +1122,7 @@ static void mcde_dsi_unbind(struct device *dev, struct device *master, { struct mcde_dsi *d = dev_get_drvdata(dev); - if (d->panel) - drm_panel_bridge_remove(d->bridge_out); + drm_bridge_remove(d->bridge_out); regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET, PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0); }