Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>,
	 Jessica Zhang <jesszhan0024@gmail.com>,
	David Airlie <airlied@gmail.com>,
	 Simona Vetter <simona@ffwll.ch>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	 Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	 Florian Fainelli <florian.fainelli@broadcom.com>,
	 Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	 Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	 Luca Ceresoli <luca.ceresoli@bootlin.com>,
	 Albert Esteve <aesteve@redhat.com>,
	 Dave Stevenson <dave.stevenson@raspberrypi.com>,
	 Javier Martinez Canillas <javierm@redhat.com>,
	 dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	llvm@lists.linux.dev,  linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	 Maxime Ripard <mripard@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>
Subject: [PATCH 5/6] drm/panel: dsi-bpf: Add Raspberry Pi 5-inch panel BPF program
Date: Mon, 28 Sep 2026 18:22:05 +0200	[thread overview]
Message-ID: <20260928-drm-mipi-dsi-panel-ebpf-v1-5-5244926aace4@kernel.org> (raw)
In-Reply-To: <20260928-drm-mipi-dsi-panel-ebpf-v1-0-5244926aace4@kernel.org>

Translate the raspberrypi,dsi-5inch initialization sequence from
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c into a BPF program.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 .../panel/bpf/progs/Raspberrypi__dsi-7inch.bpf.c   | 271 +++++++++++++++++++++
 1 file changed, 271 insertions(+)

