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: 2775 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B74D044AA6 for ; Fri, 3 Mar 2023 15:53:21 +0100 (CET) Received: by mail-pl1-f200.google.com with SMTP id a9-20020a170902b58900b0019e2eafafddsf1503552pls.7 for ; Fri, 03 Mar 2023 06:53:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677855200; cv=pass; d=google.com; s=arc-20160816; b=B3gSAnksS/dUQD1rwvMxTGVWTumKrOAOvfiBR2H/fHfOi6qXi3cfeoRnXO2nSeO4fC nuDtFRfNgReEVEIO30JSBAstknWvmU1KBS/ezrR5DSrt5sdicPACJPcziSnyN1yH85U0 gbKkDxhboYTKuAw46bQ8y8HphcXLz/cxcreQqvgxijrKvc8BTnEJcmhB/+U9lMcqn9uY XWkrQy33oonh1QfdBC+FwuH7+UGh2GDXlcqJyHWac8y/yP66OzYrckhLz5ZQ3ploh9jS g4ipW0dLllajHpUQPHrXZbmvBmit9BZfIMrN6N8w9RDmNVZDjRQyM6zES2bNbL9rYkUg qjmw== 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=2DqQj9LJQ8AwpGI0nhB8Ui2YtkNvkM/R4omuQSaK4nc=; b=YUZHhXbyYOQZdymw86NcoijuZEz/fHw69UcAVuvA2hQanM5Z6gnyoTUNUqOe1jDVCb OVzrKlCNPkk5o4vu//qUHLK6KIsVcOkVSZKyDrDtAihXoCQAcqgZOPuruMVIx2A1dMrG 5o8kww7JJT3WrrQOHOL9IsvLg4B8U2z+fXEKpgwfyT49nAGRdjOB9G4QIpFmVT3w8B+B iNEOj+8IFOf82b/r+W9uXK1dRhKTOlJC8Z3PFFeIVZAZPlN16PiRdDdfbOX+X6RN+Us3 shgCV52TugixpyRgPFrDcumMRCZaNrbuSIESzivewH5QJyAhWdmOCx53s/GSSHolfuzL 4f3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rgWm2wDS; 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=1677855200; 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=2DqQj9LJQ8AwpGI0nhB8Ui2YtkNvkM/R4omuQSaK4nc=; b=m/ehkf3yAFIT0L6osZOLcClLm14zV27FE/PesOVw4swWQprtCYftABQRYVduhXBuq2 2R4s0JVs9Z3vai6Sb6XYHs5AnnXWp2K0YVgM4OwDDbVkalDcf9z12Cl8noON28XtpJpo 48aCeHcnL/8S67hZx/CP3pUR8bgN3X+35IjM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677855200; 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=2DqQj9LJQ8AwpGI0nhB8Ui2YtkNvkM/R4omuQSaK4nc=; b=Kso8ZecmgP/IjWTHENRUP7nveS/lBSPevpyHpadpvWUWtNJ01Nb/nTdaIUrPg9UXJR ZRaGRrbzQ+R+5NjbNlcqGoWkWPrZvtNpHiGNYo1Tf5sX7i67FxvlWtWC4yRJkDQScEa4 1Kko4GuYbxHCW5x9jH/yowGvP5UqjtQE1OF5MC5ggfw9HetcBKP7u8pjhjVdTSPTYO74 +HfBMczub6cYlu1GdlOT6/VNuYZXzxiF19X2YXoDqd4MpDGbBNK/twvEJLeFNofrJnLz BcKh/eVBfbz9D+02Jadcslh8PcGf7uMgnGJ+idVeLn7m5oUKxRIoVAeRZP/aZ7x27vJ8 xsJQ== X-Gm-Message-State: AO0yUKW5Xep/+05NxXogOntMorcFfhWJyaCHgJm0k6tSm5WbdyK3Ta2V z049D55M2fO8xuDIe03H0RRDAcuN X-Google-Smtp-Source: AK7set8KVgumZ9ne5a1+Ib1Tf4AzgtzOBFrmR9MCr1NH9vqbnpzFWbCNJtJuxvHEa3rC/+rPRvg/gg== X-Received: by 2002:a62:828e:0:b0:593:da6f:fb1c with SMTP id w136-20020a62828e000000b00593da6ffb1cmr1015626pfd.4.1677855200422; Fri, 03 Mar 2023 06:53:20 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:f092:b0:230:cffb:708e with SMTP id cn18-20020a17090af09200b00230cffb708els2777047pjb.0.-pod-preprod-gmail; Fri, 03 Mar 2023 06:53:19 -0800 (PST) X-Received: by 2002:a17:90b:3a92:b0:237:6d4b:7cb7 with SMTP id om18-20020a17090b3a9200b002376d4b7cb7mr1857377pjb.41.1677855199108; Fri, 03 Mar 2023 06:53:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677855199; cv=none; d=google.com; s=arc-20160816; b=zcMCmFulA7QH04ZoB3tlalbmuKbREcbTZSGT3VWRyDORMLjlvbLNG/JxEU9MnTkR7G VAC/4zK4I9NPMnyvjvBNpFdAl2nacJDKQ+AuANzQ6ueynAhqJrpkQAviG7bXQtwfCCUn IA40I/OvBwDoOg4LecUXZhs22tvABRtT+uD40qjPUgdRIm+IfvPvwDL1DIY1/EdIrkT5 p6zMeJFQcxD2Cq9UIfstonfc9ubt+rG8odhy6qPR/FiL4CkxEPjBLbBuq7LKN5C/jlv8 uXv2IoBPqVrxzIxC40XKMUF6hRVvtuK/4vFbD/7SrgIs0QY4HjREW2+FY25kCQ6lRXD1 PkSg== 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=AUDhv2F2gloyZVsSFnMj8a6i3CQwzzAovnYe5a/5BOo=; b=uxKfqBPkZ+AT9xuZg99aooQ5L27aY4oRH82ZSVrA7EXQ4oULoQHu6j0MJj1UY2J4s1 YTqjY9V8gQzt4Zv/t3+955j337gffrEK3lMQjmh/SsGifhUFSrYJzPNIgsDKyJwb7OCJ zKhLLj6lR9lptLrMlkOQz/Cw5gpCc+C7wlSNtaObs+oOqCWkczj6ElmrOgVJyZ8pKzWu Mfo2pbmO4lEbsDFdp1H4qJ/h2dqcHv+iIITZ+hMf5y4q363UhqyXSti4KortAoTfNcR6 vyEX/aIRlkc06G/DQsnwpmEfOjZHrUHLtqHBL8Ns2ZFMIMbbOgbPwgnrd3QYQcWjgu4o rO5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rgWm2wDS; 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 y15-20020a17090a600f00b0023500af35c6sor1058428pji.17.2023.03.03.06.53.19 for (Google Transport Security); Fri, 03 Mar 2023 06:53:19 -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: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 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 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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rgWm2wDS; 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 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