From patchwork Fri Sep 16 18:17:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2362 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DC8773F36F for ; Fri, 16 Sep 2022 20:18:37 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id a12-20020a65604c000000b0042a8c1cc701sf11317914pgp.1 for ; Fri, 16 Sep 2022 11:18:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663352316; cv=pass; d=google.com; s=arc-20160816; b=APja6sF9mf5WYLnMKwEBXonarcO1eFZn2CLqdkMtLRjNlzmK0RmBcSXoRyBMfwGc7E DRMIDXLUFrMnz0K/hftMp4MwpNXrq+C9uQef9BiLQJ/qqAk5GGyVcjELrVFbsx2Kc+CZ dfwhm7xiSEkBRUyBcS3XWGZInsFTJyy74e3tyn59CT/5VUOFcecU4Q5Jb6Dm7XIxYSld JAxnTfPwd7MGfw0MnnxwmbSmX4JNq7RMZ3GREzTqAUavBHwhXzkGSlKWovwOXjKs8/pq eCTLLdWNORpycONCwsM8g26eimdAcg1jWsU4QSpDbKGZrd8aJ2HKVtA+16w5CXH6sege JIJA== 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=dXoJ7H5mCPYbiowdp/bdcfO7yexvHPNiE8h3FKHiHvA=; b=Lp+ffi46F6wu1/TMIu7AsJd96FN2CrMTdqPX/33NyY0NKdlaKRcbIxug08a9J05dXC 7t5MhdNSgAq61mj89ZK+q7UADj/GAZEOUnBwYE9gUcUxayFOr7kkjUrjfNrFHEUDeRIt HMHe2CNhZ5IeMWcpX4t3OvpezYta3zlmvvDhNgbAgwF+Etmb8wLDQFYL9cd5WZBjuto9 E5JxEsngAd5KX5ll8jD2Nfni+AA3jXUwbuCO3XQR51sBA0IthNQO2uN199y99booYR5Z 5qc2uEQrZCORkSNfXlgN3ANHbqppuz2Be6f6aTrqKdIafHKGytapBxq735sLN0enilet POwQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=R0ZsuJhL; 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; bh=dXoJ7H5mCPYbiowdp/bdcfO7yexvHPNiE8h3FKHiHvA=; b=DjjXdnSHmPsSNVqknJ6fMgDwXg/0733z+Cr2Cpy9JPmcqby5sgOjM+2Exa4CDcxuQL 0Y95qRRMqqq5TGBZUg5AmDUkYtEJIP1q/fnOzquFE1a5JaiqK4mUdF/YPvS9dROYTlWw WqKNjPTJp0873ulzQfyZ8JCqg/Xdn4j+5wPYQ= 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; bh=dXoJ7H5mCPYbiowdp/bdcfO7yexvHPNiE8h3FKHiHvA=; b=PDrXy5JOpKaPQ7GrMHXUpvUQy8rvCpGL5EhNM30Cj46asW6YpIiRLadM/vsWpHQ1Cf 2ZT6PraOmax9yhe+39u65ED/lD3Y5gNL6T25fKqafDkccbSgDLijIV598oGOaHnshM9V Otxac0umHlVIcat/kCJuFfMz5zDf+3c8APeEqTdc4IuNLLRLoaoSxikRGfiO5EEOeNlu PV6nqh5XXappLbf1tnr1ZLYp956B/9hTaRf7lUk+1T1l2vafvwPkO98bS/4jqMYfTqlC x5S6QpB3w4FKeJGDwfwhTSVyHrxjsvqEr0P+GUgn9KXsFkwPj4DoCZMxnhFN3Kh8bIBB rXDg== X-Gm-Message-State: ACrzQf1Mf/Kzly0SwTxBHVY96ebdIlB9qau/lyiAQahOPKFlLh5pHp6B JIO3BodGJnmDENtVVFS0Da+Dw/90 X-Google-Smtp-Source: AMsMyM6Kj74j7pICs9rXR0jUmVh6k7zslq/iTEgab67ICi+PPBGrcDcKJ6mczHS5FSueMWb76Hcx+Q== X-Received: by 2002:a17:90b:4d0d:b0:1fb:a86d:e752 with SMTP id mw13-20020a17090b4d0d00b001fba86de752mr6776975pjb.120.1663352316500; Fri, 16 Sep 2022 11:18:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:7404:b0:178:3881:c7e3 with SMTP id g4-20020a170902740400b001783881c7e3ls10126103pll.11.-pod-prod-gmail; Fri, 16 Sep 2022 11:18:35 -0700 (PDT) X-Received: by 2002:a17:902:bc47:b0:178:2321:3809 with SMTP id t7-20020a170902bc4700b0017823213809mr1030635plz.147.1663352315369; Fri, 16 Sep 2022 11:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663352315; cv=none; d=google.com; s=arc-20160816; b=KiZy5znkWj8sCeFrnr9Wibj2YZJgAT6TFpxTjB9y6n9AHlhqwLlJwm4WeCY+x9ajbx g5RlJe3efbTMX8fAuDFAhvC7klVgbo44Tf+mGVw0Bsm5EpSUh3pAt0eJhj5bmc9ah1kU qC7sqFqTqtkxq3PCm/R8odrjp7TCjdHypmBjRvRk2dmuePzL3hrNTfkoXCXaESv38DNP VMImKm2QcY+Aq3lWBt8WUTJdcYcMy1HpqFLilqBv5n3HLZwqis4hOqIsKkE62GGB7fiz nUxR8hTitBxLFqwzfX+PlvTykeopFbv8Ysj4mB+Qj6V5nht59z0s4Uvokb4GLJti38J8 6qMA== 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=Fc62WtE+diGKtw2GrY24ZBJ7TC7RXBsfA1l7ihTvf/0=; b=Jvio+X1fFjDq1I9zE9f6SO/zBa1JcKU8ziM2o4bs4WbHCztXsFFTUNSLqpFmEyhWVz 3/bWWkmiKOIYVqHnsvDXsYc14i6SdLegu/9K7paG7nhSQ5NbE6w6PFLzzyrv98XSDnAL 0RpoSNfZe6BhTwKWfakuazPIPZbG/3SKaIPX3QCXDjAggMTrQCPcMoojYpP1bxaMnzjF eweF1SkWn2a6PCFioM48Bz/Uk3LzLnIkQJ7+uhIDvvnEGrS0KqSfeM5YLxZ+0pX8DB1J /diK/IPZPQWC6j1+lzRp5//b1jlDemZePV5h0xTFlPTvIhT5lYfklHb3MA4MJvyuDL85 PZaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=R0ZsuJhL; 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 s6-20020a056a0008c600b0053b3b9f729dsor10302974pfu.78.2022.09.16.11.18.35 for (Google Transport Security); Fri, 16 Sep 2022 11:18:35 -0700 (PDT) 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:aa7:8115:0:b0:537:bd1e:1519 with SMTP id b21-20020aa78115000000b00537bd1e1519mr6132882pfi.14.1663352314327; Fri, 16 Sep 2022 11:18:34 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:ae5d:6ee4:5c2f:6733]) by smtp.gmail.com with ESMTPSA id d14-20020a17090a6a4e00b002007b60e288sm1770000pjm.23.2022.09.16.11.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 11:18:33 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , 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 v5 02/11] drm: bridge: Add Samsung DSIM bridge driver Date: Fri, 16 Sep 2022 23:47:22 +0530 Message-Id: <20220916181731.89764-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916181731.89764-1-jagan@amarulasolutions.com> References: <20220916181731.89764-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=R0ZsuJhL; 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. This patch is trying to differentiate platform-specific and bridge driver code by maintaining exynos platform glue code in exynos_drm_dsi.c driver and common bridge driver code in samsung-dsim.c providing that the new platform-specific glue should be supported in the bridge driver, unlike exynos platform drm drivers. - Add samsung_dsim_plat_data for keeping platform-specific attributes like host_ops, irq_ops, and hw_type. - Initialize the plat_data hooks for exynos platform in exynos_drm_dsi.c. - samsung_dsim_probe is the common probe call across exynos_drm_dsi.c and samsung-dsim.c. - plat_data hooks like host_ops and irq_ops are invoked during the respective bridge call chains. 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] v4: * include Inki Dae in MAINTAINERS * remove dsi_driver probe in exynos_drm_drv to support multi-arch build v3: * restore gpio related fixes * restore proper bridge chain * rework initialization issue * fix header includes in proper way v2: * fixed exynos dsi driver conversion (Marek Szyprowski) * updated commit message * updated MAINTAINERS file 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 Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- MAINTAINERS | 9 + drivers/gpu/drm/bridge/Kconfig | 12 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/samsung-dsim.c | 1687 ++++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_dsi.c | 1767 ++--------------------- include/drm/bridge/samsung-dsim.h | 112 ++ 7 files changed, 1935 insertions(+), 1654 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 1c6a5d0fac39..db341eb0f4bf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6634,6 +6634,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: Jagan Teki +M: Marek Szyprowski +M: Inki Dae S: Maintained diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 57946d80b02d..8e85dac9f53e 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -231,6 +231,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 1884803c6860..dae843723991 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -15,6 +15,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..ccaf87e19e81 --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1687 @@ +// 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