From patchwork Fri Apr 29 08:59:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12831659 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 86527C433F5 for ; Fri, 29 Apr 2022 08:59:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B86FF10FA7E; Fri, 29 Apr 2022 08:59:56 +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 C44B610FA7E for ; Fri, 29 Apr 2022 08:59:55 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id o69so5216954pjo.3 for ; Fri, 29 Apr 2022 01:59:55 -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=cfQQ6kIuyBuouEPLJ2XzvmY09Tm8WP7/zlQvfxQJkSk=; b=MAc+Cq2VJGbLP09AxqYmwKWFRHfoR0ur0XXDrroRb6zcMVW1IkSjfPz9fIrR5qWRHa t/0ADSVMSLQyQ0U2XL5dRtwu44GMflvkuiKjLPU1dzSR4UK7Cr6bXloKdDXqfUlCeuH6 wePRZ1Q23v/xF8ETO9siwtVl4RBjBZ7It7taY= 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=cfQQ6kIuyBuouEPLJ2XzvmY09Tm8WP7/zlQvfxQJkSk=; b=27XM1jTeAIt4NBpDLWy4dhLqQxKFyQj+XlEOGWV7bhQaB5SeFF6rbx8zoRfs1VElGi rx1I5zOXe85W/xAPrGu0E5IPh0SN9TSomJPQF5s3Fv96YKEvnFeDerXiz3gh54QQQ/XF ylUxxpqLSFmMqnjv89thoCMtB79MoNKl1bqqoi5QyktvAKOQlmj+gjKqKm90+MNRbAKj fC3p+K4GFR0Se0zRrMizOsqVbT6DLN2FStggapCWQrO49VqcD8cZ7CMvYp3XpR2zTb5y ZxhF0q+QrmdgX/Wl2OeZJ68nWdnGhI2Z2OOcRz32gutO1SdgWOFNpbtuFupSyq/idHWq Uk/w== X-Gm-Message-State: AOAM531OeTgLa/g8WklZSYZHBMhCN58Jby2l3W4xIhI76qKZfFfsVhru RBhbbOSiVm4iJMFiSJZT2S+IQw== X-Google-Smtp-Source: ABdhPJwnlxxyqK/l5LBTQEMu1uiWtqPSpdX0C9s+O7C9EUeH06MZp08Xt6Xjs3qsMSaAvVMsudZUiA== X-Received: by 2002:a17:902:f544:b0:15c:fa6f:2630 with SMTP id h4-20020a170902f54400b0015cfa6f2630mr28260580plf.110.1651222795391; Fri, 29 Apr 2022 01:59:55 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a0a9:b5c3:f85c:afa7:cae9]) by smtp.gmail.com with ESMTPSA id y4-20020a056a00190400b004fac0896e35sm2453085pfi.42.2022.04.29.01.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 01:59:54 -0700 (PDT) From: Jagan Teki To: Linus Walleij , Maxime Ripard , Laurent Pinchart Subject: [RESEND 1/2] Revert "drm: bridge: mcde_dsi: Drop explicit bridge remove" Date: Fri, 29 Apr 2022 14:29:46 +0530 Message-Id: <20220429085947.1699963-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 Reviewed-by: Linus Walleij --- Notes: Nothing changed for RESEND. 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; 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:59:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12831660 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 0C262C433EF for ; Fri, 29 Apr 2022 09:00:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5152C10FA34; Fri, 29 Apr 2022 09:00:01 +0000 (UTC) Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4C75D10FA34 for ; Fri, 29 Apr 2022 08:59:59 +0000 (UTC) Received: by mail-pg1-x535.google.com with SMTP id 15so6056380pgf.4 for ; Fri, 29 Apr 2022 01:59:59 -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=3vcraC2J+UP1DcJHUxnLq3joY2y3hu2SHI5P7oFcS2g=; b=iDKI4/YNtZz1MpApXDWP8KXQpaYQudRGj4IOKE5VHRn1ckCHw86KkYhVhYq2sNQaxz w45tCPnaypHa+FOfyouuR4BD+gwxRr7edDsUbDBfXsX9f6vw7fXwoTMs8D8hLioPJyrh Df3X/lfAysAzwF3zijIMVIA6K+GKt/bZw3ibk= 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=3vcraC2J+UP1DcJHUxnLq3joY2y3hu2SHI5P7oFcS2g=; b=E9X/98ZbcX0MVxrE1pIs6RIKzn0a0XQPrFsf8RBSH0deJttwf0QoQF46AqyuHvMujE 8MsNwUa3x43zKoa4M2InX7sAnAbcEwJhEto6szMwiIoPmw56kJpI7LMnWQeKGJzCuU9D VvQxl/rqnlwYcR8s04sAnLGLegZo0btd0u0H1/LIsgX+yZ3giXKrjX9zKNqntJj330Uw nNXsPQc6VAueTilRX/WTksSDMJ8WLXp32UQBZlM/kX5Fiddwlpgqv12aWAvI1AceBdIn wCbsCkwIVamIeXW83lSgiobvk2UUFJS+qoA+zCZS8Z9xhPgrAPhcMgyElNd8YJBuBAte j6rw== X-Gm-Message-State: AOAM530bIjayuJe1HnHvavJ4HcTz/jB/0fIuFKBx1V2RbtwQTpBv9NMf UqW8EmGV2vqgBVom4FznUsyLyuT7i6ee9w== X-Google-Smtp-Source: ABdhPJwg8KdJ50UGLTPsmKGau1HbSVaLnb5CU7RVB1vvD9/GAaQsZY3a10942zJs0efSbp8otau/fA== X-Received: by 2002:aa7:9085:0:b0:50d:35ae:271 with SMTP id i5-20020aa79085000000b0050d35ae0271mr27804043pfa.42.1651222798929; Fri, 29 Apr 2022 01:59:58 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a0a9:b5c3:f85c:afa7:cae9]) by smtp.gmail.com with ESMTPSA id y4-20020a056a00190400b004fac0896e35sm2453085pfi.42.2022.04.29.01.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 01:59:58 -0700 (PDT) From: Jagan Teki To: Linus Walleij , Maxime Ripard , Laurent Pinchart Subject: [RESEND 2/2] Revert "drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge" Date: Fri, 29 Apr 2022 14:29:47 +0530 Message-Id: <20220429085947.1699963-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220429085947.1699963-1-jagan@amarulasolutions.com> References: <20220429085947.1699963-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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- Notes: RESEND is to fix author e-mail. 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); }