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: 13239311 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id ADC90C7EE26 for ; Fri, 12 May 2023 13:40:16 +0000 (UTC) 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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uDWMnpRtNwSDbXeYuFcRiy9Y48yNzp1JZ4xMlDGY1aA=; b=q9030ATdosx6ht J6ltNei5n/XTWJeT5f1jBwH0u0G6gbNVeqndSuvIuxPSRBxf/6s4IM72HXxn1ZWIWry3OqmKGbCrq AhMlxkYwhnh9X3AAAE2Ku9328yj6FYelGeHisMyS8acsRiZSj520Yp3wZRLvKaVLyWCMYGqVgujI0 1Mif8wk6GQz7QBnlSzevZzNH4Zhms70/ApFL/AnR2br+94FuRKEg7EHh+IMWkjtl1kLFb4bxE4qv4 yisBygMZbTxf0SVJjI+fiZFdWtQ3M+5TwNUSUjxlL7S1EG/f/p+ZCtvZONZ4t9U3aNdXoBEHw1MdM RTS4jB28drEkniE5eCsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pxT0K-00C2rd-14; Fri, 12 May 2023 13:40:16 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pxT0J-00C2q7-0C for linux-phy@bombadil.infradead.org; Fri, 12 May 2023 13:40:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=mZ4HWLy2uhOnhQ1Gf2nv5BJ+8vgTd2p2II4LszbMfAk=; b=CBqIC3M8B6oFuC1qGvQP42/m8/ xZCpuECSkIa5WE6SgwTcOku8eLj5G32GmncJJUh8EPCfNeCWbrb8AbyMCFSMs3hYzXqJmRf7pUtrm 1O9dhz3bl0kDbfQg5Q0Lt5LJxZ/0/nH94mn6pA0eBYszmPraxfarchSmMXFw4uWlPLfnP5bgZv3Y/ ZO3zo0rXy9IdiE9LvqQXqyB+o2RTk8TXdxv/u57R9uUzppWvpyvg1BL5ac78yBp3r6tu+oTrnQUtq 7gwoyzfMN6wU4kQXA0IAgHRItHr/QkIDy0Nhjx1/yNXNL2Jsfg8h4PW2EnD3TlqtBVTK9pbQC0s1p S5n8eaYg==; Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pxSZ9-0099Ol-1c for linux-phy@lists.infradead.org; Fri, 12 May 2023 13:12:16 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30626f4d74aso6515760f8f.0 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=GvYkZeWRRsM1p5uOu8n7ctzHbzxL3LRV7OohIrFX6DH4FBi6tggcOh0pNhQV1VQPlw /gilwev9dI6La8awsTJTNYiqQ9a3HT5k206txkc0c/82yEI6WXOO73z5mHt3VPmrEesa 9g7EN1s53Jxx6X7e38DcC3jIWWVxIFA+qMz2IkuQmb3llfTOgoUzWg0GAdtPEAbYLN8L 0w5GDxb1yWqAWMAMZb7DQzlsS9NkN/1JALBpxYHHIsOLR7w2v4pI9x/lsA1i2JKt7SE9 5rgd42tEMAfHLMDO1c0vY8K26Bof1Y9FRzTmWScZkxhWFuQBdqg3MoBFqzyWiK9OVHxU Npgg== X-Gm-Message-State: AC+VfDwqRhfJfdpE+mca2f87VDtAZml4EY5NlYrcskLZHckrRjjaRz/2 63X5AF1qsgia8Kobbgja5Mw63w== 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 Cc: Nicolas Belin , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-phy@lists.infradead.org, Neil Armstrong , Jagan Teki , Neil Armstrong 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230512_141211_690094_88231407 X-CRM114-Status: GOOD ( 23.68 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org 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