From patchwork Tue Dec 7 05:34:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1795 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 C45F93F371 for ; Tue, 7 Dec 2021 06:35:02 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id lt10-20020a17090b354a00b001a649326aedsf927071pjb.5 for ; Mon, 06 Dec 2021 21:35:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1638855300; cv=pass; d=google.com; s=arc-20160816; b=esAFxaaZt0rJK0gpSCOZciWqG+1yP8uxQXL3SKs6BUZaxdL/POkHmdtcCm59yP58CF 2gCDlp2YVcX80ERN42SE2fM19UCighHnGMgHkX4HQ+QbFFqyA/iv1NeErxPJ+kdKu3I5 Wl9YTjvVAjs7Ys/eyuVa1lRk6JYIiwFaIGNMIrvPyashEM8Z8Lq4YNXxbkoUqXGTy/U0 xNQkcXm2wdEe9ryBVNKZhRSdQGwk8K95Q81puduZ+m/2H6kYtFnsxPsE1lJQWlqeujfN PaSwm8UBwOOgHFxOI0q/wG8IerkvL4XIZH2Cf46vtZ3sdCHWpGRsRBVo/qdtXyyBN5xN gp1w== 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=u1IAsVkolGAWGtsFUv1ySO+U/mI8DhZY2yRJeK6Hkkw=; b=KJAtJgiUm3Q6OfgkTEwuoxPqlGM2hMSj6JDPFTPujNxj3djXMuOxE12Jsy5lnmgAws UYnNvQlSy3iWTgyD50P5Aysh/uFHt1xHHOBTICr2ky8NjSWZ3xnN5XkvRMm/twhvjL+n EDCwCPd7ZqRRFKkoJgXDEcxRilDiFZFaFfnzAXVzPCwTRoSvz4CBI5NWDSgEAPkb6LAg 4KV5WCtxxzvWQ4CrPEi/jNyjL62n+WpMn2Y9nSEVZQb9ZkdQaW+axiMnAA2BpRCnoTT6 O1q1zc5bVdRaDRnwPI6774076DYHvYD1WcTLWIaWynosAh9GDRI0mcSx7cDAw2zW3sSR NYTQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ncvAVe8q; 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=u1IAsVkolGAWGtsFUv1ySO+U/mI8DhZY2yRJeK6Hkkw=; b=K9OsSOZ4ywvJb9R88ZWfaei4ZCuGcjkYhk2cHi18yZdjCg/S8gbxI33JHubV+FMofG 0OG7ORdnlYdO6fHhPFz8bufSbKTKo4vaGioHAzkmyjhHexRtq2mtnx9leI9216+eNQiq ZkBpQxp7GkaWJMlyDV7fYuyN38TXCcQyWZnEs= 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=u1IAsVkolGAWGtsFUv1ySO+U/mI8DhZY2yRJeK6Hkkw=; b=GeWSxG+c1tXQoINeyNrZcOHNqGhgAwikIKPm22z863h8HK7yF/dNLJv7+vpxS6LU4O kMIFjHOBodm4NZB44XblcLcTFGnq0L5H6+R8fLASonqe5jB6TR8VsSrY1qqujAtaHboe CNZpCA04akeVEhMz9pjCAnH7uuSTRwuBZIEhzR6yN8sYN6l7DJ+WzkVSLqU2++mX45oA Qij1oyA+88bnz4KLmdBjYzplKuYjHCowE6hvXV97TJOXRu6lOyW4m2Y6Gors3nmrujYG 7JFPkrYD9qLMSefdDnVt8XWrlPSVYVJd3KgFJyMQq4iYqd8u7rfE9sB84mHM0IBSXJm1 oEXw== X-Gm-Message-State: AOAM530NiEvdIjssq728w3AjZ6bhZSWeJon5NxBegtFExRPNj4YvX6G2 sgtBM1m+QEEbfM1siOIiyyz0udAp X-Google-Smtp-Source: ABdhPJwxU/AQTtkolDS1/dpjDP5XQhSG6f9DjzJQXnQCE/q7fC6RiwBgCVNAUdprCNrGNz9Ftig7ww== X-Received: by 2002:a05:6a00:1ac9:b0:49f:b38d:fe7 with SMTP id f9-20020a056a001ac900b0049fb38d0fe7mr41703360pfv.63.1638855299940; Mon, 06 Dec 2021 21:34:59 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:481c:: with SMTP id v28ls3044478pga.9.gmail; Mon, 06 Dec 2021 21:34:59 -0800 (PST) X-Received: by 2002:a05:6a00:1412:b0:4a7:ec46:29d1 with SMTP id l18-20020a056a00141200b004a7ec4629d1mr41114680pfu.16.1638855299278; Mon, 06 Dec 2021 21:34:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638855299; cv=none; d=google.com; s=arc-20160816; b=cGI90UD5pYej1TwNqRuDQbXz+e78Gwf7aACSoiKKQJMILidxuRs5OSCH5VJ9cYjf/1 RqH6lSpqgX9//vmgmRQsHKVx/rkq/+EOhD565HoIxLysgjtO32g2NwFhC+fyp6LYdbJh KZbTyX/zwSFkJQdTvgsbM7Bbha+gviHWtPHqmDBnphs/HzWYfWKVBkFIxJYwNHWdeAIN 9ZBRxuN3YM3fxN6jHV+d1HBZRd/X5Sl844tOUfYvIgtqWiFGBeW7DQYdcMoxwuSEFUeD /FHBlzQX4Rr0fAD5vVHLgUBvF4m2p+52nzuwNllGfN0KeVkkhXcx7TqgYXHo9LCC9QCo sSsg== 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=VmgRetq4h2blGOPfstvzem4GfE1tTHNCdBI9DXOEUFE=; b=Hilpj282bsy+mkA704JChGEUSU4D1VenQy7Hw1yGTwFBr49Xertedp6rb9rgDVH3ZO lqn21nfeMYBPGV7I4GYt02zeONrcVhFGJxE7Rd4YEB3qH54ShxoEezEHMZXN5zr6wqKp xXuoJ6EM9pP04tuk8ICgOyHiYXE9ORz1ezWzdw4Weo9NsswcWKOQORHyX6V05NP/7euE 90GaDeFm+AIR1Ib9yhd5eFC7LLGOfyRYbZBGVR8TthWDUuSfYgS8gcNnD2lMR5Xnxpkf dVOJEslDY8yb9SxBlhUqmnMgmq26xkzvcapZ0+J6SFLhtZ3DA5Ei3Tp6aBFt6gURN0kR 6W/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ncvAVe8q; 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 f7sor6348018pgk.37.2021.12.06.21.34.59 for (Google Transport Security); Mon, 06 Dec 2021 21:34:59 -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:a63:8ac8:: with SMTP id y191mr22494629pgd.438.1638855298259; Mon, 06 Dec 2021 21:34:58 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:ac1e:ca0f:5f0a:c85a]) by smtp.gmail.com with ESMTPSA id i2sm14699374pfg.90.2021.12.06.21.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Dec 2021 21:34:57 -0800 (PST) From: Jagan Teki To: linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH 2/2] drm: of: Lookup if child node is panel or bridge Date: Tue, 7 Dec 2021 11:04:45 +0530 Message-Id: <20211207053445.460387-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211207053445.460387-1-jagan@amarulasolutions.com> References: <20211207053445.460387-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=ncvAVe8q; 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>; }; }; 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);