From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 05 Jun 2025 23:15:16 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uNHvg-0049Ud-11 for lore@lore.pengutronix.de; Thu, 05 Jun 2025 23:15:16 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uNHvU-0006mO-EC for lore@pengutronix.de; Thu, 05 Jun 2025 23:15:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LaTJeWH0nYAnvVEjI8ROXV9TOlSdvHVXnq1zM1Fi+yY=; b=SQSYLgZYoD4lWNRz7FfJSCLsFV eqJms3xatoHBlbJ11qknhT9L0jHBNl/EyOkohF4OLfd9kIlrN+5gci/j774GCVkxUcUrtAlVwnzvf iAoMsmYd/3INVhQLxwAhn8l44xavV0NsIzzcQzz17W1xuUFofOKJe2f/OARv3YjJrvHDtEuVE2/s2 BR0DDkcXn3eFuEGJpQdv3sgGv/ivd8PcO2Hngv156s/CnWNred5Dxgs6UbGL+UeqwQQumBif9fOuI XVJjED0vt7zpoIt8m7a6X9U5ojKtwOyNFrAbC/+2uTcRSJMpqXavwC8cIaAPCmG0FBhy1t1CtVrXC Cv9oQypw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uNHuJ-0000000Geyy-3ddZ; Thu, 05 Jun 2025 21:13:51 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uNHoB-0000000GeGW-2Wjd for barebox@lists.infradead.org; Thu, 05 Jun 2025 21:07:35 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=geraet.fritz.box) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1uNHoA-00079B-9s; Thu, 05 Jun 2025 23:07:30 +0200 From: Ahmad Fatoum To: barebox@lists.infradead.org Cc: Ahmad Fatoum Date: Thu, 5 Jun 2025 23:07:22 +0200 Message-Id: <20250605210726.1916656-13-a.fatoum@barebox.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250605210726.1916656-1-a.fatoum@barebox.org> References: <20250605210726.1916656-1-a.fatoum@barebox.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250605_140732_153293_DB64450C X-CRM114-Status: GOOD ( 34.91 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-5.8 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: [PATCH 12/16] video: add base MIPI DSI support X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) The generic MIPI DSI support is very straight forward and is mostly helper functions to talk with a panel as well as a mipi-dsi bus to connect hosts with panels. Import the support from Linux v6.15. Signed-off-by: Ahmad Fatoum --- drivers/video/Kconfig | 7 + drivers/video/Makefile | 1 + drivers/video/mipi_dsi.c | 1730 ++++++++++++++++++++++++++++++++++++++ include/video/mipi_dsi.h | 618 ++++++++++++++ 4 files changed, 2356 insertions(+) create mode 100644 drivers/video/mipi_dsi.c create mode 100644 include/video/mipi_dsi.h diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index ef19948219f3..4ad7cd6b25d4 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -119,6 +119,13 @@ config DRIVER_VIDEO_EDID config DRIVER_VIDEO_MIPI_DBI bool +config DRIVER_VIDEO_MIPI_DSI + bool + help + Support MIPI DSI interface for driving a MIPI compatible device. + The MIPI Display Serial Interface (MIPI DSI) defines a high-speed + serial interface between a host processor and a display module. + config DRIVER_VIDEO_BACKLIGHT bool "Add backlight support" help diff --git a/drivers/video/Makefile b/drivers/video/Makefile index dde1da1bb98b..9a222fb370aa 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_DRIVER_VIDEO_MTL017) += mtl017.o obj-$(CONFIG_DRIVER_VIDEO_TC358767) += tc358767.o obj-$(CONFIG_DRIVER_VIDEO_SIMPLE_PANEL) += simple-panel.o obj-$(CONFIG_DRIVER_VIDEO_MIPI_DBI) += mipi_dbi.o +obj-$(CONFIG_DRIVER_VIDEO_MIPI_DSI) += mipi_dsi.o obj-$(CONFIG_DRIVER_VIDEO_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o obj-$(CONFIG_DRIVER_VIDEO_PANEL_MIPI_DBI) += panel-mipi-dbi.o obj-$(CONFIG_DRIVER_VIDEO_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o diff --git a/drivers/video/mipi_dsi.c b/drivers/video/mipi_dsi.c new file mode 100644 index 000000000000..91dcd5b10fc0 --- /dev/null +++ b/drivers/video/mipi_dsi.c @@ -0,0 +1,1730 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * MIPI DSI Bus + * + * Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd. + * Copyright (C) 2019 STMicroelectronics - All Rights Reserved + * Andrzej Hajda + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Mipi_dsi.c contains a set of dsi helpers. + * This file is inspired from the drm helper file drivers/gpu/drm/drm_mipi_dsi.c + * (kernel linux). + * + */ + +#include