From patchwork Thu Mar 31 15:45:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1898 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 BEE823F0D7 for ; Thu, 31 Mar 2022 17:45:38 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id m24-20020a17090b069800b001c7de0243a2sf9509535pjz.9 for ; Thu, 31 Mar 2022 08:45:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648741537; cv=pass; d=google.com; s=arc-20160816; b=h08ktb3DQQBWNjRVggpoqCnoV5Yr++d41hMeP8NqzHd7GIaWUv+XHyZcyZQ2PETDaf aA4gy727RROnEKxtxu1RxKo8joV6I7pLhR9mRh0GYRxZpJIiICS7jSSjvP37RzZldeGN DVBr9WEm3giu5yY6s9YCUw0QYCReVFB+1i2sbdBF7RaCzrbyZiLoY4rSp53v60c8NnTw 4QSxL2eDzVpTHfCROT+N8jNnxk/KE4zeC0Zzli2ebQAjc2epuEspLsdggCbcFjOgwywm T0yZqAjEHma4DXgSE1yoPFYrD+PtFoLRed4GwU9fnzoI5nTefjmEuJMeHvcB9+k8hZ08 ze5w== 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=83iK4RuEx5P/fEvhNR1JqFrjeEmsw8yVqiMntC+TkLI=; b=CswIOknnEuHdR9ZVt3YFyKRqJQLksDhYywk2flfrv3Q/fDOP9adFVvKyeZSLGY1WVG ot4JhZMpLGPPIQnbMxbmTSPORz8M1TCsy6Vot4Mst2W6Dvyr5HpOqDC/aN21SACFBhDj CsH0TeKVBqkRzaLASpF5DhRbIR8LSdYtYm4ddV6adxdc42FQhd5atMENBUlE9YBGE0aW bwTHMcEboDO6XPSp9BX4n2cOFM72BSVraaS3uT98sRq7OCaOzYHRcs4Z31Tg29UzFQEK MTaC6P0xUUiaVEgO8WaSzQCYoK1bo5xCvVMRP6FoLMbPtuVNjYrltf0i+pX9axdVzNUB 3y0Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b9ce5lv9; 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=83iK4RuEx5P/fEvhNR1JqFrjeEmsw8yVqiMntC+TkLI=; b=ejIvzl93QWFGEmGPTccyODmQ7ufcVcr3plTU7HQpxUEkDSGJ8XM/YWlCU8GgQNj1LB zeY0ZUAVccURifpHdEtZBmdZpH0m/MCYnt5kWyLGMu2yQ7txDCPEQkJKMzf2aLl2fkEx BrbA5/VqC6D34kaND5WPW7zJ7A3tNAsnIGOC4= 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=83iK4RuEx5P/fEvhNR1JqFrjeEmsw8yVqiMntC+TkLI=; b=Bl4V7suYkLA4Fl7UJkxe7xbBtpIIB9eJ3vK4LO57Rc/bloQVdT3HmOITBuL7A2ghRg 8YT7AW2RzjAdJtCJsU2pInzar7f4rarkjuvYcf8cyTGR3X0H4AZ6Hv0oST6/OPEInzw+ 5OvYNwPVfTacyDXjebsIdteNedrPE/U8Y4Qmn6i8sgrA9K6Gk7ABR9OUhe57LTiu0UtR 6fydi59dKFxBZFjEuMBX19FOOssJzSZnxY/w5hcoKptOXUqJ2n/ZDio5Y0mwLs1mNrD2 H+oIAm28u0ovqcFuGcuIc83V6hqZTW7/XClxvftyLzwK08PhBA/374sjsrq1Swp4e0qR KESg== X-Gm-Message-State: AOAM531Vmq1mGGj0hh7CCAbrWzmsAgUPpaC3mulQu0N5uRXZyRF6UqwQ nnRZQxIOHbSzBI/A0FYYspaEfJcf X-Google-Smtp-Source: ABdhPJz3XJeNsZwTfv7NgXdDCY2plAJuEUsUOWtC/ar3yvUMnuSQ3lBEs04PiE8PZyLiLS8Zj+fijA== X-Received: by 2002:a63:1649:0:b0:382:2a04:4136 with SMTP id 9-20020a631649000000b003822a044136mr11203645pgw.568.1648741537559; Thu, 31 Mar 2022 08:45:37 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:f548:b0:154:2ceb:f1af with SMTP id h8-20020a170902f54800b001542cebf1afls4661946plf.7.gmail; Thu, 31 Mar 2022 08:45:37 -0700 (PDT) X-Received: by 2002:a17:90b:4ac9:b0:1c9:a345:6b9a with SMTP id mh9-20020a17090b4ac900b001c9a3456b9amr6723478pjb.118.1648741536652; Thu, 31 Mar 2022 08:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648741536; cv=none; d=google.com; s=arc-20160816; b=MehDnClCNDG1opuaYHZDziZ1N0Ldp0KPU9ig0F5pxYNTrlwCuxJMPttB3fRGmoE9jL mkisXZmAXHjDTs7KG/8ux7sWw1t0u2ptqqeNfeybrvQhutexR4/UuczWErD1HfrklVgx rIcPtlkR/PaLMDe7Juh7xwTVbjIDI5aV2ujUpyFVF5o4LaY05cYQWHE/Lf7c/xSh1Wzn IiUG4INrcDcRVzT2Xnxdog6pERV+vElBycw6gMV4+u0Tc+OvaOTTEUVKq9DWuBoMJ5Nv xRV+qbtXG1Gu1gxqYoGL/tWRtJveCLkSY1XCup+84Htbr3dTefV5gQQCLX5HqgfUCXr6 I5qQ== 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=Vp100snWzjlwIzMGFemdwqiCb11PotYbxi064xgRA5s=; b=aM0SXtGOP+xQwhAWa+uTMR0zoSok5SyAIYh3B606uDeFzEdeQT7lMI91TDtVdfLVjR t6gzhtAMJOcIynEviUE0rCWRoPVc9VYvRz12lInNGfVYMSqaGKEl0jOik0tCPZEc9yhU oFsM9sKK13uObUbaLDno+pfIKcVvCBgqm3ZK0vh9INybV/lx3Ehig3h9Nnx5DF4aQd1n Uzin2sPlvS98NLUMeDLlFJnk+DCoHqywf8dKaGky/87s4rN4Sl9QfoqtwibRMPWmu1DG Tc1yQ8Yqi5du4NaoNRsegjXF/k1wFHYNw3zVIW4E+gybnNtDsa2h3WujgfmcOdYNbpJi AtmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b9ce5lv9; 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 p18-20020aa79e92000000b004f6b01fcc48sor10205008pfq.63.2022.03.31.08.45.36 for (Google Transport Security); Thu, 31 Mar 2022 08:45:36 -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:e617:0:b0:382:9ad9:d829 with SMTP id g23-20020a63e617000000b003829ad9d829mr11232400pgh.553.1648741536347; Thu, 31 Mar 2022 08:45:36 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 08:45:35 -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 , Linus Walleij Subject: [PATCH v4 5/5] drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge Date: Thu, 31 Mar 2022 21:15:03 +0530 Message-Id: <20220331154503.66054-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220331154503.66054-1-jagan@amarulasolutions.com> References: <20220331154503.66054-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=b9ce5lv9; 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 v4: - collect r-b 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); }