From patchwork Mon Oct 2 09:34:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9980543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01EAA602A0 for ; Mon, 2 Oct 2017 09:35:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87C927F8F for ; Mon, 2 Oct 2017 09:35:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD43528920; Mon, 2 Oct 2017 09:35:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 700F727F8F for ; Mon, 2 Oct 2017 09:35:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1764D6E2F0; Mon, 2 Oct 2017 09:35:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x229.google.com (mail-wr0-x229.google.com [IPv6:2a00:1450:400c:c0c::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64AAE6E2F0 for ; Mon, 2 Oct 2017 09:35:17 +0000 (UTC) Received: by mail-wr0-x229.google.com with SMTP id u5so3262758wrc.5 for ; Mon, 02 Oct 2017 02:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=aDoYHb9nNzhm3glJHkaoKnePiq7HmxvpjV+doWC5ujY=; b=Uooo1pZh8xEZ+F0Bjlq/YVPsZudTnWblxrK/03JAN4venlhz8UaM9Y/fhJmZYXhjUi I9aau2M//vL1HpioN1fO7DUvjCvDmjuB5MT0fN/D+SrDqcf0TXU4ADPdew6cMFyeAnnr nnxzmdv6DIx3bqGAWRPb2eMBLtqKaQlzWQeX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aDoYHb9nNzhm3glJHkaoKnePiq7HmxvpjV+doWC5ujY=; b=Wxav+kLJZQCVbldPkDlFugxccbeoI2YZV5F1+xyyX2Q8uyv8cL6kCejyIhvYqhjakD S5Znh2txj1QQlvTWjqXLqTBkHl9rQo3afh703HFR4ZerDoHkwBitLW3wocVBERwzDIVB sLdCLw+l7AOXD4wyYoKaA9FtmWWY3egbtaT005egIyDAW4C0DpNI2Pxi4pNFycsE1Eor KCnjLCXAuR1mn3BkOjpQNoOtNhfCI0Z6SVVgaS2fgQ3zvdh7qkkJkQLfcZ+ZnfsJsAql I1yQ81LkgrFLYmPKDq4nWlfcH97FT37UNDG1DNt7yVgCPuk8qVcFos2T1g3ZXKbVaYJN orfA== X-Gm-Message-State: AHPjjUhYH3LuMsSHWlgTtm8TukN4nRbCeKl7aha23L1Y2O9AVSA28Ew8 V8gfVaBt1A57hu6Cubc2Gmb+JLXEGPw= X-Google-Smtp-Source: AOwi7QAb6p2Xyn1pHEwXx2qHHiACRJSZ2NQApCA8CfsZ28ry5+D3yx6pWwuhA9OleAMnQE0P1Fn89Q== X-Received: by 10.223.152.132 with SMTP id w4mr13479733wrb.264.1506936915879; Mon, 02 Oct 2017 02:35:15 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.199.139]) by smtp.gmail.com with ESMTPSA id l4sm6516856wrb.74.2017.10.02.02.35.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 02:35:15 -0700 (PDT) From: Benjamin Gaignard To: architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, airlied@linux.ie, daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org, yannick.fertre@st.com, philippe.cornu@st.com Subject: [PATCH v2 2/5] drm/drm_of: add drm_of_panel_bridge_remove function Date: Mon, 2 Oct 2017 11:34:45 +0200 Message-Id: <1506936888-23844-3-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This function is the pendant of drm_of_find_panel_or_bridge() to remove a previously allocated panel_bridge. Given a specific port and endpoint it remove the panel bridge. Since drm_panel_bridge_remove() will check that bridge parameter is not NULL and is a real drm_panel_bridge and no a simple bridge it is safe to call it directly. Signed-off-by: Benjamin Gaignard Reviewed-by: Philippe Cornu Tested-by: Philippe Cornu --- drivers/gpu/drm/drm_of.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_of.h | 8 ++++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdf..6b54f17 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -260,3 +260,36 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +#ifdef CONFIG_DRM_PANEL_BRIDGE +/* + * drm_of_panel_bridge_remove - remove panel bridge + * @np: device tree node containing panel bridge output ports + * + * Remove the panel bridge of a given DT node's port and endpoint number + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint) +{ + struct drm_bridge *bridge; + struct device_node *remote; + + remote = of_graph_get_remote_node(np, port, endpoint); + if (!remote) + return -ENODEV; + + bridge = of_drm_find_bridge(remote); + drm_panel_bridge_remove(bridge); + + return 0; +} +#else +int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint) +{ + return -EINVAL; +} +#endif +EXPORT_SYMBOL_GPL(drm_of_panel_bridge_remove); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 104dd51..390966e 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -29,6 +29,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, struct drm_bridge **bridge); +int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint); #else static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port) @@ -65,6 +67,12 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, { return -EINVAL; } + +static inline int drm_of_panel_bridge_remove(const struct device_node *np, + int port, int endpoint) +{ + return -EINVAL; +} #endif static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,