From mboxrd@z Thu Jan 1 00:00:00 1970 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 85A82C433F5 for ; Thu, 21 Oct 2021 09:30:23 +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 4A07660F9E for ; Thu, 21 Oct 2021 09:30:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4A07660F9E 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=/OCYdVeQJ9CkEcWZ3sP8C0LX1TrwsbaM3a2Kzyx1/Hk=; b=hYp+3o9cRpS9YK KbLfJ+CriVcXVo9Duvgdc4m8YWv3i/eYUWy1X+JUWZ38I/Fg8cNI9oYBc4r0B4WMs+JwALo/tflaT l6oqpTmF7IuwrEbRxcUPd3kQyq9CSxyWpK3BSiEP027M8Kig6vdmKIbd1viLUnwqk3GVRttIHKTqo fj3P3jYWFqdkHh3W6giABAMCu6jmWzMaKb7SaJg5P9koswsoqeBLzrtUTOon1uQi5aZwe3ZKBBy5k 0MfLwt7VTboE9mKqtuQx5b099Op9wTOPgXPTtEWJfRZMfGwg9YkMl4mPlsANcfWCCtcLPP+EcSJtt gx0iPazZRWpAW3F360yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdUOl-00725e-On; Thu, 21 Oct 2021 09:30:07 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdUMO-00710Y-PO for linux-mediatek@bombadil.infradead.org; Thu, 21 Oct 2021 09:27:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=oxhFBOGZmgRXPor6lbkAlyiOraW8VoAcP/2tZEuRZ/c=; b=NEBXVjecfFewbUUkr1e4icze5n +zhIX8/f4W/UyVzScTOyiP8gbqZMFHmnFTxxreuFvq7CqvsypQb48bwMZNN2awsAJZONJ3HYWxFjD T54TPCAHI3CxnWi3JFI2I1va+itiPTFVXF4RprJR9iQJC/LIm5iBCYLEsaCZiqmfuynVGpcBdSzHX Fl8Cnckp2NMNR43jgQSr7Z9DKYzvCyuLrqtKeEm156GkqBxEbJ30bOfdo+pXH7YJ+hS21kIQfIqe3 ScdNJhouXewhAQ95bTre0rkmfy4TCLDyRu1dEoDMVoMSwRyVVq8nHGOGGsRKgL+Km296AFMD9qO04 Czcc1ExQ==; Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdUMG-00BHI2-Vc for linux-mediatek@lists.infradead.org; Thu, 21 Oct 2021 09:27:39 +0000 Received: by mail-wr1-x434.google.com with SMTP id g25so53488wrb.2 for ; Thu, 21 Oct 2021 02:27:32 -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=oxhFBOGZmgRXPor6lbkAlyiOraW8VoAcP/2tZEuRZ/c=; b=aeDiMja1rOjQi8pIm6eTaxCekuqU/2mGjpuau/PB+Jj6za5O2NBkLn1cM9tO6A+wjy unt4Dm5U7p1nOfV1diJbDKx9AxTl1khL71VjlfoBVtlyKiwOt5FKVIkI+eJ3/DqCTho3 kqWU8nLPQdjShudL+MhtQIuiM2GLjJ9M86HdFLxuxbIKfi5EqS8mPEIWWyoOcagkBMrG mMwny+I4T/5xf2YD7a07G1OLnE11okNO4+YK2yZhgHsZtUYJ+i96dfHuw0Aj7jiXm3FM nDofBAdE64u18PFU95yPzikODQheCpPA4Wn5T+SGoIUSnHkjyGIwC1XUTAZV8zlPmSgF lIOQ== 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=oxhFBOGZmgRXPor6lbkAlyiOraW8VoAcP/2tZEuRZ/c=; b=4n5s7NMbn1rfj2xdKRqLMwLjj9cwtGX6iPf7KFi9EM9N1ggOnLTAsrwSE6CHAYtAIV O+V0/V5duy0o1y61b8YITloCo2e52+NqguGJ2vw3bR2Wva4uDqMq+PJuebEY635CKXtm J/673ghv3lA98BMwq3aB2bFIv5k5b6SCAyd1uf3yohUk4T8ycr8bcE7rFA8sHEVG4vfT 2GvyfOzwEGsw7dDFx1zarAZfVIhp3brYhqLQ5yRC+AMeT6i6e2z38owbPEm6OlZir6Kw 9EaTjeQRHoyG8Hq39zZBM3iUep5E1RBtnLAjjY6qt8CY2qR9wvYhM0xJrFv5Zr8Riw3b yA5A== X-Gm-Message-State: AOAM533MQqjE1Qbiqd8tei4fEhKZt7DmLjhHZjwXaddZbdsXuxU1bI/L Bgknt7AzoFG2cuIjij0UvQIzCA== X-Google-Smtp-Source: ABdhPJwyqTzaCN6XidyxWnZOiDWd9DYeAitY073k8ij+wqJVyJT4zmyMTzEfjN0+1wNOje2pWnl9tA== X-Received: by 2002:adf:d1c2:: with SMTP id b2mr5989101wrd.73.1634808451233; Thu, 21 Oct 2021 02:27:31 -0700 (PDT) Received: from blmsp.lan ([2a02:2454:3e6:c900:5142:5fbb:5821:5dc3]) by smtp.gmail.com with ESMTPSA id d3sm4538468wrb.36.2021.10.21.02.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 02:27:30 -0700 (PDT) From: Markus Schneider-Pargmann To: Chun-Kuang Hu , Philipp Zabel , Rob Herring , Vinod Koul Cc: Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH v5 7/7] drm/mediatek: Add mt8195 DisplayPort driver Date: Thu, 21 Oct 2021 11:27:07 +0200 Message-Id: <20211021092707.3562523-8-msp@baylibre.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211021092707.3562523-1-msp@baylibre.com> References: <20211021092707.3562523-1-msp@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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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 --- Notes: Changes v4 -> v5: - Remove edp_tx compatible and rename the dp_tx compatible to dp-tx. - Detect whether it is edp by checking whether a panel is present. Changes v2 -> v3: - Solve TODOs and add defines for undescribed registers - Remove TODOs that were irrelevant Changes v1 -> v2: - Fix checkpatch --strict suggestions - General cleanups of the code. - Remove all remaining non-atomic functions. - Remove unused includes and sort them. - Remove unused select GENERIC_PHY - Rename phy registers DP_PHY -> MTK_DP_PHY - Replace usage of delays with usleep_range. - Split the phy register accesses into a separate phy driver. - Use a lock to guard access to mtk_dp->edid as it can be allocated/used/freed in different threads - use struct dp_sdp for sdp packets. Changes RFC -> v1: - Removed unused register definitions. - Replaced workqueue with threaded irq. - Removed connector code. - Move to atomic_* drm functions. - General cleanups of the code. - Remove unused select GENERIC_PHY. drivers/gpu/drm/mediatek/Kconfig | 7 + drivers/gpu/drm/mediatek/Makefile | 2 + drivers/gpu/drm/mediatek/mtk_dp.c | 2813 ++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 535 +++++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 + 6 files changed, 3359 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..029b94c71613 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 29098d7c8307..d86a6406055e 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 000000000000..d93adab2d3c5 --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -0,0 +1,2813 @@ +// 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