diff --git a/drivers/gpu/drm/panel/bpf/progs/Raspberrypi__dsi-7inch.bpf.c b/drivers/gpu/drm/panel/bpf/progs/Raspberrypi__dsi-7inch.bpf.c
new file mode 100644
index 000000000000..2055828de2f4
--- /dev/null
+++ b/drivers/gpu/drm/panel/bpf/progs/Raspberrypi__dsi-7inch.bpf.c
@@ -0,0 +1,271 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * BPF panel program for Raspberry Pi 7-inch MIPI-DSI panel (ILI9881C)
+ *
+ * Translated from drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+ * (rpi_7inch_init[] / rpi_7inch_desc)
+ */
+
+#include "vmlinux.h"
+#include "panel-bpf-mipi-dsi.h"
+#include <bpf/bpf_tracing.h>
+
+#define PAGE(p) do {						\
+	const __u8 _d[] = { 0x98, 0x81, (p) };			\
+	panel_bpf_mipi_dsi_dcs_write(pctx, 0xff, _d, sizeof(_d));\
+} while (0)
+
+#define CMD(c, d) panel_bpf_mipi_dsi_dcs_write_byte(pctx, (c), (d))
+
+SEC(PANEL_BPF_MIPI_DSI_PREPARE)
+int BPF_PROG(panel_prepare, struct panel_bpf_mipi_dsi_ctx *pctx)
+{
+	int ret;
+
+	ret = panel_bpf_mipi_dsi_regulator_enable_and_wait(pctx, PANEL_BPF_MIPI_DSI_SUPPLY_IOVCC, 5);
+	if (ret)
+		return ret;
+
+	ret = panel_bpf_mipi_dsi_regulator_enable_and_wait(pctx, PANEL_BPF_MIPI_DSI_SUPPLY_VCC, 5);
+	if (ret)
+		return ret;
+
+	panel_bpf_mipi_dsi_gpio_cycle_and_wait(pctx, PANEL_BPF_MIPI_DSI_GPIO_RESET, 20, 20);
+
+	/* Page 3 */
+	PAGE(3);
+	CMD(0x01, 0x00);
+	CMD(0x02, 0x00);
+	CMD(0x03, 0x73);
+	CMD(0x04, 0x00);
+	CMD(0x05, 0x00);
+	CMD(0x06, 0x0a);
+	CMD(0x07, 0x00);
+	CMD(0x08, 0x00);
+	CMD(0x09, 0x61);
+	CMD(0x0a, 0x00);
+	CMD(0x0b, 0x00);
+	CMD(0x0c, 0x01);
+	CMD(0x0d, 0x00);
+	CMD(0x0e, 0x00);
+	CMD(0x0f, 0x61);
+	CMD(0x10, 0x61);
+	CMD(0x11, 0x00);
+	CMD(0x12, 0x00);
+	CMD(0x13, 0x00);
+	CMD(0x14, 0x00);
+	CMD(0x15, 0x00);
+	CMD(0x16, 0x00);
+	CMD(0x17, 0x00);
+	CMD(0x18, 0x00);
+	CMD(0x19, 0x00);
+	CMD(0x1a, 0x00);
+	CMD(0x1b, 0x00);
+	CMD(0x1c, 0x00);
+	CMD(0x1d, 0x00);
+	CMD(0x1e, 0x40);
+	CMD(0x1f, 0x80);
+	CMD(0x20, 0x06);
+	CMD(0x21, 0x01);
+	CMD(0x22, 0x00);
+	CMD(0x23, 0x00);
+	CMD(0x24, 0x00);
+	CMD(0x25, 0x00);
+	CMD(0x26, 0x00);
+	CMD(0x27, 0x00);
+	CMD(0x28, 0x33);
+	CMD(0x29, 0x03);
+	CMD(0x2a, 0x00);
+	CMD(0x2b, 0x00);
+	CMD(0x2c, 0x00);
+	CMD(0x2d, 0x00);
+	CMD(0x2e, 0x00);
+	CMD(0x2f, 0x00);
+	CMD(0x30, 0x00);
+	CMD(0x31, 0x00);
+	CMD(0x32, 0x00);
+	CMD(0x33, 0x00);
+	CMD(0x34, 0x04);
+	CMD(0x35, 0x00);
+	CMD(0x36, 0x00);
+	CMD(0x37, 0x00);
+	CMD(0x38, 0x3c);
+	CMD(0x39, 0x00);
+	CMD(0x3a, 0x00);
+	CMD(0x3b, 0x00);
+	CMD(0x3c, 0x00);
+	CMD(0x3d, 0x00);
+	CMD(0x3e, 0x00);
+	CMD(0x3f, 0x00);
+	CMD(0x40, 0x00);
+	CMD(0x41, 0x00);
+	CMD(0x42, 0x00);
+	CMD(0x43, 0x00);
+	CMD(0x44, 0x00);
+	CMD(0x50, 0x10);
+	CMD(0x51, 0x32);
+	CMD(0x52, 0x54);
+	CMD(0x53, 0x76);
+	CMD(0x54, 0x98);
+	CMD(0x55, 0xba);
+	CMD(0x56, 0x10);
+	CMD(0x57, 0x32);
+	CMD(0x58, 0x54);
+	CMD(0x59, 0x76);
+	CMD(0x5a, 0x98);
+	CMD(0x5b, 0xba);
+	CMD(0x5c, 0xdc);
+	CMD(0x5d, 0xfe);
+	CMD(0x5e, 0x00);
+	CMD(0x5f, 0x0e);
+	CMD(0x60, 0x0f);
+	CMD(0x61, 0x0c);
+	CMD(0x62, 0x0d);
+	CMD(0x63, 0x06);
+	CMD(0x64, 0x07);
+	CMD(0x65, 0x02);
+	CMD(0x66, 0x02);
+	CMD(0x67, 0x02);
+	CMD(0x68, 0x02);
+	CMD(0x69, 0x01);
+	CMD(0x6a, 0x00);
+	CMD(0x6b, 0x02);
+	CMD(0x6c, 0x15);
+	CMD(0x6d, 0x14);
+	CMD(0x6e, 0x02);
+	CMD(0x6f, 0x02);
+	CMD(0x70, 0x02);
+	CMD(0x71, 0x02);
+	CMD(0x72, 0x02);
+	CMD(0x73, 0x02);
+	CMD(0x74, 0x02);
+	CMD(0x75, 0x0e);
+	CMD(0x76, 0x0f);
+	CMD(0x77, 0x0c);
+	CMD(0x78, 0x0d);
+	CMD(0x79, 0x06);
+	CMD(0x7a, 0x07);
+	CMD(0x7b, 0x02);
+	CMD(0x7c, 0x02);
+	CMD(0x7d, 0x02);
+	CMD(0x7e, 0x02);
+	CMD(0x7f, 0x01);
+	CMD(0x80, 0x00);
+	CMD(0x81, 0x02);
+	CMD(0x82, 0x14);
+	CMD(0x83, 0x15);
+	CMD(0x84, 0x02);
+	CMD(0x85, 0x02);
+	CMD(0x86, 0x02);
+	CMD(0x87, 0x02);
+	CMD(0x88, 0x02);
+	CMD(0x89, 0x02);
+	CMD(0x8a, 0x02);
+
+	/* Page 4 */
+	PAGE(4);
+	CMD(0x6c, 0x15);
+	CMD(0x6e, 0x2a);
+	CMD(0x6f, 0x33);
+	CMD(0x3b, 0x98);
+	CMD(0x3a, 0x94);
+	CMD(0x8d, 0x14);
+	CMD(0x87, 0xba);
+	CMD(0x26, 0x76);
+	CMD(0xb2, 0xd1);
+	CMD(0xb5, 0x06);
+	CMD(0x38, 0x01);
+	CMD(0x39, 0x00);
+
+	/* Page 1 */
+	PAGE(1);
+	CMD(0x22, 0x0a);
+	CMD(0x31, 0x00);
+	CMD(0x53, 0x7d);
+	CMD(0x55, 0x8f);
+	CMD(0x40, 0x33);
+	CMD(0x50, 0x96);
+	CMD(0x51, 0x96);
+	CMD(0x60, 0x23);
+	CMD(0xa0, 0x08);
+	CMD(0xa1, 0x1d);
+	CMD(0xa2, 0x2a);
+	CMD(0xa3, 0x10);
+	CMD(0xa4, 0x15);
+	CMD(0xa5, 0x28);
+	CMD(0xa6, 0x1c);
+	CMD(0xa7, 0x1d);
+	CMD(0xa8, 0x7e);
+	CMD(0xa9, 0x1d);
+	CMD(0xaa, 0x29);
+	CMD(0xab, 0x6b);
+	CMD(0xac, 0x1a);
+	CMD(0xad, 0x18);
+	CMD(0xae, 0x4b);
+	CMD(0xaf, 0x20);
+	CMD(0xb0, 0x27);
+	CMD(0xb1, 0x50);
+	CMD(0xb2, 0x64);
+	CMD(0xb3, 0x39);
+	CMD(0xc0, 0x08);
+	CMD(0xc1, 0x1d);
+	CMD(0xc2, 0x2a);
+	CMD(0xc3, 0x10);
+	CMD(0xc4, 0x15);
+	CMD(0xc5, 0x28);
+	CMD(0xc6, 0x1c);
+	CMD(0xc7, 0x1d);
+	CMD(0xc8, 0x7e);
+	CMD(0xc9, 0x1d);
+	CMD(0xca, 0x29);
+	CMD(0xcb, 0x6b);
+	CMD(0xcc, 0x1a);
+	CMD(0xcd, 0x18);
+	CMD(0xce, 0x4b);
+	CMD(0xcf, 0x20);
+	CMD(0xd0, 0x27);
+	CMD(0xd1, 0x50);
+	CMD(0xd2, 0x64);
+	CMD(0xd3, 0x39);
+
+	/* Switch to page 0 and finalize */
+	PAGE(0);
+
+	/* set_tear_on with VBLANK mode (0x00) */
+	CMD(0x35, 0x00);
+
+	ret = panel_bpf_mipi_dsi_exit_sleep_mode(pctx);
+	if (ret)
+		return ret;
+
+	ret = panel_bpf_mipi_dsi_set_display_on(pctx);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+SEC(PANEL_BPF_MIPI_DSI_UNPREPARE)
+int BPF_PROG(panel_unprepare, struct panel_bpf_mipi_dsi_ctx *pctx)
+{
+	panel_bpf_mipi_dsi_set_display_off(pctx);
+	panel_bpf_mipi_dsi_enter_sleep_mode(pctx);
+
+	panel_bpf_mipi_dsi_regulator_disable(pctx, PANEL_BPF_MIPI_DSI_SUPPLY_VCC);
+	panel_bpf_mipi_dsi_regulator_disable(pctx, PANEL_BPF_MIPI_DSI_SUPPLY_IOVCC);
+	panel_bpf_mipi_dsi_gpio_enable(pctx, PANEL_BPF_MIPI_DSI_GPIO_RESET);
+
+	return 0;
+}
+
+PANEL_BPF_MIPI_DSI_OPS(raspberrypi_dsi_7inch) = {
+	.panel_id		= "/soc/dsi@7e700000/panel@0",
+	.compatible		= "raspberrypi,dsi-7inch",
+	.format			= MIPI_DSI_FMT_RGB888,
+	.lanes			= 2,
+	.mode_flags		= MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM,
+	.panel_prepare		= (void *)panel_prepare,
+	.panel_unprepare	= (void *)panel_unprepare,
+};
+
+char _license[] SEC("license") = "GPL";

-- 
2.55.0



  parent reply	other threads:[~2026-09-28 16:23 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 16:22 [PATCH 0/6] drm/bridge: Add a BPF-based MIPI-DSI panel driver Maxime Ripard
2026-09-28 16:22 ` [PATCH 1/6] dt-bindings: display: Add panel-mipi-dsi-bpf generic panel binding Maxime Ripard
2026-09-28 19:16   ` Neil Armstrong
2026-09-28 20:40   ` Rob Herring
2026-09-29  8:39     ` Maxime Ripard
2026-09-29 22:28       ` Rob Herring
2026-09-30  8:04         ` Maxime Ripard
2026-09-30 19:07           ` Rob Herring
2026-10-01  7:22             ` Maxime Ripard
2026-10-01 16:03               ` Rob Herring
2026-09-30 13:32       ` Neil Armstrong
2026-10-01  7:09         ` Maxime Ripard
2026-10-02  7:28           ` Neil Armstrong
2026-09-28 20:43   ` Rob Herring (Arm)
2026-09-29 23:44   ` bot+bpf-ci
2026-09-28 16:22 ` [PATCH 2/6] drm/panel: Add generic MIPI-DSI panel driver with BPF init sequences Maxime Ripard
2026-09-28 16:22 ` [PATCH 3/6] drm/panel: dsi-bpf: Add BPF program build infrastructure and helper header Maxime Ripard
2026-09-29 23:44   ` bot+bpf-ci
2026-09-28 16:22 ` [PATCH 4/6] drm/panel: dsi-bpf: Add Raspberry Pi 7-inch panel BPF program Maxime Ripard
2026-09-28 16:22 ` Maxime Ripard [this message]
2026-09-28 16:22 ` [PATCH DO NOT MERGE 6/6] arm64: dts: broadcom: Add Raspberry Pi ILI9881C DSI panel overlays Maxime Ripard
2026-09-28 16:37 ` [PATCH 0/6] drm/bridge: Add a BPF-based MIPI-DSI panel driver Laurent Pinchart
2026-09-28 17:31   ` Benjamin Tissoires
2026-09-28 18:12     ` Laurent Pinchart
2026-09-29  6:54   ` Maxime Ripard
2026-09-28 16:39 ` Neil Armstrong
2026-09-28 17:24   ` Benjamin Tissoires
2026-09-28 19:20     ` Neil Armstrong
2026-09-28 19:48       ` Benjamin Tissoires
2026-09-28 20:36         ` Neil Armstrong
2026-09-29  7:41           ` Maxime Ripard
2026-09-29  7:55             ` Javier Martinez Canillas
2026-09-30 13:37               ` Neil Armstrong
2026-10-01  6:50                 ` Maxime Ripard
2026-10-02  7:30                   ` Neil Armstrong
2026-10-02  7:37                     ` Javier Martinez Canillas
2026-10-02  7:53                       ` Neil Armstrong
2026-10-02  9:04                         ` Javier Martinez Canillas
2026-09-30 13:36             ` Neil Armstrong
2026-09-30 20:59               ` Kumar Kartikeya Dwivedi
2026-10-01  6:38               ` Maxime Ripard
2026-10-01 17:03               ` Maxime Ripard
2026-09-29  7:27       ` Maxime Ripard
2026-09-30 13:49         ` Neil Armstrong
2026-10-01  7:01           ` Maxime Ripard
2026-10-02  7:39             ` Neil Armstrong
2026-09-29  7:13   ` Maxime Ripard
2026-09-29  7:46     ` Benjamin Tissoires
2026-09-30 13:46     ` Neil Armstrong
2026-10-01  6:48       ` Maxime Ripard
2026-10-02  8:11         ` Neil Armstrong
2026-09-29  9:03 ` Jani Nikula
2026-09-29  9:32   ` Benjamin Tissoires
2026-09-29 10:16     ` Jani Nikula
2026-09-29 12:28       ` Maxime Ripard
2026-09-30 14:01   ` Neil Armstrong
2026-09-30 19:18     ` Jani Nikula
2026-10-01  7:05     ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260928-drm-mipi-dsi-panel-ebpf-v1-5-5244926aace4@kernel.org \
    --to=mripard@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aesteve@redhat.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bentiss@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=javierm@redhat.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jesszhan0024@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=justinstitt@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=luca.ceresoli@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox