From patchwork Mon Sep 7 08:18:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11760149 X-Patchwork-Delegate: neil.armstrong@linaro.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7984013B1 for ; Mon, 7 Sep 2020 08:19:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3DF8B208C7 for ; Mon, 7 Sep 2020 08:19:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Oj/RoRSE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="G6mAebW2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DF8B208C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=21+ZOwk8ogNbljMDeoW0CkRXK9phl5mI6rvFdUH4Zsw=; b=Oj/RoRSE35N3JNyR6dLiqyvQB ZHRwvAuvS/XcLqK8kjMsutcBtWNsb10G4N+eXgW73rJB0cr3yoW8LQdCKZK4Z6v9aaiGjVTxX8v48 rZnB94i3FgSDs94yNzQPMFSLC76bZUb5j6hKZBhmquK8ysuLJ/ftR3aRWJwji5wAswMIoHJr3jxbW O42kGEfKLNrCJabckbtSjFkdYl5RzoTbX2u7S42jV18tphaNhGsat1/U3B03i5ky80P+RbNBZwQ75 ZbfgYJYHy2VwOQ7ikngN2osFiDCg6oN+ZKmLytTC7r+c90+96KotjpQ0DRAKiJQsE4L4y9Z/zpSp3 uot03iJuw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFCMV-0001BU-Um; Mon, 07 Sep 2020 08:18:52 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFCMK-000142-2z for linux-amlogic@lists.infradead.org; Mon, 07 Sep 2020 08:18:46 +0000 Received: by mail-wm1-x341.google.com with SMTP id e17so13486548wme.0 for ; Mon, 07 Sep 2020 01:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e1VQdJ3NOg+F1fNjmsoEY2AtaPcKRKUAySHUYDX+C0s=; b=G6mAebW2gw11g8L5gRnfzmR/vmbKgniPmtnNOrsPRyqwZ+ryQw3XQOEFBS//C2Z1sm yXwLe9y4ANiiYum8CUaUg0oIvR8JsvACsCU31BTMhZKhuCj7Px7+uvwu3PIoAhSnNef2 LKjt1eCC0am4jhmIxWOp4nMoxAlqKm1EuP3uSCWO49n9X7nbdOkbr+yCWwOv+eHCN3fh 1BCNmdKHuZShWkeCzhJaivRw8odahnn5Fint2bH8/HdGJCGGbip16uddxHx5xLZPBx9f JnzhHjFJRLlnnc0zU9CiMqzDZ88YFUZp0L6raL5P5QDm3yh/8pJTQ7EMCeRaYRhlY1vZ f12g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e1VQdJ3NOg+F1fNjmsoEY2AtaPcKRKUAySHUYDX+C0s=; b=a3SwT28PTxLMYJHOOC3loDJqEDdXOFI+5blpNv+i7YQPTUPIBifyb0FbMCKdx2fVgj 1lF7i3eFBXxzrt2N62MHPMbDRnHeiairmMKltZ4n7pgu1KgzfAngMwACKfGoBeNC+Ebe l37FoQrwW1mJ1ZrIdE9ActAcOoB6+ZghCZCa9i3/ViGpDMNmsTe/+OOHfalgoULuOd+q JM3WZfBbYM35VNysbXqDbcwfCpU1d2lhdBH6HteyKG64BA8pYtPj/+jceRCL0c2u0ZPD MkGyCG2u6MQHr1LOgxiOyeltIGoH0aDuit4q1Nleu9IBfcyC6jA1vEPOb4Lf/7KGXp+M tIBQ== X-Gm-Message-State: AOAM531JAKloxRUru9DALpgRu0np+MUCH27ess4vEwkMEQ9fv0p8Fe4r zfx2BSSz8F9y/myl/WwVf6VUMYk/gFTHuRBw X-Google-Smtp-Source: ABdhPJyjVh9SCIYRWU7ndlYpRLrZd12SUvlD8dTzCVwJChJae4CKmsg31bej9jedn5SiRE0pofVEDw== X-Received: by 2002:a1c:7405:: with SMTP id p5mr19495012wmc.35.1599466718934; Mon, 07 Sep 2020 01:18:38 -0700 (PDT) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:5405:9623:e2f1:b2ac]) by smtp.gmail.com with ESMTPSA id q186sm28032205wma.45.2020.09.07.01.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 01:18:38 -0700 (PDT) From: Neil Armstrong To: daniel@ffwll.ch Subject: [PATCH 6/6] drm/meson: add support for MIPI-DSI transceiver Date: Mon, 7 Sep 2020 10:18:25 +0200 Message-Id: <20200907081825.1654-7-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200907081825.1654-1-narmstrong@baylibre.com> References: <20200907081825.1654-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_041840_370611_568B43FF X-CRM114-Status: GOOD ( 25.05 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Neil Armstrong Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The Amlogic AXg SoCs embeds a Synopsys DW-MIPI-DSI transceiver (ver 1.21a), with a custom glue managing the IP resets, clock and data input similar to the DW-HDMI Glue on other Amlogic SoCs. This adds support for the Glue managing the transceiver, mimicing the init flow provided by Amlogic to setup the ENCl encoder, the glue, the transceiver, the digital D-PHY and the Analog PHY in the proper way. The DW-MIPI-DSI transceiver + D-PHY are directly clocked by the VCLK2 clock, which pixel clock is derived and feeds the ENCL encoder and the VIU pixel reader. An optional "MEAS" clock can be enabled to measure the delay between each vsync feeding the DW-MIPI-DSI transceiver. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/Kconfig | 7 + drivers/gpu/drm/meson/Makefile | 1 + drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 562 ++++++++++++++++++++++ 3 files changed, 570 insertions(+) create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig index 9f9281dd49f8..385f6f23839b 100644 --- a/drivers/gpu/drm/meson/Kconfig +++ b/drivers/gpu/drm/meson/Kconfig @@ -16,3 +16,10 @@ config DRM_MESON_DW_HDMI default y if DRM_MESON select DRM_DW_HDMI imply DRM_DW_HDMI_I2S_AUDIO + +config DRM_MESON_DW_MIPI_DSI + tristate "MIPI DSI Synopsys Controller support for Amlogic Meson Display" + depends on DRM_MESON + default y if DRM_MESON + select DRM_DW_MIPI_DSI + select GENERIC_PHY_MIPI_DPHY diff --git a/drivers/gpu/drm/meson/Makefile b/drivers/gpu/drm/meson/Makefile index 28a519cdf66b..2cc870e91182 100644 --- a/drivers/gpu/drm/meson/Makefile +++ b/drivers/gpu/drm/meson/Makefile @@ -5,3 +5,4 @@ meson-drm-y += meson_rdma.o meson_osd_afbcd.o obj-$(CONFIG_DRM_MESON) += meson-drm.o obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o +obj-$(CONFIG_DRM_MESON_DW_MIPI_DSI) += meson_dw_mipi_dsi.o diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file mode 100644 index 000000000000..bbe1294fce7c --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,562 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2016 BayLibre, SAS + * Author: Neil Armstrong + * Copyright (C) 2015 Amlogic, Inc. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include