From patchwork Tue May 30 07:38:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 13259382 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 B1D08C7EE2E for ; Tue, 30 May 2023 07:55:07 +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=COqUypEkN/fZ/4H3gyKjWFBfcT4CiQ0lc5gHX7WJ71k=; b=wQzXMxwhpya8uI 8C4AgpJWJ0LFBfggAwQIrXT7+JrnRFnLh+p/djYWq/rnwfzoEmNKc1cc3157KuSwz5GkBn+pdS8FQ J6RdM+51JmBQ33LKL5lzKMHjskGy++V9nJo99O/+fSbBJm10uJg52vy1qxQ8DEvEmrCYj0gSH50Dr 3HbvsPTzppCK6DJXMcEzuEWWaNBkQhhi3rw9/0CsRoBOd1kT5y3un6T21ZFJ0gaRX8wRzndCn/x11 kP6p7WYQRrpYxU71E/dvb6tjrMpQS3I3TuMXIPeoiHRuB1POoFLOH43ZD7lT0ob5XWP2E4cMJizQM kOLzKXRmgVN+9rnHkK/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3uCB-00CpDM-1E; Tue, 30 May 2023 07:55:07 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3uBm-00CoxH-2D for linux-phy@bombadil.infradead.org; Tue, 30 May 2023 07:54:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=yMsSn3PxeghPJ4vFjHKvDZOF1432jaj9kLPy4oiu4OI=; b=B9UOutsEoCtYkxtrlrDXbWo7tQ 3Od1sl8+fbk+es04oC31ergdZje9ltKggbOAHaqf8xh7yXErWV77ISHYxxD5hzq66AN2/ytjmxNuM noKupdp1auFrtm71wqUIt6IHU+jwwoDwJFd7rXZiuLNgx4JFUWsfmMVKG4KHDlyrUObcbzh1nZtTY d5zJwWSnJ+sPq9w+ChHrcrUSbST4ltC4txcFgtz8tgH7lmTQiU02+euG8bDFvi++OiZ/Ymz5vhU/I n05DPStaX+bRtlOQWVTg6RGPoUr1XwC3oWN8UHATHatLCP05L6Q0q2MOIGBxuRPLw+9N8IwvDJXNQ WvSY/O2w==; Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1q3tw5-0064U8-OL for linux-phy@lists.infradead.org; Tue, 30 May 2023 07:38:32 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30ad8f33f1aso2493353f8f.0 for ; Tue, 30 May 2023 00:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685432308; x=1688024308; 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=yMsSn3PxeghPJ4vFjHKvDZOF1432jaj9kLPy4oiu4OI=; b=DWl8a0FY5O98004Aj5vJ8jCh9gXLO6LsVqfHHsstZDs8dwLPalgUS5NpOTBkyfi/hd yQoHfBWAIECoPmmeANFK3aIfUa2/P3Ma1T6rUPBTvm+qjaGnehMp7piEWESRy5OXnuYO 5jexfdU3NtIFDtrh3OplfZ0+AcqWiJid8E/GxTLDvQhC8x/pLTG3x8WbqcXn8qurgHKb kf8ViFr4d0OcvOBFsKVkouUrC3tZnolXJLHFml84mib1EEF0EpNN+33eplvJqYzbiRjZ eetHeKO+Ub/b1Lkcq+P+lPTVEC74dDQykh2RViftjw4L6yRR9KPIhF40Pbn/2kpa0gcN 1GVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685432308; x=1688024308; 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=yMsSn3PxeghPJ4vFjHKvDZOF1432jaj9kLPy4oiu4OI=; b=QvncLpTtMBivzdSnu50zhGeS0A3YnV4w7YJaHidrosqHWZb+i9ANTKInAZN8CPfk16 +cLN8T3MowiKS843p6n0XhZdJSjmHtgEGeGCa21ZNCwrHnQFHHzoIlYKzdOmA7d+VKD6 ql4502NcWkfFGb+tZG80aRoARgcHmF+GYFmA6fHnD3HUYfFDH8iP0fw4ArqB8VyQmmn0 JkWIgXgzmxwuyoJzO0ReMHect5yV6YVkexgkeecsK7LhpiL0sZnk2wIf+XCnlijqLtSG QYPf9Q7akg3Hv+ZuDHuGU8jTOOdjWGjQnim5bFa1UVz0qhb0mlIbc0T4KY7HhRgtqM/L VLSg== X-Gm-Message-State: AC+VfDyF9a95zKv4EyL3640x0ARtn1et0v3MZVZXLnV23F8HNAAwrM7Z YDpICxr286zvnjOm9hOhXGvXRQ== X-Google-Smtp-Source: ACHHUZ4EtrnIGuC/Dxx8K85WB3LqU4c4OiIgmx0C5nEFPN8WG4nDDhO5W/EjWNaX1TyDE/eeJeKicg== X-Received: by 2002:adf:eecc:0:b0:30a:e465:5b29 with SMTP id a12-20020adfeecc000000b0030ae4655b29mr768094wrp.57.1685432307734; Tue, 30 May 2023 00:38:27 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id m4-20020a5d4a04000000b003079c402762sm2312013wrq.19.2023.05.30.00.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:38:27 -0700 (PDT) From: Neil Armstrong Date: Tue, 30 May 2023 09:38:13 +0200 Subject: [PATCH v5 12/17] drm/meson: add support for MIPI-DSI transceiver MIME-Version: 1.0 Message-Id: <20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v5-12-56eb7a4d5b8e@linaro.org> References: <20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v5-0-56eb7a4d5b8e@linaro.org> In-Reply-To: <20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v5-0-56eb7a4d5b8e@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 , Kishon Vijay Abraham I , Sam Ravnborg Cc: "Lukas F. Hartmann" , 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=19297; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=vdNged+bT879opvCVPv6gCiacGfP+EnbSlkc5Uackdg=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBkdafiIkw9gKoaNh108AEtzF2eG4nQrk5QZ25klcNz aoxua/aJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZHWn4gAKCRB33NvayMhJ0eQKD/ 9gAts/+rd7NIeBPNj1L6CiWSRU8DVHN75lhmUl4NR11ctuHHc5d2OeckKK49KuhVXfECOZW9f87Qj3 o6heThKy6y/WboNt03Es3aDEps85ou6hkGg/jAPL2A0R2ifteNyS614qEhVjsL+1qx+r6QEi5XfrN8 z3WHZMxFI5J+qinxR8IUuewJTxJmeg9K/onJS6zeN42xM2cAVp5q2HIKebAZpkhOe/0S1oAw6KmbMG tXwjrH0igxK7iPf5ZuoAp5LYKL6auAmzGDObL96s1t2FIMkct7BuEAUccV1Il9G/Kdc2wCgZYrLs6Z AtyGzjvVuWw224xEl28vCq0GK4FOHKurHT5wUXg3XFZcSbjy89F1SDQmwbtsTvfjtdiL9WLKV2MDZs qc9u2/yaO064xE5H2lpbn7y7QUtI9NvLBNTjQSVxsszVVOeq1t1j3z50O23sqxQPPIidp59iNug/sz 8spTyNn1CB3QmMRyaPH+HaxxFfZiZGwZadPoV50bjqvgDfmv9GSA6+0XI4LkFKPCtfagc/P9+UL7+e 0zBO1YHVg4z6zAQvJDXuvlBe4zFTBJh6rSqTHenbS/8Je9T/cZBlvFFHdMFC4f426qFgyXjE2j2XuK Eje8R/7+zrxqfZKsNB/b+suRIzvNB/R8MK4nxjf/6q896vvcvUHilBCvY4PQ== 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-20230530_083829_806614_18A3F153 X-CRM114-Status: GOOD ( 24.48 ) 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 inputs 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 Reviewed-by: Nicolas Belin Tested-by: Nicolas Belin # on Khadas VIM3 + TS050 Panel --- drivers/gpu/drm/meson/Kconfig | 7 + drivers/gpu/drm/meson/Makefile | 1 + drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 352 ++++++++++++++++++++++++++++++ drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 160 ++++++++++++++ 4 files changed, 520 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..dd505ac37976 --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,352 @@ +// 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