From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Sun, 08 Nov 2026 11:12:27 +0100 Received: from mx1.white.stw.pengutronix.de ([185.203.200.13]) 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 1xPzsw-008e5J-23 for lore@lore.pengutronix.de; Sun, 08 Nov 2026 11:12:27 +0100 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPS id 5D1F2200A41 for ; Sun, 08 Nov 2026 11:12:26 +0100 (CET) Authentication-Results: mx1.white.stw.pengutronix.de; dkim=pass header.d=lists.infradead.org header.s=bombadil.20210309 header.b=LoBlm1k3; spf=pass (mx1.white.stw.pengutronix.de: domain of "barebox-bounces+lore=pengutronix.de@lists.infradead.org" designates 2607:7c80:54:3::133 as permitted sender) smtp.mailfrom="barebox-bounces+lore=pengutronix.de@lists.infradead.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1794132746; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=cMXqdFxdg5vZAHaBO3i93QDpOonrMXQpJMThpAzQsk8=; b=BK5hZD3wiz9RHwHYzkrL4HxnYXlHgh7RJOFEjGvJKm7uRJUTuxeUXgSfGzMv4pJ1r4/fd8 MLnvzGlvTm4LIx1vNoBjUiebYNTsqC4Xqapr0wse+p0RXzchGPWPIXEA7l/rJxgs8P3TFn sNDm9nDaIS40W+AA2EPOhC9h7Yk/9UavpKgAnDrV95luDOCGsZnRB/0l4gwxPX6/hFbUpy 7baxbSwjeHnXaHcxSdRqAaVo7MHr46PmWpUisrRvx9/0ALYdKRtrnqtm1UUZwv2W6lkAI1 MQzstAeSx/Vf2Gop0qJayQC1kPpMTLJTDjcnwYxAb4yD6oFC/DQtjUsq3CuHDA== ARC-Authentication-Results: i=1; mx1.white.stw.pengutronix.de; dkim=pass header.d=lists.infradead.org header.s=bombadil.20210309 header.b=LoBlm1k3; spf=pass (mx1.white.stw.pengutronix.de: domain of "barebox-bounces+lore=pengutronix.de@lists.infradead.org" designates 2607:7c80:54:3::133 as permitted sender) smtp.mailfrom="barebox-bounces+lore=pengutronix.de@lists.infradead.org"; dmarc=none ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1794132746; a=rsa-sha256; cv=none; b=J2ltpF4ie2FWpY0yPV6OCu93b2PCOz+hnTI6HI+wg3VrswkQg/CCvagSMciA+lyFAYpwPF vQxMbP8ZQZVKSrm+jdGzSnuAvIS2HpuulhmGtKKYke0QdZ0o8k8iUtC75S9ze6YZCjhkAt wXdE22xGJrsOa+GzQ+Or9D/NoAHJUqQPGKtwxuGgMVVzUdqxGkjZ7a46rkAHFqVm6DA4r4 pGrH54PUqZu9QA3DbsPGXLRvzd/ASUywqt10ki3+qgsXyUt2huD/pOFL/hPNDX7zmeKph5 yh35Ck1t5ZGWHcThc4mXG16k+xakbOWrtbi3WLTR1mfK+b3HlCisjUW1VMKcUg== 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: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=cMXqdFxdg5vZAHaBO3i93QDpOonrMXQpJMThpAzQsk8=; b=LoBlm1k3DGkWVm JLySfkxxtfXreZwxYERmlqGRKDR44pRIb7k/pOdNxG8Itqz9yBNq8GV4LC3+XnsWAoAnPdnIqfvIZ izCQyM5ECyITPmJ64+G1h9C41MlrAgYQk9/95LG7qpLqJF+3zwiN7t3qMrqNoI9YqeeyTH1sgSKVp rAFv+QI0h8uxXZdWGj53cOfCp54T8T+1XaDQ4i72IKe6KqWZ5+bpoxickDWK+Oot4kXd84C6PAU1f lcXWoyNVnSDTT+/HXPRiaXn7qXT2IisaZ2G6b9GXrsiuKENVBdjG4YUUGKXX60CFVojTGP9+waNgo MQqAvGpZnOpB1ovOJJ/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xPzro-0000000FwvY-2XJT; Sun, 08 Nov 2026 10:11:16 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xPzrl-0000000Fwtd-1s9R for barebox@lists.infradead.org; Sun, 08 Nov 2026 10:11:15 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=geraet.lan) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1xPzrj-0006Qx-OE; Sun, 08 Nov 2026 11:11:11 +0100 From: Ahmad Fatoum To: barebox@lists.infradead.org Cc: Ahmad Fatoum Subject: [PATCH 4/4] commands: mipi_dsi: add command for easier DCS experimentation Date: Sun, 8 Nov 2026 11:10:54 +0100 Message-ID: <20261108101110.1270196-4-a.fatoum@barebox.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261108101110.1270196-1-a.fatoum@barebox.org> References: <20261108101110.1270196-1-a.fatoum@barebox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@barebox.org X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261108_021113_790456_F042D8B6 X-CRM114-Status: GOOD ( 29.27 ) X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: To simplify MIPI DSI panel bring up, add a mipi_dsi command along the same lines as the mipi_dbi, which lists DSI devices, sends DCS writes and reads back registers, so this can be done from the shell [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a0a:edc0:2:b01:1d:0:0:104 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 DMARC_MISSING Missing DMARC policy 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-Rspamd-Server: mx1 X-Rspamd-Queue-Id: 5D1F2200A41 X-Spamd-Result: default: False [-6.61 / 15.00]; BAYES_HAM(-3.00)[100.00%]; DWL_DNSWL_MED(-2.00)[infradead.org:dkim]; MID_CONTAINS_FROM(1.00)[]; KNOWN_LIST_ID(-1.00)[barebox.lists.infradead.org]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCVD_IN_DNSWL_MED(-0.40)[2a0a:edc0:0:900:1d::77:received,2607:7c80:54:3::133:from]; R_SPF_ALLOW(-0.20)[+mx:c]; MAILLIST(-0.20)[mailman]; R_DKIM_ALLOW(-0.20)[lists.infradead.org:s=bombadil.20210309]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[3]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[barebox.org]; RECEIVED_HELO_LOCALHOST(0.00)[]; ARC_NA(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[]; TAGGED_FROM(0.00)[lore=pengutronix.de]; NEURAL_HAM(-0.00)[-1.000]; FROM_NEQ_ENVFROM(0.00)[a.fatoum@barebox.org,barebox-bounces@lists.infradead.org]; FROM_HAS_DN(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:7247, ipnet:2607:7c80:54::/48, country:US]; DKIM_TRACE(0.00)[lists.infradead.org:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ARC_SIGNED(0.00)[pengutronix.de:s=20260414:i=1]; RCVD_IN_DNSWL_NONE(0.00)[2a0a:edc0:2:b01:1d::104:received] X-Rspamd-Action: no action X-Stat-Signature: b738o9rm3bc89zs14rmw1jsboy4qj6hf To simplify MIPI DSI panel bring up, add a mipi_dsi command along the same lines as the mipi_dbi, which lists DSI devices, sends DCS writes and reads back registers, so this can be done from the shell. Like the mipi_dbi command, the register dump only reads known read commands. The panel executes the command byte of a DCS read request: dumping 0x00-0xff unconditionally soft-reset the OTM8009A on the STM32MP157C-DK2 and put it into sleep mode. Tested on the STM32MP157C-DK2 (OTM8009A) and the Powkiddy RGB30 (ST7703). Signed-off-by: Ahmad Fatoum --- arch/arm/configs/stm32mp_defconfig | 1 + commands/Kconfig | 27 +++ commands/Makefile | 1 + commands/mipi_dsi.c | 355 +++++++++++++++++++++++++++++ test/py/test_mipi_dsi.py | 78 +++++++ 5 files changed, 462 insertions(+) create mode 100644 commands/mipi_dsi.c create mode 100644 test/py/test_mipi_dsi.py diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig index e1aef7c86fc0..13aed489ccea 100644 --- a/arch/arm/configs/stm32mp_defconfig +++ b/arch/arm/configs/stm32mp_defconfig @@ -95,6 +95,7 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_LED=y CONFIG_CMD_POWEROFF=y CONFIG_CMD_SPI=y +CONFIG_CMD_MIPI_DSI=y CONFIG_CMD_USBGADGET=y CONFIG_CMD_WD=y CONFIG_CMD_BAREBOX_UPDATE=y diff --git a/commands/Kconfig b/commands/Kconfig index a43f0fbd4d40..eb4067d8108c 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -2263,6 +2263,33 @@ config CMD_MIPI_DBI -d DEVICE select specific device (default is first registered) -w issue write command +config CMD_MIPI_DSI + bool + depends on DRIVER_VIDEO_MIPI_DSI + select PRINTF_HEXSTR + prompt "mipi_dsi command" + help + read/write DCS registers of MIPI DSI devices + + Usage: mipi_dsi [-lvdinwgLH] [-c CH] [-p on|off] [CMD] [DATA...] + + Without CMD, dump the standard DCS registers. + CMD and DATA bytes are given in hex. + + Options: + -l list all MIPI DSI devices + -v list with host, channel, lanes, format and mode flags + -d DEVICE select specific device (default is first registered) + -i read the panel identification registers + -n LEN number of bytes to read (default: known length, else 1) + -w issue write command + -g send generic packets: CMD and DATA are the payload, + reads take up to two bytes + -p on|off send Turn On or Shutdown Peripheral + -c CH use virtual channel CH (0-3) + -L send in low power mode + -H send in high speed mode + config CMD_LED_TRIGGER bool depends on LED_TRIGGERS diff --git a/commands/Makefile b/commands/Makefile index 7dae582225f5..f91f6335ff8e 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_CMD_I2C) += i2c.o obj-$(CONFIG_CMD_SPI) += spi.o obj-$(CONFIG_CMD_PWM) += pwm.o obj-$(CONFIG_CMD_MIPI_DBI) += mipi_dbi.o +obj-$(CONFIG_CMD_MIPI_DSI) += mipi_dsi.o obj-$(CONFIG_CMD_UBI) += ubi.o obj-$(CONFIG_CMD_UBIFORMAT) += ubiformat.o obj-$(CONFIG_CMD_MENU) += menu.o diff --git a/commands/mipi_dsi.c b/commands/mipi_dsi.c new file mode 100644 index 000000000000..ccef279b9830 --- /dev/null +++ b/commands/mipi_dsi.c @@ -0,0 +1,355 @@ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: © 2025 Ahmad Fatoum + +#include +#include +#include