Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp218094ybg; Tue, 28 Jul 2020 04:19:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxj4WZSvtFYDrHT2SM0EBk65/bChN6QMHK0Eg1mfz/pjq90WcOScHAfe+GHb2eauESAm8F X-Received: by 2002:a05:6402:1b1c:: with SMTP id by28mr25637514edb.270.1595935190939; Tue, 28 Jul 2020 04:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595935190; cv=none; d=google.com; s=arc-20160816; b=S96JUIvfsjKKcXcImDHssleT1L3jEqeouh8B+mvOkQNxuLpMJIXPc7u2xrbt0rjWSG HOk2dcRsrQaF8dEjcr1VYY1UJfF6+QzhbWOew/7HP/RlWUAHNEyBBXGCHX/KVbOg4AH8 M9b6g3YT7a9SY9DEzwVRSTIHqyM9BaxGEVICu67HZZiE058hFIAj1i4Rjr8eJmGDJOJB hUghC+Gj8OFqz7+hOPErrPhv+tRhvTgebAV9acHGfsfdVrEML2XzmAcZHkjKraXZAxyJ 83/ZDHHE0tscxmFSWK8cNtop2qFVLoywPjbkHVhboQJGWcOiy4s0JLGbLgTlWTu2PSrC nXZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LY9s1nnQKckO3h37XV1S0MJqqf6r6yFpGbgjuCHrjxQ=; b=hWBPsIbUc1LmM0khVhstMyPGRwFszDuSmhVUM5+FPYJ2K+J6sgQ6UL93GON7e4SiL1 3a6sdU/i/fxa0As357Qj8F7eHgV9f1PyOO/4xJ9XFPbm101WfoUuVXW7rt7lTKbOXuoh DI4SP+Fvo/K/TZF7qkMQ6uXS2vSqwKNu9qBhjx2p2bPs1dod3UsbueSQiIcYUOQbiL2I gWmKX6yccBW8kGHL47OrBBNiX80lsF8FSjLmMb/tZdolxZqNEVfdi0pwU8EPGfg9Eu1E /43K+IkOhe/4IgGvscJH3OYEId212HyjuR9H6OVqjGwIbor9/R3FbOi88lYPb+UrAmQI tcXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=XFVxZUvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si8092952edv.536.2020.07.28.04.19.29; Tue, 28 Jul 2020 04:19:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=XFVxZUvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729023AbgG1LSr (ORCPT + 99 others); Tue, 28 Jul 2020 07:18:47 -0400 Received: from mout.gmx.net ([212.227.17.20]:34321 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728934AbgG1LSq (ORCPT ); Tue, 28 Jul 2020 07:18:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1595935104; bh=pm4hEMlP1SzMjKQ+uHyoY76koqrhvWkeRDQON2vGLX0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=XFVxZUvse2zObR6M+0xBOiKlRSLE0+v2VIYCl0YJ3kC2tf49GCXNPhqSmqusKTBYF 5/nJhprONs3KnUNv0mp0IJFP8DUXWTRH3BuUm0w4Fp9WhaC1+7kj0kpyfJyhjdPOgA KWyDgQ0DJxON7KsfDPirj6/F3kd+B3ImB9v3f89A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([80.208.215.239]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MWRVb-1kGiTE44Mt-00Xw1i; Tue, 28 Jul 2020 13:18:24 +0200 From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stu Hsieh Subject: [PATCH v2 3/5] drm: Add get_possible_crtc API for dpi, dsi Date: Tue, 28 Jul 2020 13:17:58 +0200 Message-Id: <20200728111800.77641-4-frank-w@public-files.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200728111800.77641-1-frank-w@public-files.de> References: <20200728111800.77641-1-frank-w@public-files.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:hmgR7ODYKvx8oPlcDw8Lc1GdvQDfiX/JgJnDv87nXPtte2migzq ZD98y+zmB/ZdT2oYW7Y7j8ofZCmyvZqa5eJRoXNRmZdV4lhEsqqiCqPF33I3WAZ5nzXzcip 5b5gV7A/c4AzsF40MizKtDOUfJhcDZss5KO+Y5HIkLY1uKWgvNw03Vd+wONHCMSGrAmN1Ya g9M6z+lByXTke2b9AhiEw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Cj6kSjaFYw8=:ibEsBPbF6stniMnVYTZhpV zDkTCWx13nsNCZy0D5Scrx7JkmlXPW9zL7/aTnkpDis106jtkcOYgFza12v6q47vNqG2godoh gLhY6SVqb6ELX75sq7sW9ju1u74/7nZLjimkkHxejvjvC68ctmMo/7sCG8m2LGloyFKovYFGN c084KbHFzK9BOtz9pW99diRqvqZk9muoO8ZF4eUUMP/5Ua+mXClWA35s+POS6yTJrsFPwrJz+ cM7pYI9fulZGb1LVA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ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stu Hsieh Test: build pass and run ok Signed-off-by: Stu Hsieh =2D-- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 42 +++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 + 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm= /mediatek/mtk_drm_ddp_comp.c index 57c88de9a329..a5f2ff6bea93 100644 =2D-- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -13,6 +13,8 @@ #include #include #include +#include + #include "mtk_drm_drv.h" #include "mtk_drm_plane.h" #include "mtk_drm_ddp_comp.h" @@ -412,6 +414,22 @@ static const struct mtk_ddp_comp_match mtk_ddp_matche= s[DDP_COMPONENT_ID_MAX] =3D { [DDP_COMPONENT_WDMA1] =3D { MTK_DISP_WDMA, 1, NULL }, }; +static bool mtk_drm_find_comp_in_ddp(struct mtk_ddp_comp ddp_comp, + const enum mtk_ddp_comp_id *path, + unsigned int path_len) +{ + unsigned int i; + + if (path =3D=3D NULL) + return false; + + for (i =3D 0U; i < path_len; i++) + if (ddp_comp.id =3D=3D path[i]) + return true; + + return false; +} + int mtk_ddp_comp_get_id(struct device_node *node, enum mtk_ddp_comp_type comp_type) { @@ -427,6 +445,30 @@ int mtk_ddp_comp_get_id(struct device_node *node, return -EINVAL; } +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, + struct mtk_ddp_comp ddp_comp) +{ + struct mtk_drm_private *private =3D drm->dev_private; + unsigned int ret; + + if (mtk_drm_find_comp_in_ddp(ddp_comp, private->data->main_path, + private->data->main_len) =3D=3D true) { + ret =3D BIT(0); + } else if (mtk_drm_find_comp_in_ddp(ddp_comp, + private->data->ext_path, + private->data->ext_len) =3D=3D true) { + ret =3D BIT(1); + } else if (mtk_drm_find_comp_in_ddp(ddp_comp, + private->data->third_path, + private->data->third_len) =3D=3D true) { + ret =3D BIT(2); + } else { + DRM_INFO("Failed to find comp in ddp table\n"); + ret =3D 0; + } + return ret; +} + int mtk_ddp_comp_init(struct device *dev, struct device_node *node, struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm= /mediatek/mtk_drm_ddp_comp.h index debe36395fe7..1d9e00b69462 100644 =2D-- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -202,6 +202,8 @@ static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp= *comp, int mtk_ddp_comp_get_id(struct device_node *node, enum mtk_ddp_comp_type comp_type); +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, + struct mtk_ddp_comp ddp_comp); int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node, struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs); =2D- 2.25.1