From patchwork Mon Feb 27 17:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2760 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4C29C414AC for ; Mon, 27 Feb 2023 18:33:04 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id a23-20020a62bd17000000b0058db55a8d7asf3778426pff.21 for ; Mon, 27 Feb 2023 09:33:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677519183; cv=pass; d=google.com; s=arc-20160816; b=BYB1UCCD6X/saTVeC1GH3eJsMTb1cBKPrmkvOzhdvq5t8ctYOnYEWLjYT9QmpEcB3g rUcIJh0T1X55f/FrUGhtjrLqAuow8gvY70u7n4rinQac31Mug2iZFHf0hYzCsw428uPD 9hmXK9r6lyzU0zGMhIXvNwrJ27s6PoHFa27hQpg22DHl5mbPLHgtwYnC8/oesy2XMDU5 gALOH2HBcINk2xV4kMULNlqlUA761+qalp5aS5qXjF9TLGLou6DJlXgAhWYWj1uyqjcn oHcRrg41gzFJz/2ojdbe+i+CPvFiAMQ6x/uIFeE7mMcw6e70dqvXT3Jxaq2PoaJZxBE5 zykg== 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=uM+/RnmfhwZlYhT+Sm1zi9DynmZ+Dw6j7ChX038Sjss=; b=DvuUEEvHRy4/+3tTuRcF0D9tEvy8Pf2OncjOPV7qPKeNg1LuF9TUFEFuxJADZjb+GC uY/okArYK0zLP6QZaKsOtCSC0fTD77rDGA5g41mVtsznUBPPp6yOq0LdRS0Ms5q4QnyT kjWMPG3mafMmxDpI3WjFe2P4IwxeQZafkNyE5vqXl8SZCjVkaoHU4mINZmWCcQJdqBt2 WHM9Dcuy30ghEDJBb7ORAPWs29gsuZTRzOCf81vCzUV4cM8LiYvFYyMsmG3h4rLMX+9i QbpqHzgfBDxMal7HFJgsj1ZvoHARrSEzYQOMhPao2JTkVAoS66gX61vJWgfDjxaSpyDZ Qvbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SljLYax8; 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=uM+/RnmfhwZlYhT+Sm1zi9DynmZ+Dw6j7ChX038Sjss=; b=IQZB40vCWr9kZ/1TJMap4y+lEwc3UDa6pxONwFLiCDrSQr8Mq6kXcW+5RP6dR/x3sj 83OJ+/FHJ3db8Hxkj9myp/gLb8L07Q/n3kKqUQqOvg6VukCkzX+wUPBQaapLuTbTxDGf VYxyYEGZxaUsmBNvssAleMUaT1JssTZRvjkQw= 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=uM+/RnmfhwZlYhT+Sm1zi9DynmZ+Dw6j7ChX038Sjss=; b=2TmP8BUPvTTQeZw4VifanzyBXDbUvZy6hjhAiLZNy5H3w/Ek1/WPtxYkoz0OvVAraX oHutnzxUV846bIU6nkCUwBPXdmk5LFI7bheqDglvlq7eop+lk1xgJNAMxP0VBrM1g6Co Xfjh04Fa5fZNBCDeiVAU7qRKMLQQFMTxz244TPxiB4vMSpoZCUPxhZK9hNI+Oe2Ou+PM ZwafHF8nG2ysxUuefOSqpyUuuKOOSdrV5RK8S+b5mdOPmG0gPeOo5BYp+9rAt09WSoPi R/TdLYfEQ/S8HKqdZGmXmS3s+G69ZQsQIm1xQssxRMi/EBgLoh8BuqW1SCFrhomRc4QJ KJJA== X-Gm-Message-State: AO0yUKW8xTLdRwf0UXW0nAfUQv4jkm8xFgV3jjmhO+MV1KN/KFWf/CDm ndnnvbYdooTlVwekQ+Efkr0LL/pP7uEMMw== X-Google-Smtp-Source: AK7set8o8KUJTu4kkf1OQTE0gkrMqpm1Mi13w3CsCa05aMk6349z1352074HeiFUaugHSCNinD2Omw== X-Received: by 2002:aa7:848f:0:b0:590:3183:60eb with SMTP id u15-20020aa7848f000000b00590318360ebmr6053603pfn.3.1677519182990; Mon, 27 Feb 2023 09:33:02 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:6907:b0:19c:b3ca:f886 with SMTP id j7-20020a170902690700b0019cb3caf886ls11414810plk.4.-pod-prod-gmail; Mon, 27 Feb 2023 09:33:02 -0800 (PST) X-Received: by 2002:a17:90b:1d0a:b0:234:13a3:6e67 with SMTP id on10-20020a17090b1d0a00b0023413a36e67mr20181pjb.12.1677519181855; Mon, 27 Feb 2023 09:33:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677519181; cv=none; d=google.com; s=arc-20160816; b=MhL7SDRxmIR/y73AP2nzGxETQDvAL7cakBm7430huVUIr8/NGZlT5N4075yqyEI+jb ci2LAm1kq8YVFNPeyZwDMDHsKu3CPV/8QAMpbtFnhuYBF05nvNjkar5J7LjtK+d5YLor NvTBVj14L7tYSH9TkQhlkkgfmW9Q0FShKQg4F2yzHVaGBizE+/uHi351zRtnYCFs/3td 5ONRfaJbZe+coX3VX0qv8DCqRT80Qx1EOvVmG++HLEpzWuNncyxWulUyBoGZqW5cUkv+ E59JN3STMKGr0ZOGO+VucsTmYjcd4tXRtQMGr28pt6BvYn58GUuWdYK4si4sim4DcP46 ZQCg== 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=i/lQxEf2TtHUNWLWo3NazK/gJXKzS8+QxqszMeM4eHg=; b=vAEQ/CDLL7bqEFmVoCDDIrQNib2vciGmzb5CTSzsvEKlb36aE/uOd8rDksw30+dbC7 KClAcsumygI7kcvG33iSromMuh6/pWzdlDxSX9YlVOfi5NtLpyntDwXQMk3bbb7N2Nb7 RhtlMMlrcyZdfRndZcwQp+s+xWM7kiUqdBbnsNn+DtS2oRv8b9prY+SsAhag87nlEtdD ki7RJqb3EYWVSsU1K6RJ0T255EP0UJPYT+re5Ohe8Ydp6QGpFVWsiEWXkVp24Gs5E9/l 5MP4/qZGJ1YpZVxmBitN3FOzfIxDmN9CKquPEpmkjnmt1Ifd2zZVVIdkvs/yrNWm39x5 Yscg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SljLYax8; 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 x5-20020a17090a9dc500b002312511fd86sor3787354pjv.29.2023.02.27.09.33.01 for (Google Transport Security); Mon, 27 Feb 2023 09:33:01 -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:90b:3890:b0:233:f990:d646 with SMTP id mu16-20020a17090b389000b00233f990d646mr26900495pjb.35.1677519181209; Mon, 27 Feb 2023 09:33:01 -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.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 09:33:00 -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 2/3] drm: bridge: panel: Add drmm_panel_bridge_add_nodrm Date: Mon, 27 Feb 2023 23:02:30 +0530 Message-Id: <20230227173231.950107-2-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=SljLYax8; 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: , drmm_panel_bridge_add_nodrm is an another type of DRM-managed action helper with nodrm pointer. DRM pointer is required to perform DRM-managed action, - The conventional component-based drm bridges, the DRM pointer can access in component ops bind API. - The non-component-based bridges (like host DSI bridges), the DRM pointer can access only when a specific bridge has been found via bridge->dev. This drmm_panel_bridge_add_nodrm helper exclusively for the non-component-based bridges. Cc: Maxime Ripard Cc: Laurent Pinchart Cc: Linus Walleij Cc: Maarten Lankhorst Signed-off-by: Jagan Teki --- Changes for v14: - new patch drivers/gpu/drm/bridge/panel.c | 48 ++++++++++++++++++++++++++++------ include/drm/drm_bridge.h | 1 + 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index e8aae3cdc73d..d235a3843fcb 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -378,6 +378,22 @@ static void drmm_drm_panel_bridge_release(struct drm_device *drm, void *ptr) drm_panel_bridge_remove(bridge); } +static struct drm_bridge * +drmm_panel_bridge_add_action(struct drm_device *drm, struct drm_panel *panel, + struct drm_bridge *bridge) +{ + int ret; + + ret = drmm_add_action_or_reset(drm, drmm_drm_panel_bridge_release, + bridge); + if (ret) + return ERR_PTR(ret); + + bridge->pre_enable_prev_first = panel->prepare_prev_first; + + return bridge; +} + /** * drmm_panel_bridge_add - Creates a DRM-managed &drm_bridge and * &drm_connector that just calls the @@ -394,22 +410,38 @@ struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm, struct drm_panel *panel) { struct drm_bridge *bridge; - int ret; bridge = drm_panel_bridge_add_typed(panel, panel->connector_type); if (IS_ERR(bridge)) return bridge; - ret = drmm_add_action_or_reset(drm, drmm_drm_panel_bridge_release, - bridge); - if (ret) - return ERR_PTR(ret); + return drmm_panel_bridge_add_action(drm, panel, bridge); +} +EXPORT_SYMBOL(drmm_panel_bridge_add); - bridge->pre_enable_prev_first = panel->prepare_prev_first; +/** + * drmm_panel_bridge_add_nodrm - Creates a DRM-managed &drm_bridge and + * &drm_connector that just calls the + * appropriate functions from &drm_panel + * with no @dev. + * + * @panel: The drm_panel being wrapped. Must be non-NULL. + * + * This is the DRM-managed version of drm_panel_bridge_add() which + * automatically calls drm_panel_bridge_remove() when @dev is cleaned + * up. + */ +struct drm_bridge *drmm_panel_bridge_add_nodrm(struct drm_panel *panel) +{ + struct drm_bridge *bridge; - return bridge; + bridge = drm_panel_bridge_add_typed(panel, panel->connector_type); + if (IS_ERR(bridge)) + return bridge; + + return drmm_panel_bridge_add_action(bridge->dev, panel, bridge); } -EXPORT_SYMBOL(drmm_panel_bridge_add); +EXPORT_SYMBOL(drmm_panel_bridge_add_nodrm); /** * drm_panel_bridge_connector - return the connector for the panel bridge diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 42f86327b40a..acc118bab758 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -912,6 +912,7 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, u32 connector_type); struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm, struct drm_panel *panel); +struct drm_bridge *drmm_panel_bridge_add_nodrm(struct drm_panel *panel); struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge); #else static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge)