From patchwork Fri Mar 3 14:51:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13158898 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 C50EDC64EC4 for ; Fri, 3 Mar 2023 14:53:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC50F10E642; Fri, 3 Mar 2023 14:53:20 +0000 (UTC) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67A2E10E643 for ; Fri, 3 Mar 2023 14:53:19 +0000 (UTC) Received: by mail-pj1-x1029.google.com with SMTP id x34so2805562pjj.0 for ; Fri, 03 Mar 2023 06:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AUDhv2F2gloyZVsSFnMj8a6i3CQwzzAovnYe5a/5BOo=; b=rgWm2wDS5MSDprzWwx4VsKC1cAL89QpRgmL7cjdAMEKSCmf8PO2EWR3CaFxQV5aANC J06oEBt3a+yfQ7YwkcjGqY9e2xYknedRus38ue4T3rOUz7jIUqXc/9afvzYONLOJA4bm LOe+Np6SugVVQ0UYHJlwCDBV/BkAM+bCP/TJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=AUDhv2F2gloyZVsSFnMj8a6i3CQwzzAovnYe5a/5BOo=; b=u8IqzhK0N164FFSXOwh8id7Vyn5RCGrTuu1s9bN9mbxDzYX4m1IFKa4ipTxXGYpqlg si+0olndh5FEw66Jk8ykFFIaFnX2mWCB3A7KqHxUrGZJGpQhHLs07X3hMFJcQwaY46rz Ej74hDipUG62i1G78yB26K5nxZH4nEmj9lYDIckRFbX8+LX5Jccg+Kyj1hwke5dMshhH YuTrwKpG+LggsyUDEcTqqZy4Rs84IDRD8j12NITfyK+kx7oxcPzCamhIacBcDIArvObR QJ28DHzWV4DgguXlRxtvqYcvotpt3ngVWO8VeeuUtgLY7Df1tTUzq5eiF4A8328Vht+0 egbA== X-Gm-Message-State: AO0yUKWJEYLd8SoJ4VKRbZYVenufSGBaqEvgVRcQDfGlXxTWu67yi0ps JNPpJGfMzwRtOSTJtkWQEMBgPQ== X-Google-Smtp-Source: AK7set9S/NN/kGQ3WYeYjDVM2qwRwCTPC/N/KZbh1HS6vxI7/Ck3duoFVvjDMKp/pDe7pRS/j4bA2w== X-Received: by 2002:a17:90b:4d11:b0:23a:4875:6e07 with SMTP id mw17-20020a17090b4d1100b0023a48756e07mr1801373pjb.40.1677855198199; Fri, 03 Mar 2023 06:53:18 -0800 (PST) Received: from localhost.localdomain ([183.83.137.89]) by smtp.gmail.com with ESMTPSA id z4-20020a63e544000000b00502fd70b0bdsm1660856pgj.52.2023.03.03.06.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:53:17 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Subject: [PATCH v15 12/16] drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge Date: Fri, 3 Mar 2023 20:21:34 +0530 Message-Id: <20230303145138.29233-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303145138.29233-1-jagan@amarulasolutions.com> References: <20230303145138.29233-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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-samsung-soc@vger.kernel.org, Matteo Lisi , linux-amarula , Seung-Woo Kim , Frieder Schrempf , Kyungmin Park , dri-devel@lists.freedesktop.org, Adam Ford , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 v15: - drop redundent dsim->bridge.funcs->atomic_disable(&dsim->bridge, NULL); Changes for v13: - none 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 | 1898 +++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2051 +---------------------- include/drm/bridge/samsung-dsim.h | 114 ++ 7 files changed, 2079 insertions(+), 2007 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 97d814a19475..f604c36b31bf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6737,6 +6737,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..42e3536cb2fc --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1898 @@ +// 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