Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1807461ioo; Mon, 23 May 2022 03:55:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvJyN6xhIp1iS9EYKUmaxJcZXRB+QgSwGfNo6KcfzglHiRvZe2p88iANqEraYoNUr6sCr/ X-Received: by 2002:a17:90b:1613:b0:1df:23d0:cf75 with SMTP id la19-20020a17090b161300b001df23d0cf75mr25849901pjb.88.1653303309266; Mon, 23 May 2022 03:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653303309; cv=none; d=google.com; s=arc-20160816; b=S1Y+ZR1GGr//+VqLlUoZN8yEzm7NKTAVRqoHbTu5KKcoC/ms1rZX6GgnD/FcWW2fe8 ZMhIsyPhXpf0Cm3o2tNBhN8ERiw1TKQ6E2nVH6uDNSPNLxnzmKOw0kRiHa9t3B8bocAR DBn5xafaDD49Q0Bgt07GIgM1Myd5YRZ8rd2Op+WFNcB7n7nBPljrYNQyEZ1KHV+wiEw9 d7EY1zL4EsRn+5DaPRooL8Mu9EVRC/mQCNNPeh+ijJZgrCryAgtVXsp4oLL2OA7WqH4V 8+9/TbEPgFLHSu95BIHkLzWuafngOZCA8Jq1RLYh2Fkl7uY++RrkTQ8EQQcZ3ds8y+oC ssKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=D24UX7E5uee5IV3EylV55NJWU1Qz8GiktXXiCLoiGrM=; b=KOa75vKpGUft0mh/SemIAGdclpQ4Qq8NMlcNb0YQgPseRow9x4pa0Igz7ZQhPVKLjF WI/Vv8nfjp3NHlmXU2jsbIeXHZf+FHjnc/CBIb0n5E7WzE2ljN5lDavigER8UIVQsg0k 6+ey2Efa9hIhiReuX3K32WSZrxlDOdUpYduNkoWZcvOBjycY9M7RrxoYdfPHYZCIjfQl sNSgKrYOP49LIoRvr/Ll/QRQXRpij2EXYsRjKTSyvK3rws/GdboxRPPq1su4Ddyz27x1 nXrBVYmIjQP/ef2ybMJsKe8mCCdhmi1D9pagCSh+WxdRu4/gm0DGXGFdfsQrmF5vIZAs /Wqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=txYtquuI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ct27-20020a056a000f9b00b0050e0b4a4721si11852900pfb.277.2022.05.23.03.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 03:55:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=txYtquuI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D77704EA22; Mon, 23 May 2022 03:53:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234703AbiEWKxY (ORCPT + 99 others); Mon, 23 May 2022 06:53:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234659AbiEWKw6 (ORCPT ); Mon, 23 May 2022 06:52:58 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D93FE2FE60 for ; Mon, 23 May 2022 03:52:05 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id f2so20796320wrc.0 for ; Mon, 23 May 2022 03:52:05 -0700 (PDT) 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=D24UX7E5uee5IV3EylV55NJWU1Qz8GiktXXiCLoiGrM=; b=txYtquuIg6uUM+kujYR8ednuwK6dJL9Kxt74XjMjKoK5cz1BtOdryyqWPB4mMUYz7U bt7VIVv9Nw34l4/GFGhliygooRo+LjZrXC3IltDjP+hdP90AgSfN+76etDFoZ6DF3Cqi Kt3vndVRrqPNiRTrBkrK1EHrzFABpiVfuSw00ekpkpRV/HysUA76yLKNam7JteQGaJDQ zRdkK0mdnVNnIbBGDKpgRdkS51FvcG8mtWWmHQbkjox3NinXyHbnw7CuDD0y5miXuF6t m4vzbsdauv1oy0wp4eO/aW+5NWRTQdRpTVzDlqdTuLd7x7R4VV62Q5v2EzKBPaoFvPYN zQqw== 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=D24UX7E5uee5IV3EylV55NJWU1Qz8GiktXXiCLoiGrM=; b=nFse9YTVl0kIoO/Xy+VjQlFOAV0qjsVWpzEsu1orJUUqxeepKe3SXYTJ3DPa4oa24Y klD+sYWPktSEcAbv523RSuUPnt2aFYzizXG6ZimpRQeAbrAW4MA/zMtZ43HvyXhl36KO p0ZtOCHvDEqEa4S7MWLcBJujfgaeACSua8vZ9p4OCkp2jWpaVbhvbGXEjJZCbyQE5C1V O/ZSya8IH5Cm7WoBu+lttmBIUo9VXZIDEyIoCrcdgmGjr7HhyX7LYT+n6/sCjvf0W5ey UvGiuXuRXhRxGGhG9TeZEQDRlV2xIRDVLBqMN4WIAFBQxaHK2aHOB1ltVoitKHKK3m/r 6Z6g== X-Gm-Message-State: AOAM531xMITYJnUgeNRJC8EWsPASElDVpQYX2YhWxQo3txm+kOSIRY6w 3NuHfgHRqcpHEVtIwe8Sp8w2CA== X-Received: by 2002:adf:f584:0:b0:20d:431:27f8 with SMTP id f4-20020adff584000000b0020d043127f8mr18649480wro.577.1653303123491; Mon, 23 May 2022 03:52:03 -0700 (PDT) Received: from localhost.localdomain (2a02-8440-6141-9d1b-3074-96af-9642-0003.rev.sfr.net. [2a02:8440:6141:9d1b:3074:96af:9642:3]) by smtp.gmail.com with ESMTPSA id n11-20020a7bc5cb000000b003942a244f38sm8453607wmk.17.2022.05.23.03.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 03:52:02 -0700 (PDT) From: Guillaume Ranquet To: Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Matthias Brugger , Chunfeng Yun , Kishon Vijay Abraham I , Vinod Koul , Helge Deller , CK Hu , Jitao shi Cc: Markus Schneider-Pargmann , 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 Subject: [PATCH v10 18/21] drm/mediatek: Add mt8195 Embedded DisplayPort driver Date: Mon, 23 May 2022 12:47:51 +0200 Message-Id: <20220523104758.29531-19-granquet@baylibre.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220523104758.29531-1-granquet@baylibre.com> References: <20220523104758.29531-1-granquet@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,VFY_ACCT_NORDNS autolearn=no 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 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 Jason-JH.Lin . Signed-off-by: Markus Schneider-Pargmann Signed-off-by: Guillaume Ranquet --- drivers/gpu/drm/mediatek/Kconfig | 8 + drivers/gpu/drm/mediatek/Makefile | 2 + drivers/gpu/drm/mediatek/mtk_dp.c | 2570 ++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 570 ++++++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 3 + drivers/gpu/drm/mediatek/mtk_drm_drv.h | 3 + 6 files changed, 3156 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..a37b6ec9f01e 100644 --- a/drivers/gpu/drm/mediatek/Kconfig +++ b/drivers/gpu/drm/mediatek/Kconfig @@ -21,6 +21,14 @@ 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_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 3abd27d7c91d..d4d193f60271 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -25,3 +25,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..8eb17ae82bfd --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -0,0 +-2,2567 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 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