From patchwork Thu Jan 26 14:44:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2687 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 28A8E3F046 for ; Thu, 26 Jan 2023 15:47:36 +0100 (CET) Received: by mail-pg1-f198.google.com with SMTP id bk2-20020a056a02028200b004a7e2a790d2sf848784pgb.18 for ; Thu, 26 Jan 2023 06:47:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674744455; cv=pass; d=google.com; s=arc-20160816; b=N5YqjdsrxMKVKEcHwHjBnJdLLZNyiMeLLG6wY40T0MuLYv7tsoEwcE1O/u6XSqDbkh GTjznFkwsZ2MmPBGtIbI92VgS78rc+Qemq0A18fygjy2WR7f0Xhe8SPRhfQjX6arg0Xw 1DMq48ied4hE6aBJuiasD7jiWAcsybeucto3MZyLp13SdZKo4uWsl4sNLKoQXXwbSzO3 J9TN0pQ0OW54+wwrKFWgZEdjchU98Ur9+TcAKGgZo5KrY3Gv+/a6FvpMAijNhN+G74nT KRxdPUUI+S4bxmXeQT+noihX3I7bmp2lgiFqKg/uJhHJbdeM4CS58WRgAHet5Diiwd98 jmww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+GJEljjqOqmkkTUKBiUPtdfTtsO3+bMErbN9S/U496k=; b=Q4UL2DmvEzHQM6PJaxtXhc8EuI1M9xSgRB0ILF4dS91pTfspv/4hQlG0r2rgRfQImR 2Qz/sNepIzejiAiotWHjEoXaB2vCpw0LOx7/3Ue1yKapDD21gAipf2FuPApe8yWHev0V 7E8nhMrcn25gDGECWX9Z7s41xFw5RAl3/MQ3DpX/MfRz2TjaAxqPxldwlqbX++xENczf c25Xn/T97VBQ35oQQuXL+WitZ1vbBL6AWfhCWGxlzdHu7cIWhNe9S8B5wCkxMNlfY2dw Ucqcl+XVoxRPbu3FHmqLRS3qvUUm039mcJqKXFQxDpgvLBPX5pUNCikHgkkX1eHyoPgq sIpg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TZFPq4O8; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+GJEljjqOqmkkTUKBiUPtdfTtsO3+bMErbN9S/U496k=; b=DTQ7qdFoHhri/1lxMtMwdEcNrwP45/LpZDWyKj6qoXpDr5qCKO8j9UDLuw8DCe7tR+ 2IzHIkay+nyvrxZpCWxSn68gRtewxj3aEdJq5ZwZxSZwiPUcexdHv+MTqdOFa1ZAqeHK cuTulIWfB1HJKy/PuuotIroC4Iu+WS/Y5Ggss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+GJEljjqOqmkkTUKBiUPtdfTtsO3+bMErbN9S/U496k=; b=72ypTa1YEJzl+Q2YRBb/G2sRXHIXEJKvbQ5zHv52oPWzp7ZFw0bE7zZ/EdA8D0Ak4i +ei5PCDXVCCq1d9Jd01wZG0m8uQKiYXXSQDiHXT6NXGGN2j2o4PeaU1aYSSEybUwzoFF plKnGocymtgnZVe/10kMv2jAlhOZTA1Fvsx8gTen2nRUfhQ13/j9DmixIU2W7Sx8a8K3 lGKjTztUiwMLAk3aSm1bk6Izln2NqrKKwXVKElxvGfBu/c8/7revanhkY95WtxaEJaCJ 2pTPEiInQPuTnWKKsjlTeel6tu2FYd07hL0Hy7usf49swJeYwnh44lCAVahbOEfSxpub 8QCw== X-Gm-Message-State: AFqh2kqXVD8mG806AO53hNz42ykNx0TzB/rkJzWU1SzWja3aF4/z/UW1 iNuvVxVYWhTRI4OvTJJMCrk7dh3F X-Google-Smtp-Source: AMrXdXv/NxvqJ4gKCHCNwdEPh3R4YIdP95SQPgQr66ZKZTZTB6nFLgNANtWisPPQ/zRa6sq47GpgMg== X-Received: by 2002:a05:6a00:1ad4:b0:586:ed25:a54b with SMTP id f20-20020a056a001ad400b00586ed25a54bmr4153467pfv.6.1674744454782; Thu, 26 Jan 2023 06:47:34 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:db0d:b0:196:2e27:844e with SMTP id m13-20020a170902db0d00b001962e27844els2347262plx.7.-pod-prod-gmail; Thu, 26 Jan 2023 06:47:34 -0800 (PST) X-Received: by 2002:a17:902:b592:b0:194:8eab:8d8d with SMTP id a18-20020a170902b59200b001948eab8d8dmr33867723pls.26.1674744453536; Thu, 26 Jan 2023 06:47:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674744453; cv=none; d=google.com; s=arc-20160816; b=j76T1GaJO9FWSjQegWo/2vQZMhrHi3n5o5YCG/Gy7bxAaHVXW3QFNy+qraCEXtT/t+ 9furl/FSgeSIV60qtY24wo6sVWdnFdva1vhaTLkYpqKg9uSNGnVTtMRZtouHo8ox+aIc JoimW9DGdyKkNCaLpxB2CIQxqbzmn8lUIHDRuGs4qOTe1K0BmlvwZ2KfcTJ/lV2WYXiK Oa782ym3eb2VRXzpbHgYa8fs7+bagO/w/MXfI6ltkV/eAH/hv4MF199CpTcUHwEi/1Eq EPlDvGhS/0KA+2upQZxwnVeKnkZSjkXD0noLQRwGLL7HZ0jP4S56RzvCBtMUSTvLohe7 ricw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=cfyxDN1Tr8RKZcnYCe3DxARR0/2yUQR0+FZXP6JkyN0=; b=a6BpclyhQqraiy8ll1il2eUA5CpqjBSznq02DzyWHFqSPSLA1O6vrdGhfEaZUxJCqK i4yALfQWJfv5i8OvoCf/2qmavIgLXNMqifuZc33QF4Kg5Lksb5Lh3Xk6kfD3q7TDB1ME Bf+60Mu4eCDtD45rbSYbfIHMFeRL2wD2sOtRv+eh76qQOYTdTEnGDtM5G6ViXmxAPSlS ZL02O60Q0zzK5Gv31ZJId0PzREo+fTKfWnD4leRt0K05gibPUR/ivwB4Hq5nkKGsh04a LPkBkimBKz7NMQIMNwfUpq+rv781pbJHmZWE82yhnpC5dE6HjXeHIx3JG8aO8N6mOp+F 5K5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TZFPq4O8; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id l5-20020a170903244500b0019607072b23sor709874pls.109.2023.01.26.06.47.33 for (Google Transport Security); Thu, 26 Jan 2023 06:47:33 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:902:b691:b0:194:9288:dc19 with SMTP id c17-20020a170902b69100b001949288dc19mr36635281pls.68.1674744452378; Thu, 26 Jan 2023 06:47:32 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a238:3cb1:2156:ef87:8af5]) by smtp.gmail.com with ESMTPSA id d197-20020a6336ce000000b0042988a04bfdsm823660pga.9.2023.01.26.06.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:47:31 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Robert Foss , Laurent Pinchart , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [PATCH v12 14/18] drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge Date: Thu, 26 Jan 2023 20:14:23 +0530 Message-Id: <20230126144427.607098-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126144427.607098-1-jagan@amarulasolutions.com> References: <20230126144427.607098-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TZFPq4O8; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Samsung MIPI DSIM controller is common DSI IP that can be used in various SoCs like Exynos, i.MX8M Mini/Nano. In order to access this DSI controller between various platform SoCs, the ideal way to incorporate this in the drm stack is via the drm bridge driver. We already have a consolidated code for supporting component and bridge based DRM drivers, so keep the exynos component based code in existing exynos_drm_dsi.c and move generic bridge code as part of samsung-dsim.c Reviewed-by: Marek Vasut Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- Changes for v11: - sort MAINTAINERS list - collect RB from Marek Changes for v11: - fix BIT macro replacements - fix checkpatch --strict warnings Changes for v10: - don't add new code - move the files and update samsung_dsim names - update commit message Changes for v9: - drop the bridge attach fix for Exynos Changes for v8: - update the commit message head Changes for v7: - fix the drm bridge attach chain for exynos drm dsi driver - fix the hw_type checking logic Changes for v6: - handle previous bridge pointer for exynos dsi Changes for v5: - [mszyprow] reworked driver initialization using the same approach as in drivers/gpu/drm/{exynos/exynos_dp.c, bridge/analogix/analogix_dp_core.c}, removed weak functions, moved exynos_dsi_driver back to exynos_drm_dsi.c and restored integration with exynos_drm custom initialization. - updated the commit message [Jagan] Changes for v4: - include Inki Dae in MAINTAINERS - remove dsi_driver probe in exynos_drm_drv to support multi-arch build Changes for v3: - restore gpio related fixes - restore proper bridge chain - rework initialization issue - fix header includes in proper way Changes for v2: - fixed exynos dsi driver conversion (Marek Szyprowski) - updated commit message - updated MAINTAINERS file Changes for v1: - don't maintain component_ops in bridge driver - don't maintain platform glue code in bridge driver - add platform-specific glue code and make a common bridge MAINTAINERS | 9 + drivers/gpu/drm/bridge/Kconfig | 12 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/samsung-dsim.c | 1855 +++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2008 +---------------------- include/drm/bridge/samsung-dsim.h | 114 ++ 7 files changed, 2038 insertions(+), 1962 deletions(-) create mode 100644 drivers/gpu/drm/bridge/samsung-dsim.c create mode 100644 include/drm/bridge/samsung-dsim.h diff --git a/MAINTAINERS b/MAINTAINERS index 2758e7a64fa5..8bddb2a6c925 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6738,6 +6738,15 @@ T: git git://anongit.freedesktop.org/drm/drm-misc F: Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml F: drivers/gpu/drm/panel/panel-samsung-db7430.c +DRM DRIVER FOR SAMSUNG MIPI DSIM BRIDGE +M: Inki Dae +M: Jagan Teki +M: Marek Szyprowski +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: drivers/gpu/drm/bridge/samsung-dsim.c +F: include/drm/bridge/samsung-dsim.h + DRM DRIVER FOR SAMSUNG S6D27A1 PANELS M: Markuss Broks S: Maintained diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 8b2226f72b24..e9d00bcf2d5c 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -220,6 +220,18 @@ config DRM_PARADE_PS8640 The PS8640 is a high-performance and low-power MIPI DSI to eDP converter +config DRM_SAMSUNG_DSIM + tristate "Samsung MIPI DSIM bridge driver" + depends on COMMON_CLK + depends on OF && HAS_IOMEM + select DRM_KMS_HELPER + select DRM_MIPI_DSI + select DRM_PANEL_BRIDGE + help + The Samsung MIPI DSIM bridge controller driver. + This MIPI DSIM bridge can be found it on Exynos SoCs and + NXP's i.MX8M Mini/Nano. + config DRM_SIL_SII8620 tristate "Silicon Image SII8620 HDMI/MHL bridge" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 52f6e8b4a821..2b892b7ed59e 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o +obj-$(CONFIG_DRM_SAMSUNG_DSIM) += samsung-dsim.o obj-$(CONFIG_DRM_SIL_SII8620) += sil-sii8620.o obj-$(CONFIG_DRM_SII902X) += sii902x.o obj-$(CONFIG_DRM_SII9234) += sii9234.o diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c new file mode 100644 index 000000000000..c90314c4d205 --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1855 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Samsung MIPI DSIM bridge driver. + * + * Copyright (C) 2021 Amarula Solutions(India) + * Copyright (c) 2014 Samsung Electronics Co., Ltd + * Author: Jagan Teki + * + * Based on exynos_drm_dsi from + * Tomasz Figa + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include