From patchwork Tue Dec 7 05:47:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1799 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 68F763F03E for ; Tue, 7 Dec 2021 06:49:23 +0100 (CET) Received: by mail-pg1-f200.google.com with SMTP id d2-20020a656202000000b00325603f7d0bsf8135380pgv.12 for ; Mon, 06 Dec 2021 21:49:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1638856162; cv=pass; d=google.com; s=arc-20160816; b=p0fGgo2VF9zx6S8LG6j3MUvcwIAMOIABb16KSft9ZgDbNHlGHVXFY2g4eJSQn7SCJY JX/CvATqyH+jZLNAYMI55b9jvVBPs0VS5RpATX38MCodBJBPen/yA0mydFW6CXRI5ElS nkW+GIdOlg+VcW/385r+/Zm7qOCoXxxXCww+CR5qVQ6Bzy6U6kxMXAubDrrDPhMOZEPg ybVvX94pqlaBNhoaetTfy51vzoo0B2dDO9klDZjBTNYpVkTcuBS0iuprO8+crfCCg+9d dHY0AGMkIrQpG+RdK5O+L+2iwGGbNg6Mg+4oLDJvsIGtXgQqJAX03NQZUod59ddmGu6K YRUw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VSSlwRddzqG6EFX4OeipZ7LXBXwsugQEVK84+KkDkoQ=; b=WUbanEYYNEt+SKIUZnrhQlyDZyTsGRAyNggAKSXLLsAIrj7FxWnyJgCLCfsygx+zCw BjXLD9ykRuBJIcGt7qaJQxCk/LIAHKF+cN+yiuTeu+fG54ZOu5KA/zMXXnUGo9UYWOE7 e6s9frrh3GHAvhtkJDzQwuHtF0WUYu0uyHO1cBr4G84LsNmWS28OSwufMEaxII7cEsYQ /dVqRsDM/RHa8I6RIA94EjNXxlAF39BHUQntTEwx0BcYYPKDySlxhBylsfv1IQGSVHe7 ZLKme6PQcXArRmRoPn8xeMrv1dSq7KJwpb9gVm+UrOR7s+bWD+bG/Zgu7Y+YoqRlSzlK LiTA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aD7fgD5L; 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:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=VSSlwRddzqG6EFX4OeipZ7LXBXwsugQEVK84+KkDkoQ=; b=UbxomwIxFRJF1ddNs8NNQRCvhvYx4wo9elSo2/V12PAWpnXT9IV0/N24DGdaffH0jp 8TbG6VIkHWUTPwHMUj6AIXeQb3/wy8cv9zvHBsGPhO9oJrqv7es57Pgbm8Zp8BXwyOib BT1X9uuDStThZ4kkutTJTQjnuJVUkzsPBWazs= 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: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=VSSlwRddzqG6EFX4OeipZ7LXBXwsugQEVK84+KkDkoQ=; b=RgqIVppp0XZ149yIIyN2WuOQpZobMyXQAnm5gSndPFBulxZGq0j5tLncrEPkrUJ7sd 9CMPjDJyhoulocJQUgKXlFrlMUwSo2HqA7KDi1fOnvZV5tJ271ilAto4DZQJqTSST28x stQ4g3BryfUI1ulOIH+OAIPSlNKud5wWGJNbQegJ5JNf9dJ2QlKPQ5feahJehVcjmo0J hO/KiHbqaqu3UTH+Kh8rHkxI2+F57FCVJN5N76m1kgWuWQxRJ74KCNSyZhm9GgfhoETY 9eMWrkFQNSHAHnKT5XhWUJO7oScW+ZmQd10JsjL6BPe+G0FHb4Xws0gvAZ7oukdn6WSx royg== X-Gm-Message-State: AOAM530GIy8CtvHIwuMpHUkNpRJJOpeFQ3wVIcRj2EB92+DPhxmkhxL9 FLxX0f4NWvhfjOtXFmsU3bW7nXau X-Google-Smtp-Source: ABdhPJxEAwhnRG2NfieCR/ZRGNehEU6oxx8E5vxJc/BYngeGEQfSfDEp4a/YYNyln7rDahUUc/rWaQ== X-Received: by 2002:a17:902:ea10:b0:142:112d:c0b9 with SMTP id s16-20020a170902ea1000b00142112dc0b9mr48739595plg.35.1638856162127; Mon, 06 Dec 2021 21:49:22 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:a81:: with SMTP id b1ls7375795pfl.3.gmail; Mon, 06 Dec 2021 21:49:21 -0800 (PST) X-Received: by 2002:a63:ea52:: with SMTP id l18mr7532389pgk.114.1638856161458; Mon, 06 Dec 2021 21:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638856161; cv=none; d=google.com; s=arc-20160816; b=rSrOyeMuQVDPfOWMBzyEr1g7ssxOVh3+BCisCnU40YZJ9mZijpA2My8zONDYBaw6Jk hrmQiw0kgPZZVGw29LGlO6UeB1A5+Euek/vs6b/mnovXPEfAHJBFInAPlDrBzbd+M6X6 nqqVAc1IjFrNBbYaHmNfDMRzphICegbRdYTeEH13QJ6SAUEgyxlRLeF38xPTf+y8JKA9 GcZ0viR4DiZ8cVS1ZPt0Sm11AWWkzeqtsSjccti+flXZbrCj9qF1/YSrh95p6jQwTTPK e3RKEtjknvQEeOR+TDb7sddHsbpOYdPNVk6yi6UhB/8ThqGAqPJz7X0W3pqL1Ft/yMy5 FdJQ== 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=oI+jB1Oj81gXS93Xi29AaslGAFYJbNNV4lBDuspdSkg=; b=ebQOaNOy7Uhp62TQYQoMfHvgZu8hvN/Zklh4BAfrW239+dTH4wW7XDBhM0OiVWRMvZ Px0W1GthPDtZBR47mJob49ARBRrx7HS11FvigsW/Ez8P0lJCkn7AZOqPdhD6eD03hErN keX2iMOOT5zCxsjUPT2oHbYhp0PjTgk8ZTmHTSk49WT2yBDrFqFx2EefHlzo+XJbP0Jw N56vk+9zOnQtfYNVjsdsIobzyn3JaHdk1+ffMeS2oAkI4BeSLpAZlHI/8H8Xf02CjjzV Fk2LoZ1uuHlaS7B5/44vVAhEt8+4EHRSHXL/cICVs6sKfcvl2WCsZu7fwCeGLUCSerbj CqpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aD7fgD5L; 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 w19sor8359137pll.0.2021.12.06.21.49.21 for (Google Transport Security); Mon, 06 Dec 2021 21:49:21 -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:903:285:b0:142:21ba:2191 with SMTP id j5-20020a170903028500b0014221ba2191mr48896433plr.28.1638856161190; Mon, 06 Dec 2021 21:49:21 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:ac1e:ca0f:5f0a:c85a]) by smtp.gmail.com with ESMTPSA id f7sm14496352pfv.89.2021.12.06.21.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Dec 2021 21:49:20 -0800 (PST) From: Jagan Teki To: Rob Herring , Frank Rowand , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Laurent Pinchart , Robert Foss , Neil Armstrong , Andrzej Hajda Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 2/2] drm: of: Lookup if child node is panel or bridge Date: Tue, 7 Dec 2021 11:17:47 +0530 Message-Id: <20211207054747.461029-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211207054747.461029-1-jagan@amarulasolutions.com> References: <20211207054747.461029-1-jagan@amarulasolutions.com> 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=aD7fgD5L; 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: , drm_of_find_panel_or_bridge can lookup panel or bridge for a given node based on the OF graph port and endpoint and it fails to use if the given node has a child panel or bridge. This patch add support to lookup that given node has child panel or bridge however that child node cannot be a 'port'. Examples OF graph representation of DSI host, which doesn't have 'ports' dsi { compatible = "allwinner,sun6i-a31-mipi-dsi"; #address-cells = <1>; #size-cells = <0>; port { dsi_in_tcon0: endpoint { remote-endpoint = ; }; panel@0 { reg = <0>; }; }; dsi { compatible = "allwinner,sun6i-a31-mipi-dsi"; #address-cells = <1>; #size-cells = <0>; port { dsi_in_tcon0: endpoint { remote-endpoint = ; }; bridge@0 { reg = <0>; ports { #address-cells = <1>; #size-cells = <0>; bridge_out: port@1 { reg = <1>; bridge_out_panel: endpoint { remote-endpoint = <&panel_out_bridge>; }; }; }; }; }; dsi0 { compatible = "ste,mcde-dsi"; #address-cells = <1>; #size-cells = <0>; panel@0 { reg = <0>; }; }; Signed-off-by: Jagan Teki --- drivers/gpu/drm/drm_of.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 59d368ea006b..1c4cb809d7bc 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -249,18 +249,34 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, if (panel) *panel = NULL; - /* - * of_graph_get_remote_node() produces a noisy error message if port - * node isn't found and the absence of the port is a legit case here, - * so at first we silently check whether graph presents in the - * device-tree node. + /** + * Some OF graphs don't require 'ports' to represent the next output + * instead, it simply adds a child node on a given parent node. + * Lookup that child node for a given parent however that child + * cannot be a 'port'. + * + * Add precedence to lookup non port child as of_graph_get_remote_node() + * returns valid even if OF graph has 'port' but that OF graph remote + * node is not register panel or bridge. */ - if (!of_graph_is_present(np)) - return -ENODEV; + if (!of_get_child_by_name(np, "ports")) { + remote = of_get_non_port_child(np); + if (!remote) + return -ENODEV; + } else { + /* + * of_graph_get_remote_node() produces a noisy error message if port + * node isn't found and the absence of the port is a legit case here, + * so at first we silently check whether graph presents in the + * device-tree node. + */ + if (!of_graph_is_present(np)) + return -ENODEV; - remote = of_graph_get_remote_node(np, port, endpoint); - if (!remote) - return -ENODEV; + remote = of_graph_get_remote_node(np, port, endpoint); + if (!remote) + return -ENODEV; + } if (panel) { *panel = of_drm_find_panel(remote);