From patchwork Thu Nov 10 18:38:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2468 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E16393F039 for ; Thu, 10 Nov 2022 19:40:41 +0100 (CET) Received: by mail-pl1-f198.google.com with SMTP id b18-20020a170903229200b00186e357f3b9sf1892889plh.6 for ; Thu, 10 Nov 2022 10:40:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668105640; cv=pass; d=google.com; s=arc-20160816; b=pU6g3qz91E3b3/NtF2kdhvpyyhbon7UGOL1GQlQgaCdt9oHCHdHM7sMb9X+82xZ+ym GA4nlTxQHs7d098waOKLizsk39NGPTzGl5/AcEPw8mEvhrMm90WAs8Z1P4QjCVDWqoe3 IpOQLfxycDiZEZBcUgfP4kIooCUbWVNW6/Y0CZrdKbT3Nul3gtL7Wpr8+UgRBpv9h7BC KWkogF4xZp11VAS4VWxPbvYEt6Yk/Try7CjIQe7zi6xzwTSvlfSDxVnVmGBo8OnKvSWP XNLo1uY05Z8v1fJKQ7R0OwgH42+LzvPohurD2s6yhaEUSjTLvFr/ty+gAJizcBxvlNqw qJeg== 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:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+cNhu7e8hAphKYfZlkgwMQwV3AFsRHhqNgucyuXYP+M=; b=Rv9FlMANM76P5z7R2tcU51VrIYlazNU6BgNP0KptotVSm2KevrcMkxSGhKmtp5runr pFwDtwfeoZlustiuBe0nc9/7fhK+newcp8pD8TQvHXqkDZqpdCNFBmCSEL9oiZnlKRer 5raO4QcRsJjN5h9JuMYoELsBIxTK5rdtgMcEuxA82Oze/l3PX+mVXgnJAyzSBG3VRvTw qNOmcsW38anFvhnsGmlqQuQNt2X7fQhCm9EZvxMdIvL38OYBhCOrIyg4GNsDAY78H2mD tK/8KwGVXaUqMUHEDtdgRSht2cm6lIwrRU0r6kUPCUvqL1DGjssAOfzjmfxH83klJMFu fKCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ctMH8PwA; 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: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=+cNhu7e8hAphKYfZlkgwMQwV3AFsRHhqNgucyuXYP+M=; b=Tng+Q/9NVzFCFbvDb48uhnoZCu7LhzmBZsQb4RuyX+SxWElbcFxLB1pCFMETZPdand jur1o1eGGuUH9WprowKi7qZg4p9bTlX/BCmXOjcbjXDHbzk9Vnqd4vApZU63qq6RyP3c ClAfIIAA8/ou9oaGOm4AucCa3k0OwTTCVxi7w= 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 :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=+cNhu7e8hAphKYfZlkgwMQwV3AFsRHhqNgucyuXYP+M=; b=qiMbrFER9bcGj7yo+v5PSqVWB5O6ANTTOts/pC51HisLps4CNHL5ufI90QXiopQLr0 QoJu5GxcgC7BPhLh0te2/NCNzugLd4fOpF1MPl20Nm4hk678dan1Kso+rbS7tzbA+Dfd 340r/iFXQmhfOaVejT/uAHpZktLqiK7NegOx6rmAs5W3kIgTSfpWKzS5SB8ukB6TLevl 6RiK+6MkDNQyEZlcJYWard8ngbCZqBX805UH5+4T9qRIkOk4kzBQDCIN2aNp+RnSh8z1 wCfJKzA7KYkV5VH/GdrxUhF24i3Bi0o06G52A/caY8BMaulNKqRDk/aqD8FwT92mE7vT mC4Q== X-Gm-Message-State: ACrzQf2mjSo2yNOlVOQg/DV1EItolfO7B9i2efv1fhZo1MiBysMNEM9l b7y0Mfekenr1kfCDnJc6hFYQGXsH X-Google-Smtp-Source: AMsMyM6TEHOE+rxYmU/+x1xCKQHttl4grphTK6BA5sLjMnniVIWK1Sn173OEMYkuMDDyIjoAaikaxw== X-Received: by 2002:a17:902:e48b:b0:187:16d8:4428 with SMTP id i11-20020a170902e48b00b0018716d84428mr61445386ple.127.1668105640603; Thu, 10 Nov 2022 10:40:40 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:1f48:b0:213:e:b27 with SMTP id y8-20020a17090a1f4800b00213000e0b27ls4164914pjy.0.-pod-canary-gmail; Thu, 10 Nov 2022 10:40:40 -0800 (PST) X-Received: by 2002:a17:903:2596:b0:186:a395:c4bd with SMTP id jb22-20020a170903259600b00186a395c4bdmr66981634plb.60.1668105639510; Thu, 10 Nov 2022 10:40:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668105639; cv=none; d=google.com; s=arc-20160816; b=DyKvWZZx9PHhMZ6R0YFfdGBJ1mBSlXCtVjhfwWiUMEM19Nlj5lL/PcQACmkw6K2nys /ezYDMEdFnSIQvuPqtTZuWFSZbrupmKCfLMK4+cVG9VDpRfsIqtd30BXw4b6KI0VIBb3 qnWg1LpPQQrZpOhcrzeAWQurn31Y3aLzkePgfc10sgBqxcndm0rXFYCDCoZhs+czcJL4 rKTK9PcNAeJYVSU0HcjBxgXLDdQSTe+et0ys3+fIWeWqMm5XT37OucCrP4oPFPnR2WBu 6o/oqbDDtp363MoW0CbcjxfqenP7dxkshphTg9a+ZaoPVSylR2a8rf8HhY4uGirmBlWk mO8g== 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=tmESCtVC27C9vnN0s5z1wOetiJMTONRB6nBBrY79QZo=; b=fOE99k4NDPoNm2FXDX2aHpPqIV1hJ5lS7MVd5sz6se8vfPdZp19z7xL3VcvzgQChyF JmwyZS5sjAbpqvSqURMG3GBx8/aBxurkpmjS+aJSi/8dc2XU/KTmyk4vdNmJ9JwVsgQx vO9+XR1AuiUBWIIbISqGkTbnTdXhiw4I09WbdxJ84JCJHnZCvVmnXIdh3K0csOz8Q1k2 gDpN6sUF9LPW/yorAWxVKJ+sSKmKwEtHdLq7bl6yW3qcci/rsiLG5QRc12nbv9JCUzRF bRVBSyaU5oIxTMcYgXlkV2pQARrna9mnaNaRplcX1jdfY+GSNDz+tF1ShLJjfmb7Nskf tajA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ctMH8PwA; 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 q15-20020a17090a304f00b00207d436adefsor2049073pjl.35.2022.11.10.10.40.39 for (Google Transport Security); Thu, 10 Nov 2022 10:40:39 -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:90b:374a:b0:212:8f7:acf with SMTP id ne10-20020a17090b374a00b0021208f70acfmr1645298pjb.13.1668105638440; Thu, 10 Nov 2022 10:40:38 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:b5a4:486a:f07:f67e]) by smtp.gmail.com with ESMTPSA id c2-20020a170903234200b001869efb722csm11635627plh.215.2022.11.10.10.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 10:40:37 -0800 (PST) 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 v8 03/14] drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge Date: Fri, 11 Nov 2022 00:08:42 +0530 Message-Id: <20221110183853.3678209-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110183853.3678209-1-jagan@amarulasolutions.com> References: <20221110183853.3678209-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ctMH8PwA; 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 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. v8: * update the commit message head v7: * fix the drm bridge attach chain for exynos drm dsi driver * fix the hw_type checking logic v6: * handle previous bridge pointer for exynos dsi 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 | 1703 ++++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_dsi.c | 1766 ++--------------------- include/drm/bridge/samsung-dsim.h | 113 ++ 7 files changed, 1952 insertions(+), 1653 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 9ae989b32ebb..ba7a6721443c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6624,6 +6624,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..b63e0479e71d --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1703 @@ +// 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