Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1510175rwb; Fri, 5 Aug 2022 03:20:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5veQ1DBync6XkdyXVXGKpwLeYvRwB/Ixg50vJPQArTfH9U4ybae+2QNz/DiOV2mWcnTt4a X-Received: by 2002:aa7:cd86:0:b0:43a:26e3:d333 with SMTP id x6-20020aa7cd86000000b0043a26e3d333mr6107311edv.178.1659694826281; Fri, 05 Aug 2022 03:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659694826; cv=none; d=google.com; s=arc-20160816; b=ozMZvM3PprEh0yBq+FACIChdhFlrcbJ2EIxcKWsrZ3n44ke9agewwpdKgBmvgxkuOZ cFRpdFQakZUriGYL7OoQHyxt6QVXRkecPPa2SLoMCrYcyUuJmwn8lnMgAQ1kX+5co8Vc N9daSMxsWczZgb2Mu0nTBUaNrw51RIxZBNiVY0kT0w7eirAfJqV1t8B/9dS9Wc1oYSVD 17M+kjmwx83OzW9+YQAEIfh+kh9c9SluneaYowqnhzJkC8NSE9oRQZMwnlueNLf9QqxV bfyR8KLKOhMwZZ66eALYE0MCL/U0ctgHJ2kN9KTmPvjj+9KN5KUBUyLrnwS4xI989/Vd Y07w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tXrfBu+sWTx3tFId65vxhTmPvBAtUywy8EP1YNaVvO8=; b=nFNyCU/NPnGraGoaByek7TDdGm1Rjs9RzrPNFiMrbDjOC5qwe/Z7R24IaJqCsvHmsc 3DydpHa26MfnLEgRHcolPeuow2nWzFQuyoX8GK/e1t3VQNWX/6+u99jK5x8XYL7o8TWh 3Qd6BnSRfWLFyO0vJK6to78wSa5xcjlbkt5mg9nTclca+frKkJfqlACYnxOf0WLpj8gv k10XI21kpmDuQOs57IiXonz24oMK2vOj4VNvk6LQ0gFn0dM5fE6gYvQSUhzDqJmhi3zg 2CDRXciQBDBhrpwJC1uKd/I6MZkxTcVlxDYajPHPTHPa5eNIY1RZNjy1mLu0PotVsAcJ YrIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lkKzERwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j25-20020aa7ca59000000b0043e037ce517si1140586edt.199.2022.08.05.03.20.01; Fri, 05 Aug 2022 03:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lkKzERwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240721AbiHEKP4 (ORCPT + 99 others); Fri, 5 Aug 2022 06:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240635AbiHEKPT (ORCPT ); Fri, 5 Aug 2022 06:15:19 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2A6BC7; Fri, 5 Aug 2022 03:15:12 -0700 (PDT) X-UUID: 821a827a7026463088f4d9fb6f33c54c-20220805 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=tXrfBu+sWTx3tFId65vxhTmPvBAtUywy8EP1YNaVvO8=; b=lkKzERwg86v4iVoda4CyTXwFOyZRukHHI7Yme9IacxGzxYo3Qo6tGchydfj8LoRLjnvN7BZb9QZSTrdmsD98l5v1GBj3k4EFxNpWP3sk+Zmecl5EjPxNiepL1xSPEIVxmD2tfkH9ubq3k66qjmTtGfwheMrOC46NvO+0pTfNu0o=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.8,REQID:176824c0-3e4f-41b5-93d7-68b743e8315a,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACT ION:release,TS:-5 X-CID-META: VersionHash:0f94e32,CLOUDID:0611e19b-da39-4e3b-a854-56c7d2111b46,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:nil,BEC:nil,COL:1 X-UUID: 821a827a7026463088f4d9fb6f33c54c-20220805 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 332287083; Fri, 05 Aug 2022 18:15:01 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Fri, 5 Aug 2022 18:15:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 5 Aug 2022 18:15:00 +0800 From: Bo-Chen Chen To: , , , , , , , , , CC: , , , , , , , , , , , , , , Bo-Chen Chen Subject: [PATCH v16 3/8] drm/mediatek: Add MT8195 Embedded DisplayPort driver Date: Fri, 5 Aug 2022 18:14:54 +0800 Message-ID: <20220805101459.3386-4-rex-bc.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220805101459.3386-1-rex-bc.chen@mediatek.com> References: <20220805101459.3386-1-rex-bc.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_CSS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Schneider-Pargmann This patch adds a embedded displayport driver for the MediaTek mt8195 SoC. It supports the MT8195, the embedded DisplayPort units. It offers DisplayPort 1.4 with up to 4 lanes. The driver creates a child device for the phy. The child device will never exist without the parent being active. As they are sharing a register range, the parent passes a regmap pointer to the child so that both can work with the same register range. The phy driver sets device data that is read by the parent to get the phy device that can be used to control the phy properties. This driver is based on an initial version by Jitao shi Signed-off-by: Markus Schneider-Pargmann Signed-off-by: Guillaume Ranquet Signed-off-by: Bo-Chen Chen Tested-by: AngeloGioacchino Del Regno Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/Kconfig | 9 + drivers/gpu/drm/mediatek/Makefile | 2 + drivers/gpu/drm/mediatek/mtk_dp.c | 2005 +++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 489 ++++++ 4 files changed, 2505 insertions(+) create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_reg.h diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig index 2976d21e9a34..e66f4a3b6be0 100644 --- a/drivers/gpu/drm/mediatek/Kconfig +++ b/drivers/gpu/drm/mediatek/Kconfig @@ -21,6 +21,15 @@ config DRM_MEDIATEK This driver provides kernel mode setting and buffer management to userspace. +config DRM_MEDIATEK_DP + tristate "DRM DPTX Support for MediaTek SoCs" + depends on DRM_MEDIATEK + select PHY_MTK_DP + select DRM_DISPLAY_HELPER + select DRM_DISPLAY_DP_HELPER + help + DRM/KMS Display Port driver for MediaTek SoCs. + config DRM_MEDIATEK_HDMI tristate "DRM HDMI Support for Mediatek SoCs" depends on DRM_MEDIATEK diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index 6e604a933ed0..3517d1c65cd7 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -23,3 +23,5 @@ mediatek-drm-hdmi-objs := mtk_cec.o \ mtk_hdmi_ddc.o obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o + +obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk_dp.o diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c new file mode 100644 index 000000000000..59fee814075b --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -0,0 +1,2005 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019-2022 MediaTek Inc. + * Copyright (c) 2022 BayLibre + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include