From patchwork Mon Feb 27 17:32:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2759 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 46326414AC for ; Mon, 27 Feb 2023 18:33:00 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id 202-20020a6218d3000000b005a89856900esf3729214pfy.14 for ; Mon, 27 Feb 2023 09:33:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677519179; cv=pass; d=google.com; s=arc-20160816; b=S2IGc3Y6G37farVXRcPVIFXApFuxlte6zOsLoII0n7li6e3yBC+ESkCCfsmTLs6wsV 0587YAIG307GS9VZ44SKUZa9PKr2EeumfvVGZGCSjToPs3Y2ywPlOVY9PEXZvPRGc7QE zbqySXM0caX2s2XFy+Dbqx3A47JPqKi0LPgJjOpn0BFCcVZdCytnHnD+LdWflKJyVdGo N4eiYHvZAm7zVZjM5AevNOetug6vhNZo4ZaPBLCdMCd/BkCo8SehBuIK3W824ibNO5I0 TANFxXIU7brxnN3tQU2YLjG+NyIam5d0sBPVRyFssnXZ8d/FnZXYR8w/WaKVqS5Yl5tD Uqbw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=H8A/zbZ70s0XxT47OzIKEN2Akmt1QZpCoHKxibnFNj0=; b=gaGAsxe4WM+6et4MHwu/kirHD13sPbdmLpBaAl30LBB80jloeUJ3zl4ezFXGU5KOq2 8jB7ckcGOjXz97cg5aBOXKzPpwIkjILcUiqNesKRJ3zxoOlySn5VsS2wyWAJJJraXuX4 mZHGB03C+7tyZlfCfBTpVLs0EJ0uRBhSWKhn/oaSu1VfU62sBDNio3vTRkTajESMdy7J UNbXY0rMtY1Rblill6GVHTgpvEWvQh7BPtz04SUo12JqBHfWopZMzM7WxcsRDPiRSMtb DfYogSrnVN27iPzhvWsGTvPgfC3KzFb6UcLYc1eLfhoQ5kNV2KTud2LF9EFM8hMCD29I qAKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FZHhI6h2; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=H8A/zbZ70s0XxT47OzIKEN2Akmt1QZpCoHKxibnFNj0=; b=n5HxNUZ+5N8/G19UuiR/70AaqV3U7pWLOJBdiy3Z/uoumkK6JlwmwBCnqkbDkpRcy3 hJmiTUPpL7MH7spdFpUJihZ55rps+50Jow0jLYsZcMeeKdfihgTPEQNB5qQYLsSoVIsF I/vTR5A1/WnmYmvLc4m8V9zMAqg1+Tz8bwihA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H8A/zbZ70s0XxT47OzIKEN2Akmt1QZpCoHKxibnFNj0=; b=btiuvZUdpSiWqBWeNgZOa+tT84x1y2k1QOquCjIIEIyqjZeaVDDAVgFvWSUt8XEhjz NqXd29Vcj9H5wkKQK/Enspz1hE4RIwJZTgSBrtxSRxFLX1X4Go5vEl5xWgS33IoqXbGO 1UIozzjSpzYxdWy9FzyOvFizi4OZIsCH41U2ewabPltRGRGqM6pILQprscwnwEQjk2pU HwjtS8p3ONUsoSLmOdam6RDQVwDlsMn+3x8+CmRHdsUQ70htGymHWxbRyMaI0b49LkL6 h4PG+C4ZXae/QUHZnrsv1h6HHqNoIVdS1X3GZqgN+P8HPtUE8fR8daaTILq00jvgbVNe HSOQ== X-Gm-Message-State: AO0yUKWPMZOWQJmKIR4waZnb7VEldYbjwm5yBQh2lK9TXNU09vQ6DaYN B6FWNXfyEJQHqq79ELhss+EvKZyD X-Google-Smtp-Source: AK7set8Xx1SQ48SqxgCUq/SOombixQiPnv83SbP+e6qFURmIeECb3M+PbSj6Rc01Fbc9QSoS/Zyyow== X-Received: by 2002:a17:90b:3c08:b0:235:1fb7:393c with SMTP id pb8-20020a17090b3c0800b002351fb7393cmr5506814pjb.1.1677519178919; Mon, 27 Feb 2023 09:32:58 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:224d:b0:233:cf4f:61f4 with SMTP id hk13-20020a17090b224d00b00233cf4f61f4ls15277863pjb.1.-pod-canary-gmail; Mon, 27 Feb 2023 09:32:58 -0800 (PST) X-Received: by 2002:a17:902:ceca:b0:19c:fa22:e98a with SMTP id d10-20020a170902ceca00b0019cfa22e98amr7365896plg.8.1677519177922; Mon, 27 Feb 2023 09:32:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677519177; cv=none; d=google.com; s=arc-20160816; b=y6iZFfnf/V2Bz6pFiIwc4+XCRyM9Wg5iC12OpTOLSJh/ViP94dyFBx7ETp4+EOXGUa SlbFgF23vtp2SEQvr0hfA1hmgdtrWmPDJVJTVeDzCgyruVJbsMP3qYgo+q2CK/dIQzUB 1ypKNKHmd6caBTyjEVdWXcwgSgLfrSsPMFNO3NwEBuDLV2nIX5okse9FRaQvDeNThBVC iedB1GzVoGG35Jg07BmIXAKMaGAoG9u5ywd/0UAi3twv/SwDmwWwh4Qhf2K7ChWnxZVU yQCqeiYQOP3Mon/irWvrOmwugyQMjr6rbXjsQRO8wykrz6SVU5voys2UqaZuVR1clT+W kzvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=H0PG1U4rnB+Ux7NI0bDnLcmfUpG6Dhmd6/T4JTeOSQk=; b=QPyNLQ/Ld6QZu0l3iZBv8bGJvhK+mQlYOAvyBw7N41X/mr/uBDQZCeVGbigmZoyNsR VlXQwOKL5/PCaAobGUkmEWPdW1VPbAn8binAXpsaxbRklYXRGiwszEHoTFO+Zte0I0rE 0TEXIdDh3LDBMLqDMUeRrOwmMB2WV1y9fp6oV98Rj+UhmkclCeclZwqqOWbVOYSanltT Ht9KLv+SDNRl/6zBt+pAhxFKhEd6oAMv5QgkqKm4RJxx3nSpkDY61f5/q73DL9B5Q5z+ d4ffKr3dicKyl+Xxsf8gdNCIw2L1WgXNuJBMt8we55Nw3IkK7LAj1OwRSmmDgK95i4rH Q+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FZHhI6h2; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 z15-20020a1709027e8f00b0019c91d0cc35sor3024777pla.174.2023.02.27.09.32.57 for (Google Transport Security); Mon, 27 Feb 2023 09:32:57 -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:a05:6a20:728c:b0:cc:ce95:7daf with SMTP id o12-20020a056a20728c00b000ccce957dafmr111718pzk.53.1677519177518; Mon, 27 Feb 2023 09:32:57 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a1ce:9be1:7461:c30:b70a]) by smtp.gmail.com with ESMTPSA id a63-20020a639042000000b004fbb48e3e5csm4308881pge.77.2023.02.27.09.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 09:32:56 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Maarten Lankhorst , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Marek Vasut Cc: dri-devel@lists.freedesktop.org, linux-amarula , Jagan Teki , Linus Walleij Subject: [PATCH v14 1/3] drm: of: Lookup if child node has DSI panel or bridge Date: Mon, 27 Feb 2023 23:02:29 +0530 Message-Id: <20230227173231.950107-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 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=FZHhI6h2; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Devices can also be child nodes when we also control that device through the upstream device (ie, MIPI-DCS for a MIPI-DSI device). Unlike the drm_of_find_panel_or_bridge helper it requires a special case to lookup a child node of the given parent that isn't either port or ports. Lookup for a child DSI node of the given parent that isn't either port or ports. If it is found then it will directly find the panel or bridge otherwise lookup for the child node with a given port and endpoint number as drm_of_find_panel_or_bridge does. Supporting this feature via existing drm_of_find_panel_or_bridge found several issues while handling usecases. Here is the previously failed attempt of similar and the same has been reverted later. commit <80253168dbfd> ("drm: of: Lookup if child node has panel or bridge") So, add a separate helper to handle this DSI use case. Example OF graph representation of DSI host, which has port but not has ports and has child panel node. dsi { compatible = "allwinner,sun6i-a31-mipi-dsi"; #address-cells = <1>; #size-cells = <0>; port { dsi_in_tcon0: endpoint { remote-endpoint = ; }; panel@0 { reg = <0>; }; }; Example OF graph representation of DSI host, which has ports but not has port and has child panel node. dsi { compatible = "samsung,exynos5433-mipi-dsi"; #address-cells = <1>; #size-cells = <0>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; dsi_to_mic: endpoint { remote-endpoint = <&mic_to_dsi>; }; }; }; panel@0 { reg = <0>; }; }; Example OF graph representation of DSI host, which has neither a port nor a ports but has child panel node. dsi0 { compatible = "ste,mcde-dsi"; #address-cells = <1>; #size-cells = <0>; panel@0 { reg = <0>; }; }; Cc: Maxime Ripard Cc: Laurent Pinchart Cc: Linus Walleij Cc: Maarten Lankhorst Signed-off-by: Jagan Teki --- Changes for v14, v13, v12: - none Changes for v11: - drop extra line Changes for v10: - new patch drivers/gpu/drm/drm_of.c | 112 ++++++++++++++++++++++++++++++++------- include/drm/drm_of.h | 12 +++++ 2 files changed, 104 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 7bbcb999bb75..e165951e3545 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -216,6 +216,35 @@ int drm_of_encoder_active_endpoint(struct device_node *node, } EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); +static int of_drm_find_panel_or_bridge(struct device_node *remote, + struct drm_panel **panel, + struct drm_bridge **bridge) +{ + int ret = -EPROBE_DEFER; + + if (panel) { + *panel = of_drm_find_panel(remote); + if (!IS_ERR(*panel)) + ret = 0; + else + *panel = NULL; + } + + /* No panel found yet, check for a bridge next. */ + if (bridge) { + if (ret) { + *bridge = of_drm_find_bridge(remote); + if (*bridge) + ret = 0; + } else { + *bridge = NULL; + } + } + + of_node_put(remote); + return ret; +} + /** * drm_of_find_panel_or_bridge - return connected panel or bridge device * @np: device tree node containing encoder output ports @@ -238,7 +267,6 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, struct drm_panel **panel, struct drm_bridge **bridge) { - int ret = -EPROBE_DEFER; struct device_node *remote; if (!panel && !bridge) @@ -259,30 +287,74 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, if (!remote) return -ENODEV; - if (panel) { - *panel = of_drm_find_panel(remote); - if (!IS_ERR(*panel)) - ret = 0; - else - *panel = NULL; - } + return of_drm_find_panel_or_bridge(remote, panel, bridge); +} +EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); - /* No panel found yet, check for a bridge next. */ - if (bridge) { - if (ret) { - *bridge = of_drm_find_bridge(remote); - if (*bridge) - ret = 0; - } else { - *bridge = NULL; - } +/** + * drm_of_dsi_find_panel_or_bridge - return connected DSI panel or bridge device + * @np: device tree node containing encoder output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * @panel: pointer to hold returned drm_panel + * @bridge: pointer to hold returned drm_bridge + * + * Lookup for a child DSI node of the given parent that isn't either port + * or ports. If it is found then it will directly find the panel or bridge + * otherwise lookup for the child node with a given port and endpoint number + * as drm_of_find_panel_or_bridge does. + * + * Lookup a given child DSI node or a DT node's port and endpoint number, + * find the connected node and return either the associated struct drm_panel + * or drm_bridge device. Either @panel or @bridge must not be NULL. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_dsi_find_panel_or_bridge(const struct device_node *np, + int port, int endpoint, + struct drm_panel **panel, + struct drm_bridge **bridge) +{ + struct device_node *remote; + + if (!panel && !bridge) + return -EINVAL; + if (panel) + *panel = NULL; + /** + * Devices can also be child nodes when we also control that device + * through the upstream device (ie, MIPI-DCS for a MIPI-DSI device). + * + * Lookup for a child node of the given parent that isn't either port + * or ports. + */ + for_each_available_child_of_node(np, remote) { + if (of_node_name_eq(remote, "port") || + of_node_name_eq(remote, "ports")) + continue; + + goto of_find_panel_or_bridge; } - of_node_put(remote); - return ret; + /* + * 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); + +of_find_panel_or_bridge: + if (!remote) + return -ENODEV; + + return of_drm_find_panel_or_bridge(remote, panel, bridge); } -EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); +EXPORT_SYMBOL_GPL(drm_of_dsi_find_panel_or_bridge); enum drm_of_lvds_pixels { DRM_OF_LVDS_EVEN = BIT(0), diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 10ab58c40746..7a97157c1fa0 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -47,6 +47,10 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, struct drm_bridge **bridge); +int drm_of_dsi_find_panel_or_bridge(const struct device_node *np, + int port, int endpoint, + struct drm_panel **panel, + struct drm_bridge **bridge); int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, const struct device_node *port2); int drm_of_lvds_get_data_mapping(const struct device_node *port); @@ -99,6 +103,14 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, return -EINVAL; } +static inline int drm_of_dsi_find_panel_or_bridge(const struct device_node *np, + int port, int endpoint, + struct drm_panel **panel, + struct drm_bridge **bridge) +{ + return -EINVAL; +} + static inline int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, const struct device_node *port2) From patchwork Mon Feb 27 17:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2760 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4C29C414AC for ; Mon, 27 Feb 2023 18:33:04 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id a23-20020a62bd17000000b0058db55a8d7asf3778426pff.21 for ; Mon, 27 Feb 2023 09:33:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677519183; cv=pass; d=google.com; s=arc-20160816; b=BYB1UCCD6X/saTVeC1GH3eJsMTb1cBKPrmkvOzhdvq5t8ctYOnYEWLjYT9QmpEcB3g rUcIJh0T1X55f/FrUGhtjrLqAuow8gvY70u7n4rinQac31Mug2iZFHf0hYzCsw428uPD 9hmXK9r6lyzU0zGMhIXvNwrJ27s6PoHFa27hQpg22DHl5mbPLHgtwYnC8/oesy2XMDU5 gALOH2HBcINk2xV4kMULNlqlUA761+qalp5aS5qXjF9TLGLou6DJlXgAhWYWj1uyqjcn oHcRrg41gzFJz/2ojdbe+i+CPvFiAMQ6x/uIFeE7mMcw6e70dqvXT3Jxaq2PoaJZxBE5 zykg== 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=uM+/RnmfhwZlYhT+Sm1zi9DynmZ+Dw6j7ChX038Sjss=; b=DvuUEEvHRy4/+3tTuRcF0D9tEvy8Pf2OncjOPV7qPKeNg1LuF9TUFEFuxJADZjb+GC uY/okArYK0zLP6QZaKsOtCSC0fTD77rDGA5g41mVtsznUBPPp6yOq0LdRS0Ms5q4QnyT kjWMPG3mafMmxDpI3WjFe2P4IwxeQZafkNyE5vqXl8SZCjVkaoHU4mINZmWCcQJdqBt2 WHM9Dcuy30ghEDJBb7ORAPWs29gsuZTRzOCf81vCzUV4cM8LiYvFYyMsmG3h4rLMX+9i QbpqHzgfBDxMal7HFJgsj1ZvoHARrSEzYQOMhPao2JTkVAoS66gX61vJWgfDjxaSpyDZ Qvbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SljLYax8; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=uM+/RnmfhwZlYhT+Sm1zi9DynmZ+Dw6j7ChX038Sjss=; b=IQZB40vCWr9kZ/1TJMap4y+lEwc3UDa6pxONwFLiCDrSQr8Mq6kXcW+5RP6dR/x3sj 83OJ+/FHJ3db8Hxkj9myp/gLb8L07Q/n3kKqUQqOvg6VukCkzX+wUPBQaapLuTbTxDGf VYxyYEGZxaUsmBNvssAleMUaT1JssTZRvjkQw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uM+/RnmfhwZlYhT+Sm1zi9DynmZ+Dw6j7ChX038Sjss=; b=2TmP8BUPvTTQeZw4VifanzyBXDbUvZy6hjhAiLZNy5H3w/Ek1/WPtxYkoz0OvVAraX oHutnzxUV846bIU6nkCUwBPXdmk5LFI7bheqDglvlq7eop+lk1xgJNAMxP0VBrM1g6Co Xfjh04Fa5fZNBCDeiVAU7qRKMLQQFMTxz244TPxiB4vMSpoZCUPxhZK9hNI+Oe2Ou+PM ZwafHF8nG2ysxUuefOSqpyUuuKOOSdrV5RK8S+b5mdOPmG0gPeOo5BYp+9rAt09WSoPi R/TdLYfEQ/S8HKqdZGmXmS3s+G69ZQsQIm1xQssxRMi/EBgLoh8BuqW1SCFrhomRc4QJ KJJA== X-Gm-Message-State: AO0yUKW8xTLdRwf0UXW0nAfUQv4jkm8xFgV3jjmhO+MV1KN/KFWf/CDm ndnnvbYdooTlVwekQ+Efkr0LL/pP7uEMMw== X-Google-Smtp-Source: AK7set8o8KUJTu4kkf1OQTE0gkrMqpm1Mi13w3CsCa05aMk6349z1352074HeiFUaugHSCNinD2Omw== X-Received: by 2002:aa7:848f:0:b0:590:3183:60eb with SMTP id u15-20020aa7848f000000b00590318360ebmr6053603pfn.3.1677519182990; Mon, 27 Feb 2023 09:33:02 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:6907:b0:19c:b3ca:f886 with SMTP id j7-20020a170902690700b0019cb3caf886ls11414810plk.4.-pod-prod-gmail; Mon, 27 Feb 2023 09:33:02 -0800 (PST) X-Received: by 2002:a17:90b:1d0a:b0:234:13a3:6e67 with SMTP id on10-20020a17090b1d0a00b0023413a36e67mr20181pjb.12.1677519181855; Mon, 27 Feb 2023 09:33:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677519181; cv=none; d=google.com; s=arc-20160816; b=MhL7SDRxmIR/y73AP2nzGxETQDvAL7cakBm7430huVUIr8/NGZlT5N4075yqyEI+jb ci2LAm1kq8YVFNPeyZwDMDHsKu3CPV/8QAMpbtFnhuYBF05nvNjkar5J7LjtK+d5YLor NvTBVj14L7tYSH9TkQhlkkgfmW9Q0FShKQg4F2yzHVaGBizE+/uHi351zRtnYCFs/3td 5ONRfaJbZe+coX3VX0qv8DCqRT80Qx1EOvVmG++HLEpzWuNncyxWulUyBoGZqW5cUkv+ E59JN3STMKGr0ZOGO+VucsTmYjcd4tXRtQMGr28pt6BvYn58GUuWdYK4si4sim4DcP46 ZQCg== 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=i/lQxEf2TtHUNWLWo3NazK/gJXKzS8+QxqszMeM4eHg=; b=vAEQ/CDLL7bqEFmVoCDDIrQNib2vciGmzb5CTSzsvEKlb36aE/uOd8rDksw30+dbC7 KClAcsumygI7kcvG33iSromMuh6/pWzdlDxSX9YlVOfi5NtLpyntDwXQMk3bbb7N2Nb7 RhtlMMlrcyZdfRndZcwQp+s+xWM7kiUqdBbnsNn+DtS2oRv8b9prY+SsAhag87nlEtdD ki7RJqb3EYWVSsU1K6RJ0T255EP0UJPYT+re5Ohe8Ydp6QGpFVWsiEWXkVp24Gs5E9/l 5MP4/qZGJ1YpZVxmBitN3FOzfIxDmN9CKquPEpmkjnmt1Ifd2zZVVIdkvs/yrNWm39x5 Yscg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SljLYax8; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 x5-20020a17090a9dc500b002312511fd86sor3787354pjv.29.2023.02.27.09.33.01 for (Google Transport Security); Mon, 27 Feb 2023 09:33:01 -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:90b:3890:b0:233:f990:d646 with SMTP id mu16-20020a17090b389000b00233f990d646mr26900495pjb.35.1677519181209; Mon, 27 Feb 2023 09:33:01 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a1ce:9be1:7461:c30:b70a]) by smtp.gmail.com with ESMTPSA id a63-20020a639042000000b004fbb48e3e5csm4308881pge.77.2023.02.27.09.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 09:33:00 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Maarten Lankhorst , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Marek Vasut Cc: dri-devel@lists.freedesktop.org, linux-amarula , Jagan Teki , Linus Walleij Subject: [PATCH v14 2/3] drm: bridge: panel: Add drmm_panel_bridge_add_nodrm Date: Mon, 27 Feb 2023 23:02:30 +0530 Message-Id: <20230227173231.950107-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227173231.950107-1-jagan@amarulasolutions.com> References: <20230227173231.950107-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=SljLYax8; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , drmm_panel_bridge_add_nodrm is an another type of DRM-managed action helper with nodrm pointer. DRM pointer is required to perform DRM-managed action, - The conventional component-based drm bridges, the DRM pointer can access in component ops bind API. - The non-component-based bridges (like host DSI bridges), the DRM pointer can access only when a specific bridge has been found via bridge->dev. This drmm_panel_bridge_add_nodrm helper exclusively for the non-component-based bridges. Cc: Maxime Ripard Cc: Laurent Pinchart Cc: Linus Walleij Cc: Maarten Lankhorst Signed-off-by: Jagan Teki --- Changes for v14: - new patch drivers/gpu/drm/bridge/panel.c | 48 ++++++++++++++++++++++++++++------ include/drm/drm_bridge.h | 1 + 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index e8aae3cdc73d..d235a3843fcb 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -378,6 +378,22 @@ static void drmm_drm_panel_bridge_release(struct drm_device *drm, void *ptr) drm_panel_bridge_remove(bridge); } +static struct drm_bridge * +drmm_panel_bridge_add_action(struct drm_device *drm, struct drm_panel *panel, + struct drm_bridge *bridge) +{ + int ret; + + ret = drmm_add_action_or_reset(drm, drmm_drm_panel_bridge_release, + bridge); + if (ret) + return ERR_PTR(ret); + + bridge->pre_enable_prev_first = panel->prepare_prev_first; + + return bridge; +} + /** * drmm_panel_bridge_add - Creates a DRM-managed &drm_bridge and * &drm_connector that just calls the @@ -394,22 +410,38 @@ struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm, struct drm_panel *panel) { struct drm_bridge *bridge; - int ret; bridge = drm_panel_bridge_add_typed(panel, panel->connector_type); if (IS_ERR(bridge)) return bridge; - ret = drmm_add_action_or_reset(drm, drmm_drm_panel_bridge_release, - bridge); - if (ret) - return ERR_PTR(ret); + return drmm_panel_bridge_add_action(drm, panel, bridge); +} +EXPORT_SYMBOL(drmm_panel_bridge_add); - bridge->pre_enable_prev_first = panel->prepare_prev_first; +/** + * drmm_panel_bridge_add_nodrm - Creates a DRM-managed &drm_bridge and + * &drm_connector that just calls the + * appropriate functions from &drm_panel + * with no @dev. + * + * @panel: The drm_panel being wrapped. Must be non-NULL. + * + * This is the DRM-managed version of drm_panel_bridge_add() which + * automatically calls drm_panel_bridge_remove() when @dev is cleaned + * up. + */ +struct drm_bridge *drmm_panel_bridge_add_nodrm(struct drm_panel *panel) +{ + struct drm_bridge *bridge; - return bridge; + bridge = drm_panel_bridge_add_typed(panel, panel->connector_type); + if (IS_ERR(bridge)) + return bridge; + + return drmm_panel_bridge_add_action(bridge->dev, panel, bridge); } -EXPORT_SYMBOL(drmm_panel_bridge_add); +EXPORT_SYMBOL(drmm_panel_bridge_add_nodrm); /** * drm_panel_bridge_connector - return the connector for the panel bridge diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 42f86327b40a..acc118bab758 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -912,6 +912,7 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, u32 connector_type); struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm, struct drm_panel *panel); +struct drm_bridge *drmm_panel_bridge_add_nodrm(struct drm_panel *panel); struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge); #else static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge) From patchwork Mon Feb 27 17:32:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2761 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 2A229414AC for ; Mon, 27 Feb 2023 18:33:08 +0100 (CET) Received: by mail-pg1-f200.google.com with SMTP id 79-20020a630452000000b005030840e570sf2163174pge.9 for ; Mon, 27 Feb 2023 09:33:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677519187; cv=pass; d=google.com; s=arc-20160816; b=YhGM/ShBi+yIDocCeNfMlpsIXpHhXATC9jED3mnEWWvXxYq+HLsCDguQ9hGPz5duKc gEf4mAnMBtQBCW+bV8JKfFNgPgIAiSEsLvkhzI4H6Y3dhrOFE4i/0m5lx9Jc7S7eRHaV igWIPDQNuDICVZCQS11sItGi8vASBTXzWFfpN3D66zbqBzY2E5FopLKiChby/FrLfkvZ FEuXCGL+rI6yLPVqTYYnBbTZQaedQOdeuDgeIRX4Vi1XOTBYgr+IQfViiMmzDCYQStsy zsXlrnYyLtQ2XNYGU/UT3WfrpkCylp4ZNa62KpkjHkI8vvwozqJgO1+mMaJK2I+4owiG 3dTg== 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=sS2YKpQMIFiC4LtpAoqwfM8HaM6dsVm7KXnswIvXRnc=; b=qoj01z22S/gESi0m1ymVLG8JMkmoT2a6391RJ+PDPH/tOm/gZCmONRKRLnkad++oUN 3+pqswxYW3Vk8u+H0e+R+mHMfLrog+g3bxFmNf53WXncI7ElRBFbnfKZ7vuQT74+IMt5 tAvCMxdcTaKJdebc01xhOkv4xmOhNta+zzEKDUqIgQXROjjKAgsrGsNjU/2KS+Ue6VZB AiaOmxuyhc+NzVqNZz5RloiDKGr2Tz/zDSSa3gSm8pZZrNDfgFssmTaJwe2H9JaTpqOh ofUxdgyMEy+yfBI4caXyxztce/zzL0xZjPeHFTM3JWvFpToBLOxi+72tsKOza7TjRbZ1 lOPw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=l8z0K8RF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=sS2YKpQMIFiC4LtpAoqwfM8HaM6dsVm7KXnswIvXRnc=; b=km9vZHGNs4kXDJVwGYpefKSzKbiTJimLcNgdMMmDPu8YYIuqbpg0K4YV1zmKvHcngp y5GbUAgRf1AHPGXQXtfhFVyPO3rWclwAJCLc8Sb+Kr/6T+VhQPVg/ZSFv8yB2a1bwMpv F3Thk+FhGmiw7F2xg21r3XzqsI6B6HAGPRMh4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sS2YKpQMIFiC4LtpAoqwfM8HaM6dsVm7KXnswIvXRnc=; b=6a9xryQ0plIy4sCyzq12P3NL9jG07SVlPAoz8xmc4qSHcB+pem0psB+88neuqKPc8N u15prjdTT/F5N/vVvK4oSdj3HFDLBzOUKbtBQ+VSqSGH+qIUGGm+/W9ZSH7s/tzsBLeN xqMiWxlkJdWAOV2BrI9OYFmXrwf6rBQuExyilZ7Fvu4hLSW3Gr+LbvBJhSsNahGJ6DYN lx5U+E6YNdeVDgiM1r6QPDRYZ8tA8UgwiL0JAy7/VgW7bA6kpUwRKyAt3A/qkjIi685S aJrGIYMtl1BDddOmo0RxmmPINyZpmmiOnv/6PIu9UD7JXVsnwRATfHiiE+DMt9Jasv1x c1GQ== X-Gm-Message-State: AO0yUKWE5CKGyvfw/pfLHqXJBarND9ftQ2QjRwP+xcamdZiXkiAjI1PD ABuadYfxvN3Zm1uCCBFy1BKjTnXK X-Google-Smtp-Source: AK7set99/Tmk1bNhNpciGZduXxEheGXzGoeUaCNOicHj/eo94ausnU5KqpYhyavseQsc9BXs/UnXkg== X-Received: by 2002:a17:902:a3cd:b0:19a:82a2:fcf9 with SMTP id q13-20020a170902a3cd00b0019a82a2fcf9mr6308633plb.2.1677519186808; Mon, 27 Feb 2023 09:33:06 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:f542:b0:199:182b:34bf with SMTP id h2-20020a170902f54200b00199182b34bfls11421549plf.3.-pod-prod-gmail; Mon, 27 Feb 2023 09:33:06 -0800 (PST) X-Received: by 2002:a17:903:124c:b0:19c:a5dd:fadb with SMTP id u12-20020a170903124c00b0019ca5ddfadbmr23288101plh.54.1677519185878; Mon, 27 Feb 2023 09:33:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677519185; cv=none; d=google.com; s=arc-20160816; b=hXbr2stxn+uI4Vl9UIOs7/g5IbhhXaEp/hFyR0e181ihunH3oIoSqqbW5l5OCkzH3V Z/Lr/NlKhCURp/XqZDrjmk+X95+fKqef6evOTeGUfLhM1yLEIk2URCzAWn4Wn7ljI5y7 wKwvLtOXq9a9CzAIF2gLiGRhGzcKyrI21Nh8Gozx5wKQ6Mbw5BlotdnVqYfEltypQQgT NNRFzvmy27i28o96LX8cJKmFJeACDf+EDhhwrd+B32E9ZsFskUb4VoEle6DIHoDD3844 xWkP26Nw4MQK0XVAsO1rQ8knewsJ6u4lQTa+C2gvjCIe018Bbxe0e5HopTQ3ZQtmYUKH H36w== 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=OTJItNP0wwoi0zfE13wa5cJIG6qrtf4/sDgikbyAPqk=; b=MPdBrQkDLEVdonRGv5UY3KUYJ59gGCJUEVXvtvsKuszZJfl2s0nHr2nfgkPFMw4EYS RMQFYl77OHZfCftsVw7Ebj5QbKX6ov8K/YdyiRqUQ3rLjDejqpwSLQADuoeQBi+DODY4 2V9JhzF4Jvp2beZ0U8g7lrTkzOR7mv7i19MRRc2nldG74sOJ3Ulh9iuSP2VKTpQm/BHj rWPMhLyv8Zl3Tfd80An1vPD1kJaiK0Xs+MeN0igNo8v5Fy6cMxWwREhV+JhLK4LLuwjA ujYVeUO8RqDBorJ0ot9ZNvj6jVH5fncakjOiYhkEnn7kBu9VgBG9W0L18C/SVqHSe7Ec nZXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=l8z0K8RF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 s18-20020a170902b19200b0019aaba5c907sor2585771plr.53.2023.02.27.09.33.05 for (Google Transport Security); Mon, 27 Feb 2023 09:33:05 -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:a05:6a20:b062:b0:cc:f047:afaf with SMTP id dx34-20020a056a20b06200b000ccf047afafmr240390pzb.11.1677519185500; Mon, 27 Feb 2023 09:33:05 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a1ce:9be1:7461:c30:b70a]) by smtp.gmail.com with ESMTPSA id a63-20020a639042000000b004fbb48e3e5csm4308881pge.77.2023.02.27.09.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 09:33:04 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Maarten Lankhorst , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Marek Vasut Cc: dri-devel@lists.freedesktop.org, linux-amarula , Jagan Teki , Linus Walleij Subject: [PATCH v14 3/3] drm: bridge: panel: Add drmm_of_dsi_get_bridge helper Date: Mon, 27 Feb 2023 23:02:31 +0530 Message-Id: <20230227173231.950107-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227173231.950107-1-jagan@amarulasolutions.com> References: <20230227173231.950107-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=l8z0K8RF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Add devm OF helper to return the next DSI bridge in the chain. Unlike general bridge return helper drmm_of_get_bridge, this helper uses the dsi specific panel_or_bridge helper to find the next DSI device in the pipeline. Helper lookup a given child DSI node or a DT node's port and endpoint number, find the connected node and return either the associated struct drm_panel or drm_bridge device. Cc: Maxime Ripard Cc: Laurent Pinchart Cc: Linus Walleij Cc: Maarten Lankhorst Signed-off-by: Jagan Teki --- Changes for v14: - add drmm_of_dsi_get_bridge Changes for v13, v12, v11: - none Changes for v10: - new patch drivers/gpu/drm/bridge/panel.c | 32 ++++++++++++++++++++++++++++++++ include/drm/drm_bridge.h | 8 ++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index d235a3843fcb..92fc7143a249 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -531,4 +531,36 @@ struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, } EXPORT_SYMBOL(drmm_of_get_bridge); +/** + * drmm_of_dsi_get_bridge - Return next DSI bridge in the chain + * @np: device tree node containing DSI output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * + * Given a DT node's port and endpoint number, finds the connected node + * and returns the associated DSI bridge if any, or creates and returns + * a DSI panel bridge instance if a panel is connected. + * + * Returns a drmm managed pointer to the DSI bridge if successful, or + * an error pointer otherwise. + */ +struct drm_bridge *drmm_of_dsi_get_bridge(struct device_node *np, + u32 port, u32 endpoint) +{ + struct drm_bridge *bridge; + struct drm_panel *panel; + int ret; + + ret = drm_of_dsi_find_panel_or_bridge(np, port, endpoint, + &panel, &bridge); + if (ret) + return ERR_PTR(ret); + + if (panel) + bridge = drmm_panel_bridge_add_nodrm(panel); + + return bridge; +} +EXPORT_SYMBOL(drmm_of_dsi_get_bridge); + #endif diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index acc118bab758..a88391cf64b8 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -932,6 +932,8 @@ struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node u32 port, u32 endpoint); struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, struct device_node *node, u32 port, u32 endpoint); +struct drm_bridge *drmm_of_dsi_get_bridge(struct device_node *node, + u32 port, u32 endpoint); #else static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node *node, @@ -948,6 +950,12 @@ static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, { return ERR_PTR(-ENODEV); } + +static inline struct drm_bridge * +drmm_of_dsi_get_bridge(struct device_node *node, u32 port, u32 endpoint) +{ + return ERR_PTR(-ENODEV); +} #endif #endif