From patchwork Fri Feb 18 14:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Ranquet X-Patchwork-Id: 12751584 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 D898FC433FE for ; Fri, 18 Feb 2022 15:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7MtdBm4DZTU86+/ldW1e+C784kQbA2nKjFb5ZDayM0I=; b=MFstcC1zyC/XWL DHCckndjAXVjnIrlWJH6hS0oqxK21fl34OpzhWVSPqrouEVIaIxLNAXQ8xYA76CPeFS6E/8Znhb97 np9ZGyAl6AEB++7jPFaS3Rty61XE4HJobOlpszLVzGnIBIfPk7Wo9LGgjLWDSw3bpxhYYDtZm3nB3 kU7OmsvrmIKdBB+pmrIZeeT12+z5lDqmShYQ8YXK2S5rVz1OiXbirLQ3/TXGmBMS8PvihjlfMmPvQ YKPnNwXnG2qI+NRTLzCET1E1zZq2msPgpK4mamdUth5FbMFSke8shRw2n7o0k5ZPJr/vLD5pqsf+w NeVxMbBaGtxjSAkIj19w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL50f-00F2QW-6l; Fri, 18 Feb 2022 15:17:25 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL4gT-00EsOe-EP for linux-phy@lists.infradead.org; Fri, 18 Feb 2022 14:56:50 +0000 Received: by mail-wm1-x341.google.com with SMTP id i19so5408615wmq.5 for ; Fri, 18 Feb 2022 06:56:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pNtYQ1NW9bgMsck7uEE80Ot9MecVkmXTw0bgiCTpcoM=; b=nSBiQn7Mfd16j/2beXMfkG2ybwxldftfXm3yzgNGqw8ezPhXtxOpTekhI4WyHbu1DC SOWFFQVM4op6Q0kr0NOcDgtIsgT/uvgDWuMwFcydZsXTVfCumgpANUzeREXjQO3/rO/k OHFeApylTQR/qY2+W7ceqrOyqHR2E10MbSrlXTT90EjhDfFjbsO87mB0/1TlfzTz4qsc t+NfqWnNQzJpjWK1t7JAetvmLVRceKpBeIl7GPHehci9Ps0GZcNuAWY8PZwjx/m5Yn9o OdG4xjVzInM7pqN/pF2tJLNn2jtsf1eevn4zMJMdM0PVX8t6w0V+CCJ2Irrc6IYKu7Tg NpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pNtYQ1NW9bgMsck7uEE80Ot9MecVkmXTw0bgiCTpcoM=; b=T5TjCVa3fQNCc3wcCLY6OsVSykCz6a1mLjKpBwNnoHpunQgaDI098fkepKI5SjLw11 DOXgTJagygsx5em5zDMIrewpK3lRlfY0GU6WVvN3DpUNtGIzPh5zBHztw+cOgbihy7VL m+Q80HooRkMtLsPI9M/zOBzNaIxacBSk/zXYKfaCadxxr7OaVdxWh2JjRlzAyjYJYCEq da88olXYNETnJ+XGBsk2ASBSri2pU+MFk7fpK5EKwyafuSDJIhMr8CqbXHLtkPs8aO1v ZD6MQWvX5aKbhX/4ios2Zhca6c+gLYULoSJ/3WFhGq8bgXXJfgAJD6GMK2S9a3rdqRf3 ohmg== X-Gm-Message-State: AOAM533CIiyZAGefhCUBjO4Qf2Uh7/se9JneT9tLKdnY6O2OD6K6OHjq 2WeO1Wi56KDwNwv1dX01pTfZGw== X-Google-Smtp-Source: ABdhPJyvo+b5+QA2e8LIHv0Uf/gFIz15SR24+HMRZDjiBiDxgzTHtblAHhPCc+vMlxpJTgB6NaMlrg== X-Received: by 2002:a05:600c:4f83:b0:37c:d057:3efe with SMTP id n3-20020a05600c4f8300b0037cd0573efemr10819492wmq.143.1645196190327; Fri, 18 Feb 2022 06:56:30 -0800 (PST) Received: from localhost.localdomain (2a02-8440-6241-3b28-3074-96af-9642-0002.rev.sfr.net. [2a02:8440:6241:3b28:3074:96af:9642:2]) by smtp.gmail.com with ESMTPSA id b10sm47431454wrd.8.2022.02.18.06.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 06:56:29 -0800 (PST) From: Guillaume Ranquet To: chunkuang.hu@kernel.org, p.zabel@pengutronix.de, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, matthias.bgg@gmail.com, chunfeng.yun@mediatek.com, kishon@ti.com, vkoul@kernel.org, deller@gmx.de, ck.hu@mediatek.com, jitao.shi@mediatek.com, angelogioacchino.delregno@collabora.com Cc: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-fbdev@vger.kernel.org, Markus Schneider-Pargmann , kernel test robot Subject: [PATCH v8 15/19] drm/mediatek: Add mt8195 Embedded DisplayPort driver Date: Fri, 18 Feb 2022 15:54:33 +0100 Message-Id: <20220218145437.18563-16-granquet@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220218145437.18563-1-granquet@baylibre.com> References: <20220218145437.18563-1-granquet@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_065633_888310_24CF49CA X-CRM114-Status: GOOD ( 27.23 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Markus Schneider-Pargmann This patch adds a DisplayPort driver for the Mediatek mt8195 SoC. It supports the mt8195, the embedded DisplayPort units. It offers hot-plug-detection and 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 Jason-JH.Lin . Signed-off-by: Markus Schneider-Pargmann Signed-off-by: Guillaume Ranquet Reported-by: kernel test robot --- drivers/gpu/drm/mediatek/Kconfig | 7 + drivers/gpu/drm/mediatek/Makefile | 2 + drivers/gpu/drm/mediatek/mtk_dp.c | 2358 ++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 568 ++++++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 + 6 files changed, 2937 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 2976d21e9a34a..029b94c716131 100644 --- a/drivers/gpu/drm/mediatek/Kconfig +++ b/drivers/gpu/drm/mediatek/Kconfig @@ -28,3 +28,10 @@ config DRM_MEDIATEK_HDMI select PHY_MTK_HDMI help DRM/KMS HDMI driver for Mediatek SoCs + +config MTK_DPTX_SUPPORT + tristate "DRM DPTX Support for Mediatek SoCs" + depends on DRM_MEDIATEK + select PHY_MTK_DP + help + DRM/KMS Display Port driver for Mediatek SoCs. diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index 29098d7c8307c..d86a6406055e6 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -21,3 +21,5 @@ mediatek-drm-hdmi-objs := mtk_cec.o \ mtk_hdmi_ddc.o obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o + +obj-$(CONFIG_MTK_DPTX_SUPPORT) += 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 0000000000000..5b60293ecc0d3 --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -0,0 +1,2358 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 MediaTek Inc. + * Copyright (c) 2021 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