From patchwork Fri Sep 29 12:59:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9977979 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 EFEE96037F for ; Fri, 29 Sep 2017 12:59:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFB4B29868 for ; Fri, 29 Sep 2017 12:59:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D492A2986A; Fri, 29 Sep 2017 12:59:39 +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 80E542986C for ; Fri, 29 Sep 2017 12:59:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 479BE6EB8C; Fri, 29 Sep 2017 12:59:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id B17596EB8C for ; Fri, 29 Sep 2017 12:59:36 +0000 (UTC) Received: by mail-wm0-x235.google.com with SMTP id i131so3119111wma.0 for ; Fri, 29 Sep 2017 05:59:36 -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:in-reply-to:references; bh=Hj4kfz4Uzu/5sDvtj8FN2aB8mXVF81wP3HBpnWZstm8=; b=DY0wE1vKyIOBc452bJVaYDMEmkpQy9DRxipTKuYnPqYqj2eeG6rfG/ilI9iQKXHeJQ t+zKkGez0W2mZLjy7Ssrw/SEcZXrEtoQ1l01bqNYMwHYl8D3DX6JacNaRzIJEWj3laq5 pVV1NazG59mKxXc64JI6koOErcgabyL6HO5b4= 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:in-reply-to :references; bh=Hj4kfz4Uzu/5sDvtj8FN2aB8mXVF81wP3HBpnWZstm8=; b=g3fA5Ze8Sus66hjxGdMh5ts1qAeVGYGmXxnDdpVQdOpcSFSgkwuA1/NlEfWKSLRuZL 35cOSp9dwAwYy9VTmTPjmZJBLIDDYW0i7lbvGQOTnwFRgUQlslUgJvOBGjH3a8cEB/Q8 Jf6QEgactfzc6X/rmNFTtByvKZnViws72geIsai/DfSarOkzpd1rHCpaHH8KKL7cVayS bMk5saMz8nIis0kKvU8R09B29ES5TrtfufUFBarUsIlgSEgvqACV/xdKTcI5Vdw0Gn+/ RG/BzfiEyX5P1BgI/nDczpSUcwpI8n17jBwjijA7wjMesERH/fy5VXLVF/6A9rGy5vOm IKEw== X-Gm-Message-State: AMCzsaVAUiefiObN+SUMTvACSBFJGXo8HwooMzoXsmCKgLCUptz/9+OJ 5XhPcA4bMdhGQ18NMjG+ZSeTzA== X-Google-Smtp-Source: AOwi7QDbxZA+n2FGiOED0Uu2+0/BYXDXIOuiR9HrCJYtZKp2LmeYKn2FHfQbkz8yaXn0HorqY9LGiA== X-Received: by 10.28.70.133 with SMTP id t127mr4495295wma.42.1506689975240; Fri, 29 Sep 2017 05:59:35 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.91.35]) by smtp.gmail.com with ESMTPSA id k11sm3269667wrc.90.2017.09.29.05.59.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Sep 2017 05:59:34 -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 2/3] drm/drm_of: add drm_of_panel_bridge_remove function Date: Fri, 29 Sep 2017 14:59:18 +0200 Message-Id: <1506689959-7858-3-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506689959-7858-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506689959-7858-1-git-send-email-benjamin.gaignard@linaro.org> 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 --- 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,