From patchwork Thu Jan 20 08:33:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12718442 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 26F24C433F5 for ; Thu, 20 Jan 2022 08:34:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CE8910E513; Thu, 20 Jan 2022 08:34:41 +0000 (UTC) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by gabe.freedesktop.org (Postfix) with ESMTPS id 13A9E10E513 for ; Thu, 20 Jan 2022 08:34:40 +0000 (UTC) Received: by mail-wm1-x330.google.com with SMTP id j5-20020a05600c1c0500b0034d2e956aadso11828236wms.4 for ; Thu, 20 Jan 2022 00:34:39 -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=K04fzS10Xb3bGZschhctPTBveqGNPvtQF4lJJDtuijQ=; b=XVHYCs1QSWMpJYEFDWAOzP2v+81KSLbXswY/mfusAHNBMP6j+yZV3jI8FgwCjmmga8 NDKFwSQS9mJ/lQ6mGlCe+LQfn3pjBQUGk1vhwePcSXFd/G1s67BYFpyfOcZAY8VxUHCS yoiKPQfQG7aA8tCY6A8krYzEI79PzJXVpgwgXEMf/AxSnFhFBxGbLPqunj9f0JAgLhDz /Zce6GXm3OO2vl/xQZ+AFfnAMtmoc0v9jHKsg0d7kbLSxFbbgzzbeilPmLit2bdAqjnJ edzoDqrHklDxKR4jq9bKTgxk2WTHOUGFXhAwrLzQ9B9D5hoO76dW+0fHo0+OyDdmzkBu tpVA== 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=K04fzS10Xb3bGZschhctPTBveqGNPvtQF4lJJDtuijQ=; b=Jmw2kC+LaGWPw5G7MwL6ePlm3k2Y8iq5R1GCJADHUImX54CCFTOH6rCTc7i41F/sZy sYmVZ+fp43d+WYkPPOR32vitDhap07JbA9Y06/IfKmrVtotN0qgbbMAbhM591JvPTfth JicP7fXfAHyj8bstp0xPLX2QneQRC4AwdKxtx4nC6GRcaABQ91p5Sz+H1ytFADrcmmqE Ch2LarUtnRmEyY/L8FTlnif8dpoIs/TfPqLoysV4J7NbZi65xiRBfCQQxSmcgajZ1qCe YPDc80H1w0gMpAh1WrldFQ5MJ4IaeIuwfD01fjN6qAuqszHJjo5/Hcg3IQx0p0o3L/gz gF1A== X-Gm-Message-State: AOAM5305YREwlIzRK9ukwTVZerTwmVZQSQYzj33na1MoBUzcARsMG/+P V+JS5/v04Z8UgybS9Cxm1skGIzU7QJVqOw== X-Google-Smtp-Source: ABdhPJw/+r8nVWWJT92vzekaZo36OiKq9KSMV25VsdAUraconzx7mwv35BRI3Fu927lZzVfGz6+Jzw== X-Received: by 2002:a5d:6183:: with SMTP id j3mr34062960wru.615.1642667678080; Thu, 20 Jan 2022 00:34:38 -0800 (PST) Received: from localhost.localdomain ([2001:861:44c0:66c0:ced2:397a:bee8:75f5]) by smtp.gmail.com with ESMTPSA id u16sm1821975wmq.24.2022.01.20.00.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 00:34:34 -0800 (PST) From: Neil Armstrong To: dri-devel@lists.freedesktop.org, martin.blumenstingl@googlemail.com Subject: [PATCH v2 6/6] drm/meson: add support for MIPI-DSI transceiver Date: Thu, 20 Jan 2022 09:33:57 +0100 Message-Id: <20220120083357.1541262-7-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220120083357.1541262-1-narmstrong@baylibre.com> References: <20220120083357.1541262-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=19254; h=from:subject; bh=KjZ4VIFhPIL/m3fcn8BbDpn05CpqRFGF1eIUaCQG2C4=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBh6R2IVeEKAaEylrYwJ+2+P/kou5Ln7Iz5egQfVMUG UmHVUv+JAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCYekdiAAKCRB33NvayMhJ0VS/EA CB/pkiL+u57GOzZPTn5rhirWDn8vFZySR2Kz42U9pIxmSTiHJs+YARWEebPhkbkepCHk+ynNuRV2jV 8E9pS0hSf69oxQTtY69sER+yB0wqX74sFiN60z4wcbSQY1UdcvW9a5TvfCiYZhJi3MiHvh3eTVEB1e ROcwUcWJaZIcPGQZqrzGHHZs10kYKEjtziPGI4yiylYWp2gsl7FvwTJOpLQl/EaCFkGfHr/W24haXZ wLbsXwlcJfFBEpd5zjqvIbUK7iM5zIusl1uQ1b+8GT6mJ1Sb73bM8bb0FG3gaW3f07i/R+9MHvHgTr tlgg2AEEIJx53G7kJahUxvu1Va/jRGu2sQHcSj+OHBzXbx/sB8ecY3qw2Nx3w+YL3MNkHjtiJKSkj1 3akuxAqnfpzVzGZ7sEfk1SZiKQvDlTKH6ZzTdDNH9W2WB6rVXuRDwP42CFhuU4hyubA6Tk4LlwWo66 XiuesdUgD63+b9oheoGowXKPvsHhs5kJk2erkLRbffdKqd9RkRq+3c9OdiB80hA3cafL6XIswgISoT kQm+b4iWz2NPA1zkUH1aadfFs00eQZ917kLo1tu/5GcoW6gpnyfyuOhXDUnEqDA2Dv8spEoXIOaN4C lTiaJamXVYojwjNzLRQwoWiyUk69uDWkJiACKhVN1N04KrQF/v4ugFGeuwvQ== 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: 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 | 357 ++++++++++++++++++++++ drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 160 ++++++++++ 4 files changed, 525 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..75f373152caf --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,357 @@ +// 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