From patchwork Fri Apr 29 08:53:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12831656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC1CFC433F5 for ; Fri, 29 Apr 2022 08:56:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5300710F9BA; Fri, 29 Apr 2022 08:56:15 +0000 (UTC) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7004F10F664 for ; Fri, 29 Apr 2022 08:56:03 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id w17-20020a17090a529100b001db302efed6so5161791pjh.4 for ; Fri, 29 Apr 2022 01:56:03 -0700 (PDT) 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; bh=SSzFS9wSHMBoWm9vUIMAMrxz8gIMVdkk11n8JcOOYnE=; b=DNur8v5VU1o29SE4iBQ1n0C9CTAn+vtPL4yR31Fu0xure8UcVVlP891qB6+59GNTJC nwWgpwLVy++XDOgnibruxM+N7LwqzY+0njKB/Yd4bCw7BAqSeyVIaaC85nxG77BfUpYx fBDYZuWBdTWDkJmieR8aZ/uwwTGHdyFVQjwP4= 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; bh=SSzFS9wSHMBoWm9vUIMAMrxz8gIMVdkk11n8JcOOYnE=; b=rqhgVF906NN6RNhIT2kDoatJ+b2bgjwVdGoD6yeXn3UAPDc9X6XwCY8nGkgyShAX8Z lddbQDYhoxRvsn9N6OSyLPZxNYomuH565/OFJw+klO1Qt9l4CqtaSbU0qYSgFe5XW05j azbojA5PiT8wTuLQTGSTv6oBQ9UssyCVOe9HXB29x+YlDWC/p7kCPBSNYBlCnBcBlhhx hmDtQDw7VShlE8/cGknwGm3v8VQDwg2xmIWFMBF1P4YceEGRrjFEcMwrfxngp5+GoWkC jEO5Ibf2wFcFshIWNRvBBpAy5n0DzLgGfTaPZArPWE1X+huOmZ8oTza0t20QvaqE4aWc wITQ== X-Gm-Message-State: AOAM531qdLrOoXztBrWsbKjzyVjSRNG5Vwlpit/qEGib1jxDBjWtbwiQ PkvPQ22EpGiz/Itj+rjB7JcLSg== X-Google-Smtp-Source: ABdhPJz9e8o2qAAHZkiJqQWOUuzsWQJG01AkB6Prl0GddUUJvWCDjiZixDW8MPNaH8hxrqRw+jyJ8w== X-Received: by 2002:a17:90b:3904:b0:1da:2957:b5ee with SMTP id ob4-20020a17090b390400b001da2957b5eemr2688085pjb.59.1651222562983; Fri, 29 Apr 2022 01:56:02 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a0a9:b5c3:f85c:afa7:cae9]) by smtp.gmail.com with ESMTPSA id o2-20020a17090a4e8200b001d26f134e43sm9247781pjh.51.2022.04.29.01.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 01:56:02 -0700 (PDT) From: Jagan Teki To: Linus Walleij , Maxime Ripard , Laurent Pinchart Subject: [PATCH 1/2] Revert "drm: bridge: mcde_dsi: Drop explicit bridge remove" Date: Fri, 29 Apr 2022 14:23:57 +0530 Message-Id: <20220429085358.1699141-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amarula@amarulasolutions.com, Jagan Teki , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" commit <3730bc6147b0> ("drm: bridge: mcde_dsi: Drop explicit bridge remove") has removed downstream bridge as it's prior commit <3d7039e1e649> ("drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge") added devm_drm_of_get_bridge for looking up if child node has panel or bridge. However commit ("Revert "drm: of: Lookup if child node has panel or bridge") has reverted panel or bridge child node lookup from devm_drm_of_get_bridge as it breaks the non-trivial cases the first child node might not be a panel or bridge. So, revert this commit to switch the previous behavior of looking up child panel or bridge. Signed-off-by: Jagan Teki --- drivers/gpu/drm/mcde/mcde_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c index 960b49ea2ee5..083a4728654d 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -1122,6 +1122,7 @@ static void mcde_dsi_unbind(struct device *dev, struct device *master, { struct mcde_dsi *d = dev_get_drvdata(dev); + drm_bridge_remove(d->bridge_out); regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET, PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0); } From patchwork Fri Apr 29 08:53:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12831655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19B9DC433EF for ; Fri, 29 Apr 2022 08:56:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4AAB10F983; Fri, 29 Apr 2022 08:56:14 +0000 (UTC) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53BD210F664 for ; Fri, 29 Apr 2022 08:56:07 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id o69so5210657pjo.3 for ; Fri, 29 Apr 2022 01:56:07 -0700 (PDT) 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:content-transfer-encoding; bh=vtAatQi32uY0Mr/+NfdPdeyNea4utijeqFZuOoc4TBU=; b=SB8PJZQGthQSOKjBGLbQaA0ZU+9z1XiRPZf9se57/FRD69lZ0Yx8lcY+B1hzpM738k TSMlXOs9+snFx1090KsqS3rdp04YHs9K4zUYFdivfkYbhs/posTE+zXT8LnoPMUuL4Dk XHYbWDw/NvicWwTaVHptZZNrIiIEvA7GqKR1Y= 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:content-transfer-encoding; bh=vtAatQi32uY0Mr/+NfdPdeyNea4utijeqFZuOoc4TBU=; b=tA34jVLLz7+ypMkF8uTxVyyX/l92UkbBxQnRbfXvDrXZlyj/El0Rjg2QZAhEa3/1E/ LFAXRcmmnQ+ho3eCD/9o3iHEHhxcg59jkw2lyLai3/11DQdD4H/U1JCRR/eMkEzCJf1a GrmiLPhi3b+TwOgwvXA0/mg1NGTg4OccdgqJ1OebE4qRfmjQiJDG9y1rR3KwTTPSfxWQ laT3jrnLn3bardT8bX7IqdhiB9u9sM9cHFT4+h6+VRJEiNJAmXWYjyhFFhFAMTW2kcGp 7Wk4esFocdJrGQjKQ0PvnGmJalND19sqqtOH6Ea6l9tFF6uqktTbwS7wyini2CbC1S2w qxwQ== X-Gm-Message-State: AOAM532ps71zW4vTTBiWtAQH9WxtfdFOk5yGlhmPHRjE4WeqpdKeDlsI cCJDp0YSmCdKoW+AI6ZTCrzk1A== X-Google-Smtp-Source: ABdhPJwpMI0MAaL9l9KpZUw3BorEMtFqLIEh84Z9rHH7n1qNoAod8BG4nWO870Q1VedsWNsaSnYzMQ== X-Received: by 2002:a17:90b:38ce:b0:1da:49fe:d04d with SMTP id nn14-20020a17090b38ce00b001da49fed04dmr2706556pjb.51.1651222566931; Fri, 29 Apr 2022 01:56:06 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a0a9:b5c3:f85c:afa7:cae9]) by smtp.gmail.com with ESMTPSA id o2-20020a17090a4e8200b001d26f134e43sm9247781pjh.51.2022.04.29.01.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 01:56:06 -0700 (PDT) From: Jagan Teki To: Linus Walleij , Maxime Ripard , Laurent Pinchart Subject: [PATCH 2/2] Revert "drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge" Date: Fri, 29 Apr 2022 14:23:58 +0530 Message-Id: <20220429085358.1699141-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220429085358.1699141-1-jagan@amarulasolutions.com> References: <20220429085358.1699141-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amarula@amarulasolutions.com, Jagan Teki , dri-devel@lists.freedesktop.org, Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jagan Teki commit <3d7039e1e649> ("drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge") switched to devm_drm_of_get_bridge for looking up if child node has panel or bridge. However commit ("Revert "drm: of: Lookup if child node has panel or bridge") has reverted panel or bridge child node lookup from devm_drm_of_get_bridge as it breaks the non-trivial cases the first child node might not be a panel or bridge. So, revert this commit to switch the previous behavior of looking up child panel or bridge. Signed-off-by: Jagan Teki Reviewed-by: Linus Walleij --- drivers/gpu/drm/mcde/mcde_dsi.c | 44 ++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c index 083a4728654d..5651734ce977 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,7 @@ 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; @@ -1071,7 +1073,9 @@ 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 drm_bridge *bridge; + struct device_node *child; + struct drm_panel *panel = NULL; + struct drm_bridge *bridge = NULL; if (!of_get_available_child_count(dev->of_node)) { dev_info(dev, "unused DSI interface\n"); @@ -1096,10 +1100,37 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, return PTR_ERR(d->lp_clk); } - 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); + /* 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; } d->bridge_out = bridge; @@ -1122,7 +1153,8 @@ static void mcde_dsi_unbind(struct device *dev, struct device *master, { struct mcde_dsi *d = dev_get_drvdata(dev); - drm_bridge_remove(d->bridge_out); + if (d->panel) + drm_panel_bridge_remove(d->bridge_out); regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET, PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0); }