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: 114569 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp474784qgn; Mon, 2 Oct 2017 02:35:20 -0700 (PDT) X-Received: by 10.99.42.3 with SMTP id q3mr12419620pgq.354.1506936920446; Mon, 02 Oct 2017 02:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506936920; cv=none; d=google.com; s=arc-20160816; b=XwMos+FkKa3xZHch0Ftx7w/GDGAtfBcVMJ2vUxe+6Idx/8dXbqVlIqBT427ZLaYY/n kLNBtlhgcec0OJgEJjYPWPCO1rHXx1PPgnFQglwcoWoBYMMjxDA/IBle85Dtpre2Bi5O +l/956T0Wh11TuQPc5eufQi3UFgNsZ7woR14be/ZbhUFEs/f0m/pXOMXiRZVOG2CUdMU yTkijpYwkfJJGVEL0xzl6LUbaLqDmuFKMU7oIsmJqz/JqNf+12MOveJ9dDS2ja3mRE9W lFreMu8l3Iv9AcitANoaqreI72YbNI/h5l96QKQbyqUBP9CnZSAxv+Spy8jBYOL7fvTV rZuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=26HUiJu4V0L+9QchYLcH5Ut/us+THEG0X8n2WHDNZ3M=; b=z34Zmhc2Vko5+kxcnSxflTgIXPWOfPO2j51/foEYnjI25s69gifa/6uA/lomxBLAAU P4ouD+0xHSH2FvBlUWxuKYoJT7yeQ+m7S5ME1Jplg2teDcDupiJp4vcnss0A9VWgt4AH PbHXHdkZMIt12ueKgFrYNBwh1oEPsMcFyVbbbPkfdYdPXda71Yt/Vn9SAmZvEVXfNeLH 8E0K+E4EAGUrAID1SyqC7Lp7OWtyEMbVw94UNLVmJ0GQX5HmubGcccZjez3HmQc6zowq jGin5hkE3ufp86zhOtMrJhFtMeC5HFJsVVmrwYX657kQcDb78v4naoisqz9zCAxd6VbU RKbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Uooo1pZh; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g2si7365330pgf.680.2017.10.02.02.35.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 02:35:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Uooo1pZh; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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" 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 Reviewed-by: Eric Anholt --- 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,