From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3401C433F5 for ; Fri, 7 Jan 2022 14:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347997AbiAGOzp (ORCPT ); Fri, 7 Jan 2022 09:55:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347915AbiAGOzd (ORCPT ); Fri, 7 Jan 2022 09:55:33 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A6F5C06173E for ; Fri, 7 Jan 2022 06:55:32 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id s1so11550425wra.6 for ; Fri, 07 Jan 2022 06:55:32 -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=pzoT4uBARSTciniXV6I1chJ+/OGuZxriWS/QZA1r+K4=; b=5Nr95cLvamYOyqFPjaEN+Vht0wC29fjiSelX0XY106IzMtLnlbX5v1MXJp4/57P/4n 6NzWlrKAK/K/ij6wDonoewx4i63cyF8tebuxlJPlCGxlIfKTuEKOwZ4NAo71RzbBVWp9 r/0Y66+J6Lt8UZTyGrtiCn0p74+qtYhS6xCXPRwizX+ch3rLbw5H9oxHrBAHjl+AnvqW dKdx5ClSpzKVLZlWj+r06j1E0vL7jKlM68BPo7G72naRTssOZAPoQg46SihoZ0JjSBav Q9lY7yq/ewxlB24G2EkZIgWl8iu4NjobwiZzrn8/u9uRE49oyKTM0n2didFnqNFPGEuy rcYA== 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=pzoT4uBARSTciniXV6I1chJ+/OGuZxriWS/QZA1r+K4=; b=OTFXiDfftB9jGt21RPPGUIczzRbFrUD49GE0BibuUEj07P8XdC2MVYvWokYvW5tv4F aR8bYNzU0cBpGBLh6otuA1Sqab3t7G/khrJJKJTb47sEV6Th5QkItzYTiQhMXJfwlAXL HnkFnLbKmx2S1sm3/eDYUq07sqFQzCCcxQgAoTHl31UHQaMQT8zGKlMX4uPUf3IwcxDR LWEtSCVxiU6H0c8BAS5q2AeDPVd3iiNSbO4ChakIhcB2jOA1gNzPrbq/1k37fyoQ30xB e3UFSkQBy6GUt2Yhz8fvW0uWHRkCQBMVcs2XQx3VND9zsfDTjwdPM8L6t36CDOqz0h6/ Kw4g== X-Gm-Message-State: AOAM531OraYOA3Y4+eWSdzFrzIbwlieMTzb1FVAoT6wczWPC9ZAMJ8JQ fKMEWQ2DI6ul/7fSQzVJz5uMGA== X-Google-Smtp-Source: ABdhPJzRpwEHcs/4uINEOK7EWbL2AgvKo5unG/LrsX5YMLow+35BdHfblZyQ4HlFRm0sTsVikscRdw== X-Received: by 2002:adf:f94c:: with SMTP id q12mr14398846wrr.166.1641567330526; Fri, 07 Jan 2022 06:55:30 -0800 (PST) Received: from localhost.localdomain ([2001:861:44c0:66c0:fc89:e826:8938:cbde]) by smtp.gmail.com with ESMTPSA id n8sm5594492wri.47.2022.01.07.06.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 06:55:29 -0800 (PST) From: Neil Armstrong To: dri-devel@lists.freedesktop.org Cc: linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Neil Armstrong Subject: [PATCH 6/6] drm/meson: add support for MIPI-DSI transceiver Date: Fri, 7 Jan 2022 15:55:15 +0100 Message-Id: <20220107145515.613009-7-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107145515.613009-1-narmstrong@baylibre.com> References: <20220107145515.613009-1-narmstrong@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- drivers/gpu/drm/meson/Kconfig | 7 + drivers/gpu/drm/meson/Makefile | 1 + drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 383 ++++++++++++++++++++++ drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 115 +++++++ 4 files changed, 506 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..75af3eec1b74 --- /dev/null +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -0,0 +1,383 @@ +// 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