From patchwork Wed Aug 29 03:12:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6buE5a626ZKX?= X-Patchwork-Id: 10579509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC25F174C for ; Wed, 29 Aug 2018 03:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDF652A471 for ; Wed, 29 Aug 2018 03:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52702A576; Wed, 29 Aug 2018 03:13:13 +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=1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS, RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E49D2A471 for ; Wed, 29 Aug 2018 03:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Qg2ub0Zu2BiPiY5k9POM7rvjZOwyMBCF3dM6CtUwlhM=; b=N91UZBg3yqS3iRKewKmjQbYIX/ NeRlIpFxZRGMyuv0kOXusfl/pJkJZSnBXWD5YEjLOHkmRMljg8t2+1tl6T7zoPhC7qqZjFQ8/DsJT PI8sULM2m1zXqNAiF0vC6dNdd4KfEphGZlJejeEb8UFRIfoY9+DokQHsD/YzwriudfL1Ns/PeaN/i L/RfhJW2jPC5s2Lv9FHt8qmO3QtB1kzSut9PEZFpn/qph4aRndEFAcG/91d5HCLDfVgiQgMbITxC3 f7Mie4lYWHO2sSji5/X8EXqVjTpEyQ1AmmIFAPADbPTrqgJeB5zlRa5YoXLcVrsob5tfAoNiKhYwU CksZ0LfQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuqus-0005w3-Gw; Wed, 29 Aug 2018 03:13:10 +0000 Received: from regular1.263xmail.com ([211.150.99.136]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuqun-0005uD-3n; Wed, 29 Aug 2018 03:13:06 +0000 Received: from hjc?rock-chips.com (unknown [192.168.167.158]) by regular1.263xmail.com (Postfix) with ESMTP id 7227D37C; Wed, 29 Aug 2018 11:12:56 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 4F0EA3C4; Wed, 29 Aug 2018 11:12:55 +0800 (CST) X-RL-SENDER: hjc@rock-chips.com X-FST-TO: hjc@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: hjc@rock-chips.com X-UNIQUE-TAG: <18f69bf46ad5498c2f44cff213fd75c2> X-ATTACHMENT-NUM: 0 X-SENDER: hjc@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 3105632JBGK; Wed, 29 Aug 2018 11:12:56 +0800 (CST) From: Sandy Huang To: hjc@rock-chips.com, heiko@sntech.de, seanpaul@chromium.org, David Airlie Subject: [PATCH v7 1/3] drm/tockchip: add function to check if endpoint is a subdriver Date: Wed, 29 Aug 2018 11:12:42 +0800 Message-Id: <1535512364-80764-2-git-send-email-hjc@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535512364-80764-1-git-send-email-hjc@rock-chips.com> References: <1535512364-80764-1-git-send-email-hjc@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180828_201305_348830_CDF1CA14 X-CRM114-Status: GOOD ( 16.08 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Heiko Stuebner To be able to have both internal subdrivers and external bridge drivers as output endpoints of vops, add a function to be able to distinguish these. Signed-off-by: Heiko Stuebner --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 27 +++++++++++++++++++++++++++ drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + 2 files changed, 28 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 1d9c4a9..d18f7f8 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -267,6 +268,32 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { static struct platform_driver *rockchip_sub_drivers[MAX_ROCKCHIP_SUB_DRIVERS]; static int num_rockchip_sub_drivers; +/* + * check if a vop output-endpoint is a subdriver or bridge. + */ +bool rockchip_drm_endpoint_is_subdriver(struct device_node *ep) +{ + struct device_node *node = of_graph_get_remote_port_parent(ep); + struct platform_device *pdev; + int i; + + if (!node) + return false; + + pdev = of_find_device_by_node(node); + if (!pdev) + return false; + + for (i = 0; i < num_rockchip_sub_drivers; i++) { + struct device_driver *drv = pdev->dev.driver; + + if (rockchip_sub_drivers[i] == to_platform_driver(drv)) + return true; + } + + return false; +} + static int compare_dev(struct device *dev, void *data) { return dev == (struct device *)data; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index d67ad0a..305b485 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -64,6 +64,7 @@ void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, struct device *dev); int rockchip_drm_wait_vact_end(struct drm_crtc *crtc, unsigned int mstimeout); +bool rockchip_drm_endpoint_is_subdriver(struct device_node *ep); extern struct platform_driver cdn_dp_driver; extern struct platform_driver dw_hdmi_rockchip_pltfm_driver; extern struct platform_driver dw_mipi_dsi_driver;