From patchwork Fri May 12 13:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 13239264 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 CE9A6C77B7F for ; Fri, 12 May 2023 13:12:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8AFA10E6AC; Fri, 12 May 2023 13:12:10 +0000 (UTC) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B6A310E6A0 for ; Fri, 12 May 2023 13:12:05 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3077d134028so5827553f8f.3 for ; Fri, 12 May 2023 06:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683897123; x=1686489123; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mZ4HWLy2uhOnhQ1Gf2nv5BJ+8vgTd2p2II4LszbMfAk=; b=le9+Ga3OayuDIVZkTMHEm7LpRBC6VzEAVia8Vg6f4vZ1l9bvUAn1irfn/5gZDgh3d1 JJ+Qv5jC0Hsey6ywDN1Ndi/sv7sUw3oBuUWClWjVByf7lxvtPpsvBpBXDHszkGXZ7T2v 1lxRhneGO51Y9j1siMp6Tn6vTIxGYyuviiP3zM8gW6VV/HpOOnKxskMyP5eMdqjW2PGo JUYBIF+hsaZqTb4X2+Z63Or0vD5Z/JQ9hgRQRemARqsMoUs0pLS4L1eCEf5YGEizVbGw W3v3Ak6JweZZr51xlHTcA09xRAckW8LVeKhkC7bP/2h4s3nBvXYDjkdRtKDjg/DN3HWn H/2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683897123; x=1686489123; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mZ4HWLy2uhOnhQ1Gf2nv5BJ+8vgTd2p2II4LszbMfAk=; b=QNqwThg8S0QwrXH+e6iyj/VMS5nppu+FxV1qGHY4GebTAH8JtNvOds8Xdu026AV5yQ G+QSLAnZX6juGhYkStd6xJSU/mKTQJ/50+TRuBftGPgFjMg0UAQN2RdK/FqqQL/Tfce4 wOawwo/Ah7lcdrUjxTMzdadPN/4bgRUoMpsUcufvY0M0yTkHapVEs0b0jnWKDq709Moy T+SUDcROpprTSiPoAc/vLy3psiGJLnpGUlfDQxq9d7MlORR1am4SFNHlx2AJKh46VkXA tMMa1e0Vq3sxwACKTITcovDelMMs2CtWlBMtxzxVJMeGVnlwIsQZBViEDHg6bukKltCI 3lpA== X-Gm-Message-State: AC+VfDyL6Vbe79nuDd2eicerxB5080ZhOwshN7lt46vJXPCzhdwvYHhe 1pX40d9q15s12cdHsa3WIO12Qw== X-Google-Smtp-Source: ACHHUZ5E4NNhrqinjsftgSnWYhoVcyBr84rOaDaF5SMWtPGOyMZOFk7KY2fmK1i8s92QH0PxygCWLg== X-Received: by 2002:adf:f1c6:0:b0:2f8:5d92:aa12 with SMTP id z6-20020adff1c6000000b002f85d92aa12mr19380448wro.66.1683897123222; Fri, 12 May 2023 06:12:03 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id v10-20020a5d610a000000b0030647449730sm23461965wrt.74.2023.05.12.06.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 06:12:02 -0700 (PDT) From: Neil Armstrong Date: Fri, 12 May 2023 15:11:40 +0200 Subject: [PATCH v4 09/13] drm/meson: add support for MIPI-DSI transceiver MIME-Version: 1.0 Message-Id: <20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v4-9-2592c29ea263@linaro.org> References: <20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v4-0-2592c29ea263@linaro.org> In-Reply-To: <20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v4-0-2592c29ea263@linaro.org> To: Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , Martin Blumenstingl , Rob Herring , Krzysztof Kozlowski , Conor Dooley , David Airlie , Daniel Vetter , Philipp Zabel , Vinod Koul , Kishon Vijay Abraham I , Sam Ravnborg X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=19904; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=lxzYT0+ovmya50Ojd4/lz3kFWOMSjV0to39H3d8cn40=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBkXjsVXMguF8HMTyF+c6607cX7M+J8A6XP2/z5OSxc c/2IP0qJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZF47FQAKCRB33NvayMhJ0RX/D/ 4oRl78hgIcacucy7oUxHn+VNxhfbQ0YmTyfC9V/Otu99nC37WgxG41PlwhoLzuJCxdcbrrlidWiK0r 52I4UXvkGMaL8sgECLHuMwsvDGz0S8sX1SJjkI+eKpFDbOenX32MWQJqVDc496tjXmJt+o3FjTKFVG hyVpqLFuNiNLIEAxn7shYTJVqw/BGs4PhHX8qy+Oc3AUjbpvTyRT5VIBLjXSzfMn005jba2O9kizA7 JEdYMlTv4WTqfl+YhN/YdB9FAP3f7TfCJ0C8Wb6fLGvbqY2I9d6zxYv4mz1M8peem9wp7plmG4JyMV KTJKfdFwboERE5C3p5pwA73YUs+/h5Ztb1Me+6uqcWlKveOl0+385YrzLbVsS0ftDLT2uIn1dgRKcW uEV59/70jbfQrugohbwq5ss6WrnMiOYrbwamjpU8KZ7lnaBxAh03OsnvbBfQj9GS0q+/Bde9dbLOtw VuwnCN6cHMmJkJ3/tm5ICDVjLGj1MKavLSMxg/dFKHu6bWNZPnxp1TcPYSdvDYrCeYhwecmKGiDzOW yW91VCQ822sm3Ay6Gce4nhZSYTtm7VvvU5g5UqgXiyTyoHD+8TCLSz1jW2Ndc1Qr1E6w6RsR8RrCan SrUTh8Khkm7ZMxDzAG85O4UJICXV455g1ZN3LyBMdXjuWlvOPNIHvq6wpHkw== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE 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: devicetree@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Nicolas Belin , linux-phy@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jagan Teki 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 Reviewed-by: Jagan Teki 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 | 364 ++++++++++++++++++++++++++++++ drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 160 +++++++++++++ 4 files changed, 532 insertions(+) diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig index 823909da87db..615fdd0ce41b 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..bb5dea8aab36 --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,364 @@ +// 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 + +#include