From patchwork Wed Dec 14 12:58:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13073039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EE9FC46467 for ; Wed, 14 Dec 2022 13:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9fJqe3Gwuqz7fm/CWj+JE5TYq0EK6phKcUadpRvaylc=; b=WZqpzXQQhsj6c8 LQGM/DqYyEhvUzlfXhGRDri2kXx42ySpsppAzXWlzJQWr3zsCyqfpeN7+qXwoTKGTO5q+zC2qetfO it8QurRzomxmpHEewcx4L29355MYEW1jMbie6EWex+aa06CIcdf5fmfg6ziEzUBSbRwiSHP2H8hFJ zGhr/37F3BbVPfCaCs79JgLBqY+GcIJH2s4JzTXzGkFfiZRJHeug8swdWkwG14hNlGO/bF4ZOVakz t2KyXR+XNwSln1PiplZvWwpI+oozalA6PbyhFHulFq+zwVDiOhnnlp6k1muFf4PoozbiAQk+9W+Os orpInj3n2kqhvTskWp4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5RMj-00GVhA-Pa; Wed, 14 Dec 2022 13:00:05 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5RMQ-00GVXs-1D for linux-arm-kernel@lists.infradead.org; Wed, 14 Dec 2022 12:59:50 +0000 Received: by mail-pl1-x62b.google.com with SMTP id 4so3255765plj.3 for ; Wed, 14 Dec 2022 04:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j5Cg+w7Af9e5w0oCEb7RkXl27zloxkjJ1KXCIn5jcp0=; b=Gl9PUd97r12bghPzuO3DwOVtoeR//cS3eYfPq5zukWnHrnm9pdqGbEveENQeP6nm/L ywcxgX/UOUkZ0qcExi+xs9doH/iHhA51l4/o++XvR+N7yNbzogJp844lz94cwsx6hLka aI3xeMQvgHeU2Ej/KL6zXSyNbGxIv9Kb9KgGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=j5Cg+w7Af9e5w0oCEb7RkXl27zloxkjJ1KXCIn5jcp0=; b=PQbRiYJLVm6SfY2VwS9s5j7ASlOfhv7nI6evxCRb6DwzYS2yvUm5RQzwAzQ46JqFN6 xRYXY9oAwQOy1jiFizSKDbk33nWKB5lkFsRY4tP/38bkn27BkSmd87PZNn8ygJTL2nky JWeIGGN8TZ5gzHyb58uuUunnNPhkCbbTUG99rutQcxvL2NCxk4QaBEy1oP1+4weK9SqO b681K8YYlw4HXMkIDl9ozo32MEY94IEFumkVJ6xeSrM5PGmNUyEn6+17lXxuPFLDBJho BMiohND24+NdWCY5rAwmL5+UOj8LGphJMLEMMEr9UJp3gjwZ5t0mLx3mL7ZmBAYs12HM Fakg== X-Gm-Message-State: ANoB5pmlRdpW8wpU0jrt9oIV0x+li2NRve8ZheD3PgGWMtIoWygf5I6a 1KjGWDXZUbduToQtvRYZwd5D3g== X-Google-Smtp-Source: AA0mqf5M/fyXSrpL3RXH+H4YrpKX5HwB/Q3ekd51lJbt+qbKK+cXgsesXWRHUXC9gMA/8bFy2PTdbw== X-Received: by 2002:a17:903:189:b0:18c:1bc5:bd58 with SMTP id z9-20020a170903018900b0018c1bc5bd58mr39744815plg.9.1671022784870; Wed, 14 Dec 2022 04:59:44 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:5e03:faf:846e:352d]) by smtp.gmail.com with ESMTPSA id ix17-20020a170902f81100b001895f7c8a71sm1838651plb.97.2022.12.14.04.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 04:59:43 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki , Maxime Ripard , Linus Walleij , Maarten Lankhorst Subject: [PATCH v10 02/18] drm: bridge: panel: Add devm_drm_of_dsi_get_bridge helper Date: Wed, 14 Dec 2022 18:28:51 +0530 Message-Id: <20221214125907.376148-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214125907.376148-1-jagan@amarulasolutions.com> References: <20221214125907.376148-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221214_045946_133151_8636E583 X-CRM114-Status: GOOD ( 15.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add devm OF helper to return the next DSI bridge in the chain. Unlike general bridge return helper devm_drm_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 v10: - new patch drivers/gpu/drm/bridge/panel.c | 34 ++++++++++++++++++++++++++++++++++ include/drm/drm_bridge.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 03c3274dc3d9..50ea5de45197 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -496,4 +496,38 @@ struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, } EXPORT_SYMBOL(drmm_of_get_bridge); +/** + * devm_drm_of_dsi_get_bridge - Return next DSI bridge in the chain + * @dev: device to tie the bridge lifetime to + * @np: device tree node containing encoder output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * + * 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 a pointer to the bridge if successful, or an error pointer + * otherwise. + */ +struct drm_bridge *devm_drm_of_dsi_get_bridge(struct device *dev, + 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 = devm_drm_panel_bridge_add(dev, panel); + + return bridge; +} +EXPORT_SYMBOL(devm_drm_of_dsi_get_bridge); + #endif diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 42f86327b40a..ccb14e361d3f 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -931,6 +931,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 *devm_drm_of_dsi_get_bridge(struct device *dev, 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,