From patchwork Fri Jan 7 14:55:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12706743 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 87740C4332F for ; Fri, 7 Jan 2022 14:55:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4722110EFD9; Fri, 7 Jan 2022 14:55:33 +0000 (UTC) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F2B110F3C4 for ; Fri, 7 Jan 2022 14:55:32 +0000 (UTC) Received: by mail-wr1-x42d.google.com with SMTP id o3so11494928wrh.10 for ; Fri, 07 Jan 2022 06:55:32 -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=pzoT4uBARSTciniXV6I1chJ+/OGuZxriWS/QZA1r+K4=; b=5Nr95cLvamYOyqFPjaEN+Vht0wC29fjiSelX0XY106IzMtLnlbX5v1MXJp4/57P/4n 6NzWlrKAK/K/ij6wDonoewx4i63cyF8tebuxlJPlCGxlIfKTuEKOwZ4NAo71RzbBVWp9 r/0Y66+J6Lt8UZTyGrtiCn0p74+qtYhS6xCXPRwizX+ch3rLbw5H9oxHrBAHjl+AnvqW dKdx5ClSpzKVLZlWj+r06j1E0vL7jKlM68BPo7G72naRTssOZAPoQg46SihoZ0JjSBav Q9lY7yq/ewxlB24G2EkZIgWl8iu4NjobwiZzrn8/u9uRE49oyKTM0n2didFnqNFPGEuy rcYA== 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=pzoT4uBARSTciniXV6I1chJ+/OGuZxriWS/QZA1r+K4=; b=7dpaTEfYym8+k98JLMqRjojtr2RA+P0iS3keZWgmmTg7GkmyVTuGP5uP0YA3iM/Uh3 zI918SKUbCNeY7U7HXHab5qoAZqCYWbd2+XvOTLacSN2LXhQuemI+KWeySjcRe3aMw8v ao/rfgIs8pubTkRy5NsynBLBcGpQaybcOAWgUn7lQJKdN/25gAzi7zHf2QeFhtyLyqg5 5dPB5okzf+ZVz4q3t37r9hWBoVdVgyLsKrfOCSIOjcCyhG62dHv0UiSr88ntbasJ0EVO IFqT2DPLW98SonAa1ILXY2NT4PT3XgZRsbYVTtMDQWOLTTzkUlqzVoXI0b48tQNbQM86 lI9g== X-Gm-Message-State: AOAM531xKIbeDjNpKiD5rFIEPNCyTuZK73Di8kPJ7fHpKzf02Bxbb/CO swGr0R9qiQfjkutkrl6Gf2jdOftpF+1Fig== X-Google-Smtp-Source: ABdhPJzRpwEHcs/4uINEOK7EWbL2AgvKo5unG/LrsX5YMLow+35BdHfblZyQ4HlFRm0sTsVikscRdw== X-Received: by 2002:adf:f94c:: with SMTP id q12mr14398846wrr.166.1641567330526; Fri, 07 Jan 2022 06:55:30 -0800 (PST) Received: from localhost.localdomain ([2001:861:44c0:66c0:fc89:e826:8938:cbde]) by smtp.gmail.com with ESMTPSA id n8sm5594492wri.47.2022.01.07.06.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 06:55:29 -0800 (PST) From: Neil Armstrong To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/6] drm/meson: add support for MIPI-DSI transceiver Date: Fri, 7 Jan 2022 15:55:15 +0100 Message-Id: <20220107145515.613009-7-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107145515.613009-1-narmstrong@baylibre.com> References: <20220107145515.613009-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Neil Armstrong Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The Amlogic G12A/G12B/SM1 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. 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 | 383 ++++++++++++++++++++++ drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 115 +++++++ 4 files changed, 506 insertions(+) create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.h diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig index 6c70fc3214af..71a1364b51e1 100644 --- a/drivers/gpu/drm/meson/Kconfig +++ b/drivers/gpu/drm/meson/Kconfig @@ -17,3 +17,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 833e18c20603..43071bdbd4b9 100644 --- a/drivers/gpu/drm/meson/Makefile +++ b/drivers/gpu/drm/meson/Makefile @@ -6,3 +6,4 @@ meson-drm-y += meson_encoder_hdmi.o meson_encoder_dsi.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..75af3eec1b74 --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,383 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2021 BayLibre, SAS + * Author: Neil Armstrong + * Copyright (C) 2015 Amlogic, Inc. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include