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 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 D1102C43219 for ; Fri, 7 Jan 2022 14:58:09 +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=7qFRlTtHGCGh5wCeZEDib53yz2SZW/JZTHNG22afzYo=; b=ypoT9ZtUemnbXq NL4cupIvdkZ6JsRRrvFeYd5Rgjb2pstFeKQ/yAVH3TFNo5V9ytEvRns/m4IN9jSyOHPBBCo9La4eW /g/ZNEWSo9hevh4049m+96FEOXHEmnDsIB2HMY5wc7vztdP81jLiQf0U2xxzUD38/dMgn4X9+mKUP vGvVTFNxVoSfDfMrF53+1qiiCPjFSGTO/RwB4BYKOnBWRqsh0bXzvY7MPmztnE4lsG0vGASUvrobb HSEwIV8+cqLhIRGobK4iEoStLdT2q3/nRbjKbrDp9OG9rCKSlBIASiIATFwqSuDNcutwxql+ktYLd AdKfKhyEIlk+mrcs9UOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5qgu-004LLQ-OT; Fri, 07 Jan 2022 14:58:04 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5qeS-004JqW-HS for linux-amlogic@lists.infradead.org; Fri, 07 Jan 2022 14:55:42 +0000 Received: by mail-wr1-x42b.google.com with SMTP id a5so7572182wrh.5 for ; Fri, 07 Jan 2022 06:55:31 -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=7KxMJgISMbEDXW67CW2T3F5ISiPbRam8hg7CIPrtJWEImfaoj6FAQ8XIl/ZK+NceV5 Cyz0sjHIG3vcs9fwxIElONETWb5H+YygJ8jcCl6rMD+Hy9o06P4BLERJZd3Lb1Ex0vGw saUzuRM37v3MLmABPoqmpf9NKvyrvpGlDZjj2nTSfYndBzbFdjO7I/QRYmOu7BnATG46 MdoNpZ7rghdQMh0HiAgpfaIdkY6m7l8dDS6gEq6ZVUDUbWhmL+2GuoRBatc/eWCI/t2F Bsd4pXa38EN1KXZhZvgZgK8SbE5GUzpZqg/DtcsgzkRrpMk2dsyJQB6WNiD1MQK6b0si ReoA== X-Gm-Message-State: AOAM531KOvSGxqeS7AVNj7O3LJWTDVjgjDcaTwlvt6NauzeXx971U7bR AMRg0nz9OtUY3iwqu02BRikaQQ== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220107_065532_673653_B499343B X-CRM114-Status: GOOD ( 27.32 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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