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