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: 2320 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1EDCD40F47 for ; Mon, 29 Aug 2022 20:41:13 +0200 (CEST) Received: by mail-pj1-f69.google.com with SMTP id rj3-20020a17090b3e8300b001fae0be4dc4sf9910706pjb.7 for ; Mon, 29 Aug 2022 11:41:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661798472; cv=pass; d=google.com; s=arc-20160816; b=gjgLu2kNuTz7OvYoJQR43/sjpviZe6FFQafiY7PZzJKgvyO7Zqj04LbrVmfU1BDCEU CMaIetdcYzK9rhAGmHTuO1E90e//9BoE0jFMjxXpLLnonjuxQzp8XFnLZ/ISle4F9Tbr 4X3jJK9xT8S0o577CfhgxtbMEY9wkUPMziGGYjYgfHsOlX3eQMv3RBwxs+FQf7tl+61b GTV3+Lk+wRhdeG5GSOClTxBeDx+Z+4arj5OBimj/Ktq982y3oJmpwYXEzYuyCUOlHGqi MkLg+sxBHv+DaAUAtf2/uCmDKjiVD1FYUtdEVCa2vZairuBqmIbVHxFI5LUPlKOTvQUb lphg== 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=LcOjJtLn6C/P16/3kBE2hML5xA8PDIeTWLXJUTNFTgE=; b=iKCS2gxxyG1p4yeNVx20fD3Rr3w3p9O25m+IE5HxDS/gHSOGdysnmTJoFXXbuKU5vf EWgOqDtFnF3L9oKiUiz+4DYoRMaNVae8vmnbgOrOtGffTVLp4WsngpGw1fCIIAAIT6n4 lbD9L7zaWpO5H1gcxQFkVBq0QjKqYmAXMljpKqLDCJalvK7Omm0yoj8HsOvv8o06wILj A6gsjbKk7rVIuTemR4oYTWIw2755dhIPe0fax19lF10OF93E/C7afa2OhOexO3el91k6 XybX3xKAEdeqAxw1Y0y+NGNn4lkT/s5SETBWEj1Br1XKRAgFfhYe4+rMGj6Ws9tud5M8 BU3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E0eGf8oP; 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; bh=LcOjJtLn6C/P16/3kBE2hML5xA8PDIeTWLXJUTNFTgE=; b=mKHu1g0LzZ7MXYlDnq81h2gGrDPBsv26rt1PeM/RTvcBwYc8JJDaiaM2zLYV0H52dc 6kcH7GYpGVnj33eLlAEN64LzN5ZBFvV/RFmvlDz+9W4zWGH4Ta6sJqBfHFxejdKVPTjG OOws4vlfubxDqaknk2G+/cjNTZRxZ35IRDUYQ= 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; bh=LcOjJtLn6C/P16/3kBE2hML5xA8PDIeTWLXJUTNFTgE=; b=39TQ5JB4dBS0q+ZJalYcI38nAUJUaYIq2RN4kuF5ZbUHi7PujhDIE/15G2myoytz4Z suUQhM7dE4qqEOIPmk9WDS4pNJdzsqVvu7ySGvqVE8ecCfXXy9T8Oo9PC+XW5R32GGh/ rpjclB1oQ4pBi7X/JbIGY1zKNa6nkIFnHTfLJQJn6qMR/OSyoFaham+3a840emsi3rLI YjpSHXAqtkGVApeGw9iuPY6JmQBZI4zYA5CSG2LFfYtNYrdq5NpUx0gSNaUfNru61a7S /suaj+/LCIrhXvRluPWw6GhxTbDJDQR4frvTD03soLRoGZWS5L8iJWpVvFoRew9dIbqk o2wg== X-Gm-Message-State: ACgBeo3z9B7A+NqobyNNUFyJncCwk8ORrxJQxRii7jVEI59dZmNn9jBD Rq47cFMhRDZ7chIPE4+ixbw/vp7E X-Google-Smtp-Source: AA6agR4cg/DNA98Se/HiikjOUbAZKzGGQdf4y/w4bKCjQimJcwMzvNTpS5ONtxxaFb3+ZdEIGpZWaw== X-Received: by 2002:a05:6a00:1382:b0:538:1e50:a161 with SMTP id t2-20020a056a00138200b005381e50a161mr8152916pfg.43.1661798471694; Mon, 29 Aug 2022 11:41:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:2e87:b0:1f3:1fa8:829d with SMTP id r7-20020a17090a2e8700b001f31fa8829dls6565175pjd.3.-pod-control-gmail; Mon, 29 Aug 2022 11:41:11 -0700 (PDT) X-Received: by 2002:a17:902:e5c3:b0:175:534:1735 with SMTP id u3-20020a170902e5c300b0017505341735mr1849391plf.87.1661798470632; Mon, 29 Aug 2022 11:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661798470; cv=none; d=google.com; s=arc-20160816; b=dBt/4PHq4eJ5LU/IdHbV9fUygUWmnYLOgnzkDnp7DRjOiC4+xMyOYfMQW6fHnS1rc1 2lKmtVElNRkwYPbf42kDWFKNFrZqFutfXGCpAj/CYg3iKL8tna4V5jBRzxsIgTVTpKQ+ ZHbuZpUX2JZ+afhgAWwmItqaxHTgTA+FiFOSjmQmYouqdp2qtPU376oOaqia3brO1/rr wWHhdIU5wlzgC8YNjfII9S7ESyCDULksY4C7yyY9ZJ9qh6+j7R7ZJBqc21kzP8+hfX24 8iMvXA3hnnmHrmXVsbDGhQubVbvnE98aAGDoWP8D0cTI9jT+of3V6LCzmuEKGXqzpnEL /6xg== 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=kspNOPSLazs5hpv0JH2NICTBQRXcEpKsp5YV9cX8SIc=; b=OGU1V8Y7Qk3VyFsl3UaCae3A/4q3gidC2c6fevyX/KObFtLB0PoV0aNCtf3f750IFI zmkWYuEFqJ/+bRtbuTYND56y/xygBX6p9Rup8m+rF5AHZfJp4j2LkUV5zlWQ6TgW2Llk Rnf8LxNd6Rau2mXMfYssXjedyn6bTJwtx5fWvq+TrWUx4PJL/TZQy4LY6eXsjcX2In81 U3YYJQchBp+4oitrJ8Gu5bAmntINofgYHMqoazdHuw5Or2U+jZLUv2mK1/7DLrZteEDs wQdKtPnWh8ngpY7zpJAaais5iJCG7peLO8uZoQ7uvllRmKNVs1wwE0nTJbBn0YOiCK2b 9VgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E0eGf8oP; 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 u63-20020a638542000000b004293d32dcb7sor5108pgd.59.2022.08.29.11.41.10 for (Google Transport Security); Mon, 29 Aug 2022 11:41:10 -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: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 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 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 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=E0eGf8oP; 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 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