From patchwork Mon Aug 29 18:40:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12958334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0965BECAAD2 for ; Mon, 29 Aug 2022 18:41:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79DCC10F6A3; Mon, 29 Aug 2022 18:41:23 +0000 (UTC) Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0366710F6C9 for ; Mon, 29 Aug 2022 18:41:02 +0000 (UTC) Received: by mail-pg1-x52c.google.com with SMTP id bh13so8469019pgb.4 for ; Mon, 29 Aug 2022 11:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=P8VFeEM/BFJI467dCNlhyUmXQlADynuLsgzoWk47wCg=; b=EPSFr67+xfTIyGBIh3RYgbAX5fNxJaVR6R4ntWQPcH3goFHbRgOpUTUkozy0PyqKZQ tWUTihCpY0hC4P8R/uimrljrbbklIXgyvl9PBBh+xn73amdL/ko7cBn8seP9Xdh4fzFO CN0iAuNlqPllYtuV4HfqBaBP7P2pxnhBzqWQ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=P8VFeEM/BFJI467dCNlhyUmXQlADynuLsgzoWk47wCg=; b=RBIuFkwJqKXNDOTXgbVPxePl0KUtNXWrL8Mx0JChpmwHnVt8TIq8vSwK8aa6I01r0G uT/XSX1PeqLScT3aFyb0ve/ogPPlnmMRLLMaFB3VjoiezpEbrRKn/cVCkdEjZSpaZxhf 2HCTKEeqA0+ERHHQsX438UaP7THm/KvKRfJONcotan5Qgw9/odwyn7B0nNRfTT6IXURn aKrEpGSEFu57xpDsOL7xbo4RA7Vnq7TXlpxTgrRnRD/DlA/9P2F6KVeDc8WTDZcvfibm EzgvpCnIg95V3PN/RYx8Z2Ku+w5PO+Lm3S8pDTEPzuotJXY1VNEdYH1xgAltnAhtwvtE 6vhA== X-Gm-Message-State: ACgBeo1mDdsaEeM92fpjaCv5GGvwGGhInrcVongq5YEErJEWVlkLSTXq 4aG+LT8bWZJq0s+Yk6k5Nv5Wig== X-Google-Smtp-Source: AA6agR6PuGUOWRB54FiVXcq+DeYxGBCJLzqGuDD46zbx+u/8z/espw13ja8BVRylsZBCfn1YgyGaPQ== X-Received: by 2002:a63:1921:0:b0:42b:6eb3:bce5 with SMTP id z33-20020a631921000000b0042b6eb3bce5mr15304041pgl.231.1661798462536; Mon, 29 Aug 2022 11:41:02 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41:02 -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 Subject: [PATCH v4 01/12] drm: exynos: dsi: Restore proper bridge chain order Date: Tue, 30 Aug 2022 00:10:20 +0530 Message-Id: <20220829184031.1863663-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, Matteo Lisi , dri-devel@lists.freedesktop.org, NXP Linux Team , linux-amarula , linux-arm-kernel@lists.infradead.org, Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Marek Szyprowski Restore the proper bridge chain by finding the previous bridge in the chain instead of passing NULL. This establishes a proper bridge chain while attaching downstream bridges. v4: * none v3: * new patch Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index ec673223d6b7..e5b1540c4ae4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1428,7 +1428,8 @@ static int exynos_dsi_attach(struct drm_bridge *bridge, { struct exynos_dsi *dsi = bridge_to_dsi(bridge); - return drm_bridge_attach(bridge->encoder, dsi->out_bridge, NULL, flags); + return drm_bridge_attach(bridge->encoder, dsi->out_bridge, bridge, + flags); } static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { @@ -1474,7 +1475,10 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, drm_bridge_add(&dsi->bridge); - drm_bridge_attach(encoder, &dsi->bridge, NULL, 0); + drm_bridge_attach(encoder, &dsi->bridge, + list_first_entry_or_null(&encoder->bridge_chain, + struct drm_bridge, + chain_node), 0); /* * This is a temporary solution and should be made by more generic way. From patchwork Mon Aug 29 18:40:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12958335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 004E3ECAAD2 for ; Mon, 29 Aug 2022 18:41:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A95010E603; Mon, 29 Aug 2022 18:41:27 +0000 (UTC) Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0A8D10F6A3 for ; Mon, 29 Aug 2022 18:41:10 +0000 (UTC) Received: by mail-pf1-x429.google.com with SMTP id p185so9029719pfb.13 for ; Mon, 29 Aug 2022 11:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=kspNOPSLazs5hpv0JH2NICTBQRXcEpKsp5YV9cX8SIc=; b=E0eGf8oPc7K442fH3lbd498MenMk+FFppK+LZSXaGXRrong9Dh+pSJeWaaw1HHWDSj ZSyQe39Sh5alpF+PnLRtbxmc6zf6bbqvRTGj9mHFhJ3dp03kWKbmlpPBqWyjPuDkk7j4 dgHVptJvACcWMPxjlLhAK1X1CLFQtHPr+O440= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=kspNOPSLazs5hpv0JH2NICTBQRXcEpKsp5YV9cX8SIc=; b=eRRaZOPM7Or3X+OOotyMPlNBXTN9DTp9hw1UVgifv9bRDE3CWv+i+wJOHF2b7t/L+V Jc4F+/d4wA9/E7vLHZDv+rhsVpfjFauy0yktNtiQn+4nYJeHF4cfmQdpLCAn3UkcbiUH Cs2sCQB5fLzXmxTsvm8bFP+El1JxrJIHSwSPAyaTjqNFXl01lQG/GiOMbegOJQYxZV0W vqA9V8wMTwR1aehdrGxWGOMxT2aacrCX+NiBEdrum1H6UH4LXczlyd3fpDIvQSNmET3H YRQE8l36VXtgo+wiGFSlGE1MLItEBEYTBt7g8noNEPvoYgH0Ob52Wu5MQY4Ru4FLQjwU gkRQ== X-Gm-Message-State: ACgBeo1Yn5Mjqnoof42iPw6/feneLG4yWvNXrig3jX2vVIBibY1S9zF7 rZdYkFNJKjLv6rvG2cuSJstfQA== X-Google-Smtp-Source: AA6agR7wxsk4r8U7RKlUdQmK5ka+cQcOFLyS786CIg4E04+065vsqkuJHrUPd/aW0hDuLwDIzlQpqQ== X-Received: by 2002:a63:85c2:0:b0:42b:497d:e06a with SMTP id u185-20020a6385c2000000b0042b497de06amr15174218pgd.479.1661798469621; Mon, 29 Aug 2022 11:41:09 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41:09 -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 Subject: [PATCH v4 02/12] drm: bridge: Add Samsung DSIM bridge driver Date: Tue, 30 Aug 2022 00:10:21 +0530 Message-Id: <20220829184031.1863663-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, Matteo Lisi , dri-devel@lists.freedesktop.org, NXP Linux Team , linux-amarula , linux-arm-kernel@lists.infradead.org, Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 and keep maintaining the exynos_drm_dsi.c code as platform-specific glue code and samsung-dsim.c as a common bridge driver code. - Exynos specific glue code is exynos specific te_irq, host_attach, and detach code along with conventional component_ops. - Samsung DSIM is a bridge driver which is common across all platforms and the respective platform-specific glue will initialize at the end of the probe. The platform-specific operations and other glue calls will invoke on associate code areas. 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 | 1686 ++++++++++++++++++++++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 3 - drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 - drivers/gpu/drm/exynos/exynos_drm_dsi.c | 1715 +---------------------- include/drm/bridge/samsung-dsim.h | 99 ++ 9 files changed, 1868 insertions(+), 1659 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 589517372408..301478f70b41 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..ab2fa0f42f40 --- /dev/null +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -0,0 +1,1686 @@ +// 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