From patchwork Wed Mar 8 16:39:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2792 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3ED9A414B5 for ; Wed, 8 Mar 2023 17:41:30 +0100 (CET) Received: by mail-pj1-f70.google.com with SMTP id p9-20020a17090a930900b00237a7f862dfsf1276801pjo.2 for ; Wed, 08 Mar 2023 08:41:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678293689; cv=pass; d=google.com; s=arc-20160816; b=PzyhLj6OsrmNIge2yMnN71Goa6tNzziTOqVKUUfXl7KmTsJ7pOUMHHUPUm9Nqy1D/0 XsGqDBK5VS69LVxussyO4lnyw1xkAqPrYdJd8OUTCJJDlqnrWeEC0qdsetSpDuKInhAF EjOpb8ee00mKkwdmkwHi9zQVvHnz+QtDjtDPyP/lPxOgXNzemEaYgB5R/bLrklXXi/xM 0EgsQTAviJHGxgX9ckNuOGfVBG+9/US9sJpb+GctPjo2f20R2zgMVbqY3nfRk3zRxpSA ukfiLoXtt0lrPUSCcFH8N8pSTojtHidgytPS8fIlf4642lPFvXGc9W3EfOrqJPX8KnSo XvzQ== 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=FnoJXyV5iZjoLlRs/66ci5CsCbP9JSArpPLN/4vGJ7A=; b=WOQZssDl5hkNLONR33ubmJJa+DWxC9jBP+yAapbr0HvDRVK/QCxOogN6CS647QEfhp FXR1ptn1WKFbzzZm1erDrxEFECyj86TCynFRHB6dbC0yRwAOZM+Gb8DxRDjW9mo+m66b 9tm2AV+OdHpwyCaa/dBqH1fgKl9Wixb7PDgM2Ee1NBoW03ZAQnBQADMkNIoGDLHzIXxm SumSarZ+FjmXF6vdDrBqLdYXgasXuvYkqCgaQGTSo2ZOGDDyTFCbl/OjirTrjHDBhBJ+ Yyg55zct7kdI9t1KBdS6XH9NY57vwlZOqlLXHxm8/tF0RtpnKpiBBV9Ses6jcBRZzoQK fGQQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=B+B3Fk3v; 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; t=1678293689; 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=FnoJXyV5iZjoLlRs/66ci5CsCbP9JSArpPLN/4vGJ7A=; b=kW4gAFVTHDH47HI49L4kIvEi//rcaPaxodCWq/NXlB5e4e9HoIC2xq7MgU5h1rbUJY blVNBUJ+gdFygUSLXpMFgc2jabWDHAAmm3RW7Q74rmODUySzdFnJhvjDYbWilThSkB8f DWEYcGC8p9x28HmClHWflWBA7NmkXwXfZtwBA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678293689; 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=FnoJXyV5iZjoLlRs/66ci5CsCbP9JSArpPLN/4vGJ7A=; b=1cAh3qr3c1kLdB0JpbFQfu7rc8HTbAhx1av6jfyfeIU2XnhAhinjgPM7q4G1YysZ07 1pJOd6wHLnLad+ewDZ++UFD76ESr7UkaUR509KrKlOWFuUK9Qub8Kxv5cPT+QJN8M1WV q9zpX0YRSrQL/W7h6oL3jNtnMTq5hcoPSjRPeARZfVTv22IIYmiitpohje3Gy0aSk9YI 0mMyQF9tj9bwk6kUzsDLmHj/4T53HJHRg9wRoL8fzzVuYJZs3+IEOCFqa4Wd+yIT8YPf /8zB8nqJq5rpCXaAb5PP6OGJ/v02ztlUz2OI1XcBomo4aU7F8TDbjUFdYrDqTj8NY/l2 NZXw== X-Gm-Message-State: AO0yUKV2tUEKJD1pwhkcaZI3rXa4wvgKpqEL9N3wS06dqwCuGLB3fHma S072vGLZH1Vp1c6DTNtoxpHP2Pwy X-Google-Smtp-Source: AK7set/1yvJQfVhox/Oat1ryUdsYWplfDMNEZzJCfUhjXa7dz1lNODNlRZa1N2t4gfhXxSpY2q/VPw== X-Received: by 2002:a63:b253:0:b0:503:20c2:1752 with SMTP id t19-20020a63b253000000b0050320c21752mr6567144pgo.1.1678293688738; Wed, 08 Mar 2023 08:41:28 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:be18:b0:199:50f5:6729 with SMTP id r24-20020a170902be1800b0019950f56729ls16325589pls.11.-pod-prod-gmail; Wed, 08 Mar 2023 08:41:28 -0800 (PST) X-Received: by 2002:a17:902:c1cd:b0:19e:32da:e458 with SMTP id c13-20020a170902c1cd00b0019e32dae458mr15395510plc.63.1678293687566; Wed, 08 Mar 2023 08:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678293687; cv=none; d=google.com; s=arc-20160816; b=cFw6rzdIEZmXz6rtUERW4yIrZLsXseHjaARI8EK92hbnVXQqXzsqM1NJQh53fOkf5P n93Y0iKXQYBRNlTawLSh10lzD3E4k537MSmsCyN76pyjBrC1yjyinBU7n7KAd1Dgp931 fw69w5oTg8GZAS30uyxCsHDug2TLEkmnJOmWU1JmOF/pLW84/mdS7QS6uXmWAk7v8p2v Kyn6qsoRkCGu2W2CxCFlr4aAAQ+UeggEk4dLD4lIchBjJksSRT8BrCpOX0jH2V2siYn7 kCKbX7Z68qUy62GEHVcdyDn6fcEwy4CtW/paNqbz8lAZyY3cM37cqXAtUEPQCbWYvw/f hEFg== 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=JPgmICzpMw0fHaUCdRORd0zN0giN1zt/Jwczrt2kTI4=; b=QwxbFgGGZAusTjVBCfvGhuiIGOAVUqUJtG8YDZMcuDoy6ldFKXtBKMonrmx1ncWlPw NSZDciPENfKkOt85telD11K9TzgR8gUna58Rx+nwiSKQmIgQ1IZteqko6OtX0jcO73jX SsNpHXHtlANjMuIEkxjYvLe79aP20el99sez1HsJPGeRoYTkLAN5Cw5o94bN8xzwTLaG rweiXPDEPxPM6d3uzVqCrdhZsfmK77Knd07xg+uyyCuMYfThnwrGhgmoRbqjzNKSUAVr Qu36hYZebmrqSB8VvqFqDcC7JarFxa8JAOpVt/qAkF8vF61oP8kHxStMh1KtSlDRyuZf +5uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=B+B3Fk3v; 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 w15-20020a1709026f0f00b0019ea6406ddbsor5361342plk.196.2023.03.08.08.41.27 for (Google Transport Security); Wed, 08 Mar 2023 08:41:27 -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:740a:b0:19c:bcb1:d75c with SMTP id g10-20020a170902740a00b0019cbcb1d75cmr16047060pll.30.1678293686520; Wed, 08 Mar 2023 08:41:26 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a8a1:b545:91cc:80b2:f9fe]) by smtp.gmail.com with ESMTPSA id kq3-20020a170903284300b0019b9a075f1fsm10046540plb.80.2023.03.08.08.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 08:41:25 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Cc: Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH v16 12/16] drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge Date: Wed, 8 Mar 2023 22:09:49 +0530 Message-Id: <20230308163953.28506-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230308163953.28506-1-jagan@amarulasolutions.com> References: <20230308163953.28506-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=B+B3Fk3v; 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 Tested-by: Marek Szyprowski Reviewed-by: Marek Vasut Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- Changes for v16: - drop explicit bridge detach - collect TB from Marek S 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 | 1900 +++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2060 +---------------------- include/drm/bridge/samsung-dsim.h | 114 ++ 7 files changed, 2090 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..f9a5e69a0fcd --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1900 @@ +// 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