From patchwork Wed Aug 29 01:57:03 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: 10579417 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 26F0B920 for ; Wed, 29 Aug 2018 01:57:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 146072A7B6 for ; Wed, 29 Aug 2018 01:57:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 086232AB24; Wed, 29 Aug 2018 01:57:38 +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 B8F622A7B6 for ; Wed, 29 Aug 2018 01:57:37 +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=IsKibhqO/+A587/+uiJYKllOJx CLeuQhjsfookIpvLQBTqt4ndUiRtOkL/KUhqC6WlbhTuzSIYXgy9Gsy59+NxYdg9+SSz7V6u1gIlT hLtZgGr9vlTCKvdYh+ikao4/mFOHnP2oJy/us4bIyDHK9n8Q3xMA9ccbE2BwQqK1nUVkbNPBuseeg sCQCUkwUKxiaEX7vdmfyQb2xNmRqX2y4gYzdDTOuVylldo1Zhh225M9+qDhoM6CV/RcKCoxw4EYcI kkp4+MUyQ3EeRdeaQrUinsBKnkQV8gDB2IFi5ciDb/juq98fl2zQzz4goy+ATIpDPwhxJ/i+2Ie3X jfXXkNyQ==; 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 1fupji-0005jh-So; Wed, 29 Aug 2018 01:57:34 +0000 Received: from regular1.263xmail.com ([211.150.99.137]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fupjf-0005iV-Pe; Wed, 29 Aug 2018 01:57:33 +0000 Received: from hjc?rock-chips.com (unknown [192.168.167.11]) by regular1.263xmail.com (Postfix) with ESMTP id 9DC34316; Wed, 29 Aug 2018 09:57:15 +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 36F773BF; Wed, 29 Aug 2018 09:57:11 +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: <63ea444b8b687f321b8cadfaed5b344b> 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 12252YD8NJE; Wed, 29 Aug 2018 09:57:14 +0800 (CST) From: Sandy Huang To: hjc@rock-chips.com, heiko@sntech.de, seanpaul@chromium.org, David Airlie Subject: [PATCH v6 1/3] drm/tockchip: add function to check if endpoint is a subdriver Date: Wed, 29 Aug 2018 09:57:03 +0800 Message-Id: <1535507825-195695-2-git-send-email-hjc@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535507825-195695-1-git-send-email-hjc@rock-chips.com> References: <1535507825-195695-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_185732_006826_F42B51E0 X-CRM114-Status: GOOD ( 16.50 ) 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-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.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;