From patchwork Wed Mar 29 13:16:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2827 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 EE254414BB for ; Wed, 29 Mar 2023 15:18:01 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id 9-20020a630009000000b0051393797707sf162171pga.5 for ; Wed, 29 Mar 2023 06:18:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680095880; cv=pass; d=google.com; s=arc-20160816; b=OT/OIOaXkdb6Dy6z4AfDqh9KZrv1W3tEjebdZn9ER5L/T8M2PItvZxj1rzYOy8yyrN I/hOD61GnGBz8K/KIJvTKoQCXLJh6r3ZSVtyAHPreS8XX7sFEp6sATPD/j4lJu5HU8v7 RYTqIjDN9k0to/KCuVT//8CJL21v5zi+X0rKFlu6H8bn+3fCq60rtKEoz2xofj/KG5T6 RGBzJtR5uV3RUuoiM7FyLWnHU60uqQuxBrz1PWR29+aAD3kPSPP1tOKu/3mAvc4yiDlC x266WokIN9rHmXCK9nOOslCsTYOLxaJaROcbjKXsJna2rKWJYbs04OjsyrYdh9/EIB6Z 4jdQ== 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=axkRWJMsKTJPfMMd1Tk8SawIqreqLXOk3MdDwGtkvLY=; b=NEWx7ei3guUmzynOMwQUbtm7D4lQWfp/PUm8hWC5ENpm0riqyDO55tV3H/+WrqhuTm ysxGmijJEJ0YA++AoQCAkFPgsQS2YMHJoN9I/HejvpHNZ5XoDsR7JHimxjI2lXp7Racz rluhnng8ju6Q8TbXykPnJwpPwJzmTTXu7XFhlittaPahvRZCBwRNn1vhX/JCi002xgwc BirqBHjSfLdSt131otBbvlbWVdRYfWTrPdA1b2LdZsSCT4b8jlurkF8cSW7b/jwfzomS Ia/RBJN7rFQMF1UHv6Rc7/zYDXzzoEDrm/I0Hfs/YuRXhMup/hxOUg/MTljgzi9q2s3D 0S6A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cqidfaD6; 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; t=1680095880; 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=axkRWJMsKTJPfMMd1Tk8SawIqreqLXOk3MdDwGtkvLY=; b=WN9HW6heRJFKGKCCVfiKxTZo6OYL0Rrgr1DzkFt+4a8Hd5XjEvZfc/4UQjgPowtXXp 1TkjLF7x3B1WecVy1lnwlLppYPRvgm7rlLsvdrl4u+WuJQQ2JEWRt/xazOIRSEecKtgI EHtO1P3liJ8aPvU2uP7iA5X8WSnuS9zae3KPY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095880; 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=axkRWJMsKTJPfMMd1Tk8SawIqreqLXOk3MdDwGtkvLY=; b=zPIMw4YviiJZFzlDyS27TM+jysVSdDwoYW4MwZ2f6G1/Lo8ogKIcEl0czDCsvhZhWz a/C2atBFWq+j2ro7MOpNPs3FXQLtEeGPZ/6w4lJhsnH5AQiGUcWAZgtRcMP7UmtlGpXH 29YhFpbbLNYoz5XQYWWdq52nlxMQ/BGg4lEpjEnTgTJR3R0HX3qpw3L4IVb7dfuIMRkH j35jku59D4fPKmxqvevSq9xzvcy/yTIipkL8eVs5oDYDkCBFEDbrVlL8R9LE+OpFyLD5 SEY4r+hBzYZOHgQkYEHXHQkPik5izjGWlPUQgQMThFCL9Uot7C8EoG6jNcDzk59kwhG3 073g== X-Gm-Message-State: AAQBX9eeSmLJ6RnmksFtv3/3pDmRNgWI408Pmhz7ln+Cg4MlA/mW5o9w da7As1JsGggtT6+bHhFDyenwHt4e X-Google-Smtp-Source: AKy350ZBiFNnHoLO/rt4PQBeAmXTKc7nCfKobGNV50au6thLQtsQBkiqgqk3P1XB9YpiBae6Ipfx/w== X-Received: by 2002:a17:903:183:b0:1a0:4aa3:3a9a with SMTP id z3-20020a170903018300b001a04aa33a9amr7482011plg.2.1680095880703; Wed, 29 Mar 2023 06:18:00 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:4d8f:b0:234:2ef4:2e9 with SMTP id oj15-20020a17090b4d8f00b002342ef402e9ls2221767pjb.0.-pod-control-gmail; Wed, 29 Mar 2023 06:18:00 -0700 (PDT) X-Received: by 2002:a17:90b:4c10:b0:22c:816e:d67d with SMTP id na16-20020a17090b4c1000b0022c816ed67dmr21486706pjb.24.1680095879737; Wed, 29 Mar 2023 06:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680095879; cv=none; d=google.com; s=arc-20160816; b=EvwBnh2tps4bCOo1gOHD+uwy9vidBR6acr5WR3tvSyQc0aez5+dPKtwGlZGgG+1Boa GpzZr5Pm874bclxwU9+8NmJ0GQ9I31N8HR76JKcgZPN1Ca7tAiJ4uBLb7A1OYEze3AxL iTfC6sOjDGBPdhDa+9uk0BCx9nGuCJLUU+7SlKSLMNJCcsH01odIgY7c15OM5m4G8x4m buxlDTiNxA2L1dSLVgwGUdIaM6G2ainT7+ileWXQNvyQ0CrWr2vUZZXkxgFvTjbJvGKH WIczIYhGSuHPkBzPOyvJUHpjBlkeZ+DtdN4ADOIalT3oEeqE7BKDUvO94EEKj83rX5sV 2qwA== 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=0wNTb2LrxaKFlmHgalrnrr3A4EG008KaVwysZvYEb6Q=; b=oX7cDC4gGCR6PHlpSFR3CA/W+7rU93QZ7zrlIKCkYYRNvIEBy3gI/jaJTLyulDwWFu LfpQnhKLSFyZWm8Dgt0da6dlITcvzutbMoB/zfg6IjWbWRlPfwzYgy090aBQaxT4XDSP 0e5JlJ5nfNUiHRJnPyyj6D5mxC5pwziDpMURvjOJnsJgeYUTAUAiUMqazngC3/xAFezf Ka1FAxPLFEcBJSaqCCtK9paZiSfRu1QRxtmffSZ3GRSBnhkVL+rX89NxWJQ02CyrRRiN QJdicniwI1rufuQDhVHdM4r2GNHnQKTt24/wYWhAqM8w7eTySl8lWc70sOtk1FSDWxoC q6/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cqidfaD6; 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 h1-20020a17090ac38100b0022bf7fe90aesor789591pjt.31.2023.03.29.06.17.59 for (Google Transport Security); Wed, 29 Mar 2023 06:17:59 -0700 (PDT) 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:3511:b0:23f:a4da:1208 with SMTP id ls17-20020a17090b351100b0023fa4da1208mr21913619pjb.39.1680095879378; Wed, 29 Mar 2023 06:17:59 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:17:58 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 02/12] drm: bridge: panel: Implement drmm_of_dsi_get_bridge helper Date: Wed, 29 Mar 2023 18:46:08 +0530 Message-Id: <20230329131615.1328366-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-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=cqidfaD6; 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: , Implement a DRM-managed action helper that returns 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 downstream DSI device that has been added via child or OF-graph port or ports node. Upstream DSI looks for downstream devices using drm pointer, port and endpoint number. Downstream devices added via child node don't affect the port and endpoint number arguments. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/bridge/panel.c | 34 ++++++++++++++++++++++++++++++++++ include/drm/drm_bridge.h | 10 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index d4b112911a99..d047c7d9551d 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -501,4 +501,38 @@ 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 + * @drm: device to tie the bridge lifetime to + * @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 drm_device *drm, + 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(drm, 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 42f86327b40a..a1a31704b917 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -931,6 +931,9 @@ 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 drm_device *drm, + 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, @@ -947,6 +950,13 @@ 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 drm_device *drm, + struct device_node *node, + u32 port, u32 endpoint) +{ + return ERR_PTR(-ENODEV); +} #endif #endif