From patchwork Mon Jan 23 12:23:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2637 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3EAC63F039 for ; Mon, 23 Jan 2023 13:23:53 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id ca13-20020a17090af30d00b00229ed7b1c82sf4314702pjb.4 for ; Mon, 23 Jan 2023 04:23:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674476632; cv=pass; d=google.com; s=arc-20160816; b=0GyrI5/+H4ORrc3zk8SOnUMZhO6pfNYZyArQPstTVUx35C/STm6YiJVLPXZiCuuvW+ jiAMnFeqrP+kK59R3lFD0nIgBMC7KyetHz8tk9463d741+Y78F1pUV1jJMGCuTJcJOfA sta49arz4iY3S20d+bW0aTuu/uVgxh+s04yov6f5hSNFwBS188WAr0GJAvfd8703jDqX B41JimRDuvKr0OWgeUILDEUCZ50laPtOrpsCgJ3dfKg+P4Oj5HDzOyM2MpPOeYoxtSTi TbQbM2j/D24zxROJVOOExLYejMYWLFJsnT69ZWE2EoEMi9YHBurJhKs+dFacIbqe0cRA gu9Q== 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=jwuk9rSWQ8k8RLMJbV9PvQBNt+q4cA55Uql6eCk+MiI=; b=ILl1WB9uHZvxSF3kx1e5zDH5Un2KxSQR1tRbGCt04hFt4RT23JipqTGcuwaXQFMV5t jShyw3uGP2oP7Wi8PJO8xvOvGlYi9pPnjr0MADr61YeRuthGc02fQnJq/Aey6TsHNF0o nTtIvDu1Ffx5jjVhx7Lw2T1z4/lBMyFkW22nGBqvfgWF+QUFdzrwcBl8EVn2rTToaA/k mFUodVBPJ9VxMVI2xp48hcK5X+o+WVig8JLum/lONVUSuPHbePx29D7HVFs/DNaWx1nX wBkU9iRbVXLFP8dsGAm1dtAIkDx1Blz2vzdTQzgGljdDMpU1nyOSSUXKxwEYT/xZEMMU XR0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=PqkuNaJe; 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=jwuk9rSWQ8k8RLMJbV9PvQBNt+q4cA55Uql6eCk+MiI=; b=aB2qi0CymMgzD8fmIS4fgfqS0wFhc8Uf7buzT/iDXyM/KzmoeF39EF7qQp4e11cfnN w2gVJb0p7YwjZUtZkhBRGWflXewKn+qCbBHPvGcjspQSiKEkRzlYJ5+fjKYlD+VCyLDb AxXyjcx2rLYcZbuvSzCBJCLyN6/1JSJF13sNs= 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=jwuk9rSWQ8k8RLMJbV9PvQBNt+q4cA55Uql6eCk+MiI=; b=g7UN3O+8hrGnZYP7f5dg6IrP8tFw07Z6vHlw5bZk/8yvNhYr1/i89EUWbTnSGzZ2UI qOqE9DS+IiOhBanbdByzfDVU+/wxlsSCWng2kQM/lSQuFL7IlRr6IazpLZ6z38euDbmo zoFJ3f1xitBnFO5QHwo0cwghADVV4vp2qZAHnnvfPXBtVJb7s4ep788q9JqPdkRezxu5 JHBgulcwPNweveesnfQKUa3tHOESZbadBx38ZLZW6Z3D12gtRBdGearsIIHWF7Kv2NVV e+ARkh+Ej6uJe7/9w0d/ePnQ+W0hJEEW/q7kFEGcqRKxDKNncZ+ysXvj8V7ys3e8YQNg ILvQ== X-Gm-Message-State: AFqh2kp0oUX2A5Rfx/MfVrkneDDs3ve275XGWG57vePiSNEx2XeJz5FE bGuUL6X0iVEEuqctHMuRyDXzABas X-Google-Smtp-Source: AMrXdXu1Co9fAwO9SqOfBJYRErrl9bMSjJiFOR347beXXWMCYYcNvAJAbsdahh+8A/VLEyADzjGaQA== X-Received: by 2002:a17:90a:640d:b0:227:2469:27ed with SMTP id g13-20020a17090a640d00b00227246927edmr3099486pjj.140.1674476631948; Mon, 23 Jan 2023 04:23:51 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:d507:b0:22b:b830:313 with SMTP id t7-20020a17090ad50700b0022bb8300313ls8130855pju.3.-pod-control-gmail; Mon, 23 Jan 2023 04:23:51 -0800 (PST) X-Received: by 2002:a17:902:ce0b:b0:194:586a:77ba with SMTP id k11-20020a170902ce0b00b00194586a77bamr28239109plg.52.1674476631081; Mon, 23 Jan 2023 04:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674476631; cv=none; d=google.com; s=arc-20160816; b=gEj0ClvnmYESyu1uRh0+zvj7LayIFB2YxnXDxsqVJERbS9L2CALoYsRdnSo3LFhfxt Ip/FlS+35kEqLJxApU55+o4OBW07LXNB/fQB1iyKb/94dZcPT/n77wNFziLA88NHHoBR c2OjdXhRlpdiLKSVwD49tqt9UkGo8nM6Ot6iFiKQiuCAtxoGpbGoujoUsmMMB7NKjh3L qDgBdegIdnS87LUDqfeQn0BRHjoHgKfEcg/vXjb/xBJAcIwH01/N+Q9wCgqeDa4G3zJq K3AOUkA0kQ/NlaZ1gynEEP6aV6s+e6xIq/hgZPvkE5LGD0NRwJgeAgr/vSx6jX95wjBb VZGA== 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=tSTOOV1UI3u7LdjXOPnQjVzALAHz+1al5IvaQmAe3co=; b=u2/NkKveTo7j0Ouw9Z9hkP/xqt2lZKE5NXICzrVDogVy8IOhhnPEXjtCisV4YbJ0tW WYCpd1yEjqjHNtQcRfV3ugJgiUnSbuTZiVSnXwmX8CxhsQw2eAEkzORM4tDrSy47uHCo zkaAlwflffKmdH0U6UfUpwZ1Pgx82S2UQaL66eA5viRuMx1tY3rjpX2sgNiWb1ETAhXE /C82TyyJ44bZH9PSKWKsST4nkW8AY03hejZl7OfReLztiJqarUQ4U+Eu6WN1zn1xAqid JVqD44j2uHEjF25fbqoOKBQQBWOopYB8/8zwLRbdqM2AiNlYFKBPykjjOcfxw4qndmjI SkDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=PqkuNaJe; 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 q9-20020a170902bd8900b00195fe5a566csor1509212pls.97.2023.01.23.04.23.51 for (Google Transport Security); Mon, 23 Jan 2023 04:23:51 -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:902:da90:b0:194:43e2:dcd9 with SMTP id j16-20020a170902da9000b0019443e2dcd9mr34549302plx.2.1674476630792; Mon, 23 Jan 2023 04:23:50 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id w10-20020a170902e88a00b001960806728asm1291811plg.88.2023.01.23.04.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 04:23:50 -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 v11 02/18] drm: bridge: panel: Add devm_drm_of_dsi_get_bridge helper Date: Mon, 23 Jan 2023 17:53:03 +0530 Message-Id: <20230123122319.261341-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123122319.261341-1-jagan@amarulasolutions.com> References: <20230123122319.261341-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=PqkuNaJe; 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 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,