From patchwork Thu Jan 26 14:44:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2675 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5FF553F046 for ; Thu, 26 Jan 2023 15:45:17 +0100 (CET) Received: by mail-pg1-f197.google.com with SMTP id e184-20020a6369c1000000b0049de6cfcc40sf842851pgc.19 for ; Thu, 26 Jan 2023 06:45:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674744316; cv=pass; d=google.com; s=arc-20160816; b=hMwVVnJTQC49nC1/QY18Uv5lyizZDG2aebO1c2NQdYfu4pZnHFuFgNXTk69BxUwANw 2jvYuAU/LWfvGBpzk/idTfsPYdDcBOPAej/hzVcbniInByF0iZRZSapHhXJOhMZVeX0K E8S9l9XWuumpdsW9D6t/ky4fVTx6FrbBaz6VoFgtsT+hdJ27rlIoBUrVVniHUolO58D7 ZPWi/UoETE9+U+sJhy/w9KocfUNkKB3c5NVmXUcq5Tc7jhH4Z5piwXCs+/RMnxqJnhLN LHdZUkmrHZM4QooehvYA3YCzRldeWXvFn5mqKYPFWteofJr0Wg1mFwctsT7jrDudLgAS rJ7Q== 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=RxR1SasJ2PPHWQQNBML89qY6ba2+wWhbqGfHT3YzEzE=; b=1D/3GDkKX/AtasbdUNP/jXR/Ch4I+MSbDLO6XjUhl4fo1Hlyc7qaXGTweRsvymhtcZ ER6hsB8NjOVZ7e5ne/W2PTrVEfD9uG2Y9awjUHZOqxxhV5SWabRMzvHTt0TGwLLud6T+ +r4smRHbY3Qi3r0RdcIia57WC5uXHrKddTdzb1yAowmCclFKBy6KCmPJNp2AJPqHR9xh GIei2RHqEhAE6oD4CrIL11knteV6E77URrQNG6TFhbwwVjULtD/m0ECKRzg4FoYk7Tlq m9YtLoS+EC5VwnABW/E/QD9PXSR15y+G/wQSUrD8iq4II9vYCClrTftrJU/38OwcJqy5 IT9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NjLrpZiH; 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=RxR1SasJ2PPHWQQNBML89qY6ba2+wWhbqGfHT3YzEzE=; b=lbBA6FX3fmkUDN2jeaU2Kn9XYTzRjkf/qJpMsETksnZQhFWPjcCBFZeMIN3kPGwWlW 6sHMVFGkf4tFXmP6A3muEZ7gmLCN8iJyksCjtr0VDrpGRq3wHN/DDqdpLv7ue3UHkTiT ydxDNiS138HBa1E/+fvjgUMqgugg/dbza1Jbg= 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=RxR1SasJ2PPHWQQNBML89qY6ba2+wWhbqGfHT3YzEzE=; b=sHIHcYnECGvznGOM3XYafRZ+I8LrNWi4gB/nxSJjPRBGxOW1mZvrHv1auv8Iqi3rw+ Zh1pVPZotkxKNfO3FhAMglm7Q89mTZY3IZ+Q0TshW5ckweICK/tpbXAPvNT6PyR58td6 JAsrCImxCvrx1dosNIOjrLijqvxRlbaxalad922xJjIn4uiCUIcz/2LVRBoBL+GChMlk XW+3Yr5Y7VCtDsGNY0zy84Y0tm1okWx2OW8E7YpNd5n9bRKm+EIULmyy8WcWTs5GtLS5 x15ryH7cAEYf9c4TCsRXIlJEbPDo+/BBgiRdQcZKZ6Mhy6uCWHxwtgndFa7WBMeal/We ueww== X-Gm-Message-State: AO0yUKWphkV8RVgWoUBN0Tja8vXaCXYFEKEepbH/UL996o1HU1rLfVZf ymMUtL5qBsATu/dhVwgVTLyAJ6bs X-Google-Smtp-Source: AK7set9diDYUHLn27V+eMaHQ6LPH31O6aUHWLdTQ9w8kcLcn6DW1zFQuK+pZEDvRPVQSbodeAU9A/A== X-Received: by 2002:a17:902:70c2:b0:196:4e61:b6b5 with SMTP id l2-20020a17090270c200b001964e61b6b5mr4695plt.2.1674744316035; Thu, 26 Jan 2023 06:45:16 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:4a92:b0:226:e7:18f9 with SMTP id lp18-20020a17090b4a9200b0022600e718f9ls6366308pjb.0.-pod-canary-gmail; Thu, 26 Jan 2023 06:45:15 -0800 (PST) X-Received: by 2002:a17:902:d651:b0:194:bdcf:1ab8 with SMTP id y17-20020a170902d65100b00194bdcf1ab8mr28661366plh.37.1674744315149; Thu, 26 Jan 2023 06:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674744315; cv=none; d=google.com; s=arc-20160816; b=vLmdXCmOCzVINbZflB5QnHLmGcbGxFkn0uH+t8dFd2eUDeebgH21q1h5AO6A3lWQY4 HEQjxBbG9zwKto9KSUPEHO5znLqC4DXuMqy/Kf9PUgtgqlNoDC8+PtrzoeEG/YdGnV9t Upk7Pesz9sXTTt8hTr9Miidb+CWzgKJlf0r/oUtgwT4c4WHETTmWrjJ4mZtJbPkt2GGC LQ2Of9Zwe+zPHb9LBP6sTeZ/W7CDzEOfCMQL7/sr2KiIP4YuL1t99Dg26eC8AzLvZqdH uZvXzL29Ht1J+akOiM1FOzbfrXnzZCzF3CaErq1hHBHL9lCcP39vBqzyCT4GHX1byscZ eSUA== 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=BbuFui50T2yH9lXHDgl2DPCW0nuBgP82n9Kixz8u2B4=; b=qZXfkWOgSQXebVuFnK31OvCC+cpgeK/A2zHpDepPutuubQqs/e2BWbHBxc6GvN6Sb9 ffJmRw4d4brW5TrBZnJIcZWYlGPjR0tEOHREFjwTy/hiAjUZCU+U7d8fgSxG82NmqcTg jYMzV2PAYrCwU0MrrQqRJ7TvKhlJ0gq/6q7WzPhXiriisriRrwoXcUXmWJ2jDUkKetHg cG4i7Vm14d0EOI4uaEEE8rAAZVvUQgQS1ww7X8viDRpkckD9Ob6qj3bl3rVA4QjXfMCD S19debHerCLPfYngYc/pb7LR0N6SjeXpvaTjHaTMmj/7UIsXiLHc5BNrM6NFHsT/6Yab Hd1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NjLrpZiH; 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 w20-20020a1709027b9400b001964188e054sor693423pll.139.2023.01.26.06.45.15 for (Google Transport Security); Thu, 26 Jan 2023 06:45:15 -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:1611:b0:b4:6f9:ef7d with SMTP id l17-20020a056a20161100b000b406f9ef7dmr46784387pzj.35.1674744314855; Thu, 26 Jan 2023 06:45:14 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a238:3cb1:2156:ef87:8af5]) by smtp.gmail.com with ESMTPSA id d197-20020a6336ce000000b0042988a04bfdsm823660pga.9.2023.01.26.06.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:45:14 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Robert Foss , Laurent Pinchart , 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 v12 02/18] drm: bridge: panel: Add devm_drm_of_dsi_get_bridge helper Date: Thu, 26 Jan 2023 20:14:11 +0530 Message-Id: <20230126144427.607098-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126144427.607098-1-jagan@amarulasolutions.com> References: <20230126144427.607098-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=NjLrpZiH; 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 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 v12, v11: - none 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 e8aae3cdc73d..be281eb26356 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -499,4 +499,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,