From patchwork Wed Aug 2 14:47:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 756E2C41513 for ; Wed, 2 Aug 2023 15:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=czILUA+gU23y0OfnsNXXiJJt0iAx966H0jubmhVIhCQ=; b=3mc5eQnkymf/rjX3zFv7m8FEIQ /hKRtYdk1GlfqOH2sOckdjn8KdNCDYWMARL20AM+Mcqaj1zE/GtPYDQKJa6I4MLX3uFevzxrdt9xA vL2Aey9uE0W34E5x/UrBNyuD8IH+QtwU4CtxX5vuDo8taQ4EZO1chRZ5cWgDlUld7TDaVesE1Q7pq fxnB+bw1iuQo1PCsNCpeaUFyQtxRgXm/GZoUttqZHQTKzEVPnZBHd5GIkd19c4w2YcCZHtop1WVEO aCFR02yEI7fwzoHTCeySeYkE7Lrh/rYkFuowwGanBygeITdY/b2jzVY8gbiEVuswf6Gres8tNoBl8 h9m+1qcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRDSS-005BNZ-2h; Wed, 02 Aug 2023 15:08:16 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRDSQ-005BLu-0d; Wed, 02 Aug 2023 15:08:15 +0000 X-UUID: 62d0105a314611ee912e1518a6540028-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=czILUA+gU23y0OfnsNXXiJJt0iAx966H0jubmhVIhCQ=; b=MZlWRScncof2CD/OwsnbH16yA1ku7IOmJo9Ck2t4a4Atul3jDefnhgMKfXEW35yezliQ2UKMKc75HQyv6QyoxoAl3JWb4QbMEe640+MQj8kZV2uneEjjoYLfq87oFzhmbXMMliiQ9LYKfBXOGM1+zR9ufjJD73R44qbbDu8VfUU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:1662b4f3-02da-4810-8af6-9a2d41d99581,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:1fcc6f8,CLOUDID:5bc613b4-a467-4aa9-9e04-f584452e3794,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 62d0105a314611ee912e1518a6540028-20230802 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 261615183; Wed, 02 Aug 2023 08:08:07 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:03 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , Subject: [PATCH v8 1/8] drm/mediatek: Add mmsys_dev_num to mt8188 vdosys0 driver data Date: Wed, 2 Aug 2023 22:47:55 +0800 Message-ID: <20230802144802.751-2-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_080814_246294_EB4A7DEC X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add missing mmsys_dev_num to mt8188 vdosys0 driver data. Fixes: 54b48080278a ("drm/mediatek: Add mediatek-drm of vdosys0 support for mt8188") Signed-off-by: Jason-JH.Lin Reviewed-by: CK Hu Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 6dcb4ba2466c..249c9fd6347e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -287,6 +287,7 @@ static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = { static const struct mtk_mmsys_driver_data mt8188_vdosys0_driver_data = { .main_path = mt8188_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8188_mtk_ddp_main), + .mmsys_dev_num = 1, }; static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = { From patchwork Wed Aug 2 14:47:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3614CC001E0 for ; Wed, 2 Aug 2023 14:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cAu69axKcG/sCRm+98orQm4HuFnITUEM5KPKS6qi7xs=; b=Pa1ZOpd5q2smgZTzNimI+dG9uk R1zWF0ikZykWEF/wEoa6Z/FdyzjMySP/lcOSun72xujhkacW1Ie0p7aj75PZE55BsGiTe+lke+dvh 6VVape4mzBvyKzBI0okBk0pfRVs6tWxT1z+1+5CT/mN0s4zEBlL12NisT1sPYbc/VWPkTl69dIG7S /joczU/qQEvJhMq++7xcnqsg7cSDV8wMQUaiRaUs8Do9L928RU19719VSTXUIOC7xGch5SnvCFVzz e8VD4cdXM8Iq2prCNbjUcnGvKGiyYPMtO6TjKEGKZAgQhLf0B3KL1HqJv1qjguTZQZIOqFfVVDfKw TuJRL5rA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRD9h-0057cX-19; Wed, 02 Aug 2023 14:48:53 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRD9b-0057Zu-1W; Wed, 02 Aug 2023 14:48:48 +0000 X-UUID: ac299968314311ee83ed1395ce914268-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=cAu69axKcG/sCRm+98orQm4HuFnITUEM5KPKS6qi7xs=; b=umnzFxRMT6qFVKNqWjNcuE3BygaNy9sX7scbT9z0USeZ4Tmm1fOvrfRXqWaMlEJLa7P4GfYxOGRS3flrAj9mKy/OUevSCBlEwJsGKR9/NBBsvWgSaROA5oWqFeiIclPY+sjasNnANap+x1Wy5hw0yvlRCfsxe1HCGb3FWyl+vxU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:af5c0b96-b962-40cd-993b-9c2332bef502,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.30,REQID:af5c0b96-b962-40cd-993b-9c2332bef502,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:1fcc6f8,CLOUDID:7aaa13b4-a467-4aa9-9e04-f584452e3794,B ulkID:230802224806KWMI6316,BulkQuantity:3,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FSD,TF_CID_SPAM_SNR,TF_CID_SPAM_SDM,TF_CID_SPAM_ASC, TF_CID_SPAM_FAS X-UUID: ac299968314311ee83ed1395ce914268-20230802 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 321989141; Wed, 02 Aug 2023 07:48:41 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:03 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , Subject: [PATCH v8 2/8] drm/mediatevk: Add crtc path enum for all_drm_priv array Date: Wed, 2 Aug 2023 22:47:56 +0800 Message-ID: <20230802144802.751-3-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_074847_515149_F0644814 X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add mtk_drm_crtc_path enum for eatch display path. Instead of using array index of all_drm_priv in mtk_drm_kms_init(), mtk_drm_crtc_path enum can make more readable. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++--- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 249c9fd6347e..89a38561ba27 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -465,21 +465,21 @@ static int mtk_drm_kms_init(struct drm_device *drm) for (j = 0; j < private->data->mmsys_dev_num; j++) { priv_n = private->all_drm_private[j]; - if (i == 0 && priv_n->data->main_len) { + if (i == CRTC_MAIN && priv_n->data->main_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->main_path, priv_n->data->main_len, j); if (ret) goto err_component_unbind; continue; - } else if (i == 1 && priv_n->data->ext_len) { + } else if (i == CRTC_EXT && priv_n->data->ext_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->ext_path, priv_n->data->ext_len, j); if (ret) goto err_component_unbind; continue; - } else if (i == 2 && priv_n->data->third_len) { + } else if (i == CRTC_THIRD && priv_n->data->third_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->third_path, priv_n->data->third_len, j); if (ret) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index eb2fd45941f0..f4de8bb27685 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -9,11 +9,17 @@ #include #include "mtk_drm_ddp_comp.h" -#define MAX_CRTC 3 #define MAX_CONNECTOR 2 #define DDP_COMPONENT_DRM_OVL_ADAPTOR (DDP_COMPONENT_ID_MAX + 1) #define DDP_COMPONENT_DRM_ID_MAX (DDP_COMPONENT_DRM_OVL_ADAPTOR + 1) +enum mtk_drm_crtc_path { + CRTC_MAIN, + CRTC_EXT, + CRTC_THIRD, + MAX_CRTC, +}; + struct device; struct device_node; struct drm_crtc; From patchwork Wed Aug 2 14:47:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338298 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C98CCC04A6A for ; Wed, 2 Aug 2023 14:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aUhX4vm7/YwxpZ4R5IgDTC1j/2pYbB/emjeIzE3ZJpI=; b=kPZkXO4rOR6CW+fsm0cHyuHAKW D3PC+jdJHrhQLTo+TSow5qnebDq61/lRpzr78jfYohZc+dp8Y5y7KCFzAEmsmItkVswLBPqW6rSzg 3KYnOgnqTINU/ecHqag9fYdaBc43HGOWPUk9SqocJ7pkvka2ZEzfgQP2lAE1xNZ0HGzBwsohTgfAD UG3w6isd/6XaQsXGm11o+4wg1SykZKAUnndR5QwzjnXEUoe0mXWBmsNOauhCpXjPfh/jW5mrfsEAe Tfej6PHIq+MA0Ra4C+jPa7MZbTZ21f7NQ4HzfrpFxdGHa2EFFk7LIa5LOZxvWcdiBHordKDkHyEAe Ultgn6OA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRDIj-0058za-0R; Wed, 02 Aug 2023 14:58:13 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRDIf-0058y8-1u; Wed, 02 Aug 2023 14:58:11 +0000 X-UUID: fcf86e0e314411ee83ed1395ce914268-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=aUhX4vm7/YwxpZ4R5IgDTC1j/2pYbB/emjeIzE3ZJpI=; b=nNRmNcLJnezH5Xo4YW8VLPowU8hYB+6Bodr8/H/TcUhQMd6V1tYNR+GUcmrJo32Tz0VKNmC9O7xpR/JLGQHCh82ZxWs9zd4ksWmPvTtABEZUFBaM2nSzDME3liWbXC4zza+rSTaeZALAU92lkIWdJ30cXGtha0/9J5MDUKtTzw4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:e6b78d91-5519-4ac8-ab1e-272533a8a9fd,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:1fcc6f8,CLOUDID:0c95d1a0-0933-4333-8d4f-6c3c53ebd55b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_ULN,TF_CID_SPAM_SNR X-UUID: fcf86e0e314411ee83ed1395ce914268-20230802 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1910839612; Wed, 02 Aug 2023 07:58:06 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:04 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , Subject: [PATCH v8 3/8] drm/mediatek: Fix using wrong drm private data to bind mediatek-drm Date: Wed, 2 Aug 2023 22:47:57 +0800 Message-ID: <20230802144802.751-4-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_075809_633355_51CF7F20 X-CRM114-Status: GOOD ( 14.57 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org In mtk_drm_kms_init(), each element in all_drm_priv should has one display path private data only, such as: all_drm_priv[CRTC_MAIN] should has main_path data only all_drm_priv[CRTC_EXT] should has ext_path data only all_drm_priv[CRTC_THIRD] should has third_path data only So we need to add the length checking for each display path before assigning their drm private data into all_drm_priv array. Fixes: 1ef7ed48356c ("drm/mediatek: Modify mediatek-drm for mt8195 multi mmsys support") Signed-off-by: Jason-JH.Lin Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 89a38561ba27..c12886f31e54 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -351,6 +351,7 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev) { struct mtk_drm_private *drm_priv = dev_get_drvdata(dev); struct mtk_drm_private *all_drm_priv[MAX_CRTC]; + struct mtk_drm_private *temp_drm_priv; struct device_node *phandle = dev->parent->of_node; const struct of_device_id *of_id; struct device_node *node; @@ -373,9 +374,18 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev) if (!drm_dev || !dev_get_drvdata(drm_dev)) continue; - all_drm_priv[cnt] = dev_get_drvdata(drm_dev); - if (all_drm_priv[cnt] && all_drm_priv[cnt]->mtk_drm_bound) - cnt++; + temp_drm_priv = dev_get_drvdata(drm_dev); + if (temp_drm_priv) { + if (temp_drm_priv->mtk_drm_bound) + cnt++; + + if (temp_drm_priv->data->main_len) + all_drm_priv[CRTC_MAIN] = temp_drm_priv; + else if (temp_drm_priv->data->ext_len) + all_drm_priv[CRTC_EXT] = temp_drm_priv; + else if (temp_drm_priv->data->third_len) + all_drm_priv[CRTC_THIRD] = temp_drm_priv; + } } if (drm_priv->data->mmsys_dev_num == cnt) { From patchwork Wed Aug 2 14:47:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 159EEC001E0 for ; Wed, 2 Aug 2023 14:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ex722iVzhUj3+Nbr4v4VvudKMy5LYdBilR3IWl4HsjE=; b=J5ty3dQodnY7BVL6XYpQ/n/sBt 4gV98wleFCbRLwX+zurozJbLesG7AuLZ49a2kkcYblPSnQpwzJUnpF6UG8keAnQq2+3Ir//QE1qGA DO079PbL9tusvWUKmXGa6qjZCLJ7KuoSSZXSYiVW5MGTqY0gOunUL04MZCbVWMjkBPWAQJ3uN3IiB CpbXzbpXuJN06nC92EGd3o8m2+/THfALO9lQMsp31M8YdCGxwvo8dMqJxXznexEZpfYRcIgZcTsb7 6y1aoLeMyJQpbh9Q8WOfOnZVDcVuqB25VhVGC3ehTwf3xcLhiU6KAoGut0tC+XI+XoENaMHxRSl+B vYxUFpMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRD96-0057Pt-2A; Wed, 02 Aug 2023 14:48:16 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRD92-0057Nm-0U; Wed, 02 Aug 2023 14:48:14 +0000 X-UUID: 977a1ad8314311ee83ed1395ce914268-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Ex722iVzhUj3+Nbr4v4VvudKMy5LYdBilR3IWl4HsjE=; b=WnyLoMY7cZwMsXYQ830HSCXX5yLKjo9SJ0BUGiGpiMZWTUu+AB2oJd+Q1yvSaGZi+WzQWDRbcTqpjPG/TiWN6rCJn8woGwZpIIndF6E1m2/O2K7gPmHj5mMronh8Gb258CplXPKwyDCzgG10fk8Abi9opdOsY4Uh3kZV8QrobdA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:3426756b-2ec6-4d02-b8c8-6f1159ceb307,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.30,REQID:3426756b-2ec6-4d02-b8c8-6f1159ceb307,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:1fcc6f8,CLOUDID:5a1f9dd2-cd77-4e67-bbfd-aa4eaace762f,B ulkID:230802224806DJ5E8RIY,BulkQuantity:1,Recheck:0,SF:28|17|19|48|38|29,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_ASC,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_SNR, TF_CID_SPAM_SDM X-UUID: 977a1ad8314311ee83ed1395ce914268-20230802 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 260723458; Wed, 02 Aug 2023 07:48:06 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:04 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , Subject: [PATCH v8 4/8] drm/mediatek: Add encoder_index function to mtk_ddp_comp_funcs Date: Wed, 2 Aug 2023 22:47:58 +0800 Message-ID: <20230802144802.751-5-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_074812_197158_34D34792 X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 1. Add encoder_index function to mtk_ddp_comp_funcs to support dynamic connector selection for some ddp_comp who has encoder_index. 2. Add mtk_ddp_comp_encoder_index_set function to set encoder_index to each comp. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index febcaeef16a1..8428baca70f4 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -80,6 +80,7 @@ struct mtk_ddp_comp_funcs { void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next); void (*add)(struct device *dev, struct mtk_mutex *mutex); void (*remove)(struct device *dev, struct mtk_mutex *mutex); + unsigned int (*encoder_index)(struct device *dev); }; struct mtk_ddp_comp { @@ -87,6 +88,7 @@ struct mtk_ddp_comp { int irq; unsigned int id; const struct mtk_ddp_comp_funcs *funcs; + unsigned int encoder_index; }; static inline int mtk_ddp_comp_clk_enable(struct mtk_ddp_comp *comp) @@ -275,6 +277,12 @@ static inline bool mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct dev return false; } +static inline void mtk_ddp_comp_encoder_index_set(struct mtk_ddp_comp *comp) +{ + if (comp->funcs && comp->funcs->encoder_index) + comp->encoder_index = comp->funcs->encoder_index(comp->dev); +} + 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, From patchwork Wed Aug 2 14:47:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F041C001E0 for ; Wed, 2 Aug 2023 14:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=k/vFFhyoBvnFiuEbTWtAaSHHVV6IanNVx9aqT6inzqc=; b=Xy1PwbZjgKDEbeoV4jg7WDc9XO l7e71qKU5gWXF1/N7Rj6WH1u2bej4XsSCylJ7y+pRN/aoIAmq5qlj+JJOEo6BOb3qJ/8qK72W7BBc nmsal0YQWQde6jazpb35plxvBarT1RS+rVUP6R34RuAwjSs3e3omA3rO1OHIkkLczGdxb7AGBNhTf k3d6ULv4sbhmJ1plN2VKENFRMN4m6zKEefKWgDjkKyyrOkes8cBx04GsMAD5vwux788kYzSoZL3re TWt3ztuCwlo82DAOF2+ShQ6BLViVDoBWDO+yg1fMOHwjLBp0U4chNoj2PICfHt9q1vdzZOLo25F2X DCeuLgCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRD9b-0057Zo-0y; Wed, 02 Aug 2023 14:48:47 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRD9Y-0057YY-2r; Wed, 02 Aug 2023 14:48:46 +0000 X-UUID: a9fd9702314311ee912e1518a6540028-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=k/vFFhyoBvnFiuEbTWtAaSHHVV6IanNVx9aqT6inzqc=; b=Sj7uZEhK74lYKmWialIpMYG9Sjq8CdTBtTDLnWZdt1DatyC4N09GPfVx+xaXk3Tz/H9BNnupmLxs10HcyImbxWCIsSY3PU2I5uYJYTj9saJK6yj+ME/S92FVP/GAyDwDpVTTTJ58w6wGOQIqsrt554z2fNggN4+GGz4QTjwt4Uk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:6728e0ac-b6af-4e25-ba03-f41297cbb121,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:1fcc6f8,CLOUDID:4dffbd42-d291-4e62-b539-43d7d78362ba,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: a9fd9702314311ee912e1518a6540028-20230802 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 102205203; Wed, 02 Aug 2023 07:48:37 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:04 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , Subject: [PATCH v8 5/8] drm/mediatek: dpi: Support dynamic connector selection Date: Wed, 2 Aug 2023 22:47:59 +0800 Message-ID: <20230802144802.751-6-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_074844_934339_9E11911F X-CRM114-Status: GOOD ( 12.56 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add implementation of mtk_dpi_encoder_index to mtk_ddp_comp_func to make mtk_dpi support dynamic connector selection. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_dpi.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + 3 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h index 2254038519e1..5f07037670e9 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -44,6 +44,7 @@ void mtk_dither_set_common(void __iomem *regs, struct cmdq_client_reg *cmdq_reg, void mtk_dpi_start(struct device *dev); void mtk_dpi_stop(struct device *dev); +unsigned int mtk_dpi_encoder_index(struct device *dev); void mtk_dsi_ddp_start(struct device *dev); void mtk_dsi_ddp_stop(struct device *dev); diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 948a53f1f4b3..3d6b3c228f30 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -782,6 +782,15 @@ void mtk_dpi_stop(struct device *dev) mtk_dpi_power_off(dpi); } +unsigned int mtk_dpi_encoder_index(struct device *dev) +{ + struct mtk_dpi *dpi = dev_get_drvdata(dev); + unsigned int encoder_index = drm_encoder_index(&dpi->encoder); + + dev_dbg(dev, "encoder index:%d\n", encoder_index); + return encoder_index; +} + static int mtk_dpi_bind(struct device *dev, struct device *master, void *data) { struct mtk_dpi *dpi = dev_get_drvdata(dev); diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index f114da4d36a9..effaaa769b46 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -304,6 +304,7 @@ static const struct mtk_ddp_comp_funcs ddp_dither = { static const struct mtk_ddp_comp_funcs ddp_dpi = { .start = mtk_dpi_start, .stop = mtk_dpi_stop, + .encoder_index = mtk_dpi_encoder_index, }; static const struct mtk_ddp_comp_funcs ddp_dsc = { From patchwork Wed Aug 2 14:48:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3FB92C001DF for ; Wed, 2 Aug 2023 15:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7IVB1CC6BZwxJkece5d/SoXOpHZFxcvvr7Jdp61fNso=; b=h2tWHamX/sWDb1K2g6hSeaAIzc 4fPbKQDtvwiEbaBfdNnj04rc5NbqTuu1FkXPyKhouvwD701WavJyQGkwJMbMWb4Q/dQRUQCpihTk5 uRtsXELEe91g6v1Nl1+/y4TkGAgp8mB5zEtwzEij0VZmxJH2zTNS2jCUz7fqgsI3ljK5fQP+5U1YY VXM5swDVlfUZjvFApm8uof6N/5qp3rGlsbGE6sA4Rk6DJU8iEHpMBTGEviFcShMzzvRh8JUQ+3AFX 3T8A1OAXnhB02BUQjl/X9w3ol65fy/01oyqw+WDu/nPEgrwi/8G9KQGUj1XtJzkhaDBbdDg70m0Fz smuZP4Qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRDT1-005BWK-1e; Wed, 02 Aug 2023 15:08:51 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRDSy-005BVA-03; Wed, 02 Aug 2023 15:08:49 +0000 X-UUID: 7783ca28314611ee83ed1395ce914268-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=7IVB1CC6BZwxJkece5d/SoXOpHZFxcvvr7Jdp61fNso=; b=SrZjH5llkzSsm1WP6TZDUlzARdfoza/TGWQgwrEbci9e9RRYUMD7wlS98LTVn8a++7mZfa6ZPQDBy+/+HAkc0KcJY5o+lLy9cIqT1XyyOfs23Y7VNgIS0XzjoO35/rUkuTtFuZtdgV8lW+Bz6djrHH1DGjgdXLCZBuj5ttnVPIk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:6237ec74-7e0b-4215-8587-c2e356a95344,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:1fcc6f8,CLOUDID:721cbe42-d291-4e62-b539-43d7d78362ba,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 7783ca28314611ee83ed1395ce914268-20230802 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 813507891; Wed, 02 Aug 2023 08:08:41 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:04 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , , Nathan Lu Subject: [PATCH v8 6/8] drm/mediatek: Add ability to support dynamic connector selection Date: Wed, 2 Aug 2023 22:48:00 +0800 Message-ID: <20230802144802.751-7-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_080848_053498_7039D61F X-CRM114-Status: GOOD ( 23.12 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 1. Move output drm connector from each ddp_path array to connector array. 2. Add dynamic select available connector flow in crtc create and enable. Signed-off-by: Nancy Lin Signed-off-by: Nathan Lu Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 81 ++++++++++++++++++++- drivers/gpu/drm/mediatek/mtk_drm_crtc.h | 5 +- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 27 ++++++- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 20 ++++- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 7 ++ 5 files changed, 133 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index d40142842f85..c57012f9c0c8 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -62,6 +62,8 @@ struct mtk_drm_crtc { struct mtk_mutex *mutex; unsigned int ddp_comp_nr; struct mtk_ddp_comp **ddp_comp; + unsigned int num_conn_routes; + const struct mtk_drm_route *conn_routes; /* lock for display hardware access */ struct mutex hw_lock; @@ -649,6 +651,47 @@ static void mtk_drm_crtc_disable_vblank(struct drm_crtc *crtc) mtk_ddp_comp_disable_vblank(comp); } +static void mtk_drm_crtc_update_output(struct drm_crtc *crtc, + struct drm_atomic_state *state) +{ + int crtc_index = drm_crtc_index(crtc); + int i; + struct device *dev; + struct drm_crtc_state *crtc_state = state->crtcs[crtc_index].new_state; + struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); + struct mtk_drm_private *priv = crtc->dev->dev_private; + unsigned int comp_id; + unsigned int encoder_mask = crtc_state->encoder_mask; + + if (!crtc_state->connectors_changed) + return; + + if (!mtk_crtc->num_conn_routes) + return; + + priv = priv->all_drm_private[crtc_index]; + dev = priv->dev; + + dev_dbg(dev, "connector change:%d, encoder mask:0x%x for crtc:%d\n", + crtc_state->connectors_changed, encoder_mask, crtc_index); + + for (i = 0; i < mtk_crtc->num_conn_routes; i++) { + struct mtk_ddp_comp *comp; + + comp_id = mtk_crtc->conn_routes[i].route_ddp; + comp = &priv->ddp_comp[comp_id]; + if (comp->encoder_index >= 0 && + encoder_mask & BIT(comp->encoder_index)) { + mtk_crtc->ddp_comp[mtk_crtc->ddp_comp_nr - 1] = comp; + dev_dbg(dev, "Add comp_id: %d at path index %d\n", + comp->id, mtk_crtc->ddp_comp_nr - 1); + break; + } + } + + dev_dbg(dev, "Update total comp num:%d", mtk_crtc->ddp_comp_nr); +} + int mtk_drm_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane, struct mtk_plane_state *state) { @@ -681,6 +724,8 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc, DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id); + mtk_drm_crtc_update_output(crtc, state); + ret = pm_runtime_resume_and_get(comp->dev); if (ret < 0) { DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret); @@ -886,7 +931,8 @@ struct device *mtk_drm_crtc_dma_dev_get(struct drm_crtc *crtc) int mtk_drm_crtc_create(struct drm_device *drm_dev, const unsigned int *path, unsigned int path_len, - int priv_data_index) + int priv_data_index, const struct mtk_drm_route *conn_routes, + unsigned int num_conn_routes) { struct mtk_drm_private *priv = drm_dev->dev_private; struct device *dev = drm_dev->dev; @@ -1040,5 +1086,38 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, init_waitqueue_head(&mtk_crtc->cb_blocking_queue); } #endif + + if (conn_routes) { + struct device_node *node; + struct mtk_ddp_comp *comp; + unsigned int comp_id; + + for (i = 0; i < num_conn_routes; i++) { + comp_id = conn_routes[i].route_ddp; + node = priv->comp_node[comp_id]; + comp = &priv->ddp_comp[comp_id]; + + if (!comp->dev) { + dev_dbg(dev, "comp_id:%d, Component %pOF not initialized\n", + comp_id, node); + comp->encoder_index = -1; + continue; + } + + mtk_ddp_comp_encoder_index_set(&priv->ddp_comp[comp_id]); + } + + mtk_crtc->num_conn_routes = num_conn_routes; + mtk_crtc->conn_routes = conn_routes; + + /* append the last ddp_comp and ddp_comp_nr at the end of mtk_drm_crtc_create */ + mtk_crtc->ddp_comp[mtk_crtc->ddp_comp_nr] = + devm_kmalloc(dev, sizeof(*mtk_crtc->ddp_comp), GFP_KERNEL); + if (!mtk_crtc->ddp_comp[mtk_crtc->ddp_comp_nr]) + return -ENOMEM; + + mtk_crtc->ddp_comp_nr++; + } + return 0; } diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h index 3e9046993d09..3c224595fa71 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h @@ -8,6 +8,7 @@ #include #include "mtk_drm_ddp_comp.h" +#include "mtk_drm_drv.h" #include "mtk_drm_plane.h" #define MTK_LUT_SIZE 512 @@ -18,7 +19,9 @@ void mtk_drm_crtc_commit(struct drm_crtc *crtc); int mtk_drm_crtc_create(struct drm_device *drm_dev, const unsigned int *path, unsigned int path_len, - int priv_data_index); + int priv_data_index, + const struct mtk_drm_route *conn_routes, + unsigned int num_conn_routes); int mtk_drm_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane, struct mtk_plane_state *state); void mtk_drm_crtc_async_update(struct drm_crtc *crtc, struct drm_plane *plane, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index effaaa769b46..c1ea112e6be8 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -508,6 +508,23 @@ static bool mtk_drm_find_comp_in_ddp(struct device *dev, return false; } +static int mtk_drm_find_comp_in_ddp_conn_path(struct device *dev, + const struct mtk_drm_route *routes, + unsigned int num_routes, + struct mtk_ddp_comp *ddp_comp) +{ + unsigned int i; + + if (!routes) + return -EINVAL; + + for (i = 0; i < num_routes; i++) + if (dev == ddp_comp[routes[i].route_ddp].dev) + return BIT(routes[i].crtc_id); + + return -ENODEV; +} + int mtk_ddp_comp_get_id(struct device_node *node, enum mtk_ddp_comp_type comp_type) { @@ -539,7 +556,15 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, private->data->third_len, private->ddp_comp)) ret = BIT(2); else - DRM_INFO("Failed to find comp in ddp table\n"); + ret = mtk_drm_find_comp_in_ddp_conn_path(dev, + private->data->conn_routes, + private->data->num_conn_routes, + private->ddp_comp); + + if (ret <= 0) { + DRM_INFO("Failed to find comp in ddp table, ret =%d\n", ret); + ret = 0; + } return ret; } diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index c12886f31e54..9900007667a2 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -185,7 +185,10 @@ static const unsigned int mt8188_mtk_ddp_main[] = { DDP_COMPONENT_GAMMA, DDP_COMPONENT_POSTMASK0, DDP_COMPONENT_DITHER0, - DDP_COMPONENT_DP_INTF0, +}; + +static const struct mtk_drm_route mt8188_mtk_ddp_main_routes[] = { + {0, DDP_COMPONENT_DP_INTF0}, }; static const unsigned int mt8192_mtk_ddp_main[] = { @@ -287,6 +290,8 @@ static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = { static const struct mtk_mmsys_driver_data mt8188_vdosys0_driver_data = { .main_path = mt8188_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8188_mtk_ddp_main), + .conn_routes = mt8188_mtk_ddp_main_routes, + .num_conn_routes = ARRAY_SIZE(mt8188_mtk_ddp_main_routes), .mmsys_dev_num = 1, }; @@ -419,6 +424,11 @@ static bool mtk_drm_find_mmsys_comp(struct mtk_drm_private *private, int comp_id if (drv_data->third_path[i] == comp_id) return true; + if (drv_data->num_conn_routes) + for (i = 0; i < drv_data->num_conn_routes; i++) + if (drv_data->conn_routes[i].route_ddp == comp_id) + return true; + return false; } @@ -477,21 +487,23 @@ static int mtk_drm_kms_init(struct drm_device *drm) if (i == CRTC_MAIN && priv_n->data->main_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->main_path, - priv_n->data->main_len, j); + priv_n->data->main_len, j, + priv_n->data->conn_routes, + priv_n->data->num_conn_routes); if (ret) goto err_component_unbind; continue; } else if (i == CRTC_EXT && priv_n->data->ext_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->ext_path, - priv_n->data->ext_len, j); + priv_n->data->ext_len, j, NULL, 0); if (ret) goto err_component_unbind; continue; } else if (i == CRTC_THIRD && priv_n->data->third_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->third_path, - priv_n->data->third_len, j); + priv_n->data->third_len, j, NULL, 0); if (ret) goto err_component_unbind; diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index f4de8bb27685..6f98fff4f1a4 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -28,6 +28,11 @@ struct drm_fb_helper; struct drm_property; struct regmap; +struct mtk_drm_route { + const unsigned int crtc_id; + const unsigned int route_ddp; +}; + struct mtk_mmsys_driver_data { const unsigned int *main_path; unsigned int main_len; @@ -35,6 +40,8 @@ struct mtk_mmsys_driver_data { unsigned int ext_len; const unsigned int *third_path; unsigned int third_len; + const struct mtk_drm_route *conn_routes; + unsigned int num_conn_routes; bool shadow_register; unsigned int mmsys_id; From patchwork Wed Aug 2 14:48:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83ACFC04A6A for ; Wed, 2 Aug 2023 14:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A1UxD4ZIcUpJFmyZiHa2rkTyn/dhUFJzKVj42CuuMJc=; b=0BAD5IhQOt2v3gDvuyfnPED0zw 5MNy4JqWca88dDQpXm9cq8wAt4HpKxZxjX5fifgAn/YsSFnMAOsilDt0C7Eyfpmn0YeXwkA8/vYrj I8HQeHY1KRzXkOKhnS86WO58lSHc/NKCX+kWoXno+Mi3XLdHP5QhNZ7AQ8sAc2qaDAiBQsCJOKZJm LDlpPKwgPOL6PZdjKW5SBXEp5bCfx+8V1fFkR0a5DdSTIp9j9lHC4GR5U1zcY7UFG+dDaS9uTwCol 8b3tA6xtLBj1Wl0KzfMEjb2LdYeABHY4GgQQcptRGQCuMsq7D1TYoIloUH0kf3awmFOWkfzqXv7ud 9IXCZRkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRDJH-00597g-2i; Wed, 02 Aug 2023 14:58:47 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRDJE-00596t-37; Wed, 02 Aug 2023 14:58:46 +0000 X-UUID: 10231772314511ee912e1518a6540028-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=A1UxD4ZIcUpJFmyZiHa2rkTyn/dhUFJzKVj42CuuMJc=; b=S1Zn8Llp41Zu8tpEGSZXqtpJcM0XyFc7bHfbVG4RHPbR9tU8qRYfVNYUXpvtA0NF6rgvKncvpqiDFal7mxwinWPctIFHMw22OYQaI/SrwJCvYiGQLMiSriNn3KzYkPa+KqISHhntBN2pyZQ2kFNprSV/wWMKR0wJ6kbwwA0BGWM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:d0825af0-6cbd-4241-a205-6100d8154eae,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:1fcc6f8,CLOUDID:1c2d9dd2-cd77-4e67-bbfd-aa4eaace762f,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 10231772314511ee912e1518a6540028-20230802 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2127845152; Wed, 02 Aug 2023 07:58:38 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:04 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , Subject: [PATCH v8 7/8] drm/mediatek: dsi: Support dynamic connector selection Date: Wed, 2 Aug 2023 22:48:01 +0800 Message-ID: <20230802144802.751-8-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_075845_013294_05AE3461 X-CRM114-Status: GOOD ( 12.47 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add implementation of mtk_dsi_encoder_index to mtk_ddp_comp_func to make mtk_dsi support dynamic connector selection. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h index 5f07037670e9..fdaa21b6a9da 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -48,6 +48,7 @@ unsigned int mtk_dpi_encoder_index(struct device *dev); void mtk_dsi_ddp_start(struct device *dev); void mtk_dsi_ddp_stop(struct device *dev); +unsigned int mtk_dsi_encoder_index(struct device *dev); int mtk_gamma_clk_enable(struct device *dev); void mtk_gamma_clk_disable(struct device *dev); diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index c1ea112e6be8..c93b1bae00dc 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -318,6 +318,7 @@ static const struct mtk_ddp_comp_funcs ddp_dsc = { static const struct mtk_ddp_comp_funcs ddp_dsi = { .start = mtk_dsi_ddp_start, .stop = mtk_dsi_ddp_stop, + .encoder_index = mtk_dsi_encoder_index, }; static const struct mtk_ddp_comp_funcs ddp_gamma = { diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 7d5250351193..8c45dc19d39f 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -865,6 +865,15 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) return ret; } +unsigned int mtk_dsi_encoder_index(struct device *dev) +{ + struct mtk_dsi *dsi = dev_get_drvdata(dev); + unsigned int encoder_index = drm_encoder_index(&dsi->encoder); + + dev_dbg(dev, "encoder index:%d\n", encoder_index); + return encoder_index; +} + static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) { int ret; From patchwork Wed Aug 2 14:48:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 13338271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 218D3C001E0 for ; Wed, 2 Aug 2023 14:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9zDMiNk7A0rGAdzSezp69DPTRgVksUZv6SGUBYVoEW8=; b=df1HfaD0Bovh26Y1NE465XVKax +TkXZwNhctAG0vZDEYHrltwXryQwhh0kEcEGhck2i3+4Awo/4Sh5uz7CqOE+q3i8ewT7fdkAejw6B mfWsAeTqj0YQfI8MaEMydDw9SMrOfpjSu7mO8SNffIAa9ZXbdIDW1ZUmE3y+xkLQTxAj2vt9A4Ju/ X1wkG68LXVKkBhGiNMTahj8axwDsb9mSHeDV1EPjFKW+vvSV2KAiJ8FwKAA+vbDGR2ZeXFdRvVCnW rqxJh0oMFsyxAm7NHYGJBITOFAEuDTIPpaU8wKi6XNSnWmlH2B0Ba/C7YvmL9T6OScUdN9wvP8bk8 8dm6aS6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRDA4-0057li-1H; Wed, 02 Aug 2023 14:49:16 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRDA1-0057kH-1f; Wed, 02 Aug 2023 14:49:14 +0000 X-UUID: bc03cc00314311ee83ed1395ce914268-20230802 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=9zDMiNk7A0rGAdzSezp69DPTRgVksUZv6SGUBYVoEW8=; b=pfiu3b+fzqQ8J138IpNPvsnAsNu6EpQV+Isp5TTfTMEBkKyLCbuACdBgpGKKcM+Z3fdt+HDaOWWtTzkRJBuCzg/pdjQ5Qi3VqXzNyyoSoHabNFUGLSsUnorifU5kOvMJXk/ltsmhLzKOzTEgTrBEG1zBk8at4/vjze4s6Al0wHg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:e2b63f8f-f839-49b4-9943-ccbf3ab24200,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:1fcc6f8,CLOUDID:16ab13b4-a467-4aa9-9e04-f584452e3794,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: bc03cc00314311ee83ed1395ce914268-20230802 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 53331970; Wed, 02 Aug 2023 07:49:08 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 2 Aug 2023 22:48:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 2 Aug 2023 22:48:04 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , AngeloGioacchino Del Regno , Eugen Hristev CC: Matthias Brugger , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , , Nathan Lu Subject: [PATCH v8 8/8] drm/mediatek: Support DSI on MT8188 VDOSYS0 Date: Wed, 2 Aug 2023 22:48:02 +0800 Message-ID: <20230802144802.751-9-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230802144802.751-1-jason-jh.lin@mediatek.com> References: <20230802144802.751-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_074913_558495_E36ACC67 X-CRM114-Status: GOOD ( 10.39 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add DSI as a main display output selection on MT8188 VDOSYS0. Signed-off-by: Nathan Lu Signed-off-by: Jason-JH.Lin Reviewed-by: Matthias Brugger --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 9900007667a2..fb7909b21bfa 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -189,6 +189,7 @@ static const unsigned int mt8188_mtk_ddp_main[] = { static const struct mtk_drm_route mt8188_mtk_ddp_main_routes[] = { {0, DDP_COMPONENT_DP_INTF0}, + {0, DDP_COMPONENT_DSI0}, }; static const unsigned int mt8192_mtk_ddp_main[] = {