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: 12885221 X-Patchwork-Delegate: neil.armstrong@linaro.org 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 CE6DCC43334 for ; Fri, 17 Jun 2022 07:45:14 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M6kv5S37ymw1FZFXmErBr6oCFSyUaUWWyCPgBYk8AD0=; b=H6O6y7XsRnsJaI 3lQgEaTyJ3mQ/jY71pd75D4/8B05t30BSj3URIANA3H+U37iRZYcq70H1betJh3wlrcuql8CuNl5t H6L3tmj1X/fYBFJQFJHhT2YyIrM5S2r40UtKsCA/fqbBeKEhyH0CLSAG9gwonxZG8eZpkL6UqSCmp pw4+uFXNviSqNhBWOJpLDIfUN8E7kUVkPvPeapsqdTNuls5n20miSSZHTfVnkOJfR9qHsY4rpH2nZ nuC27u1H2iG8On74XXwE5kKEkipSGoMq6HMj8zl/BxpudLYXJioM6R+sGvtU8DwZ91p5uABeclUiA HRN/i1Di8UkknQW0K9bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o26fE-0064J3-2I; Fri, 17 Jun 2022 07:45:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o26OQ-005xC7-K7 for linux-amlogic@bombadil.infradead.org; Fri, 17 Jun 2022 07:27:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=U4Pt6dX20y12V8u4V+OViKUJGyXa3hK3IsPJV1JLMWE=; b=ke/HZ45p2aFQVdaokX4cnTNHPk PmaNC6/GSxhDzS8bohACfFwpzRKTZss3xkPNIXf5+T1z/EMox2wOyL1Nw2D0ShQHiNUa6EsZ46INJ BUxo0dcWg+7YlAcMHCtURQ06r5yfxxtg9TYxU1MwSNWToKEbQVMObQSLEnkpCgr0QJP1AT8QH92ZC xJWt4fJ3In9qFlvT/ouSS6v69TtUJ0bpu7RR+Bl1pqWO49MTLojL5oeVXZgoYKAQv5TJuee/Rs5vO RPxaepTUogsAzaQU2SRkvcsG8IgtN6UPm+rxT//6yXzGbHELfvdCamV1CXZTG+A+MZpNyIiOZuj3P itNjG/CQ==; Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o26OL-008crP-FN for linux-amlogic@lists.infradead.org; Fri, 17 Jun 2022 07:27:44 +0000 Received: by mail-ej1-x62f.google.com with SMTP id s12so7136876ejx.3 for ; Fri, 17 Jun 2022 00:27:39 -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=Sv43KiYQn69tdVqw6S7nSbjgqM35ScWgB8SuQGougTS3+OPSU/V45inyRNvqmfaAXI fjV0cs8x1X7if1kgnKsVbp4fXLRnFyes7+opK1d0O+jWvrOaqBnkLgBEekSxIcB4ulSQ rwSYve0K4zWJlqkbBTBzuHeCfeIYQu+5t1HSBO7ocytVJp5tEOgUZKGlKF/nSpglbn/P 51yct/UVVKgUtlbzUaaOCWgWbABSzLKY30yu5/p4M2So/CqvRdtVTT9K/eAB1owCFbsK XZcu+/kmNquhWjBv3TGoAdLH5W+5P7u+Z4T2apyw4XWacsc6Ba137/WaMs8KTLwwMZ0E qQ0Q== X-Gm-Message-State: AJIora9o3YhzuwhWLBShPmezBtBS5YtNv+MFmP2yQ+EGjBwNxTe8u2aZ ROn/bnHUlWsrPJRyWWarivxtfQ== 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 Cc: linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Neil Armstrong , Jagan Teki 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_082741_838736_1324FC33 X-CRM114-Status: GOOD ( 25.94 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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 --- 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