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: 12751595 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 7D17CC433F5 for ; Fri, 18 Feb 2022 15:19:30 +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=/2t7rtIG+ViAz8YF/hnowbMLMpwrWLrYS+AH6dH1PAg=; b=ACaqqFVsVv4/vQ HEyWt/Yoz0Sl73u3bvN4ApS4p1c9EUKfgnclSGxCWMYFXSw1zmfCatp/ZHDHR00lTwfysjhQhwEEo 2Xn+OpuNZsUV+o+/eqfwQtjXZSCFYGJ6U3ic9shhwibDOP2arf9/q34T6N+8ZJmhSsMV8UUq+81Va oq1aLQZCAzTkOcdeC7OePXT6M5enews3jOJVeB1lJKgOcXluuyupiaGTjJ27K6bp1QwVh9nnFNLlm tgXBZaLLi/lvdhAtly3AGwgPAgc08Cjkgb7JvVHtWEUzSbg0nSMah5OCcn2SPuL9gl2YDbigkA3NM Z8wtdeMcSs5jlkscNQbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL50m-00F2SV-J6; Fri, 18 Feb 2022 15:17:33 +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-00EsOc-ES for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 14:56:50 +0000 Received: by mail-wm1-x341.google.com with SMTP id k3-20020a1ca103000000b0037bdea84f9cso6616954wme.1 for ; Fri, 18 Feb 2022 06:56:31 -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=WPusBS5/Qn2Yn+rGE6v8ajZBv+HlcledXx0CxFKX7f/UHIgf/9z5ETyJ8GQMxz3Zo7 e6ZgugsdyBbpDYl0Z7gIq9gTtWSUlSoO0JyzhJtCl3aR2HusljUj6ucfJbIhjQoveUfd 5TSvfd02E2NtPTPC1YJDDqTStHQTuTCO2NIgh/rsmJbUwO2os4Klxa1oq77DX4dXePaI C2IKSc2uXggc9+Gua5DFW5pdIa9seG7kqcAOlrIF//SrisWtzE89V3Bzv85sWK6d6CVo Obm62SjzupOF7AuhQqfv9rQhJBQx+TtcYAK1IR42fZ7loqV4ZBXOC7RcwXLC6SJROoCN fx9w== X-Gm-Message-State: AOAM531Cn7BhoLvXeTqf5QiLLwWqMfVfw3KozDYIJMGfQF4bItDoUtkP oXP9nAbD3yiqgCKeyrMP0MDEpw== 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_852557_180BF79A X-CRM114-Status: GOOD ( 28.85 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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