From patchwork Fri Jun 17 07:27:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12885191 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 7F16ACCA47F for ; Fri, 17 Jun 2022 07:27:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E71D11A9EE; Fri, 17 Jun 2022 07:27:41 +0000 (UTC) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2E4711A9F3 for ; Fri, 17 Jun 2022 07:27:38 +0000 (UTC) Received: by mail-ej1-x629.google.com with SMTP id kq6so7083706ejb.11 for ; Fri, 17 Jun 2022 00:27:38 -0700 (PDT) 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=U4Pt6dX20y12V8u4V+OViKUJGyXa3hK3IsPJV1JLMWE=; b=ZcicU6Z6hFiTydjYWlHAPbXC1F/jVqnKudS8aecswkGy5gc6/dAYH+q9uNA4f8wp+e H79dFBJ/7yJ5rtz6gc3LfwAuTYcOs2/HGutqDins0b6315J10xhBD9TwKbjRgm7prlTZ NzqP1q+RrZW81cmrcGBIqWq5Fpn3qBfwWLmbMHOtQdbOlyJqCujSYnG6GAQRik80s5cF CCiylolBzzDZOKdEhHjxUhQZzcO8cYXjPF8NAUdxy3OVahEWEi+HrtTHaTbHXc5oOqtg NgmxDEJLH4cy/JyLTdb7AFix9E5R22zwyFdQg8l4LbvWM9xuVjbXPsYQHz+bbBR03zae A7fg== 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=U4Pt6dX20y12V8u4V+OViKUJGyXa3hK3IsPJV1JLMWE=; b=XQJQr+FXbjJr2ctGnc60Zjpe7Iwxku33jhoO9F1N+vZ6gfmRvgFveRo8cEjVWdlh3Z trxI6jMsXuJkHU1Xu4pPYaoKLhe77Cw+P72N85dIq3HfPYt87qfELWHKlxMn/AX7pq/m gZ4BNZOQnRkEpdUOlK745Cd6iYIKmCX3Sb2seIz9R8+GoSBDzb2K5tG4nd9kCIMTvBGh VOFtN0ohlZp2wXgTkxkNY+TFP2Zd81eSLag7yl4B3g2Hv5PjnVZw7lgfUnq6Qmiqxbkg xJuaKpIQjQoMnovJSeEkARWluNvh2wDAuQVPeIZisG3JAMe3ZIQe2dpsSgPggIbULj2V kmYw== X-Gm-Message-State: AJIora8wWyc5Yq97bSW8cesZBZYWCogteCIgdYNlLkq4X6/KoJQDV+7v aBk9TP2ddEl45Or/9NDieTbXH7OmDB5bow== X-Google-Smtp-Source: AGRyM1sy7pYIQbzYp53DMQWoIkvRDiLVBDh4cWq9pCIKXhIBlYVwxanreiKW1jSKdavuSs98bP4ZmA== X-Received: by 2002:a17:906:778b:b0:712:e477:8f33 with SMTP id s11-20020a170906778b00b00712e4778f33mr8081910ejm.42.1655450857861; Fri, 17 Jun 2022 00:27:37 -0700 (PDT) Received: from localhost.localdomain ([2001:861:44c0:66c0:d227:8f3c:286a:d9d8]) by smtp.gmail.com with ESMTPSA id n9-20020a170906840900b006fec56a80a8sm1762556ejx.115.2022.06.17.00.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 00:27:37 -0700 (PDT) From: Neil Armstrong To: dri-devel@lists.freedesktop.org, martin.blumenstingl@googlemail.com Subject: [PATCH v3 6/6] drm/meson: add support for MIPI-DSI transceiver Date: Fri, 17 Jun 2022 09:27:23 +0200 Message-Id: <20220617072723.1742668-7-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617072723.1742668-1-narmstrong@baylibre.com> References: <20220617072723.1742668-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=19338; h=from:subject; bh=PZ8q84CWoxyQYWWZJlYqiLEjqlXVQGbs+CkmFtmQKus=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBirCyrI+Nnb24D4ULuUw4ZkVK61JVQIA3X0+ERI32t APYNolGJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCYqwsqwAKCRB33NvayMhJ0Z09D/ 9Ig3N4+jj3xC40E0sjrM299BYoBTyHqNHj3Zt1ddJvMvWer2bxHgJsB//dZ9UmdrMfCb+Mjrsz0i6i DACuv59/IwFqHw2xUTUDHT+xO7RpJUkeccvMND/D5MkRT/cauyg8PrqwWA4rY4uiupSc+WHfrQnUjq BgQ0aP+MXnahyFvS1yu9zzrab2Vi25TlxNae8vs6fQx27wYeHArwQCJo5ZQ987dDLOKzQQ7Goz9ji/ 2IAv3XV65VmfVl93pxTga8P9NebQZ+Cpd0TR/4GXmgiBNEnbBRgpv97BLfR0AtPkJXKNacieWNZvT2 PPUC7qfXv6zPRIbE65wneyDV7Em29d8XeueXPt82QvBgmPGEzmSYcraPy90u/9EG1Amr5A4qNKRaTJ rDhmUTfCCFP6c6TRjvLOMRlRup8Rbb5EjIlXloitSwg/yhZpbb5YPtOhZ15EMQKyJjEzibN290waM/ QLdlCOC4qtzLaYmVZUIXagE7B9M1LJipFlsQcn+pGQUfiysejrvX2SSINYWfBOM+y//5+Nj6DTLGWn GEsh61woBPN7d8TFvTELNX3Cu0gMpCZpc1DcaZ2IGQw4aQN/e4SZvYJA1EdsVZYY0lAPLt8sp6VCPF b0VVRv4lCAFzZ8memj9bqb/LdSsCg7zG0Y4gB52E4Hsi7q5pKJ9QvHgSKA2A== X-Developer-Key: i=narmstrong@baylibre.com; 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: Jagan Teki , 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 Reviewed-by: Jagan Teki --- drivers/gpu/drm/meson/Kconfig | 7 + drivers/gpu/drm/meson/Makefile | 1 + drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 358 ++++++++++++++++++++++ drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 160 ++++++++++ 4 files changed, 526 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..52c8578914b6 --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,358 @@ +// 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