From patchwork Wed Nov 10 13:06:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Ranquet X-Patchwork-Id: 12612177 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DB9AC433F5 for ; Wed, 10 Nov 2021 13:08:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 04BA161107 for ; Wed, 10 Nov 2021 13:08:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 04BA161107 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=c/ssOsnylKmVL0zRht22aykBAQeOoE7C8CEi8PzRhr8=; b=O+bXpmOQhORcTD GaBjnRT7uReKvzZDhj2DymeK3nW63fO1tVLUl0vmHQjpF22fuBEQ66Jf5mDXAB3L+VcHKw1L+KQjg 2dvpiUYsuDOY2aPEm2C0OQM95KWv68WVHwun+aV5qcCEn0QMCFm6ddBs/pKAyMxq9kLxW++Puys09 DJg/pmJv3eCHxs5tX9LUjR2XcNA96u7x2wjK6/QVEHDWzHPFacMdUF/MmEorwZyz6AP2BjL9vzSQC hyPwn0JXRZqyj9GcJ4j4m73DPjbtPaX7KxVnNh5op1CknHA6Y6tj/ZBF2GtE0eCDU5JSWzaZ0yPNd OMOQSBM65SPPvmHjpF/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mknKj-005WYa-5t; Wed, 10 Nov 2021 13:08:09 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mknJW-005VxB-TZ for linux-mediatek@lists.infradead.org; Wed, 10 Nov 2021 13:07:05 +0000 Received: by mail-wr1-x42f.google.com with SMTP id c4so3901161wrd.9 for ; Wed, 10 Nov 2021 05:06:54 -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=pkEzlVe9qFWauunGqME7hIhiReMyTOCOuR6LVYvxLms=; b=8R6Gbx8++6SDeoXR3pmLYC392lxjAa90WbFwISmrYgPH882glB6TP8kDxgCd6F3hM7 5Ls9Txb39+7QFM6eElB0AW9dmN5zC7raXrB2uCk7+KC0QXZNjZgb169JUxMk8YIx75Ez pQRojQWPnN2YUcYbEgTDgzOfzB/U7i9Ax9Z1S0THdqhXfHloTrSF0hPe/blpVu4M8HHF Ixunrpt5rARud9K9PF6w2OaGsEcvtnG2P9xmyHoXK9qLCnUPCpleo9pIGtk1AgfyDpTN fUg6atzhgBMcLV2F4ou8kv7tiEPosKNruSl4TpAgW0DzYDzXQ4ZDURXj3V3uULnLNwXk 267w== 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=pkEzlVe9qFWauunGqME7hIhiReMyTOCOuR6LVYvxLms=; b=lQrw0OMBV2ckiZD8dfc69To4uV2M3yJafLsmEWOmMoSxqq/EbgFDVjwHsFj7K4WGJ6 H5uH0fecKZWm+GwWyvOoxh/0MC6FBVTFvdI+ID51ZDpOMwhAioOo3x7tmR/aoO/sRwQi yqj5nPpN8oAW2lrwy8hpb4JJkBprpuH9X4vumKMOyoE21k3gKgYgtQsWJlK3YT0E/IPO oC2uM8qnyZEA9Jl/mpYiWad29jrHxbamkh8TeNNoqDjsxnOQ8M4/O6pi4tfdvZ9agPsb x71jtOJ84y3/vNCOAvnHKHxhjzxP+46Fm5S+jVJt3rvmTiYdfjbFgfj8BH+t5AUxQKBQ FSYw== X-Gm-Message-State: AOAM532F3UT/Kc/U7ck0QFdxDmBv74WKLkdlOUHdATmJym9ilItLCKwz alQm4rZVhwTQ52XpLKclI9U5cQ== X-Google-Smtp-Source: ABdhPJyF1HWZeqXUtGKGpfBg+slSNgW9LJmEYYRhNKNDO+Cqm8+q8iKJ99o9idDCCTdoA8nL2Umlpg== X-Received: by 2002:adf:e5c7:: with SMTP id a7mr18761196wrn.318.1636549612922; Wed, 10 Nov 2021 05:06:52 -0800 (PST) Received: from localhost.localdomain (laubervilliers-656-1-151-143.w92-154.abo.wanadoo.fr. [92.154.18.143]) by smtp.gmail.com with ESMTPSA id i17sm5952175wmq.48.2021.11.10.05.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 05:06:52 -0800 (PST) From: Guillaume Ranquet To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger Cc: Markus Schneider-Pargmann , kernel test robot , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 7/7] drm/mediatek: Add mt8195 DisplayPort driver Date: Wed, 10 Nov 2021 14:06:23 +0100 Message-Id: <20211110130623.20553-8-granquet@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211110130623.20553-1-granquet@baylibre.com> References: <20211110130623.20553-1-granquet@baylibre.com> MIME-Version: 1.0 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 From: Markus Schneider-Pargmann This patch adds a DisplayPort driver for the Mediatek mt8195 SoC and a according phy driver mediatek-dp-phy. It supports both functional units on the mt8195, the embedded DisplayPort as well as the external DisplayPort units. It offers hot-plug-detection, audio up to 8 channels, 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/drm_edid.c | 2 +- drivers/gpu/drm/mediatek/Kconfig | 7 + drivers/gpu/drm/mediatek/Makefile | 2 + drivers/gpu/drm/mediatek/mtk_dp.c | 3094 +++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 568 +++++ drivers/gpu/drm/mediatek/mtk_dpi.c | 111 +- drivers/gpu/drm/mediatek/mtk_dpi_regs.h | 26 + drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 + 9 files changed, 3799 insertions(+), 13 deletions(-) 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/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 500279a82167a..bfd98b50ceb5b 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5183,7 +5183,7 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, * modes and forbids YCRCB422 support for all video modes per * HDMI 1.3 spec. */ - info->color_formats = DRM_COLOR_FORMAT_RGB444; + info->color_formats |= DRM_COLOR_FORMAT_RGB444; /* YCRCB444 is optional according to spec. */ if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) { 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..83087219d5a5e --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -0,0 +1,3094 @@ +// 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