From patchwork Mon Jan 23 15:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2668 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 ED9793F039 for ; Mon, 23 Jan 2023 16:14:14 +0100 (CET) Received: by mail-pg1-f200.google.com with SMTP id a33-20020a630b61000000b00429d91cc649sf5492425pgl.8 for ; Mon, 23 Jan 2023 07:14:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674486853; cv=pass; d=google.com; s=arc-20160816; b=Y5YAGbPdQH+o+vOwdt3lIardTbGTQYIPtIiG3C9nandhJqKvwqn23f8u709kwXPoT0 GsQm4FsKvhEyJ77YxZ0LB0LZFD+4+hjqmZtjoj2fEiF5fE87Je1qmb5h+b72W2jpnlqD WT53E9/SYlpAOn5pLHeZk6hVr2i6jrNudFTUnsLGcRVWXaWCWUb8EyQW70xvSJ/etUHi qVH4RJNqkgCeyZzeaDYf+fRl+sDD5Es6BdJaHF7gpvpZhKyNf+ZvVQRCi4Imm9WEGMjI iB2EiKnJdBVU/e+wjczA+4nClaUOQ7bvYmQwStmajCCfXZNO8ADoVT3Hyp6lmBB7oAs9 JGmA== 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=G17i0U39SI3JLRv6TACIgUJLbF0D2H1XTRPOT31ndAQ=; b=tzLSCwi3kkSr4IVjG3mq9N5Ghzc/qOFUHxri2l+9Ko4r/4R2B0U+beU1JrgcF0nQ3z zbCDt0cYJw8H5PotXngEIEZvDVC9LIg4gDRYG1gypWo7Oos/lmfrs+qSR3NaoOp2g/ON ewZcwWU5Pg18KpXPmEzKurl1DEeEFNv80h4MeXcUh1bHH0A80TWIDCYrRCW0uUhFMoSV R7dX2dAIEFnH5qMpGb5mQl0ICz8bdThFr+2JE3gnpScnAjhD7QCYN6hY135M+Tk585np pY+TVpoRmG7DszooFi7eUV04+CwuNLMQvGM3Xw2S0loTQi8gUTfDRnNVz69ZeU1g9l31 Fwzw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kwls0BZ6; 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:message-id:reply-to; bh=G17i0U39SI3JLRv6TACIgUJLbF0D2H1XTRPOT31ndAQ=; b=lxFab8ncIUjzPwG1xvFqdugIe31NUJ+FdH04prWiwrg64dv13KkW0D8kQHOJvdBogW jAgM5yPxLvv0VyobVanyVatp+driUfLfRSOxJBxbLxwfvyywbeDw4sdT9PfaEWY2zaW/ j99bopfPFkzV7bgAELALEWM7OszgYx7VWodsA= 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:message-id:reply-to; bh=G17i0U39SI3JLRv6TACIgUJLbF0D2H1XTRPOT31ndAQ=; b=acTn2gfZeHoE16ENxsKQcRmq7XAFBgi5bPdEjn5ELcEo16sEIUVaymhtNaIy4lIa6f wTRXF/FPHTqBeOCalY/QdzY0qXRHAL7urHu2BPmqxyqKRTryfWcU+kGd2x/GhJ31xm8W yAGpZblQqskk6SZyNZ8I/K6xDD6pyyet/1nrkYZNrkUBL+DSkwvMdBO9Dr+B5OCpCK/Q DzVAdTNy9pvUcpFk7gMqBY/Vf+MVQj5Pmwdr+d4TVupmfqSCz0gpRAk2mdjsg3Px829r c2zS+lOjH5YRI0FwnZkjEx/Wv+ywbbVqdG9PFDxEsOkxRLGnBTUo2JBToBs2D/eNiGH/ ioFQ== X-Gm-Message-State: AFqh2kr2uLJyXCavnq2u95F3mJd0WHXhUox7QMcTmbJ/MQFuBRaYZG3W +jw1GzqZdsmqRlfmXsNgMBH7AeV2 X-Google-Smtp-Source: AMrXdXt2tNXJlsaPiMgrMx8k1iBR2tGDQr+q898ngRy20f3BA+sjcJU9PEvvslGaioH0faUMYBE3RA== X-Received: by 2002:a17:90a:e2d4:b0:22b:b41d:979a with SMTP id fr20-20020a17090ae2d400b0022bb41d979amr1560000pjb.231.1674486853345; Mon, 23 Jan 2023 07:14:13 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:fd96:b0:214:246b:918a with SMTP id cx22-20020a17090afd9600b00214246b918als9647596pjb.2.-pod-canary-gmail; Mon, 23 Jan 2023 07:14:12 -0800 (PST) X-Received: by 2002:a17:902:f312:b0:193:678:df13 with SMTP id c18-20020a170902f31200b001930678df13mr19627567ple.36.1674486852232; Mon, 23 Jan 2023 07:14:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486852; cv=none; d=google.com; s=arc-20160816; b=wt6/iqiYw3H/WLn0MxSGFSsULi1ASY9AwXRczmeWtkbHJ72gGYEJxmUA+EhGpcYsXl lKpPLPuYy9xDmbJSieRlWgdaRo00EFUsnEq7YOzzNxuCu1fkENkAIH2UHKD3Q5ILUebX HntHSp6J9oaT7ORG+pkZSJFLPrvre+Dylc4ebuD6mB6D6Z0ssHLg5vOcr3LNPNaFFvsM 4+5G3lKbAcbkk8Vjpj947FxoswxnAejF62f/N3Os7pUg0hE4adIiCyBjyJCl0cYegXI4 d7Wpzmzwi1CpL4LaKnQIBnCtXUoIdV5h3kDgL9KjRhXYTarzL8riRiOwp2GjoOk0zqlf acNw== 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=1FH764tlB3M7/h0AyMeuxdZl7Qja8D2bL5oyB9vThzQ=; b=K6HwQG2KcfCXjOBR+GGfAicfRk6KWTS2dpPKK1haBVlw+ABR2z2RHxaOin4VYSX9Vb 7bR7OjjHVlyO1YhKOYJVK6Vee72+HJTOGqupu7ytrpeIxciz+ax+Tcno2F0iXJvkmDzM 5mEw8Fboqy3PtosHnTzOQjrtV5X3iCehmJ6xmU3FVcynH+Le+yKCnWwq4gqnRq7+G1B2 uYrXVdyMrRtrJvzoT5sHGnkvA7yrGFqbUeDemcbBC1EpamFlNYfk6wJKGPhe4nY8aYXd CsiumpKcrLW3DGlQUe4Hd3Qd0piKYPTI/Rhmm5Qh9hH0GqzQdvtcEhbuwc7FZE8z4vIf wz7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kwls0BZ6; 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 p8-20020a1709026b8800b001931004fe80sor822652plk.114.2023.01.23.07.14.12 for (Google Transport Security); Mon, 23 Jan 2023 07:14:12 -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:d48a:b0:194:d872:667b with SMTP id c10-20020a170902d48a00b00194d872667bmr19700553plg.49.1674486851211; Mon, 23 Jan 2023 07:14:11 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id d5-20020a170903230500b001754fa42065sm19207111plh.143.2023.01.23.07.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:14:10 -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: [RESEND PATCH v11 14/18] drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge Date: Mon, 23 Jan 2023 20:42:08 +0530 Message-Id: <20230123151212.269082-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123151212.269082-1-jagan@amarulasolutions.com> References: <20230123151212.269082-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=kwls0BZ6; 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 Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki Reviewed-by: Marek Vasut --- 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 | 1817 ++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2001 +---------------------- include/drm/bridge/samsung-dsim.h | 117 ++ 7 files changed, 2025 insertions(+), 1933 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 2758e7a64fa5..b67569e484b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6738,6 +6738,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 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..645071745760 --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1817 @@ +// 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